Implemented Catacomb Dragon

This commit is contained in:
Evan Kranzler 2019-01-27 09:14:36 -05:00
parent b49ead9bdb
commit eff0bb0e63
2 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,86 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CatacombDragon extends CardImpl {
private static final FilterCreaturePermanent filter
= new FilterCreaturePermanent("a nonartifact, non-Dragon creature");
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT)));
filter.add(Predicates.not(new SubtypePredicate(SubType.DRAGON)));
}
public CatacombDragon(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{B}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Catacomb Dragon becomes blocked by a nonartifact, non-Dragon creature, that creature gets -X/-0 until end of turn, where X is half the creature's power, rounded down.
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new CatacombDragonEffect(), filter, false));
}
private CatacombDragon(final CatacombDragon card) {
super(card);
}
@Override
public CatacombDragon copy() {
return new CatacombDragon(this);
}
}
class CatacombDragonEffect extends OneShotEffect {
CatacombDragonEffect() {
super(Outcome.Benefit);
staticText = "that creature gets -X/-0 until end of turn, where X is half the creature's power, rounded down.";
}
private CatacombDragonEffect(final CatacombDragonEffect effect) {
super(effect);
}
@Override
public CatacombDragonEffect copy() {
return new CatacombDragonEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (permanent == null || !permanent.isCreature()) {
return false;
}
int unBoost = -1 * Math.floorDiv(permanent.getPower().getValue(), 2);
game.addEffect(new BoostTargetEffect(unBoost, 0), source);
return true;
}
}

View file

@ -61,6 +61,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Cadaverous Knight", 110, Rarity.COMMON, mage.cards.c.CadaverousKnight.class));
cards.add(new SetCardInfo("Canopy Dragon", 209, Rarity.RARE, mage.cards.c.CanopyDragon.class));
cards.add(new SetCardInfo("Carrion", 111, Rarity.RARE, mage.cards.c.Carrion.class));
cards.add(new SetCardInfo("Catacomb Dragon", 112, Rarity.RARE, mage.cards.c.CatacombDragon.class));
cards.add(new SetCardInfo("Celestial Dawn", 6, Rarity.RARE, mage.cards.c.CelestialDawn.class));
cards.add(new SetCardInfo("Cerulean Wyvern", 57, Rarity.UNCOMMON, mage.cards.c.CeruleanWyvern.class));
cards.add(new SetCardInfo("Chaos Charm", 163, Rarity.COMMON, mage.cards.c.ChaosCharm.class));