Merge pull request #5175 from use/master

Implemented Gyrus, Waker of Corpses
This commit is contained in:
theelk801 2018-07-27 22:11:18 -04:00 committed by GitHub
commit 036bce7824
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 131 additions and 1 deletions

View file

@ -0,0 +1,129 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.dynamicvalue.common.ManaSpentToCastCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author Will
*/
public final class GyrusWakerOfCorpses extends CardImpl {
private static final FilterCreatureCard filter = new FilterCreatureCard("target creature card with lesser power from your graveyard");
static {
filter.add(new GyrusWakerOfCorpsesPowerLessThanSourcePredicate());
}
public GyrusWakerOfCorpses(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{B}{R}{G}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HYDRA);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Gyrus, Walker of Corpses enters the battlefield with a number of +1/+1 counters on it equal to the amount of mana spent to cast it.
Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), new ManaSpentToCastCount(), true);
effect.setText("with a number of +1/+1 counters on it equal to the amount of mana spent to cast it");
this.addAbility(new EntersBattlefieldAbility(effect));
// Whenever Gyrus attacks, you may exile target creature card with lesser power from your graveyard. If you do, create a token thats a copy of that card and thats tapped and attacking. Exile the token at the end of combat.
Ability ability = new AttacksTriggeredAbility(new GyrusWakerOfCorpsesEffect(), true);
ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability);
}
public GyrusWakerOfCorpses(final GyrusWakerOfCorpses card) {
super(card);
}
@Override
public GyrusWakerOfCorpses copy() {
return new GyrusWakerOfCorpses(this);
}
}
class GyrusWakerOfCorpsesEffect extends OneShotEffect {
public GyrusWakerOfCorpsesEffect() {
super(Outcome.Copy);
this.staticText = "exile target creature card with lesser power from your graveyard. If you do, create a token thats a copy of that card and thats tapped and attacking. Exile the token at the end of combat.";
}
public GyrusWakerOfCorpsesEffect(final GyrusWakerOfCorpsesEffect effect) {
super(effect);
}
@Override
public GyrusWakerOfCorpsesEffect copy() {
return new GyrusWakerOfCorpsesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || card == null) {
return false;
}
controller.moveCards(card, Zone.EXILED, source, game);
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true, 1, true, true);
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
effect.apply(game, source);
for (Permanent addedToken : effect.getAddedPermanent()) {
Effect exileEffect = new ExileTargetEffect();
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), false).apply(game, source);
}
return true;
}
}
class GyrusWakerOfCorpsesPowerLessThanSourcePredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
@Override
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(input.getSourceId());
return sourcePermanent != null && input.getObject().getPower().getValue() < sourcePermanent.getPower().getValue();
}
@Override
public String toString() {
return "lesser power";
}
}

View file

@ -133,6 +133,7 @@ public final class Commander2018 extends ExpansionSet {
cards.add(new SetCardInfo("Grisly Salvage", 182, Rarity.COMMON, mage.cards.g.GrislySalvage.class));
cards.add(new SetCardInfo("Ground Seal", 149, Rarity.RARE, mage.cards.g.GroundSeal.class));
cards.add(new SetCardInfo("Gruul Turf", 252, Rarity.UNCOMMON, mage.cards.g.GruulTurf.class));
cards.add(new SetCardInfo("Gyrus, Waker of Corpses", 41, Rarity.MYTHIC, mage.cards.g.GyrusWakerOfCorpses.class));
cards.add(new SetCardInfo("Halimar Depths", 253, Rarity.COMMON, mage.cards.h.HalimarDepths.class));
cards.add(new SetCardInfo("Harrow", 150, Rarity.COMMON, mage.cards.h.Harrow.class));
cards.add(new SetCardInfo("Haunted Fengraf", 254, Rarity.COMMON, mage.cards.h.HauntedFengraf.class));

View file

@ -29,7 +29,7 @@ public class ManaSpentToCastCount implements DynamicValue {
}
if (spell != null) {
// NOT the cmc of the spell on the stack
return spell.getSpellAbility().getManaCostsToPay().convertedManaCost() + spell.getSpellAbility().getManaCostsToPay().getX();
return spell.getSpellAbility().getManaCostsToPay().convertedManaCost();
}
return 0;
}