Implemented Mistfolk

This commit is contained in:
Evan Kranzler 2018-10-10 21:05:01 -04:00
parent c95f5b55fc
commit 34e4012540
3 changed files with 87 additions and 3 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import mage.target.Target;
import mage.target.TargetSpell;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Mistfolk extends CardImpl {
private static final FilterSpell filter = new FilterSpell("spell that this creature");
static {
filter.add(MistfolkPredicate.instance);
}
public Mistfolk(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{U}");
this.subtype.add(SubType.ILLUSION);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {U}: Counter target spell that targets Mistfolk.
Ability ability = new SimpleActivatedAbility(
new CounterTargetEffect()
.setText("counter target spell that targets {this}"),
new ManaCostsImpl("{U}")
);
ability.addTarget(new TargetSpell(filter));
this.addAbility(ability);
}
public Mistfolk(final Mistfolk card) {
super(card);
}
@Override
public Mistfolk copy() {
return new Mistfolk(this);
}
}
enum MistfolkPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Spell>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
Permanent sourceObject = game.getPermanent(input.getSourceId());
if (sourceObject == null || input.getObject() == null) {
return false;
}
for (SpellAbility spellAbility : input.getObject().getSpellAbilities()) {
for (Mode mode : spellAbility.getModes().values()) {
for (Target target : spellAbility.getTargets()) {
if (target.getTargets().contains(input.getSourceId())) {
return true;
}
}
}
}
return false;
}
}

View file

@ -215,6 +215,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Mind Warp", 148, Rarity.UNCOMMON, mage.cards.m.MindWarp.class));
cards.add(new SetCardInfo("Minion of Leshrac", 150, Rarity.RARE, mage.cards.m.MinionOfLeshrac.class));
cards.add(new SetCardInfo("Minion of Tevesh Szat", 151, Rarity.RARE, mage.cards.m.MinionOfTeveshSzat.class));
cards.add(new SetCardInfo("Mistfolk", 84, Rarity.COMMON, mage.cards.m.Mistfolk.class));
cards.add(new SetCardInfo("Mole Worms", 152, Rarity.UNCOMMON, mage.cards.m.MoleWorms.class));
cards.add(new SetCardInfo("Monsoon", 298, Rarity.RARE, mage.cards.m.Monsoon.class));
cards.add(new SetCardInfo("Moor Fiend", 153, Rarity.COMMON, mage.cards.m.MoorFiend.class));

View file

@ -13,7 +13,6 @@ import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author TheElk801
*/
public class MentorAbility extends AttacksTriggeredAbility {
@ -22,7 +21,7 @@ public class MentorAbility extends AttacksTriggeredAbility {
static {
filter.add(new AttackingPredicate());
filter.add(new MentorAbilityPredicate());
filter.add(MentorAbilityPredicate.instance);
}
public MentorAbility() {
@ -46,7 +45,8 @@ public class MentorAbility extends AttacksTriggeredAbility {
}
class MentorAbilityPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
enum MentorAbilityPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {