mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
* Fixed some possible null pointer exceptions and some minor editing.
This commit is contained in:
parent
69b27f594a
commit
da9e9a1180
4 changed files with 49 additions and 8 deletions
|
@ -126,8 +126,9 @@ public class PlayerView implements Serializable {
|
|||
} catch (ConcurrentModificationException e) {
|
||||
// can happen as a player left battlefield while PlayerView is created
|
||||
}
|
||||
this.topCard = (player.isTopCardRevealed() && player.getLibrary().size() > 0)
|
||||
? new CardView(player.getLibrary().getFromTop(game)) : null;
|
||||
Card cardOnTop = (player.isTopCardRevealed() && player.getLibrary().size() > 0)
|
||||
? player.getLibrary().getFromTop(game) : null;
|
||||
this.topCard = cardOnTop != null ? new CardView(cardOnTop) : null;
|
||||
if (player.getUserData() != null) {
|
||||
this.userData = player.getUserData();
|
||||
} else {
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.game;
|
|||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -136,7 +135,6 @@ class MomirEmblem extends Emblem {
|
|||
|
||||
class MomirEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public MomirEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ import mage.target.common.TargetOpponent;
|
|||
public class CarpetOfFlowers extends CardImpl {
|
||||
|
||||
public CarpetOfFlowers(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}");
|
||||
|
||||
// At the beginning of each of your main phases, if you haven't added mana to your mana pool with this ability this turn, you may add up to X mana of any one color to your mana pool, where X is the number of Islands target opponent controls.
|
||||
this.addAbility(new CarpetOfFlowersTriggeredAbility());
|
||||
|
@ -104,8 +104,7 @@ class CarpetOfFlowersTriggeredAbility extends TriggeredAbilityImpl {
|
|||
Boolean activatedThisTurn = (Boolean) game.getState().getValue(this.originalId.toString() + "addMana");
|
||||
if (activatedThisTurn == null) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return !activatedThisTurn;
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +169,10 @@ class CarpetOfFlowersEffect extends ManaEffect {
|
|||
choiceCount.setChoices(set);
|
||||
choiceCount.setMessage("Choose number of mana");
|
||||
controller.choose(Outcome.PutManaInPool, choiceCount, game);
|
||||
int count = Integer.parseInt(choiceCount.getChoice());
|
||||
int count = 0;
|
||||
if (choiceCount.getChoice() != null) {
|
||||
count = Integer.parseInt(choiceCount.getChoice());
|
||||
}
|
||||
if (count > 0) {
|
||||
Mana mana = new Mana();
|
||||
switch (choice.getChoice()) {
|
||||
|
|
|
@ -90,6 +90,46 @@ public class ReflectingPoolTest extends CardTestPlayerBase {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test 2 Reflecting Pools
|
||||
*/
|
||||
@Test
|
||||
public void test2WithExoticOrchard() {
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
// {T}: Add to your mana pool one mana of any type that a land you control could produce.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Reflecting Pool", 2);
|
||||
// {T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Exotic Orchard", 1);
|
||||
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
ManaOptions options = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("Player should be able to create 3 red mana", "{R}{R}{R}", options.get(0).toString());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test 2 Reflecting Pools
|
||||
*/
|
||||
@Test
|
||||
public void testWith2ExoticOrchard() {
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
|
||||
// {T}: Add to your mana pool one mana of any type that a land you control could produce.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Reflecting Pool", 1);
|
||||
// {T}: Add to your mana pool one mana of any color that a land an opponent controls could produce.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Exotic Orchard", 2);
|
||||
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
ManaOptions options = playerA.getAvailableManaTest(currentGame);
|
||||
Assert.assertEquals("Player should be able to create 2 red mana", "{R}{R}{R}", options.get(0).toString());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reflecting Pool does not see Gaea's Cradle or Serra's Sanctum as
|
||||
* producing mana
|
||||
|
|
Loading…
Reference in a new issue