Refactor Escape and AlternativeCost

This commit is contained in:
Hans Mackowiak
2020-01-03 04:40:09 +00:00
committed by Michael Kamensky
parent 6d193c315e
commit b2fcc6e743
21 changed files with 191 additions and 184 deletions

View File

@@ -87,7 +87,7 @@ public class HumanPlay {
sa = AbilityUtils.addSpliceEffects(sa);
if (sa.hasParam("Bestow")) {
if (sa.isBestow()) {
source.animateBestow();
}

View File

@@ -159,7 +159,7 @@ public class HumanPlaySpellAbility {
if (!prerequisitesMet) {
if (!ability.isTrigger()) {
rollbackAbility(fromZone, fromState, zonePosition, payment);
rollbackAbility(fromZone, zonePosition, payment);
if (ability.getHostCard().isMadness()) {
// if a player failed to play madness cost, move the card to graveyard
Card newCard = game.getAction().moveToGraveyard(c, null);
@@ -244,14 +244,13 @@ public class HumanPlaySpellAbility {
}
}
private void rollbackAbility(final Zone fromZone, final CardStateName fromState, final int zonePosition, CostPayment payment) {
private void rollbackAbility(final Zone fromZone, final int zonePosition, CostPayment payment) {
// cancel ability during target choosing
final Game game = ability.getActivatingPlayer().getGame();
if (fromZone != null) { // and not a copy
// add back to where it came from
game.getAction().moveTo(fromZone, ability.getHostCard(), zonePosition >= 0 ? Integer.valueOf(zonePosition) : null, null);
ability.getHostCard().setState(fromState, true);
}
clearTargets(ability);