Beispiel #1
0
        public bool Run(T ths, IMagicalDefinition definition)
        {
            MagicControl control = MagicControl.GetBestControl(ths.Actor, definition);

            if (control == null)
            {
                return(false);
            }

            mWand = control.InitialPrep(ths.Actor, definition, out mWandCreated);
            if (mWand == null)
            {
                return(false);
            }

            mWand.PrepareForUse(ths.Actor);

            ths.Wand = mWand;

            bool twoPerson = (ths.Actor == ths.Target);

            if (!Hybrid.Settings.mEnforceTwoPersonAnimation)
            {
                twoPerson = false;
            }

            bool spellCastingEpiclyFailed;
            bool spellCastingSucceeded = !IsFailure(ths.Actor, control, definition, out spellCastingEpiclyFailed);

            if (!EpicFailureAllowed(ths))
            {
                spellCastingEpiclyFailed = false;
            }

            if (!InitialPrep(ths, twoPerson, definition, control, spellCastingSucceeded, spellCastingEpiclyFailed))
            {
                return(false);
            }

            ths.StandardEntry();
            ths.BeginCommodityUpdates();

            if (!SetupAnimation(ths, control, twoPerson))
            {
                return(false);
            }

            control.ConsumeMana(ths.Actor, this, definition);

            if (!PerformResults(ths, "EpicFail", definition, control, spellCastingSucceeded, spellCastingEpiclyFailed))
            {
                mSucceeded = false;
            }

            EventTracker.SendEvent(EventTypeId.kCastSpell, ths.Actor);
            ths.EndCommodityUpdates(mSucceeded);
            ths.StandardExit();
            return(mSucceeded);
        }