mirror of
https://github.com/correl/mage.git
synced 2025-04-11 17:00:08 -09:00
[MID] Implemented Moonveil Regent
This commit is contained in:
parent
4c69286c14
commit
b8e9214a3f
2 changed files with 142 additions and 0 deletions
Mage.Sets/src/mage
141
Mage.Sets/src/mage/cards/m/MoonveilRegent.java
Normal file
141
Mage.Sets/src/mage/cards/m/MoonveilRegent.java
Normal file
|
@ -0,0 +1,141 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.costs.common.DiscardHandCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MoonveilRegent extends CardImpl {
|
||||
|
||||
public MoonveilRegent(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
|
||||
|
||||
this.subtype.add(SubType.DRAGON);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever you cast a spell, you may discard your hand. If you do, draw a card for each of that spell's colors.
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(
|
||||
new DrawCardSourceControllerEffect(MoonveilRegentSpellValue.instance)
|
||||
.setText("draw a card for each of that spell's colors"),
|
||||
new DiscardHandCost()
|
||||
), false));
|
||||
|
||||
// When Moonveil Regent dies, it deals X damage to any target, where X is the number of colors among permanents you control.
|
||||
Ability ability = new DiesSourceTriggeredAbility(new DamageTargetEffect(
|
||||
MoonveilRegentColorValue.instance
|
||||
).setText("it deals X damage to any target, where X is the number of colors among permanents you control"));
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private MoonveilRegent(final MoonveilRegent card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoonveilRegent copy() {
|
||||
return new MoonveilRegent(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum MoonveilRegentSpellValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Spell spell = (Spell) effect.getValue("spellCast");
|
||||
return spell != null ? spell.getColor(game).getColorCount() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoonveilRegentSpellValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
enum MoonveilRegentColorValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return getColorUnion(game, sourceAbility).getColorCount();
|
||||
}
|
||||
|
||||
static ObjectColor getColorUnion(Game game, Ability ability) {
|
||||
ObjectColor color = new ObjectColor();
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT, ability.getControllerId(), game
|
||||
)) {
|
||||
color.addColor(permanent.getColor(game));
|
||||
if (color.getColorCount() >= 5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoonveilRegentColorValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
enum MoonveilRegentHint implements Hint {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
ObjectColor color = MoonveilRegentColorValue.getColorUnion(game, ability);
|
||||
return "Colors among permanents you control: " + color.getColorCount() + (
|
||||
color.getColorCount() > 0
|
||||
? color
|
||||
.getColors()
|
||||
.stream()
|
||||
.map(ObjectColor::getDescription)
|
||||
.collect(Collectors.joining(", ", " (", ")")) : ""
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MoonveilRegentHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -193,6 +193,7 @@ public final class InnistradMidnightHunt extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Mask of Griselbrand", 111, Rarity.RARE, mage.cards.m.MaskOfGriselbrand.class));
|
||||
cards.add(new SetCardInfo("Might of the Old Ways", 189, Rarity.COMMON, mage.cards.m.MightOfTheOldWays.class));
|
||||
cards.add(new SetCardInfo("Moonsilver Key", 255, Rarity.UNCOMMON, mage.cards.m.MoonsilverKey.class));
|
||||
cards.add(new SetCardInfo("Moonveil Regent", 149, Rarity.MYTHIC, mage.cards.m.MoonveilRegent.class));
|
||||
cards.add(new SetCardInfo("Morbid Opportunist", 113, Rarity.UNCOMMON, mage.cards.m.MorbidOpportunist.class));
|
||||
cards.add(new SetCardInfo("Morkrut Behemoth", 114, Rarity.COMMON, mage.cards.m.MorkrutBehemoth.class));
|
||||
cards.add(new SetCardInfo("Morning Apparition", 28, Rarity.COMMON, mage.cards.m.MorningApparition.class));
|
||||
|
|
Loading…
Add table
Reference in a new issue