From 21fcea4ed5e2d1d7a6b214360aa14202a57e70ce Mon Sep 17 00:00:00 2001 From: theelk801 Date: Thu, 6 Apr 2023 09:32:14 -0400 Subject: [PATCH] [MOM] Implement Karsus Depthguard --- .../src/mage/cards/k/KarsusDepthguard.java | 67 +++++++++++++++++++ .../src/mage/sets/MarchOfTheMachine.java | 1 + 2 files changed, 68 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/k/KarsusDepthguard.java diff --git a/Mage.Sets/src/mage/cards/k/KarsusDepthguard.java b/Mage.Sets/src/mage/cards/k/KarsusDepthguard.java new file mode 100644 index 0000000000..316731c167 --- /dev/null +++ b/Mage.Sets/src/mage/cards/k/KarsusDepthguard.java @@ -0,0 +1,67 @@ +package mage.cards.k; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalAsThoughEffect; +import mage.abilities.effects.common.combat.CanAttackAsThoughItDidntHaveDefenderSourceEffect; +import mage.abilities.keyword.DefenderAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.game.Game; + +import java.util.Objects; +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class KarsusDepthguard extends CardImpl { + + public KarsusDepthguard(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}"); + + this.subtype.add(SubType.VIASHINO); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Defender + this.addAbility(DefenderAbility.getInstance()); + + // As long as Karsus Depthguard's power is 5 or greater, it can attack as though it didn't have defender. + this.addAbility(new SimpleStaticAbility(new ConditionalAsThoughEffect( + new CanAttackAsThoughItDidntHaveDefenderSourceEffect(Duration.WhileOnBattlefield), + KarsusDepthguardCondition.instance + ).setText("as long as {this}'s power is 5 or greater, it can attack as though it didn't have defender"))); + } + + private KarsusDepthguard(final KarsusDepthguard card) { + super(card); + } + + @Override + public KarsusDepthguard copy() { + return new KarsusDepthguard(this); + } +} + +enum KarsusDepthguardCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return Optional + .ofNullable(source.getSourcePermanentIfItStillExists(game)) + .filter(Objects::nonNull) + .map(MageObject::getPower) + .map(MageInt::getValue) + .orElse(0) >= 5; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java index 1900ed4af9..0d76f8d63c 100644 --- a/Mage.Sets/src/mage/sets/MarchOfTheMachine.java +++ b/Mage.Sets/src/mage/sets/MarchOfTheMachine.java @@ -110,6 +110,7 @@ public final class MarchOfTheMachine extends ExpansionSet { cards.add(new SetCardInfo("Joyful Stormsculptor", 243, Rarity.UNCOMMON, mage.cards.j.JoyfulStormsculptor.class)); cards.add(new SetCardInfo("Jungle Hollow", 270, Rarity.COMMON, mage.cards.j.JungleHollow.class)); cards.add(new SetCardInfo("Kami of Whispered Hopes", 196, Rarity.UNCOMMON, mage.cards.k.KamiOfWhisperedHopes.class)); + cards.add(new SetCardInfo("Karsus Depthguard", 150, Rarity.COMMON, mage.cards.k.KarsusDepthguard.class)); cards.add(new SetCardInfo("Khenra Spellspear", 151, Rarity.UNCOMMON, mage.cards.k.KhenraSpellspear.class)); cards.add(new SetCardInfo("Kitesail", 261, Rarity.COMMON, mage.cards.k.Kitesail.class)); cards.add(new SetCardInfo("Kithkin Billyrider", 24, Rarity.COMMON, mage.cards.k.KithkinBillyrider.class));