コード例 #1
0
        public void Cast(Ability_Stats Info, ushort Px, ushort Py, ushort Pz, ushort ZoneId)
        {
            GameData.AbilityResult Result = CanCast(Info, true);

            if (Result == GameData.AbilityResult.ABILITYRESULT_OK)
            {
                Ability NewAbility = new Ability(this, null, Info, _Owner.GetUnit(), false, Px, Py, Pz, ZoneId);

                if (NewAbility.Handler != null)
                {
                    Result = NewAbility.Handler.CanCast(true);
                }

                if (NewAbility.Handler == null || Result == GameData.AbilityResult.ABILITYRESULT_OK)
                {
                    //Log.Info("Cast", Info.Entry.ToString() + ":" + Info.Description + " : " + Info.Damages1);
                    SetCooldown(0, GlobalMSCoolDown);
                    CurrentAbility = NewAbility;
                    CurrentAbility.Start();
                    SetCooldown(Info.Entry, Info.Info.Cooldown * 1000);
                }
                else
                {
                    Cancel(false);
                }
            }
            else
            {
                Cancel(false);
            }
        }
コード例 #2
0
        public void StartCast(ushort AbilityID)
        {
            Ability_Info Info = GetAbility(AbilityID);

            if (Info == null)
            {
                return;
            }

            if (IsCasting() && CurrentAbility.Info == Info)
            {
                return;
            }

            Log.Info("AbilityInterface", "StartCast : " + AbilityID);

            if (CurrentAbility != null)
            {
                CurrentAbility.Stop();
                CurrentAbility = null;
            }

            GameData.AbilityResult Result = CanCast(Info);

            if (Result == GameData.AbilityResult.ABILITYRESULT_OK)
            {
                LastCast = TCPServer.GetTimeStampMS();

                CurrentAbility = new Ability(Info, Obj);
                CurrentAbility.Start();

                if (CurrentAbility.Handler != null)
                {
                    Result = CurrentAbility.Handler.CanCast();
                }

                Log.Info("Cast", "CastResult = " + Result);

                if (CurrentAbility.Handler == null || Result == GameData.AbilityResult.ABILITYRESULT_OK)
                {
                    Obj.GetUnit().ActionPoints -= Info.ActionPoints;
                    if (Obj.IsPlayer())
                    {
                        Obj.GetPlayer().SendHealh();
                    }
                }
                else
                {
                    CurrentAbility.Stop();
                }
            }
        }
コード例 #3
0
        public IAbilityTypeHandler AddBuff(Ability Parent, string NewHandler)
        {
            Ability Current = GetBuff(Parent.Info.Entry);

            if (Current != null && Current.Info.Level == Parent.Info.Level)
            {
                Current.Reset();
                return(Current.Handler);
            }
            else if (Current != null && Current.Info.Level > Parent.Info.Level)
            {
                return(null);
            }
            else
            {
                if (Current != null && Current.Info.Level < Parent.Info.Level)
                {
                    Current.Stop();
                }

                byte    Id = (byte)GetBuffId();
                Ability Ab = new Ability(this, Parent, Parent.Info, Parent.Caster, true, NewHandler);
                Ab.BuffId = (byte)(Id + 1);
                Ab.Start();
                Ab.Reset();

                if (Id >= ActiveBuff.Count)
                {
                    ActiveBuff.Add(Ab);
                }
                else
                {
                    ActiveBuff[Id] = Ab;
                }

                Log.Info("AddBuff", _Owner.Name + "," + Ab.Handler);
                return(Ab.Handler);
            }
        }
コード例 #4
0
ファイル: AbilityInterface.cs プロジェクト: dzikun/WarEmu
        public IAbilityTypeHandler AddBuff(Ability Parent, string NewHandler)
        {
            Ability Current = GetBuff(Parent.Info.Entry);
            if (Current != null && Current.Info.Level == Parent.Info.Level)
            {
                Current.Reset();
                return Current.Handler;
            }
            else if (Current != null && Current.Info.Level > Parent.Info.Level)
                return null;
            else
            {
                if (Current != null && Current.Info.Level < Parent.Info.Level)
                    Current.Stop();

                byte Id = (byte)GetBuffId();
                Ability Ab = new Ability(this, Parent, Parent.Info, Parent.Caster, true, NewHandler);
                Ab.BuffId = (byte)(Id + 1);
                Ab.Start();
                Ab.Reset();

                if (Id >= ActiveBuff.Count)
                    ActiveBuff.Add(Ab);
                else
                    ActiveBuff[Id] = Ab;

                Log.Info("AddBuff", _Owner.Name + "," + Ab.Handler);
                return Ab.Handler;
            }
        }
コード例 #5
0
ファイル: AbilityInterface.cs プロジェクト: dzikun/WarEmu
        public void Cast(Ability_Stats Info, ushort Px, ushort Py,ushort Pz, ushort ZoneId)
        {
            GameData.AbilityResult Result = CanCast(Info, true);

            if (Result == GameData.AbilityResult.ABILITYRESULT_OK)
            {
                Ability NewAbility = new Ability(this, null, Info, _Owner.GetUnit(),false, Px, Py, Pz, ZoneId);

                if (NewAbility.Handler != null)
                    Result = NewAbility.Handler.CanCast(true);

                if (NewAbility.Handler == null || Result == GameData.AbilityResult.ABILITYRESULT_OK)
                {
                    //Log.Info("Cast", Info.Entry.ToString() + ":" + Info.Description + " : " + Info.Damages1);
                    SetCooldown(0, GlobalMSCoolDown);
                    CurrentAbility = NewAbility;
                    CurrentAbility.Start();
                    SetCooldown(Info.Entry, Info.Info.Cooldown * 1000);
                }
                else
                    Cancel(false);
            }
            else
                Cancel(false);
        }
コード例 #6
0
        public void StartCast(ushort AbilityID)
        {
            Ability_Info Info = GetAbility(AbilityID);
            if (Info == null)
                return;

            if (IsCasting() && CurrentAbility.Info == Info)
                return;

            Log.Info("AbilityInterface","StartCast : " + AbilityID);

            if (CurrentAbility != null)
            {
                CurrentAbility.Stop();
                CurrentAbility = null;
            }

            GameData.AbilityResult Result = CanCast(Info);

            if (Result == GameData.AbilityResult.ABILITYRESULT_OK)
            {
                LastCast = TCPServer.GetTimeStampMS();

                CurrentAbility = new Ability(Info, Obj);
                CurrentAbility.Start();

                if (CurrentAbility.Handler != null)
                    Result = CurrentAbility.Handler.CanCast();

                Log.Info("Cast", "CastResult = " + Result);

                if (CurrentAbility.Handler == null || Result == GameData.AbilityResult.ABILITYRESULT_OK)
                {
                    Obj.GetUnit().ActionPoints -= Info.ActionPoints;
                    if (Obj.IsPlayer())
                        Obj.GetPlayer().SendHealh();
                }
                else
                    CurrentAbility.Stop();
            }
        }