ChangeZoneEffect: special Facedown rules for Tezzeret

This commit is contained in:
Hanmac
2018-07-15 18:42:01 +02:00
parent 14043d88e5
commit d18f891e8f
4 changed files with 70 additions and 2 deletions

View File

@@ -153,6 +153,7 @@ public class GameAction {
// up on the wrong card state etc.).
if (c.isFaceDown() && (fromBattlefield || (toHand && zoneFrom.is(ZoneType.Exile)))) {
c.setState(CardStateName.Original, true);
c.runFaceupCommands();
}
// Clean up the temporary Dash SVar when the Dashed card leaves the battlefield

View File

@@ -6,7 +6,9 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.GameCommand;
import forge.card.CardStateName;
import forge.card.CardType;
import forge.game.Game;
import forge.game.GameEntity;
import forge.game.GameObject;
@@ -32,6 +34,7 @@ import forge.util.collect.*;
import forge.util.Lang;
import forge.util.MessageUtil;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -1101,11 +1104,49 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
}
}
}
// need to be facedown before it hits the battlefield in case of Replacement Effects or Trigger
if (sa.hasParam("FaceDown") && ZoneType.Battlefield.equals(destination)) {
c.setState(CardStateName.FaceDown, true);
// set New Pt doesn't work because this values need to be copyable for clone effects
if (sa.hasParam("FaceDownPower") || sa.hasParam("FaceDownToughness")) {
if (sa.hasParam("FaceDownPower")) {
c.setBasePower(AbilityUtils.calculateAmount(
source, sa.getParam("FaceDownPower"), sa));
}
if (sa.hasParam("FaceDownToughness")) {
c.setBaseToughness(AbilityUtils.calculateAmount(
source, sa.getParam("FaceDownToughness"), sa));
}
}
if (sa.hasParam("FaceDownAddType")) {
CardType t = new CardType(c.getCurrentState().getType());
t.addAll(Arrays.asList(sa.getParam("FaceDownAddType").split(",")));
c.getCurrentState().setType(t);
}
if (sa.hasParam("FaceDownPower") || sa.hasParam("FaceDownToughness")
|| sa.hasParam("FaceDownAddType")) {
final GameCommand unanimate = new GameCommand() {
private static final long serialVersionUID = 8853789549297846163L;
@Override
public void run() {
c.clearStates(CardStateName.FaceDown, true);
}
};
c.addFaceupCommand(unanimate);
}
}
movedCard = game.getAction().moveTo(c.getController().getZone(destination), c, sa, null);
if (sa.hasParam("Tapped")) {
movedCard.setTapped(true);
}
if (sa.hasParam("FaceDown")) {
// need to do that again?
if (sa.hasParam("FaceDown") && !ZoneType.Battlefield.equals(destination)) {
movedCard.setState(CardStateName.FaceDown, true);
}
movedCard.setTimestamp(ts);

View File

@@ -234,6 +234,7 @@ public class Card extends GameEntity implements Comparable<Card> {
private final List<GameCommand> untapCommandList = Lists.newArrayList();
private final List<GameCommand> changeControllerCommandList = Lists.newArrayList();
private final List<GameCommand> unattachCommandList = Lists.newArrayList();
private final List<GameCommand> faceupCommandList = Lists.newArrayList();
private final List<Object[]> staticCommandList = Lists.newArrayList();
private final static ImmutableList<String> storableSVars = ImmutableList.of("ChosenX");
@@ -589,6 +590,12 @@ public class Card extends GameEntity implements Comparable<Card> {
}
boolean result = setState(preFaceDownState, true);
// need to run faceup commands, currently
// it does cleanup the modified facedown state
if (result) {
runFaceupCommands();
}
if (result && runTriggers) {
// Run replacement effects
Map<String, Object> repParams = Maps.newHashMap();
@@ -2389,13 +2396,23 @@ public class Card extends GameEntity implements Comparable<Card> {
public final void addUnattachCommand(final GameCommand c) {
unattachCommandList.add(c);
}
public final void addFaceupCommand(final GameCommand c) {
faceupCommandList.add(c);
}
public final void runUnattachCommands() {
for (final GameCommand c : unattachCommandList) {
c.run();
}
}
public final void runFaceupCommands() {
for (final GameCommand c : faceupCommandList) {
c.run();
}
}
public final void addChangeControllerCommand(final GameCommand c) {
changeControllerCommandList.add(c);
}

View File

@@ -0,0 +1,9 @@
Name:Tezzeret, Cruel Machinist
ManaCost:4 U U
Loyalty:4
Types:Legendary Planeswalker Tezzeret
A:AB$ Draw | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | NumCards$ 1 | Defined$ You | SpellDescription$ Draw a card.
A:AB$ Animate | Cost$ AddCounter<0/LOYALTY> | ValidTgts$ Artifact.YouCtrl | TgtPrompt$ Select target artifact you control | Power$ 5 | Toughness$ 5 | Types$ Artifact | SpellDescription$ Until your next turn, target artifact you control becomes a 5/5 creature in addition to its other types.
A:AB$ ChangeZone | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Ultimate$ True | Origin$ Hand | Destination$ Battlefield | ChangeType$ Card | ChangeNum$ X | References$ X | FaceDown$ True | FaceDownPower$ 5 | FaceDownToughness$ 5 | FaceDownAddType$ Artifact,Creature | StackDescription$ SpellDescription | SpellDescription$ Put any number of cards from your hand onto the battlefield face down. They're 5/5 artifact creatures.
SVar:X:Count$InYourHand
Oracle:[+1]: Draw a card.\n[0]: Until your next turn, target artifact you control becomes a 5/5 creature in addition to its other types.\n[-7]: Put any number of cards from your hand onto the battlefield face down. They're 5/5 artifact creatures.