mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
commit
745c3a9a7e
3 changed files with 80 additions and 1 deletions
|
@ -27,6 +27,7 @@
|
||||||
*/
|
*/
|
||||||
package mage.cards.d;
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import mage.ConditionalMana;
|
||||||
import mage.Mana;
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
|
@ -93,7 +94,16 @@ class DoublingCubeEffect extends ManaEffect {
|
||||||
int greenMana = pool.getGreen();
|
int greenMana = pool.getGreen();
|
||||||
int redMana = pool.getRed();
|
int redMana = pool.getRed();
|
||||||
int colorlessMana = pool.getColorless();
|
int colorlessMana = pool.getColorless();
|
||||||
Mana mana = new Mana(redMana, greenMana, blueMana, whiteMana, blackMana, colorlessMana, 0, 0);
|
|
||||||
|
for(ConditionalMana conditionalMana : pool.getConditionalMana()){
|
||||||
|
blackMana += conditionalMana.getBlack();
|
||||||
|
whiteMana += conditionalMana.getWhite();
|
||||||
|
blueMana += conditionalMana.getBlue();
|
||||||
|
greenMana += conditionalMana.getGreen();
|
||||||
|
redMana += conditionalMana.getRed();
|
||||||
|
colorlessMana += conditionalMana.getColorless();
|
||||||
|
}
|
||||||
|
Mana mana = new Mana(redMana, greenMana, blueMana, whiteMana, blackMana, 0, 0, colorlessMana);
|
||||||
checkToFirePossibleEvents(mana, game, source);
|
checkToFirePossibleEvents(mana, game, source);
|
||||||
pool.addMana(mana, game, source);
|
pool.addMana(mana, game, source);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.mage.test.cards.mana;
|
||||||
|
|
||||||
|
import mage.abilities.costs.mana.ColorlessManaCost;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
import org.mage.test.serverside.base.impl.CardTestAPIImpl;
|
||||||
|
|
||||||
|
public class DoublingCubeTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
// {3}, {T}: Double the amount of each type of mana in your mana pool.
|
||||||
|
String cube = "Doubling Cube";
|
||||||
|
// {T}: Add {C}{C} to your mana pool. Spend this mana only to cast colorless Eldrazi spells or activate abilities of colorless Eldrazi.
|
||||||
|
String temple = "Eldrazi Temple";
|
||||||
|
// Mana pools don't empty as steps and phases end.
|
||||||
|
String upwelling = "Upwelling";
|
||||||
|
|
||||||
|
//issue 3443
|
||||||
|
@Test
|
||||||
|
public void DoublingCubeEldraziTemple() {
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, temple);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, cube);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, upwelling);
|
||||||
|
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G} to your mana pool");
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G} to your mana pool");
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {G} to your mana pool");
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Add {C}{C}");
|
||||||
|
|
||||||
|
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{3},{T}:");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
assertManaPool(playerA, "colorless", 4);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package org.mage.test.serverside.base.impl;
|
package org.mage.test.serverside.base.impl;
|
||||||
|
|
||||||
|
import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
|
@ -22,6 +23,7 @@ import mage.game.GameOptions;
|
||||||
import mage.game.command.CommandObject;
|
import mage.game.command.CommandObject;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentCard;
|
import mage.game.permanent.PermanentCard;
|
||||||
|
import mage.players.ManaPool;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -833,6 +835,31 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
|
||||||
Assert.assertEquals("(Hand) Card counts for card " + cardName + " for " + player.getName() + " are not equal ", count, actual);
|
Assert.assertEquals("(Hand) Card counts for card " + cardName + " for " + player.getName() + " are not equal ", count, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void assertManaPool(Player player, String color, int amount){
|
||||||
|
ManaPool manaPool = currentGame.getPlayer(player.getId()).getManaPool();
|
||||||
|
switch (color){
|
||||||
|
case "colorless":
|
||||||
|
Assert.assertEquals(manaPool.getColorless() + manaPool.getConditionalMana().stream().mapToInt(Mana::getColorless).sum(), amount);
|
||||||
|
break;
|
||||||
|
case "red":
|
||||||
|
Assert.assertEquals(manaPool.getRed() + manaPool.getConditionalMana().stream().mapToInt(Mana::getRed).sum(), amount);
|
||||||
|
break;
|
||||||
|
case "blue":
|
||||||
|
Assert.assertEquals(manaPool.getBlue() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlue).sum(), amount);
|
||||||
|
break;
|
||||||
|
case "white":
|
||||||
|
Assert.assertEquals(manaPool.getWhite() + manaPool.getConditionalMana().stream().mapToInt(Mana::getWhite).sum(), amount);
|
||||||
|
break;
|
||||||
|
case "green":
|
||||||
|
Assert.assertEquals(manaPool.getGreen() + manaPool.getConditionalMana().stream().mapToInt(Mana::getGreen).sum(), amount);
|
||||||
|
break;
|
||||||
|
case "black":
|
||||||
|
Assert.assertEquals(manaPool.getBlack() + manaPool.getConditionalMana().stream().mapToInt(Mana::getBlack).sum(), amount);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assert card count in player's graveyard.
|
* Assert card count in player's graveyard.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue