[ZNR] Implemented Ancient Greenwarden

This commit is contained in:
Evan Kranzler 2020-09-09 10:57:18 -04:00
parent a2a0d75ff5
commit dc03a14ae7
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,100 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.ruleModifying.PlayLandsFromGraveyardEffect;
import mage.abilities.keyword.ReachAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.NumberOfTriggersEvent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AncientGreenwarden extends CardImpl {
public AncientGreenwarden(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(5);
this.toughness = new MageInt(7);
// Reach
this.addAbility(ReachAbility.getInstance());
// You may play lands from your graveyard.
this.addAbility(new SimpleStaticAbility(new PlayLandsFromGraveyardEffect()));
// If a land entering the battlefield causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time.
this.addAbility(new SimpleStaticAbility(new AncientGreenwardenEffect()));
}
private AncientGreenwarden(final AncientGreenwarden card) {
super(card);
}
@Override
public AncientGreenwarden copy() {
return new AncientGreenwarden(this);
}
}
class AncientGreenwardenEffect extends ReplacementEffectImpl {
AncientGreenwardenEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "If a land entering the battlefield causes a triggered ability " +
"of a permanent you control to trigger, that ability triggers an additional time";
}
private AncientGreenwardenEffect(final AncientGreenwardenEffect effect) {
super(effect);
}
@Override
public AncientGreenwardenEffect copy() {
return new AncientGreenwardenEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!(event instanceof NumberOfTriggersEvent)) {
return false;
}
NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event;
if (!source.isControlledBy(event.getPlayerId())) {
return false;
}
GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
if (sourceEvent == null
|| sourceEvent.getType() != GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|| !(sourceEvent instanceof EntersTheBattlefieldEvent)
|| !((EntersTheBattlefieldEvent) sourceEvent).getTarget().isLand()) {
return false;
}
return game.getPermanent(numberOfTriggersEvent.getSourceId()) != null;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(event.getAmount() + 1);
return false;
}
}

View file

@ -113,6 +113,7 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Akoum Hellhound", 133, Rarity.COMMON, mage.cards.a.AkoumHellhound.class));
cards.add(new SetCardInfo("Akoum Teeth", 134, Rarity.UNCOMMON, mage.cards.a.AkoumTeeth.class));
cards.add(new SetCardInfo("Akoum Warrior", 134, Rarity.UNCOMMON, mage.cards.a.AkoumWarrior.class));
cards.add(new SetCardInfo("Ancient Greenwarden", 178, Rarity.RARE, mage.cards.a.AncientGreenwarden.class));
cards.add(new SetCardInfo("Angelheart Protector", 3, Rarity.COMMON, mage.cards.a.AngelheartProtector.class));
cards.add(new SetCardInfo("Anticognition", 45, Rarity.COMMON, mage.cards.a.Anticognition.class));
cards.add(new SetCardInfo("Archon of Emeria", 4, Rarity.RARE, mage.cards.a.ArchonOfEmeria.class));