From 07d1d68e71ce34feaaf1c34d97ed48c66e912698 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Sun, 17 Sep 2023 23:00:22 +0200 Subject: [PATCH] Fix Ashiok --- .../main/java/forge/game/ability/AbilityKey.java | 1 + .../java/forge/game/ability/effects/DigEffect.java | 14 ++++++++------ .../forge/game/ability/effects/DigUntilEffect.java | 10 +++++----- .../forge/game/replacement/ReplacementHandler.java | 1 + .../upcoming/ashiok_wicked_manipulator.txt | 6 +++--- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/AbilityKey.java b/forge-game/src/main/java/forge/game/ability/AbilityKey.java index fce9790c488..0db9ccaa4bc 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityKey.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityKey.java @@ -118,6 +118,7 @@ public enum AbilityKey { ScryBottom("ScryBottom"), ScryNum("ScryNum"), Sides("Sides"), + SimultaneousETB("SimultaneousETB"), Source("Source"), Sources("Sources"), SourceSA("SourceSA"), diff --git a/forge-game/src/main/java/forge/game/ability/effects/DigEffect.java b/forge-game/src/main/java/forge/game/ability/effects/DigEffect.java index 442b52a6c4f..779c15da4d8 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/DigEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/DigEffect.java @@ -398,10 +398,13 @@ public class DigEffect extends SpellAbilityEffect { if (sa.hasParam("Tapped")) { c.setTapped(true); } - if (destZone1.equals(ZoneType.Battlefield) && sa.hasParam("WithCounter")) { - final int numCtr = AbilityUtils.calculateAmount(host, - sa.getParamOrDefault("WithCounterNum", "1"), sa); - c.addEtbCounter(CounterType.getType(sa.getParam("WithCounter")), numCtr, player); + if (destZone1.equals(ZoneType.Battlefield)) { + moveParams.put(AbilityKey.SimultaneousETB, movedCards); + if (sa.hasParam("WithCounter")) { + final int numCtr = AbilityUtils.calculateAmount(host, + sa.getParamOrDefault("WithCounterNum", "1"), sa); + c.addEtbCounter(CounterType.getType(sa.getParam("WithCounter")), numCtr, player); + } } if (sa.hasAdditionalAbility("AnimateSubAbility")) { // need LKI before Animate does apply @@ -477,8 +480,7 @@ public class DigEffect extends SpellAbilityEffect { } } else { // just move them randomly - for (int i = 0; i < rest.size(); i++) { - Card c = rest.get(i); + for (Card c : rest) { final ZoneType origin = c.getZone().getZoneType(); final PlayerZone toZone = c.getOwner().getZone(destZone2); c = game.getAction().moveTo(toZone, c, sa); diff --git a/forge-game/src/main/java/forge/game/ability/effects/DigUntilEffect.java b/forge-game/src/main/java/forge/game/ability/effects/DigUntilEffect.java index 35c51a6bb08..0f5938c6b37 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/DigUntilEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/DigUntilEffect.java @@ -99,11 +99,6 @@ public class DigUntilEffect extends SpellAbilityEffect { final Card host = sa.getHostCard(); final Game game = host.getGame(); - String[] type = new String[]{"Card"}; - if (sa.hasParam("Valid")) { - type = sa.getParam("Valid").split(","); - } - int untilAmount = 1; if (sa.hasParam("Amount")) { untilAmount = AbilityUtils.calculateAmount(host, sa.getParam("Amount"), sa); @@ -115,6 +110,11 @@ public class DigUntilEffect extends SpellAbilityEffect { maxRevealed = AbilityUtils.calculateAmount(host, sa.getParam("MaxRevealed"), sa); } + String[] type = new String[]{"Card"}; + if (sa.hasParam("Valid")) { + type = sa.getParam("Valid").split(","); + } + final boolean remember = sa.hasParam("RememberFound"); final boolean imprint = sa.hasParam("ImprintFound"); diff --git a/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java b/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java index 72b823a035d..d58eabb666e 100644 --- a/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java +++ b/forge-game/src/main/java/forge/game/replacement/ReplacementHandler.java @@ -312,6 +312,7 @@ public class ReplacementHandler { replacementEffect.setReplacingObjects(runParams, tailend); //set original Params to update them later tailend.setReplacingObject(AbilityKey.OriginalParams, runParams); + tailend.setReplacingObjectsFrom(runParams, AbilityKey.SimultaneousETB); tailend = tailend.getSubAbility(); } while(tailend != null); diff --git a/forge-gui/res/cardsfolder/upcoming/ashiok_wicked_manipulator.txt b/forge-gui/res/cardsfolder/upcoming/ashiok_wicked_manipulator.txt index 181c94d6b0e..47cff6c0ca8 100644 --- a/forge-gui/res/cardsfolder/upcoming/ashiok_wicked_manipulator.txt +++ b/forge-gui/res/cardsfolder/upcoming/ashiok_wicked_manipulator.txt @@ -3,12 +3,12 @@ ManaCost:3 B B Types:Legendary Planeswalker Ashiok Loyalty:5 R:Event$ PayLife | ActiveZones$ Battlefield | ValidPlayer$ You | ReplaceWith$ ExileTop | Amount$ LEY | Description$ If you would pay life while your library has at least that many cards in it, exile that many cards from the top of your library instead. -SVar:ExileTop:DB$ Dig | DigNum$ X | ChangeNum$ All | DestinationZone$ Exile +SVar:ExileTop:DB$ DigUntil | Amount$ X | Valid$ Card.NotDefinedReplacedSimultaneousETB | NoMoveRevealed$ True | FoundDestination$ Exile SVar:X:ReplaceCount$Amount -SVar:Y:Count$ValidLibrary Card +SVar:Y:Count$ValidLibrary Card.YouOwn A:AB$ Dig | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | DigNum$ 2 | ChangeNum$ 1 | DestinationZone2$ Exile | NoReveal$ True | SpellDescription$ Look at the top two cards of your library. Exile one of them and put the other into your hand. A:AB$ Token | Cost$ SubCounter<2/LOYALTY> | Planeswalker$ True | TokenAmount$ 2 | TokenScript$ b_1_1_nightmare_exile_counter | TokenOwner$ You | SpellDescription$ Create two 1/1 black Nightmare creature tokens with "At the beginning of combat on your turn, if a card was put into exile this turn, put a +1/+1 counter on this creature." -A:AB$ Discard | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Ultimate$ True | ValidTgts$ Player | NumCards$ Z | Mode$ TgtChoose | SpellDescription$ Target player exiles the top X cards of their library, where X is the total mana value of cards you own in exile. +A:AB$ Dig | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Ultimate$ True | ValidTgts$ Player | DigNum$ Z | ChangeNum$ All | DestinationZone$ Exile | SpellDescription$ Target player exiles the top X cards of their library, where X is the total mana value of cards you own in exile. SVar:Z:Count$ValidExile Card.YouOwn$SumCMC AI:RemoveDeck:Random Oracle:If you would pay life while your library has at least that many cards in it, exile that many cards from the top of your library instead.\n+1: Look at the top two cards of your library. Exile one of them and put the other into your hand.\n−2: Create two 1/1 black Nightmare creature tokens with "At the beginning of combat on your turn, if a card was put into exile this turn, put a +1/+1 counter on this creature."\n−7: Target player exiles the top X cards of their library, where X is the total mana value of cards you own in exile.