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:
click
2010-07-19 14:17:30 +02:00
parent 84c6fa001c
commit ba36f1eb23
28 changed files with 43 additions and 43 deletions
@@ -456,7 +456,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
caster = target; caster = target;
//Allowed to cast only if not casting (unless we interrupt ourself) or if spell is triggered //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 cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if (action.cast.castFlags & CAST_AURA_NOT_PRESENT) if (action.cast.castFlags & CAST_AURA_NOT_PRESENT)
@@ -492,7 +492,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
else else
{ {
//Interrupt any previous spell //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->InterruptNonMeleeSpells(false);
caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED)); caster->CastSpell(target, action.cast.spellId, (action.cast.castFlags & CAST_TRIGGERED));
+1 -1
View File
@@ -150,7 +150,7 @@ enum Target
enum CastFlags 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_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_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 CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
+1 -1
View File
@@ -91,7 +91,7 @@ struct TRINITY_DLL_DECL custom_exampleAI : public ScriptedAI
//*** HANDLED FUNCTION *** //*** HANDLED FUNCTION ***
//Attack Start is called whenever someone hits us. //Attack Start is called whenever someone hits us.
void Aggro(Unit *who) void EnterCombat(Unit *who)
{ {
//Say some stuff //Say some stuff
DoSay(SAY_AGGRO,LANG_UNIVERSAL,NULL); DoSay(SAY_AGGRO,LANG_UNIVERSAL,NULL);
+1 -1
View File
@@ -87,7 +87,7 @@ struct TRINITY_DLL_DECL npc_testAI : public npc_escortAI
} }
} }
void Aggro(Unit*) void EnterCombat(Unit*)
{ {
if (HasEscortState(STATE_ESCORT_ESCORTING)) if (HasEscortState(STATE_ESCORT_ESCORTING))
me->Say(SAY_AGGRO1, LANG_UNIVERSAL, PlayerGUID); 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 uiYellTimer = urand(20*IN_MILLISECONDS,30*IN_MILLISECONDS); //20 to 30 seconds
} }
void Aggro(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
DoScriptText(YELL_AGGRO, me); DoScriptText(YELL_AGGRO, me);
} }
@@ -55,7 +55,7 @@ struct boss_galvangarAI : public ScriptedAI
uiResetTimer = 5*IN_MILLISECONDS; uiResetTimer = 5*IN_MILLISECONDS;
} }
void Aggro(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
DoScriptText(YELL_AGGRO, me); DoScriptText(YELL_AGGRO, me);
} }
@@ -60,7 +60,7 @@ struct boss_vanndarAI : public ScriptedAI
uiYellTimer = urand(20*IN_MILLISECONDS,30*IN_MILLISECONDS); uiYellTimer = urand(20*IN_MILLISECONDS,30*IN_MILLISECONDS);
} }
void Aggro(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
DoScriptText(YELL_AGGRO, me); DoScriptText(YELL_AGGRO, me);
} }
@@ -178,7 +178,7 @@ struct boss_gythAI : public ScriptedAI
&& me->GetHealth() > 0) && me->GetHealth() > 0)
{ {
//summon Rend and Change model to normal Gyth //summon Rend and Change model to normal Gyth
//Inturrupt any spell casting //Interrupt any spell casting
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
//Gyth model //Gyth model
me->SetDisplayId(9806); me->SetDisplayId(9806);
@@ -292,7 +292,7 @@ struct boss_victor_nefariusAI : public ScriptedAI
//Teleport Victor Nefarius way out of the map //Teleport Victor Nefarius way out of the map
//sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0); //sMapMgr.GetMap(me->GetMapId(), me)->CreatureRelocation(me,0,0,-5000,0);
//Inturrupt any spell casting //Interrupt any spell casting
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
//Root self //Root self
@@ -247,7 +247,7 @@ struct boss_netherspiteAI : public ScriptedAI
Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); Door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
} }
void Aggro(Unit * /*who*/) void EnterCombat(Unit * /*who*/)
{ {
HandleDoors(false); HandleDoors(false);
SwitchToPortalPhase(); SwitchToPortalPhase();
@@ -109,7 +109,7 @@ struct boss_aranAI : public ScriptedAI
uint32 FireCooldown; uint32 FireCooldown;
uint32 FrostCooldown; uint32 FrostCooldown;
uint32 DrinkInturruptTimer; uint32 DrinkInterruptTimer;
bool ElementalsSpawned; bool ElementalsSpawned;
bool Drinking; bool Drinking;
@@ -133,7 +133,7 @@ struct boss_aranAI : public ScriptedAI
FireCooldown = 0; FireCooldown = 0;
FrostCooldown = 0; FrostCooldown = 0;
DrinkInturruptTimer = 10000; DrinkInterruptTimer = 10000;
ElementalsSpawned = false; ElementalsSpawned = false;
Drinking = false; Drinking = false;
@@ -261,11 +261,11 @@ struct boss_aranAI : public ScriptedAI
DoCast(me, SPELL_CONJURE, false); DoCast(me, SPELL_CONJURE, false);
DoCast(me, SPELL_DRINK, false); DoCast(me, SPELL_DRINK, false);
me->SetStandState(UNIT_STAND_STATE_SIT); me->SetStandState(UNIT_STAND_STATE_SIT);
DrinkInturruptTimer = 10000; DrinkInterruptTimer = 10000;
} }
} }
//Drink Inturrupt //Drink Interrupt
if (Drinking && DrinkInturrupted) if (Drinking && DrinkInturrupted)
{ {
Drinking = false; Drinking = false;
@@ -275,10 +275,10 @@ struct boss_aranAI : public ScriptedAI
DoCast(me, SPELL_POTION, false); DoCast(me, SPELL_POTION, false);
} }
//Drink Inturrupt Timer //Drink Interrupt Timer
if (Drinking && !DrinkInturrupted) if (Drinking && !DrinkInturrupted)
if (DrinkInturruptTimer >= diff) if (DrinkInterruptTimer >= diff)
DrinkInturruptTimer -= diff; DrinkInterruptTimer -= diff;
else else
{ {
me->SetStandState(UNIT_STAND_STATE_STAND); me->SetStandState(UNIT_STAND_STATE_STAND);
@@ -476,13 +476,13 @@ struct boss_aranAI : public ScriptedAI
void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell) 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 && if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST && Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false)) Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
return; return;
//Inturrupt effect //Interrupt effect
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
//Normally we would set the cooldown equal to the spell duration //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(); boss_priestess_lackey_commonAI::Reset();
} }
void Aggro(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
{ {
DoCast(me, SPELL_SUMMON_IMP); DoCast(me, SPELL_SUMMON_IMP);
} }
@@ -93,7 +93,7 @@ struct boss_jandicebarovAI : public ScriptedAI
if (!Invisible && Illusion_Timer <= diff) if (!Invisible && Illusion_Timer <= diff)
{ {
//Inturrupt any spell casting //Interrupt any spell casting
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
me->setFaction(35); me->setFaction(35);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 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) if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER)
return; return;
@@ -233,7 +233,7 @@ struct pyrewood_ambushAI : public ScriptedAI
} }
} }
void Aggro(Unit * /*who*/){} void EnterCombat(Unit * /*who*/){}
void JustSummoned(Creature *pSummoned) 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(); Player* pPlayer = GetPlayerForEscort();
@@ -96,7 +96,7 @@ struct boss_noxxionAI : public ScriptedAI
//Adds_Timer //Adds_Timer
if (!Invisible && Adds_Timer <= diff) if (!Invisible && Adds_Timer <= diff)
{ {
//Inturrupt any spell casting //Interrupt any spell casting
//me->m_canMove = true; //me->m_canMove = true;
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
me->setFaction(35); me->setFaction(35);
+1 -1
View File
@@ -325,7 +325,7 @@ struct npc_muglashAI : public npc_escortAI
} }
} }
void Aggro(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
{ {
if (HasEscortState(STATE_ESCORT_PAUSED)) if (HasEscortState(STATE_ESCORT_PAUSED))
{ {
+1 -1
View File
@@ -125,7 +125,7 @@ struct npc_giltharesAI : public npc_escortAI
} }
} }
void Aggro(Unit* pWho) void EnterCombat(Unit* pWho)
{ {
//not always use //not always use
if (rand()%4) if (rand()%4)
@@ -998,7 +998,7 @@ struct mob_tenebronAI : public dummy_dragonAI
m_bHasPortalOpen = false; m_bHasPortalOpen = false;
} }
void Aggro(Unit* pWho) void EnterCombat(Unit* pWho)
{ {
DoScriptText(SAY_TENEBRON_AGGRO, me); DoScriptText(SAY_TENEBRON_AGGRO, me);
DoZoneInCombat(); DoZoneInCombat();
@@ -1091,7 +1091,7 @@ struct mob_shadronAI : public dummy_dragonAI
m_bHasPortalOpen = false; m_bHasPortalOpen = false;
} }
void Aggro(Unit* pWho) void EnterCombat(Unit* pWho)
{ {
DoScriptText(SAY_SHADRON_AGGRO,me); DoScriptText(SAY_SHADRON_AGGRO,me);
DoZoneInCombat(); DoZoneInCombat();
@@ -1187,7 +1187,7 @@ struct mob_vesperonAI : public dummy_dragonAI
m_bHasPortalOpen = false; m_bHasPortalOpen = false;
} }
void Aggro(Unit* pWho) void EnterCombat(Unit* pWho)
{ {
DoScriptText(SAY_VESPERON_AGGRO,me); DoScriptText(SAY_VESPERON_AGGRO,me);
DoZoneInCombat(); DoZoneInCombat();
@@ -2110,7 +2110,7 @@ struct npc_warmage_coldarraAI : public Scripted_NoMovementAI
m_uiTimer = 0; m_uiTimer = 0;
} }
void Aggro(Unit* /*pWho*/) {} void EnterCombat(Unit* /*pWho*/) {}
void AttackStart(Unit* /*pWho*/) {} void AttackStart(Unit* /*pWho*/) {}
+1 -1
View File
@@ -52,7 +52,7 @@ struct npc_mageguard_dalaranAI : public Scripted_NoMovementAI
void Reset(){} void Reset(){}
void Aggro(Unit* /*pWho*/){} void EnterCombat(Unit* /*pWho*/){}
void AttackStart(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) if (m_pInstance && !m_pInstance->GetData(DATA_KAELTHASEVENT) && !Phase)
StartEvent(); StartEvent();
@@ -985,7 +985,7 @@ struct boss_thaladred_the_darkenerAI : public advisorbase_ai
advisorbase_ai::Reset(); advisorbase_ai::Reset();
} }
void Aggro(Unit *who) void EnterCombat(Unit *who)
{ {
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return; return;
@@ -1058,7 +1058,7 @@ struct boss_lord_sanguinarAI : public advisorbase_ai
advisorbase_ai::Reset(); advisorbase_ai::Reset();
} }
void Aggro(Unit *who) void EnterCombat(Unit *who)
{ {
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return; 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)) if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return; return;
@@ -1243,7 +1243,7 @@ struct boss_master_engineer_telonicusAI : public advisorbase_ai
DoScriptText(SAY_TELONICUS_DEATH, me); DoScriptText(SAY_TELONICUS_DEATH, me);
} }
void Aggro(Unit *who) void EnterCombat(Unit *who)
{ {
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE))
return; return;
+1 -1
View File
@@ -566,7 +566,7 @@ struct npc_maghar_captiveAI : public npc_escortAI
m_uiFrostShockTimer = 6000; m_uiFrostShockTimer = 6000;
} }
void Aggro(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
{ {
DoCast(me, SPELL_EARTHBIND_TOTEM, false); 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); 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 //don't always use
if (rand()%5) if (rand()%5)
+1 -1
View File
@@ -59,7 +59,7 @@ struct boss_emerissAI : public ScriptedAI
m_uiCorruptionsCasted = 0; m_uiCorruptionsCasted = 0;
} }
void Aggro(Unit* /*pWho*/) void EnterCombat(Unit* /*pWho*/)
{ {
DoScriptText(SAY_AGGRO, me); DoScriptText(SAY_AGGRO, me);
} }
+1 -1
View File
@@ -173,7 +173,7 @@ struct boss_taerarAI : public ScriptedAI
{ {
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0))
{ {
//Inturrupt any spell casting //Interrupt any spell casting
me->InterruptNonMeleeSpells(false); me->InterruptNonMeleeSpells(false);
//horrible workaround, need to fix //horrible workaround, need to fix
+1 -1
View File
@@ -1691,7 +1691,7 @@ struct mob_mojoAI : public ScriptedAI
if (Unit* own = me->GetOwner()) if (Unit* own = me->GetOwner())
me->GetMotionMaster()->MoveFollow(own,0,0); me->GetMotionMaster()->MoveFollow(own,0,0);
} }
void Aggro(Unit * /*who*/){} void EnterCombat(Unit * /*who*/){}
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if (me->HasAura(20372)) if (me->HasAura(20372))