From 199fc37c323b6edcba56313f724ffda023a7092c Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sun, 12 Apr 2020 11:50:39 -0400 Subject: [PATCH] Implemented Lavabrink Venturer --- .../src/mage/cards/l/LavabrinkVenturer.java | 97 +++++++++++++++++++ .../src/mage/sets/IkoriaLairOfBehemoths.java | 1 + 2 files changed, 98 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/l/LavabrinkVenturer.java diff --git a/Mage.Sets/src/mage/cards/l/LavabrinkVenturer.java b/Mage.Sets/src/mage/cards/l/LavabrinkVenturer.java new file mode 100644 index 0000000000..09d6fc01dd --- /dev/null +++ b/Mage.Sets/src/mage/cards/l/LavabrinkVenturer.java @@ -0,0 +1,97 @@ +package mage.cards.l; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AsEntersBattlefieldAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.common.ChooseModeEffect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.ProtectionAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.DependencyType; +import mage.constants.SubType; +import mage.filter.FilterObject; +import mage.filter.predicate.mageobject.ConvertedManaCostParityPredicate; +import mage.game.Game; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class LavabrinkVenturer extends CardImpl { + + public LavabrinkVenturer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // As Lavabrink Venturer enters the battlefield, choose odd or even. + this.addAbility(new AsEntersBattlefieldAbility( + new ChooseModeEffect("Odd or even?", "Odd", "Even") + )); + + // Lavabrink Venturer has protection from each converted mana cost of the chosen value. + this.addAbility(new SimpleStaticAbility(new LavabrinkVenturerEffect())); + } + + private LavabrinkVenturer(final LavabrinkVenturer card) { + super(card); + } + + @Override + public LavabrinkVenturer copy() { + return new LavabrinkVenturer(this); + } +} + +class LavabrinkVenturerEffect extends GainAbilitySourceEffect { + + private static final FilterObject oddFilter = new FilterObject("odd converted mana costs"); + private static final FilterObject evenFilter = new FilterObject("even converted mana costs"); + + static { + oddFilter.add(ConvertedManaCostParityPredicate.ODD); + evenFilter.add(ConvertedManaCostParityPredicate.EVEN); + } + + LavabrinkVenturerEffect() { + super((Ability) null); + this.addDependedToType(DependencyType.AddingAbility); + staticText = "{this} has protection from each converted mana cost of the chosen value."; + } + + private LavabrinkVenturerEffect(final LavabrinkVenturerEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + String choosenMode = (String) game.getState().getValue(source.getSourceId() + "_modeChoice"); + if (choosenMode == null) { + return false; + } + Ability ability; + switch (choosenMode) { + case "Odd": + this.ability = new ProtectionAbility(oddFilter); + break; + case "Even": + this.ability = new ProtectionAbility(evenFilter); + break; + default: + return false; + } + return super.apply(game, source); + } + + @Override + public LavabrinkVenturerEffect copy() { + return new LavabrinkVenturerEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java index ce90373475..37ae8a4126 100644 --- a/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java +++ b/Mage.Sets/src/mage/sets/IkoriaLairOfBehemoths.java @@ -189,6 +189,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet { cards.add(new SetCardInfo("Kogla, the Titan Ape", 162, Rarity.RARE, mage.cards.k.KoglaTheTitanApe.class)); cards.add(new SetCardInfo("Labyrinth Raptor", 193, Rarity.RARE, mage.cards.l.LabyrinthRaptor.class)); cards.add(new SetCardInfo("Lava Serpent", 124, Rarity.COMMON, mage.cards.l.LavaSerpent.class)); + cards.add(new SetCardInfo("Lavabrink Venturer", 19, Rarity.RARE, mage.cards.l.LavabrinkVenturer.class)); cards.add(new SetCardInfo("Lead the Stampede", 163, Rarity.UNCOMMON, mage.cards.l.LeadTheStampede.class)); cards.add(new SetCardInfo("Light of Hope", 20, Rarity.COMMON, mage.cards.l.LightOfHope.class)); cards.add(new SetCardInfo("Lore Drakkis", 194, Rarity.UNCOMMON, mage.cards.l.LoreDrakkis.class));