Will, Scion of Peace (#10854)

This commit is contained in:
Susucre 2023-08-18 21:15:45 +02:00 committed by GitHub
parent 8ad37e19b8
commit 7560530b1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 93 additions and 0 deletions

View file

@ -0,0 +1,92 @@
package mage.cards.w;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.dynamicvalue.common.ControllerGainedLifeCount;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.util.CardUtil;
import mage.watchers.common.PlayerGainedLifeWatcher;
import java.util.UUID;
/**
* @author Susucr
*/
public final class WillScionOfPeace extends CardImpl {
public WillScionOfPeace(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Vigilance
this.addAbility(VigilanceAbility.getInstance());
// {T}: Spells you cast this turn that are white and/or blue cost {X} less to cast, where X is the amount of life you gained this turn. Activate only as a sorcery.
this.addAbility(
new ActivateAsSorceryActivatedAbility(
new WillScionOfPeaceEffect(),
new TapSourceCost()
).addHint(ControllerGainedLifeCount.getHint()),
new PlayerGainedLifeWatcher()
);
}
private WillScionOfPeace(final WillScionOfPeace card) {
super(card);
}
@Override
public WillScionOfPeace copy() {
return new WillScionOfPeace(this);
}
}
class WillScionOfPeaceEffect extends CostModificationEffectImpl {
WillScionOfPeaceEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "Spells you cast this turn that are white and/or blue cost {X} less to cast, where X is the amount of life you gained this turn.";
}
private WillScionOfPeaceEffect(final WillScionOfPeaceEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, Math.max(0, ControllerGainedLifeCount.instance.calculate(game, source, this)));
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (!(abilityToModify instanceof SpellAbility)) {
return false;
}
SpellAbility spell = (SpellAbility) abilityToModify;
ObjectColor color = spell.getCharacteristics(game).getColor(game);
return spell.isControlledBy(source.getControllerId())
&& game.getCard(spell.getSourceId()) != null
&& (color.isBlue() || color.isWhite());
}
@Override
public WillScionOfPeaceEffect copy() {
return new WillScionOfPeaceEffect(this);
}
}

View file

@ -107,6 +107,7 @@ public final class WildsOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Virtue of Loyalty", 38, Rarity.MYTHIC, mage.cards.v.VirtueOfLoyalty.class));
cards.add(new SetCardInfo("Virtue of Persistence", 115, Rarity.MYTHIC, mage.cards.v.VirtueOfPersistence.class));
cards.add(new SetCardInfo("Warehouse Tabby", 117, Rarity.COMMON, mage.cards.w.WarehouseTabby.class));
cards.add(new SetCardInfo("Will, Scion of Peace", 218, Rarity.MYTHIC, mage.cards.w.WillScionOfPeace.class));
}
// @Override