Implemented Chandra's Triumph

This commit is contained in:
Evan Kranzler 2019-04-09 18:56:41 -04:00
parent 0c296c3820
commit c50353cd73
2 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPlaneswalkerPermanent;
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ChandrasTriumph extends CardImpl {
private static final FilterPermanent filter
= new FilterCreatureOrPlaneswalkerPermanent("creature or planeswalker an opponent controls");
static {
filter.add(new ControllerPredicate(TargetController.OPPONENT));
}
public ChandrasTriumph(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
// Chandra's Triumph deals 3 damage to target creature or planeswalker an opponent controls. Chandra's Triumph deals 5 damage to that permanent instead if you control a Chandra planeswalker.
this.getSpellAbility().addEffect(new ChandrasTriumphEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
}
private ChandrasTriumph(final ChandrasTriumph card) {
super(card);
}
@Override
public ChandrasTriumph copy() {
return new ChandrasTriumph(this);
}
}
class ChandrasTriumphEffect extends OneShotEffect {
private static final FilterControlledPlaneswalkerPermanent filter
= new FilterControlledPlaneswalkerPermanent(SubType.CHANDRA);
ChandrasTriumphEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 3 damage to target creature or planeswalker an opponent controls. " +
"{this} deals 5 damage to that permanent instead if you control a Chandra planeswalker.";
}
private ChandrasTriumphEffect(final ChandrasTriumphEffect effect) {
super(effect);
}
@Override
public ChandrasTriumphEffect copy() {
return new ChandrasTriumphEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
int damage = 3;
if (game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game).isEmpty()) {
damage = 5;
}
return permanent.damage(damage, source.getSourceId(), game) > 0;
}
}

View file

@ -42,6 +42,7 @@ public final class WarOfTheSpark extends ExpansionSet {
cards.add(new SetCardInfo("Burning Prophet", 117, Rarity.COMMON, mage.cards.b.BurningProphet.class));
cards.add(new SetCardInfo("Challenger Troll", 157, Rarity.UNCOMMON, mage.cards.c.ChallengerTroll.class));
cards.add(new SetCardInfo("Chandra's Pyrohelix", 120, Rarity.COMMON, mage.cards.c.ChandrasPyrohelix.class));
cards.add(new SetCardInfo("Chandra's Triumph", 121, Rarity.UNCOMMON, mage.cards.c.ChandrasTriumph.class));
cards.add(new SetCardInfo("Courage in Crisis", 158, Rarity.COMMON, mage.cards.c.CourageInCrisis.class));
cards.add(new SetCardInfo("Cruel Celebrant", 188, Rarity.UNCOMMON, mage.cards.c.CruelCelebrant.class));
cards.add(new SetCardInfo("Crush Dissent", 47, Rarity.COMMON, mage.cards.c.CrushDissent.class));