From 7c6dfe3e566617e16388a396d9ca919f632f9146 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 25 Jul 2018 12:39:06 -0400 Subject: [PATCH] Implemented Octopus Umbra --- Mage.Sets/src/mage/cards/o/OctopusUmbra.java | 76 +++++++++++++++++++ Mage.Sets/src/mage/sets/Commander2018.java | 1 + .../SetPowerToughnessEnchantedEffect.java | 18 ++++- 3 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/o/OctopusUmbra.java diff --git a/Mage.Sets/src/mage/cards/o/OctopusUmbra.java b/Mage.Sets/src/mage/cards/o/OctopusUmbra.java new file mode 100644 index 0000000000..148586f6fc --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OctopusUmbra.java @@ -0,0 +1,76 @@ +package mage.cards.o; + +import java.util.UUID; +import mage.constants.SubType; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.TapTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; +import mage.abilities.effects.common.continuous.SetPowerToughnessEnchantedEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.abilities.keyword.TotemArmorAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.ComparisonType; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.PowerPredicate; + +/** + * + * @author TheElk801 + */ +public final class OctopusUmbra extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with power 8 or less"); + + static { + filter.add(new PowerPredicate(ComparisonType.FEWER_THAN, 9)); + } + + public OctopusUmbra(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}{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 has base power and toughness 8/8 and has "Whenever this creature attacks, you may tap target creature with power 8 or less." + Ability abilityToAdd = new AttacksTriggeredAbility(new TapTargetEffect(), true); + abilityToAdd.addTarget(new TargetCreaturePermanent(filter)); + ability = new SimpleStaticAbility( + Zone.BATTLEFIELD, + new SetPowerToughnessEnchantedEffect(8, 8) + ); + ability.addEffect(new GainAbilityAttachedEffect( + abilityToAdd, AttachmentType.AURA + ).setText("and has \"Whenever this creature attacks, " + + "you may tap target creature with power 8 or less.\"")); + this.addAbility(ability); + + // Totem armor + this.addAbility(new TotemArmorAbility()); + + } + + public OctopusUmbra(final OctopusUmbra card) { + super(card); + } + + @Override + public OctopusUmbra copy() { + return new OctopusUmbra(this); + } +} diff --git a/Mage.Sets/src/mage/sets/Commander2018.java b/Mage.Sets/src/mage/sets/Commander2018.java index ff6c88e1d9..a1aaea2765 100644 --- a/Mage.Sets/src/mage/sets/Commander2018.java +++ b/Mage.Sets/src/mage/sets/Commander2018.java @@ -47,6 +47,7 @@ public final class Commander2018 extends ExpansionSet { cards.add(new SetCardInfo("Loyal Guardian", 31, Rarity.UNCOMMON, mage.cards.l.LoyalGuardian.class)); cards.add(new SetCardInfo("Loyal Subordinate", 16, Rarity.UNCOMMON, mage.cards.l.LoyalSubordinate.class)); cards.add(new SetCardInfo("Nesting Dragon", 24, Rarity.RARE, mage.cards.n.NestingDragon.class)); + cards.add(new SetCardInfo("Octopus Umbra", 11, Rarity.RARE, mage.cards.o.OctopusUmbra.class)); cards.add(new SetCardInfo("Rampaging Baloths", 158, Rarity.RARE, mage.cards.r.RampagingBaloths.class)); cards.add(new SetCardInfo("Retrofitter Foundry", 57, Rarity.RARE, mage.cards.r.RetrofitterFoundry.class)); cards.add(new SetCardInfo("Ruinous Path", 117, Rarity.RARE, mage.cards.r.RuinousPath.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessEnchantedEffect.java index e33d30a36d..a5f1cf72e3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/SetPowerToughnessEnchantedEffect.java @@ -1,4 +1,3 @@ - package mage.abilities.effects.common.continuous; import mage.abilities.Ability; @@ -16,13 +15,24 @@ import mage.game.permanent.Permanent; */ public class SetPowerToughnessEnchantedEffect extends ContinuousEffectImpl { + private final int power; + private final int toughness; + public SetPowerToughnessEnchantedEffect() { + this(0, 2); + } + + public SetPowerToughnessEnchantedEffect(int power, int toughness) { super(Duration.WhileOnBattlefield, Layer.PTChangingEffects_7, SubLayer.SetPT_7b, Outcome.BoostCreature); - staticText = "Enchanted creature has base power and toughness 0/2"; + staticText = "Enchanted creature has base power and toughness " + power + "/" + toughness; + this.power = power; + this.toughness = toughness; } public SetPowerToughnessEnchantedEffect(final SetPowerToughnessEnchantedEffect effect) { super(effect); + this.power = effect.power; + this.toughness = effect.toughness; } @Override @@ -36,8 +46,8 @@ public class SetPowerToughnessEnchantedEffect extends ContinuousEffectImpl { if (enchantment != null && enchantment.getAttachedTo() != null) { Permanent enchanted = game.getPermanent(enchantment.getAttachedTo()); if (enchanted != null) { - enchanted.getPower().setValue(0); - enchanted.getToughness().setValue(2); + enchanted.getPower().setValue(power); + enchanted.getToughness().setValue(toughness); } return true; }