[AFR] Implemented Green Dragon

This commit is contained in:
Daniel Bomar 2021-07-01 07:08:33 -05:00
parent 37158ffec9
commit ac300fbaff
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,87 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author weirddan455
*/
public final class GreenDragon extends CardImpl {
public GreenDragon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Poison Breath When Green Dragon enters the battlefield, until end of turn, whenever a creature an opponent controls is dealt damage, destroy it.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateDelayedTriggeredAbilityEffect(
new GreenDragonDelayedTriggeredAbility(), false
)));
}
private GreenDragon(final GreenDragon card) {
super(card);
}
@Override
public GreenDragon copy() {
return new GreenDragon(this);
}
}
class GreenDragonDelayedTriggeredAbility extends DelayedTriggeredAbility {
public GreenDragonDelayedTriggeredAbility() {
super(new DestroyTargetEffect(), Duration.EndOfTurn, false);
}
private GreenDragonDelayedTriggeredAbility(final GreenDragonDelayedTriggeredAbility ability) {
super(ability);
}
@Override
public GreenDragonDelayedTriggeredAbility copy() {
return new GreenDragonDelayedTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null && permanent.isCreature()
&& game.getOpponents(permanent.getControllerId()).contains(this.getControllerId())) {
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
return true;
}
return false;
}
@Override
public String getRule() {
return "until end of turn, whenever a creature an opponent controls is dealt damage, destroy it.";
}
}

View file

@ -59,6 +59,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Gloom Stalker", 16, Rarity.COMMON, mage.cards.g.GloomStalker.class));
cards.add(new SetCardInfo("Gnoll Hunter", 185, Rarity.COMMON, mage.cards.g.GnollHunter.class));
cards.add(new SetCardInfo("Grazilaxx, Illithid Scholar", 60, Rarity.RARE, mage.cards.g.GrazilaxxIllithidScholar.class));
cards.add(new SetCardInfo("Green Dragon", 186, Rarity.UNCOMMON, mage.cards.g.GreenDragon.class));
cards.add(new SetCardInfo("Guild Thief", 61, Rarity.UNCOMMON, mage.cards.g.GuildThief.class));
cards.add(new SetCardInfo("Half-Elf Monk", 19, Rarity.COMMON, mage.cards.h.HalfElfMonk.class));
cards.add(new SetCardInfo("Hive of the Eye Tyrant", 258, Rarity.RARE, mage.cards.h.HiveOfTheEyeTyrant.class));