fix(Scripts/Karazhan): Chess pieces reset to correct positions (#21061)

This commit is contained in:
vrachv
2024-12-29 19:13:22 +00:00
committed by GitHub
parent a97bff0baa
commit e152d6a3aa
2 changed files with 4 additions and 3 deletions

View File

@@ -1424,6 +1424,7 @@ struct npc_chesspiece : public ScriptedAI
_instance = creature->GetInstanceScript();
_currentOrientation = GetDefaultOrientationForTeam();
_homePosition = creature->GetPosition();
_nextMoveTimer = urand(8 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
@@ -1457,6 +1458,8 @@ struct npc_chesspiece : public ScriptedAI
{
me->SetResistance(SpellSchools(i), 0);
}
me->NearTeleportTo(_homePosition);
}
void EnterEvadeMode(EvadeReason /*why*/) override
@@ -2044,6 +2047,7 @@ private:
KarazhanChessOrientationType _currentOrientation;
bool _teamControlledByRaid;
Position _homePosition;
};
struct npc_chess_move_trigger : public ScriptedAI

View File

@@ -271,9 +271,6 @@ public:
piece->RemoveAllAuras();
piece->setDeathState(DeathState::JustRespawned);
piece->SetHealth(piece->GetMaxHealth());
float x, y, z, o;
piece->GetHomePosition(x, y, z, o);
piece->NearTeleportTo(x, y, z, o);
piece->AI()->DoAction(ACTION_CHESS_PIECE_RESET_ORIENTATION);
piece->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
piece->AI()->Reset();