From ca30c319758d8f32933578d87e9dc954b15658bf Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Thu, 4 Aug 2022 19:28:45 +0200 Subject: [PATCH 1/4] View fix --- .../forge/game/ability/effects/AnimateEffectBase.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/effects/AnimateEffectBase.java b/forge-game/src/main/java/forge/game/ability/effects/AnimateEffectBase.java index 6df27fae809..02df76cee8b 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/AnimateEffectBase.java +++ b/forge-game/src/main/java/forge/game/ability/effects/AnimateEffectBase.java @@ -65,10 +65,6 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect { source.addRemembered(c); } - if ((power != null) || (toughness != null)) { - c.addNewPT(power, toughness, timestamp, 0); - } - if (!addType.isEmpty() || !removeType.isEmpty() || addAllCreatureTypes || removeSuperTypes || removeCardTypes || removeSubTypes || removeLandTypes || removeCreatureTypes || removeArtifactTypes || removeEnchantmentTypes) { c.addChangedCardTypes(addType, removeType, addAllCreatureTypes, removeSuperTypes, removeCardTypes, removeSubTypes, @@ -77,6 +73,11 @@ public abstract class AnimateEffectBase extends SpellAbilityEffect { c.addChangedCardKeywords(keywords, removeKeywords, removeAll, timestamp, 0); + // do this after changing types in case it wasn't a creature before + if (power != null || toughness != null) { + c.addNewPT(power, toughness, timestamp, 0); + } + if (sa.hasParam("CantHaveKeyword")) { c.addCantHaveKeyword(timestamp, Keyword.setValueOf(sa.getParam("CantHaveKeyword"))); } From f1fb414ebe7c6501e4ab1c7a7774522b92028b58 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Thu, 4 Aug 2022 19:29:22 +0200 Subject: [PATCH 2/4] Fix targeting abilities --- forge-gui/res/cardsfolder/e/ersatz_gnomes.txt | 2 +- forge-gui/res/cardsfolder/f/failure_comply.txt | 2 +- forge-gui/res/cardsfolder/g/gales_redirection.txt | 2 +- forge-gui/res/cardsfolder/h/hullbreaker_horror.txt | 2 +- forge-gui/res/cardsfolder/o/obscura_interceptor.txt | 2 +- forge-gui/res/cardsfolder/p/parallectric_feedback.txt | 2 +- forge-gui/res/cardsfolder/r/refuse_cooperate.txt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/forge-gui/res/cardsfolder/e/ersatz_gnomes.txt b/forge-gui/res/cardsfolder/e/ersatz_gnomes.txt index 8cae6a8194b..4a3dfbeab8a 100644 --- a/forge-gui/res/cardsfolder/e/ersatz_gnomes.txt +++ b/forge-gui/res/cardsfolder/e/ersatz_gnomes.txt @@ -2,7 +2,7 @@ Name:Ersatz Gnomes ManaCost:3 Types:Artifact Creature Gnome PT:1/1 -A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Card | TgtZone$ Stack | TgtPrompt$ Select target spell to make colorless | Duration$ Permanent | SpellDescription$ Target spell becomes colorless. +A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Card | TargetType$ Spell | TgtZone$ Stack | TgtPrompt$ Select target spell to make colorless | Duration$ Permanent | SpellDescription$ Target spell becomes colorless. A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Permanent | TgtPrompt$ Select target permanent to make colorless | SpellDescription$ Target permanent becomes colorless until end of turn. AI:RemoveDeck:Random AI:RemoveDeck:All diff --git a/forge-gui/res/cardsfolder/f/failure_comply.txt b/forge-gui/res/cardsfolder/f/failure_comply.txt index 78065f5ff40..e4e38eac007 100644 --- a/forge-gui/res/cardsfolder/f/failure_comply.txt +++ b/forge-gui/res/cardsfolder/f/failure_comply.txt @@ -1,7 +1,7 @@ Name:Failure ManaCost:1 U Types:Instant -A:SP$ ChangeZone | Cost$ 1 U | ValidTgts$ Card | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Hand | SpellDescription$ Return target spell to its owner's hand. +A:SP$ ChangeZone | Cost$ 1 U | ValidTgts$ Card | TargetType$ Spell | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Hand | SpellDescription$ Return target spell to its owner's hand. AlternateMode:Split Oracle:Return target spell to its owner's hand. diff --git a/forge-gui/res/cardsfolder/g/gales_redirection.txt b/forge-gui/res/cardsfolder/g/gales_redirection.txt index 2d85425ef4d..7ed1a535b27 100644 --- a/forge-gui/res/cardsfolder/g/gales_redirection.txt +++ b/forge-gui/res/cardsfolder/g/gales_redirection.txt @@ -1,7 +1,7 @@ Name:Gale's Redirection ManaCost:3 U U Types:Instant -A:SP$ ChangeZone | ValidTgts$ Card | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Exile | TgtPrompt$ Choose target spell to exile | RememberChanged$ True | SubAbility$ DBRoll | SpellDescription$ Exile target spell. +A:SP$ ChangeZone | ValidTgts$ Card | TargetType$ Spell | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Exile | TgtPrompt$ Choose target spell to exile | RememberChanged$ True | SubAbility$ DBRoll | SpellDescription$ Exile target spell. SVar:DBRoll:DB$ RollDice | Sides$ 20 | Modifier$ Y | ResultSubAbilities$ 1-14:DBMayPlay,Else:DBMayPlayWithoutCost | StackDescription$ SpellDescription | SpellDescription$ Roll a d20 and add that spell's mana value. SVar:DBMayPlay:DB$ Effect | StaticAbilities$ STPlay | RememberObjects$ Remembered | Duration$ Permanent | ExileOnMoved$ Exile | SubAbility$ DBCleanup | SpellDescription$ 1—14 VERT You may cast that card for as long as it remains exiled, and you may spend mana as though it were mana of any color to cast it. SVar:DBMayPlayWithoutCost:DB$ Effect | StaticAbilities$ STPlayWithoutCost | RememberObjects$ Remembered | Duration$ Permanent | ExileOnMoved$ Exile | SubAbility$ DBCleanup | SpellDescription$ 15+ VERT You may cast that card without paying its mana cost for as long as it remains exiled. diff --git a/forge-gui/res/cardsfolder/h/hullbreaker_horror.txt b/forge-gui/res/cardsfolder/h/hullbreaker_horror.txt index 2767f547ed7..3954ba50c29 100644 --- a/forge-gui/res/cardsfolder/h/hullbreaker_horror.txt +++ b/forge-gui/res/cardsfolder/h/hullbreaker_horror.txt @@ -6,6 +6,6 @@ K:Flash K:This spell can't be countered. T:Mode$ SpellCast | ValidCard$ Card | ValidActivatingPlayer$ You | Execute$ TrigCharm | TriggerZones$ Battlefield | TriggerDescription$ Whenever you cast a spell, ABILITY SVar:TrigCharm:DB$ Charm | Choices$ ControlReturn,ControlBounce | MinCharmNum$ 0 | CharmNum$ 1 -SVar:ControlReturn:DB$ ChangeZone | ValidTgts$ Card.YouDontCtrl | TgtPrompt$ Select target spell you don't control | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Hand | SpellDescription$ Return target spell you don't control to its owner's hand. +SVar:ControlReturn:DB$ ChangeZone | ValidTgts$ Card.YouDontCtrl | TargetType$ Spell | TgtPrompt$ Select target spell you don't control | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Hand | SpellDescription$ Return target spell you don't control to its owner's hand. SVar:ControlBounce:DB$ ChangeZone | ValidTgts$ Permanent.nonLand | TgtPrompt$ Select target nonland permanent | TgtZone$ Battlefield | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return target nonland permanent to its owner's hand. Oracle:Flash\nThis spell can't be countered.\nWhenever you cast a spell, choose up to one —\n• Return target spell you don't control to its owner's hand.\n• Return target nonland permanent to its owner's hand. diff --git a/forge-gui/res/cardsfolder/o/obscura_interceptor.txt b/forge-gui/res/cardsfolder/o/obscura_interceptor.txt index ec64d336b6c..0d0d562f9ef 100644 --- a/forge-gui/res/cardsfolder/o/obscura_interceptor.txt +++ b/forge-gui/res/cardsfolder/o/obscura_interceptor.txt @@ -7,6 +7,6 @@ K:Lifelink T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigConnive | TriggerDescription$ When CARDNAME enters the battlefield, it connives. When it connives this way, return up to one target spell to its owner's hand. (To have a creature connive, draw a card, then discard a card. If you discarded a nonland card, put a +1/+1 counter on that creature.) SVar:TrigConnive:DB$ Connive | SubAbility$ DBImmediateTrigger SVar:DBImmediateTrigger:DB$ ImmediateTrigger | Execute$ TrigReturn | TriggerDescription$ When it connives this way, return up to one target spell to its owner's hand. -SVar:TrigReturn:DB$ ChangeZone | ValidTgts$ Card | TgtPrompt$ Select target spell | TargetMax$ 1 | TargetMin$ 0 | TgtZone$ Stack | Origin$ Stack | Fizzle$ True | Destination$ Hand +SVar:TrigReturn:DB$ ChangeZone | ValidTgts$ Card | TgtPrompt$ Select target spell | TargetMax$ 1 | TargetMin$ 0 | TgtZone$ Stack | TargetType$ Spell | Origin$ Stack | Fizzle$ True | Destination$ Hand DeckHas:Ability$LifeGain|Discard|Counters Oracle:Flash\nLifelink\nWhen Obscura Interceptor enters the battlefield, it connives. When it connives this way, return up to one target spell to its owner's hand. (To have a creature connive, draw a card, then discard a card. If you discarded a nonland card, put a +1/+1 counter on that creature.) diff --git a/forge-gui/res/cardsfolder/p/parallectric_feedback.txt b/forge-gui/res/cardsfolder/p/parallectric_feedback.txt index 09eb1bdd488..cbc1450ac24 100644 --- a/forge-gui/res/cardsfolder/p/parallectric_feedback.txt +++ b/forge-gui/res/cardsfolder/p/parallectric_feedback.txt @@ -1,7 +1,7 @@ Name:Parallectric Feedback ManaCost:3 R Types:Instant -A:SP$ Pump | Cost$ 3 R | ValidTgts$ Card | TgtZone$ Stack | TgtPrompt$ Select target spell | PumpZone$ Stack | StackDescription$ None | SubAbility$ DBDmg | SpellDescription$ CARDNAME deals damage to target spell's controller equal to that spell's mana value. +A:SP$ Pump | Cost$ 3 R | ValidTgts$ Card | TargetType$ Spell | TgtZone$ Stack | TgtPrompt$ Select target spell | PumpZone$ Stack | StackDescription$ None | SubAbility$ DBDmg | SpellDescription$ CARDNAME deals damage to target spell's controller equal to that spell's mana value. SVar:DBDmg:DB$ DealDamage | Defined$ TargetedController | NumDmg$ X SVar:X:Targeted$CardManaCost AI:RemoveDeck:All diff --git a/forge-gui/res/cardsfolder/r/refuse_cooperate.txt b/forge-gui/res/cardsfolder/r/refuse_cooperate.txt index d6c4e708630..6f1e84ff971 100644 --- a/forge-gui/res/cardsfolder/r/refuse_cooperate.txt +++ b/forge-gui/res/cardsfolder/r/refuse_cooperate.txt @@ -1,7 +1,7 @@ Name:Refuse ManaCost:3 R Types:Instant -A:SP$ Pump | Cost$ 3 R | ValidTgts$ Card | TgtZone$ Stack | TgtPrompt$ Select target spell | PumpZone$ Stack | StackDescription$ None | SubAbility$ DBDmg | SpellDescription$ CARDNAME deals damage to target spell's controller equal to that spell's mana value. +A:SP$ Pump | Cost$ 3 R | ValidTgts$ Card | TargetType$ Spell | TgtZone$ Stack | TgtPrompt$ Select target spell | PumpZone$ Stack | StackDescription$ None | SubAbility$ DBDmg | SpellDescription$ CARDNAME deals damage to target spell's controller equal to that spell's mana value. SVar:DBDmg:DB$ DealDamage | Defined$ TargetedController | NumDmg$ X SVar:X:Targeted$CardManaCost AI:RemoveDeck:All From e75c456524a067b54145eddebe390ef517df9d90 Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Thu, 4 Aug 2022 21:23:16 +0200 Subject: [PATCH 3/4] Extort fix --- forge-game/src/main/java/forge/game/card/CardFactoryUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index 0d68aae35db..551c18a6290 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -1131,7 +1131,7 @@ public class CardFactoryUtil { SpellAbility loseLifeSA = AbilityFactory.getAbility(loseLifeStr, card); AbilitySub gainLifeSA = (AbilitySub) AbilityFactory.getAbility(gainLifeStr, card); - gainLifeSA.setSVar("AFLifeLost", "Number$0"); + loseLifeSA.setSVar("AFLifeLost", "Number$0"); loseLifeSA.setSubAbility(gainLifeSA); loseLifeSA.setIntrinsic(intrinsic); From caad3bff44112125266c2aef5ac295281597c20f Mon Sep 17 00:00:00 2001 From: tool4EvEr Date: Thu, 4 Aug 2022 23:04:35 +0200 Subject: [PATCH 4/4] Fix logic from refactoring --- forge-ai/src/main/java/forge/ai/ComputerUtilCost.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java index 1c1b88a4313..e2c2998c1a7 100644 --- a/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java +++ b/forge-ai/src/main/java/forge/ai/ComputerUtilCost.java @@ -778,9 +778,12 @@ public class ComputerUtilCost { // Check if the AI intends to play the card and if it can pay for it with the mana it has boolean willPlay = ComputerUtil.hasReasonToPlayCardThisTurn(payer, c); boolean canPay = c.getManaCost().canBePaidWithAvailable(ColorSet.fromNames(getAvailableManaColors(payer, source)).getColor()); - return canPay && willPlay; + if (canPay && willPlay) { + return true; + } } } + return false; } } }