From c0aeb44e5b61dc9bab3bad9c5d54187435637f83 Mon Sep 17 00:00:00 2001 From: "Alex W. Jackson" Date: Sat, 10 Sep 2022 03:27:41 -0400 Subject: [PATCH] [TOR] Implemented Carrion Rats and Carrion Wurm --- Mage.Sets/src/mage/cards/c/CarrionRats.java | 91 +++++++++++++++++++ Mage.Sets/src/mage/cards/c/CarrionWurm.java | 91 +++++++++++++++++++ Mage.Sets/src/mage/sets/HachetteUK.java | 7 +- Mage.Sets/src/mage/sets/Torment.java | 2 + .../common/TargetCardInYourGraveyard.java | 8 +- 5 files changed, 193 insertions(+), 6 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/c/CarrionRats.java create mode 100644 Mage.Sets/src/mage/cards/c/CarrionWurm.java diff --git a/Mage.Sets/src/mage/cards/c/CarrionRats.java b/Mage.Sets/src/mage/cards/c/CarrionRats.java new file mode 100644 index 0000000000..f4bf588006 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CarrionRats.java @@ -0,0 +1,91 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksOrBlocksTriggeredAbility; +import mage.abilities.costs.common.ExileFromGraveCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.AssignNoCombatDamageSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * + * @author awjackson + */ +public final class CarrionRats extends CardImpl { + + public CarrionRats(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}"); + this.subtype.add(SubType.RAT); + + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever Carrion Rats attacks or blocks, any player may exile a card from their graveyard. + // If a player does, Carrion Rats assigns no combat damage this turn. + this.addAbility(new AttacksOrBlocksTriggeredAbility(new CarrionRatsEffect(), false)); + } + + private CarrionRats(final CarrionRats card) { + super(card); + } + + @Override + public CarrionRats copy() { + return new CarrionRats(this); + } +} + +class CarrionRatsEffect extends OneShotEffect { + + public CarrionRatsEffect() { + super(Outcome.Neutral); + this.staticText = "any player may exile a card from their graveyard. If a player does, {this} assigns no combat damage this turn"; + } + + public CarrionRatsEffect(final CarrionRatsEffect effect) { + super(effect); + } + + @Override + public CarrionRatsEffect copy() { + return new CarrionRatsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentOrLKI(game); + if (permanent == null) { + return false; + } + ExileFromGraveCost cost = new ExileFromGraveCost(new TargetCardInYourGraveyard()); + String message = "Exile a card from your graveyard to have " + permanent.getIdName() + " assign no combat damage?"; + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + cost.clearPaid(); + if (player != null + && player.canRespond() + && cost.canPay(source, source, playerId, game) + && player.chooseUse(Outcome.Benefit, message, source, game) + && cost.pay(source, game, source, playerId, false, null)) { + if (!game.isSimulation()) { + game.informPlayers(player.getLogName() + " exiles a card to have " + permanent.getLogName() + " assign no combat damage."); + } + game.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn), source); + break; + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/cards/c/CarrionWurm.java b/Mage.Sets/src/mage/cards/c/CarrionWurm.java new file mode 100644 index 0000000000..cfe96d1419 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CarrionWurm.java @@ -0,0 +1,91 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksOrBlocksTriggeredAbility; +import mage.abilities.costs.common.ExileFromGraveCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.AssignNoCombatDamageSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * + * @author awjackson + */ +public final class CarrionWurm extends CardImpl { + + public CarrionWurm(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}{B}"); + this.subtype.add(SubType.ZOMBIE, SubType.WURM); + + this.power = new MageInt(6); + this.toughness = new MageInt(5); + + // Whenever Carrion Wurm attacks or blocks, any player may exile three cards from their graveyard. + // If a player does, Carrion Wurm assigns no combat damage this turn. + this.addAbility(new AttacksOrBlocksTriggeredAbility(new CarrionWurmEffect(), false)); + } + + private CarrionWurm(final CarrionWurm card) { + super(card); + } + + @Override + public CarrionWurm copy() { + return new CarrionWurm(this); + } +} + +class CarrionWurmEffect extends OneShotEffect { + + public CarrionWurmEffect() { + super(Outcome.Neutral); + this.staticText = "any player may exile three cards from their graveyard. If a player does, {this} assigns no combat damage this turn"; + } + + public CarrionWurmEffect(final CarrionWurmEffect effect) { + super(effect); + } + + @Override + public CarrionWurmEffect copy() { + return new CarrionWurmEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = source.getSourcePermanentOrLKI(game); + if (permanent == null) { + return false; + } + ExileFromGraveCost cost = new ExileFromGraveCost(new TargetCardInYourGraveyard(3)); + String message = "Exile three cards from your graveyard to have " + permanent.getIdName() + " assign no combat damage?"; + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + cost.clearPaid(); + if (player != null + && player.canRespond() + && cost.canPay(source, source, playerId, game) + && player.chooseUse(Outcome.Benefit, message, source, game) + && cost.pay(source, game, source, playerId, false, null)) { + if (!game.isSimulation()) { + game.informPlayers(player.getLogName() + " exiles three cards to have " + permanent.getLogName() + " assign no combat damage."); + } + game.addEffect(new AssignNoCombatDamageSourceEffect(Duration.EndOfTurn), source); + break; + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/HachetteUK.java b/Mage.Sets/src/mage/sets/HachetteUK.java index d5ec98b5b7..de7d2388ea 100644 --- a/Mage.Sets/src/mage/sets/HachetteUK.java +++ b/Mage.Sets/src/mage/sets/HachetteUK.java @@ -21,10 +21,9 @@ public class HachetteUK extends ExpansionSet { this.hasBasicLands = true; cards.add(new SetCardInfo("Betrayal of Flesh", 52, Rarity.UNCOMMON, mage.cards.b.BetrayalOfFlesh.class)); - // Card not implemented - // cards.add(new SetCardInfo("Carrion Rats", 40, Rarity.COMMON, mage.cards.c.CarrionRats.class, NON_FULL_USE_VARIOUS)); - // cards.add(new SetCardInfo("Carrion Rats", 41, Rarity.COMMON, mage.cards.c.CarrionRats.class, NON_FULL_USE_VARIOUS)); - // cards.add(new SetCardInfo("Carrion Rats", 53, Rarity.COMMON, mage.cards.c.CarrionRats.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Carrion Rats", 40, Rarity.COMMON, mage.cards.c.CarrionRats.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Carrion Rats", 41, Rarity.COMMON, mage.cards.c.CarrionRats.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Carrion Rats", 53, Rarity.COMMON, mage.cards.c.CarrionRats.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Chittering Rats", 5, Rarity.COMMON, mage.cards.c.ChitteringRats.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Chittering Rats", 19, Rarity.COMMON, mage.cards.c.ChitteringRats.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Chittering Rats", 54, Rarity.COMMON, mage.cards.c.ChitteringRats.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage.Sets/src/mage/sets/Torment.java b/Mage.Sets/src/mage/sets/Torment.java index e9eb791d21..f6bf726014 100644 --- a/Mage.Sets/src/mage/sets/Torment.java +++ b/Mage.Sets/src/mage/sets/Torment.java @@ -47,6 +47,8 @@ public final class Torment extends ExpansionSet { cards.add(new SetCardInfo("Cabal Ritual", 51, Rarity.COMMON, mage.cards.c.CabalRitual.class)); cards.add(new SetCardInfo("Cabal Surgeon", 52, Rarity.COMMON, mage.cards.c.CabalSurgeon.class)); cards.add(new SetCardInfo("Cabal Torturer", 53, Rarity.COMMON, mage.cards.c.CabalTorturer.class)); + cards.add(new SetCardInfo("Carrion Rats", 54, Rarity.COMMON, mage.cards.c.CarrionRats.class)); + cards.add(new SetCardInfo("Carrion Wurm", 55, Rarity.UNCOMMON, mage.cards.c.CarrionWurm.class)); cards.add(new SetCardInfo("Centaur Chieftain", 122, Rarity.UNCOMMON, mage.cards.c.CentaurChieftain.class)); cards.add(new SetCardInfo("Centaur Veteran", 123, Rarity.COMMON, mage.cards.c.CentaurVeteran.class)); cards.add(new SetCardInfo("Cephalid Aristocrat", 27, Rarity.COMMON, mage.cards.c.CephalidAristocrat.class)); diff --git a/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java b/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java index d5a0cadf25..382decab56 100644 --- a/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java +++ b/Mage/src/main/java/mage/target/common/TargetCardInYourGraveyard.java @@ -21,11 +21,15 @@ import mage.target.TargetCard; public class TargetCardInYourGraveyard extends TargetCard { public TargetCardInYourGraveyard() { - this(1, 1, StaticFilters.FILTER_CARD_FROM_YOUR_GRAVEYARD); + this(1); + } + + public TargetCardInYourGraveyard(int numTargets) { + this(numTargets, numTargets); } public TargetCardInYourGraveyard(FilterCard filter) { - this(1, 1, filter); + this(1, filter); } public TargetCardInYourGraveyard(int numTargets, FilterCard filter) {