* 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 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;

View file

@ -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());
}

View file

@ -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());