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