* Fixed that special actions (e.g. delve mana payment) were handled correctly if a player plays a turn for another player.

This commit is contained in:
LevelX2 2016-12-24 16:52:06 +01:00
parent 7bdc5b2f44
commit 862ac38f51
3 changed files with 15 additions and 11 deletions

View file

@ -81,10 +81,10 @@ public class GameView implements Serializable {
private final PhaseStep step; private final PhaseStep step;
private final UUID activePlayerId; private final UUID activePlayerId;
private String activePlayerName = ""; private String activePlayerName = "";
private String priorityPlayerName = ""; private String priorityPlayerName;
private final int turn; private final int turn;
private boolean special = false; private boolean special = false;
private final boolean isPlayer; private final boolean isPlayer; // false = watching user
private final int spellsCastCurrentTurn; private final int spellsCastCurrentTurn;
private final boolean rollbackTurnsAllowed; private final boolean rollbackTurnsAllowed;
@ -187,18 +187,22 @@ public class GameView implements Serializable {
} else { } else {
this.activePlayerName = ""; this.activePlayerName = "";
} }
Player priorityPlayer = null;
if (state.getPriorityPlayerId() != null) { if (state.getPriorityPlayerId() != null) {
this.priorityPlayerName = state.getPlayer(state.getPriorityPlayerId()).getName(); priorityPlayer = state.getPlayer(state.getPriorityPlayerId());
this.priorityPlayerName = priorityPlayer != null ? priorityPlayer.getName() : "";
} else { } else {
this.priorityPlayerName = ""; this.priorityPlayerName = "";
} }
for (CombatGroup combatGroup : state.getCombat().getGroups()) { for (CombatGroup combatGroup : state.getCombat().getGroups()) {
combat.add(new CombatGroupView(combatGroup, game)); combat.add(new CombatGroupView(combatGroup, game));
} }
if (isPlayer) { if (isPlayer) { // no watcher
// has only to be set for active palyer with priority (e.g. pay mana by delve or Quenchable Fire special action) // has only to be set for active player with priority (e.g. pay mana by delve or Quenchable Fire special action)
if (createdForPlayer != null && createdForPlayerId != null && createdForPlayerId.equals(state.getPriorityPlayerId())) { if (priorityPlayer != null && createdForPlayer != null && createdForPlayerId != null && createdForPlayer.isGameUnderControl()
this.special = state.getSpecialActions().getControlledBy(state.getPriorityPlayerId(), createdForPlayer.isInPayManaMode()).size() > 0; && (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 { } else {
this.special = false; this.special = false;

View file

@ -45,8 +45,7 @@ public class BecomeImmense extends CardImpl {
public BecomeImmense(UUID ownerId, CardSetInfo setInfo) { 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 (Each card you exile from your graveyard while casting this spell pays for {1}.)
// Delve
this.addAbility(new DelveAbility()); this.addAbility(new DelveAbility());
// Target creature gets +6/+6 until end of turn // 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));

View file

@ -570,6 +570,7 @@ public abstract class PlayerImpl implements Player, Serializable {
if (!player.hasLeft() && !player.hasLost()) { if (!player.hasLeft() && !player.hasLost()) {
player.setGameUnderYourControl(false); player.setGameUnderYourControl(false);
player.setTurnControlledBy(this.getId()); player.setTurnControlledBy(this.getId());
game.informPlayers(getLogName() + " controlls the turn of " + player.getLogName());
} }
DelayedTriggeredAbility ability = new AtTheEndOfTurnStepPostDelayedTriggeredAbility(new LoseControlOnOtherPlayersControllerEffect(this.getLogName(), player.getLogName())); DelayedTriggeredAbility ability = new AtTheEndOfTurnStepPostDelayedTriggeredAbility(new LoseControlOnOtherPlayersControllerEffect(this.getLogName(), player.getLogName()));
ability.setSourceId(getId()); ability.setSourceId(getId());