From 6daf4ac78da16851581b69c83ee4044736d15246 Mon Sep 17 00:00:00 2001 From: Lyu Zong-Hong Date: Sun, 20 Jun 2021 17:22:49 +0900 Subject: [PATCH] Add remaining commander cards --- forge-gui/res/cardsfolder/i/impact_resonance.txt | 13 +++++++++++++ forge-gui/res/cardsfolder/s/sudden_substitution.txt | 13 +++++++++++++ .../gamemodes/match/input/InputSelectTargets.java | 11 ++++------- 3 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 forge-gui/res/cardsfolder/i/impact_resonance.txt create mode 100644 forge-gui/res/cardsfolder/s/sudden_substitution.txt diff --git a/forge-gui/res/cardsfolder/i/impact_resonance.txt b/forge-gui/res/cardsfolder/i/impact_resonance.txt new file mode 100644 index 00000000000..6a6c29e3778 --- /dev/null +++ b/forge-gui/res/cardsfolder/i/impact_resonance.txt @@ -0,0 +1,13 @@ +Name:Impact Resonance +ManaCost:1 R +Types:Instant +T:Mode$ TurnBegin | Execute$ ResetDamage | Static$ True +SVar:ResetDamage:DB$ StoreSVar | SVar$ X | Type$ Number | Expression$ 0 +T:Mode$ DamageDone | ValidTarget$ Player,Permanent | Execute$ StoreDamage | Static$ True +SVar:StoreDamage:DB$ StoreSVar | SVar$ X | Type$ Calculate | Expression$ Y | ConditionCheckSVar$ Y | ConditionSVarCompare$ GTX +A:SP$ DealDamage | Cost$ 1 R | ValidTgts$ Creature | TargetMin$ MinTgts | TargetMax$ MaxTgts | NumDmg$ X | DividedAsYouChoose$ X | SpellDescription$ CARDNAME deals X damage divided as you choose among any number of target creatures, where X is the greatest amount of damage dealt by a source to a permanent or player this turn. +SVar:X:Number$0 +SVar:Y:TriggerCount$DamageAmount +SVar:MinTgts:SVar$X/LimitMax.1 +SVar:MaxTgts:Count$Valid Creature +Oracle:Impact Resonance deals X damage divided as you choose among any number of target creatures, where X is the greatest amount of damage dealt by a source to a permanent or player this turn. diff --git a/forge-gui/res/cardsfolder/s/sudden_substitution.txt b/forge-gui/res/cardsfolder/s/sudden_substitution.txt new file mode 100644 index 00000000000..ac7be89163e --- /dev/null +++ b/forge-gui/res/cardsfolder/s/sudden_substitution.txt @@ -0,0 +1,13 @@ +Name:Sudden Substitution +ManaCost:2 U U +Types:Instant +K:Split second +A:SP$ Pump | TargetType$ Spell | ValidTgts$ Card.nonCreature | TgtZone$ Stack | ImprintCards$ TargetedSource | SubAbility$ DBRemember | StackDescription$ SpellDescription | SpellDescription$ Exchange control of target noncreature spell and target creature. Then the spell's controller may choose new targets for it. +SVar:DBRemember:DB$ Pump | ValidTgts$ Creature | RememberObjects$ ThisTargetedCard | SubAbility$ DBRememberPlayer +SVar:DBRememberPlayer:DB$ Pump | RememberObjects$ RememberedController | ConditionDefined$ Remembered | ConditionPresent$ Card | SubAbility$ DBGainControl +SVar:DBGainControl:DB$ GainControl | Defined$ Remembered.Creature | NewController$ ImprintedController | ConditionDefined$ Imprinted | ConditionPresent$ Card | StackDescription$ None | SubAbility$ DBControlSpell +SVar:DBControlSpell:DB$ ControlSpell | Defined$ Targeted | NewController$ Player.IsRemembered | Mode$ Gain | ConditionDefined$ Remembered | ConditionPresent$ Card | StackDescription$ None | SubAbility$ DBChooseTargets +SVar:DBChooseTargets:DB$ ChangeTargets | Defined$ Targeted | Chooser$ ImprintedController | Optional$ True | ConditionDefined$ Imprinted | ConditionPresent$ Card | StackDescription$ None | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True +AI:RemoveDeck:All +Oracle:Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)\nExchange control of target noncreature spell and target creature. Then the spell's controller may choose new targets for it. diff --git a/forge-gui/src/main/java/forge/gamemodes/match/input/InputSelectTargets.java b/forge-gui/src/main/java/forge/gamemodes/match/input/InputSelectTargets.java index 12bc7098a66..8ab0d742dae 100644 --- a/forge-gui/src/main/java/forge/gamemodes/match/input/InputSelectTargets.java +++ b/forge-gui/src/main/java/forge/gamemodes/match/input/InputSelectTargets.java @@ -128,10 +128,10 @@ public final class InputSelectTargets extends InputSyncronizedBase { "(Targeting ERROR)", ""); showMessage(message, sa.getView()); - if (divisionValues != null && sa.getMinTargets() == 0 && sa.getTargets().size() == 0) { + if ((divisionValues != null && !divisionValues.isEmpty()) && sa.getMinTargets() == 0 && sa.getTargets().size() == 0) { // extra logic for Divided with min targets = 0, should only work if num targets are 0 too getController().getGui().updateButtons(getOwner(), true, true, false); - } else if (!sa.isMinTargetChosen() || divisionValues != null) { + } else if (!sa.isMinTargetChosen() || (divisionValues != null && !divisionValues.isEmpty())){ // If reached Minimum targets, enable OK button if (mandatory && tgt.hasCandidates(sa, true)) { // Player has to click on a target @@ -279,7 +279,7 @@ public final class InputSelectTargets extends InputSyncronizedBase { return false; } - if (divisionValues != null) { + if ((divisionValues != null && !divisionValues.isEmpty())) { Boolean val = onDividedAsYouChoose(card); if (val != null) { return val; @@ -321,7 +321,7 @@ public final class InputSelectTargets extends InputSyncronizedBase { return; } - if (divisionValues != null) { + if ((divisionValues != null && !divisionValues.isEmpty())) { Boolean val = onDividedAsYouChoose(player); if (val != null) { return; @@ -331,9 +331,6 @@ public final class InputSelectTargets extends InputSyncronizedBase { } protected Boolean onDividedAsYouChoose(GameObject go) { - if (divisionValues.isEmpty()) { - return false; - } String apiBasedMessage = "Distribute how much to "; if (sa.getApi() == ApiType.DealDamage) { apiBasedMessage = "Select how much damage to deal to ";