[KHM] Implemented Righteous Valkyrie (#7414)

This commit is contained in:
Daniel Bomar 2021-01-21 09:41:07 -06:00 committed by GitHub
parent 30b3e2e658
commit edfbfac5e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,106 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author weirddan455
*/
public final class RighteousValkyrie extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("another Angel or Cleric");
static {
filter.add(AnotherPredicate.instance);
filter.add(Predicates.or(SubType.ANGEL.getPredicate(), SubType.CLERIC.getPredicate()));
}
public RighteousValkyrie(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.subtype.add(SubType.ANGEL);
this.subtype.add(SubType.CLERIC);
this.power = new MageInt(2);
this.toughness = new MageInt(4);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever another Angel or Cleric enters the battlefield under your control, you gain life equal to that creature's toughness.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(new RighteousValkyrieEffect(), filter));
// As long as you have at least 7 life more than your starting life total, creatures you control get +2/+2.
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield), RighteousValkyrieCondition.instance,
"As long as you have at least 7 life more than your starting life total, creatures you control get +2/+2"
)));
}
private RighteousValkyrie(final RighteousValkyrie card) {
super(card);
}
@Override
public RighteousValkyrie copy() {
return new RighteousValkyrie(this);
}
}
class RighteousValkyrieEffect extends OneShotEffect {
public RighteousValkyrieEffect() {
super(Outcome.GainLife);
staticText = "you gain life equal to that creature's toughness";
}
private RighteousValkyrieEffect(final RighteousValkyrieEffect effect) {
super(effect);
}
@Override
public RighteousValkyrieEffect copy() {
return new RighteousValkyrieEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = (Permanent) this.getValue("permanentEnteringBattlefield");
if (player == null || permanent == null) {
return false;
}
player.gainLife(permanent.getToughness().getValue(), game, source);
return true;
}
}
enum RighteousValkyrieCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
return player != null && player.getLife() >= game.getLife() + 7;
}
}

View file

@ -253,6 +253,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("Resplendent Marshal", 22, Rarity.MYTHIC, mage.cards.r.ResplendentMarshal.class));
cards.add(new SetCardInfo("Return Upon the Tide", 106, Rarity.UNCOMMON, mage.cards.r.ReturnUponTheTide.class));
cards.add(new SetCardInfo("Revitalize", 23, Rarity.COMMON, mage.cards.r.Revitalize.class));
cards.add(new SetCardInfo("Righteous Valkyrie", 24, Rarity.RARE, mage.cards.r.RighteousValkyrie.class));
cards.add(new SetCardInfo("Rimewood Falls", 266, Rarity.COMMON, mage.cards.r.RimewoodFalls.class));
cards.add(new SetCardInfo("Rise of the Dread Marn", 107, Rarity.RARE, mage.cards.r.RiseOfTheDreadMarn.class));
cards.add(new SetCardInfo("Rootless Yew", 189, Rarity.UNCOMMON, mage.cards.r.RootlessYew.class));