diff --git a/forge-game/src/main/java/forge/game/Game.java b/forge-game/src/main/java/forge/game/Game.java index ac8c1ceeeef..9021921122e 100644 --- a/forge-game/src/main/java/forge/game/Game.java +++ b/forge-game/src/main/java/forge/game/Game.java @@ -1115,11 +1115,9 @@ public class Game { List> result = countersAddedThisTurn.get(cType, putter); if (result == null) { result = Lists.newArrayList(); - } - result.add(Pair.of(CardUtil.getLKICopy(card), value)); - if (!countersAddedThisTurn.contains(cType, putter)) { countersAddedThisTurn.put(cType, putter, result); } + result.add(Pair.of(CardUtil.getLKICopy(card), value)); } public int getCounterAddedThisTurn(CounterType cType, String validPlayer, String validCard, Card source, Player sourceController, CardTraitBase ctb) { diff --git a/forge-game/src/main/java/forge/game/card/CardProperty.java b/forge-game/src/main/java/forge/game/card/CardProperty.java index 785efb9f7e9..032a2da5943 100644 --- a/forge-game/src/main/java/forge/game/card/CardProperty.java +++ b/forge-game/src/main/java/forge/game/card/CardProperty.java @@ -639,18 +639,12 @@ public class CardProperty { } final String restriction = property.split("SharesColorWith ")[1]; - if (restriction.startsWith("Remembered") || restriction.startsWith("Imprinted")) { + if (restriction.startsWith("Remembered") || restriction.startsWith("Imprinted") || restriction.startsWith("TopOfLibrary")) { CardCollection list = AbilityUtils.getDefinedCards(source, restriction, spellAbility); return Iterables.any(list, CardPredicates.sharesColorWith(card)); } switch (restriction) { - case "TopCardOfLibrary": - final CardCollectionView cards = sourceController.getCardsIn(ZoneType.Library); - if (cards.isEmpty() || !card.sharesColorWith(cards.get(0))) { - return false; - } - break; case "Equipped": if (!source.isEquipment() || !source.isEquipping() || !card.sharesColorWith(source.getEquipping())) { @@ -778,16 +772,6 @@ public class CardProperty { return false; } break; - case "Remembered": - for (final Object rem : source.getRemembered()) { - if (rem instanceof Card) { - final Card c = (Card) rem; - if (card.sharesCardTypeWith(c)) { - return true; - } - } - } - return false; case "EachTopLibrary": final CardCollection cards = new CardCollection(); for (Player p : game.getPlayers()) { @@ -930,13 +914,8 @@ public class CardProperty { } else { final String restriction = property.split("sharesOwnerWith ")[1]; CardCollection def = AbilityUtils.getDefinedCards(source, restriction, spellAbility); - for (final Object rem : def) { - if (rem instanceof Card) { - final Card c = (Card) rem; - if (!card.getOwner().equals(c.getOwner())) { - return false; - } - } + if (!Iterables.all(def, CardPredicates.isOwner(card.getOwner()))) { + return false; } } } else if (property.startsWith("SecondSpellCastThisTurn")) { diff --git a/forge-gui/res/cardsfolder/a/absorb_energy.txt b/forge-gui/res/cardsfolder/a/absorb_energy.txt index 5394ec2fda4..b3a4a44b3fb 100644 --- a/forge-gui/res/cardsfolder/a/absorb_energy.txt +++ b/forge-gui/res/cardsfolder/a/absorb_energy.txt @@ -2,7 +2,7 @@ Name:Absorb Energy ManaCost:1 U U Types:Instant A:SP$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | RememberCountered$ True | SubAbility$ DBEffect | SpellDescription$ Counter target spell. -SVar:DBEffect:DB$ Effect | ImprintCards$ Remembered | RememberObjects$ ValidHand Card.YouOwn+sharesCardTypeWith Remembered | StaticAbilities$ PerpetualAbility | Duration$ Permanent | Triggers$ Update | Name$ Absorb Energy's Perpetual Effect | SubAbility$ DBCleanup | SpellDescription$ Cards in your hand that share a card type with that spell perpetually gain "This spell costs {1} less to cast." +SVar:DBEffect:DB$ Effect | ImprintCards$ Remembered | RememberObjects$ ValidHand Card.YouOwn+sharesCardTypeWith RememberedLKI | StaticAbilities$ PerpetualAbility | Duration$ Permanent | Triggers$ Update | Name$ Absorb Energy's Perpetual Effect | SubAbility$ DBCleanup | SpellDescription$ Cards in your hand that share a card type with that spell perpetually gain "This spell costs {1} less to cast." SVar:PerpetualAbility:Mode$ Continuous | Affected$ Card.IsRemembered | AddStaticAbility$ PerpetualReduceCost | EffectZone$ Command | AffectedZone$ Battlefield,Hand,Graveyard,Exile,Stack,Library,Command | Description$ Cards in your hand that share a card type with that [imprinted] spell perpetually gain "This spell costs {1} less to cast." SVar:PerpetualReduceCost:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ 1 | EffectZone$ All | Description$ This spell costs {1} less to cast. SVar:Update:Mode$ ChangesZone | Origin$ Any | Destination$ Any | Static$ True | ValidCard$ Card.IsRemembered | Execute$ DBUpdate diff --git a/forge-gui/res/cardsfolder/c/crown_of_convergence.txt b/forge-gui/res/cardsfolder/c/crown_of_convergence.txt index 74b1a6fcc9d..0152b053907 100644 --- a/forge-gui/res/cardsfolder/c/crown_of_convergence.txt +++ b/forge-gui/res/cardsfolder/c/crown_of_convergence.txt @@ -2,7 +2,7 @@ Name:Crown of Convergence ManaCost:2 Types:Artifact S:Mode$ Continuous | Affected$ Card.TopLibrary+YouCtrl | AffectedZone$ Library | MayLookAt$ Player | Description$ Play with the top card of your library revealed. -S:Mode$ Continuous | Affected$ Creature.SharesColorWith TopCardOfLibrary+YouCtrl | AddPower$ 1 | AddToughness$ 1 | TopCardOfLibraryIs$ Creature | Description$ As long as the top card of your library is a creature card, creatures you control that share a color with that card get +1/+1. +S:Mode$ Continuous | Affected$ Creature.YouCtrl+SharesColorWith TopOfLibrary | AddPower$ 1 | AddToughness$ 1 | TopCardOfLibraryIs$ Creature | Description$ As long as the top card of your library is a creature card, creatures you control that share a color with that card get +1/+1. A:AB$ Dig | Cost$ G W | LibraryPosition$ -1 | DigNum$ 1 | Reveal$ False | DestinationZone$ Library | SpellDescription$ Put the top card of your library on the bottom of your library AI:RemoveDeck:All Oracle:Play with the top card of your library revealed.\nAs long as the top card of your library is a creature card, creatures you control that share a color with that card get +1/+1.\n{G}{W}: Put the top card of your library on the bottom of your library. diff --git a/forge-gui/res/cardsfolder/c/cryptic_gateway.txt b/forge-gui/res/cardsfolder/c/cryptic_gateway.txt index c3d423b3285..9b8a7ef7fa6 100644 --- a/forge-gui/res/cardsfolder/c/cryptic_gateway.txt +++ b/forge-gui/res/cardsfolder/c/cryptic_gateway.txt @@ -1,7 +1,8 @@ Name:Cryptic Gateway ManaCost:5 Types:Artifact -A:AB$ ChangeZone | Cost$ tapXType<2/Creature> | ChangeType$ Creature.sharesCreatureTypeWith Tapped | Origin$ Hand | Destination$ Battlefield | ChangeNum$ 1 | Optional$ True | SpellDescription$ You may put a creature card from your hand that shares a creature type with each creature tapped this way onto the battlefield. +A:AB$ ChangeZone | Cost$ tapXType<2/Creature> | RememberCostCards$ True | ChangeType$ Creature.sharesCreatureTypeWith AllRemembered | Origin$ Hand | Destination$ Battlefield | ChangeNum$ 1 | Optional$ True | SpellDescription$ You may put a creature card from your hand that shares a creature type with each creature tapped this way onto the battlefield. | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:NonStackingEffect:True AI:RemoveDeck:All Oracle:Tap two untapped creatures you control: You may put a creature card from your hand that shares a creature type with each creature tapped this way onto the battlefield. diff --git a/forge-gui/res/cardsfolder/e/elkin_lair.txt b/forge-gui/res/cardsfolder/e/elkin_lair.txt index 0616971f4a0..ee34e9283d4 100644 --- a/forge-gui/res/cardsfolder/e/elkin_lair.txt +++ b/forge-gui/res/cardsfolder/e/elkin_lair.txt @@ -3,7 +3,7 @@ ManaCost:3 R Types:World Enchantment T:Mode$ Phase | Phase$ Upkeep | TriggerZones$ Battlefield | Execute$ TrigChangeZone | TriggerDescription$ At the beginning of each player's upkeep, that player exiles a card at random from their hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard. SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Hand | Destination$ Exile | ChangeType$ Card | DefinedPlayer$ TriggeredPlayer | ChangeNum$ 1 | Hidden$ True | Mandatory$ True | AtRandom$ True | RememberChanged$ True | SubAbility$ ElkinEffect -SVar:ElkinEffect:DB$ Effect | StaticAbilities$ ElkinPlay | Duration$ Permanent | ExileOnMoved$ True | RememberObjects$ RememberedCard | Triggers$ TrigReturn,TrigDuration | SubAbility$ DBResetSVar +SVar:ElkinEffect:DB$ Effect | StaticAbilities$ ElkinPlay | Duration$ Permanent | ExileOnMoved$ Exile | RememberObjects$ RememberedCard | Triggers$ TrigReturn,TrigDuration | SubAbility$ DBResetSVar SVar:ElkinPlay:Mode$ Continuous | Affected$ Card.IsRemembered | MayPlay$ True | MayPlayPlayer$ CardOwner | EffectZone$ Command | AffectedZone$ Exile | CheckSVar$ ElkinSVar | Description$ The player may play that card this turn. # Even though the Effect is "Permanent", it's not really permanent SVar:DBResetSVar:DB$ StoreSVar | SVar$ ElkinSVar | Type$ Number | Expression$ 1 | SubAbility$ DBCleanup @@ -13,8 +13,7 @@ SVar:ElkinSVar:Number$1 SVar:TrigDuration:Mode$ TurnBegin | ValidPlayer$ Player | Static$ True | TriggerZones$ Command | Execute$ DBDuration SVar:DBDuration:DB$ StoreSVar | SVar$ ElkinSVar | Type$ Number | Expression$ 0 # Return the card as a normal trigger -SVar:TrigReturn:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player | TriggerZones$ Command | Execute$ DBReturn | TriggerDescription$ At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard. -SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Graveyard | SubAbility$ RemoveEffect -SVar:RemoveEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile +SVar:TrigReturn:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ Player | TriggerZones$ Command | Execute$ DBReturn | OneOff$ True | TriggerDescription$ At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard. +SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Graveyard AI:RemoveDeck:Random Oracle:At the beginning of each player's upkeep, that player exiles a card at random from their hand. The player may play that card this turn. At the beginning of the next end step, if the player hasn't played the card, they put it into their graveyard. diff --git a/forge-gui/res/cardsfolder/g/grinning_totem.txt b/forge-gui/res/cardsfolder/g/grinning_totem.txt index cf223855cef..63c9d4cf4a8 100644 --- a/forge-gui/res/cardsfolder/g/grinning_totem.txt +++ b/forge-gui/res/cardsfolder/g/grinning_totem.txt @@ -12,9 +12,8 @@ SVar:STGrinning:Mode$ Continuous | Affected$ Card.IsRemembered+OppOwn | MayPlay$ SVar:TrigDuration:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Static$ True | TriggerZones$ Command | Execute$ DBDuration SVar:DBDuration:DB$ StoreSVar | SVar$ ActiveTotem | Type$ Number | Expression$ 0 # Return the card as a normal trigger -SVar:TrigReturn:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | Static$ True | TriggerZones$ Command | Execute$ DBReturn -SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Graveyard | SubAbility$ RemoveEffect -SVar:RemoveEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile +SVar:TrigReturn:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Command | Execute$ DBReturn | OneOff$ True | TriggerDescription$ At the beginning of your next upkeep, if you haven't played it, put it into its owner's graveyard. +SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Graveyard # Remove Totem Effect when the card is played SVar:TrigLandPlayed:Mode$ LandPlayed | ValidCard$ Land.IsRemembered | Static$ True | TriggerZones$ Command | Execute$ RemoveEffect SVar:TrigCast:Mode$ SpellCast | ValidCard$ Card.IsRemembered | Static$ True | TriggerZones$ Command | Execute$ RemoveEffect diff --git a/forge-gui/res/cardsfolder/i/inspiring_overseer.txt b/forge-gui/res/cardsfolder/i/inspiring_overseer.txt index 26bb5a9f5ff..7fd1403ab5d 100644 --- a/forge-gui/res/cardsfolder/i/inspiring_overseer.txt +++ b/forge-gui/res/cardsfolder/i/inspiring_overseer.txt @@ -7,4 +7,4 @@ T:Mode$ ChangesZone | ValidCard$ Card.Self | Destination$ Battlefield | Execute$ SVar:TrigLife:DB$ GainLife | LifeAmount$ 1 | SubAbility$ DBDraw SVar:DBDraw:DB$ Draw DeckHas:Ability$LifeGain -Oracle:When Inspiring Overseer enters the battlefield, you gain 1 life and draw a card. +Oracle:Flying\nWhen Inspiring Overseer enters the battlefield, you gain 1 life and draw a card. diff --git a/forge-gui/res/cardsfolder/p/possibility_storm.txt b/forge-gui/res/cardsfolder/p/possibility_storm.txt index 726c7fbb052..1cf9f458ad7 100644 --- a/forge-gui/res/cardsfolder/p/possibility_storm.txt +++ b/forge-gui/res/cardsfolder/p/possibility_storm.txt @@ -3,7 +3,7 @@ ManaCost:3 R R Types:Enchantment T:Mode$ SpellCast | ValidCard$ Card.wasCastFromTheirHand | Execute$ TrigExileSpell | TriggerZones$ Battlefield | TriggerDescription$ Whenever a player casts a spell from their hand, that player exiles it, then exiles cards from the top of their library until they exile a card that shares a card type with it. That player may cast that card without paying its mana cost. Then they put all cards exiled with CARDNAME on the bottom of their library in a random order. SVar:TrigExileSpell:DB$ ChangeZone | Defined$ TriggeredCardLKICopy | Origin$ Stack | Destination$ Exile | Fizzle$ True | SubAbility$ DBDig | Imprint$ True -SVar:DBDig:DB$ DigUntil | Defined$ TriggeredCardController | Valid$ Card.sharesCardTypeWith TriggeredCard | ValidDescription$ shares a card type with exiled card | FoundDestination$ Exile | RevealedDestination$ Exile | RememberFound$ True | ImprintRevealed$ True | SubAbility$ DBPlay +SVar:DBDig:DB$ DigUntil | Defined$ TriggeredCardController | Valid$ Card.sharesCardTypeWith TriggeredCardLKICopy | ValidDescription$ shares a card type with exiled card | FoundDestination$ Exile | RevealedDestination$ Exile | RememberFound$ True | ImprintRevealed$ True | SubAbility$ DBPlay SVar:DBPlay:DB$ Play | Defined$ Remembered | Controller$ TriggeredCardController | WithoutManaCost$ True | Optional$ True | SubAbility$ DBChangeZone SVar:DBChangeZone:DB$ ChangeZoneAll | Origin$ Exile | ChangeType$ Card.IsRemembered,Card.IsImprinted | Destination$ Library | LibraryPosition$ -1 | RandomOrder$ True | SubAbility$ DBPossibilityCleanup SVar:DBPossibilityCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True diff --git a/forge-gui/res/cardsfolder/r/reality_scramble.txt b/forge-gui/res/cardsfolder/r/reality_scramble.txt index ef86cb26069..a5d57eae476 100644 --- a/forge-gui/res/cardsfolder/r/reality_scramble.txt +++ b/forge-gui/res/cardsfolder/r/reality_scramble.txt @@ -3,6 +3,6 @@ ManaCost:2 R R Types:Sorcery K:Retrace A:SP$ ChangeZone | Cost$ 2 R R | ValidTgts$ Permanent.YouOwn | Origin$ Battlefield | Destination$ Library | LibraryPosition$ -1 | RememberLKI$ True | SubAbility$ DBRevealUntilShare | SpellDescription$ Put target permanent you own on the bottom of your library. Reveal cards from the top of your library until you reveal a card that shares a card type with that permanent. Put that card onto the battlefield and the rest on the bottom of your library in a random order. -SVar:DBRevealUntilShare:DB$ DigUntil | Valid$ Card.sharesCardTypeWith Remembered | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | SubAbility$ DBCleanup +SVar:DBRevealUntilShare:DB$ DigUntil | Valid$ Card.sharesCardTypeWith RememberedLKI | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True Oracle:Put target permanent you own on the bottom of your library. Reveal cards from the top of your library until you reveal a card that shares a card type with that permanent. Put that card onto the battlefield and the rest on the bottom of your library in a random order.\nRetrace (You may cast this card from your graveyard by discarding a land card in addition to paying its other costs.) diff --git a/forge-gui/res/cardsfolder/r/reweave.txt b/forge-gui/res/cardsfolder/r/reweave.txt index 0faaee74044..ab30675c794 100644 --- a/forge-gui/res/cardsfolder/r/reweave.txt +++ b/forge-gui/res/cardsfolder/r/reweave.txt @@ -3,7 +3,7 @@ ManaCost:5 U Types:Instant Arcane K:Splice:Arcane:2 U U A:SP$ Destroy | Cost$ 5 U | ValidTgts$ Permanent | Sacrifice$ True | SubAbility$ DBDigUntil | RememberLKI$ True | StackDescription$ {p:TargetedController} destroys {c:Targeted}. If {p:TargetedController} does, | SpellDescription$ Target permanent's controller sacrifices it. If the player does, they reveal cards from the top of their library until they reveal a permanent card that shares a card type with the sacrificed permanent, put that card onto the battlefield, then shuffle. -SVar:DBDigUntil:DB$ DigUntil | Defined$ RememberedController | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ1 | Valid$ Permanent.sharesCardTypeWith Remembered | ValidDescription$ permanent card that shares a card type with the sacrificed permanent | FoundDestination$ Battlefield | RevealedDestination$ Library | Shuffle$ True | StackDescription$ they reveal cards from the top of their library until they reveal a permanent card that shares a card type with {c:Targeted}, put that card onto the battlefield, then shuffle their library. | SubAbility$ DBCleanup +SVar:DBDigUntil:DB$ DigUntil | Defined$ RememberedController | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ1 | Valid$ Permanent.sharesCardTypeWith RememberedLKI | ValidDescription$ permanent card that shares a card type with the sacrificed permanent | FoundDestination$ Battlefield | RevealedDestination$ Library | Shuffle$ True | StackDescription$ they reveal cards from the top of their library until they reveal a permanent card that shares a card type with {c:Targeted}, put that card onto the battlefield, then shuffle their library. | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True AI:RemoveDeck:All DeckHints:Type$Arcane diff --git a/forge-gui/res/cardsfolder/upcoming/wild_magic_surge.txt b/forge-gui/res/cardsfolder/upcoming/wild_magic_surge.txt index 2445d4975f0..7110b61722c 100644 --- a/forge-gui/res/cardsfolder/upcoming/wild_magic_surge.txt +++ b/forge-gui/res/cardsfolder/upcoming/wild_magic_surge.txt @@ -2,7 +2,7 @@ Name:Wild Magic Surge ManaCost:R R Types:Instant A:SP$ Destroy | ValidTgts$ Permanent.OppCtrl | RememberLKI$ True | AlwaysRemember$ True | TgtPrompt$ Select target permanent an opponent controls | SubAbility$ DBDigUntil | SpellDescription$ Destroy target permanent an opponent controls. Its controller reveals cards from the top of their library until they reveal a permanent card that shares a card type with that permanent. They put that card onto the battlefield and the rest on the bottom of their library in a random order. -SVar:DBDigUntil:DB$ DigUntil | Defined$ RememberedController | Valid$ Permanent.sharesCardTypeWith Remembered | ValidDescription$ permanent card that shares a card type with the destroyed permanent | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | SubAbility$ DBCleanup +SVar:DBDigUntil:DB$ DigUntil | Defined$ RememberedController | Valid$ Permanent.sharesCardTypeWith RememberedLKI | ValidDescription$ permanent card that shares a card type with the destroyed permanent | FoundDestination$ Battlefield | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True AI:RemoveDeck:All Oracle:Destroy target permanent an opponent controls. Its controller reveals cards from the top of their library until they reveal a permanent card that shares a card type with that permanent. They put that card onto the battlefield and the rest on the bottom of their library in a random order.