mirror of
https://github.com/GoodStartLabs/AI_Diplomacy.git
synced 2026-05-02 17:46:00 +00:00
WIP: Adding a larger relationship view, that shows all powers
This commit is contained in:
parent
cd501a5b03
commit
d250e38359
12 changed files with 824 additions and 113 deletions
|
|
@ -165,6 +165,35 @@ class GameState {
|
|||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a power is present in the current game
|
||||
* @param power The power to check
|
||||
* @returns True if the power is present in the current phase
|
||||
*/
|
||||
isPowerInGame = (power: string): boolean => {
|
||||
if (!this.gameData || !this.gameData.phases || this.phaseIndex < 0 || this.phaseIndex >= this.gameData.phases.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const currentPhase = this.gameData.phases[this.phaseIndex];
|
||||
|
||||
// Check if power has units or centers in the current phase
|
||||
if (currentPhase.state?.units && power in currentPhase.state.units) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (currentPhase.state?.centers && power in currentPhase.state.centers) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if power has relationships defined
|
||||
if (currentPhase.agent_relationships && power in currentPhase.agent_relationships) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
initScene = () => {
|
||||
this.scene.background = new THREE.Color(0x87CEEB);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue