fix(Script/ICC): Spirit Alarm and Deathbound Ward (#3592)

This commit is contained in:
Patrick Lewis
2020-11-04 12:32:33 -08:00
committed by GitHub
parent 9a9308afd1
commit 6ef7627c69
3 changed files with 117 additions and 18 deletions

View File

@@ -1946,34 +1946,40 @@ public:
void HandleEvent(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
float range = 0.0f;
uint32 trapId = 0;
switch (GetSpellInfo()->Effects[effIndex].MiscValue)
{
case EVENT_AWAKEN_WARD_1:
trapId = GO_SPIRIT_ALARM_1;
break;
case EVENT_AWAKEN_WARD_2:
range = 100.0f;
trapId = GO_SPIRIT_ALARM_2;
break;
case EVENT_AWAKEN_WARD_3:
trapId = GO_SPIRIT_ALARM_3;
break;
case EVENT_AWAKEN_WARD_4:
range = 50.0f;
trapId = GO_SPIRIT_ALARM_4;
break;
default:
return;
}
if (GameObject* trap = GetCaster()->FindNearestGameObject(trapId, 5.0f))
{
trap->SetRespawnTime(trap->GetGOInfo()->GetAutoCloseTime() / IN_MILLISECONDS);
}
std::list<Creature*> wards;
GetCaster()->GetCreatureListWithEntryInGrid(wards, NPC_DEATHBOUND_WARD, range);
GetCaster()->GetCreatureListWithEntryInGrid(wards, NPC_DEATHBOUND_WARD, 150.0f);
wards.sort(acore::ObjectDistanceOrderPred(GetCaster()));
for (std::list<Creature*>::iterator itr = wards.begin(); itr != wards.end(); ++itr)
{
if ((*itr)->IsAlive() && (*itr)->HasAura(SPELL_STONEFORM))
{
if (Player* target = (*itr)->SelectNearestPlayer(150.0f))
{
(*itr)->AI()->Talk(SAY_TRAP_ACTIVATE);
(*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM);
(*itr)->AI()->AttackStart(target);
}
(*itr)->AI()->Talk(SAY_TRAP_ACTIVATE);
(*itr)->RemoveAurasDueToSpell(SPELL_STONEFORM);
(*itr)->AI()->SetData(1, 1);
break;
}
}

View File

@@ -109,6 +109,12 @@ Position const MuradinSpawnPos = { -47.34549f, 2208.087f, 27.98586f, 3.106686f
Position const UtherSpawnPos = { -26.58507f, 2211.524f, 30.19898f, 3.124139f };
Position const SylvanasSpawnPos = { -41.45833f, 2222.891f, 27.98586f, 3.647738f };
// Set position traps Spirit Alarm
std::vector<Position> GoSpiritAlarm_1 = { { -160.96f, 2210.46f, 35.24f, 0.0f }, { -176.27f, 2201.93f, 35.24f, 0.0f}, { -207.83f, 2207.38f, 35.24f, 0.0f } };
std::vector<Position> GoSpiritAlarm_2 = { { -178.41f, 2225.11f, 35.24f, 0.0f }, { -195.23f, 2221.55f, 35.24f, 0.0f}, { -209.94f, 2250.34f, 37.99f, 0.0f } };
std::vector<Position> GoSpiritAlarm_3 = { { -289.80f, 2216.60f, 42.39f, 0.0f }, { -317.76f, 2216.11f, 42.57f, 0.0f}, { -301.07f, 2216.62f, 42.0f, 0.0f } };
std::vector<Position> GoSpiritAlarm_4 = { { -276.07f, 2206.76f, 42.57f, 0.0f }, { -304.44f, 2199.11f, 41.99f, 0.0f}, { -292.82f, 2204.61f, 42.02f, 0.0f } };
class RespawnEvent : public BasicEvent
{
public:
@@ -674,14 +680,7 @@ public:
case GO_SPIRIT_ALARM_2:
case GO_SPIRIT_ALARM_3:
case GO_SPIRIT_ALARM_4:
{
Position pos[4 * 3] = {{-160.96f, 2210.46f, 35.24f, 0.0f}, {-176.27f, 2201.93f, 35.24f, 0.0f}, {-207.83f, 2207.38f, 35.24f, 0.0f},
{-178.41f, 2225.11f, 35.24f, 0.0f}, {-195.23f, 2221.55f, 35.24f, 0.0f}, {-209.94f, 2250.34f, 37.99f, 0.0f},
{-289.80f, 2216.60f, 42.39f, 0.0f}, {-317.76f, 2216.11f, 42.57f, 0.0f}, {-301.07f, 2216.62f, 42.0f, 0.0f},
{-276.07f, 2206.76f, 42.57f, 0.0f}, {-304.44f, 2199.11f, 41.99f, 0.0f}, {-292.82f, 2204.61f, 42.02f, 0.0f}
};
go->SetPosition(pos[3 * (go->GetEntry() - GO_SPIRIT_ALARM_1) + urand(0, 2)]);
}
SetPositionTraps(go);
break;
case GO_GEIST_ALARM_1:
case GO_GEIST_ALARM_2:
@@ -1872,6 +1871,31 @@ public:
break;
}
}
void SetPositionTraps(GameObject* go)
{
std::vector<Position> trapPositions;
switch (go->GetEntry())
{
case GO_SPIRIT_ALARM_1:
trapPositions = GoSpiritAlarm_1;
break;
case GO_SPIRIT_ALARM_2:
trapPositions = GoSpiritAlarm_2;
break;
case GO_SPIRIT_ALARM_3:
trapPositions = GoSpiritAlarm_3;
break;
case GO_SPIRIT_ALARM_4:
trapPositions = GoSpiritAlarm_4;
break;
default:
return;
}
go->Relocate(acore::Containers::SelectRandomContainerElement(trapPositions));
}
protected:
// pussywizard: