Skip to content

Commit 646d293

Browse files
authored
CantHappen layer can stop iterating after finding one match! (#11186)
1 parent 8d157a5 commit 646d293

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ public List<ReplacementEffect> getReplacementList(final ReplacementType event, f
138138
&& replacementEffect.requirementsCheck(game)
139139
&& replacementEffect.canReplace(runParams)) {
140140
possibleReplacers.add(replacementEffect);
141+
if (layer == ReplacementLayer.CantHappen) {
142+
return false;
143+
}
141144
}
142145
}
143146
return true;

forge-gui/res/cardsfolder/s/scarlet_witch_chaotic_avenger.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Types:Legendary Creature Mutant Warlock Hero
44
PT:3/3
55
K:Flying
66
T:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | Execute$ TrigDig | CombatDamage$ True | TriggerDescription$ Whenever NICKNAME deals combat damage to a player, look at the top two cards of your library, then exile them face down. Then you may cast a Hero or noncreature spell from among cards exiled with NICKNAME without paying its mana cost.
7-
SVar:TrigDig:DB$ Dig | DigNum$ 2 | ChangeNum$ All | DestinationZone$ Exile | ExileFaceDown$ True | WithMayLook$ True | RememberChanged$ True | SubAbility$ DBPlay
8-
SVar:DBPlay:DB$ Play | ValidZone$ Exile | Valid$ Card.ExiledWithSource | ValidSA$ Spell.Hero,Spell.nonCreature | Controller$ You | WithoutManaCost$ True | Optional$ True | Amount$ 1 | SubAbility$ DBCleanup
9-
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
7+
SVar:TrigDig:DB$ Dig | DigNum$ 2 | ChangeNum$ All | DestinationZone$ Exile | ExileFaceDown$ True | WithMayLook$ True | SubAbility$ DBPlay
8+
SVar:DBPlay:DB$ Play | ValidZone$ Exile | Valid$ Card.ExiledWithSource | ValidSA$ Spell.Hero,Spell.nonCreature | Controller$ You | WithoutManaCost$ True | Optional$ True | Amount$ 1
109
Oracle:Flying\nWhenever Scarlet Witch deals combat damage to a player, look at the top two cards of your library, then exile them face down. Then you may cast a Hero or noncreature spell from among cards exiled with Scarlet Witch without paying its mana cost.

forge-gui/src/main/java/forge/gamemodes/match/AbstractGuiGame.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
4747
private boolean ignoreConcedeChain = false;
4848
private boolean networkGame = false;
4949

50-
private java.util.Timer waitingTimer;
50+
private Timer waitingTimer;
5151
private long waitingStartTime;
5252

5353
@Override
@@ -601,9 +601,9 @@ public void showWaitingTimer(final PlayerView forPlayer, final String waitingFor
601601
}
602602
this.waitingStartTime = System.currentTimeMillis();
603603
// Capture timer so stale EDT tick runnables detect cancel/restart and skip
604-
final java.util.Timer myTimer = new java.util.Timer("waitingTimer");
604+
final Timer myTimer = new Timer("waitingTimer");
605605
waitingTimer = myTimer;
606-
myTimer.schedule(new java.util.TimerTask() {
606+
myTimer.schedule(new TimerTask() {
607607
@Override
608608
public void run() {
609609
FThreads.invokeInEdtLater(() -> {

0 commit comments

Comments
 (0)