CR 603.6b: cardsAddedThisTurn should not use LKI with unmodified characteristics for battlefield

This commit is contained in:
Bug Hunter
2022-01-14 04:43:47 +00:00
committed by Michael Kamensky
parent 37e8c41b7e
commit e1f784211f
10 changed files with 37 additions and 21 deletions

View File

@@ -53,7 +53,7 @@ public class CloneAi extends SpellAbilityAi {
boolean bFlag = false;
for (final Card c : defined) {
bFlag |= (!c.isCreature() && !c.isTapped() && !(c.getTurnInZone() == phase.getTurn()));
bFlag |= !c.isCreature() && !c.isTapped() && !(c.getTurnInZone() == phase.getTurn());
// for creatures that could be improved (like Figure of Destiny)
if (c.isCreature() && (!sa.hasParam("Duration") || (!c.isTapped() && !c.isSick()))) {

View File

@@ -89,6 +89,7 @@ public class GameCopier {
newPlayer.setCounters(Maps.newHashMap(origPlayer.getCounters()));
newPlayer.setLifeLostLastTurn(origPlayer.getLifeLostLastTurn());
newPlayer.setLifeLostThisTurn(origPlayer.getLifeLostThisTurn());
newPlayer.setLifeGainedThisTurn(origPlayer.getLifeGainedThisTurn());
newPlayer.getManaPool().add(origPlayer.getManaPool());
newPlayer.setCommanders(origPlayer.getCommanders()); // will be fixed up below
playerMap.put(origPlayer, newPlayer);

View File

@@ -17,7 +17,6 @@ public class EnumMapOfLists<K extends Enum<K>, V> extends EnumMap<K, Collection<
this.factory = factory;
}
public EnumMapOfLists(EnumMap<K, ? extends List<V>> m, Supplier<? extends Collection<V>> factory) {
super(m);
this.factory = factory;
@@ -42,7 +41,6 @@ public class EnumMapOfLists<K extends Enum<K>, V> extends EnumMap<K, Collection<
ensureCollectionFor(key).add(element);
}
@Override
public void addAll(K key, Collection<V> elements) {
ensureCollectionFor(key).addAll(elements);

View File

@@ -528,7 +528,7 @@ public class GameAction {
if (repres != ReplacementResult.NotReplaced) continue;
}
if (card == c) {
zoneTo.add(copied, position, lastKnownInfo); // the modified state of the card is also reported here (e.g. for Morbid + Awaken)
zoneTo.add(copied, position, toBattlefield ? null : lastKnownInfo); // the modified state of the card is also reported here (e.g. for Morbid + Awaken)
} else {
zoneTo.add(card, position, CardUtil.getLKICopy(card));
}
@@ -537,7 +537,7 @@ public class GameAction {
} else {
// "enter the battlefield as a copy" - apply code here
// but how to query for input here and continue later while the callers assume synchronous result?
zoneTo.add(copied, position, lastKnownInfo); // the modified state of the card is also reported here (e.g. for Morbid + Awaken)
zoneTo.add(copied, position, toBattlefield ? null : lastKnownInfo); // the modified state of the card is also reported here (e.g. for Morbid + Awaken)
c.setZone(zoneTo);
}
@@ -568,6 +568,12 @@ public class GameAction {
// Need to apply any static effects to produce correct triggers
checkStaticAbilities();
// CR 603.6b
if (toBattlefield) {
zoneTo.saveLKI(copied, lastKnownInfo);
}
game.getTriggerHandler().clearActiveTriggers(copied, null);
game.getTriggerHandler().registerActiveLTBTrigger(lastKnownInfo);
game.getTriggerHandler().registerActiveTrigger(copied, false);

View File

@@ -2706,9 +2706,6 @@ public class AbilityUtils {
String validFilter = workingCopy[hasFrom ? 4 : 2] ;
final List<Card> res = CardUtil.getThisTurnEntered(destination, origin, validFilter, c, ctb);
if (origin == null) { // Remove cards on the battlefield that changed controller
res.removeAll(CardUtil.getThisTurnEntered(destination, destination, validFilter, c, ctb));
}
return doXMath(res.size(), expr, c, ctb);
}
@@ -2722,9 +2719,6 @@ public class AbilityUtils {
String validFilter = workingCopy[hasFrom ? 4 : 2] ;
final List<Card> res = CardUtil.getLastTurnEntered(destination, origin, validFilter, c, ctb);
if (origin == null) { // Remove cards on the battlefield that changed controller
res.removeAll(CardUtil.getLastTurnEntered(destination, destination, validFilter, c, ctb));
}
return doXMath(res.size(), expr, c, ctb);
}

View File

@@ -1397,10 +1397,18 @@ public class CardProperty {
return false;
}
} else if (property.equals("cmcNotChosenEvenOdd")) {
if (source.hasChosenEvenOdd()) {
if ((card.getCMC() % 2 == 0) == (source.getChosenEvenOdd() == EvenOdd.Even)) {
return false;
}
if (!source.hasChosenEvenOdd()) {
return false;
}
if ((card.getCMC() % 2 == 0) == (source.getChosenEvenOdd() == EvenOdd.Even)) {
return false;
}
} else if (property.equals("cmcChosen")) {
if (!source.hasChosenNumber()) {
return false;
}
if (card.getCMC() != source.getChosenNumber()) {
return false;
}
} else if (property.startsWith("power") || property.startsWith("toughness")
|| property.startsWith("cmc") || property.startsWith("totalPT")) {

View File

@@ -111,7 +111,9 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
if (zt != zoneType) {
c.setTurnInController(getPlayer());
c.setTurnInZone(game.getPhaseHandler().getTurn());
cardsAddedThisTurn.add(zt, latestState != null ? latestState : c);
if (latestState != null) {
cardsAddedThisTurn.add(zt, latestState);
}
}
}
@@ -265,4 +267,13 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
return result;
}
public void saveLKI(Card c, Card old) {
final Zone oldZone = game.getZoneOf(old);
final ZoneType zt = oldZone == null ? ZoneType.Stack : oldZone.getZoneType();
if (zt == zoneType) {
return;
}
cardsAddedThisTurn.add(zt, CardUtil.getLKICopy(c));
}
}

View File

@@ -2,6 +2,5 @@ Name:Emissary's Ploy
Types:Conspiracy
Text:(Start the game with this conspiracy face up in the command zone.)
K:Before drawing your opening hand, choose 1, 2, or 3.
S:Mode$ Continuous | Affected$ Creature.YouCtrl+cmcEQX | AffectedZone$ Stack | AddHiddenKeyword$ May spend mana as though it were mana of any color to cast CARDNAME | Description$ You may spend mana as though it were mana of any color to cast creature spells with mana value equal to the chosen number.
SVar:X:Count$ChosenNumber
S:Mode$ Continuous | Affected$ Creature.YouCtrl+cmcChosen | AffectedZone$ Stack | AddHiddenKeyword$ May spend mana as though it were mana of any color to cast CARDNAME | Description$ You may spend mana as though it were mana of any color to cast creature spells with mana value equal to the chosen number.
Oracle:(Start the game with this conspiracy face up in the command zone.)\nBefore drawing your opening hand, choose 1, 2, or 3.\nYou may spend mana as though it were mana of any color to cast creature spells with mana value equal to the chosen number.

View File

@@ -4,8 +4,7 @@ Types:Creature Human Cleric
PT:2/2
K:ETBReplacement:Other:ChooseNumber
SVar:ChooseNumber:DB$ ChooseNumber | Defined$ You | SpellDescription$ As CARDNAME enters the battlefield, choose a number.
S:Mode$ CantBeCast | ValidCard$ Card.nonCreature+cmcEQX | Description$ Noncreature spells with mana value equal to the chosen number can't be cast.
SVar:X:Count$ChosenNumber
S:Mode$ CantBeCast | ValidCard$ Card.nonCreature+cmcChosen | Description$ Noncreature spells with mana value equal to the chosen number can't be cast.
AI:RemoveDeck:All
SVar:Picture:http://www.wizards.com/global/images/magic/general/sanctum_prelate.jpg
Oracle:As Sanctum Prelate enters the battlefield, choose a number.\nNoncreature spells with mana value equal to the chosen number can't be cast.

View File

@@ -2,7 +2,7 @@ Name:Sorin's Guide
ManaCost:3 B B
Types:Creature Vampire
PT:4/2
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a card named flying, Vampire CARDNAME, and put it into your hand. If you search your library this way, shuffle it.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigSearch | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a card named Sorin, Vampire Lord, and put it into your hand. If you search your library this way, shuffle it.
SVar:TrigSearch:DB$ ChangeZone | Origin$ Library | OriginChoice$ True | OriginAlternative$ Graveyard | AlternativeMessage$ Would you like to search your library with this ability? If you do, your library will be shuffled. | Destination$ Hand | ChangeType$ Card.namedSorin; Vampire Lord | ChangeNum$ 1 | Optional$ True
DeckHints:Name$Sorin, Vampire Lord
Oracle:When Sorin's Guide enters the battlefield, you may search your library and/or graveyard for a card named Sorin, Vampire Lord, reveal it, and put it into your hand. If you search your library this way, shuffle.