Exemple #1
0
        public override void StartAttack(GameObject attackTarget)
        {
            if (attackTarget == null)
            {
                return;
            }

            if (attackTarget is GameLiving && GameServer.ServerRules.IsAllowedToAttack(this, (GameLiving)attackTarget, true) == false)
            {
                return;
            }

            if (Brain is IControlledBrain)
            {
                if ((Brain as IControlledBrain).AggressionState == eAggressionState.Passive)
                {
                    return;
                }

                GamePlayer playerowner;
                if ((playerowner = ((IControlledBrain)Brain).GetPlayerOwner()) != null)
                {
                    playerowner.Stealth(false);
                }
            }

            TargetObject = attackTarget;
            if (TargetObject.Realm == 0 || Realm == 0)
            {
                m_lastAttackTickPvE = m_CurrentRegion.Time;
            }
            else
            {
                m_lastAttackTickPvP = m_CurrentRegion.Time;
            }

            if (m_attackers.Count == 0)
            {
                if (SpellTimer == null)
                {
                    SpellTimer = new SpellAction(this);
                }

                if (!SpellTimer.IsAlive)
                {
                    SpellTimer.Start(1);
                }
            }

            if (Brain is TurretMainPetTankBrain)
            {
                base.StartAttack(TargetObject);
            }
        }
Exemple #2
0
        public override void OnAfterSpellCastSequence(ISpellHandler handler)
        {
            if (SpellTimer != null)
            {
                if (this == null || this.ObjectState != eObjectState.Active || !this.IsAlive || this.TargetObject == null || (this.TargetObject is GameLiving && this.TargetObject.ObjectState != eObjectState.Active || !(this.TargetObject as GameLiving).IsAlive))
                {
                    SpellTimer.Stop();
                }
                else
                {
                    SpellTimer.Start(1);
                }
            }
            if (m_runningSpellHandler != null)
            {
                //prevent from relaunch
                m_runningSpellHandler.CastingCompleteEvent -= new CastingCompleteCallback(OnAfterSpellCastSequence);
                m_runningSpellHandler = null;
            }

            Brain.Notify(GameNPCEvent.CastFinished, this, new CastingEventArgs(handler));
        }