[MKM] Implement Crowd-Control Warden (#11975)

This commit is contained in:
Cameron Merkel 2024-03-22 23:47:37 -05:00 committed by GitHub
parent 714d899c39
commit 1cf84a7066
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,116 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.constants.*;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.keyword.DisguiseAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
* @author Cguy7777
*/
public final class CrowdControlWarden extends CardImpl {
private static final Hint hint = new ValueHint(
"Other creatures you control",
new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE));
public CrowdControlWarden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{W}");
this.subtype.add(SubType.CENTAUR);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// As Crowd-Control Warden enters the battlefield or is turned face up, put X +1/+1 counters on it, where X is the number of other creatures you control.
Ability ability = new SimpleStaticAbility(Zone.ALL, new CrowdControlWardenReplacementEffect());
ability.setWorksFaceDown(true);
ability.addHint(hint);
this.addAbility(ability);
// Disguise {3}{G/W}{G/W}
this.addAbility(new DisguiseAbility(this, new ManaCostsImpl<>("{3}{G/W}{G/W}")));
}
private CrowdControlWarden(final CrowdControlWarden card) {
super(card);
}
@Override
public CrowdControlWarden copy() {
return new CrowdControlWarden(this);
}
}
class CrowdControlWardenReplacementEffect extends ReplacementEffectImpl {
private static final DynamicValue xValue
= new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE);
CrowdControlWardenReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "as {this} enters the battlefield or is turned face up, " +
"put X +1/+1 counters on it, where X is the number of other creatures you control";
}
private CrowdControlWardenReplacementEffect(final CrowdControlWardenReplacementEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
switch (event.getType()) {
case ENTERS_THE_BATTLEFIELD:
case TURN_FACE_UP:
return true;
default:
return false;
}
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
if (event.getTargetId().equals(source.getSourceId())) {
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
return true;
}
}
}
if (event.getType() == GameEvent.EventType.TURN_FACE_UP) {
return event.getTargetId().equals(source.getSourceId());
}
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), xValue, false)
.apply(game, source);
return false;
}
@Override
public CrowdControlWardenReplacementEffect copy() {
return new CrowdControlWardenReplacementEffect(this);
}
}

View file

@ -78,6 +78,7 @@ public final class MurdersAtKarlovManor extends ExpansionSet {
cards.add(new SetCardInfo("Cornered Crook", 120, Rarity.UNCOMMON, mage.cards.c.CorneredCrook.class));
cards.add(new SetCardInfo("Crime Novelist", 121, Rarity.UNCOMMON, mage.cards.c.CrimeNovelist.class));
cards.add(new SetCardInfo("Crimestopper Sprite", 49, Rarity.COMMON, mage.cards.c.CrimestopperSprite.class));
cards.add(new SetCardInfo("Crowd-Control Warden", 193, Rarity.COMMON, mage.cards.c.CrowdControlWarden.class));
cards.add(new SetCardInfo("Cryptex", 251, Rarity.RARE, mage.cards.c.Cryptex.class));
cards.add(new SetCardInfo("Culvert Ambusher", 158, Rarity.UNCOMMON, mage.cards.c.CulvertAmbusher.class));
cards.add(new SetCardInfo("Curious Cadaver", 194, Rarity.UNCOMMON, mage.cards.c.CuriousCadaver.class));