From efa99cb9ac99d52ed18c8702a255391bfd5f137b Mon Sep 17 00:00:00 2001 From: Northmoc Date: Wed, 26 May 2021 23:33:44 -0400 Subject: [PATCH 1/3] chefs_kiss.txt --- forge-gui/res/cardsfolder/upcoming/chefs_kiss.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 forge-gui/res/cardsfolder/upcoming/chefs_kiss.txt diff --git a/forge-gui/res/cardsfolder/upcoming/chefs_kiss.txt b/forge-gui/res/cardsfolder/upcoming/chefs_kiss.txt new file mode 100644 index 00000000000..bca9676325a --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/chefs_kiss.txt @@ -0,0 +1,7 @@ +Name:Chef's Kiss +ManaCost:1 R R +Types:Instant +A:SP$ ControlSpell | ValidTgts$ Card | TgtPrompt$ Select target spell that targets only a single permanent or player | TargetType$ Spell | Mode$ Gain | TargetsSingleTarget$ True | TargetValidTargeting$ Permanent,Player | SubAbility$ DBCopy | StackDescription$ SpellDescription | SpellDescription$ Gain control of target spell that targets only a single permanent or player. Copy it, then reselect the targets at random for the spell and the copy. The new targets can't be you or a permanent you control. +SVar:DBCopy:DB$ CopySpellAbility | Defined$ Targeted | RandomTarget$ True | RandomTargetRestriction$ Player.Other,Permanent.YouDontCtrl | SubAbility$ DBChangeTargets | StackDescription$ None +SVar:DBChangeTargets:DB$ ChangeTargets | Defined$ Targeted | RandomTarget$ True | RandomTargetRestriction$ Player.Other,Permanent.YouDontCtrl +Oracle:Gain control of target spell that targets only a single permanent or player. Copy it, then reselect the targets at random for the spell and the copy. The new targets can't be you or a permanent you control. From 5c689ebf9be1de5c38933c5cc1c796b73b5fd81d Mon Sep 17 00:00:00 2001 From: Northmoc Date: Wed, 26 May 2021 23:35:47 -0400 Subject: [PATCH 2/3] support for RandomTarget and RandomTargetRestriction on CopySpellAbilityEffect --- .../game/ability/effects/CopySpellAbilityEffect.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java index 73aa44a4cf0..7a0af1f764f 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CopySpellAbilityEffect.java @@ -21,6 +21,7 @@ import forge.game.player.Player; import forge.game.replacement.ReplacementType; import forge.game.spellability.AbilitySub; import forge.game.spellability.SpellAbility; +import forge.util.Aggregates; import forge.util.CardTranslation; import forge.util.Localizer; @@ -162,6 +163,14 @@ public class CopySpellAbilityEffect extends SpellAbilityEffect { if (sa.hasParam("MayChooseTarget")) { copy.setMayChooseNewTargets(true); } + if (sa.hasParam("RandomTarget")){ + List candidates = copy.getTargetRestrictions().getAllCandidates(chosenSA, true); + if (sa.hasParam("RandomTargetRestriction")) { + candidates.removeIf(c -> !c.isValid(sa.getParam("RandomTargetRestriction").split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa)); + } + GameEntity choice = Aggregates.random(candidates); + resetFirstTargetOnCopy(copy, choice, chosenSA); + } // extra case for Epic to remove the keyword and the last part of the SpellAbility if (sa.hasParam("Epic")) { From c3f88773d2019fa4bb06af269fca9fba02b36463 Mon Sep 17 00:00:00 2001 From: Northmoc Date: Wed, 26 May 2021 23:36:29 -0400 Subject: [PATCH 3/3] support for RandomTargetRestriction on ChangeTargetsEffect --- .../java/forge/game/ability/effects/ChangeTargetsEffect.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeTargetsEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeTargetsEffect.java index 84aeb0ae8c1..4b37c69f0b3 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeTargetsEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeTargetsEffect.java @@ -99,6 +99,9 @@ public class ChangeTargetsEffect extends SpellAbilityEffect { int div = changingTgtSA.getTotalDividedValue(); changingTgtSA.resetTargets(); List candidates = changingTgtSA.getTargetRestrictions().getAllCandidates(changingTgtSA, true); + if (sa.hasParam("RandomTargetRestriction")) { + candidates.removeIf(c -> !c.isValid(sa.getParam("RandomTargetRestriction").split(","), sa.getActivatingPlayer(), sa.getHostCard(), sa)); + } GameEntity choice = Aggregates.random(candidates); changingTgtSA.getTargets().add(choice); if (changingTgtSA.isDividedAsYouChoose()) {