diff --git a/Mage.Sets/src/mage/cards/t/TemptingContract.java b/Mage.Sets/src/mage/cards/t/TemptingContract.java new file mode 100644 index 0000000000..1cbce2362d --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TemptingContract.java @@ -0,0 +1,81 @@ +package mage.cards.t; + +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.game.Game; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TemptingContract extends CardImpl { + + public TemptingContract(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); + + // At the beginning of your upkeep, each opponent may create a Treasure token. For each opponent who does, you create a Treasure token. + this.addAbility(new BeginningOfUpkeepTriggeredAbility( + new TemptingContractEffect(), TargetController.YOU, false + )); + } + + private TemptingContract(final TemptingContract card) { + super(card); + } + + @Override + public TemptingContract copy() { + return new TemptingContract(this); + } +} + +class TemptingContractEffect extends OneShotEffect { + + TemptingContractEffect() { + super(Outcome.Benefit); + staticText = "each opponent may create a Treasure token. " + + "For each opponent who does, you create a Treasure token"; + } + + private TemptingContractEffect(final TemptingContractEffect effect) { + super(effect); + } + + @Override + public TemptingContractEffect copy() { + return new TemptingContractEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller == null) { + return false; + } + int counter = 0; + for (UUID playerId : game.getOpponents(source.getControllerId())) { + Player opponent = game.getPlayer(playerId); + if (opponent != null && opponent.chooseUse( + outcome, "Create a Treasure token?", + "If you do, " + controller.getName() + " will create one as well", + "Yes", "No", source, game + ) && new TreasureToken().putOntoBattlefield(1, game, source, opponent.getId())) { + counter++; + } + } + if (counter > 0) { + new TreasureToken().putOntoBattlefield(counter, game, source, source.getControllerId()); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2021Edition.java b/Mage.Sets/src/mage/sets/Commander2021Edition.java index da33fdbfd7..5696df64b2 100644 --- a/Mage.Sets/src/mage/sets/Commander2021Edition.java +++ b/Mage.Sets/src/mage/sets/Commander2021Edition.java @@ -291,6 +291,7 @@ public final class Commander2021Edition extends ExpansionSet { cards.add(new SetCardInfo("Temple of Silence", 325, Rarity.RARE, mage.cards.t.TempleOfSilence.class)); cards.add(new SetCardInfo("Temple of Triumph", 327, Rarity.RARE, mage.cards.t.TempleOfTriumph.class)); cards.add(new SetCardInfo("Temple of the False God", 326, Rarity.UNCOMMON, mage.cards.t.TempleOfTheFalseGod.class)); + cards.add(new SetCardInfo("Tempting Contract", 78, Rarity.RARE, mage.cards.t.TemptingContract.class)); cards.add(new SetCardInfo("Terastodon", 207, Rarity.RARE, mage.cards.t.Terastodon.class)); cards.add(new SetCardInfo("Teysa, Envoy of Ghosts", 230, Rarity.RARE, mage.cards.t.TeysaEnvoyOfGhosts.class)); cards.add(new SetCardInfo("Thopter Engineer", 181, Rarity.UNCOMMON, mage.cards.t.ThopterEngineer.class));