From fcc1481679909ccba05aad6cefd715977908be10 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 6 Nov 2021 13:43:20 -0400 Subject: [PATCH] [VOW] Implemented Lacerate Flesh --- Mage.Sets/src/mage/cards/l/LacerateFlesh.java | 69 +++++++++++++++++++ .../src/mage/sets/InnistradCrimsonVow.java | 1 + .../java/mage/game/permanent/token/Token.java | 2 + .../mage/game/permanent/token/TokenImpl.java | 22 +++--- 4 files changed, 85 insertions(+), 9 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/l/LacerateFlesh.java diff --git a/Mage.Sets/src/mage/cards/l/LacerateFlesh.java b/Mage.Sets/src/mage/cards/l/LacerateFlesh.java new file mode 100644 index 0000000000..0d4f8c4eea --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LacerateFlesh.java @@ -0,0 +1,69 @@ +package mage.cards.l; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +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.game.permanent.token.BloodToken; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LacerateFlesh extends CardImpl { + + public LacerateFlesh(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}"); + + // Lacerate Flesh deals 4 damage to target creature. Create a number of Blood tokens equal to the amount of excess damage dealt to that creature this way. + this.getSpellAbility().addEffect(new LacerateFleshEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private LacerateFlesh(final LacerateFlesh card) { + super(card); + } + + @Override + public LacerateFlesh copy() { + return new LacerateFlesh(this); + } +} + +class LacerateFleshEffect extends OneShotEffect { + + LacerateFleshEffect() { + super(Outcome.Benefit); + staticText = "{this} deals 4 damage to target creature. Create a number of Blood tokens " + + "equal to the amount of excess damage dealt to that creature this way"; + } + + private LacerateFleshEffect(final LacerateFleshEffect effect) { + super(effect); + } + + @Override + public LacerateFleshEffect copy() { + return new LacerateFleshEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + if (permanent == null) { + return false; + } + int lethal = Math.min(permanent.getLethalDamage(source.getSourceId(), game), 4); + permanent.damage(4, source.getSourceId(), source, game); + if (lethal < 4) { + new BloodToken().putOntoBattlefield(4 - lethal, game, source); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java index 339b19ec5d..e55045ab88 100644 --- a/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java +++ b/Mage.Sets/src/mage/sets/InnistradCrimsonVow.java @@ -157,6 +157,7 @@ public final class InnistradCrimsonVow extends ExpansionSet { cards.add(new SetCardInfo("Kessig Flamebreather", 164, Rarity.COMMON, mage.cards.k.KessigFlamebreather.class)); cards.add(new SetCardInfo("Kessig Wolfrider", 165, Rarity.RARE, mage.cards.k.KessigWolfrider.class)); cards.add(new SetCardInfo("Kindly Ancestor", 22, Rarity.COMMON, mage.cards.k.KindlyAncestor.class)); + cards.add(new SetCardInfo("Lacerate Flesh", 166, Rarity.COMMON, mage.cards.l.LacerateFlesh.class)); cards.add(new SetCardInfo("Laid to Rest", 207, Rarity.UNCOMMON, mage.cards.l.LaidToRest.class)); cards.add(new SetCardInfo("Lambholt Raconteur", 167, Rarity.UNCOMMON, mage.cards.l.LambholtRaconteur.class)); cards.add(new SetCardInfo("Lambholt Ravager", 167, Rarity.UNCOMMON, mage.cards.l.LambholtRavager.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/Token.java b/Mage/src/main/java/mage/game/permanent/token/Token.java index dde696755f..f072d1cf88 100644 --- a/Mage/src/main/java/mage/game/permanent/token/Token.java +++ b/Mage/src/main/java/mage/game/permanent/token/Token.java @@ -27,6 +27,8 @@ public interface Token extends MageObject { void addAbility(Ability ability); + boolean putOntoBattlefield(int amount, Game game, Ability source); + boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId); boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId, boolean tapped, boolean attacking); diff --git a/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java b/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java index 5014b16350..80f75ae7a3 100644 --- a/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java +++ b/Mage/src/main/java/mage/game/permanent/token/TokenImpl.java @@ -3,7 +3,13 @@ package mage.game.permanent.token; import mage.MageObject; import mage.MageObjectImpl; import mage.abilities.Ability; +import mage.abilities.SpellAbility; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.keyword.EnchantAbility; import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.game.events.CreateTokenEvent; @@ -12,18 +18,11 @@ import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; import mage.game.permanent.PermanentToken; import mage.players.Player; +import mage.target.Target; import mage.util.RandomUtil; import java.util.*; -import mage.abilities.SpellAbility; -import mage.abilities.effects.Effect; -import mage.abilities.effects.common.AttachEffect; -import mage.abilities.keyword.EnchantAbility; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.target.Target; - public abstract class TokenImpl extends MageObjectImpl implements Token { protected String description; @@ -128,6 +127,11 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { abilities.addAll(ability.getSubAbilities()); } + @Override + public boolean putOntoBattlefield(int amount, Game game, Ability source) { + return this.putOntoBattlefield(amount, game, source, source.getControllerId()); + } + @Override public boolean putOntoBattlefield(int amount, Game game, Ability source, UUID controllerId) { return this.putOntoBattlefield(amount, game, source, controllerId, false, false); @@ -187,7 +191,7 @@ public abstract class TokenImpl extends MageObjectImpl implements Token { if (amountToRemove > 0) { game.informPlayers( "The token limit per player is " + MAX_TOKENS_PER_GAME + ", " + controller.getName() - + " will only create " + tokenSlots + " tokens." + + " will only create " + tokenSlots + " tokens." ); Iterator> it = event.getTokens().entrySet().iterator(); while (it.hasNext() && amountToRemove > 0) {