@Override public boolean apply(ObjectSourcePlayer<Player> input, Game game) { Player player = input.getObject(); if(player != null) { return player.isCanGainLife(); } return false; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (UUID opponentId : game.getOpponents(controllerId)) { Player player = game.getPlayer(opponentId); if (player != null && player.isCanGainLife()) { // at least one opponent must be able to gain life return true; } } } return true; }
@Override public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { Player controller = game.getPlayer(controllerId); if (controller != null) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { if (!playerId.equals(controllerId)) { Player player = game.getPlayer(playerId); if (player != null && !player.isCanGainLife()) { // if only one other player can't gain life, the cost can't be paid return false; } } } } return true; }
if (lifePlayer1 < lifePlayer2 && (!sourcePlayer.isCanGainLife() || !targetPlayer.isCanLoseLife())) { return false; if (lifePlayer1 > lifePlayer2 && (!sourcePlayer.isCanLoseLife() || !targetPlayer.isCanGainLife())) { return false;
if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife())) { return false; if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife())) { return false;
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Player player = game.getPlayer(source.getFirstTarget()); if (controller != null && player != null) { int lifeController = controller.getLife(); int lifePlayer = player.getLife(); if (lifeController == lifePlayer) { return false; } if (!controller.isLifeTotalCanChange() || !player.isLifeTotalCanChange()) { return false; } if (lifeController < lifePlayer && (!controller.isCanGainLife() || !player.isCanLoseLife())) { return false; } if (lifeController > lifePlayer && (!controller.isCanLoseLife() || !player.isCanGainLife())) { return false; } controller.setLife(lifePlayer, game, source); player.setLife(lifeController, game, source); return true; } return false; }
if (lifePlayer1 < lifePlayer2 && (!player1.isCanGainLife() || !player2.isCanLoseLife())) { return false; if (lifePlayer1 > lifePlayer2 && (!player1.isCanLoseLife() || !player2.isCanGainLife())) { return false;
this.canGainLife = player.isCanGainLife(); this.canLoseLife = player.isCanLoseLife(); this.attachments.clear();
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.isLifeTotalCanChange()) { Permanent perm = game.getPermanent(source.getSourceId()); if (perm != null) { int amount = perm.getPower().getValue(); int life = player.getLife(); if (life == amount) { return false; } if (life < amount && !player.isCanGainLife()) { return false; } if (life > amount && !player.isCanLoseLife()) { return false; } player.setLife(amount, game, source); game.addEffect(new SetPowerToughnessSourceEffect(life, Integer.MIN_VALUE, Duration.Custom, SubLayer.SetPT_7b), source); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null && player.isLifeTotalCanChange()) { Permanent perm = game.getPermanent(source.getSourceId()); if (perm != null) { int amount = perm.getToughness().getValue(); int life = player.getLife(); if (life == amount) { return false; } if (life < amount && !player.isCanGainLife()) { return false; } if (life > amount && !player.isCanLoseLife()) { return false; } player.setLife(amount, game, source); game.addEffect(new SetPowerToughnessSourceEffect(Integer.MIN_VALUE, life, Duration.Custom, SubLayer.SetPT_7b), source); return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player opponent = game.getPlayer(source.getFirstTarget()); if (opponent != null && opponent.isLifeTotalCanChange()) { Permanent perm = game.getPermanent(source.getSourceId()); if (perm != null) { int amount = perm.getToughness().getValue(); int life = opponent.getLife(); if (life == amount) { return false; } if (life < amount && !opponent.isCanGainLife()) { return false; } if (life > amount && !opponent.isCanLoseLife()) { return false; } opponent.setLife(amount, game, source); perm.getToughness().modifyBaseValue(life); // game.addEffect(new SetPowerToughnessSourceEffect(Integer.MIN_VALUE, life, Duration.Custom, SubLayer.SetPT_7b), source); return true; } } return false; }