[CMR] Implemented Laboratory Drudge

This commit is contained in:
Evan Kranzler 2020-10-31 20:48:59 -04:00
parent ac1ba7dcb0
commit da5d9b46e8
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,91 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.Watcher;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LaboratoryDrudge extends CardImpl {
public LaboratoryDrudge(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.HORROR);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// At the beginning of each end step, draw a card if you've cast a spell from a graveyard or activated an ability of a card in a graveyard this turn.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new ConditionalOneShotEffect(
new DrawCardSourceControllerEffect(1), LaboratoryDrudgeCondition.instance,
"draw a card if you've cast a spell from a graveyard or activated an ability of a card in a graveyard this turn"
), TargetController.ANY, false
), new LaboratoryDrudgeWatcher());
}
private LaboratoryDrudge(final LaboratoryDrudge card) {
super(card);
}
@Override
public LaboratoryDrudge copy() {
return new LaboratoryDrudge(this);
}
}
enum LaboratoryDrudgeCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
LaboratoryDrudgeWatcher watcher = game.getState().getWatcher(LaboratoryDrudgeWatcher.class);
return watcher != null && watcher.checkPlayer(source.getControllerId());
}
}
class LaboratoryDrudgeWatcher extends Watcher {
private final Set<UUID> playerSet = new HashSet<>();
LaboratoryDrudgeWatcher() {
super(WatcherScope.GAME);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getZone() != Zone.GRAVEYARD) {
return;
}
switch (event.getType()) {
case SPELL_CAST:
case ACTIVATED_ABILITY:
playerSet.add(event.getPlayerId());
}
}
@Override
public void reset() {
playerSet.clear();
super.reset();
}
boolean checkPlayer(UUID playerId) {
return playerSet.contains(playerId);
}
}

View file

@ -106,6 +106,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Kor Cartographer", 30, Rarity.COMMON, mage.cards.k.KorCartographer.class));
cards.add(new SetCardInfo("Krark, the Thumbless", 189, Rarity.RARE, mage.cards.k.KrarkTheThumbless.class));
cards.add(new SetCardInfo("Kydele, Chosen of Kruphix", 524, Rarity.MYTHIC, mage.cards.k.KydeleChosenOfKruphix.class));
cards.add(new SetCardInfo("Laboratory Drudge", 78, Rarity.RARE, mage.cards.l.LaboratoryDrudge.class));
cards.add(new SetCardInfo("Livio, Oathsworn Sentinel", 31, Rarity.RARE, mage.cards.l.LivioOathswornSentinel.class));
cards.add(new SetCardInfo("Ludevic, Necro-Alchemist", 525, Rarity.MYTHIC, mage.cards.l.LudevicNecroAlchemist.class));
cards.add(new SetCardInfo("Maelstrom Colossus", 322, Rarity.COMMON, mage.cards.m.MaelstromColossus.class));