diff --git a/Mage.Sets/src/mage/cards/l/LoxodonLifechanter.java b/Mage.Sets/src/mage/cards/l/LoxodonLifechanter.java new file mode 100644 index 0000000000..239901d607 --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LoxodonLifechanter.java @@ -0,0 +1,107 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.SetPlayerLifeSourceEffect; +import mage.abilities.effects.common.continuous.BoostSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LoxodonLifechanter extends CardImpl { + + public LoxodonLifechanter(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}"); + + this.subtype.add(SubType.ELEPHANT); + this.subtype.add(SubType.CLERIC); + this.power = new MageInt(4); + this.toughness = new MageInt(6); + + // When Loxodon Lifechanter enters the battlefield, you may have your life total become the total toughness of creatures you control. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SetPlayerLifeSourceEffect( + LoxodonLifechanterValue.instance + ).setText("have your life total become the total toughness of creatures you control"), true)); + + // {5}{W}: Loxodon Lifechanter gets +X/+X until end of turn, where X is your life total. + this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect( + LoxodonLifechanterValue2.instance, + LoxodonLifechanterValue2.instance, + Duration.EndOfTurn, true + ), new ManaCostsImpl("{5}{W}"))); + } + + private LoxodonLifechanter(final LoxodonLifechanter card) { + super(card); + } + + @Override + public LoxodonLifechanter copy() { + return new LoxodonLifechanter(this); + } +} + +enum LoxodonLifechanterValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game.getBattlefield().getAllActivePermanents( + StaticFilters.FILTER_PERMANENT_CREATURE, + sourceAbility.getControllerId(), game + ).stream().mapToInt(permanent -> (permanent.getToughness().getValue())).sum(); + } + + @Override + public DynamicValue copy() { + return instance; + } + + @Override + public String getMessage() { + return null; + } +} + +enum LoxodonLifechanterValue2 implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Player player = game.getPlayer(sourceAbility.getControllerId()); + if (player == null) { + return 0; + } + return player.getLife(); + } + + @Override + public DynamicValue copy() { + return instance; + } + + @Override + public String getMessage() { + return "your life total"; + } + + @Override + public String toString() { + return "X"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/CoreSet2020.java b/Mage.Sets/src/mage/sets/CoreSet2020.java index 0f8ff457b4..d84c48abe5 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2020.java +++ b/Mage.Sets/src/mage/sets/CoreSet2020.java @@ -69,6 +69,7 @@ public final class CoreSet2020 extends ExpansionSet { cards.add(new SetCardInfo("Leyline of Sanctity", 26, Rarity.RARE, mage.cards.l.LeylineOfSanctity.class)); cards.add(new SetCardInfo("Leyline of the Void", 107, Rarity.RARE, mage.cards.l.LeylineOfTheVoid.class)); cards.add(new SetCardInfo("Loaming Shaman", 180, Rarity.UNCOMMON, mage.cards.l.LoamingShaman.class)); + cards.add(new SetCardInfo("Loxodon Lifechanter", 27, Rarity.RARE, mage.cards.l.LoxodonLifechanter.class)); cards.add(new SetCardInfo("Loyal Pegasus", 28, Rarity.UNCOMMON, mage.cards.l.LoyalPegasus.class)); cards.add(new SetCardInfo("Moldervine Reclamation", 214, Rarity.UNCOMMON, mage.cards.m.MoldervineReclamation.class)); cards.add(new SetCardInfo("Negate", 69, Rarity.COMMON, mage.cards.n.Negate.class));