diff --git a/Mage/src/main/java/mage/game/Game.java b/Mage/src/main/java/mage/game/Game.java index ca7191e97a7..96d34899d76 100644 --- a/Mage/src/main/java/mage/game/Game.java +++ b/Mage/src/main/java/mage/game/Game.java @@ -515,12 +515,28 @@ public interface Game extends MageItem, Serializable, Copyable { Counters getEnterWithCounters(UUID sourceId); + /** + * Get the UUID of the current player who is the Monarch, or null if nobody has it. + * + * @return UUID of the Monarch (null if nobody has it). + */ UUID getMonarchId(); void setMonarchId(Ability source, UUID monarchId); + /** + * Get the UUID of the current player who has the initiative, or null if nobody has it. + * + * @return UUID of the player who currently has the Initiative (null if nobody has it). + */ UUID getInitiativeId(); + /** + * Function to call for a player to take the initiative. + * + * @param source The ability granting initiative. + * @param initiativeId UUID of the player taking the initiative + */ void takeInitiative(Ability source, UUID initiativeId); int damagePlayerOrPlaneswalker(UUID playerOrWalker, int damage, UUID attackerId, Ability source, Game game, boolean combatDamage, boolean preventable); diff --git a/Mage/src/main/java/mage/game/GameImpl.java b/Mage/src/main/java/mage/game/GameImpl.java index 9dbbe2de516..955d3fd510d 100644 --- a/Mage/src/main/java/mage/game/GameImpl.java +++ b/Mage/src/main/java/mage/game/GameImpl.java @@ -3703,11 +3703,17 @@ public abstract class GameImpl implements Game { @Override public void takeInitiative(Ability source, UUID initiativeId) { - if (getInitiativeId() == null) { + // First time someone takes the initiative + if (getInitiativeId() == null) { // 1. Nobody has initiative getState().addDesignation(new Initiative(), this, initiativeId); - } else if (!getInitiativeId().equals(initiativeId)) { - getState().setInitiativeId(initiativeId); } + + // Update it every time, even if it doesn't have to change to make the code simpler. + // It only really has to change under 2 circumstances: + // 1. First time someone takes the initiative + // 2. A player taking the initiative when another player currently has it. + getState().setInitiativeId(initiativeId); + informPlayers(getPlayer(initiativeId).getLogName() + " takes the initiative"); fireEvent(new GameEvent(GameEvent.EventType.TOOK_INITIATIVE, initiativeId, source, initiativeId)); }