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); } }
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(); } } }
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); } }
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; } }
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); }
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(); } }