mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[CLB] Implemented Moonshae Pixie
This commit is contained in:
parent
8d3c45007c
commit
92ddceef8f
2 changed files with 124 additions and 0 deletions
123
Mage.Sets/src/mage/cards/m/MoonshaePixie.java
Normal file
123
Mage.Sets/src/mage/cards/m/MoonshaePixie.java
Normal file
|
@ -0,0 +1,123 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.hint.ValueHint;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.AdventureCard;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MoonshaePixie extends AdventureCard {
|
||||
|
||||
private static final Hint hint = new ValueHint("Opponents dealt damage this turn", MoonshaePixieValue.instance);
|
||||
|
||||
public MoonshaePixie(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, new CardType[]{CardType.INSTANT}, "{3}{U}", "Pixie Dust", "{1}{U}");
|
||||
|
||||
this.subtype.add(SubType.FAERIE);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Moonshae Pixie enters the battlefield, draw cards equal to the number of opponents who were dealt combat damage this turn.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(MoonshaePixieValue.instance)
|
||||
.setText("draw cards equal to the number of opponents who were dealt combat damage this turn")
|
||||
), new MoonshaePixieWatcher());
|
||||
|
||||
// Pixie Dust
|
||||
// Up to three target creatures gain flying until end of turn.
|
||||
this.getSpellCard().getSpellAbility().addEffect(new GainAbilityTargetEffect(FlyingAbility.getInstance()));
|
||||
this.getSpellCard().getSpellAbility().addTarget(new TargetCreaturePermanent(0, 3));
|
||||
}
|
||||
|
||||
private MoonshaePixie(final MoonshaePixie card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoonshaePixie copy() {
|
||||
return new MoonshaePixie(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MoonshaePixieValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return MoonshaePixieWatcher.getDamaged(sourceAbility.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoonshaePixieValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
class MoonshaePixieWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> players = new HashSet<>();
|
||||
|
||||
MoonshaePixieWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||
&& ((DamagedEvent) event).isCombatDamage()) {
|
||||
players.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
players.clear();
|
||||
super.reset();
|
||||
}
|
||||
|
||||
static int getDamaged(UUID playerId, Game game) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(MoonshaePixieWatcher.class)
|
||||
.players
|
||||
.stream()
|
||||
.filter(game.getOpponents(playerId)::contains)
|
||||
.mapToInt(x -> 1)
|
||||
.sum();
|
||||
}
|
||||
}
|
|
@ -181,6 +181,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Minsc & Boo, Timeless Heroes", 285, Rarity.MYTHIC, mage.cards.m.MinscBooTimelessHeroes.class));
|
||||
cards.add(new SetCardInfo("Mold Folk", 133, Rarity.COMMON, mage.cards.m.MoldFolk.class));
|
||||
cards.add(new SetCardInfo("Monster Manual", 242, Rarity.RARE, mage.cards.m.MonsterManual.class));
|
||||
cards.add(new SetCardInfo("Moonshae Pixie", 84, Rarity.UNCOMMON, mage.cards.m.MoonshaePixie.class));
|
||||
cards.add(new SetCardInfo("Morphic Pool", 357, Rarity.RARE, mage.cards.m.MorphicPool.class));
|
||||
cards.add(new SetCardInfo("Moss Diamond", 327, Rarity.COMMON, mage.cards.m.MossDiamond.class));
|
||||
cards.add(new SetCardInfo("Mountain", 463, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
Loading…
Reference in a new issue