diff --git a/Mage.Sets/src/mage/cards/t/TombOfHorrorsAdventurer.java b/Mage.Sets/src/mage/cards/t/TombOfHorrorsAdventurer.java new file mode 100644 index 00000000000..959611a981e --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TombOfHorrorsAdventurer.java @@ -0,0 +1,81 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.CastSecondSpellTriggeredAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.common.CompletedDungeonCondition; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.TakeTheInitiativeEffect; +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.stack.Spell; +import mage.watchers.common.CompletedDungeonWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TombOfHorrorsAdventurer extends CardImpl { + + public TombOfHorrorsAdventurer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{U}"); + + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.MONK); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // When Tomb of Horrors Adventurer enters the battlefield, you take the initiative. + this.addAbility(new EntersBattlefieldTriggeredAbility(new TakeTheInitiativeEffect())); + + // Whenever you cast your second spell each turn, copy it. If you've completed a dungeon, copy that spell twice instead. You may choose new targets for the copies. + this.addAbility(new CastSecondSpellTriggeredAbility(new TombOfHorrorsAdventurerEffect()) + .addHint(CompletedDungeonCondition.getHint()), new CompletedDungeonWatcher()); + } + + private TombOfHorrorsAdventurer(final TombOfHorrorsAdventurer card) { + super(card); + } + + @Override + public TombOfHorrorsAdventurer copy() { + return new TombOfHorrorsAdventurer(this); + } +} + +class TombOfHorrorsAdventurerEffect extends OneShotEffect { + + TombOfHorrorsAdventurerEffect() { + super(Outcome.Benefit); + staticText = "copy it. If you've completed a dungeon, copy that spell twice instead. " + + "You may choose new targets for the copies"; + } + + private TombOfHorrorsAdventurerEffect(final TombOfHorrorsAdventurerEffect effect) { + super(effect); + } + + @Override + public TombOfHorrorsAdventurerEffect copy() { + return new TombOfHorrorsAdventurerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Spell spell = (Spell) getValue("spellCast"); + if (spell == null) { + return false; + } + spell.createCopyOnStack( + game, source, source.getControllerId(), true, + CompletedDungeonWatcher.checkPlayer(source.getControllerId(), game) ? 2 : 1 + ); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 6c28a29ea4d..3c7d314964a 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -164,6 +164,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("The Council of Four", 271, Rarity.RARE, mage.cards.t.TheCouncilOfFour.class)); cards.add(new SetCardInfo("Thrakkus the Butcher", 295, Rarity.UNCOMMON, mage.cards.t.ThrakkusTheButcher.class)); cards.add(new SetCardInfo("Thunderwave", 201, Rarity.UNCOMMON, mage.cards.t.Thunderwave.class)); + cards.add(new SetCardInfo("Tomb of Horrors Adventurer", 100, Rarity.RARE, mage.cards.t.TombOfHorrorsAdventurer.class)); cards.add(new SetCardInfo("Treasure Keeper", 341, Rarity.UNCOMMON, mage.cards.t.TreasureKeeper.class)); cards.add(new SetCardInfo("Two-Handed Axe", 203, Rarity.UNCOMMON, mage.cards.t.TwoHandedAxe.class)); cards.add(new SetCardInfo("Tymora's Invoker", 101, Rarity.COMMON, mage.cards.t.TymorasInvoker.class)); diff --git a/Mage/src/main/java/mage/abilities/common/CastSecondSpellTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/CastSecondSpellTriggeredAbility.java index 5c387fdfc0c..6dd478a6ab1 100644 --- a/Mage/src/main/java/mage/abilities/common/CastSecondSpellTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/CastSecondSpellTriggeredAbility.java @@ -70,7 +70,11 @@ public class CastSecondSpellTriggeredAbility extends TriggeredAbilityImpl { throw new IllegalArgumentException("TargetController " + targetController + " not supported"); } CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); - return watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2; + if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) == 2) { + this.getEffects().setValue("spellCast", game.getSpell(event.getTargetId())); + return true; + } + return false; } @Override