[CLB] Implemented Folk Hero

This commit is contained in:
Evan Kranzler 2022-06-01 08:36:23 -04:00
parent d4bb6d2092
commit 686600a4fe
2 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,71 @@
package mage.cards.f;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FolkHero extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a spell that shares a creature type with this creature");
static {
filter.add(FolkHeroPredicate.instance);
}
public FolkHero(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.BACKGROUND);
// Commander creatures you own have "Whenever you cast a spell that shares a creature type with this creature, draw a card. This ability triggers only once each turn."
this.addAbility(new SimpleStaticAbility(new GainAbilityAllEffect(
new SpellCastControllerTriggeredAbility(
new DrawCardSourceControllerEffect(1), filter, false
).setTriggersOnce(true), Duration.WhileOnBattlefield,
StaticFilters.FILTER_CREATURES_OWNED_COMMANDER
)));
}
private FolkHero(final FolkHero card) {
super(card);
}
@Override
public FolkHero copy() {
return new FolkHero(this);
}
}
enum FolkHeroPredicate implements ObjectSourcePlayerPredicate<Spell> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Spell> input, Game game) {
return Optional
.of(input.getSource().getSourcePermanentIfItStillExists(game))
.filter(Objects::nonNull)
.map(permanent -> input.getObject().shareCreatureTypes(game, permanent))
.orElse(false);
}
}

View file

@ -137,6 +137,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Fireball", 175, Rarity.UNCOMMON, mage.cards.f.Fireball.class));
cards.add(new SetCardInfo("Flaming Fist Officer", 19, Rarity.COMMON, mage.cards.f.FlamingFistOfficer.class));
cards.add(new SetCardInfo("Flaming Fist", 18, Rarity.COMMON, mage.cards.f.FlamingFist.class));
cards.add(new SetCardInfo("Folk Hero", 650, Rarity.MYTHIC, mage.cards.f.FolkHero.class));
cards.add(new SetCardInfo("Font of Magic", 71, Rarity.MYTHIC, mage.cards.f.FontOfMagic.class));
cards.add(new SetCardInfo("Forest", 467, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ganax, Astral Hunter", 176, Rarity.UNCOMMON, mage.cards.g.GanaxAstralHunter.class));