From ba28ee3a06a9e6356e89832f41d49c38692ef7ce Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 3 Jun 2018 20:24:35 -0400 Subject: [PATCH] Implemented Juju Bubble --- Mage.Sets/src/mage/cards/j/JujuBubble.java | 76 ++++++++++++++++++++++ Mage.Sets/src/mage/sets/Visions.java | 1 + 2 files changed, 77 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/j/JujuBubble.java diff --git a/Mage.Sets/src/mage/cards/j/JujuBubble.java b/Mage.Sets/src/mage/cards/j/JujuBubble.java new file mode 100644 index 00000000000..8521e56b82f --- /dev/null +++ b/Mage.Sets/src/mage/cards/j/JujuBubble.java @@ -0,0 +1,76 @@ +package mage.cards.j; + +import java.util.UUID; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.abilities.keyword.CumulativeUpkeepAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author TheElk801 + */ +public final class JujuBubble extends CardImpl { + + public JujuBubble(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}"); + + // Cumulative upkeep {1} + this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{1}"))); + + // When you play a card, sacrifice Juju Bubble. + this.addAbility(new JujuBubbleTriggeredAbility()); + + // {2}: You gain 1 life. + this.addAbility(new SimpleActivatedAbility(new GainLifeEffect(1), new GenericManaCost(1))); + } + + public JujuBubble(final JujuBubble card) { + super(card); + } + + @Override + public JujuBubble copy() { + return new JujuBubble(this); + } +} + +class JujuBubbleTriggeredAbility extends TriggeredAbilityImpl { + + JujuBubbleTriggeredAbility() { + super(Zone.BATTLEFIELD, new SacrificeSourceEffect(), false); + } + + JujuBubbleTriggeredAbility(final JujuBubbleTriggeredAbility ability) { + super(ability); + } + + @Override + public JujuBubbleTriggeredAbility copy() { + return new JujuBubbleTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SPELL_CAST || event.getType() == GameEvent.EventType.LAND_PLAYED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return event.getPlayerId().equals(this.getControllerId()); + } + + @Override + public String getRule() { + return "When you play a card, sacrifice {this}"; + } +} diff --git a/Mage.Sets/src/mage/sets/Visions.java b/Mage.Sets/src/mage/sets/Visions.java index e58c373ae8b..d2bfc1318e1 100644 --- a/Mage.Sets/src/mage/sets/Visions.java +++ b/Mage.Sets/src/mage/sets/Visions.java @@ -88,6 +88,7 @@ public final class Visions extends ExpansionSet { cards.add(new SetCardInfo("Inspiration", 35, Rarity.COMMON, mage.cards.i.Inspiration.class)); cards.add(new SetCardInfo("Iron-Heart Chimera", 146, Rarity.UNCOMMON, mage.cards.i.IronHeartChimera.class)); cards.add(new SetCardInfo("Jamuraan Lion", 10, Rarity.COMMON, mage.cards.j.JamuraanLion.class)); + cards.add(new SetCardInfo("Juju Bubble", 147, Rarity.UNCOMMON, mage.cards.j.JujuBubble.class)); cards.add(new SetCardInfo("Jungle Basin", 164, Rarity.UNCOMMON, mage.cards.j.JungleBasin.class)); cards.add(new SetCardInfo("Kaervek's Spite", 63, Rarity.RARE, mage.cards.k.KaerveksSpite.class)); cards.add(new SetCardInfo("Karoo", 165, Rarity.UNCOMMON, mage.cards.k.Karoo.class));