forked from External/mage
[BLC] Implement Pyreswipe Hawk
This commit is contained in:
parent
65164ec23d
commit
1cf91b0b2d
3 changed files with 112 additions and 2 deletions
99
Mage.Sets/src/mage/cards/p/PyreswipeHawk.java
Normal file
99
Mage.Sets/src/mage/cards/p/PyreswipeHawk.java
Normal file
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
* <p>
|
||||
* 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<UUID, UUID> eventFor4thExpend = new HashMap<>();
|
||||
// Player id -> event id for the 6th mana expended this turn
|
||||
private final Map<UUID, UUID> eventFor6thExpend = new HashMap<>();
|
||||
// Player id -> event id for the 8th mana expended this turn
|
||||
private final Map<UUID, UUID> eventFor8thExpend = new HashMap<>();
|
||||
|
||||
|
|
@ -141,6 +144,9 @@ class ExpendWatcher extends Watcher {
|
|||
case 4:
|
||||
eventFor4thExpend.put(playerId, eventId);
|
||||
break;
|
||||
case 6:
|
||||
eventFor6thExpend.put(playerId, eventId);
|
||||
break;
|
||||
case 8:
|
||||
eventFor8thExpend.put(playerId, eventId);
|
||||
break;
|
||||
|
|
@ -152,6 +158,7 @@ class ExpendWatcher extends Watcher {
|
|||
super.reset();
|
||||
manaExpended.clear();
|
||||
eventFor4thExpend.clear();
|
||||
eventFor6thExpend.clear();
|
||||
eventFor8thExpend.clear();
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +171,9 @@ class ExpendWatcher extends Watcher {
|
|||
case FOUR:
|
||||
return watcher.eventFor4thExpend.containsKey(playerId)
|
||||
&& watcher.eventFor4thExpend.get(playerId).equals(event.getId());
|
||||
case SIX:
|
||||
return watcher.eventFor6thExpend.containsKey(playerId)
|
||||
&& watcher.eventFor6thExpend.get(playerId).equals(event.getId());
|
||||
case EIGHT:
|
||||
return watcher.eventFor8thExpend.containsKey(playerId)
|
||||
&& watcher.eventFor8thExpend.get(playerId).equals(event.getId());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue