Implemented Flame Spill

This commit is contained in:
Evan Kranzler 2020-04-08 20:27:35 -04:00
parent 1a6dee02dd
commit 82aa9fdb95
2 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,77 @@
package mage.cards.f;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
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 java.util.UUID;
/**
* @author TheElk801
*/
public final class FlameSpill extends CardImpl {
public FlameSpill(UUID ownerId, CardSetInfo setInfo) {
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.
this.getSpellAbility().addEffect(new FlameSpillEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
private FlameSpill(final FlameSpill card) {
super(card);
}
@Override
public FlameSpill copy() {
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 = Math.max(permanent.getToughness().getValue() - permanent.getDamage(), 0);
if (sourceObject.getAbilities().containsKey(DeathtouchAbility.getInstance().getId())) {
lethal = Math.min(lethal, 1);
}
lethal = Math.min(lethal, 4);
permanent.damage(lethal, source.getSourceId(), game);
Player player = game.getPlayer(permanent.getControllerId());
if (player != null && lethal < 4) {
player.damage(4 - lethal, source.getSourceId(), game);
}
return true;
}
}

View file

@ -91,6 +91,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
cards.add(new SetCardInfo("Farfinder", 2, Rarity.COMMON, mage.cards.f.Farfinder.class));
cards.add(new SetCardInfo("Fertilid", 152, Rarity.COMMON, mage.cards.f.Fertilid.class));
cards.add(new SetCardInfo("Fight as One", 12, Rarity.UNCOMMON, mage.cards.f.FightAsOne.class));
cards.add(new SetCardInfo("Flame Spill", 117, Rarity.UNCOMMON, mage.cards.f.FlameSpill.class));
cards.add(new SetCardInfo("Flourishing Fox", 13, Rarity.UNCOMMON, mage.cards.f.FlourishingFox.class));
cards.add(new SetCardInfo("Footfall Crater", 118, Rarity.UNCOMMON, mage.cards.f.FootfallCrater.class));
cards.add(new SetCardInfo("Forbidden Friendship", 119, Rarity.COMMON, mage.cards.f.ForbiddenFriendship.class));