[C21] Implemented Felisa, Fang of Silverquill

This commit is contained in:
Evan Kranzler 2021-04-12 09:47:27 -04:00
parent c8e21a8c6a
commit e51ebbec93
3 changed files with 112 additions and 8 deletions

View file

@ -0,0 +1,104 @@
package mage.cards.f;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.MentorAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.counters.Counter;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.CounterAnyPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SilverquillToken;
import java.util.Map;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FelisaFangOfSilverquill extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledCreaturePermanent("nontoken creature you control");
static {
filter.add(Predicates.not(TokenPredicate.instance));
filter.add(CounterAnyPredicate.instance);
}
private static final String rule = "if it had counters on it, " +
"create X tapped 2/1 white and black Inkling creature tokens with flying, " +
"where X is the number of counters it had on it";
public FelisaFangOfSilverquill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.VAMPIRE);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Mentor
this.addAbility(new MentorAbility());
// Whenever a nontoken creature you control dies, if it had counters on it, create X tapped 2/1 white and black Inkling creature tokens with flying, where X is the number of counters it had on it.
this.addAbility(new DiesCreatureTriggeredAbility(new CreateTokenEffect(
new SilverquillToken(), FelisaFangOfSilverquillValue.instance, true, false
).setText(rule), false, filter));
}
private FelisaFangOfSilverquill(final FelisaFangOfSilverquill card) {
super(card);
}
@Override
public FelisaFangOfSilverquill copy() {
return new FelisaFangOfSilverquill(this);
}
}
enum FelisaFangOfSilverquillValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent permanent = (Permanent) effect.getValue("creatureDied");
if (permanent == null) {
return 0;
}
return permanent
.getCounters(game)
.entrySet()
.stream()
.map(Map.Entry::getValue)
.mapToInt(Counter::getCount)
.sum();
}
@Override
public FelisaFangOfSilverquillValue copy() {
return instance;
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -94,6 +94,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Ezzaroot Channeler", 60, Rarity.RARE, mage.cards.e.EzzarootChanneler.class)); cards.add(new SetCardInfo("Ezzaroot Channeler", 60, Rarity.RARE, mage.cards.e.EzzarootChanneler.class));
cards.add(new SetCardInfo("Faithless Looting", 168, Rarity.COMMON, mage.cards.f.FaithlessLooting.class)); cards.add(new SetCardInfo("Faithless Looting", 168, Rarity.COMMON, mage.cards.f.FaithlessLooting.class));
cards.add(new SetCardInfo("Feldon of the Third Path", 169, Rarity.MYTHIC, mage.cards.f.FeldonOfTheThirdPath.class)); cards.add(new SetCardInfo("Feldon of the Third Path", 169, Rarity.MYTHIC, mage.cards.f.FeldonOfTheThirdPath.class));
cards.add(new SetCardInfo("Felisa, Fang of Silverquill", 2, Rarity.MYTHIC, mage.cards.f.FelisaFangOfSilverquill.class));
cards.add(new SetCardInfo("Fiery Encore", 51, Rarity.RARE, mage.cards.f.FieryEncore.class)); cards.add(new SetCardInfo("Fiery Encore", 51, Rarity.RARE, mage.cards.f.FieryEncore.class));
cards.add(new SetCardInfo("Fiery Fall", 170, Rarity.COMMON, mage.cards.f.FieryFall.class)); cards.add(new SetCardInfo("Fiery Fall", 170, Rarity.COMMON, mage.cards.f.FieryFall.class));
cards.add(new SetCardInfo("Forgotten Ancient", 137, Rarity.RARE, mage.cards.f.ForgottenAncient.class)); cards.add(new SetCardInfo("Forgotten Ancient", 137, Rarity.RARE, mage.cards.f.ForgottenAncient.class));

View file

@ -69,16 +69,15 @@ public class DiesCreatureTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event; ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) { if (!zEvent.isDiesEvent() || !filter.match(zEvent.getTarget(), sourceId, controllerId, game)) {
if (filter.match(zEvent.getTarget(), sourceId, controllerId, game)) { return false;
}
getEffects().setValue("creatureDied", zEvent.getTarget());
if (setTargetPointer) { if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game)); this.getEffects().setTargetPointer(new FixedTarget(event.getTargetId(), game));
} }
return true; return true;
} }
}
return false;
}
@Override @Override
public boolean isInUseableZone(Game game, MageObject source, GameEvent event) { public boolean isInUseableZone(Game game, MageObject source, GameEvent event) {