Implemented Expansion // Explosion

This commit is contained in:
Evan Kranzler 2018-09-12 10:35:23 -04:00
parent 2ae21816fa
commit 774b8214be
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,91 @@
package mage.cards.e;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardSetInfo;
import mage.cards.SplitCard;
import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Outcome;
import mage.constants.SpellAbilityType;
import mage.filter.FilterSpell;
import mage.filter.common.FilterInstantOrSorcerySpell;
import mage.filter.predicate.mageobject.ConvertedManaCostPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.TargetSpell;
import mage.target.common.TargetAnyTarget;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public final class ExpansionExplosion extends SplitCard {
private static final FilterSpell filter = new FilterInstantOrSorcerySpell("instant or sorcery spell with converted mana cost 4 or less");
static {
filter.add(new ConvertedManaCostPredicate(ComparisonType.FEWER_THAN, 5));
}
public ExpansionExplosion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{U/R}{U/R}", "{X}{U}{U}{R}{R}", SpellAbilityType.SPLIT);
// Expansion
// Copy target instant or sorcery spell with converted mana cost 4 or less. You may choose new targets for the copy.
this.getLeftHalfCard().getSpellAbility().addEffect(new CopyTargetSpellEffect());
this.getSpellAbility().addTarget(new TargetSpell(filter));
// Explosion
// Explosion deals X damage to any target. Target player draws X cards.
this.getRightHalfCard().getSpellAbility().addEffect(new ExplosionEffect());
this.getRightHalfCard().getSpellAbility().addTarget(new TargetAnyTarget());
this.getRightHalfCard().getSpellAbility().addTarget(new TargetPlayer());
}
public ExpansionExplosion(final ExpansionExplosion card) {
super(card);
}
@Override
public ExpansionExplosion copy() {
return new ExpansionExplosion(this);
}
}
class ExplosionEffect extends OneShotEffect {
public ExplosionEffect() {
super(Outcome.Benefit);
this.staticText = "{this} deals X damage to any target. "
+ "Target player draws X cards.";
}
public ExplosionEffect(final ExplosionEffect effect) {
super(effect);
}
@Override
public ExplosionEffect copy() {
return new ExplosionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int xValue = source.getManaCostsToPay().getX();
Effect effect = new DamageTargetEffect(xValue);
effect.setTargetPointer(new FixedTarget(source.getFirstTarget(), game));
effect.apply(game, source);
Player player = game.getPlayer(source.getTargets().get(1).getFirstTarget());
if (player != null) {
player.drawCards(xValue, game);
}
return true;
}
}

View file

@ -48,6 +48,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
cards.add(new SetCardInfo("District Guide", 128, Rarity.UNCOMMON, mage.cards.d.DistrictGuide.class));
cards.add(new SetCardInfo("Dream Eater", 38, Rarity.MYTHIC, mage.cards.d.DreamEater.class));
cards.add(new SetCardInfo("Emmara, Soul of the Accord", 168, Rarity.RARE, mage.cards.e.EmmaraSoulOfTheAccord.class));
cards.add(new SetCardInfo("Expansion // Explosion", 224, Rarity.RARE, mage.cards.e.ExpansionExplosion.class));
cards.add(new SetCardInfo("Find // Finality", 225, Rarity.RARE, mage.cards.f.FindFinality.class));
cards.add(new SetCardInfo("Firemind's Research", 171, Rarity.RARE, mage.cards.f.FiremindsResearch.class));
cards.add(new SetCardInfo("Forest", 264, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));