Implemented Chandra, Awakened Inferno

This commit is contained in:
Evan Kranzler 2019-06-15 16:22:48 -04:00
parent 75e5ad3d7b
commit 1887bc149e
3 changed files with 159 additions and 0 deletions

View file

@ -0,0 +1,131 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.PayVariableLoyaltyCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.ExileTargetIfDiesEffect;
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.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.command.emblems.ChandraAwakenedInfernoEmblem;
import mage.target.common.TargetCreatureOrPlaneswalker;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ChandraAwakenedInferno extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("non-Elemental creature");
static {
filter.add(Predicates.not(new SubtypePredicate(SubType.ELEMENTAL)));
}
public ChandraAwakenedInferno(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{4}{R}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.CHANDRA);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(6));
// This spell can't be countered.
this.addAbility(new CantBeCounteredAbility());
// +2: Each opponent gets an emblem with "At the beginning of your upkeep, this emblem deals 1 damage to you."
this.addAbility(new LoyaltyAbility(new ChandraAwakenedInfernoEffect(), 2));
// -3: Chandra, Awakened Inferno deals 3 damage to each non-Elemental creature.
this.addAbility(new LoyaltyAbility(new DamageAllEffect(3, filter), -3));
// -X: Chandra, Awakened Inferno deals X damage to target creature or planeswalker. If a permanent dealt damage this way would die this turn, exile it instead.
Ability ability = new LoyaltyAbility(new DamageTargetEffect(ChandraAwakenedInfernoXValue.instance));
ability.addEffect(
new ExileTargetIfDiesEffect()
.setText("If a permanent dealt damage this way would die this turn, exile it instead.")
);
ability.addTarget(new TargetCreatureOrPlaneswalker());
this.addAbility(ability);
}
private ChandraAwakenedInferno(final ChandraAwakenedInferno card) {
super(card);
}
@Override
public ChandraAwakenedInferno copy() {
return new ChandraAwakenedInferno(this);
}
}
class ChandraAwakenedInfernoEffect extends OneShotEffect {
ChandraAwakenedInfernoEffect() {
super(Outcome.Benefit);
staticText = "Each opponent gets an emblem with " +
"\"At the beginning of your upkeep, this emblem deals 1 damage to you.\"";
}
private ChandraAwakenedInfernoEffect(final ChandraAwakenedInfernoEffect effect) {
super(effect);
}
@Override
public ChandraAwakenedInfernoEffect copy() {
return new ChandraAwakenedInfernoEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getOpponents(source.getControllerId())) {
game.addEmblem(new ChandraAwakenedInfernoEmblem(), source.getSourceObjectIfItStillExists(game), playerId);
}
return true;
}
}
enum ChandraAwakenedInfernoXValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for (Cost cost : sourceAbility.getCosts()) {
if (cost instanceof PayVariableLoyaltyCost) {
return ((PayVariableLoyaltyCost) cost).getAmount();
}
}
return 0;
}
@Override
public DynamicValue copy() {
return instance;
}
@Override
public String getMessage() {
return "";
}
@Override
public String toString() {
return "X";
}
}

View file

@ -27,6 +27,7 @@ public final class CoreSet2020 extends ExpansionSet {
this.ratioBoosterMythic = 8;
this.maxCardNumberInBooster = 280;
cards.add(new SetCardInfo("Chandra, Awakened Inferno", 127, Rarity.MYTHIC, mage.cards.c.ChandraAwakenedInferno.class));
cards.add(new SetCardInfo("Chandra, Novice Pyromancer", 128, Rarity.UNCOMMON, mage.cards.c.ChandraNovicePyromancer.class));
}
}

View file

@ -0,0 +1,27 @@
package mage.game.command.emblems;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.command.Emblem;
/**
* @author TheElk801
*/
public final class ChandraAwakenedInfernoEmblem extends Emblem {
/**
* Emblem with "At the beginning of your upkeep, this emblem deals 1 damage
* to you."
*/
public ChandraAwakenedInfernoEmblem() {
setName("Emblem Chandra");
setExpansionSetCodeForImage("M19");
this.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(
Zone.COMMAND, new DamageControllerEffect(1, "this emblem"),
TargetController.YOU, false, true
));
}
}