mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
fix Deep Gnome Terramancer triggering out of extra lands played
This commit is contained in:
parent
c3862e7196
commit
113630c1ab
3 changed files with 74 additions and 9 deletions
|
|
@ -24,7 +24,7 @@ import java.util.UUID;
|
|||
public final class DeepGnomeTerramancer extends CardImpl {
|
||||
|
||||
public DeepGnomeTerramancer(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{1}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||
this.subtype.add(SubType.GNOME, SubType.WIZARD);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
|
@ -81,7 +81,7 @@ class DeepGnomeTerramancerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (watcher.wasLandPlayed(land.getId())) { // Land was played
|
||||
if (watcher.wasLandPlayed(land, game)) { // Land was played
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
package org.mage.test.cards.single.clb;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public class DeepGnomeTerramancerTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* {@link mage.cards.d.DeepGnomeTerramancer Deep Gnome Terramancer} {1}{W}
|
||||
* Creature — Gnome Wizard
|
||||
* Flash
|
||||
* Mold Earth — Whenever one or more lands enter the battlefield under an opponent’s control without being played, you may search your library for a Plains card, put it onto the battlefield tapped, then shuffle. Do this only once each turn.
|
||||
* 2/2
|
||||
*/
|
||||
private static final String gnome = "Deep Gnome Terramancer";
|
||||
|
||||
// Bug: Deep Gnome triggers out of playing extra lands.
|
||||
@Test
|
||||
public void test_OracleOfMuldaya_NoTrigger() {
|
||||
setStrictChooseMode(true);
|
||||
skipInitShuffling();
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, gnome);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Oracle of Mul Daya");
|
||||
addCard(Zone.LIBRARY, playerA, "Island");
|
||||
addCard(Zone.LIBRARY, playerA, "Island");
|
||||
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Island");
|
||||
playLand(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Island");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Island", 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Trigger() {
|
||||
setStrictChooseMode(true);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, gnome);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||
addCard(Zone.HAND, playerA, "Arboreal Grazer");
|
||||
addCard(Zone.HAND, playerA, "Plains");
|
||||
addCard(Zone.LIBRARY, playerB, "Tundra");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arboreal Grazer");
|
||||
setChoice(playerA, true); // yes to trigger from Grazer
|
||||
setChoice(playerA, "Plains"); // puts plains into play
|
||||
setChoice(playerB, true); // yes to trigger from Gnome
|
||||
addTarget(playerB, "Tundra"); // search for Tundra with Gnome trigger
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Plains", 1);
|
||||
assertPermanentCount(playerB, "Tundra", 1);
|
||||
assertTappedCount("Tundra", true, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package mage.watchers.common;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -16,7 +17,7 @@ import java.util.UUID;
|
|||
public class PlayLandWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> playerPlayedLand = new HashSet<>(); // player that played land
|
||||
private final Set<UUID> landPlayed = new HashSet<>(); // land played
|
||||
private final Set<MageObjectReference> landPlayed = new HashSet<>(); // land played
|
||||
|
||||
public PlayLandWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
|
|
@ -26,11 +27,10 @@ public class PlayLandWatcher extends Watcher {
|
|||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.LAND_PLAYED) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent != null
|
||||
&& permanent.isLand(game)
|
||||
&& !playerPlayedLand.contains(event.getPlayerId())) {
|
||||
if (permanent != null && permanent.isLand(game)) {
|
||||
MageObjectReference mor = new MageObjectReference(permanent, game);
|
||||
landPlayed.add(mor);
|
||||
playerPlayedLand.add(event.getPlayerId());
|
||||
landPlayed.add(event.getTargetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ public class PlayLandWatcher extends Watcher {
|
|||
return playerPlayedLand.contains(playerId);
|
||||
}
|
||||
|
||||
public boolean wasLandPlayed(UUID landId) {
|
||||
return landPlayed.contains(landId);
|
||||
public boolean wasLandPlayed(Permanent land, Game game) {
|
||||
return landPlayed.contains(new MageObjectReference(land, game));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue