Scripts/Nexus: Properly fixed achievement Split Personality
This commit is contained in:
@@ -32,12 +32,14 @@ enum Spells
|
||||
SPELL_FROST_MAGUS_VISUAL = 47706,
|
||||
SPELL_ARCANE_MAGUS_VISUAL = 47704
|
||||
};
|
||||
|
||||
enum Creatures
|
||||
{
|
||||
MOB_FIRE_MAGUS = 26928,
|
||||
MOB_FROST_MAGUS = 26930,
|
||||
MOB_ARCANE_MAGUS = 26929
|
||||
};
|
||||
|
||||
enum Yells
|
||||
{
|
||||
SAY_AGGRO = -1576000,
|
||||
@@ -47,11 +49,9 @@ enum Yells
|
||||
SAY_SPLIT_1 = -1576004,
|
||||
SAY_SPLIT_2 = -1576005,
|
||||
};
|
||||
enum Achievements
|
||||
{
|
||||
ACHIEV_SPLIT_PERSONALITY = 2150,
|
||||
ACHIEV_TIMER = 5*IN_MILLISECONDS
|
||||
};
|
||||
|
||||
#define ACTION_MAGUS_DEAD 1
|
||||
#define DATA_SPLIT_PERSONALITY 2
|
||||
|
||||
const Position CenterOfRoom = {504.80f, 89.07f, -16.12f, 6.27f};
|
||||
|
||||
@@ -82,17 +82,16 @@ public:
|
||||
bool bFrostMagusDead;
|
||||
bool bArcaneMagusDead;
|
||||
bool bIsWaitingToAppear;
|
||||
bool bIsAchievementTimerRunning;
|
||||
|
||||
uint32 uiIsWaitingToAppearTimer;
|
||||
uint32 uiIceNovaTimer;
|
||||
uint32 uiFireBombTimer;
|
||||
uint32 uiGravityWellTimer;
|
||||
uint32 uiCooldown;
|
||||
uint32 uiAchievementTimer;
|
||||
|
||||
uint8 Phase;
|
||||
uint8 uiAchievementProgress;
|
||||
uint8 splitPersonality;
|
||||
time_t time[3];
|
||||
|
||||
void Reset()
|
||||
{
|
||||
@@ -107,10 +106,10 @@ public:
|
||||
uiFrostMagusGUID = 0;
|
||||
uiArcaneMagusGUID = 0;
|
||||
|
||||
uiAchievementProgress = 0;
|
||||
uiAchievementTimer = 0;
|
||||
for (uint8 n = 0; n < 3; ++n)
|
||||
time[n] = 0;
|
||||
|
||||
bIsAchievementTimerRunning = false;
|
||||
splitPersonality = 0;
|
||||
bIsWaitingToAppear = false;
|
||||
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
@@ -133,11 +132,7 @@ public:
|
||||
DoScriptText(SAY_DEATH, me);
|
||||
|
||||
if (pInstance)
|
||||
{
|
||||
if (IsHeroic() && uiAchievementProgress == 2)
|
||||
pInstance->DoCompleteAchievement(ACHIEV_SPLIT_PERSONALITY);
|
||||
pInstance->SetData(DATA_MAGUS_TELESTRA_EVENT, DONE);
|
||||
}
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/)
|
||||
@@ -145,6 +140,28 @@ public:
|
||||
DoScriptText(SAY_KILL, me);
|
||||
}
|
||||
|
||||
void DoAction(int32 const action)
|
||||
{
|
||||
if (action == ACTION_MAGUS_DEAD)
|
||||
{
|
||||
uint8 i = 0;
|
||||
while (time[i] != 0)
|
||||
++i;
|
||||
|
||||
time[i] = sWorld->GetGameTime();
|
||||
if (i == 2 && (time[2] - time[1] < 5) && (time[1] - time[0] < 5))
|
||||
++splitPersonality;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
if (type == DATA_SPLIT_PERSONALITY)
|
||||
return splitPersonality;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64 SplitPersonality(uint32 entry)
|
||||
{
|
||||
if (Creature* Summoned = me->SummonCreature(entry, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1*IN_MILLISECONDS))
|
||||
@@ -181,18 +198,18 @@ public:
|
||||
|
||||
if (summon->GetGUID() == uiFireMagusGUID)
|
||||
{
|
||||
me->AI()->DoAction(ACTION_MAGUS_DEAD);
|
||||
bFireMagusDead = true;
|
||||
bIsAchievementTimerRunning = true;
|
||||
}
|
||||
else if (summon->GetGUID() == uiFrostMagusGUID)
|
||||
{
|
||||
me->AI()->DoAction(ACTION_MAGUS_DEAD);
|
||||
bFrostMagusDead = true;
|
||||
bIsAchievementTimerRunning = true;
|
||||
}
|
||||
else if (summon->GetGUID() == uiArcaneMagusGUID)
|
||||
{
|
||||
me->AI()->DoAction(ACTION_MAGUS_DEAD);
|
||||
bArcaneMagusDead = true;
|
||||
bIsAchievementTimerRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,12 +233,10 @@ public:
|
||||
|
||||
if ((Phase == 1) ||(Phase == 3))
|
||||
{
|
||||
if (bIsAchievementTimerRunning)
|
||||
uiAchievementTimer += diff;
|
||||
if (bFireMagusDead && bFrostMagusDead && bArcaneMagusDead)
|
||||
{
|
||||
if (uiAchievementTimer <= ACHIEV_TIMER)
|
||||
uiAchievementProgress +=1;
|
||||
for (uint8 n = 0; n < 3; ++n)
|
||||
time[n] = 0;
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMap()->CreatureRelocation(me, CenterOfRoom.GetPositionX(), CenterOfRoom.GetPositionY(), CenterOfRoom.GetPositionZ(), CenterOfRoom.GetOrientation());
|
||||
DoCast(me, SPELL_TELESTRA_BACK);
|
||||
@@ -236,8 +251,6 @@ public:
|
||||
bIsWaitingToAppear = true;
|
||||
uiIsWaitingToAppearTimer = 4*IN_MILLISECONDS;
|
||||
DoScriptText(SAY_MERGE, me);
|
||||
bIsAchievementTimerRunning = false;
|
||||
uiAchievementTimer = 0;
|
||||
}
|
||||
else
|
||||
return;
|
||||
@@ -324,7 +337,25 @@ public:
|
||||
|
||||
};
|
||||
|
||||
class achievement_split_personality : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
achievement_split_personality() : AchievementCriteriaScript("achievement_split_personality")
|
||||
{
|
||||
}
|
||||
|
||||
bool OnCheck(Player* /*player*/, Unit* target)
|
||||
{
|
||||
if (Creature* Telestra = target->ToCreature())
|
||||
if (Telestra->AI()->GetData(DATA_SPLIT_PERSONALITY) == 2)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_boss_magus_telestra()
|
||||
{
|
||||
new boss_magus_telestra();
|
||||
new achievement_split_personality();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user