diff --git a/Mage.Sets/src/mage/cards/h/HamaPasharRuinSeeker.java b/Mage.Sets/src/mage/cards/h/HamaPasharRuinSeeker.java new file mode 100644 index 0000000000..d4d50c858a --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HamaPasharRuinSeeker.java @@ -0,0 +1,77 @@ +package mage.cards.h; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.NumberOfTriggersEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HamaPasharRuinSeeker extends CardImpl { + + public HamaPasharRuinSeeker(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{U}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WIZARD); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // Room abilities of dungeons you own trigger an additional time. + this.addAbility(new SimpleStaticAbility(new HamaPasharRuinSeekerEffect())); + } + + private HamaPasharRuinSeeker(final HamaPasharRuinSeeker card) { + super(card); + } + + @Override + public HamaPasharRuinSeeker copy() { + return new HamaPasharRuinSeeker(this); + } +} + +class HamaPasharRuinSeekerEffect extends ReplacementEffectImpl { + + HamaPasharRuinSeekerEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "room abilities of dungeons you own trigger an additional time"; + } + + private HamaPasharRuinSeekerEffect(final HamaPasharRuinSeekerEffect effect) { + super(effect); + } + + @Override + public HamaPasharRuinSeekerEffect copy() { + return new HamaPasharRuinSeekerEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + GameEvent gameEvent = ((NumberOfTriggersEvent) event).getSourceEvent(); + return gameEvent.getType() == GameEvent.EventType.ROOM_ENTERED + && source.isControlledBy(gameEvent.getPlayerId()); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(event.getAmount() + 1); + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java index 3b5e7de747..91593dd4f9 100644 --- a/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java +++ b/Mage.Sets/src/mage/sets/AdventuresInTheForgottenRealms.java @@ -70,6 +70,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet { cards.add(new SetCardInfo("Grim Wanderer", 107, Rarity.UNCOMMON, mage.cards.g.GrimWanderer.class)); cards.add(new SetCardInfo("Guild Thief", 61, Rarity.UNCOMMON, mage.cards.g.GuildThief.class)); cards.add(new SetCardInfo("Half-Elf Monk", 19, Rarity.COMMON, mage.cards.h.HalfElfMonk.class)); + cards.add(new SetCardInfo("Hama Pashar, Ruin Seeker", 224, Rarity.UNCOMMON, mage.cards.h.HamaPasharRuinSeeker.class)); cards.add(new SetCardInfo("Hive of the Eye Tyrant", 258, Rarity.RARE, mage.cards.h.HiveOfTheEyeTyrant.class)); cards.add(new SetCardInfo("Hobgoblin Captain", 148, Rarity.COMMON, mage.cards.h.HobgoblinCaptain.class)); cards.add(new SetCardInfo("Hunter's Mark", 188, Rarity.UNCOMMON, mage.cards.h.HuntersMark.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/dungeons/DungeonTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/dungeons/DungeonTest.java index d6415d5b63..75a4f225bc 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/dungeons/DungeonTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/dungeons/DungeonTest.java @@ -27,6 +27,7 @@ public class DungeonTest extends CardTestPlayerBase { private static final String GLOOM_STALKER = "Gloom Stalker"; private static final String DUNGEON_CRAWLER = "Dungeon Crawler"; private static final String SILVERCOAT_LION = "Silvercoat Lion"; + private static final String HAMA_PASHAR_RUIN_SEEKER = "Hama Pashar, Ruin Seeker"; private void makeTester() { makeTester(playerA); @@ -87,7 +88,7 @@ public class DungeonTest extends CardTestPlayerBase { execute(); assertAllCommandsUsed(); - assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 4, 3); + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2, 3); assertPermanentCount(playerA, "Goblin", 0); assertDungeonRoom(LOST_MINE_OF_PHANDELVER, "Cave Entrance"); assertLife(playerA, 20); @@ -110,7 +111,7 @@ public class DungeonTest extends CardTestPlayerBase { execute(); assertAllCommandsUsed(); - assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 4, 3); + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2, 3); assertPermanentCount(playerA, "Goblin", 1); assertDungeonRoom(LOST_MINE_OF_PHANDELVER, "Goblin Lair"); assertLife(playerA, 20); @@ -136,7 +137,7 @@ public class DungeonTest extends CardTestPlayerBase { execute(); assertAllCommandsUsed(); - assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 4, 3); + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2, 3); assertPermanentCount(playerA, "Goblin", 1); assertDungeonRoom(LOST_MINE_OF_PHANDELVER, "Dark Pool"); assertLife(playerA, 20 + 1); @@ -164,7 +165,7 @@ public class DungeonTest extends CardTestPlayerBase { execute(); assertAllCommandsUsed(); - assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 4, 3); + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2, 3); assertPermanentCount(playerA, "Goblin", 1); assertDungeonRoom(null, null); assertLife(playerA, 20 + 1); @@ -283,8 +284,8 @@ public class DungeonTest extends CardTestPlayerBase { execute(); assertAllCommandsUsed(); - assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 4, 3); - assertPowerToughness(playerB, FLAMESPEAKER_ADEPT, 6, 3); + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2, 3); + assertPowerToughness(playerB, FLAMESPEAKER_ADEPT, 2 + 2 + 2, 3); assertPermanentCount(playerA, "Goblin", 1); assertPermanentCount(playerB, "Treasure", 1); assertDungeonRoom(playerA, LOST_MINE_OF_PHANDELVER, "Dark Pool"); @@ -384,4 +385,58 @@ public class DungeonTest extends CardTestPlayerBase { assertHandCount(playerA, DUNGEON_CRAWLER, 1); assertDungeonRoom(null, null); } + + @Test + public void test__HamaPasharRuinSeeker_DoubleController() { + makeTester(); + addCard(Zone.BATTLEFIELD, playerA, FLAMESPEAKER_ADEPT); + addCard(Zone.BATTLEFIELD, playerA, HAMA_PASHAR_RUIN_SEEKER); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}:"); + setChoice(playerA, LOST_MINE_OF_PHANDELVER); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}:"); + setChoice(playerA, "Yes"); // Goblin Lair + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}:"); + setChoice(playerA, "No"); // Dark Pool + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + assertAllCommandsUsed(); + + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2 + 2, 3); + assertPermanentCount(playerA, "Goblin", 2); + assertDungeonRoom(LOST_MINE_OF_PHANDELVER, "Dark Pool"); + assertLife(playerA, 20 + 1 + 1); + assertLife(playerB, 20 - 1 - 1); + assertHandCount(playerA, 0); + } + + @Test + public void test__HamaPasharRuinSeeker_DontDoubleOpponent() { + makeTester(); + addCard(Zone.BATTLEFIELD, playerA, FLAMESPEAKER_ADEPT); + addCard(Zone.BATTLEFIELD, playerB, HAMA_PASHAR_RUIN_SEEKER); + + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}:"); + setChoice(playerA, LOST_MINE_OF_PHANDELVER); + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}:"); + setChoice(playerA, "Yes"); // Goblin Lair + waitStackResolved(1, PhaseStep.PRECOMBAT_MAIN); + activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{0}:"); + setChoice(playerA, "No"); // Dark Pool + + setStopAt(1, PhaseStep.POSTCOMBAT_MAIN); + execute(); + assertAllCommandsUsed(); + + assertPowerToughness(playerA, FLAMESPEAKER_ADEPT, 2 + 2, 3); + assertPermanentCount(playerA, "Goblin", 1); + assertDungeonRoom(LOST_MINE_OF_PHANDELVER, "Dark Pool"); + assertLife(playerA, 20 + 1); + assertLife(playerB, 20 - 1); + assertHandCount(playerA, 0); + } }