Scripts/ToC: Simplify the code for "A Tribute to Immortality" achievement

* also fixes the achievement being still awarded if players die indirectly during boss fights (Anub'arak adds, for example)
This commit is contained in:
Nyeriah
2014-11-06 22:13:13 -02:00
parent f1e705257e
commit 9838cbda1a
7 changed files with 10 additions and 35 deletions

View File

@@ -205,10 +205,7 @@ class boss_anubarak_trial : public CreatureScript
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_KILL_PLAYER);
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
void MoveInLineOfSight(Unit* /*who*/) override
@@ -611,9 +608,7 @@ class npc_frost_sphere : public CreatureScript
struct npc_frost_sphereAI : public ScriptedAI
{
npc_frost_sphereAI(Creature* creature) : ScriptedAI(creature)
{
}
npc_frost_sphereAI(Creature* creature) : ScriptedAI(creature) { }
void Reset() override
{
@@ -766,7 +761,6 @@ class npc_anubarak_spike : public CreatureScript
}
void MoveInLineOfSight(Unit* pWho) override
{
if (!pWho)
return;

View File

@@ -647,8 +647,6 @@ struct boss_faction_championsAI : public BossAI
if (Creature* temp = ObjectAccessor::GetCreature(*me, instance->GetGuidData(NPC_GARROSH)))
temp->AI()->Talk(SAY_KILL_PLAYER);
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}

View File

@@ -122,10 +122,7 @@ class boss_jaraxxus : public CreatureScript
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_KILL_PLAYER);
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
void JustDied(Unit* /*killer*/) override

View File

@@ -540,12 +540,6 @@ struct boss_jormungarAI : public BossAI
me->DespawnOrUnsummon();
}
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();
@@ -943,14 +937,6 @@ class boss_icehowl : public CreatureScript
me->DespawnOrUnsummon();
}
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
void EnterCombat(Unit* /*who*/) override
{
_EnterCombat();

View File

@@ -212,10 +212,7 @@ struct boss_twin_baseAI : public BossAI
void KilledUnit(Unit* who) override
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
Talk(SAY_KILL_PLAYER);
instance->SetData(DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE, 0);
}
}
void SummonedCreatureDespawn(Creature* summoned) override

View File

@@ -190,6 +190,13 @@ class instance_trial_of_the_crusader : public InstanceMapScript
}
}
void OnUnitDeath(Unit* unit) override
{
if (unit->GetTypeId() == TYPEID_PLAYER && IsEncounterInProgress())
TributeToImmortalityEligible = false;
}
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
@@ -427,9 +434,6 @@ class instance_trial_of_the_crusader : public InstanceMapScript
else if (data == DECREASE)
--MistressOfPainCount;
break;
case DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE:
TributeToImmortalityEligible = false;
break;
default:
break;
}

View File

@@ -24,9 +24,8 @@ enum DataTypes
TYPE_EVENT_NPC = 102,
TYPE_NORTHREND_BEASTS = 103,
DATA_SNOBOLD_COUNT = 301,
DATA_MISTRESS_OF_PAIN_COUNT = 302,
DATA_TRIBUTE_TO_IMMORTALITY_ELIGIBLE = 303,
DATA_SNOBOLD_COUNT = 301,
DATA_MISTRESS_OF_PAIN_COUNT = 302,
INCREASE = 501,
DECREASE = 502,