[TOR] Implemented Carrion Rats and Carrion Wurm

This commit is contained in:
Alex W. Jackson 2022-09-10 03:27:41 -04:00
parent b5ccc44afc
commit c0aeb44e5b
5 changed files with 193 additions and 6 deletions

View file

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

View file

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

View file

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

View file

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

View file

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