mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
[KHM] fixed Draugr Necromancer not allowing snow mana to be used for exiled cards
This commit is contained in:
parent
683d5e7c25
commit
bac2585d83
3 changed files with 105 additions and 7 deletions
|
@ -11,6 +11,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
|
import mage.game.CardState;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.ZoneChangeEvent;
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
@ -159,14 +160,17 @@ class DraugrNecromancerSpendAnyManaEffect extends AsThoughEffectImpl implements
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (!source.isControlledBy(affectedControllerId)
|
if (!source.isControlledBy(affectedControllerId)
|
||||||
|| game.getState().getZone(sourceId) != Zone.EXILED) {
|
|| !game.getOpponents(game.getOwnerId(sourceId)).contains(source.getControllerId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Card card = game.getCard(sourceId);
|
Card card = game.getCard(sourceId);
|
||||||
return card != null
|
if (card != null
|
||||||
&& !card.isLand()
|
&& game.getState().getZone(sourceId) == Zone.EXILED
|
||||||
&& game.getOpponents(card.getOwnerId()).contains(source.getControllerId())
|
&& card.getCounters(game).getCount(CounterType.ICE) > 0) {
|
||||||
&& card.getCounters(game).getCount(CounterType.ICE) > 0;
|
return true;
|
||||||
|
}
|
||||||
|
CardState cardState = game.getLastKnownInformationCard(sourceId, Zone.EXILED);
|
||||||
|
return cardState != null && cardState.getCounters().getCount(CounterType.ICE) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
package org.mage.test.cards.single.khm;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public class DraugrNecromancerTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
private static final String necromancer = "Draugr Necromancer";
|
||||||
|
private static final String bolt = "Lightning Bolt";
|
||||||
|
private static final String bear = "Grizzly Bears";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testExilesWithCounter() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, necromancer);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain");
|
||||||
|
addCard(Zone.HAND, playerA, bolt);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, bear);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertExileCount(playerB, bear, 1);
|
||||||
|
assertCounterOnExiledCardCount(bear, CounterType.ICE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCastFromExile() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, necromancer);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest");
|
||||||
|
addCard(Zone.HAND, playerA, bolt);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, bear);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear);
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertExileCount(playerB, bear, 0);
|
||||||
|
assertPermanentCount(playerA, bear, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCastFromExileWithSnow() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, necromancer);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Snow-Covered Swamp");
|
||||||
|
addCard(Zone.HAND, playerA, bolt);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, bear);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear);
|
||||||
|
|
||||||
|
setStrictChooseMode(true);
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
assertAllCommandsUsed();
|
||||||
|
|
||||||
|
assertExileCount(playerB, bear, 0);
|
||||||
|
assertPermanentCount(playerA, bear, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCastFromExileWithoutSnow() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, necromancer);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Swamp");
|
||||||
|
addCard(Zone.HAND, playerA, bolt);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, bear);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, bolt, bear);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, bear);
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertExileCount(playerB, bear, 1);
|
||||||
|
assertCounterOnExiledCardCount(bear, CounterType.ICE, 1);
|
||||||
|
assertPermanentCount(playerA, bear, 0);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2954,7 +2954,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CardState getLastKnownInformationCard(UUID objectId, Zone zone) {
|
public CardState getLastKnownInformationCard(UUID objectId, Zone zone) {
|
||||||
if (zone == Zone.GRAVEYARD) {
|
if (zone.isPublicZone()) {
|
||||||
Map<UUID, CardState> lkiCardStateMap = lkiCardState.get(zone);
|
Map<UUID, CardState> lkiCardStateMap = lkiCardState.get(zone);
|
||||||
if (lkiCardStateMap != null) {
|
if (lkiCardStateMap != null) {
|
||||||
CardState cardState = lkiCardStateMap.get(objectId);
|
CardState cardState = lkiCardStateMap.get(objectId);
|
||||||
|
@ -3008,7 +3008,7 @@ public abstract class GameImpl implements Game, Serializable {
|
||||||
lkiExtended.put(objectId, lkiExtendedMap);
|
lkiExtended.put(objectId, lkiExtendedMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Zone.GRAVEYARD.equals(zone)) {
|
} else if (zone.isPublicZone()) {
|
||||||
// Remember card state in this public zone (mainly removed/gained abilities)
|
// Remember card state in this public zone (mainly removed/gained abilities)
|
||||||
Map<UUID, CardState> lkiMap = lkiCardState.get(zone);
|
Map<UUID, CardState> lkiMap = lkiCardState.get(zone);
|
||||||
if (lkiMap != null) {
|
if (lkiMap != null) {
|
||||||
|
|
Loading…
Reference in a new issue