Merge branch 'foreach' into 'master'

Fix Clarion Ultimatum and co.

Closes #1980

See merge request core-developers/forge!5446
This commit is contained in:
Michael Kamensky
2021-09-27 03:50:57 +00:00
5 changed files with 47 additions and 22 deletions

View File

@@ -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<Long, Player> 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);

View File

@@ -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")) {

View File

@@ -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.

View File

@@ -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.)

View File

@@ -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.