Implemented Lava Storm

This commit is contained in:
Evan Kranzler 2019-01-30 17:11:24 -05:00
parent c46b268819
commit 24a7bd4b37
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.l;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.BlockingPredicate;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LavaStorm extends CardImpl {
public LavaStorm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}");
// Lava Storm deals 2 damage to each attacking creature or Lava Storm deals 2 damage to each blocking creature.
this.getSpellAbility().addEffect(new LavaStormEffect());
}
private LavaStorm(final LavaStorm card) {
super(card);
}
@Override
public LavaStorm copy() {
return new LavaStorm(this);
}
}
class LavaStormEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterCreaturePermanent();
private static final FilterPermanent filter2 = new FilterCreaturePermanent();
static {
filter.add(AttackingPredicate.instance);
filter2.add(BlockingPredicate.instance);
}
LavaStormEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 2 damage to each attacking creature " +
"or {this} deals 2 damage to each blocking creature.";
}
private LavaStormEffect(final LavaStormEffect effect) {
super(effect);
}
@Override
public LavaStormEffect copy() {
return new LavaStormEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (player.chooseUse(
Outcome.Benefit, "Deal 2 damage to all attacking creatures or all blocking creatures?",
null, "Attackers", "Blockers", source, game)
) {
return new DamageAllEffect(2, filter).apply(game, source);
}
return new DamageAllEffect(2, filter2).apply(game, source);
}
}

View file

@ -107,6 +107,7 @@ public final class Weatherlight extends ExpansionSet {
cards.add(new SetCardInfo("Inner Sanctum", 18, Rarity.RARE, mage.cards.i.InnerSanctum.class));
cards.add(new SetCardInfo("Jabari's Banner", 150, Rarity.UNCOMMON, mage.cards.j.JabarisBanner.class));
cards.add(new SetCardInfo("Lava Hounds", 109, Rarity.UNCOMMON, mage.cards.l.LavaHounds.class));
cards.add(new SetCardInfo("Lava Storm", 110, Rarity.COMMON, mage.cards.l.LavaStorm.class));
cards.add(new SetCardInfo("Llanowar Behemoth", 132, Rarity.UNCOMMON, mage.cards.l.LlanowarBehemoth.class));
cards.add(new SetCardInfo("Llanowar Druid", 133, Rarity.COMMON, mage.cards.l.LlanowarDruid.class));
cards.add(new SetCardInfo("Llanowar Sentinel", 134, Rarity.COMMON, mage.cards.l.LlanowarSentinel.class));