[VOW] Implemented Hallowed Haunting

This commit is contained in:
Daniel Bomar 2021-10-31 10:38:08 -05:00
parent 0e2c58d35f
commit 3bac561d07
No known key found for this signature in database
GPG key ID: C86C8658F4023918
3 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,77 @@
package mage.cards.h;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.CompoundAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SpiritClericToken;
/**
*
* @author weirddan455
*/
public final class HallowedHaunting extends CardImpl {
private static final FilterSpell filter = new FilterSpell("an enchantment spell");
static {
filter.add(CardType.ENCHANTMENT.getPredicate());
}
public HallowedHaunting(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
// As long as you control seven or more enchantments, creatures you control have flying and vigilance.
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new GainAbilityControlledEffect(new CompoundAbility(FlyingAbility.getInstance(), VigilanceAbility.getInstance()), Duration.WhileOnBattlefield, StaticFilters.FILTER_PERMANENT_CREATURES),
HallowedHauntingCondition.instance,
"As long as you control seven or more enchantments, creatures you control have flying and vigilance"
)));
// Whenever you cast an enchantment spell, create a white Spirit Cleric creature token with "This creature's power and toughness are each equal to the number of Spirits you control."
this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new SpiritClericToken()), filter, false));
}
private HallowedHaunting(final HallowedHaunting card) {
super(card);
}
@Override
public HallowedHaunting copy() {
return new HallowedHaunting(this);
}
}
enum HallowedHauntingCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
int enchantments = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (permanent.getCardType(game).contains(CardType.ENCHANTMENT)) {
enchantments++;
if (enchantments >= 7) {
return true;
}
}
}
return false;
}
}

View file

@ -53,6 +53,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
cards.add(new SetCardInfo("Grolnok, the Omnivore", 238, Rarity.RARE, mage.cards.g.GrolnokTheOmnivore.class));
cards.add(new SetCardInfo("Gryff Rider", 15, Rarity.COMMON, mage.cards.g.GryffRider.class));
cards.add(new SetCardInfo("Halana and Alena, Partners", 239, Rarity.RARE, mage.cards.h.HalanaAndAlenaPartners.class));
cards.add(new SetCardInfo("Hallowed Haunting", 17, Rarity.MYTHIC, mage.cards.h.HallowedHaunting.class));
cards.add(new SetCardInfo("Island", 270, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Massive Might", 208, Rarity.COMMON, mage.cards.m.MassiveMight.class));
cards.add(new SetCardInfo("Mindleech Ghoul", 122, Rarity.COMMON, mage.cards.m.MindleechGhoul.class));

View file

@ -0,0 +1,72 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author weirddan455
*/
public class SpiritClericToken extends TokenImpl {
public SpiritClericToken() {
super("Spirit Cleric", "white Spirit Cleric creature token with \"This creature's power and toughness are each equal to the number of Spirits you control.\"");
cardType.add(CardType.CREATURE);
subtype.add(SubType.SPIRIT);
subtype.add(SubType.CLERIC);
color.setWhite(true);
power = new MageInt(0);
toughness = new MageInt(0);
this.addAbility(new SimpleStaticAbility(new SetPowerToughnessSourceEffect(SpiritClericTokenValue.instance, Duration.EndOfGame)));
}
private SpiritClericToken(final SpiritClericToken token) {
super(token);
}
@Override
public SpiritClericToken copy() {
return new SpiritClericToken(this);
}
}
enum SpiritClericTokenValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int spirits = 0;
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(sourceAbility.getControllerId())) {
if (permanent.hasSubtype(SubType.SPIRIT, game)) {
spirits++;
}
}
return spirits;
}
@Override
public SpiritClericTokenValue copy() {
return instance;
}
@Override
public String toString() {
return "X";
}
@Override
public String getMessage() {
return "Spirits you control";
}
}