More failing tests based on bug reports

This commit is contained in:
magenoxx 2012-05-11 20:25:58 +04:00
parent 38eaef59e0
commit 519e136431
7 changed files with 194 additions and 35 deletions

View file

@ -0,0 +1,40 @@
package org.mage.test.cards.abilities.equipped;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author noxx
*/
public class GolemSkinGauntletsTest extends CardTestPlayerBase {
/**
* Tests that creature will get +1/0 for each equipment
*/
@Test
public void testBoostOnEquip() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 6);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Golem-Skin Gauntlets");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {2}", "Elite Vanguard");
setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 20);
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
Assert.assertTrue(eliteVanguard.getAttachments().size() == 2);
Assert.assertEquals(4, eliteVanguard.getPower().getValue());
Assert.assertEquals(1, eliteVanguard.getPower().getValue());
}
}

View file

@ -0,0 +1,63 @@
package org.mage.test.cards.abilities.equipped;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author noxx
*/
public class HeavyArbalestTest extends CardTestPlayerBase {
/**
* Tests that creature with Heavy Arbalest will use it and won't untap
*/
@Test
public void testNotUntapping() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 2 damage", playerB);
setStopAt(3, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 18);
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
Assert.assertTrue(eliteVanguard.getAttachments().size() > 0);
Assert.assertTrue(eliteVanguard.isTapped());
}
/**
* Tests that creature with Heavy Arbalest will use it and untap later
*/
@Test
public void testUntapsLater() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 4);
addCard(Constants.Zone.BATTLEFIELD, playerA, "Heavy Arbalest");
addCard(Constants.Zone.BATTLEFIELD, playerA, "Elite Vanguard");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Llanowar Elves");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Equip {4}", "Elite Vanguard");
activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: {source} deals 2 damage", playerB);
setStopAt(5, Constants.PhaseStep.BEGIN_COMBAT);
execute();
assertLife(playerA, 20);
assertLife(playerB, 18);
Permanent eliteVanguard = getPermanent("Elite Vanguard", playerA.getId());
Assert.assertTrue(eliteVanguard.getAttachments().size() > 0);
Assert.assertFalse(eliteVanguard.isTapped());
}
}

View file

@ -0,0 +1,56 @@
package org.mage.test.cards.control;
import mage.Constants;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author noxx
*/
public class BattlefieldTriggeredAbilitiesTest extends CardTestPlayerBase {
@Test
public void testBeguilerofWillsAndPrimevalTitan() {
addCard(Constants.Zone.BATTLEFIELD, playerA, "Primeval Titan");
addCard(Constants.Zone.LIBRARY, playerA, "Mountain", 10);
addCard(Constants.Zone.BATTLEFIELD, playerB, "Beguiler of Wills");
addCard(Constants.Zone.BATTLEFIELD, playerB, "Arrogant Bloodlord", 5);
addCard(Constants.Zone.LIBRARY, playerB, "Mountain", 10);
activateAbility(2, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "{T}: Gain control", "Primeval Titan");
attack(4, playerB, "Primeval Titan");
setStopAt(4, Constants.PhaseStep.END_TURN);
execute();
assertLife(playerA, 14);
assertLife(playerB, 20);
assertPermanentCount(playerB, "Beguiler of Wills", 1);
assertPermanentCount(playerB, "Arrogant Bloodlord", 5);
assertPermanentCount(playerB, "Primeval Titan", 1);
// lands weren't added to playerA
assertPermanentCount(playerA, "Mountain", 0);
// but to playerB instead
int playerACount = 0;
int playerBCount = 0;
for (Permanent p : currentGame.getBattlefield().getAllActivePermanents()) {
if (p.getCardType().contains(Constants.CardType.LAND)) {
if (p.getControllerId().equals(playerB.getId())) {
playerBCount++;
}
if (p.getControllerId().equals(playerA.getId())) {
playerACount++;
}
}
}
Assert.assertEquals(0, playerACount);
Assert.assertEquals(2, playerBCount);
}
}

View file

@ -0,0 +1,4 @@
/**
* Contains tests for cards and game positions that causes some cards to change its controller.
*/
package org.mage.test.cards.control;