From aebde7a1d0dab15d0d1772b62e449bcfead9ab53 Mon Sep 17 00:00:00 2001 From: tool4ever Date: Sun, 22 Sep 2024 19:54:02 +0200 Subject: [PATCH 1/2] Fix NPE with Starforged Sword (#6188) * Fix NPE * Fix The Lord of Pain --------- Co-authored-by: TRT <> --- .../java/forge/game/ability/SpellAbilityEffect.java | 2 +- .../main/java/forge/game/player/PlayerProperty.java | 10 +++++----- forge-gui/res/cardsfolder/d/decoy_gambit.txt | 2 +- forge-gui/res/cardsfolder/r/research_development.txt | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/forge-game/src/main/java/forge/game/ability/SpellAbilityEffect.java b/forge-game/src/main/java/forge/game/ability/SpellAbilityEffect.java index a8f232bb366..5f145d9af5f 100644 --- a/forge-game/src/main/java/forge/game/ability/SpellAbilityEffect.java +++ b/forge-game/src/main/java/forge/game/ability/SpellAbilityEffect.java @@ -64,7 +64,7 @@ public abstract class SpellAbilityEffect { // prelude for when this is root ability if (!(sa instanceof AbilitySub)) { sb.append(sa.getHostCard()).append(" -"); - if (sa.getHostCard().hasPromisedGift()) { + if (sa.getHostCard().hasPromisedGift() && sa.hasAdditionalAbility("GiftAbility")) { sb.append(" Gift "). append(sa.getAdditionalAbility("GiftAbility").getParam("GiftDescription")). append(" to ").append(sa.getHostCard().getPromisedGift()).append(". "); diff --git a/forge-game/src/main/java/forge/game/player/PlayerProperty.java b/forge-game/src/main/java/forge/game/player/PlayerProperty.java index aaf3db80bee..e2915155497 100644 --- a/forge-game/src/main/java/forge/game/player/PlayerProperty.java +++ b/forge-game/src/main/java/forge/game/player/PlayerProperty.java @@ -24,11 +24,11 @@ public class PlayerProperty { public static boolean playerHasProperty(Player player, String property, Player sourceController, Card source, CardTraitBase spellAbility) { Game game = player.getGame(); - if (property.endsWith("Activator")) { - sourceController = spellAbility.getHostCard().getController(); - property = property.substring(0, property.length() - 9); - } - if (property.equals("You")) { + if (property.equals("Activator")) { + if (!player.equals(spellAbility.getHostCard().getController())) { + return false; + } + } else if (property.equals("You")) { if (!player.equals(sourceController)) { return false; } diff --git a/forge-gui/res/cardsfolder/d/decoy_gambit.txt b/forge-gui/res/cardsfolder/d/decoy_gambit.txt index 4b28e783873..852d3c3a8fe 100644 --- a/forge-gui/res/cardsfolder/d/decoy_gambit.txt +++ b/forge-gui/res/cardsfolder/d/decoy_gambit.txt @@ -3,6 +3,6 @@ ManaCost:2 U Types:Instant A:SP$ Pump | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Choose up to one target creature each opponent controls | TargetMin$ 0 | TargetMax$ OneEach | TargetsForEachPlayer$ True | SubAbility$ DBRepeat | SpellDescription$ For each opponent, choose up to one target creature that player controls, then return that creature to its owner's hand unless its controller has you draw a card. SVar:DBRepeat:DB$ RepeatEach | DefinedCards$ Targeted | RepeatSubAbility$ DBReturn -SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Battlefield | Destination$ Hand | UnlessCost$ Draw<1/Player.YouActivator> | UnlessPayer$ RememberedController +SVar:DBReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Battlefield | Destination$ Hand | UnlessCost$ Draw<1/Player.Activator> | UnlessPayer$ RememberedController SVar:OneEach:PlayerCountOpponents$Amount Oracle:For each opponent, choose up to one target creature that player controls, then return that creature to its owner's hand unless its controller has you draw a card. diff --git a/forge-gui/res/cardsfolder/r/research_development.txt b/forge-gui/res/cardsfolder/r/research_development.txt index f6ec3f9b409..bd8b3526f55 100644 --- a/forge-gui/res/cardsfolder/r/research_development.txt +++ b/forge-gui/res/cardsfolder/r/research_development.txt @@ -12,5 +12,5 @@ Name:Development ManaCost:3 U R Types:Instant A:SP$ Repeat | RepeatSubAbility$ DBToken | MaxRepeat$ 3 | StackDescription$ SpellDescription | SpellDescription$ Create a 3/1 red Elemental creature token unless any opponent has you draw a card. Repeat this process two more times. -SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenScript$ r_3_1_elemental | TokenOwner$ You | UnlessPayer$ Player.Opponent | UnlessCost$ Draw<1/Player.YouActivator> | UnlessAI$ MorePowerful +SVar:DBToken:DB$ Token | TokenAmount$ 1 | TokenScript$ r_3_1_elemental | TokenOwner$ You | UnlessPayer$ Player.Opponent | UnlessCost$ Draw<1/Player.Activator> | UnlessAI$ MorePowerful Oracle:Create a 3/1 red Elemental creature token unless any opponent has you draw a card. Repeat this process two more times. From 2b41b1cbe82c5c67a3fd3c1f5817d3bccdfcf507 Mon Sep 17 00:00:00 2001 From: loud1990 <49922764+loud1990@users.noreply.github.com> Date: Sun, 22 Sep 2024 13:56:17 -0400 Subject: [PATCH 2/2] Fixed 2 DSK cards (#6186) Fixed Trial of Agony which wasn't dealing the damage, and Disturbing Mirth which was only allowing you to sacrifice another enchantment (not a creature). --- forge-gui/res/cardsfolder/upcoming/disturbing_mirth.txt | 2 +- forge-gui/res/cardsfolder/upcoming/trial_of_agony.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/forge-gui/res/cardsfolder/upcoming/disturbing_mirth.txt b/forge-gui/res/cardsfolder/upcoming/disturbing_mirth.txt index 3a90a43caf5..5339ff384ed 100644 --- a/forge-gui/res/cardsfolder/upcoming/disturbing_mirth.txt +++ b/forge-gui/res/cardsfolder/upcoming/disturbing_mirth.txt @@ -2,7 +2,7 @@ Name:Disturbing Mirth ManaCost:B R Types:Enchantment T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDraw | TriggerDescription$ When CARDNAME enters, you may sacrifice another enchantment or creature. If you do, draw two cards. -SVar:TrigDraw:AB$ Draw | Cost$ Sac<1/Enchantment.Other,Creature.Other/another enchantment or creature> | NumCards$ 2 +SVar:TrigDraw:AB$ Draw | Cost$ Sac<1/Enchantment.Other;Creature.Other/another enchantment or creature> | NumCards$ 2 T:Mode$ Sacrificed | ValidPlayer$ You | ValidCard$ Card.Self | Execute$ TrigDread | TriggerZones$ Battlefield | TriggerDescription$ When you sacrifice CARDNAME, manifest dread. (Look at the top two cards of your library. Put one onto the battlefield face down as a 2/2 creature and the other into your graveyard. Turn it face up any time for its mana cost if it's a creature card.) SVar:TrigDread:DB$ ManifestDread DeckHas:Ability$Sacrifice diff --git a/forge-gui/res/cardsfolder/upcoming/trial_of_agony.txt b/forge-gui/res/cardsfolder/upcoming/trial_of_agony.txt index 8649457d236..2c5596fadc0 100644 --- a/forge-gui/res/cardsfolder/upcoming/trial_of_agony.txt +++ b/forge-gui/res/cardsfolder/upcoming/trial_of_agony.txt @@ -3,7 +3,7 @@ ManaCost:R Types:Sorcery A:SP$ Pump | ValidTgts$ Creature.OppCtrl | TgtPrompt$ Select two target creatures controlled by the same opponent | TargetMin$ 2 | TargetMax$ 2 | TargetsFromSingleZone$ True | IsCurse$ True | RememberTargets$ True | SubAbility$ DBChoose | StackDescription$ SpellDescription | SpellDescription$ Choose two target creatures controlled by the same opponent. That player chooses one of those creatures. CARDNAME deals 5 damage to that creature, and the other can't block this turn. SVar:DBChoose:DB$ ChooseCard | Defined$ TargetedController | Mandatory$ True | Choices$ Creature.IsRemembered | ChoiceTitle$ Choose one to take 5 damage | ForgetChosen$ True | SubAbility$ DBDealDamage -SVar:DBDealDamage:DB$ DealDamage | Defined$ ChosenCard | SubAbility$ DBCantBlock +SVar:DBDealDamage:DB$ DealDamage | NumDmg$ 5 | Defined$ ChosenCard | SubAbility$ DBCantBlock SVar:DBCantBlock:DB$ Pump | Defined$ Remembered | KW$ HIDDEN CARDNAME can't block. | SubAbility$ DBCleanup SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True Oracle:Choose two target creatures controlled by the same opponent. That player chooses one of those creatures. Trial of Agony deals 5 damage to that creature, and the other can't block this turn.