From 71a917a5d49b551e75521b18b388f30391a17313 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Fri, 6 Sep 2019 21:08:26 -0400 Subject: [PATCH] Implemented Steelclaw Lance --- .../src/mage/cards/b/BlackbladeReforged.java | 36 +++++----- .../src/mage/cards/s/SteelclawLance.java | 49 +++++++++++++ Mage.Sets/src/mage/sets/ThroneOfEldraine.java | 1 + .../abilities/keyword/EquipFilterAbility.java | 40 +++++++++++ .../keyword/EquipLegendaryAbility.java | 69 ------------------- 5 files changed, 110 insertions(+), 85 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/s/SteelclawLance.java create mode 100644 Mage/src/main/java/mage/abilities/keyword/EquipFilterAbility.java delete mode 100644 Mage/src/main/java/mage/abilities/keyword/EquipLegendaryAbility.java diff --git a/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java b/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java index 16ccb69fbd..a3ab6f157a 100644 --- a/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java +++ b/Mage.Sets/src/mage/cards/b/BlackbladeReforged.java @@ -5,30 +5,35 @@ */ package mage.cards.b; -import java.util.UUID; -import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; import mage.abilities.common.SimpleStaticAbility; -import mage.filter.common.FilterControlledLandPermanent; -import mage.filter.common.FilterControlledPermanent; -import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; import mage.abilities.keyword.EquipAbility; -import mage.abilities.keyword.EquipLegendaryAbility; +import mage.abilities.keyword.EquipFilterAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.SuperType; -import mage.constants.Zone; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.SupertypePredicate; + +import java.util.UUID; /** - * * @author Rystan */ public final class BlackbladeReforged extends CardImpl { - private static final FilterControlledPermanent filter = new FilterControlledLandPermanent(); + private static final DynamicValue count + = new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND); + private static final FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent("legendary creature"); + + static { + filter.add(new SupertypePredicate(SuperType.LEGENDARY)); + } public BlackbladeReforged(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); @@ -36,17 +41,16 @@ public final class BlackbladeReforged extends CardImpl { this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +1/+1 for each land you control. - PermanentsOnBattlefieldCount count = new PermanentsOnBattlefieldCount(filter); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(count, count))); // Equip legendary creature (3) - this.addAbility(new EquipLegendaryAbility(Outcome.AddAbility, new GenericManaCost(3))); + this.addAbility(new EquipFilterAbility(filter, new GenericManaCost(3))); // Equip {7} this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(7))); } - public BlackbladeReforged(final BlackbladeReforged card) { + private BlackbladeReforged(final BlackbladeReforged card) { super(card); } diff --git a/Mage.Sets/src/mage/cards/s/SteelclawLance.java b/Mage.Sets/src/mage/cards/s/SteelclawLance.java new file mode 100644 index 0000000000..ace1b7684f --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SteelclawLance.java @@ -0,0 +1,49 @@ +package mage.cards.s; + +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.GenericManaCost; +import mage.abilities.effects.common.continuous.BoostEquippedEffect; +import mage.abilities.keyword.EquipAbility; +import mage.abilities.keyword.EquipFilterAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.common.FilterControlledCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SteelclawLance extends CardImpl { + + private static final FilterControlledCreaturePermanent filter + = new FilterControlledCreaturePermanent(SubType.KNIGHT, "Knight"); + + public SteelclawLance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{B}{R}"); + + this.subtype.add(SubType.EQUIPMENT); + + // Equipped creature gets +2/+2. + this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(2, 2))); + + // Equip Knight {1} + this.addAbility(new EquipFilterAbility(filter, new GenericManaCost(1))); + + // Equip {3} + this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3))); + + } + + private SteelclawLance(final SteelclawLance card) { + super(card); + } + + @Override + public SteelclawLance copy() { + return new SteelclawLance(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java index b103a80535..917f8a9a6f 100644 --- a/Mage.Sets/src/mage/sets/ThroneOfEldraine.java +++ b/Mage.Sets/src/mage/sets/ThroneOfEldraine.java @@ -70,6 +70,7 @@ public final class ThroneOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Silverflame Ritual", 30, Rarity.COMMON, mage.cards.s.SilverflameRitual.class)); cards.add(new SetCardInfo("Slaying Fire", 143, Rarity.UNCOMMON, mage.cards.s.SlayingFire.class)); cards.add(new SetCardInfo("Steelbane Hydra", 322, Rarity.RARE, mage.cards.s.SteelbaneHydra.class)); + cards.add(new SetCardInfo("Steelclaw Lance", 202, Rarity.UNCOMMON, mage.cards.s.SteelclawLance.class)); cards.add(new SetCardInfo("Taste of Death", 320, Rarity.RARE, mage.cards.t.TasteOfDeath.class)); cards.add(new SetCardInfo("The Circle of Loyalty", 9, Rarity.MYTHIC, mage.cards.t.TheCircleOfLoyalty.class)); cards.add(new SetCardInfo("Thornwood Falls", 313, Rarity.COMMON, mage.cards.t.ThornwoodFalls.class)); diff --git a/Mage/src/main/java/mage/abilities/keyword/EquipFilterAbility.java b/Mage/src/main/java/mage/abilities/keyword/EquipFilterAbility.java new file mode 100644 index 0000000000..9941068604 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/keyword/EquipFilterAbility.java @@ -0,0 +1,40 @@ +package mage.abilities.keyword; + +import mage.abilities.ActivatedAbilityImpl; +import mage.abilities.costs.Cost; +import mage.abilities.effects.common.AttachEffect; +import mage.constants.Outcome; +import mage.constants.TimingRule; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * @author TheElk801 + */ +public class EquipFilterAbility extends ActivatedAbilityImpl { + + private final FilterControlledCreaturePermanent filter; + + public EquipFilterAbility(FilterControlledCreaturePermanent filter, Cost cost) { + super(Zone.BATTLEFIELD, new AttachEffect(Outcome.AddAbility, "Equip"), cost); + this.addTarget(new TargetControlledCreaturePermanent(filter)); + this.filter = filter; + this.timing = TimingRule.SORCERY; + } + + private EquipFilterAbility(final EquipFilterAbility ability) { + super(ability); + this.filter = ability.filter; + } + + @Override + public EquipFilterAbility copy() { + return new EquipFilterAbility(this); + } + + @Override + public String getRule() { + return "Equip " + filter.getMessage() + costs.getText() + manaCosts.getText(); + } +} diff --git a/Mage/src/main/java/mage/abilities/keyword/EquipLegendaryAbility.java b/Mage/src/main/java/mage/abilities/keyword/EquipLegendaryAbility.java deleted file mode 100644 index f7aac822fd..0000000000 --- a/Mage/src/main/java/mage/abilities/keyword/EquipLegendaryAbility.java +++ /dev/null @@ -1,69 +0,0 @@ - -package mage.abilities.keyword; - -import java.util.UUID; -import mage.abilities.ActivatedAbilityImpl; -import mage.abilities.costs.Cost; -import mage.abilities.effects.common.AttachEffect; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.SuperType; -import mage.constants.TimingRule; -import mage.constants.Zone; -import mage.filter.common.FilterControlledCreaturePermanent; -import mage.filter.predicate.mageobject.SupertypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.target.Target; -import mage.target.common.TargetControlledCreaturePermanent; - -/** - * @author Rystan - */ -public class EquipLegendaryAbility extends ActivatedAbilityImpl { - - private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("legendary creature you control"); - - static { - filter.add(new SupertypePredicate(SuperType.LEGENDARY)); - } - - public EquipLegendaryAbility(Outcome outcome, Cost cost) { - this(outcome, cost, new TargetControlledCreaturePermanent(filter)); - } - - public EquipLegendaryAbility(Outcome outcome, Cost cost, Target target) { - super(Zone.BATTLEFIELD, new AttachEffect(outcome, "Equip"), cost); - this.addTarget(target); - this.timing = TimingRule.SORCERY; - } - - @Override - public ActivationStatus canActivate(UUID playerId, Game game) { - ActivationStatus activationStatus = super.canActivate(playerId, game); - if (activationStatus.canActivate()) { - Permanent permanent = game.getPermanent(sourceId); - if (permanent != null && permanent.hasSubtype(SubType.EQUIPMENT, game)) { - return activationStatus; - } - } - return activationStatus; - } - - public EquipLegendaryAbility(final EquipLegendaryAbility ability) { - super(ability); - } - - @Override - public EquipLegendaryAbility copy() { - return new EquipLegendaryAbility(this); - } - - @Override - public String getRule() { - return "Equip legendary creature " + costs.getText() - + manaCosts.getText() + " (" + manaCosts.getText() - + ": Attach to target legendary creature you control. Equip only as a sorcery.)"; - } - -}