diff --git a/Mage.Sets/src/mage/cards/c/Cunning.java b/Mage.Sets/src/mage/cards/c/Cunning.java new file mode 100644 index 0000000000..505c10898a --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/Cunning.java @@ -0,0 +1,89 @@ +package mage.cards.c; + +import java.util.UUID; +import mage.constants.SubType; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.AttacksOrBlocksEnchantedTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextCleanupDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.abilities.effects.common.continuous.BoostEnchantedEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +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; + +/** + * + * @author jeffwadsworth + */ +public final class Cunning extends CardImpl { + + public Cunning(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature gets +3/+3. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(3, 3))); + + // When enchanted creature attacks or blocks, sacrifice Cunning at the beginning of the next cleanup step. + this.addAbility(new AttacksOrBlocksEnchantedTriggeredAbility(Zone.BATTLEFIELD, + new SacrificeSourceBeginningCleanupStepEffect())); + } + + public Cunning(final Cunning card) { + super(card); + } + + @Override + public Cunning copy() { + return new Cunning(this); + } +} + +class SacrificeSourceBeginningCleanupStepEffect extends OneShotEffect { + + public SacrificeSourceBeginningCleanupStepEffect() { + super(Outcome.Sacrifice); + this.staticText = "sacrifice {this} at the beginning of the next cleanup step"; + } + + public SacrificeSourceBeginningCleanupStepEffect(final SacrificeSourceBeginningCleanupStepEffect effect) { + super(effect); + } + + @Override + public SacrificeSourceBeginningCleanupStepEffect copy() { + return new SacrificeSourceBeginningCleanupStepEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent cunning = game.getPermanent(source.getSourceId()); + if (cunning != null) { + DelayedTriggeredAbility delayedAbility + = new AtTheBeginOfNextCleanupDelayedTriggeredAbility( + new SacrificeSourceEffect()); + game.addDelayedTriggeredAbility(delayedAbility, source); + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/cards/g/Grollub.java b/Mage.Sets/src/mage/cards/g/Grollub.java new file mode 100644 index 0000000000..b014a76b8e --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/Grollub.java @@ -0,0 +1,76 @@ +package mage.cards.g; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealtDamageToSourceTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.constants.SubType; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author jeffwadsworth + */ +public final class Grollub extends CardImpl { + + public Grollub(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.BEAST); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever Grollub is dealt damage, each opponent gains that much life. + this.addAbility(new DealtDamageToSourceTriggeredAbility( + Zone.BATTLEFIELD, + new EachOpponentGainsLifeEffect(), false, false, true)); + + } + + public Grollub(final Grollub card) { + super(card); + } + + @Override + public Grollub copy() { + return new Grollub(this); + } +} + +class EachOpponentGainsLifeEffect extends OneShotEffect { + + public EachOpponentGainsLifeEffect() { + super(Outcome.Neutral); + this.staticText = "each opponent gains that much life"; + } + + public EachOpponentGainsLifeEffect(final EachOpponentGainsLifeEffect effect) { + super(effect); + } + + @Override + public EachOpponentGainsLifeEffect copy() { + return new EachOpponentGainsLifeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + for (UUID opponentId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player opponent = game.getPlayer(opponentId); + if (opponent != null) { + int amount = (Integer) getValue("damage"); + if (amount > 0) { + opponent.gainLife(amount, game, source); + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/Exodus.java b/Mage.Sets/src/mage/sets/Exodus.java index d6687e6cae..8ee7f6a6ed 100644 --- a/Mage.Sets/src/mage/sets/Exodus.java +++ b/Mage.Sets/src/mage/sets/Exodus.java @@ -45,6 +45,7 @@ public final class Exodus extends ExpansionSet { cards.add(new SetCardInfo("Convalescence", 5, Rarity.RARE, mage.cards.c.Convalescence.class)); cards.add(new SetCardInfo("Crashing Boars", 108, Rarity.UNCOMMON, mage.cards.c.CrashingBoars.class)); cards.add(new SetCardInfo("Culling the Weak", 55, Rarity.COMMON, mage.cards.c.CullingTheWeak.class)); + cards.add(new SetCardInfo("Cunning", 28, Rarity.COMMON, mage.cards.c.Cunning.class)); cards.add(new SetCardInfo("Curiosity", 29, Rarity.UNCOMMON, mage.cards.c.Curiosity.class)); cards.add(new SetCardInfo("Cursed Flesh", 56, Rarity.COMMON, mage.cards.c.CursedFlesh.class)); cards.add(new SetCardInfo("Dauthi Cutthroat", 57, Rarity.UNCOMMON, mage.cards.d.DauthiCutthroat.class)); @@ -66,6 +67,7 @@ public final class Exodus extends ExpansionSet { cards.add(new SetCardInfo("Forbid", 35, Rarity.UNCOMMON, mage.cards.f.Forbid.class)); cards.add(new SetCardInfo("Fugue", 62, Rarity.UNCOMMON, mage.cards.f.Fugue.class)); cards.add(new SetCardInfo("Furnace Brood", 84, Rarity.COMMON, mage.cards.f.FurnaceBrood.class)); + cards.add(new SetCardInfo("Grollub", 63, Rarity.COMMON, mage.cards.g.Grollub.class)); cards.add(new SetCardInfo("Hatred", 64, Rarity.RARE, mage.cards.h.Hatred.class)); cards.add(new SetCardInfo("High Ground", 7, Rarity.UNCOMMON, mage.cards.h.HighGround.class)); cards.add(new SetCardInfo("Jackalope Herd", 111, Rarity.COMMON, mage.cards.j.JackalopeHerd.class));