[STX] Implemented Flame Spill

This commit is contained in:
Evan Kranzler 2021-04-04 10:40:13 -04:00
parent 1461a875ff
commit 2184a18c04
5 changed files with 89 additions and 85 deletions

View file

@ -1,15 +1,9 @@
package mage.cards.f; package mage.cards.f;
import mage.MageObject; import mage.abilities.effects.common.DamageWithExcessEffect;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -23,7 +17,7 @@ public final class FlameSpill extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Flame Spill deals 4 damage to target creature. Excess damage is dealt to that creature's controller instead. // Flame Spill deals 4 damage to target creature. Excess damage is dealt to that creature's controller instead.
this.getSpellAbility().addEffect(new FlameSpillEffect()); this.getSpellAbility().addEffect(new DamageWithExcessEffect(4));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }
@ -36,38 +30,3 @@ public final class FlameSpill extends CardImpl {
return new FlameSpill(this); return new FlameSpill(this);
} }
} }
class FlameSpillEffect extends OneShotEffect {
FlameSpillEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 4 damage to target creature. " +
"Excess damage is dealt to that creature's controller instead.";
}
private FlameSpillEffect(final FlameSpillEffect effect) {
super(effect);
}
@Override
public FlameSpillEffect copy() {
return new FlameSpillEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
MageObject sourceObject = source.getSourceObject(game);
if (permanent == null || sourceObject == null) {
return false;
}
int lethal = permanent.getLethalDamage(source.getSourceId(), game);
lethal = Math.min(lethal, 4);
permanent.damage(lethal, source.getSourceId(), source, game);
Player player = game.getPlayer(permanent.getControllerId());
if (player != null && lethal < 4) {
player.damage(4 - lethal, source.getSourceId(), source, game);
}
return true;
}
}

View file

@ -0,0 +1,32 @@
package mage.cards.p;
import mage.abilities.effects.common.DamageWithExcessEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class PigmentStorm extends CardImpl {
public PigmentStorm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
// Pigment Storm deals 5 damage to target creature. Excess damage is dealt to that creature's controller instead.
this.getSpellAbility().addEffect(new DamageWithExcessEffect(5));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private PigmentStorm(final PigmentStorm card) {
super(card);
}
@Override
public PigmentStorm copy() {
return new PigmentStorm(this);
}
}

View file

@ -1,17 +1,11 @@
package mage.cards.s; package mage.cards.s;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DamageWithExcessEffect;
import mage.abilities.effects.common.InfoEffect; import mage.abilities.effects.common.InfoEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -30,7 +24,8 @@ public final class SuperDuperDeathRay extends CardImpl {
))); )));
// Super-Duper Death Ray deals 4 damage to target creature. // Super-Duper Death Ray deals 4 damage to target creature.
this.getSpellAbility().addEffect(new SuperDuperDeathRayEffect()); this.getSpellAbility().addEffect(new DamageWithExcessEffect(4)
.setText("{this} deals 4 damage to target creature"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
} }
@ -43,37 +38,3 @@ public final class SuperDuperDeathRay extends CardImpl {
return new SuperDuperDeathRay(this); return new SuperDuperDeathRay(this);
} }
} }
class SuperDuperDeathRayEffect extends OneShotEffect {
SuperDuperDeathRayEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 4 damage to target creature.";
}
private SuperDuperDeathRayEffect(final SuperDuperDeathRayEffect effect) {
super(effect);
}
@Override
public SuperDuperDeathRayEffect copy() {
return new SuperDuperDeathRayEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
MageObject sourceObject = source.getSourceObject(game);
if (permanent == null || sourceObject == null) {
return false;
}
int lethal = permanent.getLethalDamage(source.getSourceId(), game);
lethal = Math.min(lethal, 4);
permanent.damage(lethal, source.getSourceId(), source, game);
Player player = game.getPlayer(permanent.getControllerId());
if (player != null && lethal < 4) {
player.damage(4 - lethal, source.getSourceId(), source, game);
}
return true;
}
}

View file

@ -145,6 +145,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Overgrown Arch", 139, Rarity.UNCOMMON, mage.cards.o.OvergrownArch.class)); cards.add(new SetCardInfo("Overgrown Arch", 139, Rarity.UNCOMMON, mage.cards.o.OvergrownArch.class));
cards.add(new SetCardInfo("Owlin Shieldmage", 210, Rarity.COMMON, mage.cards.o.OwlinShieldmage.class)); cards.add(new SetCardInfo("Owlin Shieldmage", 210, Rarity.COMMON, mage.cards.o.OwlinShieldmage.class));
cards.add(new SetCardInfo("Pest Summoning", 211, Rarity.COMMON, mage.cards.p.PestSummoning.class)); cards.add(new SetCardInfo("Pest Summoning", 211, Rarity.COMMON, mage.cards.p.PestSummoning.class));
cards.add(new SetCardInfo("Pigment Storm", 111, Rarity.COMMON, mage.cards.p.PigmentStorm.class));
cards.add(new SetCardInfo("Pilgrim of the Ages", 22, Rarity.COMMON, mage.cards.p.PilgrimOfTheAges.class)); cards.add(new SetCardInfo("Pilgrim of the Ages", 22, Rarity.COMMON, mage.cards.p.PilgrimOfTheAges.class));
cards.add(new SetCardInfo("Pillardrop Rescuer", 23, Rarity.COMMON, mage.cards.p.PillardropRescuer.class)); cards.add(new SetCardInfo("Pillardrop Rescuer", 23, Rarity.COMMON, mage.cards.p.PillardropRescuer.class));
cards.add(new SetCardInfo("Plains", 366, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Plains", 366, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));

View file

@ -0,0 +1,51 @@
package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
* @author TheElk801
*/
public class DamageWithExcessEffect extends OneShotEffect {
private final int amount;
public DamageWithExcessEffect(int amount) {
super(Outcome.Damage);
this.amount = amount;
this.staticText = "{this} deals " + amount + " damage to target creature. " +
"Excess damage is dealt to that creature's controller instead";
}
private DamageWithExcessEffect(final DamageWithExcessEffect effect) {
super(effect);
this.amount = effect.amount;
}
@Override
public DamageWithExcessEffect copy() {
return new DamageWithExcessEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
MageObject sourceObject = source.getSourceObject(game);
if (permanent == null || sourceObject == null) {
return false;
}
int lethal = permanent.getLethalDamage(source.getSourceId(), game);
lethal = Math.min(lethal, amount);
permanent.damage(lethal, source.getSourceId(), source, game);
Player player = game.getPlayer(permanent.getControllerId());
if (player != null && lethal < amount) {
player.damage(amount - lethal, source.getSourceId(), source, game);
}
return true;
}
}