mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 04:12:14 -08:00
Merge branch 'master' into Network_Upgrade
Conflicts: Mage.Client/src/main/java/mage/client/MageFrame.java Mage.Client/src/main/java/mage/client/chat/ChatPanel.java Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java Mage.Client/src/main/java/mage/client/game/GamePanel.java Mage.Client/src/main/java/mage/client/game/PlayAreaPanel.java Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java Mage.Client/src/main/java/mage/client/tournament/TournamentPanel.java Mage.Common/src/mage/interfaces/MageServer.java Mage.Common/src/mage/remote/Connection.java Mage.Common/src/mage/remote/SessionImpl.java Mage.Server/src/main/java/mage/server/MageServerImpl.java Mage.Server/src/main/java/mage/server/Session.java Mage.Server/src/main/java/mage/server/SessionManager.java Mage.Server/src/main/java/mage/server/TableController.java Mage.Server/src/main/java/mage/server/User.java Mage.Server/src/main/java/mage/server/game/GamesRoomImpl.java Mage.Server/src/main/java/mage/server/tournament/TournamentController.java
This commit is contained in:
commit
88e30ee6e1
1364 changed files with 51978 additions and 7733 deletions
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.AI.basic;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBaseAI;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CastAlternateCastingCostsTest extends CardTestPlayerBaseAI {
|
||||
|
||||
/**
|
||||
* Tests that if a spell has alternate casting costs, this option is also calculated
|
||||
*/
|
||||
@Test
|
||||
@Ignore // AI only gets the cast ability yet, but does always say yes to use evoke
|
||||
// TODO: Get the AI both options to calculate
|
||||
public void testEvoke() {
|
||||
// Flying
|
||||
// When Mulldrifter enters the battlefield, draw two cards.
|
||||
// Evoke (You may cast this spell for its evoke cost. If you do, it's sacrificed when it enters the battlefield.)
|
||||
addCard(Zone.HAND, playerA, "Mulldrifter");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 5);
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Mulldrifter", 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -38,22 +38,22 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class ScytheOfTheWretchedTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Test that the creature taht died returns to battlefield under your control
|
||||
* if the previous equiped creature does not die
|
||||
* Test that the creature that died returns to battlefield under your
|
||||
* control if the previous equipped creature does not die
|
||||
*/
|
||||
@Test
|
||||
public void testEquipAlive() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulmender", 1);
|
||||
// {T}: You gain 1 life.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulmender", 1); // 1/1
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
// Equipped creature gets +2/+2.
|
||||
// Whenever a creature dealt damage by equipped creature this turn dies, return that card to the battlefield under your control. Attach Scythe of the Wretched to that creature.
|
||||
// Equip {4}
|
||||
// Equip {4}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Scythe of the Wretched");
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Equip {4}", "Silvercoat Lion");
|
||||
|
|
@ -66,29 +66,31 @@ public class ScytheOfTheWretchedTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertPermanentCount(playerA, "Soulmender", 0);
|
||||
assertPermanentCount(playerB, "Soulmender", 1);
|
||||
assertPowerToughness(playerB, "Soulmender", 3, 3);
|
||||
|
||||
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 2, 2);
|
||||
|
||||
Permanent silvercoatLion = getPermanent("Silvercoat Lion", playerB.getId());
|
||||
Assert.assertTrue("Silvercoat Lion may not have any attachments", silvercoatLion.getAttachments().isEmpty());
|
||||
}
|
||||
/**
|
||||
* Test that the creature that died returns to battlefield under your control
|
||||
* if the previous equiped creature does die after equipment is removed
|
||||
|
||||
/**
|
||||
* Test that the creature that died returns to battlefield under your
|
||||
* control if the previous equiped creature does die after equipment is
|
||||
* removed
|
||||
*/
|
||||
@Test
|
||||
public void testEquipDied() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Oreskos Swiftclaw", 1); // 3/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Oreskos Swiftclaw", 1); // 3/1
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
// Equipped creature gets +2/+2.
|
||||
// Whenever a creature dealt damage by equipped creature this turn dies, return that card to the battlefield under your control. Attach Scythe of the Wretched to that creature.
|
||||
// Equip {4}
|
||||
// Equip {4}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Scythe of the Wretched");
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Equip {4}", "Silvercoat Lion");
|
||||
|
|
@ -101,27 +103,27 @@ public class ScytheOfTheWretchedTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertPermanentCount(playerA, "Oreskos Swiftclaw", 0);
|
||||
assertPermanentCount(playerB, "Oreskos Swiftclaw", 1);
|
||||
assertPowerToughness(playerB, "Oreskos Swiftclaw", 5, 3);
|
||||
|
||||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the creature that died returns to battlefield under your control
|
||||
* if the previous equiped creature does die already in combat
|
||||
|
||||
/**
|
||||
* Test that the creature that died returns to battlefield under your
|
||||
* control if the previous equiped creature does die already in combat
|
||||
*/
|
||||
@Test
|
||||
public void testEquipDiedInCombat() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Serra Angel", 1); // 4/4
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
// Equipped creature gets +2/+2.
|
||||
// Whenever a creature dealt damage by equipped creature this turn dies, return that card to the battlefield under your control. Attach Scythe of the Wretched to that creature.
|
||||
// Equip {4}
|
||||
// Equip {4}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Scythe of the Wretched");
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Equip {4}", "Silvercoat Lion");
|
||||
|
|
@ -134,18 +136,18 @@ public class ScytheOfTheWretchedTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertPermanentCount(playerA, "Serra Angel", 0);
|
||||
assertPermanentCount(playerB, "Serra Angel", 1);
|
||||
assertPowerToughness(playerB, "Serra Angel", 6, 6);
|
||||
|
||||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test that the creature that died returns to battlefield under your control
|
||||
* if the previous equiped creature does die already in combat and the equipment was destroyed meanwhile
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the creature that died returns to battlefield under your
|
||||
* control if the previous equiped creature does die already in combat and
|
||||
* the equipment was destroyed meanwhile
|
||||
*/
|
||||
@Test
|
||||
public void testEquipDiedInCombat2() {
|
||||
|
|
@ -154,17 +156,17 @@ public class ScytheOfTheWretchedTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Disenchant", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
// Equipped creature gets +2/+2.
|
||||
// Whenever a creature dealt damage by equipped creature this turn dies, return that card to the battlefield under your control. Attach Scythe of the Wretched to that creature.
|
||||
// Equip {4}
|
||||
// Equip {4}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Scythe of the Wretched");
|
||||
|
||||
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Equip {4}", "Silvercoat Lion");
|
||||
|
||||
attack(2, playerB, "Silvercoat Lion");
|
||||
block(2, playerA, "Serra Angel", "Silvercoat Lion");
|
||||
|
||||
|
||||
castSpell(2, PhaseStep.COMBAT_DAMAGE, playerA, "Disenchant", "Scythe of the Wretched", "Whenever a creature dealt damage");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
|
|
@ -172,14 +174,14 @@ public class ScytheOfTheWretchedTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
|
||||
assertGraveyardCount(playerA, "Disenchant", 1);
|
||||
assertGraveyardCount(playerB, "Scythe of the Wretched", 1);
|
||||
|
||||
|
||||
assertPermanentCount(playerA, "Serra Angel", 0);
|
||||
assertPermanentCount(playerB, "Serra Angel", 1);
|
||||
assertPowerToughness(playerB, "Serra Angel", 4, 4);
|
||||
|
||||
|
||||
assertGraveyardCount(playerB, "Silvercoat Lion", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -40,32 +40,27 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class ModularTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* 702.42. Modular
|
||||
* 702.42a Modular represents both a static ability and a triggered ability. “Modular N” means “This
|
||||
* permanent enters the battlefield with N +1/+1 counters on it” and “When this permanent is put
|
||||
* into a graveyard from the battlefield, you may put a +1/+1 counter on target artifact creature for
|
||||
* each +1/+1 counter on this permanent.”
|
||||
* 702.42b If a creature has multiple instances of modular, each one works separately.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Arcbound Bruiser
|
||||
* Artifact Creature — Golem 0/0, 5 (5)
|
||||
* Modular 3 (This enters the battlefield with three +1/+1 counters on it.
|
||||
* When it dies, you may put its +1/+1 counters on target artifact creature.)
|
||||
* 702.42. Modular 702.42a Modular represents both a static ability and a
|
||||
* triggered ability. “Modular N” means “This permanent enters the
|
||||
* battlefield with N +1/+1 counters on it” and “When this permanent is put
|
||||
* into a graveyard from the battlefield, you may put a +1/+1 counter on
|
||||
* target artifact creature for each +1/+1 counter on this permanent.”
|
||||
* 702.42b If a creature has multiple instances of modular, each one works
|
||||
* separately.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Arcbound Hybrid
|
||||
* Artifact Creature — Beast 0/0, 4 (4)
|
||||
* Haste
|
||||
* Modular 2 (This enters the battlefield with two +1/+1 counters on it.
|
||||
* When it dies, you may put its +1/+1 counters on target artifact creature.)
|
||||
*
|
||||
* Arcbound Bruiser Artifact Creature — Golem 0/0, 5 (5) Modular 3 (This
|
||||
* enters the battlefield with three +1/+1 counters on it. When it dies, you
|
||||
* may put its +1/+1 counters on target artifact creature.)
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Arcbound Hybrid Artifact Creature — Beast 0/0, 4 (4) Haste Modular 2
|
||||
* (This enters the battlefield with two +1/+1 counters on it. When it dies,
|
||||
* you may put its +1/+1 counters on target artifact creature.)
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testModularEnters() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
|
||||
|
|
@ -85,7 +80,7 @@ public class ModularTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Arcbound Hybrid", 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testModularLeaves() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 4);
|
||||
|
|
@ -108,4 +103,32 @@ public class ModularTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* My Inkmoth Nexus was in creature "form". My Arcbound Ravager died. I
|
||||
* could not transfer his counters on my Inkmoth "creature".
|
||||
*/
|
||||
@Test
|
||||
public void testInkmothNexus() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Inkmoth Nexus");
|
||||
addCard(Zone.HAND, playerA, "Arcbound Ravager");
|
||||
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arcbound Ravager");
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{1}: {this} becomes");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Arcbound Ravager");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Arcbound Ravager", 1);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
|
||||
assertCounterCount("Inkmoth Nexus", CounterType.P1P1, 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ package org.mage.test.cards.abilities.keywords;
|
|||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -89,5 +92,5 @@ public class ProvokeTest extends CardTestPlayerBase{
|
|||
assertLife(playerA, 18); // one attack from Imp
|
||||
assertLife(playerB, 15); // Not blocked
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,142 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.abilities.keywords;
|
||||
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class RenownTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testKnightOfThePilgrimsRoad() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
// Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.)
|
||||
addCard(Zone.HAND, playerA, "Knight of the Pilgrim's Road"); // 3/2
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Knight of the Pilgrim's Road");
|
||||
|
||||
attack(3, playerA, "Knight of the Pilgrim's Road"); // 3 damage
|
||||
attack(5, playerA, "Knight of the Pilgrim's Road"); // 4 damage
|
||||
attack(7, playerA, "Knight of the Pilgrim's Road"); // 4 damage
|
||||
|
||||
setStopAt(7, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Knight of the Pilgrim's Road", 4, 3);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 9);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renown trigger
|
||||
*/
|
||||
@Test
|
||||
public void testRelicSeeker() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
// Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.)
|
||||
// When Relic Seeker becomes renowned, you may search your library for an Equipment card, reveal it, put it into your hand, then shuffle your library.
|
||||
addCard(Zone.HAND, playerA, "Relic Seeker"); // 2/2
|
||||
|
||||
addCard(Zone.LIBRARY, playerA, "Veteran's Sidearm");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Relic Seeker");
|
||||
|
||||
attack(3, playerA, "Relic Seeker"); // 2 damage
|
||||
attack(5, playerA, "Relic Seeker"); // 3 damage
|
||||
|
||||
setStopAt(5, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Relic Seeker", 3, 3);
|
||||
assertHandCount(playerA, "Veteran's Sidearm", 1);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 15);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renown state
|
||||
*/
|
||||
@Test
|
||||
public void testHonoredHierarch() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
|
||||
// As long as Honored Hierarch is renowned, it has vigilance and "{T}: Add one mana of any color to your mana pool."
|
||||
addCard(Zone.HAND, playerA, "Honored Hierarch"); // 1/1
|
||||
|
||||
addCard(Zone.LIBRARY, playerA, "Veteran's Sidearm");
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Honored Hierarch");
|
||||
|
||||
attack(3, playerA, "Honored Hierarch"); // 1 damage
|
||||
attack(5, playerA, "Honored Hierarch"); // 2 damage
|
||||
|
||||
setStopAt(5, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Honored Hierarch", 2, 2);
|
||||
assertTapped("Honored Hierarch", false);
|
||||
assertAbility(playerA, "Honored Hierarch", VigilanceAbility.getInstance(), true);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 17);
|
||||
|
||||
}
|
||||
/**
|
||||
* Test renown > 1
|
||||
*/
|
||||
@Test
|
||||
public void testRhoxMaulers() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
|
||||
// Trample
|
||||
// Renown 2
|
||||
addCard(Zone.HAND, playerA, "Rhox Maulers"); // 4/4
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rhox Maulers");
|
||||
|
||||
attack(3, playerA, "Rhox Maulers"); // 4 damage
|
||||
attack(5, playerA, "Rhox Maulers"); // 6 damage
|
||||
attack(7, playerA, "Rhox Maulers"); // 6 damage
|
||||
|
||||
setStopAt(7, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPowerToughness(playerA, "Rhox Maulers", 6, 6);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 4);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -8,18 +8,21 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
|
||||
/**
|
||||
*
|
||||
* also tests regenerate and
|
||||
* tests that permanents with protection can be sacrificed
|
||||
*
|
||||
* also tests regenerate and tests that permanents with protection can be
|
||||
* sacrificed
|
||||
*
|
||||
* @author BetaSteward
|
||||
*/
|
||||
public class SpitefulShadowsTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testCard() {
|
||||
// Infect (This creature deals damage to creatures in the form of -1/-1 counters and to players in the form of poison counters.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Glistener Elf");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
// Enchant creature
|
||||
// Whenever enchanted creature is dealt damage, it deals that much damage to its controller.
|
||||
addCard(Zone.HAND, playerA, "Spiteful Shadows");
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.abilities.oneshot.destroy;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class WrathOfGodTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testDestroy() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains",4);
|
||||
addCard(Zone.HAND, playerA, "Wrath of God");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
// If Mossbridge Troll would be destroyed, regenerate it.
|
||||
// Tap any number of untapped creatures you control other than Mossbridge Troll with total power 10 or greater: Mossbridge Troll gets +20/+20 until end of turn.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mossbridge Troll");
|
||||
|
||||
// Flying
|
||||
// Darksteel Gargoyle is indestructible. ("Destroy" effects and lethal damage don't destroy it.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Darksteel Gargoyle");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mossbridge Troll");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Darksteel Gargoyle");
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wrath of God");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||
assertPermanentCount(playerA, "Mossbridge Troll", 0);
|
||||
assertPermanentCount(playerA, "Darksteel Gargoyle", 1);
|
||||
assertPermanentCount(playerB, "Silvercoat Lion", 0);
|
||||
assertPermanentCount(playerB, "Mossbridge Troll", 0);
|
||||
assertPermanentCount(playerB, "Darksteel Gargoyle", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.other;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -41,17 +40,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*/
|
||||
public class MycosynthGolemTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Mycosynth Golem
|
||||
* Artifact Creature — Golem 4/5, 11 (11)
|
||||
* Affinity for artifacts (This spell costs {1} less to cast for each
|
||||
* artifact you control.)
|
||||
* Artifact creature spells you cast have affinity for artifacts. (They cost
|
||||
* {1} less to cast for each artifact you control.)
|
||||
/**
|
||||
* Mycosynth Golem Artifact Creature — Golem 4/5, 11 (11) Affinity for
|
||||
* artifacts (This spell costs {1} less to cast for each artifact you
|
||||
* control.) Artifact creature spells you cast have affinity for artifacts.
|
||||
* (They cost {1} less to cast for each artifact you control.)
|
||||
*
|
||||
*/
|
||||
|
||||
// @Ignore // at this time player.getPlayable() does not account for spells that gain abilities
|
||||
@Test
|
||||
public void testSpellsAffinity() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
|
|
@ -60,13 +55,13 @@ public class MycosynthGolemTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Alpha Myr");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Alpha Myr");
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Alpha Myr", 1);
|
||||
assertHandCount(playerA, "Alpha Myr", 0);
|
||||
|
||||
|
||||
Permanent mountain = getPermanent("Mountain", playerA);
|
||||
Permanent forest = getPermanent("Forest", playerA);
|
||||
int tappedLands = 0;
|
||||
|
|
@ -79,5 +74,5 @@ public class MycosynthGolemTest extends CardTestPlayerBase {
|
|||
Assert.assertEquals("only one land may be tapped because the cost reduction", 1, tappedLands);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.abilities.other;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -39,17 +38,13 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*/
|
||||
public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Soulfire Grand Master
|
||||
* Creature - Human Monk 2/2, 1W (2)
|
||||
* Lifelink
|
||||
* Instant and sorcery spells you control have lifelink.
|
||||
* {2}{U/R}{U/R}: The next time you cast an instant or sorcery spell from
|
||||
* your hand this turn, put that card into your hand instead of into your
|
||||
* graveyard as it resolves.
|
||||
/**
|
||||
* Soulfire Grand Master Creature - Human Monk 2/2, 1W (2) Lifelink Instant
|
||||
* and sorcery spells you control have lifelink. {2}{U/R}{U/R}: The next
|
||||
* time you cast an instant or sorcery spell from your hand this turn, put
|
||||
* that card into your hand instead of into your graveyard as it resolves.
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testSpellsGainLifelink() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
|
|
@ -57,7 +52,7 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
|
|
@ -75,9 +70,9 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U/R}{U/R}:");
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Lightning Bolt", playerB);
|
||||
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
|
|
@ -87,12 +82,11 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertLife(playerB, 17);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test with Searing Blood
|
||||
* If the delayed triggered ability triggers, it has to give
|
||||
* life from lifelink because the source is still Searing Blood
|
||||
* Test with Searing Blood If the delayed triggered ability triggers, it has
|
||||
* to give life from lifelink because the source is still Searing Blood
|
||||
*/
|
||||
// @Ignore // Does not work because as the delayed triggered ability resolves, the source card is no longer on the stack and
|
||||
@Test
|
||||
public void testSearingBlood1() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
|
|
@ -117,9 +111,8 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test with Searing Blood
|
||||
* If the delayed triggered ability triggers, it has to give
|
||||
* life from lifelink because the source is still Searing Blood
|
||||
* Test with Searing Blood If the delayed triggered ability triggers, it has
|
||||
* to give life from lifelink because the source is still Searing Blood
|
||||
*/
|
||||
@Test
|
||||
public void testSearinBlood2() {
|
||||
|
|
@ -146,12 +139,12 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertLife(playerB, 17);
|
||||
assertLife(playerA, 28); // +2 from damage to Silvercoat Lion + 3 from Lighning Bolt + 3 from damage to Player B from Searing Blood
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test copied instant spell gives also life
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testCopySpell() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||
|
|
@ -172,20 +165,18 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Lightning Bolt", 1);
|
||||
|
||||
assertLife(playerB, 14);
|
||||
assertLife(playerA, 26);
|
||||
assertLife(playerA, 26);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test damage of activated ability of a permanent does not gain lifelink
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testActivatedAbility() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 3);
|
||||
|
||||
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
|
||||
// {3}, {T}: Rod of Ruin deals 1 damage to target creature or player.
|
||||
|
|
@ -200,21 +191,22 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Rod of Ruin", 1);
|
||||
|
||||
assertLife(playerB, 19);
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerA, 20);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Test that if Soulfire Grand Master has left the battlefield
|
||||
* spell has no longer lifelink
|
||||
* Test that if Soulfire Grand Master has left the battlefield spell has no
|
||||
* longer lifelink
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testSoulfireLeft() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
|
||||
|
||||
addCard(Zone.HAND, playerA, "Lightning Bolt");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
|
||||
|
||||
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
|
|
@ -229,28 +221,30 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Soulfire Grand Master", 1);
|
||||
|
||||
assertLife(playerB, 17);
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerA, 20);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* I activated the ability of Soulfire grand master, it resolved, then i cast Stoke the Flames
|
||||
* on Whisperwood Elemental, my opponenet sacrificed the elemental, so stoke didnt resolve,
|
||||
* but i still got the life from lifelink.
|
||||
* I activated the ability of Soulfire grand master, it resolved, then i
|
||||
* cast Stoke the Flames on Whisperwood Elemental, my opponenet sacrificed
|
||||
* the elemental, so stoke didnt resolve, but i still got the life from
|
||||
* lifelink.
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testSoulfireStokeTheFlames() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
|
||||
|
||||
|
||||
addCard(Zone.HAND, playerA, "Stoke the Flames");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Whisperwood Elemental", 1);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U/R}{U/R}:");
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Stoke the Flames", "Whisperwood Elemental");
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice {this}", null ,"{this} deals 4 damage");
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Sacrifice {this}", null, "{this} deals 4 damage");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
|
@ -259,29 +253,28 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Whisperwood Elemental", 1);
|
||||
|
||||
assertLife(playerB, 20);
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerA, 20);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if second ability resolved, the next spell that is counterer
|
||||
* won't go to hand back because it did not resolve
|
||||
*
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if second ability resolved, the next spell that is counterer won't
|
||||
* go to hand back because it did not resolve
|
||||
*
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testSoulfireCounteredSpellDontGoesBack() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 8);
|
||||
|
||||
|
||||
addCard(Zone.HAND, playerA, "Stoke the Flames");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
addCard(Zone.HAND, playerB, "Counterspell", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Whisperwood Elemental", 1);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2}{U/R}{U/R}:");
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "Stoke the Flames", "Whisperwood Elemental");
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Counterspell", "Stoke the Flames");
|
||||
|
||||
|
|
@ -292,26 +285,28 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Stoke the Flames", 1); // no legal target left so the spell is countered and goes to graveyard
|
||||
|
||||
assertLife(playerB, 20);
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerA, 20);
|
||||
|
||||
}
|
||||
/**
|
||||
* With a Soulfire Grand Master in play, Deflecting Palm doesn't gain the caster life.
|
||||
* It should as it has lifelink, and it's Deflecting Palm (an instant) dealing damage.
|
||||
* I was playing against a human in Standard Constructed.
|
||||
*
|
||||
}
|
||||
|
||||
/**
|
||||
* With a Soulfire Grand Master in play, Deflecting Palm doesn't gain the
|
||||
* caster life. It should as it has lifelink, and it's Deflecting Palm (an
|
||||
* instant) dealing damage. I was playing against a human in Standard
|
||||
* Constructed.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
@Test
|
||||
public void testWithDeflectingPalm() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
// Instant -{R}{W}
|
||||
// The next time a source of your choice would deal damage to you this turn, prevent that damage.
|
||||
// The next time a source of your choice would deal damage to you this turn, prevent that damage.
|
||||
// If damage is prevented this way, Deflecting Palm deals that much damage to that source's controller.
|
||||
addCard(Zone.HAND, playerA, "Deflecting Palm");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Soulfire Grand Master", 1);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
|
||||
|
|
@ -323,10 +318,10 @@ public class SoulfireGrandMasterTest extends CardTestPlayerBase {
|
|||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertGraveyardCount(playerA, "Deflecting Palm", 1);
|
||||
assertGraveyardCount(playerA, "Deflecting Palm", 1);
|
||||
|
||||
assertLife(playerB, 17);
|
||||
assertLife(playerA, 23); // damage is prevented + lifelink + 3
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.copy;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CleverImpersonatorTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Clever Impersonator Copy Gilded Drake. Gilded drake does not trigger to
|
||||
* exchange creature.
|
||||
*/
|
||||
@Test
|
||||
public void testCopyGildedDrake() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
// Flying
|
||||
// When Gilded Drake enters the battlefield, exchange control of Gilded Drake and up to one target creature an opponent controls. If you don't make an exchange, sacrifice Gilded Drake. This ability can't be countered except by spells and abilities.
|
||||
addCard(Zone.HAND, playerA, "Gilded Drake", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Pillarfield Ox", 1);
|
||||
|
||||
// You may have Clever Impersonator enter the battlefield as a copy of any nonland permanent on the battlefield.
|
||||
addCard(Zone.HAND, playerB, "Clever Impersonator", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Gilded Drake");
|
||||
addTarget(playerA, "Silvercoat Lion");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Clever Impersonator");
|
||||
setChoice(playerB, "Gilded Drake"); // copy the drake
|
||||
addTarget(playerB, "Pillarfield Ox"); // exchange control with Ox
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Gilded Drake", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
assertPermanentCount(playerB, "Gilded Drake", 1);
|
||||
assertPermanentCount(playerB, "Pillarfield Ox", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.copy;
|
||||
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.permanent.Permanent;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class FelhideSpiritbinderTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=17295&p=181417#p181440
|
||||
* Felhide Spiritbinder does not seem to be giving haste or the enchantment
|
||||
* subtype to tokens it creates..
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testTokenCopy() {
|
||||
// Inspired - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}.
|
||||
// If you do, put a token onto the battlefield that's a copy of another target creature
|
||||
// except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Felhide Spiritbinder", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||
|
||||
attack(2, playerB, "Felhide Spiritbinder");
|
||||
|
||||
setStopAt(4, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Silvercoat Lion", 1);
|
||||
Permanent lion = getPermanent("Silvercoat Lion", playerB);
|
||||
assertAbility(playerB, "Silvercoat Lion", HasteAbility.getInstance(), true);
|
||||
Assert.assertEquals("token has to have card type enchantment", true, lion.getCardType().contains(CardType.ENCHANTMENT));
|
||||
|
||||
assertLife(playerA, 17);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTokenCopyExiled() {
|
||||
// Inspired - Whenever Felhide Spiritbinder becomes untapped, you may pay {1}{R}.
|
||||
// If you do, put a token onto the battlefield that's a copy of another target creature
|
||||
// except it's an enchantment in addition to its other types. It gains haste. Exile it at the beginning of the next end step.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Felhide Spiritbinder", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||
|
||||
attack(2, playerB, "Felhide Spiritbinder");
|
||||
|
||||
setStopAt(5, PhaseStep.UPKEEP);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Silvercoat Lion", 0);
|
||||
|
||||
assertLife(playerA, 17);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.mana;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class EmptyOnlyOnTurnsEndManaTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testDaxosOfMeletis() {
|
||||
// At the beginning of each player's upkeep, that player adds {G}{G}{G} to his or her mana pool. Until end of turn, this mana doesn't empty from that player's mana pool as steps and phases end.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Shizuko, Caller of Autumn", 1);
|
||||
addCard(Zone.HAND, playerA, "Birds of Paradise", 1);
|
||||
|
||||
addCard(Zone.HAND, playerB, "Birds of Paradise", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Birds of Paradise");
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Birds of Paradise");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Birds of Paradise", 1);
|
||||
assertPermanentCount(playerB, "Birds of Paradise", 1);
|
||||
|
||||
Assert.assertEquals("2 {G} have to be still im Mana Pool", "{G}{G}", playerB.getManaPool().getMana().toString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.mana;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SpendManaAsThoughItWereManaOfAnyColorTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testDaxosOfMeletis() {
|
||||
// Put two 2/2 black Zombie creature tokens onto the battlefield.
|
||||
// Flashback (You may cast this card from your graveyard for its flashback cost. Then exile it.)
|
||||
addCard(Zone.LIBRARY, playerA, "Moan of the Unhallowed", 1);
|
||||
|
||||
skipInitShuffling();
|
||||
|
||||
// Daxos of Meletis can't be blocked by creatures with power 3 or greater.
|
||||
// Whenever Daxos of Meletis deals combat damage to a player, exile the top card of that player's library.
|
||||
// You gain life equal to that card's converted mana cost. Until end of turn, you may cast that card and
|
||||
// you may spend mana as though it were mana of any color to cast it.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Daxos of Meletis", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 4);
|
||||
|
||||
attack(2, playerB, "Daxos of Meletis");
|
||||
|
||||
castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Moan of the Unhallowed");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 18);
|
||||
assertLife(playerB, 24);
|
||||
|
||||
assertExileCount(playerA, 0);
|
||||
assertGraveyardCount(playerA, "Moan of the Unhallowed", 1);
|
||||
assertPermanentCount(playerB, "Zombie", 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,23 +37,49 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class DrawEffectsTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* The effects of multiple Thought Reflections are cumulative. For example, if you have
|
||||
* three Thought Reflections on the battlefield, you'll draw eight times the original number of cards.
|
||||
* The effects of multiple Thought Reflections are cumulative. For example,
|
||||
* if you have three Thought Reflections on the battlefield, you'll draw
|
||||
* eight times the original number of cards.
|
||||
*/
|
||||
@Test
|
||||
public void testCard() {
|
||||
// If you would draw a card, draw two cards instead.
|
||||
// If you would draw a card, draw two cards instead.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Thought Reflection", 3);
|
||||
|
||||
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
Assert.assertEquals("Player B has to have 4 cards in hand", 8 , playerB.getHand().size());
|
||||
Assert.assertEquals("Player B has to have 4 cards in hand", 8, playerB.getHand().size());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* http://www.slightlymagic.net/forum/viewtopic.php?f=70&t=17295&start=75#p181427
|
||||
* If I have a Notion Thief on the battlefield and cast Opportunity,
|
||||
* targeting my opponent, during my opponent's upkeep, the opponent
|
||||
* incorrectly draws the cards.
|
||||
*/
|
||||
@Test
|
||||
public void testNotionThief() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 6);
|
||||
// Flash
|
||||
// If an opponent would draw a card except the first one he or she draws in each of his or her draw steps, instead that player skips that draw and you draw a card.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Notion Thief", 1);
|
||||
|
||||
// Target player draws four cards.
|
||||
addCard(Zone.HAND, playerA, "Opportunity", 1);
|
||||
|
||||
castSpell(2, PhaseStep.UPKEEP, playerA, "Opportunity", playerB);
|
||||
|
||||
setStopAt(2, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Opportunity", 1);
|
||||
assertHandCount(playerA, 4);
|
||||
assertHandCount(playerB, 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.requirement;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class AttackRequirementTest extends CardTestPlayerBase {
|
||||
|
||||
|
||||
@Test
|
||||
public void testSimpleAttackRequirement() {
|
||||
// Defender
|
||||
// {G}: Wall of Tanglecord gains reach until end of turn. (It can block creatures with flying.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Wall of Tanglecord"); // 0/6
|
||||
|
||||
// Juggernaut attacks each turn if able.
|
||||
// Juggernaut can't be blocked by Walls
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Juggernaut"); // 5/3
|
||||
|
||||
// Juggernaut should be forced to ttack
|
||||
block(2, playerA, "Wall of Tanglecord", "Juggernaut"); // this block should'nt work because of Juggernauts restriction
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 15);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAttackRequirementWithAttackRestriction() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 3);
|
||||
// Defender
|
||||
// {G}: Wall of Tanglecord gains reach until end of turn. (It can block creatures with flying.)
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Wall of Tanglecord"); // 0/6
|
||||
|
||||
// Creatures can't attack you unless their controller pays {2} for each creature he or she controls that's attacking you
|
||||
addCard(Zone.HAND, playerA, "Ghostly Prison");
|
||||
|
||||
// Juggernaut attacks each turn if able.
|
||||
// Juggernaut can't be blocked by Walls
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Juggernaut"); // 5/3
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Ghostly Prison");
|
||||
|
||||
// Juggernaut is forced to attack but can't without paying the Ghostly Prison cost and don't has to pay the costs so no attack
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ package org.mage.test.cards.restriction;
|
|||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -36,18 +37,18 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CantAttackTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests "If all other elves get the Forestwalk ability and can't be blockt from creatures whose controler has a forest in game"
|
||||
* Tests "If all other elves get the Forestwalk ability and can't be blockt
|
||||
* from creatures whose controler has a forest in game"
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testAttack() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Myr Enforcer"); // 4/4
|
||||
|
||||
// Except for creatures named Akron Legionnaire and artifact creatures, creatures you control can't attack.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Akron Legionnaire"); // 8/4
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); // 2/2
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Myr Enforcer"); // 4/4
|
||||
|
|
@ -64,20 +65,21 @@ public class CantAttackTest extends CardTestPlayerBase {
|
|||
|
||||
assertLife(playerA, 8); // 8 + 4
|
||||
assertLife(playerB, 14); // 4 + 2
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@Test
|
||||
public void testAttackHarborSerpent() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion"); // 2/2
|
||||
// Islandwalk (This creature is unblockable as long as defending player controls an Island.)
|
||||
// Harbor Serpent can't attack unless there are five or more Islands on the battlefield.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Harbor Serpent"); // 5/5
|
||||
addCard(Zone.HAND, playerA, "Island");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); // 2/2
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Harbor Serpent"); // 5/5
|
||||
|
||||
|
||||
attack(2, playerB, "Harbor Serpent");
|
||||
attack(2, playerB, "Silvercoat Lion");
|
||||
|
||||
|
|
@ -88,9 +90,54 @@ public class CantAttackTest extends CardTestPlayerBase {
|
|||
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerB, 13);
|
||||
assertLife(playerA, 18);
|
||||
assertLife(playerB, 13);
|
||||
assertLife(playerA, 18);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlazingArchon() {
|
||||
// Flying
|
||||
// Creatures can't attack you.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Blazing Archon");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Ajani Goldmane"); // Planeswalker 4 loyality counter
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion"); // 2/2
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox"); // 2/4
|
||||
|
||||
attack(2, playerB, "Pillarfield Ox", "Ajani Goldmane");
|
||||
attack(2, playerB, "Silvercoat Lion", playerA);
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
|
||||
assertTapped("Silvercoat Lion", false);
|
||||
assertTapped("Pillarfield Ox", true);
|
||||
assertCounterCount("Ajani Goldmane", CounterType.LOYALTY, 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCowedByWisdom() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 1);
|
||||
// Enchant creature
|
||||
// Enchanted creature can't attack or block unless its controller pays {1} for each card in your hand.
|
||||
addCard(Zone.HAND, playerA, "Cowed by Wisdom"); // Planeswalker 4 loyality counter
|
||||
|
||||
// Bushido 2 (When this blocks or becomes blocked, it gets +2/+2 until end of turn.)
|
||||
// Battle-Mad Ronin attacks each turn if able.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Battle-Mad Ronin");
|
||||
addCard(Zone.HAND, playerA, "Mountain", 4);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Cowed by Wisdom", "Battle-Mad Ronin");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
|
||||
assertTapped("Battle-Mad Ronin", false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package org.mage.test.cards.single.rtr;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
|
|
@ -35,36 +34,32 @@ import org.junit.Test;
|
|||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
* Jace, Architect of Thought {2}{U}{U}
|
||||
* Planeswalker — Jace
|
||||
* Loyalty 4
|
||||
* +1: Until your next turn, whenever a creature an opponent controls attacks, it gets
|
||||
* -1/-0 until end of turn.
|
||||
* -2: Reveal the top three cards of your library. An opponent separates those cards into
|
||||
* two piles. Put one pile into your hand and the other on the bottom of your library
|
||||
* in any order.
|
||||
* -8: For each player, search that player's library for a nonland card and exile it, then
|
||||
* that player shuffles his or her library. You may cast those cards without paying
|
||||
* their mana costs.
|
||||
*
|
||||
* Jace, Architect of Thought {2}{U}{U} Planeswalker — Jace Loyalty 4 +1: Until
|
||||
* your next turn, whenever a creature an opponent controls attacks, it gets
|
||||
* -1/-0 until end of turn. -2: Reveal the top three cards of your library. An
|
||||
* opponent separates those cards into two piles. Put one pile into your hand
|
||||
* and the other on the bottom of your library in any order. -8: For each
|
||||
* player, search that player's library for a nonland card and exile it, then
|
||||
* that player shuffles his or her library. You may cast those cards without
|
||||
* paying their mana costs.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class JaceArchitectOfThoughtTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testAbility1normal() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Jace, Architect of Thought");
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Until your next turn, whenever a creature an opponent controls attacks, it gets -1/-0 until end of turn.");
|
||||
|
||||
attack(2, playerB, "Silvercoat Lion");
|
||||
|
||||
|
||||
setStopAt(2, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertCounterCount("Jace, Architect of Thought", CounterType.LOYALTY, 5);
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 1, 2);
|
||||
|
||||
|
|
@ -72,53 +67,56 @@ public class JaceArchitectOfThoughtTest extends CardTestPlayerBase {
|
|||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAbilit1lastOnlyUntilNextTurn() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Jace, Architect of Thought");
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Until your next turn, whenever a creature an opponent controls attacks, it gets -1/-0 until end of turn.");
|
||||
|
||||
attack(2, playerB, "Silvercoat Lion");
|
||||
attack(4, playerB, "Silvercoat Lion");
|
||||
|
||||
|
||||
setStopAt(4, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertCounterCount("Jace, Architect of Thought", CounterType.LOYALTY, 5);
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 2, 2);
|
||||
|
||||
assertLife(playerA, 17);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
Ability 1 has still to trigger next turn if used also if Jace left the battlefield.
|
||||
*/
|
||||
Ability 1 has still to trigger next turn if used also if Jace left the battlefield.
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testAbility1AfterJacesWasExiled() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Jace, Architect of Thought");
|
||||
|
||||
|
||||
// Sorcery {R}{B}
|
||||
// Destroy target creature or planeswalker.
|
||||
addCard(Zone.HAND, playerB, "Dreadbore");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Until your next turn, whenever a creature an opponent controls attacks, it gets -1/-0 until end of turn.");
|
||||
|
||||
|
||||
// +1: Until your next turn, whenever a creature an opponent controls attacks, it gets -1/-0 until end of turn.
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "+1: Until your next turn");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Dreadbore", "Jace, Architect of Thought");
|
||||
attack(2, playerB, "Silvercoat Lion");
|
||||
|
||||
|
||||
setStopAt(2, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 19);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerB, "Jace, Architect of Thought", 0);
|
||||
|
||||
assertPermanentCount(playerA, "Jace, Architect of Thought", 0);
|
||||
assertPowerToughness(playerB, "Silvercoat Lion", 1, 2);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.triggers;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class GolemsHeartTest extends CardTestPlayerBase {
|
||||
|
||||
/*
|
||||
My opponent and I were both playing artifact decks.
|
||||
He had Golem's Heart out.
|
||||
He wasn't gaining life when I or he was casting spells.
|
||||
*/
|
||||
@Test
|
||||
public void testFirstTriggeredAbility() {
|
||||
// Whenever a player casts an artifact spell, you may gain 1 life.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Golem's Heart", 1);
|
||||
|
||||
addCard(Zone.HAND, playerA, "Expedition Map"); // {1}
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 1);
|
||||
|
||||
addCard(Zone.HAND, playerB, "Darksteel Axe"); // {1}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Expedition Map");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Darksteel Axe");
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 22);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertPermanentCount(playerA, "Expedition Map", 1);
|
||||
assertPermanentCount(playerB, "Darksteel Axe", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
|
|
@ -82,9 +81,10 @@ public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertPermanentCount(playerA, "Arcbound Worker", 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* That that the creature with a +1/+1 counter does not return
|
||||
* if the card was removed from graveyard meanwhile
|
||||
* Test that the creature with a +1/+1 counter does not return if the card
|
||||
* was removed from graveyard meanwhile by Relic of Progenitus
|
||||
*/
|
||||
@Test
|
||||
public void testMarchesatheBlackRoseAfterExile() {
|
||||
|
|
@ -100,10 +100,10 @@ public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
|
|||
// {T}: Target player exiles a card from his or her graveyard.
|
||||
// {1}, Exile Relic of Progenitus: Exile all cards from all graveyards. Draw a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Relic of Progenitus", 1);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Arcbound Worker");
|
||||
castSpell(1, PhaseStep.END_COMBAT, playerB, "Lightning Bolt", "Arcbound Worker");
|
||||
|
||||
|
||||
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "{T}: Target player exiles", playerA);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
|
|
@ -113,13 +113,15 @@ public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Arcbound Worker", 0);
|
||||
|
||||
assertExileCount("Arcbound Worker", 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* With my opponent's Deathmist Raptor return-to-battlefield trigger on the stack,
|
||||
* I exiled the Deathmist Raptor with Pharika, God of Affliction. However, the Deathmist Raptor
|
||||
* returned to the battlefield from exile, though it should not have because it had
|
||||
* changed zones so was a different object.
|
||||
* With my opponent's Deathmist Raptor return-to-battlefield trigger on the
|
||||
* stack, I exiled the Deathmist Raptor with Pharika, God of Affliction.
|
||||
* However, the Deathmist Raptor returned to the battlefield from exile,
|
||||
* though it should not have because it had changed zones so was a different
|
||||
* object.
|
||||
*/
|
||||
@Test
|
||||
public void testDeathmistRaptor() {
|
||||
|
|
@ -129,20 +131,20 @@ public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
|
|||
addCard(Zone.GRAVEYARD, playerA, "Deathmist Raptor");
|
||||
addCard(Zone.HAND, playerA, "Pine Walker");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 5);
|
||||
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Forest", 1);
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
// {B}{G}: Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield.
|
||||
// {B}{G}: Exile target creature card from a graveyard. It's owner puts a 1/1 black and green Snake enchantment creature token with deathtouch onto the battlefield.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Pharika, God of Affliction", 1);
|
||||
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerB, "{B}{G}: Exile target creature card from a graveyard",
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerA, "{4}{G}: Turn this face-down permanent face up.");
|
||||
activateAbility(3, PhaseStep.POSTCOMBAT_MAIN, playerB, "{B}{G}: Exile target creature card from a graveyard",
|
||||
"Deathmist Raptor", "Whenever a permanent you control is turned face up");
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
||||
setStopAt(3, PhaseStep.END_TURN);
|
||||
|
||||
execute();
|
||||
assertPermanentCount(playerB, "Pharika, God of Affliction", 1);
|
||||
|
|
@ -150,6 +152,37 @@ public class ReturnToBattlefieldEffectsTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Pine Walker", 1);
|
||||
|
||||
assertExileCount("Deathmist Raptor", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reassembling Skeleton is blocked by Necroskitter, and dies. Necroskitter
|
||||
* triggers. With the trigger on the stack, activate Skeleton and return it
|
||||
* to play. Expected result: trigger can't find Skeleton since it changed
|
||||
* zones. Actual result: trigger steals control of Skeleton when it's
|
||||
* already on the battlefield.
|
||||
*/
|
||||
@Test
|
||||
public void testNecroskitter1() {
|
||||
// Wither (This deals damage to creatures in the form of -1/-1 counters.)
|
||||
// Whenever a creature an opponent controls with a -1/-1 counter on it dies, you may return that card to the battlefield under your control.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Necroskitter", 1); // 1/4
|
||||
|
||||
// {1}{B}: Return Reassembling Skeleton from your graveyard to the battlefield tapped.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Reassembling Skeleton");
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||
|
||||
attack(2, playerB, "Reassembling Skeleton");
|
||||
block(2, playerA, "Necroskitter", "Reassembling Skeleton");
|
||||
|
||||
activateAbility(2, PhaseStep.COMBAT_DAMAGE, playerB, "{1}{B}: Return", NO_TARGET, "Whenever a creature");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertPermanentCount(playerB, "Reassembling Skeleton", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,10 @@
|
|||
*/
|
||||
package org.mage.test.cards.triggers;
|
||||
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
|
|
@ -133,7 +134,6 @@ public class WorldgorgerDragonTest extends CardTestPlayerBase {
|
|||
*
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
public void testWithAnimateDeadDifferentTargets() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
|
||||
|
|
@ -153,35 +153,40 @@ public class WorldgorgerDragonTest extends CardTestPlayerBase {
|
|||
// When Staunch Defenders enters the battlefield, you gain 4 life.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Staunch Defenders", 1);
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {B}");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Animate Dead", "Worldgorger Dragon");
|
||||
addTarget(playerA, "Worldgorger Dragon");
|
||||
addTarget(playerA, "Worldgorger Dragon");
|
||||
addTarget(playerA, "Silvercoat Lion");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
setChoice(playerA, "Worldgorger Dragon");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 9);
|
||||
setChoice(playerA, "X=7");
|
||||
setChoice(playerA, "Silvercoat Lion");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {R}");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Volcanic Geyser", playerB, 9);
|
||||
setChoice(playerA, "X=9");
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Volcanic Geyser", 1);
|
||||
assertGraveyardCount(playerA, "Worldgorger Dragon", 1);
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
assertLife(playerA, 24);
|
||||
assertLife(playerA, 28);
|
||||
assertLife(playerB, 11);
|
||||
|
||||
assertGraveyardCount(playerA, "Volcanic Geyser", 1);
|
||||
Assert.assertEquals("Mana pool", "[]", playerA.getManaAvailable(currentGame).toString());
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.cards.triggers.dies;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class GainedDiesTriggersTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* Tests that gained dies triggers work as intended
|
||||
*/
|
||||
@Test
|
||||
public void testInfernalScarring() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 3);
|
||||
|
||||
// Enchant creature
|
||||
// Enchanted creature gets +2/+0 and has "When this creature dies, draw a card."
|
||||
addCard(Zone.HAND, playerA, "Infernal Scarring", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Infernal Scarring", "Silvercoat Lion");
|
||||
|
||||
// Destroy all creatures.
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", "Silvercoat Lion");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Silvercoat Lion", 1);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 1);
|
||||
assertHandCount(playerA, 1); // draw a card for dying Lion
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.commander.duel;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameException;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestCommanderDuelBase;
|
||||
|
||||
/**
|
||||
* This tests checks for problems that could arise from the possible commander
|
||||
* returns to the command zone option.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CommanderReplaceEffectTest extends CardTestCommanderDuelBase {
|
||||
|
||||
@Override
|
||||
protected Game createNewGameAndPlayers() throws GameException, FileNotFoundException {
|
||||
setDecknamePlayerA("CommanderDuel_UW.dck"); // Commander = Daxos of Meletis
|
||||
setDecknamePlayerB("CommanderDuel_UW.dck"); // Commander = Daxos of Meletis
|
||||
return super.createNewGameAndPlayers();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void castCommanderWithFlash() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 1);
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 6);
|
||||
addCard(Zone.HAND, playerB, "Phyrexian Rebirth", 1);
|
||||
|
||||
// Daxos of Meletis can't be blocked by creatures with power 3 or greater.
|
||||
// Whenever Daxos of Meletis deals combat damage to a player, exile the top card of that player's library. You gain life equal to that card's converted mana cost. Until end of turn, you may cast that card and you may spend mana as though it were mana of any color to cast it.
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Daxos of Meletis");
|
||||
|
||||
// Destroy all creatures, then put an X/X colorless Horror artifact creature token onto the battlefield, where X is the number of creatures destroyed this way.
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Phyrexian Rebirth");
|
||||
|
||||
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Daxos of Meletis", 0);
|
||||
assertGraveyardCount(playerA, "Daxos of Meletis", 0);
|
||||
|
||||
assertPermanentCount(playerB, "Horror", 1);
|
||||
assertPowerToughness(playerB, "Horror", 1, 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2012 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
|
@ -20,21 +20,32 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package org.mage.test.player;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.abilities.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.Modes;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.PassAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.RangeOfInfluence;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -45,13 +56,10 @@ import mage.target.Target;
|
|||
import mage.target.TargetAmount;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* plays randomly
|
||||
*
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class RandomPlayer extends ComputerPlayer {
|
||||
|
|
@ -85,12 +93,13 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
return actionCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean priority(Game game) {
|
||||
boolean didSomething = false;
|
||||
Ability ability = getAction(game);
|
||||
if (!(ability instanceof PassAbility))
|
||||
if (!(ability instanceof PassAbility)) {
|
||||
didSomething = true;
|
||||
}
|
||||
|
||||
activateAbility((ActivatedAbility) ability, game);
|
||||
|
||||
|
|
@ -135,7 +144,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
// }
|
||||
// }
|
||||
// else {
|
||||
break;
|
||||
break;
|
||||
// }
|
||||
}
|
||||
return ability;
|
||||
|
|
@ -154,8 +163,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
List<Ability> options = getPlayableOptions(source, game);
|
||||
if (options.isEmpty()) {
|
||||
ability = source;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (options.size() == 1) {
|
||||
ability = options.get(0);
|
||||
} else {
|
||||
|
|
@ -197,9 +205,9 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
setStoredBookmark(game.bookmarkState()); // makes it possible to UNDO a declared attacker with costs from e.g. Propaganda
|
||||
if (!game.getCombat().declareAttacker(attackersList.get(i).getId(), defenderId, playerId, game)) {
|
||||
game.undo(playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
actionCount++;
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +219,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
}
|
||||
|
||||
List<Permanent> blockers = getAvailableBlockers(game);
|
||||
for (Permanent blocker: blockers) {
|
||||
for (Permanent blocker : blockers) {
|
||||
int check = rnd.nextInt(numGroups + 1);
|
||||
if (check < numGroups) {
|
||||
CombatGroup group = game.getCombat().getGroups().get(check);
|
||||
|
|
@ -248,7 +256,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
}
|
||||
|
||||
protected boolean chooseRandomTarget(Target target, Ability source, Game game) {
|
||||
Set<UUID> possibleTargets = target.possibleTargets(source==null?null:source.getSourceId(), playerId, game);
|
||||
Set<UUID> possibleTargets = target.possibleTargets(source == null ? null : source.getSourceId(), playerId, game);
|
||||
if (possibleTargets.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -317,7 +325,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
|
||||
@Override
|
||||
public boolean chooseTargetAmount(Outcome outcome, TargetAmount target, Ability source, Game game) {
|
||||
Set<UUID> possibleTargets = target.possibleTargets(source==null?null:source.getSourceId(), playerId, game);
|
||||
Set<UUID> possibleTargets = target.possibleTargets(source == null ? null : source.getSourceId(), playerId, game);
|
||||
if (possibleTargets.isEmpty()) {
|
||||
return !target.isRequired(source);
|
||||
}
|
||||
|
|
@ -346,7 +354,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean chooseUse(Outcome outcome, String message, Game game) {
|
||||
public boolean chooseUse(Outcome outcome, String message, Ability source, Game game) {
|
||||
return rnd.nextBoolean();
|
||||
}
|
||||
|
||||
|
|
@ -379,12 +387,12 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
|
||||
@Override
|
||||
public Mode chooseMode(Modes modes, Ability source, Game game) {
|
||||
Iterator<Mode> it = modes.values().iterator();
|
||||
Iterator<Mode> it = modes.getAvailableModes(source, game).iterator();
|
||||
Mode mode = it.next();
|
||||
if (modes.size() == 1) {
|
||||
return mode;
|
||||
}
|
||||
int modeNum = rnd.nextInt(modes.values().size());
|
||||
int modeNum = rnd.nextInt(modes.getAvailableModes(source, game).size());
|
||||
for (int i = 0; i < modeNum; i++) {
|
||||
mode = it.next();
|
||||
}
|
||||
|
|
@ -410,8 +418,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
if (targets.size() == 1) {
|
||||
targetId = targets.get(0);
|
||||
amount = remainingDamage;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
targetId = targets.get(rnd.nextInt(targets.size()));
|
||||
amount = rnd.nextInt(damage + 1);
|
||||
}
|
||||
|
|
@ -419,8 +426,7 @@ public class RandomPlayer extends ComputerPlayer {
|
|||
if (permanent != null) {
|
||||
permanent.damage(amount, sourceId, game, false, true);
|
||||
remainingDamage -= amount;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Player player = game.getPlayer(targetId);
|
||||
if (player != null) {
|
||||
player.damage(amount, sourceId, game, false, true);
|
||||
|
|
|
|||
|
|
@ -99,8 +99,6 @@ import mage.target.common.TargetCreaturePermanentAmount;
|
|||
import mage.target.common.TargetPermanentOrPlayer;
|
||||
import org.junit.Ignore;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -119,7 +117,6 @@ public class TestPlayer implements Player {
|
|||
|
||||
private final ComputerPlayer computerPlayer;
|
||||
|
||||
|
||||
public TestPlayer(ComputerPlayer computerPlayer) {
|
||||
this.computerPlayer = computerPlayer;
|
||||
AIPlayer = false;
|
||||
|
|
@ -156,13 +153,14 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param maxCallsWithoutAction max number of priority passes a player may have for this test (default = 100)
|
||||
*/
|
||||
*
|
||||
* @param maxCallsWithoutAction max number of priority passes a player may
|
||||
* have for this test (default = 100)
|
||||
*/
|
||||
public void setMaxCallsWithoutAction(int maxCallsWithoutAction) {
|
||||
this.maxCallsWithoutAction = maxCallsWithoutAction;
|
||||
}
|
||||
|
||||
|
||||
protected Permanent findPermanent(FilterPermanent filter, UUID controllerId, Game game) {
|
||||
List<Permanent> permanents = game.getBattlefield().getAllActivePermanents(filter, controllerId, game);
|
||||
if (permanents.size() > 0) {
|
||||
|
|
@ -427,7 +425,7 @@ public class TestPlayer implements Player {
|
|||
if (numberOfActions == actions.size()) {
|
||||
foundNoAction++;
|
||||
if (foundNoAction > maxCallsWithoutAction) {
|
||||
throw new AssertionError("More priority calls to " +getName() + " and doing no action than allowed (" + maxCallsWithoutAction +")");
|
||||
throw new AssertionError("More priority calls to " + getName() + " and doing no action than allowed (" + maxCallsWithoutAction + ")");
|
||||
}
|
||||
} else {
|
||||
foundNoAction = 0;
|
||||
|
|
@ -512,7 +510,7 @@ public class TestPlayer implements Player {
|
|||
if (!modesSet.isEmpty() && modes.getMaxModes() > modes.getSelectedModes().size()) {
|
||||
int selectedMode = Integer.parseInt(modesSet.get(0));
|
||||
int i = 1;
|
||||
for (Mode mode : modes.values()) {
|
||||
for (Mode mode : modes.getAvailableModes(source, game)) {
|
||||
if (i == selectedMode) {
|
||||
modesSet.remove(0);
|
||||
return mode;
|
||||
|
|
@ -609,13 +607,13 @@ public class TestPlayer implements Player {
|
|||
if (target instanceof TargetCardInGraveyard) {
|
||||
TargetCardInGraveyard targetCardInGraveyard = ((TargetCardInGraveyard) target);
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
for(UUID playerId: this.getInRange()) {
|
||||
for (UUID playerId : this.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
possibleTargets.addAll(player.getGraveyard());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (String choose2 : choices) {
|
||||
String[] targetList = choose2.split("\\^");
|
||||
boolean targetFound = false;
|
||||
|
|
@ -628,8 +626,10 @@ public class TestPlayer implements Player {
|
|||
if (targetCardInGraveyard.canTarget(targetObject.getId(), game)) {
|
||||
if (alreadyTargetted != null && !alreadyTargetted.contains(targetObject.getId())) {
|
||||
targetCardInGraveyard.add(targetObject.getId(), game);
|
||||
choices.remove(choose2);
|
||||
targetFound = true;
|
||||
if (target.getTargets().size() >= target.getMaxNumberOfTargets()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -641,7 +641,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (target instanceof TargetSource) {
|
||||
Set<UUID> possibleTargets;
|
||||
TargetSource t = ((TargetSource) target);
|
||||
|
|
@ -793,7 +793,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean chooseUse(Outcome outcome, String message, Game game) {
|
||||
public boolean chooseUse(Outcome outcome, String message, Ability source, Game game) {
|
||||
if (!choices.isEmpty()) {
|
||||
if (choices.get(0).equals("No")) {
|
||||
choices.remove(0);
|
||||
|
|
@ -810,10 +810,12 @@ public class TestPlayer implements Player {
|
|||
@Override
|
||||
public int announceXMana(int min, int max, String message, Game game, Ability ability) {
|
||||
if (!choices.isEmpty()) {
|
||||
if (choices.get(0).startsWith("X=")) {
|
||||
int xValue = Integer.parseInt(choices.get(0).substring(2));
|
||||
choices.remove(0);
|
||||
return xValue;
|
||||
for (String choice : choices) {
|
||||
if (choice.startsWith("X=")) {
|
||||
int xValue = Integer.parseInt(choice.substring(2));
|
||||
choices.remove(choice);
|
||||
return xValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return computerPlayer.announceXMana(min, max, message, game, ability);
|
||||
|
|
@ -1128,6 +1130,11 @@ public class TestPlayer implements Player {
|
|||
computerPlayer.lookAtCards(name, cards, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lookAtCards(String name, Card card, Game game) {
|
||||
computerPlayer.lookAtCards(name, card, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void phasing(Game game) {
|
||||
computerPlayer.phasing(game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue