[DSK] Implement Leyline of Hope

This commit is contained in:
theelk801 2024-06-28 15:12:14 -04:00
parent 606a4a4e49
commit f0a77a8551
7 changed files with 104 additions and 78 deletions

View file

@ -5,7 +5,7 @@ import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.MoreThanStartingLifeTotalCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
@ -50,7 +50,7 @@ public final class AngelOfDestiny extends CardImpl {
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
new BeginningOfEndStepTriggeredAbility(
new AngelOfDestinyLoseEffect(), TargetController.YOU, false
), AngelOfDestinyCondition.instance, "At the beginning of your end step, " +
), MoreThanStartingLifeTotalCondition.FIFTEEN, "At the beginning of your end step, " +
"if you have at least 15 life more than your starting life total, " +
"each player {this} attacked this turn loses the game."
), new AngelOfDestinyWatcher());
@ -66,16 +66,6 @@ public final class AngelOfDestiny extends CardImpl {
}
}
enum AngelOfDestinyCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
return player != null && player.getLife() >= game.getStartingLife() + 15;
}
}
class AngelOfDestinyGainLifeEffect extends OneShotEffect {
AngelOfDestinyGainLifeEffect() {

View file

@ -1,10 +1,9 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.MoreThanStartingLifeTotalCondition;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -21,13 +20,11 @@ import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetNonlandPermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class AyliEternalPilgrim extends CardImpl {
@ -54,7 +51,7 @@ public final class AyliEternalPilgrim extends CardImpl {
Zone.BATTLEFIELD,
new ExileTargetEffect(),
new ManaCostsImpl<>("{1}{W}{B}"),
new AyliEternalPilgrimCondition()
MoreThanStartingLifeTotalCondition.TEN
);
ability.addCost(new SacrificeTargetCost(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE));
ability.addTarget(new TargetNonlandPermanent().withChooseHint("to exile"));
@ -70,20 +67,3 @@ public final class AyliEternalPilgrim extends CardImpl {
return new AyliEternalPilgrim(this);
}
}
class AyliEternalPilgrimCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if(player != null) {
return player.getLife() >= game.getStartingLife() + 10;
}
return false;
}
@Override
public String toString() {
return "you have at least 10 life more than your starting life total";
}
}

View file

@ -0,0 +1,46 @@
package mage.cards.l;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.MoreThanStartingLifeTotalCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.effects.common.replacement.GainPlusOneLifeReplacementEffect;
import mage.abilities.keyword.LeylineAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class LeylineOfHope extends CardImpl {
public LeylineOfHope(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
// If Leyline of Hope is in your opening hand, you may begin the game with it on the battlefield.
this.addAbility(LeylineAbility.getInstance());
// If you would gain life, you gain that much life plus 1 instead.
this.addAbility(new SimpleStaticAbility(new GainPlusOneLifeReplacementEffect()));
// 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),
MoreThanStartingLifeTotalCondition.SEVEN, "as long as you have at least " +
"7 life more than your starting life total, creatures you control get +2/+2"
)));
}
private LeylineOfHope(final LeylineOfHope card) {
super(card);
}
@Override
public LeylineOfHope copy() {
return new LeylineOfHope(this);
}
}

View file

@ -1,21 +1,20 @@
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.condition.common.MoreThanStartingLifeTotalCondition;
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.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AnotherPredicate;
@ -23,8 +22,9 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author weirddan455
*/
public final class RighteousValkyrie extends CardImpl {
@ -52,8 +52,9 @@ public final class RighteousValkyrie extends CardImpl {
// 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"
new BoostControlledEffect(2, 2, Duration.WhileOnBattlefield),
MoreThanStartingLifeTotalCondition.SEVEN, "as long as you have at least " +
"7 life more than your starting life total, creatures you control get +2/+2"
)));
}
@ -94,13 +95,3 @@ class RighteousValkyrieEffect extends OneShotEffect {
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.getStartingLife() + 7;
}
}

View file

@ -1,9 +1,8 @@
package mage.cards.s;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.MoreThanStartingLifeTotalCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.LifelinkAbility;
@ -14,9 +13,7 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TimingRule;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.token.AngelToken;
import mage.players.Player;
import java.util.UUID;
@ -42,7 +39,7 @@ public final class SpeakerOfTheHeavens extends CardImpl {
// {T}: Create a 4/4 white Angel creature token with flying. Activate only if you have at least 7 more life than your starting life total and only as a sorcery.
this.addAbility(new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD, new CreateTokenEffect(new AngelToken()),
new TapSourceCost(), SpeakerOfTheHeavensCondition.instance,
new TapSourceCost(), MoreThanStartingLifeTotalCondition.SEVEN,
TimingRule.SORCERY
));
}
@ -56,21 +53,3 @@ public final class SpeakerOfTheHeavens extends CardImpl {
return new SpeakerOfTheHeavens(this);
}
}
enum SpeakerOfTheHeavensCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null || player.getLife() < game.getStartingLife() + 7) {
return false;
}
return true;
}
@Override
public String toString() {
return "you have at least 7 life more than your starting life total";
}
}

View file

@ -24,6 +24,7 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
cards.add(new SetCardInfo("Enduring Tenacity", 95, Rarity.RARE, mage.cards.e.EnduringTenacity.class));
cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Leyline of Hope", 18, Rarity.RARE, mage.cards.l.LeylineOfHope.class));
cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plains", 272, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Swamp", 274, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));

View file

@ -0,0 +1,39 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Controllable;
import mage.game.Game;
import mage.players.Player;
import java.util.Optional;
/**
* @author TheElk801
*/
public enum MoreThanStartingLifeTotalCondition implements Condition {
SEVEN(7),
TEN(10),
FIFTEEN(10);
private final int amount;
MoreThanStartingLifeTotalCondition(int amount) {
this.amount = amount;
}
@Override
public boolean apply(Game game, Ability source) {
return Optional
.ofNullable(source)
.map(Controllable::getControllerId)
.map(game::getPlayer)
.map(Player::getLife)
.map(life -> life >= game.getStartingLife() + amount)
.orElse(false);
}
@Override
public String toString() {
return "you have at least " + amount + " life more than your starting life total";
}
}