[MH2] Implemented Breathless Knight (#7876)

This commit is contained in:
Daniel Bomar 2021-06-02 17:01:55 -05:00 committed by GitHub
parent 58a297ec5c
commit 8879a5fdf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.watchers.common.CastFromGraveyardWatcher;
/**
*
* @author weirddan455
*/
public final class BreathlessKnight extends CardImpl {
public BreathlessKnight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{B}");
this.subtype.add(SubType.SPIRIT);
this.subtype.add(SubType.KNIGHT);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// Whenever Breathless Knight or another creature enters the battlefield under your control, if that creature entered from a graveyard or you cast it from a graveyard, put a +1/+1 counter on Breathless Knight.
this.addAbility(new BreathlessKnightTriggeredAbility(), new CastFromGraveyardWatcher());
}
private BreathlessKnight(final BreathlessKnight card) {
super(card);
}
@Override
public BreathlessKnight copy() {
return new BreathlessKnight(this);
}
}
class BreathlessKnightTriggeredAbility extends TriggeredAbilityImpl {
public BreathlessKnightTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()));
}
private BreathlessKnightTriggeredAbility(final BreathlessKnightTriggeredAbility ability) {
super(ability);
}
@Override
public BreathlessKnightTriggeredAbility copy() {
return new BreathlessKnightTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof EntersTheBattlefieldEvent) {
EntersTheBattlefieldEvent entersEvent = (EntersTheBattlefieldEvent) event;
Permanent permanent = entersEvent.getTarget();
if (permanent != null && permanent.isCreature() && permanent.isControlledBy(this.getControllerId())) {
if (entersEvent.getFromZone() == Zone.GRAVEYARD) {
return true;
}
CastFromGraveyardWatcher watcher = game.getState().getWatcher(CastFromGraveyardWatcher.class);
int zcc = game.getState().getZoneChangeCounter(entersEvent.getSourceId());
return watcher != null && watcher.spellWasCastFromGraveyard(entersEvent.getSourceId(), zcc - 1);
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} or another creature enters the battlefield under your control, if that creature entered from a graveyard or you cast it from a graveyard, " + super.getRule();
}
}

View file

@ -55,6 +55,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Brainstone", 223, Rarity.UNCOMMON, mage.cards.b.Brainstone.class));
cards.add(new SetCardInfo("Break Ties", 8, Rarity.COMMON, mage.cards.b.BreakTies.class));
cards.add(new SetCardInfo("Break the Ice", 77, Rarity.UNCOMMON, mage.cards.b.BreakTheIce.class));
cards.add(new SetCardInfo("Breathless Knight", 187, Rarity.COMMON, mage.cards.b.BreathlessKnight.class));
cards.add(new SetCardInfo("Breya's Apprentice", 117, Rarity.RARE, mage.cards.b.BreyasApprentice.class));
cards.add(new SetCardInfo("Cabal Coffers", 301, Rarity.MYTHIC, mage.cards.c.CabalCoffers.class));
cards.add(new SetCardInfo("Calibrated Blast", 118, Rarity.RARE, mage.cards.c.CalibratedBlast.class));