mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Make end turn button meet player's expectations by skipping the attack phase and not requiring you to respond to triggers
This commit is contained in:
@@ -1131,11 +1131,6 @@ public class AiController {
|
||||
sb.append("Computer just assigned ").append(element.getName()).append(" as an attacker.");
|
||||
Log.debug(sb.toString());
|
||||
}
|
||||
|
||||
// ai is about to attack, cancel all phase skipping
|
||||
for (Player p : game.getPlayers()) {
|
||||
p.getController().autoPassCancel();
|
||||
}
|
||||
return combat;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ public abstract class PlayerController {
|
||||
autoPassUntilPhase = null;
|
||||
}
|
||||
|
||||
public boolean mayAutoPass(PhaseType phase) {
|
||||
return phase.isBefore(autoPassUntilPhase);
|
||||
public boolean mayAutoPass() {
|
||||
return autoPassUntilPhase != null && game.getPhaseHandler().getPhase().isBefore(autoPassUntilPhase);
|
||||
}
|
||||
|
||||
public boolean isAI() {
|
||||
|
||||
@@ -344,11 +344,6 @@ public class TriggerHandler implements IGameStateObject {
|
||||
private void runSingleTrigger(final Trigger regtrig, final Map<String, Object> runParams) {
|
||||
final Map<String, String> triggerParams = regtrig.getMapParams();
|
||||
|
||||
// Any trigger should cause the phase not to skip
|
||||
for (Player p : game.getPlayers()) {
|
||||
p.getController().autoPassCancel();
|
||||
}
|
||||
|
||||
regtrig.setRunParams(runParams);
|
||||
|
||||
// All tests passed, execute ability.
|
||||
|
||||
@@ -617,6 +617,10 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
|
||||
@Override
|
||||
public void declareAttackers(Player attacker, Combat combat) {
|
||||
if (mayAutoPass()) {
|
||||
return; //don't prompt to declare attackers if user chose to end the turn
|
||||
}
|
||||
|
||||
// This input should not modify combat object itself, but should return user choice
|
||||
InputAttack inpAttack = new InputAttack(attacker, combat);
|
||||
inpAttack.showAndWait();
|
||||
@@ -631,14 +635,12 @@ public class PlayerControllerHuman extends PlayerController {
|
||||
|
||||
@Override
|
||||
public SpellAbility chooseSpellAbilityToPlay() {
|
||||
PhaseType phase = game.getPhaseHandler().getPhase();
|
||||
|
||||
boolean maySkipPriority = mayAutoPass(phase) || isUiSetToSkipPhase(game.getPhaseHandler().getPlayerTurn(), phase);
|
||||
if (game.getStack().isEmpty() && maySkipPriority) {
|
||||
return null;
|
||||
if (mayAutoPass()) {
|
||||
return null; //avoid prompting for input if current phase is set to be auto-passed
|
||||
}
|
||||
else {
|
||||
autoPassCancel(); // probably cancel, since something has happened
|
||||
|
||||
if (game.getStack().isEmpty() && isUiSetToSkipPhase(game.getPhaseHandler().getPlayerTurn(), game.getPhaseHandler().getPhase())) {
|
||||
return null; //avoid prompt for input if stack is empty and player is set to skip the current phase
|
||||
}
|
||||
|
||||
InputPassPriority defaultInput = new InputPassPriority(player);
|
||||
|
||||
Reference in New Issue
Block a user