mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Clean up old (and partially unused) Aggro() function and use EnterCombat() instead + fix some minor enum-typos (INTURRUPT -> INTERRUPT)
(fix by Azazel) --HG-- branch : trunk
This commit is contained in:
@@ -456,7 +456,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
caster = target;
|
||||
|
||||
//Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered
|
||||
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTURRUPT_PREVIOUS));
|
||||
bool canCast = !caster->IsNonMeleeSpellCasted(false) || (action.cast.castFlags & (CAST_TRIGGERED | CAST_INTERRUPT_PREVIOUS));
|
||||
|
||||
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
|
||||
if (action.cast.castFlags & CAST_AURA_NOT_PRESENT)
|
||||
@@ -492,7 +492,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
|
||||
else
|
||||
{
|
||||
//Interrupt any previous spell
|
||||
if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTURRUPT_PREVIOUS)
|
||||
if (caster->IsNonMeleeSpellCasted(false) && action.cast.castFlags & CAST_INTERRUPT_PREVIOUS)
|
||||
caster->InterruptNonMeleeSpells(false);
|
||||
|
||||
caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED));
|
||||
|
||||
@@ -150,7 +150,7 @@ enum Target
|
||||
|
||||
enum CastFlags
|
||||
{
|
||||
CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
|
||||
CAST_INTERRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
|
||||
CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
|
||||
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
|
||||
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
|
||||
|
||||
@@ -91,7 +91,7 @@ struct TRINITY_DLL_DECL custom_exampleAI : public ScriptedAI
|
||||
|
||||
//*** HANDLED FUNCTION ***
|
||||
//Attack Start is called whenever someone hits us.
|
||||
void Aggro(Unit *who)
|
||||
void EnterCombat(Unit *who)
|
||||
{
|
||||
//Say some stuff
|
||||
DoSay(SAY_AGGRO,LANG_UNIVERSAL,NULL);
|
||||
|
||||
@@ -87,7 +87,7 @@ struct TRINITY_DLL_DECL npc_testAI : public npc_escortAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit*)
|
||||
void EnterCombat(Unit*)
|
||||
{
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
||||
me->Say(SAY_AGGRO1, LANG_UNIVERSAL, PlayerGUID);
|
||||
|
||||
@@ -62,7 +62,7 @@ struct boss_drektharAI : public ScriptedAI
|
||||
uiYellTimer = urand(20*IN_MILLISECONDS,30*IN_MILLISECONDS); //20 to 30 seconds
|
||||
}
|
||||
|
||||
void Aggro(Unit * /*who*/)
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
DoScriptText(YELL_AGGRO, me);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ struct boss_galvangarAI : public ScriptedAI
|
||||
uiResetTimer = 5*IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
void Aggro(Unit * /*who*/)
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
DoScriptText(YELL_AGGRO, me);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ struct boss_vanndarAI : public ScriptedAI
|
||||
uiYellTimer = urand(20*IN_MILLISECONDS,30*IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
void Aggro(Unit * /*who*/)
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
DoScriptText(YELL_AGGRO, me);
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ struct boss_gythAI : public ScriptedAI
|
||||
&& me->GetHealth() > 0)
|
||||
{
|
||||
//summon Rend and Change model to normal Gyth
|
||||
//Inturrupt any spell casting
|
||||
//Interrupt any spell casting
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
//Gyth model
|
||||
me->SetDisplayId(9806);
|
||||
|
||||
@@ -292,7 +292,7 @@ struct boss_victor_nefariusAI : public ScriptedAI
|
||||
//Teleport Victor Nefarius way out of the map
|
||||
//sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0);
|
||||
|
||||
//Inturrupt any spell casting
|
||||
//Interrupt any spell casting
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
|
||||
//Root self
|
||||
|
||||
@@ -247,7 +247,7 @@ struct boss_netherspiteAI : public ScriptedAI
|
||||
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
}
|
||||
|
||||
void Aggro(Unit * /*who*/)
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
HandleDoors(false);
|
||||
SwitchToPortalPhase();
|
||||
|
||||
@@ -109,7 +109,7 @@ struct boss_aranAI : public ScriptedAI
|
||||
uint32 FireCooldown;
|
||||
uint32 FrostCooldown;
|
||||
|
||||
uint32 DrinkInturruptTimer;
|
||||
uint32 DrinkInterruptTimer;
|
||||
|
||||
bool ElementalsSpawned;
|
||||
bool Drinking;
|
||||
@@ -133,7 +133,7 @@ struct boss_aranAI : public ScriptedAI
|
||||
FireCooldown = 0;
|
||||
FrostCooldown = 0;
|
||||
|
||||
DrinkInturruptTimer = 10000;
|
||||
DrinkInterruptTimer = 10000;
|
||||
|
||||
ElementalsSpawned = false;
|
||||
Drinking = false;
|
||||
@@ -261,11 +261,11 @@ struct boss_aranAI : public ScriptedAI
|
||||
DoCast(me, SPELL_CONJURE, false);
|
||||
DoCast(me, SPELL_DRINK, false);
|
||||
me->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
DrinkInturruptTimer = 10000;
|
||||
DrinkInterruptTimer = 10000;
|
||||
}
|
||||
}
|
||||
|
||||
//Drink Inturrupt
|
||||
//Drink Interrupt
|
||||
if (Drinking && DrinkInturrupted)
|
||||
{
|
||||
Drinking = false;
|
||||
@@ -275,10 +275,10 @@ struct boss_aranAI : public ScriptedAI
|
||||
DoCast(me, SPELL_POTION, false);
|
||||
}
|
||||
|
||||
//Drink Inturrupt Timer
|
||||
//Drink Interrupt Timer
|
||||
if (Drinking && !DrinkInturrupted)
|
||||
if (DrinkInturruptTimer >= diff)
|
||||
DrinkInturruptTimer -= diff;
|
||||
if (DrinkInterruptTimer >= diff)
|
||||
DrinkInterruptTimer -= diff;
|
||||
else
|
||||
{
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
@@ -476,13 +476,13 @@ struct boss_aranAI : public ScriptedAI
|
||||
|
||||
void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell)
|
||||
{
|
||||
//We only care about inturrupt effects and only if they are durring a spell currently being casted
|
||||
//We only care about interrupt effects and only if they are durring a spell currently being casted
|
||||
if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST &&
|
||||
Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST &&
|
||||
Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
|
||||
return;
|
||||
|
||||
//Inturrupt effect
|
||||
//Interrupt effect
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
|
||||
//Normally we would set the cooldown equal to the spell duration
|
||||
|
||||
@@ -597,7 +597,7 @@ struct boss_ellris_duskhallowAI : public boss_priestess_lackey_commonAI
|
||||
boss_priestess_lackey_commonAI::Reset();
|
||||
}
|
||||
|
||||
void Aggro(Unit* /*pWho*/)
|
||||
void EnterCombat(Unit* /*pWho*/)
|
||||
{
|
||||
DoCast(me, SPELL_SUMMON_IMP);
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ struct boss_jandicebarovAI : public ScriptedAI
|
||||
if (!Invisible && Illusion_Timer <= diff)
|
||||
{
|
||||
|
||||
//Inturrupt any spell casting
|
||||
//Interrupt any spell casting
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
me->setFaction(35);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
@@ -101,7 +101,7 @@ struct npc_00x09hlAI : public npc_escortAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit* pWho)
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER)
|
||||
return;
|
||||
|
||||
@@ -233,7 +233,7 @@ struct pyrewood_ambushAI : public ScriptedAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit * /*who*/){}
|
||||
void EnterCombat(Unit * /*who*/){}
|
||||
|
||||
void JustSummoned(Creature *pSummoned)
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ struct npc_tapoke_slim_jahnAI : public npc_escortAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit* /*pWho*/)
|
||||
void EnterCombat(Unit* /*pWho*/)
|
||||
{
|
||||
Player* pPlayer = GetPlayerForEscort();
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ struct boss_noxxionAI : public ScriptedAI
|
||||
//Adds_Timer
|
||||
if (!Invisible && Adds_Timer <= diff)
|
||||
{
|
||||
//Inturrupt any spell casting
|
||||
//Interrupt any spell casting
|
||||
//me->m_canMove = true;
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
me->setFaction(35);
|
||||
|
||||
@@ -325,7 +325,7 @@ struct npc_muglashAI : public npc_escortAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit* /*pWho*/)
|
||||
void EnterCombat(Unit* /*pWho*/)
|
||||
{
|
||||
if (HasEscortState(STATE_ESCORT_PAUSED))
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ struct npc_giltharesAI : public npc_escortAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit* pWho)
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
//not always use
|
||||
if (rand()%4)
|
||||
|
||||
@@ -998,7 +998,7 @@ struct mob_tenebronAI : public dummy_dragonAI
|
||||
m_bHasPortalOpen = false;
|
||||
}
|
||||
|
||||
void Aggro(Unit* pWho)
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
DoScriptText(SAY_TENEBRON_AGGRO, me);
|
||||
DoZoneInCombat();
|
||||
@@ -1091,7 +1091,7 @@ struct mob_shadronAI : public dummy_dragonAI
|
||||
m_bHasPortalOpen = false;
|
||||
}
|
||||
|
||||
void Aggro(Unit* pWho)
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
DoScriptText(SAY_SHADRON_AGGRO,me);
|
||||
DoZoneInCombat();
|
||||
@@ -1187,7 +1187,7 @@ struct mob_vesperonAI : public dummy_dragonAI
|
||||
m_bHasPortalOpen = false;
|
||||
}
|
||||
|
||||
void Aggro(Unit* pWho)
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
DoScriptText(SAY_VESPERON_AGGRO,me);
|
||||
DoZoneInCombat();
|
||||
|
||||
@@ -2110,7 +2110,7 @@ struct npc_warmage_coldarraAI : public Scripted_NoMovementAI
|
||||
m_uiTimer = 0;
|
||||
}
|
||||
|
||||
void Aggro(Unit* /*pWho*/) {}
|
||||
void EnterCombat(Unit* /*pWho*/) {}
|
||||
|
||||
void AttackStart(Unit* /*pWho*/) {}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI
|
||||
|
||||
void Reset(){}
|
||||
|
||||
void Aggro(Unit* /*pWho*/){}
|
||||
void EnterCombat(Unit* /*pWho*/){}
|
||||
|
||||
void AttackStart(Unit* /*pWho*/){}
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ struct boss_kaelthasAI : public ScriptedAI
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit * /*who*/)
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
if (m_pInstance && !m_pInstance->GetData(DATA_KAELTHASEVENT) && !Phase)
|
||||
StartEvent();
|
||||
@@ -985,7 +985,7 @@ struct boss_thaladred_the_darkenerAI : public advisorbase_ai
|
||||
advisorbase_ai::Reset();
|
||||
}
|
||||
|
||||
void Aggro(Unit *who)
|
||||
void EnterCombat(Unit *who)
|
||||
{
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
@@ -1058,7 +1058,7 @@ struct boss_lord_sanguinarAI : public advisorbase_ai
|
||||
advisorbase_ai::Reset();
|
||||
}
|
||||
|
||||
void Aggro(Unit *who)
|
||||
void EnterCombat(Unit *who)
|
||||
{
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
@@ -1141,7 +1141,7 @@ struct boss_grand_astromancer_capernianAI : public advisorbase_ai
|
||||
}
|
||||
}
|
||||
|
||||
void Aggro(Unit *who)
|
||||
void EnterCombat(Unit *who)
|
||||
{
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
@@ -1243,7 +1243,7 @@ struct boss_master_engineer_telonicusAI : public advisorbase_ai
|
||||
DoScriptText(SAY_TELONICUS_DEATH, me);
|
||||
}
|
||||
|
||||
void Aggro(Unit *who)
|
||||
void EnterCombat(Unit *who)
|
||||
{
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
|
||||
@@ -566,7 +566,7 @@ struct npc_maghar_captiveAI : public npc_escortAI
|
||||
m_uiFrostShockTimer = 6000;
|
||||
}
|
||||
|
||||
void Aggro(Unit* /*pWho*/)
|
||||
void EnterCombat(Unit* /*pWho*/)
|
||||
{
|
||||
DoCast(me, SPELL_EARTHBIND_TOTEM, false);
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ struct npc_earthmender_wildaAI : public npc_escortAI
|
||||
DoSummon(NPC_COILSKAR_ASSASSIN, me, 15.0f, 5000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT);
|
||||
}
|
||||
|
||||
void Aggro(Unit* pWho)
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
//don't always use
|
||||
if (rand()%5)
|
||||
|
||||
@@ -59,7 +59,7 @@ struct boss_emerissAI : public ScriptedAI
|
||||
m_uiCorruptionsCasted = 0;
|
||||
}
|
||||
|
||||
void Aggro(Unit* /*pWho*/)
|
||||
void EnterCombat(Unit* /*pWho*/)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, me);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ struct boss_taerarAI : public ScriptedAI
|
||||
{
|
||||
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
|
||||
{
|
||||
//Inturrupt any spell casting
|
||||
//Interrupt any spell casting
|
||||
me->InterruptNonMeleeSpells(false);
|
||||
|
||||
//horrible workaround, need to fix
|
||||
|
||||
@@ -1691,7 +1691,7 @@ struct mob_mojoAI : public ScriptedAI
|
||||
if (Unit* own = me->GetOwner())
|
||||
me->GetMotionMaster()->MoveFollow(own,0,0);
|
||||
}
|
||||
void Aggro(Unit * /*who*/){}
|
||||
void EnterCombat(Unit * /*who*/){}
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (me->HasAura(20372))
|
||||
|
||||
Reference in New Issue
Block a user