mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
Fix(Scripts/BlackwingLair) :bwl suppression traps (#27774)
Co-authored-by: Nefertumm <[email protected]>
This commit is contained in:
+31
-3
@@ -134,10 +134,19 @@ struct go_suppression_device : public GameObjectAI
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE)
|
||||
me->AllowSaveToDB(true);
|
||||
|
||||
// Disarmed devices use GO_STATE_ACTIVE. Preserve that state after Broodlord dies;
|
||||
// before then, a reload resets the transient disarm because its reset timer is not persisted.
|
||||
if (me->GetGoState() == GO_STATE_ACTIVE)
|
||||
{
|
||||
Deactivate();
|
||||
return;
|
||||
if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE)
|
||||
{
|
||||
Deactivate();
|
||||
return;
|
||||
}
|
||||
|
||||
me->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 5s);
|
||||
@@ -166,6 +175,22 @@ struct go_suppression_device : public GameObjectAI
|
||||
}
|
||||
}
|
||||
|
||||
void OnStateChanged(uint32 state, Unit* /*unit*/) override
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GO_JUST_DEACTIVATED:
|
||||
// Disarm Trap must retract the device, not send it through generic despawning.
|
||||
me->SetLootState(GO_READY);
|
||||
[[fallthrough]];
|
||||
case GO_ACTIVATED:
|
||||
DoAction(ACTION_DISARMED);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
if (action == ACTION_DEACTIVATE)
|
||||
@@ -174,6 +199,9 @@ struct go_suppression_device : public GameObjectAI
|
||||
}
|
||||
else if (action == ACTION_DISARMED)
|
||||
{
|
||||
if (!_active)
|
||||
return;
|
||||
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user