Skip to content

Commit

Permalink
fix(Scripts/Karazhan): Chess pieces reset to correct positions (#21061)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrachv authored Dec 29, 2024
1 parent a97bff0 commit e152d6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -1457,6 +1458,8 @@ struct npc_chesspiece : public ScriptedAI
{
me->SetResistance(SpellSchools(i), 0);
}

me->NearTeleportTo(_homePosition);
}

void EnterEvadeMode(EvadeReason /*why*/) override
Expand Down Expand Up @@ -2044,6 +2047,7 @@ struct npc_chesspiece : public ScriptedAI
KarazhanChessOrientationType _currentOrientation;

bool _teamControlledByRaid;
Position _homePosition;
};

struct npc_chess_move_trigger : public ScriptedAI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ class instance_karazhan : public InstanceMapScript
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();
Expand Down

0 comments on commit e152d6a

Please sign in to comment.