[CLB] Implement Deep Gnome Terramancer (#9858)

This commit is contained in:
Rowan Gudmundsson 2023-03-01 02:40:45 -08:00 committed by GitHub
parent 2b77d53f81
commit 049dd48d0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,102 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.events.GameEvent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInLibrary;
import mage.watchers.common.PlayLandWatcher;
import java.util.UUID;
/**
* @author rgudmundsson
*/
public final class DeepGnomeTerramancer extends CardImpl {
public DeepGnomeTerramancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{1}{W}");
this.subtype.add(SubType.GNOME, SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flash
this.addAbility(FlashAbility.getInstance());
// Whenever one or more lands enter the battlefield under an opponent's control
// without being played, you may search your library for a Plains card, put it
// onto the battlefield tapped, then shuffle. Do this only once each turn.
this.addAbility(new DeepGnomeTerramancerTriggeredAbility().setDoOnlyOnce(true), new PlayLandWatcher());
}
private DeepGnomeTerramancer(final DeepGnomeTerramancer card) {
super(card);
}
@Override
public DeepGnomeTerramancer copy() {
return new DeepGnomeTerramancer(this);
}
}
class DeepGnomeTerramancerTriggeredAbility extends TriggeredAbilityImpl {
DeepGnomeTerramancerTriggeredAbility() {
super(Zone.BATTLEFIELD, null);
FilterCard filter = new FilterCard("Plains card");
filter.add(SubType.PLAINS.getPredicate());
TargetCardInLibrary target = new TargetCardInLibrary(filter);
addEffect(new SearchLibraryPutInPlayEffect(target, true, true, Outcome.PutLandInPlay));
}
DeepGnomeTerramancerTriggeredAbility(DeepGnomeTerramancerTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent land = game.getPermanent(event.getTargetId());
PlayLandWatcher watcher = game.getState().getWatcher(PlayLandWatcher.class);
if (land == null || !land.isLand(game)) { // Permanent is not a land
return false;
}
if (land.isControlledBy(this.controllerId)) { // Land enters under ability controllers control
return false;
}
if (watcher.wasLandPlayed(land.getId())) { // Land was played
return false;
}
return true;
}
@Override
public DeepGnomeTerramancerTriggeredAbility copy() {
return new DeepGnomeTerramancerTriggeredAbility(this);
}
@Override
public String getRule() {
return "Whenever one or more lands enter the battlefield under an opponent's control without being played, you may search " +
"your library for a Plains card, put it onto the battlefield tapped, then shuffle. Do this only once each turn.";
}
}

View file

@ -169,6 +169,8 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Deadly Dispute", 124, Rarity.COMMON, mage.cards.d.DeadlyDispute.class));
cards.add(new SetCardInfo("Death Kiss", 675, Rarity.RARE, mage.cards.d.DeathKiss.class));
cards.add(new SetCardInfo("Decanter of Endless Water", 309, Rarity.COMMON, mage.cards.d.DecanterOfEndlessWater.class));
cards.add(new SetCardInfo("Deep Gnome Terramancer", 658, Rarity.RARE, mage.cards.d.DeepGnomeTerramancer.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Deep Gnome Terramancer", 607, Rarity.RARE, mage.cards.d.DeepGnomeTerramancer.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Delayed Blast Fireball", 676, Rarity.RARE, mage.cards.d.DelayedBlastFireball.class));
cards.add(new SetCardInfo("Demon Bolt", 787, Rarity.COMMON, mage.cards.d.DemonBolt.class));
cards.add(new SetCardInfo("Descent into Avernus", 169, Rarity.RARE, mage.cards.d.DescentIntoAvernus.class));