Merge branch 'thisTurnEnteredProperty' into 'master'

CardProperty: ThisTurnEntered and ThisTurnEnteredFrom for better check

Closes #1711 and #1710

See merge request core-developers/forge!3777
This commit is contained in:
Hans Mackowiak
2021-02-07 14:40:06 +00:00
18 changed files with 38 additions and 35 deletions

View File

@@ -1039,17 +1039,21 @@ public class CardProperty {
}
}
return false;
} else if (property.startsWith("ThisTurnEntered")) {
final String restrictions = property.split("ThisTurnEntered_")[1];
final String[] res = restrictions.split("_");
final ZoneType destination = ZoneType.smartValueOf(res[0]);
ZoneType origin = null;
if (res.length > 1 && res[1].equals("from")) {
origin = ZoneType.smartValueOf(res[2]);
} else if (property.equals("ThisTurnEntered")) {
// only check if it entered the Zone this turn
if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) {
return false;
}
List<Card> cards = CardUtil.getThisTurnEntered(destination,
origin, "Card", source);
if (!cards.contains(card)) {
} else if (property.startsWith("ThisTurnEnteredFrom")) {
final String restrictions = property.split("ThisTurnEnteredFrom_")[1];
final String[] res = restrictions.split("_");
final ZoneType origin = ZoneType.smartValueOf(res[0]);
if (card.getTurnInZone() != game.getPhaseHandler().getTurn()) {
return false;
}
if (card.getZone().isCardAddedThisTurn(card, origin)) {
return false;
}
} else if (property.equals("DiscardedThisTurn")) {

View File

@@ -211,6 +211,13 @@ public class Zone implements java.io.Serializable, Iterable<Card> {
return getCardsAdded(cardsAddedLastTurn, origin);
}
public final boolean isCardAddedThisTurn(final Card card, final ZoneType origin) {
if (!cardsAddedThisTurn.containsKey(origin)) {
return false;
}
return cardsAddedThisTurn.get(origin).contains(card);
}
private static List<Card> getCardsAdded(final MapOfLists<ZoneType, Card> cardsAdded, final ZoneType origin) {
if (origin != null) {
final Collection<Card> cards = cardsAdded.get(origin);

View File

@@ -1,5 +1,5 @@
Name:Brought Back
ManaCost:W W
Types:Instant
A:SP$ ChangeZone | Cost$ W W | ValidTgts$ Permanent.YouOwn+ThisTurnEntered_Graveyard_from_Battlefield | TgtPrompt$ Select up to two target permanent cards in your graveyard that were put there from the battlefield this turn | TargetMin$ 0 | TargetMax$ 2 | Origin$ Graveyard | Destination$ Battlefield | Tapped$ True | SpellDescription$ Choose up to two target permanent cards in your graveyard that were put there from the battlefield this turn. Return them to the battlefield tapped.
A:SP$ ChangeZone | Cost$ W W | ValidTgts$ Permanent.YouOwn+ThisTurnEnteredFrom_Battlefield | TgtPrompt$ Select up to two target permanent cards in your graveyard that were put there from the battlefield this turn | TargetMin$ 0 | TargetMax$ 2 | Origin$ Graveyard | Destination$ Battlefield | Tapped$ True | SpellDescription$ Choose up to two target permanent cards in your graveyard that were put there from the battlefield this turn. Return them to the battlefield tapped.
Oracle:Choose up to two target permanent cards in your graveyard that were put there from the battlefield this turn. Return them to the battlefield tapped.

View File

@@ -2,5 +2,5 @@ Name:Cry of the Carnarium
ManaCost:1 B B
Types:Sorcery
A:SP$ PumpAll | Cost$ 1 B B | ValidCards$ Creature | NumAtt$ -2 | NumDef$ -2 | IsCurse$ True | ReplaceDyingValid$ Creature | SubAbility$ ExileSomeCreatures | SpellDescription$ All creatures get -2/-2 until end of turn. Exile all creature cards in all graveyards that were put there from the battlefield this turn. If a creature would die this turn, exile it instead.
SVar:ExileSomeCreatures:DB$ ChangeZone | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Creature.nonToken | Origin$ Graveyard | Destination$ Exile | SpellDescription$ Exile all creature cards in all graveyards that were put there from the battlefield this turn.
SVar:ExileSomeCreatures:DB$ ChangeZone | Defined$ ValidGraveyard Creature.nonToken+ThisTurnEnteredFrom_Battlefield | Origin$ Graveyard | Destination$ Exile | SpellDescription$ Exile all creature cards in all graveyards that were put there from the battlefield this turn.
Oracle:All creatures get -2/-2 until end of turn. Exile all creature cards in all graveyards that were put there from the battlefield this turn. If a creature would die this turn, exile it instead.

View File

@@ -1,6 +1,5 @@
Name:Faith's Reward
ManaCost:3 W
Types:Instant
A:SP$ ChangeZone | Cost$ 3 W | Origin$ Graveyard | Destination$ Battlefield | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Permanent.YouOwn | SpellDescription$ Return to the battlefield all permanent cards in your graveyard that were put there from the battlefield this turn.
SVar:Picture:http://www.wizards.com/global/images/magic/general/faiths_reward.jpg
A:SP$ ChangeZone | Cost$ 3 W | Origin$ Graveyard | Destination$ Battlefield | Defined$ ValidGraveyard Permanent.YouOwn+ThisTurnEnteredFrom_Battlefield | SpellDescription$ Return to the battlefield all permanent cards in your graveyard that were put there from the battlefield this turn.
Oracle:Return to the battlefield all permanent cards in your graveyard that were put there from the battlefield this turn.

View File

@@ -3,7 +3,6 @@ ManaCost:5 B B
Types:Creature Avatar
PT:8/6
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigReturn | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, you may return all creature cards put into your graveyard from the battlefield this turn to your hand.
SVar:TrigReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Card.YouOwn+Creature
SVar:TrigReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ValidGraveyard Creature.YouOwn+ThisTurnEnteredFrom_Battlefield
A:AB$ Pump | Cost$ B Sac<1/Creature.Other/another creature> | ValidTgts$ Creature | NumAtt$ -2 | NumDef$ -2 | SpellDescription$ Target creature gets -2/-2 until end of turn.
SVar:Picture:http://www.wizards.com/global/images/magic/general/fell_shepherd.jpg
Oracle:Whenever Fell Shepherd deals combat damage to a player, you may return to your hand all creature cards that were put into your graveyard from the battlefield this turn.\n{B}, Sacrifice another creature: Target creature gets -2/-2 until end of turn.

View File

@@ -4,7 +4,6 @@ Types:Legendary Creature Human Warrior
PT:3/3
K:Flash
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | TriggerDescription$ When CARDNAME enters the battlefield, return to your hand all creature cards in your graveyard that were put there from anywhere this turn.
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ThisTurnEntered_Graveyard_Card.Creature+YouOwn+nonToken
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ValidGraveyard Creature.YouOwn+nonToken+ThisTurnEntered
S:Mode$ Continuous | Affected$ Creature.Other+YouCtrl | AddKeyword$ Haste | Description$ Other creatures you control have haste.
SVar:Picture:http://www.wizards.com/global/images/magic/general/garna_the_bloodflame.jpg
Oracle:Flash\nWhen Garna, the Bloodflame enters the battlefield, return to your hand all creature cards in your graveyard that were put there from anywhere this turn.\nOther creatures you control have haste.

View File

@@ -5,5 +5,5 @@ PT:3/3
K:First Strike
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigExile | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME dies, exile it and return to the battlefield all artifact and creature cards in your graveyard that were put there from the battlefield this turn.
SVar:TrigExile:DB$ ChangeZone | Defined$ TriggeredNewCardLKICopy | Origin$ Graveyard | Destination$ Exile | SubAbility$ DBReturn
SVar:DBReturn:DB$ChangeZone | Origin$ Graveyard | Destination$ Battlefield | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Card.Artifact+YouOwn,Card.Creature+YouOwn
SVar:DBReturn:DB$ ChangeZone | Origin$ Graveyard | Destination$ Battlefield | Defined$ ValidGraveyard Artifact.YouOwn+ThisTurnEnteredFrom_Battlefield,Creature.YouOwn+ThisTurnEnteredFrom_Battlefield
Oracle:First strike\nWhen Gerrard, Weatherlight Hero dies, exile it and return to the battlefield all artifact and creature cards in your graveyard that were put there from the battlefield this turn.

View File

@@ -4,7 +4,7 @@ Types:Legendary Creature Pirate Spirit
PT:2/3
K:CantBeBlockedBy Creature.toughnessGE3
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ TrigChangeZone | TriggerZones$ Battlefield | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, choose up to one target card in any graveyard that has been discarded or put there from a library this turn. Put that card into its owner's hand.
SVar:TrigChangeZone:DB$ ChangeZone | TargetMin$ 0 | TargetMax$ 1 | Origin$ Graveyard | Destination$ Hand | ValidTgts$ Card.DiscardedThisTurn,Card.ThisTurnEntered_Graveyard_from_Library | TgtPrompt$ Choose up to one target card in any graveyard that has been discarded or put there from a library this turn
SVar:TrigChangeZone:DB$ ChangeZone | TargetMin$ 0 | TargetMax$ 1 | Origin$ Graveyard | Destination$ Hand | ValidTgts$ Card.DiscardedThisTurn,Card.ThisTurnEnteredFrom_Library | TgtPrompt$ Choose up to one target card in any graveyard that has been discarded or put there from a library this turn
K:Partner
DeckHas:Ability$Graveyard
DeckHints:Ability$Mill

View File

@@ -3,7 +3,6 @@ ManaCost:3 BG BG BG
Types:Creature Insect Horror
PT:6/6
K:Trample
T:Mode$Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigChangeZone | TriggerDescription$ At the beginning of your end step, return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Card.Creature+YouCtrl
SVar:Picture:http://www.wizards.com/global/images/magic/general/gleancrawler.jpg
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigChangeZone | TriggerDescription$ At the beginning of your end step, return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ValidGraveyard Creature.YouCtrl+ThisTurnEnteredFrom_Battlefield
Oracle:Trample\nAt the beginning of your end step, return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.

View File

@@ -1,6 +1,5 @@
Name:Grim Return
ManaCost:2 B
Types:Instant
A:SP$ ChangeZone | Cost$ 2 B | Origin$ Graveyard | Destination$ Battlefield | GainControl$ True | ValidTgts$ Card.Creature+ThisTurnEntered_Graveyard_from_Battlefield | TgtPrompt$ Select target creature card in a graveyard that was put there from the battlefield this turn | SpellDescription$ Choose target creature card in a graveyard that was put there from the battlefield this turn. Put that card onto the battlefield under your control.
SVar:Picture:http://www.wizards.com/global/images/magic/general/grim_return.jpg
A:SP$ ChangeZone | Cost$ 2 B | Origin$ Graveyard | Destination$ Battlefield | GainControl$ True | ValidTgts$ Card.Creature+ThisTurnEnteredFrom_Battlefield | TgtPrompt$ Select target creature card in a graveyard that was put there from the battlefield this turn | SpellDescription$ Choose target creature card in a graveyard that was put there from the battlefield this turn. Put that card onto the battlefield under your control.
Oracle:Choose target creature card in a graveyard that was put there from the battlefield this turn. Put that card onto the battlefield under your control.

View File

@@ -9,7 +9,7 @@ SVar:LoseTrack:DB$ Pump | ForgetObjects$ TriggeredCard
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ DBCleanup | Static$ True
T:Mode$ TurnBegin | Execute$ DBCleanup | Static$ True
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player | TriggerZones$ Battlefield | CheckSVar$ X | SVarCompare$ GE1 | IsPresent$ Card.Self | Execute$ TrigChange | TriggerDescription$ At the beginning of each end step, if a creature dealt damage by CARDNAME this turn died, put that card onto the battlefield under your control. Sacrifice it when you lose control of CARDNAME.
SVar:TrigChange:DB$ ChangeZoneAll | ChangeType$ Creature.IsRemembered+ThisTurnEntered_Graveyard_from_Battlefield | Origin$ Graveyard | Destination$ Battlefield | GainControl$ True | RememberChanged$ True | ForgetOtherRemembered$ True | SubAbility$ TrigDelay
SVar:TrigChange:DB$ ChangeZoneAll | ChangeType$ Creature.IsRemembered+ThisTurnEnteredFrom_Battlefield | Origin$ Graveyard | Destination$ Battlefield | GainControl$ True | RememberChanged$ True | ForgetOtherRemembered$ True | SubAbility$ TrigDelay
SVar:TrigDelay:DB$ DelayedTrigger | Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | RememberObjects$ Remembered | Execute$ TrigSac | Secondary$ True | SubAbility$ DBCleanup | SpellDescription$ Sacrifice it when you lose control of CARDNAME.
SVar:TrigSac:DB$ SacrificeAll | Defined$ DelayTriggerRemembered | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True

View File

@@ -4,5 +4,5 @@ Types:Instant Trap
SVar:AltCost:Cost$ 3 R R | CheckSVar$ LandsEntered | SVarCompare$ GE2 | References$ LandsEntered | Description$ If an opponent had two or more lands enter the battlefield under their control this turn, you may pay {3}{R}{R} rather than pay this spell's mana cost.
A:SP$ Destroy | Cost$ 6 R R | TargetMin$ 2 | TargetMax$ 2 | ValidTgts$ Land | TgtPrompt$ Select two target lands | SubAbility$ DBDamageAll | SpellDescription$ Destroy two target lands. CARDNAME deals 4 damage to each creature.
SVar:DBDamageAll:DB$ DamageAll | ValidCards$ Creature | NumDmg$ 4 | ValidDescription$ each creature.
SVar:LandsEntered:PlayerCountOpponents$HighestValid Card.ThisTurnEntered_Battlefield_Land.YouCtrl
SVar:LandsEntered:PlayerCountOpponents$HighestValid Land.YouCtrl+ThisTurnEntered
Oracle:If an opponent had two or more lands enter the battlefield under their control this turn, you may pay {3}{R}{R} rather than pay this spell's mana cost.\nDestroy two target lands. Lavaball Trap deals 4 damage to each creature.

View File

@@ -1,6 +1,5 @@
Name:No Rest for the Wicked
ManaCost:1 B
Types:Enchantment
A:AB$ ChangeZone | Cost$ Sac<1/CARDNAME> | Origin$ Graveyard | Destination$ Hand | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Card.Creature+YouCtrl | SpellDescription$ Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.
SVar:Picture:http://www.wizards.com/global/images/magic/general/no_rest_for_the_wicked.jpg
A:AB$ ChangeZone | Cost$ Sac<1/CARDNAME> | Origin$ Graveyard | Destination$ Hand | Defined$ ValidGraveyard Creature.YouOwn+ThisTurnEnteredFrom_Battlefield | SpellDescription$ Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.
Oracle:Sacrifice No Rest for the Wicked: Return to your hand all creature cards in your graveyard that were put there from the battlefield this turn.

View File

@@ -2,6 +2,6 @@ Name:Salvager of Ruin
ManaCost:3
Types:Artifact Creature Construct
PT:2/1
A:AB$ ChangeZone | Cost$ Sac<1/CARDNAME> | ValidTgts$ Permanent.YouOwn+ThisTurnEntered_Graveyard_from_Battlefield | Origin$ Graveyard | Destination$ Hand | TgtPrompt$ Choose target permanent card in your graveyard that was put there from the battlefield this turn | SpellDescription$ Choose target permanent card in your graveyard that was put there from the battlefield this turn. Return it to your hand.
A:AB$ ChangeZone | Cost$ Sac<1/CARDNAME> | ValidTgts$ Permanent.YouOwn+ThisTurnEnteredFrom_Battlefield | Origin$ Graveyard | Destination$ Hand | TgtPrompt$ Choose target permanent card in your graveyard that was put there from the battlefield this turn | SpellDescription$ Choose target permanent card in your graveyard that was put there from the battlefield this turn. Return it to your hand.
AI:RemoveDeck:Random
Oracle:Sacrifice Salvager of Ruin: Choose target permanent card in your graveyard that was put there from the battlefield this turn. Return it to your hand.

View File

@@ -1,6 +1,5 @@
Name:Second Sunrise
ManaCost:1 W W
Types:Instant
A:SP$ChangeZone | Cost$ 1 W W | Origin$ Graveyard | Destination$ Battlefield | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Card.Artifact,Card.Creature,Card.Enchantment,Card.Land | SpellDescription$ Each player returns to the battlefield all artifact, creature, enchantment, and land cards in their graveyard that were put there from the battlefield this turn.
SVar:Picture:http://www.wizards.com/global/images/magic/general/second_sunrise.jpg
A:SP$ChangeZone | Cost$ 1 W W | Origin$ Graveyard | Destination$ Battlefield | Defined$ ValidGraveyard Artifact.ThisTurnEnteredFrom_Battlefield,Creature.ThisTurnEnteredFrom_Battlefield,Enchantment.ThisTurnEnteredFrom_Battlefield,Land.ThisTurnEnteredFrom_Battlefield | SpellDescription$ Each player returns to the battlefield all artifact, creature, enchantment, and land cards in their graveyard that were put there from the battlefield this turn.
Oracle:Each player returns to the battlefield all artifact, creature, enchantment, and land cards in their graveyard that were put there from the battlefield this turn.

View File

@@ -1,5 +1,5 @@
Name:Thrilling Encore
ManaCost:4 B
Types:Instant
A:SP$ ChangeZone | Cost$ 4 B | Origin$ Graveyard | Destination$ Battlefield | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Creature.nonToken | GainControl$ True | SpellDescription$ Put onto the battlefield under your control all creature cards in all graveyards that were put there from the battlefield this turn.
A:SP$ ChangeZone | Cost$ 4 B | Origin$ Graveyard | Destination$ Battlefield | Defined$ ValidGraveyard Creature.ThisTurnEnteredFrom_Battlefield | GainControl$ True | SpellDescription$ Put onto the battlefield under your control all creature cards in all graveyards that were put there from the battlefield this turn.
Oracle:Put onto the battlefield under your control all creature cards in all graveyards that were put there from the battlefield this turn.

View File

@@ -6,6 +6,5 @@ K:Flying
K:Vigilance
K:Persist
T:Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | TriggerDescription$ When CARDNAME enters the battlefield, return to your hand all cards in your graveyard that were put there from the battlefield this turn.
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ThisTurnEntered_Graveyard_from_Battlefield_Card.YouCtrl
SVar:Picture:http://www.wizards.com/global/images/magic/general/twilight_shepherd.jpg
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Hand | Defined$ ValidGraveyard Card.YouOwn+ThisTurnEnteredFrom_Battlefield
Oracle:Flying, vigilance\nWhen Twilight Shepherd enters the battlefield, return to your hand all cards in your graveyard that were put there from the battlefield this turn.\nPersist (When this creature dies, if it had no -1/-1 counters on it, return it to the battlefield under its owner's control with a -1/-1 counter on it.)