From bf1a51755065fa60d72344af3f0018a907b86f54 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:25:53 +0200 Subject: [PATCH] [BIG] Implement Generous Plunderer --- .../src/mage/cards/g/GenerousPlunderer.java | 104 ++++++++++++++++++ Mage.Sets/src/mage/sets/TheBigScore.java | 1 + 2 files changed, 105 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/g/GenerousPlunderer.java diff --git a/Mage.Sets/src/mage/cards/g/GenerousPlunderer.java b/Mage.Sets/src/mage/cards/g/GenerousPlunderer.java new file mode 100644 index 00000000000..a6fd6fcf314 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GenerousPlunderer.java @@ -0,0 +1,104 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.delayed.ReflexiveTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.CreateTokenTargetEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.keyword.MenaceAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactPermanent; +import mage.filter.predicate.permanent.DefendingPlayerControlsSourceAttackingPredicate; +import mage.game.Game; +import mage.game.permanent.token.TreasureToken; +import mage.target.common.TargetOpponent; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class GenerousPlunderer extends CardImpl { + + private static final FilterPermanent filter + = new FilterArtifactPermanent("artifacts permanents controlled by defending player"); + + static { + filter.add(DefendingPlayerControlsSourceAttackingPredicate.instance); + } + + private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter); + + public GenerousPlunderer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.ROGUE); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Menace + this.addAbility(new MenaceAbility()); + + // At the beginning of your upkeep, you may create a Treasure token. When you do, target opponent creates a tapped Treasure token. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GenerousPlundererEffect(), TargetController.YOU, true)); + + // Whenever Generous Plunderer attacks, it deals damage to defending player equal to the number of artifacts they control. + this.addAbility(new AttacksTriggeredAbility( + new DamageTargetEffect(xValue), false, + "Whenever {this} attacks, it deals damage to defending player equal to the number of artifacts they control.", + SetTargetPointer.PLAYER + )); + } + + private GenerousPlunderer(final GenerousPlunderer card) { + super(card); + } + + @Override + public GenerousPlunderer copy() { + return new GenerousPlunderer(this); + } +} + +class GenerousPlundererEffect extends OneShotEffect { + + GenerousPlundererEffect() { + super(Outcome.Benefit); + staticText = "you may create a Treasure token. When you do, target opponent creates a tapped Treasure token."; + } + + private GenerousPlundererEffect(final GenerousPlundererEffect effect) { + super(effect); + } + + @Override + public GenerousPlundererEffect copy() { + return new GenerousPlundererEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + boolean flag = new CreateTokenEffect(new TreasureToken()) + .apply(game, source); + if (!flag) { + return false; + } + ReflexiveTriggeredAbility reflexive = new ReflexiveTriggeredAbility( + new CreateTokenTargetEffect(new TreasureToken(), 1, true), false + ); + reflexive.addTarget(new TargetOpponent()); + game.fireReflexiveTriggeredAbility(reflexive, source); + return true; + } + +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TheBigScore.java b/Mage.Sets/src/mage/sets/TheBigScore.java index 87fc43d993f..10a8d6bfe47 100644 --- a/Mage.Sets/src/mage/sets/TheBigScore.java +++ b/Mage.Sets/src/mage/sets/TheBigScore.java @@ -25,6 +25,7 @@ public final class TheBigScore extends ExpansionSet { cards.add(new SetCardInfo("Bristlebud Farmer", 17, Rarity.MYTHIC, mage.cards.b.BristlebudFarmer.class)); cards.add(new SetCardInfo("Collector's Cage", 1, Rarity.MYTHIC, mage.cards.c.CollectorsCage.class)); cards.add(new SetCardInfo("Esoteric Duplicator", 5, Rarity.MYTHIC, mage.cards.e.EsotericDuplicator.class)); + cards.add(new SetCardInfo("Generous Plunderer", 11, Rarity.MYTHIC, mage.cards.g.GenerousPlunderer.class)); cards.add(new SetCardInfo("Grand Abolisher", 2, Rarity.MYTHIC, mage.cards.g.GrandAbolisher.class)); cards.add(new SetCardInfo("Harvester of Misery", 9, Rarity.MYTHIC, mage.cards.h.HarvesterOfMisery.class)); cards.add(new SetCardInfo("Hostile Investigator", 10, Rarity.MYTHIC, mage.cards.h.HostileInvestigator.class));