From eed20352cac245674f0cb22c3b6e2551764dcb29 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Wed, 27 Sep 2023 22:45:41 +0200 Subject: [PATCH 1/5] Fix activated charm keeping last sub abilities --- forge-game/src/main/java/forge/game/GameActionUtil.java | 5 +++++ .../game/spellability/SpellAbilityStackInstance.java | 5 +++++ forge-game/src/main/java/forge/game/zone/MagicStack.java | 9 ++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/forge-game/src/main/java/forge/game/GameActionUtil.java b/forge-game/src/main/java/forge/game/GameActionUtil.java index f37d4cb9b0f..f62eb05b3d3 100644 --- a/forge-game/src/main/java/forge/game/GameActionUtil.java +++ b/forge-game/src/main/java/forge/game/GameActionUtil.java @@ -910,6 +910,11 @@ public final class GameActionUtil { } } + if (ability.getApi() == ApiType.Charm) { + // reset chain + ability.setSubAbility(null); + } + ability.clearTargets(); ability.resetOnceResolved(); diff --git a/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java b/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java index 7bab8458cb4..4bc7e7aabdc 100644 --- a/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java +++ b/forge-game/src/main/java/forge/game/spellability/SpellAbilityStackInstance.java @@ -80,6 +80,11 @@ public class SpellAbilityStackInstance implements IIdentifiable, IHasCardView { sVars.put("StoredTransform", String.valueOf(ability.getHostCard().getTransformedTimestamp())); } + if (sa.getApi() == ApiType.Charm && sa.hasParam("ChoiceRestriction")) { + // Remember the Choice here for later handling + sa.getHostCard().addChosenModes(sa, sa.getSubAbility().getDescription(), sa.getHostCard().getGame().getPhaseHandler().inCombat()); + } + view = new StackItemView(this); } diff --git a/forge-game/src/main/java/forge/game/zone/MagicStack.java b/forge-game/src/main/java/forge/game/zone/MagicStack.java index cdf5b6b0c36..dec17f6a45f 100644 --- a/forge-game/src/main/java/forge/game/zone/MagicStack.java +++ b/forge-game/src/main/java/forge/game/zone/MagicStack.java @@ -291,11 +291,6 @@ public class MagicStack /* extends MyObservable */ implements Iterable Date: Wed, 27 Sep 2023 22:46:19 +0200 Subject: [PATCH 2/5] nonAuras can ETB unattached --- .../java/forge/game/ability/effects/ChangeZoneEffect.java | 4 ++-- .../main/java/forge/game/ability/effects/DigUntilEffect.java | 2 +- forge-game/src/main/java/forge/game/phase/PhaseHandler.java | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java index 97b9d495bb8..8e28d35174e 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java @@ -636,7 +636,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { // TODO can't attach later or moveToPlay would attach indirectly // bypass canBeAttached to skip Protection checks when trying to attach multiple auras that would grant protection gameCard.attachToEntity(game.getCardState(attachedTo), sa, true); - } else { // When it should enter the battlefield attached to an illegal permanent it fails + } else if (gameCard.isAura()) { // When it should enter the battlefield attached to an illegal permanent it fails continue; } } @@ -1366,7 +1366,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { // bypass canBeAttached to skip Protection checks when trying to attach multiple auras that would grant protection c.attachToEntity(game.getCardState(attachedTo), sa, true); } - else { // When it should enter the battlefield attached to an illegal permanent it fails + else if (c.isAura()) { // When it should enter the battlefield attached to an illegal permanent it fails continue; } } 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 99dd4659d78..c3382bc1c39 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 @@ -231,7 +231,7 @@ public class DigUntilEffect extends SpellAbilityEffect { params.put("Attach", c); Card attachedTo = p.getController().chooseSingleEntityForEffect(list, sa, Localizer.getInstance().getMessage("lblSelectACardAttachSourceTo", c.toString()), params); c.attachToEntity(game.getCardState(attachedTo), sa, true); - } else { + } else if (c.isAura()) { continue; } } diff --git a/forge-game/src/main/java/forge/game/phase/PhaseHandler.java b/forge-game/src/main/java/forge/game/phase/PhaseHandler.java index c61850c72b0..9d5f9974c1f 100644 --- a/forge-game/src/main/java/forge/game/phase/PhaseHandler.java +++ b/forge-game/src/main/java/forge/game/phase/PhaseHandler.java @@ -1063,7 +1063,6 @@ public class PhaseHandler implements java.io.Serializable { // do setup this.setupFirstTurn(goesFirst, startGameHook); - // MAIN GAME LOOP while (!game.isGameOver()) { this.mainLoopStep(); From 9c3c785270f7810eb460ba787a978a591c08a53a Mon Sep 17 00:00:00 2001 From: TRT <> Date: Thu, 28 Sep 2023 14:33:20 +0200 Subject: [PATCH 3/5] Clean up --- forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt b/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt index 8b3f2eca626..d7727f56968 100644 --- a/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt +++ b/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt @@ -3,7 +3,7 @@ ManaCost:R G Types:Legendary Creature Gnoll PT:2/2 T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigPumpAll | TriggerZones$ Battlefield | CheckSVar$ PackTactics | SVarCompare$ GE6 | NoResolvingCheck$ True | TriggerDescription$ Pack tactics — Whenever CARDNAME attacks, if you attacked with creatures with total power 6 or greater this combat, attacking creatures get +1/+0 until end of turn. -A:AB$ Pump | Cost$ 2 R G | NumAtt$ +X | NumDef$ +Y | Double$ True | SpellDescription$ Double CARDNAME's power and toughness until end of turn. +A:AB$ Pump | Cost$ 2 R G | NumAtt$ +X | NumDef$ +Y | Double$ True | SpellDescription$ Double NICKAME's power and toughness until end of turn. SVar:TrigPumpAll:DB$ PumpAll | ValidCards$ Creature.attacking | NumAtt$ 1 SVar:X:Count$CardPower SVar:Y:Count$CardToughness From 7ff02f707f1331391620346d8598b963d303b201 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Thu, 28 Sep 2023 22:12:23 +0200 Subject: [PATCH 4/5] Support for Ojer Axonil --- forge-game/src/main/java/forge/game/ability/AbilityUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java index 73c2aa47e7f..55de7e628d7 100644 --- a/forge-game/src/main/java/forge/game/ability/AbilityUtils.java +++ b/forge-game/src/main/java/forge/game/ability/AbilityUtils.java @@ -2359,7 +2359,7 @@ public class AbilityUtils { String[] props = l[0].split(" "); Boolean isCombat = null; if (sq[0].contains("CombatDamage")) { - isCombat = true; + isCombat = !sq[0].contains("Non"); } int num; List dmgInstances = game.getDamageDoneThisTurn(isCombat, false, props[1], props[2], c, player, ctb); From 60f3172b82b36c8561ba44a5c9be641b69971b7c Mon Sep 17 00:00:00 2001 From: tool4ever Date: Fri, 29 Sep 2023 09:01:52 +0200 Subject: [PATCH 5/5] Update targ_nar_demon_fang_gnoll.txt --- forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt b/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt index d7727f56968..523b260e68b 100644 --- a/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt +++ b/forge-gui/res/cardsfolder/t/targ_nar_demon_fang_gnoll.txt @@ -3,7 +3,7 @@ ManaCost:R G Types:Legendary Creature Gnoll PT:2/2 T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigPumpAll | TriggerZones$ Battlefield | CheckSVar$ PackTactics | SVarCompare$ GE6 | NoResolvingCheck$ True | TriggerDescription$ Pack tactics — Whenever CARDNAME attacks, if you attacked with creatures with total power 6 or greater this combat, attacking creatures get +1/+0 until end of turn. -A:AB$ Pump | Cost$ 2 R G | NumAtt$ +X | NumDef$ +Y | Double$ True | SpellDescription$ Double NICKAME's power and toughness until end of turn. +A:AB$ Pump | Cost$ 2 R G | NumAtt$ +X | NumDef$ +Y | Double$ True | SpellDescription$ Double NICKNAME's power and toughness until end of turn. SVar:TrigPumpAll:DB$ PumpAll | ValidCards$ Creature.attacking | NumAtt$ 1 SVar:X:Count$CardPower SVar:Y:Count$CardToughness