forked from External/mage
Word of Command & Mindslaver interaction fixes
This commit is contained in:
parent
5fa69cb8a9
commit
3e180267ed
5 changed files with 72 additions and 13 deletions
|
|
@ -156,6 +156,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
protected boolean isGameUnderControl = true;
|
||||
protected UUID turnController;
|
||||
protected List<UUID> turnControllers = new ArrayList<>();
|
||||
protected Set<UUID> playersUnderYourControl = new HashSet<>();
|
||||
|
||||
protected Set<UUID> usersAllowedToSeeHandCards = new HashSet<>();
|
||||
|
|
@ -263,6 +264,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.isGameUnderControl = player.isGameUnderControl;
|
||||
|
||||
this.turnController = player.turnController;
|
||||
this.turnControllers.clear();
|
||||
this.turnControllers.addAll(player.turnControllers);
|
||||
|
||||
this.passed = player.passed;
|
||||
this.passedTurn = player.passedTurn;
|
||||
|
|
@ -343,6 +346,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.isGameUnderControl = player.isGameUnderControl();
|
||||
|
||||
this.turnController = player.getTurnControlledBy();
|
||||
this.turnControllers.clear();
|
||||
this.turnControllers.addAll(player.getTurnControllers());
|
||||
this.reachedNextTurnAfterLeaving = player.hasReachedNextTurnAfterLeaving();
|
||||
this.castSourceIdWithAlternateMana = player.getCastSourceIdWithAlternateMana();
|
||||
this.castSourceIdManaCosts = player.getCastSourceIdManaCosts();
|
||||
|
|
@ -398,6 +403,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.turns = 0;
|
||||
this.isGameUnderControl = true;
|
||||
this.turnController = this.getId();
|
||||
this.turnControllers.clear();
|
||||
this.playersUnderYourControl.clear();
|
||||
|
||||
this.passed = false;
|
||||
|
|
@ -520,13 +526,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public void controlPlayersTurn(Game game, UUID playerId) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
player.setTurnControlledBy(this.getId());
|
||||
game.informPlayers(getLogName() + " controls the turn of " + player.getLogName());
|
||||
if (!playerId.equals(this.getId())) {
|
||||
this.playersUnderYourControl.add(playerId);
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (!player.hasLeft() && !player.hasLost()) {
|
||||
player.setGameUnderYourControl(false);
|
||||
player.setTurnControlledBy(this.getId());
|
||||
game.informPlayers(getLogName() + " controls the turn of " + player.getLogName());
|
||||
}
|
||||
DelayedTriggeredAbility ability = new AtTheEndOfTurnStepPostDelayedTriggeredAbility(new LoseControlOnOtherPlayersControllerEffect(this.getLogName(), player.getLogName()));
|
||||
ability.setSourceId(getId());
|
||||
|
|
@ -538,6 +544,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
@Override
|
||||
public void setTurnControlledBy(UUID playerId) {
|
||||
this.turnController = playerId;
|
||||
this.turnControllers.add(playerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UUID> getTurnControllers() {
|
||||
return this.turnControllers;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -563,9 +575,27 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
@Override
|
||||
public void setGameUnderYourControl(boolean value) {
|
||||
setGameUnderYourControl(value, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGameUnderYourControl(boolean value, boolean fullRestore) {
|
||||
this.isGameUnderControl = value;
|
||||
if (isGameUnderControl) {
|
||||
this.turnController = getId();
|
||||
if (fullRestore) {
|
||||
this.turnControllers.clear();
|
||||
this.turnController = getId();
|
||||
} else {
|
||||
if (turnControllers.size() > 0) {
|
||||
this.turnControllers.remove(turnControllers.size() - 1);
|
||||
}
|
||||
if (turnControllers.isEmpty()) {
|
||||
this.turnController = getId();
|
||||
} else {
|
||||
this.turnController = turnControllers.get(turnControllers.size() - 1);
|
||||
isGameUnderControl = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -980,6 +1010,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return castSourceIdManaCosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPayManaMode(boolean payManaMode) {
|
||||
this.payManaMode = payManaMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInPayManaMode() {
|
||||
return payManaMode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue