Scripts/Achievements:

- Move achievement Shocking! to appropriate boss script instead of instance script.
- Split the polarity spellscript into two and move to proper boss file
- Fixed a typo in Loatheb's spore achievement.
This commit is contained in:
kaelima
2012-01-11 17:21:03 +01:00
parent c398f20988
commit 233d891952
9 changed files with 182 additions and 33 deletions
@@ -82,7 +82,7 @@ class boss_loatheb : public CreatureScript
_sporeLoserData = false;
}
uint32 GetData(int32 id)
uint32 GetData(uint32 id)
{
if (id != DATA_ACHIEVEMENT_SPORE_LOSER)
return 0;
@@ -83,7 +83,11 @@ enum ThaddiusSpells
SPELL_BALL_LIGHTNING = 28299,
SPELL_CHAIN_LIGHTNING = 28167,
H_SPELL_CHAIN_LIGHTNING = 54531,
SPELL_BERSERK = 27680
SPELL_BERSERK = 27680,
SPELL_POSITIVE_CHARGE = 28062,
SPELL_POSITIVE_CHARGE_STACK = 29659,
SPELL_NEGATIVE_CHARGE = 28085,
SPELL_NEGATIVE_CHARGE_STACK = 29660
};
enum Events
@@ -94,6 +98,11 @@ enum Events
EVENT_BERSERK,
};
enum Achievement
{
DATA_POLARITY_SWITCH = 76047605,
};
class boss_thaddius : public CreatureScript
{
public:
@@ -135,6 +144,7 @@ public:
bool checkStalaggAlive;
bool checkFeugenAlive;
bool polaritySwitch;
uint32 uiAddsTimer;
void KilledUnit(Unit* /*victim*/)
@@ -194,6 +204,20 @@ public:
me->SetReactState(REACT_AGGRESSIVE);
}
void SetData(uint32 id, uint32 data)
{
if (id == DATA_POLARITY_SWITCH)
polaritySwitch = data ? true : false;
}
uint32 GetData(uint32 id)
{
if (id != DATA_POLARITY_SWITCH)
return 0;
return uint32(polaritySwitch);
}
void UpdateAI(const uint32 diff)
{
if (checkFeugenAlive && checkStalaggAlive)
@@ -409,6 +433,24 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
{
PrepareSpellScript(spell_thaddius_pos_neg_charge_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_CHARGE_STACK))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_CHARGE_STACK))
return false;
return true;
}
bool Load()
{
return GetCaster()->GetTypeId() == TYPEID_UNIT;
}
void HandleTargets(std::list<Unit*>& targetList)
{
uint8 count = 0;
@@ -417,16 +459,16 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
if (Player* target = (*ihit)->ToPlayer())
if (target->HasAura(GetTriggeringSpell()->Id))
++count;
if (count)
{
uint32 spellId = 0;
switch (GetSpellInfo()->Id)
{
case 28062: spellId = 29659; break;
case 28085: spellId = 29660; break;
case 39090: spellId = 39089; break;
case 39093: spellId = 39092; break;
}
if (GetSpellInfo()->Id == SPELL_POSITIVE_CHARGE)
spellId = SPELL_POSITIVE_CHARGE_STACK;
else // if (GetSpellInfo()->Id == SPELL_NEGATIVE_CHARGE)
spellId = SPELL_NEGATIVE_CHARGE_STACK;
GetCaster()->SetAuraStack(spellId, GetCaster(), count);
}
}
@@ -435,14 +477,17 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
{
if (!GetTriggeringSpell())
return;
Unit* target = GetHitUnit();
Unit* caster = GetCaster();
if (target->HasAura(GetTriggeringSpell()->Id))
SetHitDamage(0);
else
if (InstanceScript* instance = target->GetInstanceScript())
instance->SetData(DATA_POLARITY_SWITCHED, 1);
{
if (target->GetTypeId() == TYPEID_PLAYER && caster->IsAIEnabled)
caster->ToCreature()->AI()->SetData(DATA_POLARITY_SWITCH, 1);
}
}
void Register()
@@ -458,10 +503,22 @@ class spell_thaddius_pos_neg_charge : public SpellScriptLoader
}
};
class achievement_polarity_switch : public AchievementCriteriaScript
{
public:
achievement_polarity_switch() : AchievementCriteriaScript("achievement_polarity_switch") { }
bool OnCheck(Player* /*source*/, Unit* target)
{
return target && target->GetAI()->GetData(DATA_POLARITY_SWITCH);
}
};
void AddSC_boss_thaddius()
{
new boss_thaddius();
new mob_stalagg();
new mob_feugen();
new spell_thaddius_pos_neg_charge();
new achievement_polarity_switch();
}
@@ -148,8 +148,6 @@ public:
time_t maxHorsemenDiedTime;
uint32 playerDied;
uint32 PolaritySwitch;
void Initialize()
{
@@ -170,8 +168,6 @@ public:
playerDied = 0;
gothikDoorState = GO_STATE_ACTIVE;
PolaritySwitch = 0;
memset(portalsGUID, 0, sizeof(portalsGUID));
}
@@ -315,9 +311,6 @@ public:
case DATA_ABOMINATION_KILLED:
AbominationCount = value;
break;
case DATA_POLARITY_SWITCHED:
PolaritySwitch = value;
break;
}
}
@@ -447,13 +440,6 @@ public:
if (AreAllEncoutersDone() && !playerDied)
return true;
return false;
// Criteria for achievement 2178: Shocking! (10-man)
case 7604:
// Criteria for achievement 2179: Shocking! (25-man)
case 7605:
if (!PolaritySwitch)
return true;
return false;
}
return false;
}
@@ -461,14 +447,14 @@ public:
std::string GetSaveData()
{
std::ostringstream saveStream;
saveStream << GetBossSaveData() << gothikDoorState << ' ' << playerDied << ' ' << PolaritySwitch;
saveStream << GetBossSaveData() << gothikDoorState << ' ' << playerDied;
return saveStream.str();
}
void Load(const char * data)
{
std::istringstream loadStream(LoadBossState(data));
uint32 temp, buff, buff2, buff3;
uint32 temp, buff, buff2;
for (uint32 i = 0; i < MAX_BOSS_NUMBER; ++i)
loadStream >> temp;
@@ -477,8 +463,6 @@ public:
gothikDoorState = GOState(buff);
loadStream >> buff2;
playerDied = buff2;
loadStream >> buff3;
PolaritySwitch = buff3;
}
};
@@ -49,8 +49,6 @@ enum Data
DATA_HORSEMEN2,
DATA_HORSEMEN3,
DATA_ABOMINATION_KILLED,
DATA_POLARITY_SWITCHED,
};
enum Data64