[CLB] Implemented Tomb of Horrors Adventurer

This commit is contained in:
Evan Kranzler 2022-05-25 21:19:14 -04:00
parent 6f94151930
commit e6e74c2000
3 changed files with 87 additions and 1 deletions

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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