예제 #1
0
파일: Ability.cs 프로젝트: dzikun/WarEmu
 public Ability(AbilityInterface Interface, Ability Parent, Ability_Stats Info, Unit Caster, bool IsBuff, ushort Px, ushort Py, ushort Pz, ushort ZoneId, string OverrideHandler = "")
     : this(Interface, Parent, Info, Caster, IsBuff, OverrideHandler)
 {
     this.Px = Px;
     this.Py = Py;
     this.Pz = Pz;
     this.ZoneId = ZoneId;
 }
예제 #2
0
파일: Ability.cs 프로젝트: dzikun/WarEmu
        public Ability(AbilityInterface Interface, Ability Parent, Ability_Stats Info, Unit Caster, bool IsBuff, string OverrideHandler = "")
        {
            this.Parent = Parent;
            this.Info = Info;
            this.Caster = Caster;
            this.Interface = Interface;
            if (OverrideHandler == "")
                this.Handler = AbilityMgr.GetAbilityHandler(Info.Entry, Info.Info.HandlerName);
            else
                this.Handler = AbilityMgr.GetAbilityHandler(0, OverrideHandler);

            this.IsBuff = IsBuff;

            if (Handler != null)
                Handler.InitAbility(this);
        }
예제 #3
0
        public GameData.AbilityResult CanCast(Ability_Stats Info, bool CheckCoolDown)
        {
            if (Info.Info.ApCost > GetPlayer().ActionPoints)
                return GameData.AbilityResult.ABILITYRESULT_AP;
            else if (CheckCoolDown && !CanCastCooldown(0))
                return GameData.AbilityResult.ABILITYRESULT_NOTREADY;
            else if (CheckCoolDown && !CanCastCooldown(Info.Entry))
                return GameData.AbilityResult.ABILITYRESULT_NOTREADY;

            return GameData.AbilityResult.ABILITYRESULT_OK;
        }
예제 #4
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);
        }
예제 #5
0
파일: Ability.cs 프로젝트: dzikun/WarEmu
        public void SendSpellEffect(Object Caster, Unit Target, UInt16 RealDamage, UInt16 Damage, Ability_Stats Ability = null)
        {
            if (Target == null)
                return;

            // Frappe
            /*{
                PacketOut Out = new PacketOut((byte)Opcodes.F_USE_ABILITY);
                Out.WriteUInt16(Target.Oid);
                Out.WriteUInt16(Ability.Entry);
                Out.WriteUInt16(Caster.Oid);
                Out.WriteUInt16(Ability.EffectID);

                Out.WriteUInt16(Target.Oid);
                Out.WriteByte(6);
                Out.WriteByte(1);
                Out.WriteUInt16(0);
                Out.WriteUInt32(0x023F0C00);
                Out.WriteUInt16(0);

                Caster.DispatchPacket(Out, true);
            }

            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_CAST_PLAYER_EFFECT);
                Out.WriteUInt16(Caster.Oid);
                Out.WriteUInt16(Target.Oid);
                Out.WriteUInt16(Ability.Entry);
                Out.WriteByte(2);
                Out.WriteByte((byte)GameData.CombatEvent.COMBATEVENT_ABILITY_HIT);
                Out.WriteByte(7);
                Out.WriteUInt16(0x0799);
                Out.WriteByte(0);
                Caster.DispatchPacket(Out, true);
            }*/
        }