diff --git a/Mage.Sets/src/mage/cards/p/PyreswipeHawk.java b/Mage.Sets/src/mage/cards/p/PyreswipeHawk.java new file mode 100644 index 00000000000..36487417a63 --- /dev/null +++ b/Mage.Sets/src/mage/cards/p/PyreswipeHawk.java @@ -0,0 +1,99 @@ +package mage.cards.p; + +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.common.ExpendTriggeredAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.common.StaticValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.abilities.effects.common.continuous.GainControlTargetEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.target.common.TargetArtifactPermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class PyreswipeHawk extends CardImpl { + + public PyreswipeHawk(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}"); + + this.subtype.add(SubType.ELEMENTAL); + this.subtype.add(SubType.BIRD); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Haste + this.addAbility(HasteAbility.getInstance()); + + // Whenever Pyreswipe Hawk attacks, it gets +X/+0 until end of turn, where X is the greatest mana value among artifacts you control. + this.addAbility(new AttacksTriggeredAbility(new BoostSourceEffect( + PyreswipeHawkValue.instance, StaticValue.get(0), Duration.EndOfTurn, "it" + ))); + + // Whenever you expend 6, gain control of up to one target artifact for as long as you control Pyreswipe Hawk. + Ability ability = new ExpendTriggeredAbility( + new GainControlTargetEffect(Duration.WhileControlled), ExpendTriggeredAbility.Expend.SIX + ); + ability.addTarget(new TargetArtifactPermanent(0, 1)); + this.addAbility(ability); + } + + private PyreswipeHawk(final PyreswipeHawk card) { + super(card); + } + + @Override + public PyreswipeHawk copy() { + return new PyreswipeHawk(this); + } +} + +enum PyreswipeHawkValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game + .getBattlefield() + .getActivePermanents( + StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT, + sourceAbility.getControllerId(), sourceAbility, game + ) + .stream() + .mapToInt(MageObject::getManaValue) + .max() + .orElse(0); + } + + @Override + public PyreswipeHawkValue copy() { + return this; + } + + @Override + public String getMessage() { + return "the greatest mana value among artifacts you control"; + } + + @Override + public String toString() { + return "X"; + } +} diff --git a/Mage.Sets/src/mage/sets/BloomburrowCommander.java b/Mage.Sets/src/mage/sets/BloomburrowCommander.java index 2267fe832c9..45f204fc7b8 100644 --- a/Mage.Sets/src/mage/sets/BloomburrowCommander.java +++ b/Mage.Sets/src/mage/sets/BloomburrowCommander.java @@ -204,6 +204,7 @@ public final class BloomburrowCommander extends ExpansionSet { cards.add(new SetCardInfo("Psychosis Crawler", 282, Rarity.RARE, mage.cards.p.PsychosisCrawler.class)); cards.add(new SetCardInfo("Pull from Tomorrow", 172, Rarity.RARE, mage.cards.p.PullFromTomorrow.class)); cards.add(new SetCardInfo("Putrefy", 257, Rarity.UNCOMMON, mage.cards.p.Putrefy.class)); + cards.add(new SetCardInfo("Pyreswipe Hawk", 26, Rarity.RARE, mage.cards.p.PyreswipeHawk.class)); cards.add(new SetCardInfo("Raging Ravine", 324, Rarity.RARE, mage.cards.r.RagingRavine.class)); cards.add(new SetCardInfo("Rain of Riches", 200, Rarity.RARE, mage.cards.r.RainOfRiches.class)); cards.add(new SetCardInfo("Rampaging Baloths", 233, Rarity.MYTHIC, mage.cards.r.RampagingBaloths.class)); diff --git a/Mage/src/main/java/mage/abilities/common/ExpendTriggeredAbility.java b/Mage/src/main/java/mage/abilities/common/ExpendTriggeredAbility.java index da2306ef69d..f9e101a6552 100644 --- a/Mage/src/main/java/mage/abilities/common/ExpendTriggeredAbility.java +++ b/Mage/src/main/java/mage/abilities/common/ExpendTriggeredAbility.java @@ -27,10 +27,11 @@ public class ExpendTriggeredAbility extends TriggeredAbilityImpl { private static final Hint hint = new ValueHint("Mana you expended this turn", ExpendValue.instance); /** - * For memory-usage purpose, we only support expend 4 and expend 8 so far. + * For memory-usage purpose, we only support expend 4, expend 6, and expend 8 so far. */ public enum Expend { FOUR(4), + SIX(6), EIGHT(8); private final int amount; @@ -106,7 +107,7 @@ enum ExpendValue implements DynamicValue { /** * Watcher for mana expended this turn. *
- * Of note, to reduce memory usage, only tracks the events that did expend 4 and expend 8.
+ * Of note, to reduce memory usage, only tracks the events that did expend 4, expend 6, and expend 8.
* If expend N extends to more than a couple values, storing the full list (in order) of event id is advised.
*/
class ExpendWatcher extends Watcher {
@@ -116,6 +117,8 @@ class ExpendWatcher extends Watcher {
// Player id -> event id for the 4th mana expended this turn
private final Map