Implemented Varina, Lich Queen

This commit is contained in:
Evan Kranzler 2018-07-26 21:16:29 -04:00
parent e39dbacc8b
commit 2d027dbacd
2 changed files with 118 additions and 0 deletions

View file

@ -0,0 +1,117 @@
package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.ZombieToken;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author TheElk801
*/
public final class VarinaLichQueen extends CardImpl {
public VarinaLichQueen(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Whenever you attack with one or more Zombies, draw that many cards, then discard that many cards. You gain that much life.
this.addAbility(new VarinaLichQueenTriggeredAbility());
// {2}, Exile two cards from your graveyard: Create a tapped 2/2 black Zombie creature token.
Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new CreateTokenEffect(
new ZombieToken(),
1, true, false
), new GenericManaCost(2)
);
ability.addCost(new ExileFromGraveCost(new TargetCardInYourGraveyard(
2, new FilterCard("cards from your graveyard")
)));
this.addAbility(ability);
}
public VarinaLichQueen(final VarinaLichQueen card) {
super(card);
}
@Override
public VarinaLichQueen copy() {
return new VarinaLichQueen(this);
}
}
class VarinaLichQueenTriggeredAbility extends TriggeredAbilityImpl {
public VarinaLichQueenTriggeredAbility() {
super(Zone.BATTLEFIELD, null, false);
}
public VarinaLichQueenTriggeredAbility(final VarinaLichQueenTriggeredAbility ability) {
super(ability);
}
@Override
public VarinaLichQueenTriggeredAbility copy() {
return new VarinaLichQueenTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
int attackingZombies = 0;
for (UUID attacker : game.getCombat().getAttackers()) {
Permanent creature = game.getPermanent(attacker);
if (creature != null
&& creature.getControllerId() != null
&& creature.isControlledBy(this.getControllerId())
&& creature.hasSubtype(SubType.ZOMBIE, game)) {
attackingZombies++;
}
}
if (attackingZombies > 0) {
this.getEffects().clear();
addEffect(new DrawCardSourceControllerEffect(attackingZombies));
addEffect(new DiscardControllerEffect(attackingZombies, false));
addEffect(new GainLifeEffect(attackingZombies));
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever you attack with one or more Zombies, "
+ "draw that many cards, then discard that many cards. "
+ "You gain that much life.";
}
}

View file

@ -87,6 +87,7 @@ public final class Commander2018 extends ExpansionSet {
cards.add(new SetCardInfo("Turntimber Sower", 35, Rarity.RARE, mage.cards.t.TurntimberSower.class));
cards.add(new SetCardInfo("Tuvasa the Sunlit", 47, Rarity.MYTHIC, mage.cards.t.TuvasaTheSunlit.class));
cards.add(new SetCardInfo("Varchild, Betrayer of Kjeldor", 28, Rarity.RARE, mage.cards.v.VarchildBetrayerOfKjeldor.class));
cards.add(new SetCardInfo("Varina, Lich Queen", 48, Rarity.MYTHIC, mage.cards.v.VarinaLichQueen.class));
cards.add(new SetCardInfo("Whiptongue Hydra", 36, Rarity.RARE, mage.cards.w.WhiptongueHydra.class));
cards.add(new SetCardInfo("Winds of Rath", 79, Rarity.RARE, mage.cards.w.WindsOfRath.class));
}