mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Split cards correctly transform back if targeting is canceled or if mana cost is not paid. Also, consolidated the implementation of back-transformation when going to graveyard or exile (or another zone except stack).
This commit is contained in:
@@ -20,7 +20,9 @@ package forge.card.spellability;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardCharacteristicName;
|
||||
import forge.Singletons;
|
||||
import forge.card.CardSplitType;
|
||||
import forge.card.ability.AbilityUtils;
|
||||
import forge.card.cost.CostPayment;
|
||||
import forge.game.zone.Zone;
|
||||
@@ -149,6 +151,12 @@ public class SpellAbilityRequirements {
|
||||
if (this.select.isCanceled()) {
|
||||
// cancel ability during target choosing
|
||||
final Card c = this.ability.getSourceCard();
|
||||
|
||||
// split cards transform back to full form if targeting is canceled
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
|
||||
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
||||
// add back to where it came from
|
||||
Singletons.getModel().getGame().getAction().moveTo(this.fromZone, c, this.zonePosition);
|
||||
@@ -203,6 +211,12 @@ public class SpellAbilityRequirements {
|
||||
Singletons.getModel().getGame().getAction().checkStateEffects();
|
||||
} else if (this.payment.isCanceled()) {
|
||||
final Card c = this.ability.getSourceCard();
|
||||
|
||||
// split cards transform back to full form if targeting is canceled
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
|
||||
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
|
||||
// add back to Previous Zone
|
||||
Singletons.getModel().getGame().getAction().moveTo(this.fromZone, c, this.zonePosition);
|
||||
|
||||
@@ -340,6 +340,11 @@ public class GameAction {
|
||||
* @return a {@link forge.Card} object.
|
||||
*/
|
||||
public final Card moveTo(final Zone zoneTo, Card c) {
|
||||
// if a split card is moved, convert it back to its full form before moving (unless moving to stack)
|
||||
if ((c.getRules().getSplitType() == CardSplitType.Split) && (zoneTo != game.getStackZone())) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
|
||||
return moveTo(zoneTo, c, null);
|
||||
}
|
||||
|
||||
@@ -465,11 +470,6 @@ public class GameAction {
|
||||
c.getController().addPoisonCounters(1, c);
|
||||
}
|
||||
|
||||
// if a split card, convert back to its full face form before going to graveyard
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
|
||||
// must put card in OWNER's graveyard not controller's
|
||||
c = this.moveTo(grave, c);
|
||||
|
||||
@@ -711,11 +711,6 @@ public class GameAction {
|
||||
}
|
||||
final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
|
||||
|
||||
// if a split card, convert back to its full face form before going to graveyard
|
||||
if (c.getRules().getSplitType() == CardSplitType.Split) {
|
||||
c.setState(CardCharacteristicName.Original);
|
||||
}
|
||||
|
||||
return moveTo(removed, c);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user