[CLB] Implemented Font of Magic

This commit is contained in:
Evan Kranzler 2022-05-26 09:04:16 -04:00
parent 7ba86ee02a
commit 7082e174ee
2 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,77 @@
package mage.cards.f;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.CommanderCastCountValue;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class FontOfMagic extends CardImpl {
private static final Hint hint = new ValueHint(
"Commanders cast from command zone", CommanderCastCountValue.instance
);
public FontOfMagic(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
// Instant and sorcery spells you cast cost {1} less to cast for each time you've cast a commander from the command zone this game.
this.addAbility(new SimpleStaticAbility(new FontOfMagicEffect()).addHint(hint));
}
private FontOfMagic(final FontOfMagic card) {
super(card);
}
@Override
public FontOfMagic copy() {
return new FontOfMagic(this);
}
}
class FontOfMagicEffect extends CostModificationEffectImpl {
FontOfMagicEffect() {
super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "instant and sorcery spells you cast cost {1} less to cast " +
"for each time you've cast a commander from the command zone this game";
}
private FontOfMagicEffect(final FontOfMagicEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, Math.max(0, CommanderCastCountValue.instance.calculate(game, source, this)));
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify instanceof SpellAbility
&& abilityToModify.isControlledBy(source.getControllerId())
&& ((SpellAbility) abilityToModify).getCharacteristics(game).isInstantOrSorcery(game)
&& game.getCard(abilityToModify.getSourceId()) != null;
}
@Override
public FontOfMagicEffect copy() {
return new FontOfMagicEffect(this);
}
}

View file

@ -88,6 +88,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Fire Diamond", 313, Rarity.COMMON, mage.cards.f.FireDiamond.class));
cards.add(new SetCardInfo("Fireball", 175, Rarity.UNCOMMON, mage.cards.f.Fireball.class));
cards.add(new SetCardInfo("Flaming Fist", 18, Rarity.COMMON, mage.cards.f.FlamingFist.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));
cards.add(new SetCardInfo("Gate Colossus", 315, Rarity.UNCOMMON, mage.cards.g.GateColossus.class));