From 42e00b7a37abd1d9998edf988d27dbb81eeb813d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 30 Oct 2020 21:12:04 -0400 Subject: [PATCH] [CMR] Implemented Fall from Favor --- Mage.Sets/src/mage/cards/f/FallFromFavor.java | 69 +++++++++++++++++++ Mage.Sets/src/mage/sets/CommanderLegends.java | 1 + 2 files changed, 70 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/f/FallFromFavor.java diff --git a/Mage.Sets/src/mage/cards/f/FallFromFavor.java b/Mage.Sets/src/mage/cards/f/FallFromFavor.java new file mode 100644 index 0000000000..ab19e5b6fc --- /dev/null +++ b/Mage.Sets/src/mage/cards/f/FallFromFavor.java @@ -0,0 +1,69 @@ +package mage.cards.f; + +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.BecomesMonarchSourceEffect; +import mage.abilities.effects.common.DontUntapInControllersUntapStepEnchantedEffect; +import mage.abilities.effects.common.TapEnchantedEffect; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.game.Game; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class FallFromFavor extends CardImpl { + + public FallFromFavor(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{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); + + // When Fall from Favor enters the battlefield, tap enchanted creature and you become the monarch. + ability = new EntersBattlefieldTriggeredAbility(new TapEnchantedEffect()); + ability.addEffect(new BecomesMonarchSourceEffect().concatBy("and")); + this.addAbility(ability); + + // Enchanted creature doesn't untap during its controller's untap step unless that player is the monarch. + this.addAbility(new SimpleStaticAbility(new ConditionalContinuousRuleModifyingEffect( + new DontUntapInControllersUntapStepEnchantedEffect(), FallFromFavorCondition.instance + ).setText("enchanted creature doesn't untap during its controller's untap step unless that player is the monarch"))); + } + + private FallFromFavor(final FallFromFavor card) { + super(card); + } + + @Override + public FallFromFavor copy() { + return new FallFromFavor(this); + } +} + +enum FallFromFavorCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getActivePlayerId().equals(game.getActivePlayerId()); + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegends.java b/Mage.Sets/src/mage/sets/CommanderLegends.java index 789797c984..78762eeef6 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegends.java +++ b/Mage.Sets/src/mage/sets/CommanderLegends.java @@ -60,6 +60,7 @@ public final class CommanderLegends extends ExpansionSet { cards.add(new SetCardInfo("Entourage of Trest", 224, Rarity.COMMON, mage.cards.e.EntourageOfTrest.class)); cards.add(new SetCardInfo("Exquisite Huntmaster", 122, Rarity.COMMON, mage.cards.e.ExquisiteHuntmaster.class)); cards.add(new SetCardInfo("Eyeblight Cullers", 124, Rarity.COMMON, mage.cards.e.EyeblightCullers.class)); + cards.add(new SetCardInfo("Fall from Favor", 68, Rarity.COMMON, mage.cards.f.FallFromFavor.class)); cards.add(new SetCardInfo("Farhaven Elf", 225, Rarity.COMMON, mage.cards.f.FarhavenElf.class)); cards.add(new SetCardInfo("First Response", 22, Rarity.UNCOMMON, mage.cards.f.FirstResponse.class)); cards.add(new SetCardInfo("Fleshbag Marauder", 128, Rarity.COMMON, mage.cards.f.FleshbagMarauder.class));