Added possibility to check kind of cost to pay for conditional mana use.

This commit is contained in:
LevelX2 2016-01-10 12:01:58 +01:00
parent d63f6d7d27
commit c8f82b49ff
208 changed files with 770 additions and 571 deletions

View file

@ -159,7 +159,7 @@ public abstract class PayCostToAttackBlockEffectImpl extends ReplacementEffectIm
if (attackBlockOtherTax.canPay(source, source.getSourceId(), event.getPlayerId(), game)
&& player.chooseUse(Outcome.Neutral,
attackBlockOtherTax.getText() + " to " + (event.getType().equals(EventType.DECLARE_ATTACKER) ? "attack?" : "block?"), source, game)) {
if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false)) {
if (attackBlockOtherTax.pay(source, game, source.getSourceId(), event.getPlayerId(), false, null)) {
return false;
}
}

View file

@ -93,7 +93,7 @@ public class CounterUnlessPaysEffect extends OneShotEffect {
message = costToPay.getText() + " to prevent counter effect?";
}
costToPay.clearPaid();
if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false))) {
if (!(player.chooseUse(Outcome.Benefit, message, source, game) && costToPay.pay(source, game, spell.getSourceId(), spell.getControllerId(), false, null))) {
return game.getStack().counter(spell.getId(), source.getSourceId(), game);
}
return true;

View file

@ -93,7 +93,7 @@ public class DoUnlessAnyPlayerPaysEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, source, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
if (cost.pay(source, game, source.getSourceId(), player.getId(), false, null)) {
if (!game.isSimulation())
game.informPlayers(player.getLogName() + " pays the cost to prevent the effect");
doEffect = false;

View file

@ -78,7 +78,7 @@ public class EnterBattlefieldPayCostOrPutGraveyardEffect extends ReplacementEffe
if (cost.canPay(source, source.getSourceId(), player.getId(), game)) {
if (player.chooseUse(outcome, cost.getText() + "? (otherwise " + sourceObject.getLogName() + " is put into graveyard)", source, game)) {
cost.clearPaid();
replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false);
replace = !cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null);
}
}
if (replace) {

View file

@ -68,7 +68,7 @@ public class ExileSourceUnlessPaysEffect extends OneShotEffect {
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
if (controller.chooseUse(Outcome.Benefit, message, source, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
return true;
}
}

View file

@ -40,7 +40,7 @@ public class SacrificeSourceUnlessPaysEffect extends OneShotEffect {
message = Character.toUpperCase(message.charAt(0)) + message.substring(1);
if (player.chooseUse(Outcome.Benefit, message, source, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
return true;
}
}

View file

@ -66,7 +66,7 @@ public class TapSourceUnlessPaysEffect extends OneShotEffect {
if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game)
&& player.chooseUse(Outcome.Benefit, cost.getText() + "? (otherwise " + permanent.getName() + " becomes tapped)", source, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false)) {
if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) {
return true;
}
}

View file

@ -65,7 +65,9 @@ public class UntapSourceDuringEachOtherPlayersUntapStepEffect extends Continuous
applied = Boolean.FALSE;
}
if (!applied && layer.equals(Layer.RulesEffects)) {
if (!source.getControllerId().equals(game.getActivePlayerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
if (!source.getControllerId().equals(game.getActivePlayerId())
&& game.getStep() != null
&& game.getStep().getType() == PhaseStep.UNTAP) {
game.getState().setValue(source.getSourceId() + "applied", true);
Permanent permanent = (Permanent) game.getPermanent(source.getSourceId());
if (permanent != null) {
@ -79,7 +81,7 @@ public class UntapSourceDuringEachOtherPlayersUntapStepEffect extends Continuous
}
}
} else if (applied && layer.equals(Layer.RulesEffects)) {
if (game.getStep().getType() == PhaseStep.END_TURN) {
if (game.getStep() != null && game.getStep().getType() == PhaseStep.END_TURN) {
game.getState().setValue(source.getSourceId() + "applied", false);
}
}