From a442a59606121bf5b94d9096c01072343009839a Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Sun, 14 Apr 2019 01:45:21 +0100 Subject: [PATCH 1/5] Implement Gift of the Woods --- .../src/mage/cards/g/GiftOfTheWoods.java | 54 +++++++++++++++++++ Mage.Sets/src/mage/sets/Alliances.java | 2 + 2 files changed, 56 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GiftOfTheWoods.java diff --git a/Mage.Sets/src/mage/cards/g/GiftOfTheWoods.java b/Mage.Sets/src/mage/cards/g/GiftOfTheWoods.java new file mode 100644 index 00000000000..185f1a9eb7b --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GiftOfTheWoods.java @@ -0,0 +1,54 @@ + +package mage.cards.g; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Ketsuban + */ +public final class GiftOfTheWoods extends CardImpl { + + public GiftOfTheWoods(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[] { CardType.ENCHANTMENT }, "{G}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit)); + this.getSpellAbility().addTarget(auraTarget); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Whenever enchanted creature blocks or becomes blocked, it gets +0/+3 until + // end of turn and you gain 1 life. + Ability ability2 = new BlocksOrBecomesBlockedTriggeredAbility( + new BoostEnchantedEffect(0, 3, Duration.EndOfTurn), false); + ability2.addEffect(new GainLifeEffect(1).concatBy("and")); + this.addAbility(ability2); + } + + public GiftOfTheWoods(final GiftOfTheWoods card) { + super(card); + } + + @Override + public GiftOfTheWoods copy() { + return new GiftOfTheWoods(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Alliances.java b/Mage.Sets/src/mage/sets/Alliances.java index c8be8d1dfc0..8d5089f9083 100644 --- a/Mage.Sets/src/mage/sets/Alliances.java +++ b/Mage.Sets/src/mage/sets/Alliances.java @@ -83,6 +83,8 @@ public final class Alliances extends ExpansionSet { cards.add(new SetCardInfo("Fyndhorn Druid", "90a", Rarity.COMMON, mage.cards.f.FyndhornDruid.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Fyndhorn Druid", "90b", Rarity.COMMON, mage.cards.f.FyndhornDruid.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gargantuan Gorilla", 91, Rarity.RARE, mage.cards.g.GargantuanGorilla.class)); + cards.add(new SetCardInfo("Gift of the Woods", "92a", Rarity.COMMON, mage.cards.g.GiftOfTheWoods.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Gift of the Woods", "92b", Rarity.COMMON, mage.cards.g.GiftOfTheWoods.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gorilla Berserkers", "93a", Rarity.COMMON, mage.cards.g.GorillaBerserkers.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gorilla Berserkers", "93b", Rarity.COMMON, mage.cards.g.GorillaBerserkers.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gorilla Chieftain", "94a", Rarity.COMMON, mage.cards.g.GorillaChieftain.class, NON_FULL_USE_VARIOUS)); From 57cea736b906f6f78e18685adbf1dce1301ecf8e Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Sun, 14 Apr 2019 01:46:25 +0100 Subject: [PATCH 2/5] Implement Kjeldoran Pride --- .../src/mage/cards/k/KjeldoranPride.java | 64 +++++++++++++++++++ Mage.Sets/src/mage/sets/Alliances.java | 2 + 2 files changed, 66 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KjeldoranPride.java diff --git a/Mage.Sets/src/mage/cards/k/KjeldoranPride.java b/Mage.Sets/src/mage/cards/k/KjeldoranPride.java new file mode 100644 index 00000000000..d946ed77e64 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KjeldoranPride.java @@ -0,0 +1,64 @@ + +package mage.cards.k; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.AnotherEnchantedPredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author Ketsuban + */ +public final class KjeldoranPride extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature other than enchanted creature"); + + static { + filter.add(new AnotherEnchantedPredicate()); + } + + public KjeldoranPride(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[] { CardType.ENCHANTMENT }, "{1}{W}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit)); + Ability enchantAbility = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(enchantAbility); + + // Enchanted creature gets +1/+2. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(1, 2))); + + // 2U: Attach Kjeldoran Pride to target creature other than enchanted creature. + Ability ability = new SimpleActivatedAbility(new AttachEffect(Outcome.Benefit), new ManaCostsImpl<>("{2}{U}")); + ability.addTarget(new TargetCreaturePermanent(filter)); + this.addAbility(ability); + } + + public KjeldoranPride(final KjeldoranPride card) { + super(card); + } + + @Override + public KjeldoranPride copy() { + return new KjeldoranPride(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Alliances.java b/Mage.Sets/src/mage/sets/Alliances.java index 8d5089f9083..643b2b16ce1 100644 --- a/Mage.Sets/src/mage/sets/Alliances.java +++ b/Mage.Sets/src/mage/sets/Alliances.java @@ -108,6 +108,8 @@ public final class Alliances extends ExpansionSet { cards.add(new SetCardInfo("Keeper of Tresserhorn", 52, Rarity.RARE, mage.cards.k.KeeperOfTresserhorn.class)); cards.add(new SetCardInfo("Kjeldoran Escort", "7a", Rarity.COMMON, mage.cards.k.KjeldoranEscort.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Kjeldoran Escort", "7b", Rarity.COMMON, mage.cards.k.KjeldoranEscort.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Kjeldoran Pride", "9a", Rarity.COMMON, mage.cards.k.KjeldoranPride.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Kjeldoran Pride", "9b", Rarity.COMMON, mage.cards.k.KjeldoranPride.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Kjeldoran Home Guard", 8, Rarity.UNCOMMON, mage.cards.k.KjeldoranHomeGuard.class)); cards.add(new SetCardInfo("Kjeldoran Outpost", 139, Rarity.RARE, mage.cards.k.KjeldoranOutpost.class)); cards.add(new SetCardInfo("Krovikan Horror", 53, Rarity.RARE, mage.cards.k.KrovikanHorror.class)); From fad76ba4e0e5ccb176228003ce5e867c6ecc84ae Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Sun, 14 Apr 2019 01:47:40 +0100 Subject: [PATCH 3/5] Implement Rogue Skycaptain --- .../src/mage/cards/r/RogueSkycaptain.java | 99 +++++++++++++++++++ Mage.Sets/src/mage/sets/Alliances.java | 1 + Mage.Sets/src/mage/sets/MastersEditionII.java | 3 +- .../main/java/mage/counters/CounterType.java | 1 + 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/r/RogueSkycaptain.java diff --git a/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java b/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java new file mode 100644 index 00000000000..773014a7aed --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java @@ -0,0 +1,99 @@ +package mage.cards.r; + +import java.util.UUID; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.RemoveAllCountersSourceEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.TargetController; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.Target; +import mage.target.common.TargetOpponent; + +/** + * + * @author Ketsuban + */ +public class RogueSkycaptain extends CardImpl { + + public RogueSkycaptain(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{2}{R}"); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ROGUE); + this.subtype.add(SubType.MERCENARY); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // At the beginning of your upkeep, put a wage counter on Rogue Skycaptain. You + // may pay 2 for each wage counter on it. If you don't, remove all wage counters + // from Rogue Skycaptain and an opponent gains control of it. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RogueSkycaptainEffect(), TargetController.YOU, false)); + } + + @Override + public Card copy() { + return null; + } + +} + +class RogueSkycaptainEffect extends OneShotEffect { + + public RogueSkycaptainEffect() { + super(Outcome.GainControl); + staticText = "put a wage counter on {this}. You may pay {2} for each wage counter on it. If you don't, remove all wage counters from {this} and an opponent gains control of it"; + } + + public RogueSkycaptainEffect(final RogueSkycaptainEffect effect) { + super(effect); + } + + @Override + public Effect copy() { + return new RogueSkycaptainEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); + if (permanent == null) { + permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); + } + if (controller != null && permanent != null) { + new AddCountersSourceEffect(CounterType.WAGE.createInstance(), true).apply(game, source); + Cost cost = new GenericManaCost(2 * permanent.getCounters(game).getCount(CounterType.WAGE)); + if (!cost.pay(source, game, controller.getId(), controller.getId(), false)) { + new RemoveAllCountersSourceEffect(CounterType.WAGE).apply(game, source); + Target target = new TargetOpponent(true); + target.choose(Outcome.GainControl, source.getControllerId(), source.getSourceId(), game); + Player opponent = game.getPlayer(target.getFirstTarget()); + if (opponent != null) { + permanent.changeControllerId(controller.getId(), game); + } + } + return true; + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Alliances.java b/Mage.Sets/src/mage/sets/Alliances.java index 643b2b16ce1..619806c24d0 100644 --- a/Mage.Sets/src/mage/sets/Alliances.java +++ b/Mage.Sets/src/mage/sets/Alliances.java @@ -153,6 +153,7 @@ public final class Alliances extends ExpansionSet { cards.add(new SetCardInfo("Reprisal", "13a", Rarity.COMMON, mage.cards.r.Reprisal.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Reprisal", "13b", Rarity.COMMON, mage.cards.r.Reprisal.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ritual of the Machine", 59, Rarity.RARE, mage.cards.r.RitualOfTheMachine.class)); + cards.add(new SetCardInfo("Rogue Skycaptain", 79, Rarity.RARE, mage.cards.r.RogueSkycaptain.class)); cards.add(new SetCardInfo("Royal Decree", 14, Rarity.RARE, mage.cards.r.RoyalDecree.class)); cards.add(new SetCardInfo("Royal Herbalist", "15a", Rarity.COMMON, mage.cards.r.RoyalHerbalist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Royal Herbalist", "15b", Rarity.COMMON, mage.cards.r.RoyalHerbalist.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage.Sets/src/mage/sets/MastersEditionII.java b/Mage.Sets/src/mage/sets/MastersEditionII.java index 8cc2b5f1333..573f0482dff 100644 --- a/Mage.Sets/src/mage/sets/MastersEditionII.java +++ b/Mage.Sets/src/mage/sets/MastersEditionII.java @@ -152,7 +152,7 @@ public final class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Leaping Lizard", 171, Rarity.COMMON, mage.cards.l.LeapingLizard.class)); cards.add(new SetCardInfo("Lim-Dul's High Guard", 103, Rarity.UNCOMMON, mage.cards.l.LimDulsHighGuard.class)); cards.add(new SetCardInfo("Lodestone Bauble", 213, Rarity.RARE, mage.cards.l.LodestoneBauble.class)); - cards.add(new SetCardInfo("Lost Order of Jarkeld", 24, Rarity.RARE, mage.cards.l.LostOrderOfJarkeld.class)); + cards.add(new SetCardInfo("Lost Order of Jarkeld", 24, Rarity.RARE, mage.cards.l.LostOrderOfJarkeld.class)); cards.add(new SetCardInfo("Magus of the Unseen", 53, Rarity.RARE, mage.cards.m.MagusOfTheUnseen.class)); cards.add(new SetCardInfo("Mana Crypt", 214, Rarity.RARE, mage.cards.m.ManaCrypt.class)); cards.add(new SetCardInfo("Marjhan", 54, Rarity.RARE, mage.cards.m.Marjhan.class)); @@ -195,6 +195,7 @@ public final class MastersEditionII extends ExpansionSet { cards.add(new SetCardInfo("Ritual of Subdual", 174, Rarity.RARE, mage.cards.r.RitualOfSubdual.class)); cards.add(new SetCardInfo("Ritual of the Machine", 109, Rarity.RARE, mage.cards.r.RitualOfTheMachine.class)); cards.add(new SetCardInfo("Roterothopter", 218, Rarity.COMMON, mage.cards.r.Roterothopter.class)); + cards.add(new SetCardInfo("Rogue Skycaptain", 149, Rarity.RARE, mage.cards.r.RogueSkycaptain.class)); cards.add(new SetCardInfo("Royal Decree", 31, Rarity.RARE, mage.cards.r.RoyalDecree.class)); cards.add(new SetCardInfo("Royal Trooper", 32, Rarity.COMMON, mage.cards.r.RoyalTrooper.class)); cards.add(new SetCardInfo("Ruins of Trokair", 234, Rarity.UNCOMMON, mage.cards.r.RuinsOfTrokair.class)); diff --git a/Mage/src/main/java/mage/counters/CounterType.java b/Mage/src/main/java/mage/counters/CounterType.java index 57274198a0b..89ce5320cc0 100644 --- a/Mage/src/main/java/mage/counters/CounterType.java +++ b/Mage/src/main/java/mage/counters/CounterType.java @@ -135,6 +135,7 @@ public enum CounterType { VERSE("verse"), VITALITY("vitality"), VORTEX("vortex"), + WAGE("wage"), WINCH("winch"), WIND("wind"), WISH("wish"); From 8db00d34dea2e630dffd069ad20491b5acc70f58 Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Sun, 14 Apr 2019 01:47:56 +0100 Subject: [PATCH 4/5] Implement Soldevi Sentry --- Mage.Sets/src/mage/cards/s/SoldeviSentry.java | 68 +++++++++++++++++++ Mage.Sets/src/mage/sets/Alliances.java | 2 + 2 files changed, 70 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SoldeviSentry.java diff --git a/Mage.Sets/src/mage/cards/s/SoldeviSentry.java b/Mage.Sets/src/mage/cards/s/SoldeviSentry.java new file mode 100644 index 00000000000..14d2fdb476e --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SoldeviSentry.java @@ -0,0 +1,68 @@ + +package mage.cards.s; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.RegenerateSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetOpponent; + +/** + * + * @author Ketsuban + */ +public final class SoldeviSentry extends CardImpl { + + public SoldeviSentry(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[] { CardType.ARTIFACT, CardType.CREATURE }, "{1}"); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // 1: Choose target opponent. Regenerate Soldevi Sentry. When it regenerates + // this way, that player may draw a card. + Ability ability = new SimpleActivatedAbility(new SoldeviSentryEffect(), new GenericManaCost(1)); + ability.addTarget(new TargetOpponent()); + this.addAbility(ability); + } + + public SoldeviSentry(final SoldeviSentry card) { + super(card); + } + + @Override + public SoldeviSentry copy() { + return new SoldeviSentry(this); + } +} + +class SoldeviSentryEffect extends RegenerateSourceEffect { + + @Override + public boolean apply(Game game, Ability source) { + //20110204 - 701.11 + Player opponent = game.getPlayer(source.getFirstTarget()); + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null && permanent.regenerate(this.getId(), game)) { + if (opponent != null) { + if (opponent.chooseUse(Outcome.DrawCard, "Draw a card?", source, game)) { + opponent.drawCards(1, game); + } + } + this.used = true; + return true; + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/Alliances.java b/Mage.Sets/src/mage/sets/Alliances.java index 619806c24d0..a93161e7257 100644 --- a/Mage.Sets/src/mage/sets/Alliances.java +++ b/Mage.Sets/src/mage/sets/Alliances.java @@ -171,6 +171,8 @@ public final class Alliances extends ExpansionSet { cards.add(new SetCardInfo("Soldevi Heretic", "33b", Rarity.COMMON, mage.cards.s.SoldeviHeretic.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Soldevi Sage", "34a", Rarity.COMMON, mage.cards.s.SoldeviSage.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Soldevi Sage", "34b", Rarity.COMMON, mage.cards.s.SoldeviSage.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Soldevi Sentry", "132a", Rarity.COMMON, mage.cards.s.SoldeviSentry.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Soldevi Sentry", "132b", Rarity.COMMON, mage.cards.s.SoldeviSentry.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Soldevi Steam Beast", "133a", Rarity.COMMON, mage.cards.s.SoldeviSteamBeast.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Soldevi Steam Beast", "133b", Rarity.COMMON, mage.cards.s.SoldeviSteamBeast.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Soldier of Fortune", 80, Rarity.UNCOMMON, mage.cards.s.SoldierOfFortune.class)); From 67b48dbea76746dea30b1120676d94058db3cddc Mon Sep 17 00:00:00 2001 From: Thomas Winwood Date: Fri, 19 Apr 2019 12:41:25 +0100 Subject: [PATCH 5/5] Address issues identified in code review --- .../src/mage/cards/r/RogueSkycaptain.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java b/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java index 773014a7aed..029c8fff97c 100644 --- a/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java +++ b/Mage.Sets/src/mage/cards/r/RogueSkycaptain.java @@ -1,5 +1,6 @@ package mage.cards.r; +import java.util.Set; import java.util.UUID; import mage.MageInt; @@ -19,7 +20,6 @@ import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.TargetController; -import mage.constants.Zone; import mage.counters.CounterType; import mage.game.Game; import mage.game.permanent.Permanent; @@ -76,20 +76,24 @@ class RogueSkycaptainEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Permanent permanent = game.getBattlefield().getPermanent(source.getSourceId()); - if (permanent == null) { - permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); - } + Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && permanent != null) { new AddCountersSourceEffect(CounterType.WAGE.createInstance(), true).apply(game, source); Cost cost = new GenericManaCost(2 * permanent.getCounters(game).getCount(CounterType.WAGE)); if (!cost.pay(source, game, controller.getId(), controller.getId(), false)) { new RemoveAllCountersSourceEffect(CounterType.WAGE).apply(game, source); - Target target = new TargetOpponent(true); - target.choose(Outcome.GainControl, source.getControllerId(), source.getSourceId(), game); - Player opponent = game.getPlayer(target.getFirstTarget()); + Player opponent; + Set opponents = game.getOpponents(controller.getId()); + if (opponents.size() == 1) { + opponent = game.getPlayer(opponents.iterator().next()); + } else { + Target target = new TargetOpponent(true); + target.setNotTarget(true); + target.choose(Outcome.GainControl, source.getControllerId(), source.getSourceId(), game); + opponent = game.getPlayer(target.getFirstTarget()); + } if (opponent != null) { - permanent.changeControllerId(controller.getId(), game); + permanent.changeControllerId(opponent.getId(), game); } } return true;