mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Fix optional shuffle into Library cases (#6147)
This commit is contained in:
@@ -463,8 +463,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
origin.addAll(ZoneType.listValueOf(sa.getParam("Origin")));
|
||||
}
|
||||
|
||||
int libraryPosition = sa.hasParam("LibraryPosition") ?
|
||||
AbilityUtils.calculateAmount(hostCard, sa.getParam("LibraryPosition"), sa) : 0;
|
||||
int libraryPosition = sa.hasParam("LibraryPosition") ? AbilityUtils.calculateAmount(hostCard, sa.getParam("LibraryPosition"), sa) : 0;
|
||||
if (sa.hasParam("DestinationAlternative")) {
|
||||
Pair<ZoneType, Integer> pair = handleAltDest(sa, hostCard, destination, libraryPosition, activator);
|
||||
destination = pair.getKey();
|
||||
@@ -505,6 +504,11 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
final boolean shuffle = sa.hasParam("Shuffle") && "True".equals(sa.getParam("Shuffle"));
|
||||
boolean combatChanged = false;
|
||||
|
||||
if (sa.hasParam("ShuffleNonMandatory") &&
|
||||
!activator.getController().confirmAction(sa, null, Localizer.getInstance().getMessage("lblDoyouWantShuffleTheLibrary"), null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player chooser = activator;
|
||||
if (sa.hasParam("Chooser")) {
|
||||
chooser = AbilityUtils.getDefinedPlayers(hostCard, sa.getParam("Chooser"), sa).get(0);
|
||||
@@ -537,8 +541,9 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
|
||||
final String prompt = TextUtil.concatWithSpace(Localizer.getInstance().getMessage("lblDoYouWantMoveTargetFromOriToDest", CardTranslation.getTranslatedName(gameCard.getName()), Lang.joinHomogenous(origin, ZoneType::getTranslatedName), destination.getTranslatedName()));
|
||||
if (optional && !chooser.getController().confirmAction(sa, null, prompt, null))
|
||||
if (optional && !chooser.getController().confirmAction(sa, null, prompt, null)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final Zone originZone = game.getZoneOf(gameCard);
|
||||
|
||||
@@ -1047,28 +1052,10 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
player.addController(controlTimestamp, searchControlPlayer.getValue());
|
||||
}
|
||||
|
||||
decider.incLibrarySearched();
|
||||
// should only count the number of searching player's own library
|
||||
// Panglacial Wurm
|
||||
CardCollection canCastWhileSearching = CardLists.getKeyword(fetchList,
|
||||
"While you're searching your library, you may cast CARDNAME from your library.");
|
||||
decider.getController().tempShowCards(canCastWhileSearching);
|
||||
for (final Card tgtCard : canCastWhileSearching) {
|
||||
List<SpellAbility> sas = AbilityUtils.getSpellsFromPlayEffect(tgtCard, decider, CardStateName.Original, true);
|
||||
if (sas.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
SpellAbility tgtSA = decider.getController().getAbilityToPlay(tgtCard, sas);
|
||||
if (!decider.getController().confirmAction(tgtSA, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())), null)) {
|
||||
continue;
|
||||
}
|
||||
// if played, that card cannot be found
|
||||
if (decider.getController().playSaFromPlayEffect(tgtSA)) {
|
||||
fetchList.remove(tgtCard);
|
||||
}
|
||||
//some kind of reset here?
|
||||
}
|
||||
decider.getController().endTempShowCards();
|
||||
decider.incLibrarySearched();
|
||||
|
||||
handleCastWhileSearching(fetchList, decider);
|
||||
}
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(decider);
|
||||
runParams.put(AbilityKey.Target, Lists.newArrayList(player));
|
||||
@@ -1507,6 +1494,29 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleCastWhileSearching(final CardCollection fetchList, final Player decider) {
|
||||
// Panglacial Wurm
|
||||
CardCollection canCastWhileSearching = CardLists.getKeyword(fetchList,
|
||||
"While you're searching your library, you may cast CARDNAME from your library.");
|
||||
decider.getController().tempShowCards(canCastWhileSearching);
|
||||
for (final Card tgtCard : canCastWhileSearching) {
|
||||
List<SpellAbility> sas = AbilityUtils.getSpellsFromPlayEffect(tgtCard, decider, CardStateName.Original, true);
|
||||
if (sas.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
SpellAbility tgtSA = decider.getController().getAbilityToPlay(tgtCard, sas);
|
||||
if (!decider.getController().confirmAction(tgtSA, null, Localizer.getInstance().getMessage("lblDoYouWantPlayCard", CardTranslation.getTranslatedName(tgtCard.getName())), null)) {
|
||||
continue;
|
||||
}
|
||||
// if played, that card cannot be found
|
||||
if (decider.getController().playSaFromPlayEffect(tgtSA)) {
|
||||
fetchList.remove(tgtCard);
|
||||
}
|
||||
//some kind of reset here?
|
||||
}
|
||||
decider.getController().endTempShowCards();
|
||||
}
|
||||
|
||||
private static class HiddenOriginChoices {
|
||||
boolean shuffleMandatory;
|
||||
boolean searchedLibrary;
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:4 W W W
|
||||
Types:Creature Angel
|
||||
PT:5/6
|
||||
K:Flying
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.
|
||||
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.Self | Execute$ TrigReturn | TriggerDescription$ When CARDNAME leaves the battlefield, return the exiled cards to their owners' hands.
|
||||
SVar:TrigExile:DB$ ChangeZone | TargetMin$ 0 | TargetMax$ 3 | IsCurse$ True | ValidTgts$ Creature.Other | TgtPrompt$ Choose another target creature | RememberChanged$ True | Origin$ Battlefield,Graveyard | Destination$ Exile
|
||||
SVar:TrigReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Hand | SubAbility$ DBCleanup
|
||||
|
||||
@@ -17,8 +17,8 @@ Colors:blue
|
||||
Types:Creature Spirit
|
||||
PT:3/4
|
||||
K:Flying
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | TriggerDescription$ When CARDNAME enters, shuffle up to three target cards from your graveyard into your library.
|
||||
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouOwn | TgtPrompt$ Select up to three target cards from your graveyard | TargetMin$ 0 | TargetMax$ 3 | Shuffle$ True
|
||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChangeZone | TriggerDescription$ When CARDNAME enters, you may shuffle up to three target cards from your graveyard into your library.
|
||||
SVar:TrigChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouOwn | TgtPrompt$ Select up to three target cards from your graveyard | TargetMin$ 0 | TargetMax$ 3 | Shuffle$ True | ShuffleNonMandatory$ True
|
||||
R:Event$ Moved | ValidCard$ Card.Self | Destination$ Graveyard | ReplaceWith$ Exile | Description$ If CARDNAME would be put into a graveyard from anywhere, exile it instead.
|
||||
SVar:Exile:DB$ ChangeZone | Hidden$ True | Origin$ All | Destination$ Exile | Defined$ ReplacedCard
|
||||
Oracle:Flying\nWhen Ghostly Castigator enters, shuffle up to three target cards from your graveyard into your library.\nIf Ghostly Castigator would be put into a graveyard from anywhere, exile it instead.
|
||||
Oracle:Flying\nWhen Ghostly Castigator enters, you may shuffle up to three target cards from your graveyard into your library.\nIf Ghostly Castigator would be put into a graveyard from anywhere, exile it instead.
|
||||
|
||||
@@ -2,5 +2,5 @@ Name:Devious Cover-Up
|
||||
ManaCost:2 U U
|
||||
Types:Instant
|
||||
A:SP$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | Destination$ Exile | SubAbility$ DBChangeZone | SpellDescription$ Counter target spell. If that spell is countered this way, exile it instead of putting it into its owner's graveyard. You may shuffle up to four target cards from your graveyard into your library.
|
||||
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouCtrl | TgtPrompt$ Select target card from your graveyard | TargetMin$ 0 | TargetMax$ 4 | Shuffle$ True
|
||||
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouCtrl | TgtPrompt$ Select target card from your graveyard | TargetMin$ 0 | TargetMax$ 4 | Shuffle$ True | ShuffleNonMandatory$ True
|
||||
Oracle:Counter target spell. If that spell is countered this way, exile it instead of putting it into its owner's graveyard. You may shuffle up to four target cards from your graveyard into your library.
|
||||
|
||||
@@ -2,5 +2,5 @@ Name:Put Away
|
||||
ManaCost:2 U U
|
||||
Types:Instant
|
||||
A:SP$ Counter | TargetType$ Spell | TgtPrompt$ Select target spell | ValidTgts$ Card | SubAbility$ DBChangeZone | SpellDescription$ Counter target spell. You may shuffle up to one target card from your graveyard into your library.
|
||||
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouCtrl | TgtPrompt$ Select target card from your graveyard | TargetMin$ 0 | TargetMax$ 1 | Shuffle$ True
|
||||
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouCtrl | TgtPrompt$ Select target card from your graveyard | TargetMin$ 0 | TargetMax$ 1 | Shuffle$ True | ShuffleNonMandatory$ True
|
||||
Oracle:Counter target spell. You may shuffle up to one target card from your graveyard into your library.
|
||||
|
||||
@@ -3,7 +3,7 @@ ManaCost:1 U R W
|
||||
Types:Legendary Creature Giant Warrior
|
||||
PT:7/7
|
||||
T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ You | Execute$ TrigChoose | TriggerZones$ Battlefield | TriggerDescription$ At the beginning of combat on your turn, choose an opponent at random. CARDNAME attacks that player this combat if able.
|
||||
SVar:TrigChoose:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | Random$ True | SubAbility$ DBPump
|
||||
SVar:DBPump:DB$ Animate | Defined$ Self | staticAbilities$ AttackChosen | Duration$ UntilEndOfCombat
|
||||
SVar:AttackChosen:Mode$ MustAttack | ValidCreature$ Card.Self | MustAttack$ ChosenPlayer | Secondary$ True
|
||||
SVar:TrigChoose:DB$ ChoosePlayer | Defined$ You | Choices$ Player.Opponent | Random$ True | SubAbility$ DBPEffect
|
||||
SVar:DBEffect:DB$ Effect | RememberObjects$ Self | ExileOnMoved$ Battlefield | StaticAbilities$ AttackChosen | Duration$ UntilEndOfCombat
|
||||
SVar:AttackChosen:Mode$ MustAttack | ValidCreature$ Card.IsRemembered | MustAttack$ ChosenPlayer | Description$ EFFECTSOURCE attacks that player this combat if able.
|
||||
Oracle:At the beginning of combat on your turn, choose an opponent at random. Ruhan of the Fomori attacks that player this combat if able.
|
||||
|
||||
@@ -2,5 +2,5 @@ Name:Cathartic Parting
|
||||
ManaCost:1 G
|
||||
Types:Sorcery
|
||||
A:SP$ ChangeZone | Origin$ Battlefield | Destination$ Library | ValidTgts$ Artifact.OppCtrl,Enchantment.OppCtrl | TgtPrompt$ Select target artifact or enchantment an opponent controls | SubAbility$ DBChangeZone | Shuffle$ True | SpellDescription$ The owner of target artifact or enchantment an opponent controls shuffles it into their library. You may shuffle up to four target cards from your graveyard into your library.
|
||||
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouOwn | TgtPrompt$ Select target card from your graveyard | TargetMin$ 0 | TargetMax$ 4 | Shuffle$ True
|
||||
SVar:DBChangeZone:DB$ ChangeZone | Origin$ Graveyard | Destination$ Library | ValidTgts$ Card.YouOwn | TgtPrompt$ Select target card from your graveyard | TargetMin$ 0 | TargetMax$ 4 | Shuffle$ True | ShuffleNonMandatory$ True
|
||||
Oracle:The owner of target artifact or enchantment an opponent controls shuffles it into their library. You may shuffle up to four target cards from your graveyard into your library.
|
||||
Reference in New Issue
Block a user