Clean up Ruin Grinder (#8930)

This commit is contained in:
tool4ever
2025-10-16 10:05:41 +02:00
committed by GitHub
parent 8ae1bcd2c5
commit 77dae2418f
6 changed files with 54 additions and 53 deletions

View File

@@ -891,10 +891,6 @@ public abstract class SpellAbilityEffect {
runParams.put(AbilityKey.Cause, sa); runParams.put(AbilityKey.Cause, sa);
runParams.put(AbilityKey.DiscardedBefore, discardedBefore.get(p)); runParams.put(AbilityKey.DiscardedBefore, discardedBefore.get(p));
p.getGame().getTriggerHandler().runTrigger(TriggerType.DiscardedAll, runParams, false); p.getGame().getTriggerHandler().runTrigger(TriggerType.DiscardedAll, runParams, false);
if (sa.hasParam("RememberDiscardingPlayers")) {
sa.getHostCard().addRemembered(p);
}
} }
} }
} }

View File

@@ -143,12 +143,12 @@ public class DiscardEffect extends SpellAbilityEffect {
continue; continue;
} }
boolean runDiscard = !sa.hasParam("Optional") if (sa.hasParam("Optional") && !p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, sa.getParam("DiscardMessage"), null)) {
|| p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, sa.getParam("DiscardMessage"), null); continue;
if (runDiscard) {
toBeDiscarded = AbilityUtils.getDefinedCards(source, sa.getParam("DefinedCards"), sa);
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
} }
toBeDiscarded = AbilityUtils.getDefinedCards(source, sa.getParam("DefinedCards"), sa);
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
} }
if (mode.equals("Hand")) { if (mode.equals("Hand")) {
@@ -159,6 +159,17 @@ public class DiscardEffect extends SpellAbilityEffect {
continue; continue;
} }
String message = Localizer.getInstance().getMessage("lblDoYouWantDiscardYourHand");
if (sa.hasParam("Optional")) {
if (!p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message, null)) {
continue;
} else if (discarders.size() > 1) {
// later players need to know the decision
message = Localizer.getInstance().getMessage("lblPlayerKeepNCardsHand", p.getName(), String.valueOf(p.getZone(ZoneType.Hand).size()));
game.getAction().notifyOfValue(sa, p, message, p);
}
}
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa); toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
} }
@@ -172,16 +183,17 @@ public class DiscardEffect extends SpellAbilityEffect {
if (!p.canDiscardBy(sa, true)) { if (!p.canDiscardBy(sa, true)) {
continue; continue;
} }
String message = Localizer.getInstance().getMessage("lblWouldYouLikeRandomDiscardTargetCard", String.valueOf(numCards)); String message = Localizer.getInstance().getMessage("lblWouldYouLikeRandomDiscardTargetCard", String.valueOf(numCards));
boolean runDiscard = !sa.hasParam("Optional") || p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message, null); if (sa.hasParam("Optional") && !p.getController().confirmAction(sa, PlayerActionConfirmMode.Random, message, null)) {
continue;
if (runDiscard) {
final String valid = sa.getParamOrDefault("DiscardValid", "Card");
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), valid, source.getController(), source, sa);
toBeDiscarded = new CardCollection(Aggregates.random(list, numCards));
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
} }
final String valid = sa.getParamOrDefault("DiscardValid", "Card");
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), valid, source.getController(), source, sa);
toBeDiscarded = new CardCollection(Aggregates.random(list, numCards));
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
} }
else if (mode.equals("TgtChoose") && sa.hasParam("UnlessType")) { else if (mode.equals("TgtChoose") && sa.hasParam("UnlessType")) {
if (!p.canDiscardBy(sa, true)) { if (!p.canDiscardBy(sa, true)) {
@@ -194,30 +206,27 @@ public class DiscardEffect extends SpellAbilityEffect {
} }
} }
else if (mode.equals("RevealDiscardAll")) { else if (mode.equals("RevealDiscardAll")) {
// Reveal
final CardCollectionView dPHand = p.getCardsIn(ZoneType.Hand); final CardCollectionView dPHand = p.getCardsIn(ZoneType.Hand);
for (final Player opp : p.getAllOtherPlayers()) { if (dPHand.isEmpty()) {
opp.getController().reveal(dPHand, ZoneType.Hand, p, Localizer.getInstance().getMessage("lblReveal") + " "); continue;
} }
game.getAction().reveal(dPHand, ZoneType.Hand, p, true, Localizer.getInstance().getMessage("lblReveal") + " ");
if (!p.canDiscardBy(sa, true)) { if (!p.canDiscardBy(sa, true)) {
continue; continue;
} }
String valid = sa.getParamOrDefault("DiscardValid", "Card"); String valid = sa.getParamOrDefault("DiscardValid", "Card");
if (valid.contains("X")) {
valid = TextUtil.fastReplace(valid,
"X", Integer.toString(AbilityUtils.calculateAmount(source, "X", sa)));
}
toBeDiscarded = CardLists.getValidCards(dPHand, valid, source.getController(), source, sa); toBeDiscarded = CardLists.getValidCards(dPHand, valid, source.getController(), source, sa);
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa); toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
} else if (mode.endsWith("YouChoose") || mode.endsWith("TgtChoose")) { } else if (mode.endsWith("YouChoose") || mode.endsWith("TgtChoose")) {
CardCollectionView dPHand = p.getCardsIn(ZoneType.Hand); CardCollectionView dPHand = p.getCardsIn(ZoneType.Hand);
if (dPHand.isEmpty()) if (dPHand.isEmpty()) {
continue; // for loop over players continue;
}
if (sa.hasParam("RevealNumber")) { if (sa.hasParam("RevealNumber")) {
int amount = AbilityUtils.calculateAmount(source, sa.getParam("RevealNumber"), sa); int amount = AbilityUtils.calculateAmount(source, sa.getParam("RevealNumber"), sa);
@@ -250,6 +259,10 @@ public class DiscardEffect extends SpellAbilityEffect {
toBeDiscarded = max == 0 ? CardCollection.EMPTY : chooser.getController().chooseCardsToDiscardFrom(p, sa, validCards, min, max); toBeDiscarded = max == 0 ? CardCollection.EMPTY : chooser.getController().chooseCardsToDiscardFrom(p, sa, validCards, min, max);
if (toBeDiscarded.isEmpty()) {
continue;
}
toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa); toBeDiscarded = GameActionUtil.orderCardsByTheirOwners(game, toBeDiscarded, ZoneType.Graveyard, sa);
if (mode.startsWith("Reveal") && p != chooser) { if (mode.startsWith("Reveal") && p != chooser) {
@@ -259,6 +272,10 @@ public class DiscardEffect extends SpellAbilityEffect {
discardedMap.put(p, toBeDiscarded); discardedMap.put(p, toBeDiscarded);
} }
if (sa.hasParam("RememberDiscardingPlayers")) {
source.addRemembered(discardedMap.keySet());
}
Map<AbilityKey, Object> params = AbilityKey.newMap(); Map<AbilityKey, Object> params = AbilityKey.newMap();
CardZoneTable table = AbilityKey.addCardZoneTableParams(params, sa); CardZoneTable table = AbilityKey.addCardZoneTableParams(params, sa);

View File

@@ -3,13 +3,10 @@ ManaCost:5 R
Types:Artifact Creature Construct Types:Artifact Creature Construct
PT:7/4 PT:7/4
K:Menace K:Menace
T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Graveyard | Execute$ TrigChoose | TriggerDescription$ When CARDNAME dies, each player may discard their hand and draw seven cards. T:Mode$ ChangesZone | ValidCard$ Card.Self | Origin$ Battlefield | Destination$ Graveyard | Execute$ TrigDiscard | TriggerDescription$ When CARDNAME dies, each player may discard their hand and draw seven cards.
SVar:TrigChoose:DB$ GenericChoice | TempRemember$ Chooser | ShowChoice$ ExceptSelf | Defined$ Player | Choices$ Discard,No | SubAbility$ DBDiscard SVar:TrigDiscard:DB$ Discard | Mode$ Hand | Defined$ Player | Optional$ True | RememberDiscardingPlayers$ True | SubAbility$ DBDraw
SVar:Discard:DB$ Pump | Defined$ Remembered | NoteCards$ Self | NoteCardsFor$ Discard | SpellDescription$ I will discard my hand. SVar:DBDraw:DB$ Draw | Defined$ Remembered | NumCards$ 7 | SubAbility$ DBCleanup
SVar:No:DB$ Pump | SpellDescription$ I will NOT discard my hand. SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:DBDiscard:DB$ Discard | Mode$ Hand | Defined$ Player.NotedForDiscard | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | Defined$ Player.NotedForDiscard | NumCards$ 7 | SubAbility$ DBClearNotes
SVar:DBClearNotes:DB$ Pump | Defined$ Player | ClearNotedCardsFor$ Discard
K:TypeCycling:Mountain:2 K:TypeCycling:Mountain:2
DeckHas:Ability$Discard DeckHas:Ability$Discard
Oracle:Menace\nWhen Ruin Grinder dies, each player may discard their hand and draw seven cards.\nMountaincycling {2} ({2}, Discard this card: Search your library for a Mountain card, reveal it, put it into your hand, then shuffle.) Oracle:Menace\nWhen Ruin Grinder dies, each player may discard their hand and draw seven cards.\nMountaincycling {2} ({2}, Discard this card: Search your library for a Mountain card, reveal it, put it into your hand, then shuffle.)

View File

@@ -4,11 +4,8 @@ Types:Instant
A:SP$ Vote | Defined$ Player | Choices$ DBChangeZone,DBWheel | VoteTiedAbility$ DBWheel | StackDescription$ REP you, each player votes_{p:You}, {p:Player} each vote & each player returns_{p:Player} each return & each player may_{p:Player} may each | SpellDescription$ Will of the council — Starting with you, each player votes for return or embark. If return gets more votes, each player returns up to two cards from their graveyard to their hand, then you exile CARDNAME. If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards. A:SP$ Vote | Defined$ Player | Choices$ DBChangeZone,DBWheel | VoteTiedAbility$ DBWheel | StackDescription$ REP you, each player votes_{p:You}, {p:Player} each vote & each player returns_{p:Player} each return & each player may_{p:Player} may each | SpellDescription$ Will of the council — Starting with you, each player votes for return or embark. If return gets more votes, each player returns up to two cards from their graveyard to their hand, then you exile CARDNAME. If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards.
SVar:DBChangeZone:DB$ ChangeZone | Defined$ Player | Origin$ Graveyard | Destination$ Hand | ChangeNum$ 2 | Hidden$ True | SubAbility$ ExileSelf | SpellDescription$ If return gets more votes, each player returns up to two cards from their graveyard to their hand, then you exile CARDNAME. SVar:DBChangeZone:DB$ ChangeZone | Defined$ Player | Origin$ Graveyard | Destination$ Hand | ChangeNum$ 2 | Hidden$ True | SubAbility$ ExileSelf | SpellDescription$ If return gets more votes, each player returns up to two cards from their graveyard to their hand, then you exile CARDNAME.
SVar:ExileSelf:DB$ ChangeZone | Origin$ Stack | Destination$ Exile SVar:ExileSelf:DB$ ChangeZone | Origin$ Stack | Destination$ Exile
SVar:DBWheel:DB$ GenericChoice | TempRemember$ Chooser | ShowChoice$ ExceptSelf | Defined$ Player | Choices$ Discard,No | SubAbility$ DBDiscard | SpellDescription$ If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards. SVar:DBWheel:DB$ Discard | Mode$ Hand | Defined$ Player | Optional$ True | RememberDiscardingPlayers$ True | SubAbility$ DBDraw | SpellDescription$ If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards.
SVar:Discard:DB$ Pump | Defined$ Remembered | NoteCards$ Self | NoteCardsFor$ Discard | SpellDescription$ I will discard my hand. SVar:DBDraw:DB$ Draw | Defined$ Remembered | NumCards$ 7 | SubAbility$ DBCleanup
SVar:No:DB$ Pump | SpellDescription$ I will NOT discard my hand. SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:DBDiscard:DB$ Discard | Mode$ Hand | Defined$ Player.NotedForDiscard | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | Defined$ Player.NotedForDiscard | NumCards$ 7 | SubAbility$ DBClearNotes
SVar:DBClearNotes:DB$ Pump | Defined$ Player | ClearNotedCardsFor$ Discard
DeckHas:Ability$Discard|Graveyard DeckHas:Ability$Discard|Graveyard
Oracle:Will of the council — Starting with you, each player votes for return or embark. If return gets more votes, each player returns up to two cards from their graveyard to their hand, then you exile Sail into the West. If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards. Oracle:Will of the council — Starting with you, each player votes for return or embark. If return gets more votes, each player returns up to two cards from their graveyard to their hand, then you exile Sail into the West. If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards.

View File

@@ -1,12 +1,9 @@
Name:Snort Name:Snort
ManaCost:3 R ManaCost:3 R
Types:Sorcery Types:Sorcery
A:SP$ GenericChoice | TempRemember$ Chooser | ShowChoice$ ExceptSelf | Defined$ Player | Choices$ Discard,No | SubAbility$ DBDiscard | StackDescription$ SpellDescription | SpellDescription$ Each player may discard their hand and draw five cards. Then CARDNAME deals 5 damage to each opponent who discarded their hand this way. A:SP$ Discard | Mode$ Hand | Defined$ Player | Optional$ True | RememberDiscardingPlayers$ True | SubAbility$ DBDraw | StackDescription$ SpellDescription | SpellDescription$ Each player may discard their hand and draw five cards. Then CARDNAME deals 5 damage to each opponent who discarded their hand this way.
SVar:Discard:DB$ Pump | Defined$ Remembered | NoteCards$ Self | NoteCardsFor$ Discard | SpellDescription$ I will discard my hand. SVar:DBDraw:DB$ Draw | Defined$ Remembered | NumCards$ 5 | SubAbility$ DBDmg
SVar:No:DB$ Pump | SpellDescription$ I will NOT discard my hand. SVar:DBDmg:DB$ DamageAll | ValidPlayers$ Opponent.IsRemembered | NumDmg$ 5 | SubAbility$ DBCleanup | StackDescription$ None
SVar:DBDiscard:DB$ Discard | Mode$ Hand | Defined$ Player.NotedForDiscard | SubAbility$ DBDraw SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:DBDraw:DB$ Draw | Defined$ Player.NotedForDiscard | NumCards$ 5 | SubAbility$ DBDmg
SVar:DBDmg:DB$ DamageAll | ValidPlayers$ Player.Opponent+NotedForDiscard | NumDmg$ 5 | SubAbility$ DBClearNotes | StackDescription$ None
SVar:DBClearNotes:DB$ Pump | Defined$ Player | ClearNotedCardsFor$ Discard | StackDescription$ None
K:Flashback:5 R K:Flashback:5 R
Oracle:Each player may discard their hand and draw five cards. Then Snort deals 5 damage to each opponent who discarded their hand this way.\nFlashback {5}{R} (You may cast this card from your graveyard for its flashback cost. Then exile it.) Oracle:Each player may discard their hand and draw five cards. Then Snort deals 5 damage to each opponent who discarded their hand this way.\nFlashback {5}{R} (You may cast this card from your graveyard for its flashback cost. Then exile it.)

View File

@@ -2,12 +2,9 @@ Name:Will of the Jeskai
ManaCost:3 R ManaCost:3 R
Types:Sorcery Types:Sorcery
A:SP$ Charm | MinCharmNum$ 1 | CharmNum$ Count$Compare Y GE1.2.1 | Choices$ DBWheel,DBFlames | AdditionalDescription$ . If you control a commander as you cast this spell, you may choose both instead. A:SP$ Charm | MinCharmNum$ 1 | CharmNum$ Count$Compare Y GE1.2.1 | Choices$ DBWheel,DBFlames | AdditionalDescription$ . If you control a commander as you cast this spell, you may choose both instead.
SVar:DBWheel:DB$ GenericChoice | TempRemember$ Chooser | ShowChoice$ ExceptSelf | Defined$ Player | Choices$ Discard,No | SubAbility$ DBDiscard | SpellDescription$ Each player may discard their hand and draw five cards. SVar:DBWheel:DB$ Discard | Mode$ Hand | Defined$ Player | Optional$ True | RememberDiscardingPlayers$ True | SubAbility$ DBDraw | SpellDescription$ If embark gets more votes or the vote is tied, each player may discard their hand and draw seven cards.
SVar:Discard:DB$ Pump | Defined$ Remembered | NoteCards$ Self | NoteCardsFor$ Discard | SpellDescription$ I will discard my hand. SVar:DBDraw:DB$ Draw | Defined$ Remembered | NumCards$ 7 | SubAbility$ DBCleanup
SVar:No:DB$ Pump | SpellDescription$ I will NOT discard my hand. SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:DBDiscard:DB$ Discard | Mode$ Hand | Defined$ Player.NotedForDiscard | SubAbility$ DBDraw
SVar:DBDraw:DB$ Draw | Defined$ Player.NotedForDiscard | NumCards$ 5 | SubAbility$ DBClearNotes
SVar:DBClearNotes:DB$ Pump | Defined$ Player | ClearNotedCardsFor$ Discard | StackDescription$ None
SVar:DBFlames:DB$ PumpAll | ValidCards$ Instant.YouCtrl,Sorcery.YouCtrl | KW$ Flashback | PumpZone$ Graveyard | SpellDescription$ Each instant and sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost. SVar:DBFlames:DB$ PumpAll | ValidCards$ Instant.YouCtrl,Sorcery.YouCtrl | KW$ Flashback | PumpZone$ Graveyard | SpellDescription$ Each instant and sorcery card in your graveyard gains flashback until end of turn. The flashback cost is equal to its mana cost.
SVar:Y:Count$Valid Card.IsCommander+YouCtrl SVar:Y:Count$Valid Card.IsCommander+YouCtrl
DeckHas:Ability$Discard DeckHas:Ability$Discard