diff --git a/Mage.Sets/src/mage/cards/d/DarkConfidant.java b/Mage.Sets/src/mage/cards/d/DarkConfidant.java index f8e73aefe4e..89a2f10d5a9 100644 --- a/Mage.Sets/src/mage/cards/d/DarkConfidant.java +++ b/Mage.Sets/src/mage/cards/d/DarkConfidant.java @@ -1,23 +1,17 @@ - package mage.cards.d; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.effects.OneShotEffect; -import mage.cards.*; +import mage.abilities.effects.common.RevealPutInHandLoseLifeEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.SubType; import mage.constants.TargetController; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.permanent.Permanent; -import mage.players.Player; + +import java.util.UUID; /** - * * @author Loki */ public final class DarkConfidant extends CardImpl { @@ -31,7 +25,7 @@ public final class DarkConfidant extends CardImpl { this.toughness = new MageInt(1); // At the beginning of your upkeep, reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost. - this.addAbility(new BeginningOfUpkeepTriggeredAbility(new DarkConfidantEffect(), TargetController.YOU, false)); + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RevealPutInHandLoseLifeEffect(), TargetController.YOU, false)); } private DarkConfidant(final DarkConfidant card) { @@ -43,40 +37,3 @@ public final class DarkConfidant extends CardImpl { return new DarkConfidant(this); } } - -class DarkConfidantEffect extends OneShotEffect { - - DarkConfidantEffect() { - super(Outcome.DrawCard); - this.staticText = "reveal the top card of your library and put that card into your hand. You lose life equal to its mana value"; - } - - private DarkConfidantEffect(final DarkConfidantEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); - if (controller != null && sourcePermanent != null) { - if (controller.getLibrary().hasCards()) { - Card card = controller.getLibrary().getFromTop(game); - if (card != null) { - Cards cards = new CardsImpl(card); - controller.revealCards(sourcePermanent.getIdName(), cards, game); - controller.moveCards(card, Zone.HAND, source, game); - controller.loseLife(card.getManaValue(), game, source, false); - - } - return true; - } - } - return false; - } - - @Override - public DarkConfidantEffect copy() { - return new DarkConfidantEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/d/DarkTutelage.java b/Mage.Sets/src/mage/cards/d/DarkTutelage.java index 8125fe71859..8298efee1ef 100644 --- a/Mage.Sets/src/mage/cards/d/DarkTutelage.java +++ b/Mage.Sets/src/mage/cards/d/DarkTutelage.java @@ -1,18 +1,11 @@ package mage.cards.d; -import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; +import mage.abilities.effects.common.RevealPutInHandLoseLifeEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.cards.CardsImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.TargetController; -import mage.constants.Zone; -import mage.game.Game; -import mage.players.Player; import java.util.UUID; @@ -25,7 +18,7 @@ public final class DarkTutelage extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}"); this.addAbility(new BeginningOfUpkeepTriggeredAbility( - new DarkTutelageEffect(), TargetController.YOU, false + new RevealPutInHandLoseLifeEffect(), TargetController.YOU, false )); } @@ -38,38 +31,3 @@ public final class DarkTutelage extends CardImpl { return new DarkTutelage(this); } } - -class DarkTutelageEffect extends OneShotEffect { - - DarkTutelageEffect() { - super(Outcome.DrawCard); - staticText = "reveal the top card of your library and put that card into your hand. You lose life equal to its mana value"; - } - - private DarkTutelageEffect(final DarkTutelageEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null || !player.getLibrary().hasCards()) { - return false; - } - Card card = player.getLibrary().getFromTop(game); - if (card == null) { - return false; - } - player.revealCards(source, new CardsImpl(card), game); - player.moveCards(card, Zone.HAND, source, game); - if (card.getManaValue() > 0) { - player.loseLife(card.getManaValue(), game, source, false); - } - return true; - } - - @Override - public DarkTutelageEffect copy() { - return new DarkTutelageEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/d/DarkstarAugur.java b/Mage.Sets/src/mage/cards/d/DarkstarAugur.java new file mode 100644 index 00000000000..4c58d3e9669 --- /dev/null +++ b/Mage.Sets/src/mage/cards/d/DarkstarAugur.java @@ -0,0 +1,47 @@ +package mage.cards.d; + +import mage.MageInt; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.common.RevealPutInHandLoseLifeEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.OffspringAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.TargetController; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class DarkstarAugur extends CardImpl { + + public DarkstarAugur(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.subtype.add(SubType.BAT); + this.subtype.add(SubType.WARLOCK); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Offspring {B} + this.addAbility(new OffspringAbility("{B}")); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // At the beginning of your upkeep, reveal the top card of your library and put that card into your hand. You lose life equal to its mana value. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new RevealPutInHandLoseLifeEffect(), TargetController.YOU, false)); + } + + private DarkstarAugur(final DarkstarAugur card) { + super(card); + } + + @Override + public DarkstarAugur copy() { + return new DarkstarAugur(this); + } +} diff --git a/Mage.Sets/src/mage/cards/p/PainSeer.java b/Mage.Sets/src/mage/cards/p/PainSeer.java index e852a1e79d9..f9ef273fa93 100644 --- a/Mage.Sets/src/mage/cards/p/PainSeer.java +++ b/Mage.Sets/src/mage/cards/p/PainSeer.java @@ -1,17 +1,12 @@ - package mage.cards.p; import mage.MageInt; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.RevealPutInHandLoseLifeEffect; import mage.abilities.keyword.InspiredAbility; -import mage.cards.*; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.SubType; -import mage.constants.Zone; -import mage.game.Game; -import mage.players.Player; import java.util.UUID; @@ -29,7 +24,7 @@ public final class PainSeer extends CardImpl { this.toughness = new MageInt(2); // Inspired — Whenever Pain Seer becomes untapped, reveal the top card of your library and put that card into your hand. You lose life equal to that card's converted mana cost. - this.addAbility(new InspiredAbility(new PainSeerEffect())); + this.addAbility(new InspiredAbility(new RevealPutInHandLoseLifeEffect())); } private PainSeer(final PainSeer card) { @@ -41,42 +36,3 @@ public final class PainSeer extends CardImpl { return new PainSeer(this); } } - -class PainSeerEffect extends OneShotEffect { - - PainSeerEffect() { - super(Outcome.DrawCard); - this.staticText = "reveal the top card of your library and put that card into your hand. You lose life equal to that card's mana value"; - } - - private PainSeerEffect(final PainSeerEffect effect) { - super(effect); - } - - @Override - public PainSeerEffect copy() { - return new PainSeerEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(source.getControllerId()); - if (player == null) { - return false; - } - - if (player.getLibrary().hasCards()) { - Card card = player.getLibrary().getFromTop(game); - - if (card != null) { - Cards cards = new CardsImpl(card); - player.revealCards("Pain Seer", cards, game); - if(player.moveCards(card, Zone.HAND, source, game)) { - player.loseLife(card.getManaValue(), game, source, false); - return true; - } - } - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/r/RuinRaider.java b/Mage.Sets/src/mage/cards/r/RuinRaider.java index 38e4ad57b0c..488065ad043 100644 --- a/Mage.Sets/src/mage/cards/r/RuinRaider.java +++ b/Mage.Sets/src/mage/cards/r/RuinRaider.java @@ -5,12 +5,14 @@ import mage.abilities.Ability; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; import mage.abilities.condition.common.RaidCondition; import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.RevealPutInHandLoseLifeEffect; import mage.abilities.hint.common.RaidHint; -import mage.cards.*; -import mage.constants.*; -import mage.game.Game; -import mage.players.Player; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.AbilityWord; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.TargetController; import mage.watchers.common.PlayerAttackedWatcher; import java.util.UUID; @@ -30,11 +32,12 @@ public final class RuinRaider extends CardImpl { // Raid — At the beginning of your end step, if you attacked this turn, reveal the top card of your library and put that card into your hand. You lose life equal to the card's converted mana cost. Ability ability = new ConditionalInterveningIfTriggeredAbility( - new BeginningOfEndStepTriggeredAbility(new RuinRaiderEffect(), TargetController.YOU, false), - RaidCondition.instance, - "At the beginning of your end step, if you attacked this turn, " - + "reveal the top card of your library and put that card into your hand. " - + "You lose life equal to the card's mana value."); + new BeginningOfEndStepTriggeredAbility( + new RevealPutInHandLoseLifeEffect(), TargetController.YOU, false + ), RaidCondition.instance, "At the beginning of your end step, " + + "if you attacked this turn, reveal the top card of your library " + + "and put that card into your hand. You lose life equal to the card's mana value." + ); ability.setAbilityWord(AbilityWord.RAID); ability.addHint(RaidHint.instance); this.addAbility(ability, new PlayerAttackedWatcher()); @@ -49,38 +52,3 @@ public final class RuinRaider extends CardImpl { return new RuinRaider(this); } } - -class RuinRaiderEffect extends OneShotEffect { - - RuinRaiderEffect() { - super(Outcome.DrawCard); - this.staticText = "reveal the top card of your library and put that card into your hand. You lose life equal to its mana value"; - } - - private RuinRaiderEffect(final RuinRaiderEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - if (controller.getLibrary().hasCards()) { - Card card = controller.getLibrary().getFromTop(game); - if (card != null) { - Cards cards = new CardsImpl(card); - controller.revealCards(source, cards, game); - controller.moveCards(card, Zone.HAND, source, game); - controller.loseLife(card.getManaValue(), game, source, false); - } - return true; - } - } - return false; - } - - @Override - public RuinRaiderEffect copy() { - return new RuinRaiderEffect(this); - } -} diff --git a/Mage.Sets/src/mage/cards/s/StrongholdArena.java b/Mage.Sets/src/mage/cards/s/StrongholdArena.java index 4de94a3d09d..b94499cf00b 100644 --- a/Mage.Sets/src/mage/cards/s/StrongholdArena.java +++ b/Mage.Sets/src/mage/cards/s/StrongholdArena.java @@ -1,30 +1,29 @@ package mage.cards.s; -import java.util.UUID; - -import mage.abilities.Ability; import mage.abilities.common.DealCombatDamageControlledTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.dynamicvalue.MultipliedValue; +import mage.abilities.dynamicvalue.common.MultikickerCount; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.RevealPutInHandLoseLifeEffect; import mage.abilities.keyword.KickerAbility; -import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.cards.CardsImpl; import mage.constants.CardType; -import mage.constants.Outcome; import mage.constants.SetTargetPointer; import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.game.Game; -import mage.players.Player; + +import java.util.UUID; /** - * * @author weirddan455 */ public final class StrongholdArena extends CardImpl { + private static final DynamicValue xValue = new MultipliedValue(MultikickerCount.instance, 3); + public StrongholdArena(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}"); @@ -34,11 +33,17 @@ public final class StrongholdArena extends CardImpl { this.addAbility(kickerAbility); // When Stronghold Arena enters the battlefield, you gain 3 life for each time it was kicked. - this.addAbility(new EntersBattlefieldTriggeredAbility(new StrongholdArenaGainLifeEffect())); + this.addAbility(new EntersBattlefieldTriggeredAbility(new GainLifeEffect( + xValue, "you gain 3 life for each time it was kicked" + ))); // Whenever one or more creatures you control deal combat damage to a player, you may reveal the top card of your library and put it into your hand. // If you do, you lose life equal to its mana value. - this.addAbility(new DealCombatDamageControlledTriggeredAbility(Zone.BATTLEFIELD, new StrongholdArenaDrawEffect(), StaticFilters.FILTER_PERMANENT_CREATURES, SetTargetPointer.NONE, true)); + this.addAbility(new DealCombatDamageControlledTriggeredAbility( + Zone.BATTLEFIELD, new RevealPutInHandLoseLifeEffect(true), + StaticFilters.FILTER_PERMANENT_CREATURES, + SetTargetPointer.NONE, true + )); } private StrongholdArena(final StrongholdArena card) { @@ -50,65 +55,3 @@ public final class StrongholdArena extends CardImpl { return new StrongholdArena(this); } } - -class StrongholdArenaGainLifeEffect extends OneShotEffect { - - StrongholdArenaGainLifeEffect() { - super(Outcome.GainLife); - this.staticText = "you gain 3 life for each time it was kicked"; - } - - private StrongholdArenaGainLifeEffect(final StrongholdArenaGainLifeEffect effect) { - super(effect); - } - - @Override - public StrongholdArenaGainLifeEffect copy() { - return new StrongholdArenaGainLifeEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { - return false; - } - controller.gainLife(KickerAbility.getKickedCounter(game, source) * 3, game, source); - return true; - } -} - -class StrongholdArenaDrawEffect extends OneShotEffect { - - StrongholdArenaDrawEffect() { - super(Outcome.DrawCard); - this.staticText = "reveal the top card of your library and put it into your hand. If you do, you lose life equal to its mana value."; - } - - private StrongholdArenaDrawEffect(final StrongholdArenaDrawEffect effect) { - super(effect); - } - - @Override - public StrongholdArenaDrawEffect copy() { - return new StrongholdArenaDrawEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); - if (controller == null) { - return false; - } - Card card = controller.getLibrary().getFromTop(game); - if (card == null) { - return false; - } - int manaValue = card.getManaValue(); - controller.revealCards(source, new CardsImpl(card), game); - if (controller.moveCards(card, Zone.HAND, source, game)) { - controller.loseLife(manaValue, game, source, false); - } - return true; - } -} diff --git a/Mage.Sets/src/mage/sets/Bloomburrow.java b/Mage.Sets/src/mage/sets/Bloomburrow.java index 12183d96213..7bc733ed4d4 100644 --- a/Mage.Sets/src/mage/sets/Bloomburrow.java +++ b/Mage.Sets/src/mage/sets/Bloomburrow.java @@ -43,6 +43,7 @@ public final class Bloomburrow extends ExpansionSet { cards.add(new SetCardInfo("Clifftop Lookout", 168, Rarity.UNCOMMON, mage.cards.c.ClifftopLookout.class)); cards.add(new SetCardInfo("Corpseberry Cultivator", 210, Rarity.COMMON, mage.cards.c.CorpseberryCultivator.class)); cards.add(new SetCardInfo("Coruscation Mage", 131, Rarity.UNCOMMON, mage.cards.c.CoruscationMage.class)); + cards.add(new SetCardInfo("Darkstar Augur", 90, Rarity.RARE, mage.cards.d.DarkstarAugur.class)); cards.add(new SetCardInfo("Diresight", 91, Rarity.COMMON, mage.cards.d.Diresight.class)); cards.add(new SetCardInfo("Downwind Ambusher", 92, Rarity.UNCOMMON, mage.cards.d.DownwindAmbusher.class)); cards.add(new SetCardInfo("Dreamdew Entrancer", 211, Rarity.RARE, mage.cards.d.DreamdewEntrancer.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/RevealPutInHandLoseLifeEffect.java b/Mage/src/main/java/mage/abilities/effects/common/RevealPutInHandLoseLifeEffect.java new file mode 100644 index 00000000000..9f67e197e40 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/RevealPutInHandLoseLifeEffect.java @@ -0,0 +1,51 @@ +package mage.abilities.effects.common; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardsImpl; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * @author TheElk801 + */ +public class RevealPutInHandLoseLifeEffect extends OneShotEffect { + + public RevealPutInHandLoseLifeEffect() { + this(false); + } + + public RevealPutInHandLoseLifeEffect(boolean ifYouDo) { + super(Outcome.Benefit); + staticText = "reveal the top card of your library and put that card into your hand. " + + (ifYouDo ? "If you do, y" : "Y") + "ou lose life equal to its mana value"; + } + + private RevealPutInHandLoseLifeEffect(final RevealPutInHandLoseLifeEffect effect) { + super(effect); + } + + @Override + public RevealPutInHandLoseLifeEffect copy() { + return new RevealPutInHandLoseLifeEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Card card = player.getLibrary().getFromTop(game); + if (card == null) { + return false; + } + player.revealCards(source, new CardsImpl(card), game); + player.moveCards(card, Zone.HAND, source, game); + player.loseLife(card.getManaValue(), game, source, false); + return true; + } +}