From 862ac38f51a78fcdf25bdbec6108c6f706c55cd1 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 24 Dec 2016 16:52:06 +0100 Subject: [PATCH] * Fixed that special actions (e.g. delve mana payment) were handled correctly if a player plays a turn for another player. --- Mage.Common/src/mage/view/GameView.java | 18 +++++++++++------- Mage.Sets/src/mage/cards/b/BecomeImmense.java | 7 +++---- .../src/main/java/mage/players/PlayerImpl.java | 1 + 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/Mage.Common/src/mage/view/GameView.java b/Mage.Common/src/mage/view/GameView.java index bc12e6cb69..d0fae59a0f 100644 --- a/Mage.Common/src/mage/view/GameView.java +++ b/Mage.Common/src/mage/view/GameView.java @@ -81,10 +81,10 @@ public class GameView implements Serializable { private final PhaseStep step; private final UUID activePlayerId; private String activePlayerName = ""; - private String priorityPlayerName = ""; + private String priorityPlayerName; private final int turn; private boolean special = false; - private final boolean isPlayer; + private final boolean isPlayer; // false = watching user private final int spellsCastCurrentTurn; private final boolean rollbackTurnsAllowed; @@ -187,18 +187,22 @@ public class GameView implements Serializable { } else { this.activePlayerName = ""; } + Player priorityPlayer = null; if (state.getPriorityPlayerId() != null) { - this.priorityPlayerName = state.getPlayer(state.getPriorityPlayerId()).getName(); + priorityPlayer = state.getPlayer(state.getPriorityPlayerId()); + this.priorityPlayerName = priorityPlayer != null ? priorityPlayer.getName() : ""; } else { this.priorityPlayerName = ""; } for (CombatGroup combatGroup : state.getCombat().getGroups()) { combat.add(new CombatGroupView(combatGroup, game)); } - if (isPlayer) { - // has only to be set for active palyer with priority (e.g. pay mana by delve or Quenchable Fire special action) - if (createdForPlayer != null && createdForPlayerId != null && createdForPlayerId.equals(state.getPriorityPlayerId())) { - this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId(), createdForPlayer.isInPayManaMode()).size() > 0; + if (isPlayer) { // no watcher + // has only to be set for active player with priority (e.g. pay mana by delve or Quenchable Fire special action) + if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl() + && (createdForPlayerId.equals(priorityPlayer.getId()) // player controls the turn + || createdForPlayer.getPlayersUnderYourControl().contains(priorityPlayer.getId()))) { // player controls active players turn + this.special = state.getSpecialActions().getControlledBy(priorityPlayer.getId(), priorityPlayer.isInPayManaMode()).size() > 0; } } else { this.special = false; diff --git a/Mage.Sets/src/mage/cards/b/BecomeImmense.java b/Mage.Sets/src/mage/cards/b/BecomeImmense.java index 5a6c8347a6..3f60e9f962 100644 --- a/Mage.Sets/src/mage/cards/b/BecomeImmense.java +++ b/Mage.Sets/src/mage/cards/b/BecomeImmense.java @@ -43,13 +43,12 @@ import mage.target.common.TargetCreaturePermanent; public class BecomeImmense extends CardImpl { public BecomeImmense(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{5}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{G}"); - - // Delve + // Delve (Each card you exile from your graveyard while casting this spell pays for {1}.) this.addAbility(new DelveAbility()); // Target creature gets +6/+6 until end of turn - this.getSpellAbility().addEffect(new BoostTargetEffect(6,6,Duration.EndOfTurn)); + this.getSpellAbility().addEffect(new BoostTargetEffect(6, 6, Duration.EndOfTurn)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); } diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 86f053fa9d..c803bb69ad 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -570,6 +570,7 @@ public abstract class PlayerImpl implements Player, Serializable { if (!player.hasLeft() && !player.hasLost()) { player.setGameUnderYourControl(false); player.setTurnControlledBy(this.getId()); + game.informPlayers(getLogName() + " controlls the turn of " + player.getLogName()); } DelayedTriggeredAbility ability = new AtTheEndOfTurnStepPostDelayedTriggeredAbility(new LoseControlOnOtherPlayersControllerEffect(this.getLogName(), player.getLogName())); ability.setSourceId(getId());