[ONE] Implement Malcator, Purity Overseer

This commit is contained in:
theelk801 2023-01-21 11:28:56 -05:00
parent 44d57e4874
commit 445f67f513
2 changed files with 137 additions and 0 deletions

View file

@ -0,0 +1,136 @@
package mage.cards.m;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.token.PhyrexianGolemToken;
import mage.util.CardUtil;
import mage.watchers.Watcher;
/**
* @author TheElk801
*/
public final class MalcatorPurityOverseer extends CardImpl {
private static final Hint hint = new ValueHint(
"Artifacts that entered under your control this turn", MalcatorPurityOverseerValue.instance
);
public MalcatorPurityOverseer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.ELEPHANT);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// When Malcator, Purity Overseer enters the battlefield, create a 3/3 colorless Phyrexian Golem artifact creature token.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new PhyrexianGolemToken())));
// At the beginning of your end step, if three or more artifacts entered the battlefield under your control this turn, create a 3/3 colorless Phyrexian Golem artifact creature token.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
new CreateTokenEffect(new PhyrexianGolemToken()), TargetController.YOU,
MalcatorPurityOverseerCondition.instance, false
));
}
private MalcatorPurityOverseer(final MalcatorPurityOverseer card) {
super(card);
}
@Override
public MalcatorPurityOverseer copy() {
return new MalcatorPurityOverseer(this);
}
}
enum MalcatorPurityOverseerCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
return MalcatorPurityOverseerWatcher.checkPlayer(source, game);
}
@Override
public String toString() {
return "three or more artifacts entered the battlefield under your control this turn";
}
}
enum MalcatorPurityOverseerValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
return MalcatorPurityOverseerWatcher.getCount(sourceAbility, game);
}
@Override
public MalcatorPurityOverseerValue copy() {
return this;
}
@Override
public String getMessage() {
return "";
}
}
class MalcatorPurityOverseerWatcher extends Watcher {
private final Map<UUID, Integer> map = new HashMap<>();
MalcatorPurityOverseerWatcher() {
super(WatcherScope.GAME);
}
@Override
public void watch(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
&& ((EntersTheBattlefieldEvent) event).getTarget().isArtifact(game)) {
map.compute(event.getPlayerId(), CardUtil::setOrIncrementValue);
}
}
@Override
public void reset() {
super.reset();
map.clear();
}
static boolean checkPlayer(Ability source, Game game) {
return game
.getState()
.getWatcher(MalcatorPurityOverseerWatcher.class)
.map
.getOrDefault(source.getControllerId(), 0) >= 3;
}
static int getCount(Ability source, Game game) {
return game
.getState()
.getWatcher(MalcatorPurityOverseerWatcher.class)
.map
.getOrDefault(source.getControllerId(), 0);
}
}

View file

@ -57,6 +57,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
cards.add(new SetCardInfo("Kaya, Intangible Slayer", 205, Rarity.RARE, mage.cards.k.KayaIntangibleSlayer.class));
cards.add(new SetCardInfo("Kemba, Kha Enduring", 19, Rarity.RARE, mage.cards.k.KembaKhaEnduring.class));
cards.add(new SetCardInfo("Koth, Fire of Resistance", 138, Rarity.RARE, mage.cards.k.KothFireOfResistance.class));
cards.add(new SetCardInfo("Malcator, Purity Overseer", 208, Rarity.RARE, mage.cards.m.MalcatorPurityOverseer.class));
cards.add(new SetCardInfo("Maze Skullbomb", 231, Rarity.COMMON, mage.cards.m.MazeSkullbomb.class));
cards.add(new SetCardInfo("Mercurial Spelldancer", 61, Rarity.RARE, mage.cards.m.MercurialSpelldancer.class));
cards.add(new SetCardInfo("Mesmerizing Dose", 62, Rarity.COMMON, mage.cards.m.MesmerizingDose.class));