From 21536abda7b4550034ac3d7fe84c837ff1f9ee63 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Sun, 26 Sep 2021 17:08:09 -0400 Subject: [PATCH 1/5] clarion_ultimatum.txt improve --- forge-gui/res/cardsfolder/c/clarion_ultimatum.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/forge-gui/res/cardsfolder/c/clarion_ultimatum.txt b/forge-gui/res/cardsfolder/c/clarion_ultimatum.txt index a7d42bdea12..8bb489f5ec8 100644 --- a/forge-gui/res/cardsfolder/c/clarion_ultimatum.txt +++ b/forge-gui/res/cardsfolder/c/clarion_ultimatum.txt @@ -1,11 +1,10 @@ Name:Clarion Ultimatum ManaCost:G G W W W U U Types:Sorcery -A:SP$ ChooseCard | Cost$ G G W W W U U | Defined$ You | Amount$ 5 | Choices$ Permanent.YouCtrl | ChoiceTitle$ Choose five permanents you control | ChoiceZone$ Battlefield | RememberChosen$ True | SubAbility$ DBSearch | SpellDescription$ Choose five permanents you control. For each of those permanents, you may search your library for a card with the same name as that permanent. Put those cards onto the battlefield tapped, then shuffle. -SVar:DBSearch:DB$ RepeatEach | UseImprinted$ True | RepeatCards$ Permanent.IsRemembered | ChooseOrder$ True | Zone$ Battlefield | RepeatSubAbility$ DBClarion | SubAbility$ DBShuffle -SVar:DBClarion:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Card.sharesNameWith Imprinted | ChangeNum$ 1 | Tapped$ True | NoShuffle$ True -SVar:DBShuffle:DB$ Shuffle | Defined$ You | SubAbility$ DBCleanup -SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True -AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/clarion_ultimatum.jpg +A:SP$ ChooseCard | Defined$ You | Amount$ 5 | Mandatory$ True | Choices$ Permanent.YouCtrl | ChoiceTitle$ Choose five permanents you control | ChoiceZone$ Battlefield | SubAbility$ DBRepeat | StackDescription$ SpellDescription | SpellDescription$ Choose five permanents you control. For each of those permanents, you may search your library for a card with the same name as that permanent. Put those cards onto the battlefield tapped, then shuffle. +SVar:DBRepeat:DB$ RepeatEach | RepeatCards$ Card.ChosenCard | Zone$ Battlefield | RepeatSubAbility$ DBSearch | SubAbility$ DBChangeZone +SVar:DBSearch:DB$ ChooseCard | ChoiceZone$ Library | QuasiLibrarySearch$ You | Choices$ Card.YouOwn+IsNotImprinted+sharesNameWith Remembered | ImprintChosen$ True | ChoiceTitle$ You may select a card with this name from your library +SVar:DBChangeZone:DB$ ChangeZone | Defined$ Imprinted | Origin$ Library | Destination$ Battlefield | Tapped$ True | Searched$ True | Shuffle$ True | StackDescription$ None +SVar:NeedsToPlayVar:Z GE4 +SVar:Z:Count$Valid Permanent.YouCtrl Oracle:Choose five permanents you control. For each of those permanents, you may search your library for a card with the same name as that permanent. Put those cards onto the battlefield tapped, then shuffle. From 83063616078ac397ecf5fbc1f8ebc2bfa16a4a49 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Sun, 26 Sep 2021 17:12:00 -0400 Subject: [PATCH 2/5] doubling_chant.txt improve --- forge-gui/res/cardsfolder/d/doubling_chant.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/forge-gui/res/cardsfolder/d/doubling_chant.txt b/forge-gui/res/cardsfolder/d/doubling_chant.txt index b2b5f650ef8..078d8249456 100644 --- a/forge-gui/res/cardsfolder/d/doubling_chant.txt +++ b/forge-gui/res/cardsfolder/d/doubling_chant.txt @@ -1,11 +1,11 @@ Name:Doubling Chant ManaCost:5 G Types:Sorcery -A:SP$ RepeatEach | Cost$ 5 G | RepeatSubAbility$ DBSearch | RepeatCards$ Creature.YouCtrl | SubAbility$ DBShuffle | StackDescription$ SpellDescription | SpellDescription$ For each creature you control, you may search your library for a creature card with the same name as that creature. Put those cards onto the battlefield, then shuffle. -SVar:DBSearch:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Remembered.Creature+sameName | ChangeNum$ 1 | NoShuffle$ True -SVar:DBShuffle:DB$ Shuffle | Defined$ You | StackDescription$ None +A:SP$ RepeatEach | RepeatSubAbility$ DBSearch | RepeatCards$ Creature.YouCtrl | SubAbility$ DBChangeZone | StackDescription$ SpellDescription | SpellDescription$ For each creature you control, you may search your library for a creature card with the same name as that creature. Put those cards onto the battlefield, then shuffle. +SVar:DBSearch:DB$ ChooseCard | ChoiceZone$ Library | QuasiLibrarySearch$ You | Choices$ Card.YouOwn+IsNotImprinted+sharesNameWith Remembered | ImprintChosen$ True | ChoiceTitle$ You may select a card with the same name from your library +SVar:DBChangeZone:DB$ ChangeZone | Defined$ Imprinted | Origin$ Library | Destination$ Battlefield | Searched$ True | Shuffle$ True | StackDescription$ None +#SVar:DBSearch:DB$ ChangeZone | Origin$ Library | Destination$ Battlefield | ChangeType$ Remembered.Creature+sameName | ChangeNum$ 1 | NoShuffle$ True +#SVar:DBShuffle:DB$ Shuffle | Defined$ You | StackDescription$ None SVar:NeedsToPlayVar:Z GE2 -SVar:Z:Count$Valid Creature.YouCtrl+inZoneBattlefield -AI:RemoveDeck:Random -SVar:Picture:http://www.wizards.com/global/images/magic/general/doubling_chant.jpg +SVar:Z:Count$Valid Creature.YouCtrl Oracle:For each creature you control, you may search your library for a creature card with the same name as that creature. Put those cards onto the battlefield, then shuffle. From bca8f9457f85d9be7d3230d0a741485fa4e38bfb Mon Sep 17 00:00:00 2001 From: Northmoc Date: Sun, 26 Sep 2021 17:12:12 -0400 Subject: [PATCH 3/5] dichotomancy.txt improve --- forge-gui/res/cardsfolder/d/dichotomancy.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/forge-gui/res/cardsfolder/d/dichotomancy.txt b/forge-gui/res/cardsfolder/d/dichotomancy.txt index 52c499e2239..542255f714e 100644 --- a/forge-gui/res/cardsfolder/d/dichotomancy.txt +++ b/forge-gui/res/cardsfolder/d/dichotomancy.txt @@ -2,9 +2,10 @@ Name:Dichotomancy ManaCost:7 U U Types:Sorcery K:Suspend:3:1 U U -A:SP$ RepeatEach | Cost$ 7 U U | ValidTgts$ Opponent | UseImprinted$ True | RepeatCards$ Permanent.nonLand+TargetedPlayerCtrl+tapped | Zone$ Battlefield | ChooseOrder$ True | RepeatSubAbility$ DBSearch | SubAbility$ DBShuffle | StackDescription$ SpellDescription | SpellDescription$ For each tapped nonland permanent target opponent controls, search that player's library for a card with the same name as that permanent. Put those cards onto the battlefield under your control, then that player shuffles. -SVar:DBSearch:DB$ ChangeZone | DefinedPlayer$ ImprintedController | Chooser$ You | Origin$ Library | Destination$ Battlefield | GainControl$ True | ChangeType$ Card.sharesNameWith Imprinted | ChangeNum$ 1 | NoShuffle$ True +A:SP$ RepeatEach | ValidTgts$ Opponent | RepeatCards$ Permanent.nonLand+TargetedPlayerCtrl+tapped | Zone$ Battlefield | RepeatSubAbility$ DBSearch | SubAbility$ DBChangeZone | StackDescription$ SpellDescription | SpellDescription$ For each tapped nonland permanent target opponent controls, search that player's library for a card with the same name as that permanent. Put those cards onto the battlefield under your control, then that player shuffles. +SVar:DBSearch:DB$ ChooseCard | ChoiceZone$ Library | QuasiLibrarySearch$ TargetedPlayer | Choices$ Card.TargetedPlayerOwn+IsNotImprinted+sharesNameWith Remembered | ImprintChosen$ True | ChoiceTitle$ You may select a card with the same name from your opponent's library +SVar:DBChangeZone:DB$ ChangeZone | Defined$ Imprinted | Origin$ Library | Destination$ Battlefield | GainControl$ True | Searched$ True | StackDescription$ None | SubAbility$ DBShuffle SVar:DBShuffle:DB$ Shuffle | Defined$ ParentTarget | StackDescription$ None -AI:RemoveDeck:All -SVar:Picture:http://www.wizards.com/global/images/magic/general/dichotomancy.jpg +SVar:NeedsToPlayVar:Z GE3 +SVar:Z:PlayerCountOpponents$HighestValid Permanent.nonLand+YouCtrl+tapped Oracle:For each tapped nonland permanent target opponent controls, search that player's library for a card with the same name as that permanent. Put those cards onto the battlefield under your control, then that player shuffles.\nSuspend 3—{1}{U}{U} (Rather than cast this card from your hand, you may pay {1}{U}{U} and exile it with three time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.) From b76f2d4705de10b1fc8957d96d28118c2b248b8f Mon Sep 17 00:00:00 2001 From: Northmoc Date: Sun, 26 Sep 2021 17:13:45 -0400 Subject: [PATCH 4/5] support "Searched" for cards that quasi-search many times, then change Defined --- .../java/forge/game/ability/effects/ChangeZoneEffect.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java index 73612d7c01e..99ec1d54876 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java @@ -1003,6 +1003,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } Long controlTimestamp = null; + if (!searchedLibrary && sa.hasParam("Searched")) { + searchedLibrary = true; + } if (searchedLibrary) { if (decider.equals(player)) { Map.Entry searchControlPlayer = player.getControlledWhileSearching(); @@ -1038,6 +1041,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect { runParams.put(AbilityKey.Target, Lists.newArrayList(player)); decider.getGame().getTriggerHandler().runTrigger(TriggerType.SearchedLibrary, runParams, false); } + if (searchedLibrary && sa.hasParam("Searched")) { + searchedLibrary = false; + } if (!defined && changeType != null) { fetchList = (CardCollection)AbilityUtils.filterListByType(fetchList, sa.getParam("ChangeType"), sa); From d1a0d703fe2689a186b6051ead61c14e44121dba Mon Sep 17 00:00:00 2001 From: Northmoc Date: Sun, 26 Sep 2021 17:14:58 -0400 Subject: [PATCH 5/5] support "QuasiLibrarySearch" to pick multiple cards from libraries for ChangeZone effects --- .../ability/effects/ChooseCardEffect.java | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChooseCardEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChooseCardEffect.java index 204122f9eab..cfefd2f4ff2 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChooseCardEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChooseCardEffect.java @@ -4,6 +4,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import forge.game.player.DelayedReveal; +import forge.game.player.PlayerView; +import forge.util.CardTranslation; import org.apache.commons.lang3.StringUtils; import forge.card.CardType; @@ -165,12 +168,28 @@ public class ChooseCardEffect extends SpellAbilityEffect { } else { String title = sa.hasParam("ChoiceTitle") ? sa.getParam("ChoiceTitle") : Localizer.getInstance().getMessage("lblChooseaCard") + " "; if (sa.hasParam ("ChoiceTitleAppendDefined")) { - String defined = AbilityUtils.getDefinedPlayers(sa.getHostCard(), sa.getParam("ChoiceTitleAppendDefined"), sa).toString(); - final StringBuilder sb = new StringBuilder(); - sb.append(title).append(" ").append(defined); - title = sb.toString(); + String defined = AbilityUtils.getDefinedPlayers(host, sa.getParam("ChoiceTitleAppendDefined"), sa).toString(); + title = title + " " + defined; + } + if (sa.hasParam("QuasiLibrarySearch")) { + final Player searched = AbilityUtils.getDefinedPlayers(host, + sa.getParam("QuasiLibrarySearch"), sa).get(0); + final int fetchNum = Math.min(searched.getCardsIn(ZoneType.Library).size(), 4); + CardCollectionView shown = !p.hasKeyword("LimitSearchLibrary") + ? searched.getCardsIn(ZoneType.Library) : searched.getCardsIn(ZoneType.Library, fetchNum); + DelayedReveal delayedReveal = new DelayedReveal(shown, ZoneType.Library, PlayerView.get(searched), + CardTranslation.getTranslatedName(host.getName()) + " - " + + Localizer.getInstance().getMessage("lblLookingCardIn") + " "); + Card choice = p.getController().chooseSingleEntityForEffect(choices, delayedReveal, sa, title, + !sa.hasParam("Mandatory"), p, null); + if (choice == null) { + return; + } + chosen.add(choice); + } else { + chosen.addAll(p.getController().chooseCardsForEffect(choices, sa, title, minAmount, validAmount, + !sa.hasParam("Mandatory"), null)); } - chosen.addAll(p.getController().chooseCardsForEffect(choices, sa, title, minAmount, validAmount, !sa.hasParam("Mandatory"), null)); } } if (sa.hasParam("Reveal")) {