* Fixed a bug in calculation of available mana that can be a source of heavy server load.

This commit is contained in:
LevelX2 2015-02-13 08:39:44 +01:00
parent fcd1d89137
commit 0722276ca4
3 changed files with 43 additions and 4 deletions

View file

@ -128,6 +128,42 @@ public class ManaOptionsTest extends CardTestPlayerBase {
Assert.assertEquals("{W}{W}{Any}{Any}", getManaOption(0, manaOptions));
}
// Crystal Quarry
// {T}: {1} Add to your mana pool.
// {5}, {T}: Add {W}{U}{B}{R}{G} to your mana pool.
@Test
public void testCrystalQuarry() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Crystal Quarry", 1);
setStopAt(1, PhaseStep. UPKEEP);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit",1, manaOptions.size());
Assert.assertEquals("{1}{G}{G}{W}{W}", getManaOption(0, manaOptions));
}
// Crystal Quarry
// {T}: {1} Add to your mana pool.
// {5}, {T}: Add {W}{U}{B}{R}{G} to your mana pool.
@Test
public void testCrystalQuarry2() {
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
addCard(Zone.BATTLEFIELD, playerA, "Crystal Quarry", 1);
setStopAt(1, PhaseStep. UPKEEP);
execute();
ManaOptions manaOptions = playerA.getAvailableManaTest(currentGame);
Assert.assertEquals("mana variations don't fit",2, manaOptions.size());
Assert.assertEquals("{1}{G}{G}{G}{W}{W}", getManaOption(0, manaOptions));
Assert.assertEquals("{R}{G}{U}{W}{B}", getManaOption(1, manaOptions));
}
private String getManaOption(int index, ManaOptions manaOptions) {
if (manaOptions.size() < index + 1) {
return "";