diff --git a/Mage.Sets/src/mage/cards/j/JaredCarthalion.java b/Mage.Sets/src/mage/cards/j/JaredCarthalion.java new file mode 100644 index 0000000000..240a34231c --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JaredCarthalion.java @@ -0,0 +1,132 @@ +package mage.cards.j; + +import mage.abilities.Ability; +import mage.abilities.LoyaltyAbility; +import mage.abilities.common.CanBeYourCommanderAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.MulticoloredPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.KavuAllColorToken; +import mage.game.permanent.token.TreasureToken; +import mage.players.Player; +import mage.target.common.TargetCardInYourGraveyard; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class JaredCarthalion extends CardImpl { + + private static final FilterCard filter = new FilterCard("multicolored card from your graveyard"); + + static { + filter.add(MulticoloredPredicate.instance); + } + + public JaredCarthalion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{W}{U}{B}{R}{G}"); + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.JARED); + + this.setStartingLoyalty(5); + + // +1: Create a 3/3 Kavu creature token with trample that's all colors. + this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new KavuAllColorToken()), 1)); + + // −3: Choose up to two target creatures. For each of them, put a number of +1/+1 counters on it equal to the number of colors it is. + Ability ability1 = new LoyaltyAbility(new JaredCarthalionBoostEffect(), -3); + ability1.addTarget(new TargetCreaturePermanent(0, 2)); + this.addAbility(ability1); + + // −6: Return target multicolored card from your graveyard to your hand. If that card was all colors, draw a card and create two Treasure tokens. + Ability ability2 = new LoyaltyAbility(new JaredCarthalionUltimateEffect(), -6); + ability2.addTarget(new TargetCardInYourGraveyard(filter)); + this.addAbility(ability2); + + // Jared Carthalion can be your commander. + this.addAbility(CanBeYourCommanderAbility.getInstance()); + } + + private JaredCarthalion(final JaredCarthalion card) { + super(card); + } + + @Override + public JaredCarthalion copy() { + return new JaredCarthalion(this); + } +} + +class JaredCarthalionBoostEffect extends OneShotEffect { + + public JaredCarthalionBoostEffect() { + super(Outcome.BoostCreature); + this.staticText = "Choose up to two target creatures. For each of them, put " + + "a number of +1/+1 counters on it equal to the number of colors it is."; + } + + public JaredCarthalionBoostEffect(final JaredCarthalionBoostEffect effect) { + super(effect); + } + + @Override + public JaredCarthalionBoostEffect copy() { + return new JaredCarthalionBoostEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID targetId : getTargetPointer().getTargets(game, source)) { + Permanent creature = game.getPermanent(targetId); + if (creature != null && creature.getColor().getColorCount() != 0) { + Counter counter = CounterType.P1P1.createInstance(creature.getColor().getColorCount()); + creature.addCounters(counter, source, game); + } + } + return true; + } +} + +class JaredCarthalionUltimateEffect extends OneShotEffect { + + public JaredCarthalionUltimateEffect() { + super(Outcome.Benefit); + this.staticText = "Return target multicolored card from your graveyard to your hand. " + + "If that card was all colors, draw a card and create two Treasure tokens."; + } + + public JaredCarthalionUltimateEffect(final JaredCarthalionUltimateEffect effect) { + super(effect); + } + + @Override + public JaredCarthalionUltimateEffect copy() { + return new JaredCarthalionUltimateEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Card card = game.getCard(targetPointer.getFirst(game, source)); + if (controller != null && card != null) { + if (controller.moveCards(card, Zone.HAND, source, game) + && card.getColor().getColorCount() == 5) { + controller.drawCards(1, source, game); + new TreasureToken().putOntoBattlefield(2, game, source); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java b/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java index 02b27bf88d..977d801608 100644 --- a/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java +++ b/Mage.Sets/src/mage/sets/DominariaUnitedCommander.java @@ -97,6 +97,8 @@ public final class DominariaUnitedCommander extends ExpansionSet { cards.add(new SetCardInfo("Illuna, Apex of Wishes", 154, Rarity.MYTHIC, mage.cards.i.IllunaApexOfWishes.class)); cards.add(new SetCardInfo("Iridian Maelstrom", 12, Rarity.RARE, mage.cards.i.IridianMaelstrom.class)); cards.add(new SetCardInfo("Jazal Goldmane", 102, Rarity.MYTHIC, mage.cards.j.JazalGoldmane.class)); + cards.add(new SetCardInfo("Jared Carthalion", 2, Rarity.MYTHIC, mage.cards.j.JaredCarthalion.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Jared Carthalion", 50, Rarity.MYTHIC, mage.cards.j.JaredCarthalion.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Jedit Ojanen, Mercenary", 34, Rarity.MYTHIC, mage.cards.j.JeditOjanenMercenary.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Jedit Ojanen, Mercenary", 56, Rarity.MYTHIC, mage.cards.j.JeditOjanenMercenary.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Jenson Carthalion, Druid Exile", 3, Rarity.MYTHIC, mage.cards.j.JensonCarthalionDruidExile.class)); diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 22343f1863..83f200943e 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -436,6 +436,7 @@ public enum SubType { GRIST("Grist", SubTypeSet.PlaneswalkerType), HUATLI("Huatli", SubTypeSet.PlaneswalkerType), JACE("Jace", SubTypeSet.PlaneswalkerType), + JARED("Jared", SubTypeSet.PlaneswalkerType), JESKA("Jeska", SubTypeSet.PlaneswalkerType), KAITO("Kaito", SubTypeSet.PlaneswalkerType), KARN("Karn", SubTypeSet.PlaneswalkerType), diff --git a/Mage/src/main/java/mage/game/permanent/token/KavuAllColorToken.java b/Mage/src/main/java/mage/game/permanent/token/KavuAllColorToken.java new file mode 100644 index 0000000000..e74738573a --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/KavuAllColorToken.java @@ -0,0 +1,39 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.InfoEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; + +/** + * @author PurpleCrowbar + */ +public final class KavuAllColorToken extends TokenImpl { + + public KavuAllColorToken() { + super("Kavu Token", "3/3 Kavu creature token with trample that's all colors"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.KAVU); + color.setWhite(true); + color.setBlue(true); + color.setBlack(true); + color.setRed(true); + color.setGreen(true); + power = new MageInt(3); + toughness = new MageInt(3); + this.addAbility(TrampleAbility.getInstance()); + this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("This creature is all colors"))); + setOriginalExpansionSetCode("DMC"); + } + + public KavuAllColorToken(final KavuAllColorToken token) { + super(token); + } + + public KavuAllColorToken copy() { + return new KavuAllColorToken(this); + } +}