mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Fix issue with StopAtPhase restricting the AI being able to play outside their main phase
This commit is contained in:
@@ -173,8 +173,8 @@ public class AbilityFactory_DealDamage {
|
||||
|
||||
// TODO handle proper calculation of X values based on Cost
|
||||
|
||||
// todo(sol): this should only happen during Humans EOT or if Stuffy is going to die
|
||||
if(AF.getHostCard().getName().equals("Stuffy Doll")) {
|
||||
// todo(sol): this should also happen if Stuffy is going to die
|
||||
if(AF.getHostCard().getName().equals("Stuffy Doll") && AllZone.Phase.is(Constant.Phase.End_Of_Turn, AllZone.HumanPlayer)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,9 +156,6 @@ public class GameActionUtil {
|
||||
// experimental, AI abuse aluren
|
||||
|
||||
AllZone.Stack.unfreezeStack();
|
||||
|
||||
if (AllZone.Stack.size() == 0 && !AllZone.Display.stopAtPhase(player, Constant.Phase.Upkeep))
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public static void executeDrawStepEffects() {
|
||||
@@ -175,8 +172,6 @@ public class GameActionUtil {
|
||||
draw_Mana_Vault(player);
|
||||
draw_Sylvan_Library(player);
|
||||
AllZone.Stack.unfreezeStack();
|
||||
if (AllZone.Stack.size() == 0 && !AllZone.Display.stopAtPhase(player, Constant.Phase.Draw))
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
public static void executeTapSideEffects(Card c) {
|
||||
|
||||
@@ -1050,7 +1050,7 @@ public class GuiDisplay3 extends JFrame implements CardContainer, Display, NewCo
|
||||
else if (phase.equals(Constant.Phase.Combat_End))
|
||||
return cbHumanEndCombat.isSelected();
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean loadPrefs(){
|
||||
|
||||
@@ -1038,7 +1038,7 @@ public class GuiDisplay4 extends JFrame implements CardContainer, Display, NewCo
|
||||
else if (phase.equals(Constant.Phase.Combat_End))
|
||||
return cbHumanEndCombat.isSelected();
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean loadPrefs(){
|
||||
|
||||
@@ -122,8 +122,9 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
}
|
||||
|
||||
else if(phase.equals(Constant.Phase.End_Of_Turn)){
|
||||
if (priority.isComputer()){
|
||||
// AI passes priority in his end of turn phase to player automatically
|
||||
if (priority.isComputer() && playerTurn.isComputer()){
|
||||
// this section may not be needed
|
||||
// AI passes priority in his end of turn phase to player automatically
|
||||
AllZone.Phase.passPriority();
|
||||
return null;
|
||||
}
|
||||
@@ -138,7 +139,14 @@ public class InputControl extends MyObservable implements java.io.Serializable {
|
||||
// Special phases handled above, everything else is handled simply by priority
|
||||
|
||||
if (priority.isHuman()){
|
||||
return new Input_PassPriority();
|
||||
boolean skip = AllZone.Phase.doSkipPhase();
|
||||
AllZone.Phase.setSkipPhase(false);
|
||||
if(AllZone.Stack.size() == 0 && !AllZone.Display.stopAtPhase(playerTurn, phase) && skip) {
|
||||
AllZone.Phase.passPriority();
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return new Input_PassPriority();
|
||||
}
|
||||
|
||||
else if (playerTurn.isComputer())
|
||||
|
||||
@@ -85,6 +85,15 @@ public class Phase extends MyObservable
|
||||
bPhaseEffects = b;
|
||||
}
|
||||
|
||||
private boolean bSkipPhase = true;
|
||||
public boolean doSkipPhase() {
|
||||
return bSkipPhase;
|
||||
}
|
||||
|
||||
public void setSkipPhase(boolean b) {
|
||||
bSkipPhase = b;
|
||||
}
|
||||
|
||||
private boolean bCombat = false;
|
||||
public boolean inCombat() {
|
||||
return bCombat;
|
||||
@@ -152,6 +161,7 @@ public class Phase extends MyObservable
|
||||
// Handle effects that happen at the beginning of phases
|
||||
final String phase = AllZone.Phase.getPhase();
|
||||
final Player turn = AllZone.Phase.getPlayerTurn();
|
||||
AllZone.Phase.setSkipPhase(true);
|
||||
|
||||
if(phase.equals(Constant.Phase.Untap)) {
|
||||
PhaseUtil.handleUntap();
|
||||
@@ -188,12 +198,7 @@ public class Phase extends MyObservable
|
||||
}
|
||||
|
||||
else if(phase.equals(Constant.Phase.Combat_Begin)){
|
||||
if (AllZone.Display.stopAtPhase(turn, phase)){
|
||||
PhaseUtil.verifyCombat();
|
||||
}
|
||||
else {
|
||||
this.setNeedToNextPhase(true);
|
||||
}
|
||||
PhaseUtil.verifyCombat();
|
||||
}
|
||||
|
||||
else if (phase.equals(Constant.Phase.Combat_Declare_Attackers_InstantAbility)){
|
||||
@@ -267,17 +272,11 @@ public class Phase extends MyObservable
|
||||
runParams.put("Phase", phase);
|
||||
runParams.put("Player", getPlayerTurn());
|
||||
AllZone.TriggerHandler.runTrigger("Phase", runParams);
|
||||
|
||||
if(AllZone.Stack.size() == 0 && !AllZone.Display.stopAtPhase(turn, phase))
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
}
|
||||
|
||||
else if(phase.equals(Constant.Phase.End_Of_Turn)) {
|
||||
AllZone.EndOfTurn.executeAt();
|
||||
// todo: when we have a bar for selecting which phases to stop at, we will check that instead of display.stop
|
||||
if(AllZone.Stack.size() == 0 && !AllZone.Display.stopAtPhase(turn, phase))
|
||||
AllZone.Phase.setNeedToNextPhase(true);
|
||||
}
|
||||
|
||||
else if(phase.equals(Constant.Phase.Cleanup)){
|
||||
@@ -293,7 +292,6 @@ public class Phase extends MyObservable
|
||||
//This line fixes Combat Damage triggers not going off when they should
|
||||
AllZone.Stack.unfreezeStack();
|
||||
|
||||
|
||||
resetPriority();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user