From eee9fb9f251993878dc63665ea3ebb9b02edccc4 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Tue, 31 May 2022 09:19:33 -0400 Subject: [PATCH] [CLB] Implemented Contraband Livestock --- .../src/mage/cards/c/ContrabandLivestock.java | 81 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + .../game/permanent/token/OxGreenToken.java | 30 +++++++ 3 files changed, 112 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/ContrabandLivestock.java create mode 100644 Mage/src/main/java/mage/game/permanent/token/OxGreenToken.java diff --git a/Mage.Sets/src/mage/cards/c/ContrabandLivestock.java b/Mage.Sets/src/mage/cards/c/ContrabandLivestock.java new file mode 100644 index 0000000000..a2e77892bb --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ContrabandLivestock.java @@ -0,0 +1,81 @@ +package mage.cards.c; + +import mage.abilities.Ability; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.abilities.effects.common.RollDieWithResultTableEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.Boar2Token; +import mage.game.permanent.token.GoatToken; +import mage.game.permanent.token.OxGreenToken; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; +import mage.target.targetpointer.FixedTarget; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ContrabandLivestock extends CardImpl { + + public ContrabandLivestock(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{W}"); + + // Exile target creature, then roll a d20. + // 1-9 | That creature's controller creates a 4/4 green Ox creature token. + // 10-19 | That creature's controller creates a 2/2 green Boar creature token. + // 20 | That creature's controller creates a 0/1 white Goat creature token. + this.getSpellAbility().addEffect(new ContrabandLivestockEffect()); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + } + + private ContrabandLivestock(final ContrabandLivestock card) { + super(card); + } + + @Override + public ContrabandLivestock copy() { + return new ContrabandLivestock(this); + } +} + +class ContrabandLivestockEffect extends RollDieWithResultTableEffect { + + ContrabandLivestockEffect() { + super(20, "exile target creature, then roll a d20"); + this.addTableEntry(1, 9, new CreateTokenTargetEffect(new OxGreenToken()) + .setText("that creature's controller creates a 4/4 green Ox creature token")); + this.addTableEntry(10, 19, new CreateTokenTargetEffect(new Boar2Token()) + .setText("that creature's controller creates a 2/2 green Boar creature token")); + this.addTableEntry(20, 20, new CreateTokenTargetEffect(new GoatToken()) + .setText("that creature's controller creates a 0/1 white Goat creature token")); + } + + private ContrabandLivestockEffect(final ContrabandLivestockEffect effect) { + super(effect); + } + + @Override + public ContrabandLivestockEffect copy() { + return new ContrabandLivestockEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); + if (player == null || permanent == null) { + return false; + } + player.moveCards(permanent, Zone.EXILED, source, game); + int result = player.rollDice(outcome, source, game, sides); + this.setTargetPointer(new FixedTarget(permanent.getControllerId())); + this.applyResult(result, game, source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index f4e2aa9c8b..d91e7d1754 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -91,6 +91,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Cone of Cold", 61, Rarity.UNCOMMON, mage.cards.c.ConeOfCold.class)); cards.add(new SetCardInfo("Consuming Aberration", 640, Rarity.RARE, mage.cards.c.ConsumingAberration.class)); cards.add(new SetCardInfo("Contact Other Plane", 62, Rarity.COMMON, mage.cards.c.ContactOtherPlane.class)); + cards.add(new SetCardInfo("Contraband Livestock", 12, Rarity.UNCOMMON, mage.cards.c.ContrabandLivestock.class)); cards.add(new SetCardInfo("Criminal Past", 122, Rarity.UNCOMMON, mage.cards.c.CriminalPast.class)); cards.add(new SetCardInfo("Crystal Dragon", 13, Rarity.UNCOMMON, mage.cards.c.CrystalDragon.class)); cards.add(new SetCardInfo("Cultist of the Absolute", 123, Rarity.RARE, mage.cards.c.CultistOfTheAbsolute.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/OxGreenToken.java b/Mage/src/main/java/mage/game/permanent/token/OxGreenToken.java new file mode 100644 index 0000000000..fa12465aac --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/OxGreenToken.java @@ -0,0 +1,30 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class OxGreenToken extends TokenImpl { + + public OxGreenToken() { + super("Ox Token", "4/4 green Ox creature token"); + + cardType.add(CardType.CREATURE); + color.setGreen(true); + subtype.add(SubType.OX); + power = new MageInt(4); + toughness = new MageInt(4); + } + + public OxGreenToken(final OxGreenToken token) { + super(token); + } + + @Override + public OxGreenToken copy() { + return new OxGreenToken(this); + } +}