Beispiel #1
0
        public bool Cast()
        {
            if (IsDone)
            {
                return(false);
            }

            bool CanCast = true;

            if (Caster.AbtInterface.CanCast(Info, false) == GameData.AbilityResult.ABILITYRESULT_OK)
            {
                Caster.ActionPoints -= Info.Info.ApCost;

                if (Info.Info.ApSec == 0)
                {
                    DoneTime = TCPServer.GetTimeStampMS();
                }

                if (Handler != null)
                {
                    if (CanCast && Handler.CanCast(false) == GameData.AbilityResult.ABILITYRESULT_OK)
                    {
                        Caster.EvtInterface.Notify(EventName.ON_CAST, Caster, this);
                        Handler.Cast();
                    }
                    else
                    {
                        Handler.SendDone();
                    }
                }
                else
                {
                    SendAbilityDone(0);
                }

                WorldMgr.GeneralScripts.OnCastAbility(this);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public void Cast()
        {
            Log.Info("Ability", "Cast");

            if (IsDone)
            {
                return;
            }

            IsDone   = true;
            DoneTime = TCPServer.GetTimeStampMS();

            if (Handler != null)
            {
                GameData.AbilityResult Result = Handler.CanCast();

                if (Result == GameData.AbilityResult.ABILITYRESULT_OK)
                {
                    Handler.Cast();
                }
            }
        }