コード例 #1
0
        public virtual void OnTaunt(Unit taunter, byte lvl)
        {
            ulong maxHate = 0;

            if (_unit is Pet)
            {
                return;
            }

            AI.Debugger?.SendClientMessage("[MR]: Received taunt from  " + taunter.Name + ".");

            if (!Combat.IsInCombat)
            {
                AI.ProcessCombatStart(taunter);
            }
            else
            {
                AggroInfo info;
                foreach (KeyValuePair <ushort, AggroInfo> kp in Aggros)
                {
                    info = kp.Value;
                    ulong hate = info.GetHate();
                    if (hate > maxHate)
                    {
                        maxHate = hate;
                    }
                }

                uint newHatred = (uint)((300 + 1950 * ((lvl - 1) / 39.0f)) * taunter.StsInterface.GetStatPercentageModifier(Stats.HateCaused));
                AddHatred(taunter, true, newHatred);
            }
        }
        public override void OnAttacked(Unit attacker)
        {
            if (_petOwner.AIMode != (byte)PetCommand.Passive && !_petOwner.IsHeeling && !IgnoreDamageEvents && CurrentTarget == null)
            {
                switch (AIInterface.State)
                {
                case AiState.STANDING:
                    AIInterface.ProcessCombatStart(attacker);
                    break;

                case AiState.MOVING:
                    AIInterface.ProcessCombatStart(attacker);
                    break;
                }
            }

            RefreshCombatTimer();

            _petOwner.Owner.CbtInterface.RefreshCombatTimer();
        }
        public override void OnDealDamage(Unit victim, uint damageCount)
        {
            if (_petOwner.AIMode != (byte)PetCommand.Passive && !_petOwner.IsHeeling && !IgnoreDamageEvents && CurrentTarget == null)
            {
                switch (AIInterface.State)
                {
                case AiState.STANDING:
                    AIInterface.ProcessCombatStart(victim);
                    break;

                case AiState.MOVING:
                    AIInterface.ProcessCombatStart(victim);
                    break;
                }

                _Owner.EvtInterface.Notify(EventName.OnDealDamage, victim, damageCount);
            }

            RefreshCombatTimer();

            _petOwner.Owner.CbtInterface.RefreshCombatTimer();
        }
        public override void OnTakeDamage(Unit fighter, uint damage, float hatredMod, uint mitigation = 0)
        {
            if (_petOwner.AIMode != (byte)PetCommand.Passive && !_petOwner.IsHeeling && !IgnoreDamageEvents && CurrentTarget == null)
            {
                switch (AIInterface.State)
                {
                case AiState.STANDING:
                    AIInterface.ProcessCombatStart(fighter);
                    break;

                case AiState.MOVING:
                    AIInterface.ProcessCombatStart(fighter);
                    break;
                }

                _Owner.EvtInterface.Notify(EventName.OnReceiveDamage, fighter, null);
            }

            RefreshCombatTimer();

            _petOwner.Owner.CbtInterface.RefreshCombatTimer();
        }