"take priority" changed: now on priority SBA is checked, triggers are ordered, then player is asked for spell they want to play, then spell is played. Until player refuses to choose a spell, that means "I pass"

This commit is contained in:
Maxmtg
2014-02-01 20:43:20 +00:00
parent 2ea69dde48
commit da3b2c1dc1
6 changed files with 69 additions and 82 deletions

View File

@@ -669,26 +669,26 @@ public class PlayerControllerHuman extends PlayerController {
}
@Override
public void takePriority() {
public SpellAbility chooseSpellAbilityToPlay() {
PhaseType phase = game.getPhaseHandler().getPhase();
boolean maySkipPriority = mayAutoPass(phase) || isUiSetToSkipPhase(game.getPhaseHandler().getPlayerTurn(), phase);
if (game.getStack().isEmpty() && maySkipPriority) {
return;
return null;
}
else {
autoPassCancel(); // probably cancel, since something has happened
}
SpellAbility chosenSa = null;
do {
if (chosenSa != null) {
HumanPlay.playSpellAbility(player, chosenSa);
if (game.isGameOver()) { return; } //don't wait to pass priority if player conceded while in middle of playing a spell/ability
}
InputPassPriority defaultInput = new InputPassPriority(player);
defaultInput.showAndWait();
chosenSa = defaultInput.getChosenSa();
} while (chosenSa != null);
InputPassPriority defaultInput = new InputPassPriority(player);
defaultInput.showAndWait();
return defaultInput.getChosenSa();
}
@Override
public void playChosenSpellAbility(SpellAbility chosenSa)
{
HumanPlay.playSpellAbility(player, chosenSa);
}
@Override

View File

@@ -363,8 +363,9 @@ public class PlayerControllerForTests extends PlayerController {
}
@Override
public void takePriority() {
//TODO: just about everything...
public SpellAbility chooseSpellAbilityToPlay() {
//TODO: This method has to return the spellability chosen by player
// It should not play the sa right from here. The code has been left as it is to quickly adapt to changed playercontroller interface
if (playerActions != null) {
CastSpellFromHandAction castSpellFromHand = playerActions.getNextActionIfApplicable(player, game, CastSpellFromHandAction.class);
if (castSpellFromHand != null) {
@@ -376,6 +377,7 @@ public class PlayerControllerForTests extends PlayerController {
activateAbilityAction.activateAbility(player, game);
}
}
return null;
}
@Override
@@ -582,4 +584,10 @@ public class PlayerControllerForTests extends PlayerController {
// Probably along with deciding how many creatures to tap
return new HashMap<Card, ManaCostShard>();
}
@Override
public void playChosenSpellAbility(SpellAbility sa) {
// TODO Play abilities from here
}
}