From b246631db66ca1510822dc99fc56a565eb00d47c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 5 Nov 2022 15:15:02 -0400 Subject: [PATCH] [BRC] Implement Urza's Workshop --- Mage.Sets/src/mage/cards/u/UrzasWorkshop.java | 55 +++++++++++++++++++ .../mage/sets/TheBrothersWarCommander.java | 1 + .../java/mage/abilities/ActivatedAbility.java | 3 + .../mage/abilities/ActivatedAbilityImpl.java | 6 ++ 4 files changed, 65 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/u/UrzasWorkshop.java diff --git a/Mage.Sets/src/mage/cards/u/UrzasWorkshop.java b/Mage.Sets/src/mage/cards/u/UrzasWorkshop.java new file mode 100644 index 0000000000..5802f17335 --- /dev/null +++ b/Mage.Sets/src/mage/cards/u/UrzasWorkshop.java @@ -0,0 +1,55 @@ +package mage.cards.u; + +import mage.Mana; +import mage.abilities.condition.common.MetalcraftCondition; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.abilities.hint.common.MetalcraftHint; +import mage.abilities.mana.ColorlessManaAbility; +import mage.abilities.mana.DynamicManaAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.filter.common.FilterControlledLandPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class UrzasWorkshop extends CardImpl { + + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(new FilterControlledLandPermanent( + SubType.URZAS, "Urza's land you control. Activate only if you control three or more artifacts" + )); + private static final Hint hint = new ValueHint("Urza's lands you control", xValue); + + public UrzasWorkshop(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.LAND}, ""); + + this.subtype.add(SubType.URZAS); + + // {T}: Add {C}. + this.addAbility(new ColorlessManaAbility()); + + // Metalcraft -- {T}: Add {C} for each Urza's land you control. Activate only if you control three or more artifacts. + this.addAbility(new DynamicManaAbility(Mana.ColorlessMana(1), xValue, (String) null) + .setCondition(MetalcraftCondition.instance) + .setAbilityWord(AbilityWord.METALCRAFT) + .addHint(MetalcraftHint.instance) + .addHint(hint)); + } + + private UrzasWorkshop(final UrzasWorkshop card) { + super(card); + } + + @Override + public UrzasWorkshop copy() { + return new UrzasWorkshop(this); + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java b/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java index 12f1c2e837..6d9911deeb 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java @@ -168,6 +168,7 @@ public final class TheBrothersWarCommander extends ExpansionSet { cards.add(new SetCardInfo("Traxos, Scourge of Kroog", 170, Rarity.RARE, mage.cards.t.TraxosScourgeOfKroog.class)); cards.add(new SetCardInfo("Unbreakable Formation", 78, Rarity.RARE, mage.cards.u.UnbreakableFormation.class)); cards.add(new SetCardInfo("Urza's Ruinous Blast", 79, Rarity.RARE, mage.cards.u.UrzasRuinousBlast.class)); + cards.add(new SetCardInfo("Urza's Workshop", 28, Rarity.RARE, mage.cards.u.UrzasWorkshop.class)); cards.add(new SetCardInfo("Urza, Chief Artificer", 2, Rarity.MYTHIC, mage.cards.u.UrzaChiefArtificer.class)); cards.add(new SetCardInfo("Vault of Whispers", 211, Rarity.COMMON, mage.cards.v.VaultOfWhispers.class)); cards.add(new SetCardInfo("Vedalken Humiliator", 100, Rarity.RARE, mage.cards.v.VedalkenHumiliator.class)); diff --git a/Mage/src/main/java/mage/abilities/ActivatedAbility.java b/Mage/src/main/java/mage/abilities/ActivatedAbility.java index 61fe629ab1..6f0d7c4d7d 100644 --- a/Mage/src/main/java/mage/abilities/ActivatedAbility.java +++ b/Mage/src/main/java/mage/abilities/ActivatedAbility.java @@ -1,6 +1,7 @@ package mage.abilities; import mage.ApprovingObject; +import mage.abilities.condition.Condition; import mage.abilities.mana.ManaOptions; import mage.constants.TargetController; import mage.constants.TimingRule; @@ -83,4 +84,6 @@ public interface ActivatedAbility extends Ability { int getMaxActivationsPerTurn(Game game); public void setTiming(TimingRule timing); + + public ActivatedAbility setCondition(Condition condition); } diff --git a/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java b/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java index d92974b3e8..84fcc5ccff 100644 --- a/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java +++ b/Mage/src/main/java/mage/abilities/ActivatedAbilityImpl.java @@ -310,4 +310,10 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa game.getState().setValue(CardUtil .getCardZoneString("totalActivations" + originalId, sourceId, game), activationInfo.totalActivations); } + + @Override + public ActivatedAbilityImpl setCondition(Condition condition) { + this.condition = condition; + return this; + } }