[ZNR] Implemented Drana, the Last Bloodchief

This commit is contained in:
Evan Kranzler 2020-09-10 12:29:12 -04:00
parent 8d9a62f259
commit bdef7a0d2b
2 changed files with 197 additions and 0 deletions

View file

@ -0,0 +1,196 @@
package mage.cards.d;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DranaTheLastBloodchief extends CardImpl {
public DranaTheLastBloodchief(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VAMPIRE);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Drana, the Last Bloodchief attacks, defending player chooses a nonlegendary creature card in your graveyard. You return that card to the battlefield with a +1/+1 counter on it. The creature is a Vampire in addition to its other types.
this.addAbility(new AttacksTriggeredAbility(new DranaTheLastBloodchiefEffect(), false));
}
private DranaTheLastBloodchief(final DranaTheLastBloodchief card) {
super(card);
}
@Override
public DranaTheLastBloodchief copy() {
return new DranaTheLastBloodchief(this);
}
}
class DranaTheLastBloodchiefEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCreatureCard("nonlegendary creature card");
static {
filter.add(Predicates.not(SuperType.LEGENDARY.getPredicate()));
}
DranaTheLastBloodchiefEffect() {
super(Outcome.Benefit);
staticText = "defending player chooses a nonlegendary creature card in your graveyard. " +
"You return that card to the battlefield with a +1/+1 counter on it. " +
"The creature is a Vampire in addition to its other types.";
}
private DranaTheLastBloodchiefEffect(final DranaTheLastBloodchiefEffect effect) {
super(effect);
}
@Override
public DranaTheLastBloodchiefEffect copy() {
return new DranaTheLastBloodchiefEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (controller == null || player == null
|| controller.getGraveyard().count(filter, game) < 1) {
return false;
}
TargetCard target = new TargetCardInGraveyard(filter);
target.setNotTarget(true);
player.choose(outcome, controller.getGraveyard(), target, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
game.addEffect(new DranaTheLastBloodchiefSubtypeEffect(card, game), source);
game.addEffect(new DranaTheLastBloodchiefCounterEffect(card, game), source);
return controller.moveCards(card, Zone.BATTLEFIELD, source, game);
}
}
class DranaTheLastBloodchiefSubtypeEffect extends ContinuousEffectImpl {
private final MageObjectReference mor;
DranaTheLastBloodchiefSubtypeEffect(Card card, Game game) {
super(Duration.Custom, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
this.mor = new MageObjectReference(card.getId(), card.getZoneChangeCounter(game) + 1, game);
}
private DranaTheLastBloodchiefSubtypeEffect(final DranaTheLastBloodchiefSubtypeEffect effect) {
super(effect);
this.mor = effect.mor;
}
@Override
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
Permanent creature;
if (source.getTargets().getFirstTarget() == null) {
creature = game.getPermanent(getTargetPointer().getFirst(game, source));
} else {
creature = game.getPermanent(source.getTargets().getFirstTarget());
if (creature == null) {
creature = game.getPermanentEntering(source.getTargets().getFirstTarget());
}
}
if (creature != null && mor.refersTo(creature, game)) {
if (!creature.hasSubtype(SubType.VAMPIRE, game)) {
creature.getSubtype(game).add(SubType.VAMPIRE);
}
return true;
} else {
this.used = true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public DranaTheLastBloodchiefSubtypeEffect copy() {
return new DranaTheLastBloodchiefSubtypeEffect(this);
}
}
class DranaTheLastBloodchiefCounterEffect extends ReplacementEffectImpl {
private final MageObjectReference mor;
DranaTheLastBloodchiefCounterEffect(Card card, Game game) {
super(Duration.EndOfStep, Outcome.BoostCreature);
this.mor = new MageObjectReference(card, game);
}
private DranaTheLastBloodchiefCounterEffect(final DranaTheLastBloodchiefCounterEffect effect) {
super(effect);
this.mor = effect.mor;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature != null && mor.refersTo(creature, game)) {
creature.addCounters(CounterType.P1P1.createInstance(), source, game, event.getAppliedEffects());
discard();
}
return false;
}
@Override
public DranaTheLastBloodchiefCounterEffect copy() {
return new DranaTheLastBloodchiefCounterEffect(this);
}
}

View file

@ -159,6 +159,7 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Demon's Disciple", 97, Rarity.UNCOMMON, mage.cards.d.DemonsDisciple.class));
cards.add(new SetCardInfo("Disenchant", 10, Rarity.COMMON, mage.cards.d.Disenchant.class));
cards.add(new SetCardInfo("Drana's Silencer", 99, Rarity.COMMON, mage.cards.d.DranasSilencer.class));
cards.add(new SetCardInfo("Drana, the Last Bloodchief", 98, Rarity.MYTHIC, mage.cards.d.DranaTheLastBloodchief.class));
cards.add(new SetCardInfo("Dreadwurm", 100, Rarity.COMMON, mage.cards.d.Dreadwurm.class));
cards.add(new SetCardInfo("Emeria Captain", 11, Rarity.UNCOMMON, mage.cards.e.EmeriaCaptain.class));
cards.add(new SetCardInfo("Emeria's Call", 12, Rarity.MYTHIC, mage.cards.e.EmeriasCall.class));