Only auto skip combat phases if stack is empty.

Fixes issue 285.
master
melvin 2012-11-23 17:05:26 +08:00
parent 9fddfa7f76
commit 7655d3d3b8
2 changed files with 48 additions and 2 deletions

View File

@ -96,13 +96,16 @@ public class MagicPlayChoice extends MagicChoice {
return PASS_CHOICE_RESULTS; return PASS_CHOICE_RESULTS;
} }
//skip all combat phases if nobody is attacking //skip all combat phases if
// nobody is attacking and
// stack is empty
if ((game.isPhase(MagicPhaseType.DeclareAttackers) || if ((game.isPhase(MagicPhaseType.DeclareAttackers) ||
game.isPhase(MagicPhaseType.DeclareBlockers) || game.isPhase(MagicPhaseType.DeclareBlockers) ||
game.isPhase(MagicPhaseType.CombatDamage) || game.isPhase(MagicPhaseType.CombatDamage) ||
game.isPhase(MagicPhaseType.EndOfCombat)) && game.isPhase(MagicPhaseType.EndOfCombat)) &&
player.getNrOfAttackers() == 0 && player.getNrOfAttackers() == 0 &&
player.getOpponent().getNrOfAttackers() == 0) { player.getOpponent().getNrOfAttackers() == 0 &&
game.getStack().isEmpty()) {
return PASS_CHOICE_RESULTS; return PASS_CHOICE_RESULTS;
} }

View File

@ -0,0 +1,43 @@
package magic.test;
import magic.model.MagicDuel;
import magic.model.MagicGame;
import magic.model.MagicPlayer;
import magic.model.MagicPlayerDefinition;
import magic.model.MagicPlayerProfile;
import magic.model.phase.MagicMainPhase;
class TestCounterFlash extends TestGameBuilder {
public MagicGame getGame() {
final MagicDuel duel=new MagicDuel();
duel.setDifficulty(6);
final MagicPlayerProfile profile=new MagicPlayerProfile("bgruw");
final MagicPlayerDefinition player1=new MagicPlayerDefinition("Player",false,profile,15);
final MagicPlayerDefinition player2=new MagicPlayerDefinition("Computer",true,profile,14);
duel.setPlayers(new MagicPlayerDefinition[]{player1,player2});
duel.setStartPlayer(0);
final MagicGame game=duel.nextGame(true);
game.setPhase(MagicMainPhase.getFirstInstance());
final MagicPlayer player=game.getPlayer(0);
final MagicPlayer opponent=game.getPlayer(1);
MagicPlayer P = player;
P.setLife(1);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
addToHand(P,"Counterspell",1);
P = opponent;
P.setLife(1);
addToLibrary(P, "Plains", 10);
createPermanent(game,P,"Rupture Spire",false,8);
addToHand(P,"Restoration Angel",1);
//addToHand(P,"Grizzly Bears",1);
return game;
}
}