mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Add a somewhat hidden option in the UI to turn on simulation via a context menu on the AI radio button on desktop.
This allows choosing the AI mode without recompiling and also allows things like making a non-simulation AI play a simulation AI.
This commit is contained in:
@@ -100,22 +100,25 @@ import forge.util.MyRandom;
|
||||
* @version $Id$
|
||||
*/
|
||||
public class AiController {
|
||||
private static boolean USE_SIMULATION = false;
|
||||
|
||||
private final Player player;
|
||||
private final Game game;
|
||||
private final AiCardMemory memory;
|
||||
public boolean bCheatShuffle;
|
||||
private boolean cheatShuffle;
|
||||
private boolean useSimulation;
|
||||
private SpellAbilityPicker simPicker;
|
||||
|
||||
public boolean canCheatShuffle() {
|
||||
return bCheatShuffle;
|
||||
return cheatShuffle;
|
||||
}
|
||||
|
||||
public void allowCheatShuffle(boolean canCheatShuffle) {
|
||||
this.bCheatShuffle = canCheatShuffle;
|
||||
this.cheatShuffle = canCheatShuffle;
|
||||
}
|
||||
|
||||
public void setUseSimulation(boolean value) {
|
||||
this.useSimulation = value;
|
||||
}
|
||||
|
||||
public Game getGame() {
|
||||
return game;
|
||||
}
|
||||
@@ -1213,7 +1216,7 @@ public class AiController {
|
||||
if (all == null || all.isEmpty())
|
||||
return null;
|
||||
|
||||
if (USE_SIMULATION) {
|
||||
if (useSimulation) {
|
||||
return simPicker.chooseSpellAbilityToPlay(getOriginalAndAltCostAbilities(all), skipCounter);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package forge.ai;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
import forge.game.Game;
|
||||
import forge.game.player.IGameEntitiesFactory;
|
||||
@@ -7,19 +9,23 @@ import forge.game.player.Player;
|
||||
import forge.game.player.PlayerController;
|
||||
|
||||
public class LobbyPlayerAi extends LobbyPlayer implements IGameEntitiesFactory {
|
||||
public LobbyPlayerAi(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
private String aiProfile = "";
|
||||
private boolean rotateProfileEachGame;
|
||||
private boolean allowCheatShuffle;
|
||||
private boolean useSimulation;
|
||||
|
||||
public LobbyPlayerAi(String name, Map<String, String> options) {
|
||||
super(name);
|
||||
if (options != null && "True".equals(options.get("UseSimulation"))) {
|
||||
this.useSimulation = true;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAllowCheatShuffle() {
|
||||
return allowCheatShuffle;
|
||||
}
|
||||
|
||||
|
||||
public void setAllowCheatShuffle(boolean allowCheatShuffle) {
|
||||
this.allowCheatShuffle = allowCheatShuffle;
|
||||
}
|
||||
@@ -38,6 +44,7 @@ public class LobbyPlayerAi extends LobbyPlayer implements IGameEntitiesFactory {
|
||||
|
||||
private PlayerControllerAi createControllerFor(Player ai) {
|
||||
PlayerControllerAi result = new PlayerControllerAi(ai.getGame(), ai, this);
|
||||
result.setUseSimulation(useSimulation);
|
||||
result.allowCheatShuffle(allowCheatShuffle);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,9 @@ public class PlayerControllerAi extends PlayerController {
|
||||
brains.allowCheatShuffle(value);
|
||||
}
|
||||
|
||||
public void setUseSimulation(boolean value) {
|
||||
brains.setUseSimulation(value);
|
||||
}
|
||||
|
||||
public SpellAbility getAbilityToPlay(List<SpellAbility> abilities, ITriggerEvent triggerEvent) {
|
||||
if (abilities.size() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user