[MOM] Implement Sandstalker Moloch

This commit is contained in:
theelk801 2023-04-15 10:20:40 -04:00
parent 240000ce72
commit d8de407f4c
2 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package mage.cards.s;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.LookLibraryAndPickControllerEffect;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.PutCards;
import mage.constants.SubType;
import mage.constants.WatcherScope;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SandstalkerMoloch extends CardImpl {
public SandstalkerMoloch(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
this.subtype.add(SubType.LIZARD);
this.power = new MageInt(4);
this.toughness = new MageInt(2);
// Flash
this.addAbility(FlashAbility.getInstance());
// When Sandstalker Moloch enters the battlefield, if an opponent cast a blue and/or black spell this turn, look at the top four cards of your library. You may reveal a permanent card from among them and put it into your hand. Put the rest on the bottom of your library in a random order.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new EntersBattlefieldTriggeredAbility(
new LookLibraryAndPickControllerEffect(
4, 1, StaticFilters.FILTER_CARD_A_PERMANENT,
PutCards.HAND, PutCards.BOTTOM_RANDOM
)
), SandstalkerMolochWatcher::checkPlayer, "When {this} enters the battlefield, " +
"if an opponent cast a blue and/or black spell this turn, look at the top four cards " +
"of your library. You may reveal a permanent card from among them and put it into your hand. " +
"Put the rest on the bottom of your library in a random order."
));
}
private SandstalkerMoloch(final SandstalkerMoloch card) {
super(card);
}
@Override
public SandstalkerMoloch copy() {
return new SandstalkerMoloch(this);
}
}
class SandstalkerMolochWatcher extends Watcher {
private final Set<UUID> players = new HashSet<>();
private static final ObjectColor color = new ObjectColor("UB");
SandstalkerMolochWatcher() {
super(WatcherScope.GAME);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() != GameEvent.EventType.SPELL_CAST) {
return;
}
Spell spell = game.getSpell(event.getTargetId());
if (spell != null && spell.getColor(game).shares(color)) {
players.addAll(game.getOpponents(spell.getControllerId()));
}
}
@Override
public void reset() {
super.reset();
}
static boolean checkPlayer(Game game, Ability source) {
return game
.getState()
.getWatcher(SandstalkerMolochWatcher.class)
.players
.contains(source.getControllerId());
}
}

View file

@ -255,6 +255,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Rugged Highlands", 271, Rarity.COMMON, mage.cards.r.RuggedHighlands.class));
cards.add(new SetCardInfo("Ruins Recluse", 336, Rarity.UNCOMMON, mage.cards.r.RuinsRecluse.class));
cards.add(new SetCardInfo("Saiba Cryptomancer", 76, Rarity.COMMON, mage.cards.s.SaibaCryptomancer.class));
cards.add(new SetCardInfo("Sandstalker Moloch", 203, Rarity.UNCOMMON, mage.cards.s.SandstalkerMoloch.class));
cards.add(new SetCardInfo("Scorn-Blade Berserker", 124, Rarity.UNCOMMON, mage.cards.s.ScornBladeBerserker.class));
cards.add(new SetCardInfo("Scoured Barrens", 272, Rarity.COMMON, mage.cards.s.ScouredBarrens.class));
cards.add(new SetCardInfo("Scrappy Bruiser", 162, Rarity.UNCOMMON, mage.cards.s.ScrappyBruiser.class));