From dd89e0eb64e8b279fb173de2c7c985f85ddb8763 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Fri, 6 Aug 2021 19:51:16 -0400 Subject: [PATCH 1/3] skyshroud_ambush.txt initial try --- forge-gui/res/cardsfolder/upcoming/skyshroud_ambush.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 forge-gui/res/cardsfolder/upcoming/skyshroud_ambush.txt diff --git a/forge-gui/res/cardsfolder/upcoming/skyshroud_ambush.txt b/forge-gui/res/cardsfolder/upcoming/skyshroud_ambush.txt new file mode 100644 index 00000000000..368f29b64fd --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/skyshroud_ambush.txt @@ -0,0 +1,9 @@ +Name:Skyshroud Ambush +ManaCost:1 G +Types:Instant +A:SP$ Pump | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Choose target creature you control | ImprintCards$ ThisTargetedCard | SubAbility$ DBFight | StackDescription$ Target creature you control [{c:ThisTargetedCard}] | SpellDescription$ Target creature you control fights target creature you don't control. When the creature you control wins the fight, draw a card. +SVar:DBFight:DB$ Fight | Defined$ ParentTarget | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Choose target creature you don't control | RememberObjects$ ThisTargetedCard | ConditionWinnerDefined$ Imprinted | WinSubAbility$ DBImmediateTrigger | CheckStates$ True | SubAbility$ DBCleanup | StackDescription$ fights target creature you don't control [{c:ThisTargetedCard}]. When the creature you control wins the fight, draw a card. +SVar:DBImmediateTrigger:DB$ ImmediateTrigger | Execute$ TrigDraw | Secondary$ True | StackDescription$ None | TriggerDescription$ When the creature you control wins the fight, draw a card. +SVar:TrigDraw:DB$ Draw | NumCards$ 1 +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True +Oracle:Target creature you control fights target creature you don't control. When the creature you control wins the fight, draw a card. From 974e0879b0f95350bc7ed0f016dd9552a3e707cc Mon Sep 17 00:00:00 2001 From: Northmoc Date: Fri, 6 Aug 2021 19:52:15 -0400 Subject: [PATCH 2/3] GameAction - allow some SAs to check states if specified --- forge-game/src/main/java/forge/game/GameAction.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java index 61159befd7c..40bedc7b398 100644 --- a/forge-game/src/main/java/forge/game/GameAction.java +++ b/forge-game/src/main/java/forge/game/GameAction.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import forge.game.spellability.SpellAbilityStackInstance; import org.apache.commons.lang3.tuple.ImmutablePair; import com.google.common.base.Predicate; @@ -1157,7 +1158,11 @@ public class GameAction { // sol(10/29) added for Phase updates, state effects shouldn't be // checked during Spell Resolution (except when persist-returning if (game.getStack().isResolving()) { - return; + Iterator it = game.getStack().iterator(); + SpellAbility top = it.next().getSpellAbility(true); + if (!top.hasParam("CheckStates") && !top.getSubAbility().hasParam("CheckStates")) { + return; + } } if (game.isGameOver()) { From 8ea2cae285e218604968bc67c8b04f6cc0709ce0 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Fri, 6 Aug 2021 19:52:52 -0400 Subject: [PATCH 3/3] Support "winning" Fights --- .../game/ability/effects/FightEffect.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/FightEffect.java b/forge-game/src/main/java/forge/game/ability/effects/FightEffect.java index e6f82bfb9f8..39aa63f34bb 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/FightEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/FightEffect.java @@ -15,6 +15,7 @@ import forge.game.player.Player; import forge.game.replacement.ReplacementType; import forge.game.spellability.SpellAbility; import forge.game.trigger.TriggerType; +import forge.game.zone.ZoneType; import forge.util.CardTranslation; import forge.util.Localizer; @@ -51,14 +52,14 @@ public class FightEffect extends DamageBaseEffect { if (fighters.size() < 2) { return; } - + if (sa.hasParam("RememberObjects")) { final String remembered = sa.getParam("RememberObjects"); for (final Object o : AbilityUtils.getDefinedObjects(host, remembered, sa)) { host.addRemembered(o); } } - + Player controller = host.getController(); boolean isOptional = sa.hasParam("Optional"); @@ -77,6 +78,24 @@ public class FightEffect extends DamageBaseEffect { final Map runParams = AbilityKey.newMap(); runParams.put(AbilityKey.Fighters, fighters); game.getTriggerHandler().runTrigger(TriggerType.FightOnce, runParams, false); + + if (sa.hasParam("ConditionWinnerDefined")) { + Card mustWin = AbilityUtils.getDefinedCards(host, sa.getParam("ConditionWinnerDefined"), sa).get(0); + Card mustLose = null; + for (Card l : fighters) { + if (l != mustWin) { + mustLose = l; + } + } + game.getAction().checkStateEffects(true); + SpellAbility sub = sa.getAdditionalAbility("WinSubAbility"); + if (mustWin.getZone().getZoneType().equals(ZoneType.Battlefield) && mustLose != null && + !mustLose.getZone().getZoneType().equals(ZoneType.Battlefield)) { + if (sub != null) { + AbilityUtils.resolve(sub); + } + } + } } private static List getFighters(SpellAbility sa) {