[VOW] Implemented Lacerate Flesh

This commit is contained in:
Evan Kranzler 2021-11-06 13:43:20 -04:00
parent 8b02badf33
commit fcc1481679
4 changed files with 85 additions and 9 deletions

View file

@ -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;
}
}

View file

@ -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));

View file

@ -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);

View file

@ -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<Map.Entry<Token, Integer>> it = event.getTokens().entrySet().iterator();
while (it.hasNext() && amountToRemove > 0) {