From 95a9d13294a5fe915714628330d3df9c51faf227 Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Fri, 6 Dec 2024 11:50:39 +0100 Subject: [PATCH] terrain priorities --- .../botAction/ActionTransformAndBuild.vue | 9 ++- .../turn/botAction/TerrainPriorities.vue | 59 +++++++++++++++++++ src/util/NavigationState.ts | 3 + src/util/getPriorityTerrains.ts | 2 +- 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 src/components/turn/botAction/TerrainPriorities.vue diff --git a/src/components/turn/botAction/ActionTransformAndBuild.vue b/src/components/turn/botAction/ActionTransformAndBuild.vue index f973562..a8a44e7 100644 --- a/src/components/turn/botAction/ActionTransformAndBuild.vue +++ b/src/components/turn/botAction/ActionTransformAndBuild.vue @@ -25,7 +25,10 @@ @@ -65,6 +68,7 @@ import { useStateStore } from '@/store/state' import NavigationState from '@/util/NavigationState' import BotFaction from '@/services/enum/BotFaction' import Structure from '@/services/enum/Structure' +import TerrainPriorities from './TerrainPriorities.vue' export default defineComponent({ name: 'ActionTransformAndBuild', @@ -73,7 +77,8 @@ export default defineComponent({ AppIcon, SupportInfo, Upgrade, - ModalDialog + ModalDialog, + TerrainPriorities }, setup() { const { t } = useI18n() diff --git a/src/components/turn/botAction/TerrainPriorities.vue b/src/components/turn/botAction/TerrainPriorities.vue new file mode 100644 index 0000000..5f05877 --- /dev/null +++ b/src/components/turn/botAction/TerrainPriorities.vue @@ -0,0 +1,59 @@ + + + + + diff --git a/src/util/NavigationState.ts b/src/util/NavigationState.ts index 1e8fd81..c369300 100644 --- a/src/util/NavigationState.ts +++ b/src/util/NavigationState.ts @@ -9,6 +9,7 @@ import { MAX_TURN } from '@/util/getTurnOrder' import ScienceDiscipline from '@/services/enum/ScienceDiscipline' import getRoundScoreTile, { RoundScoreTile } from './getRoundScoreTile' import getRoundScoreFinalTile from './getRoundScoreFinalTile' +import Terrain from '@/services/enum/Terrain' export default class NavigationState { @@ -21,6 +22,7 @@ export default class NavigationState { readonly player : number readonly bot : number readonly botFaction? : BotFaction + readonly botTerrain? : Terrain readonly cardDeck? : CardDeck readonly passVictoryPoints?: number readonly preferredScienceDiscipline?: ScienceDiscipline @@ -39,6 +41,7 @@ export default class NavigationState { if (this.bot > 0) { this.botFaction = setup.playerSetup.botFaction[this.bot - 1] + this.botTerrain = (setup.botTerrain ?? [])[this.bot - 1] // card deck: draw next card for bot this.cardDeck = getCardDeck(state, this.round, this.turn, this.bot) diff --git a/src/util/getPriorityTerrains.ts b/src/util/getPriorityTerrains.ts index 21549ec..d07134f 100644 --- a/src/util/getPriorityTerrains.ts +++ b/src/util/getPriorityTerrains.ts @@ -24,7 +24,7 @@ export default function getPriorityTerrains(terrain: Terrain, terrainPriority: T case TerrainPriority.B: switch (terrain) { case Terrain.LAKE: return [Terrain.LAKE, Terrain.FOREST, Terrain.SWAMP, Terrain.MOUNTAIN, Terrain.DESERT, Terrain.PLAINS, Terrain.WASTELAND] - case Terrain.PLAINS: return [Terrain.PLAINS,Terrain.SWAMP,Terrain.DESERT,Terrain.LAKE,Terrain.MOUNTAIN,Terrain.WASTELAND,Terrain.FOREST] + case Terrain.PLAINS: return [Terrain.PLAINS, Terrain.SWAMP, Terrain.DESERT, Terrain.LAKE, Terrain.MOUNTAIN, Terrain.WASTELAND, Terrain.FOREST] case Terrain.FOREST: return [Terrain.FOREST, Terrain.MOUNTAIN, Terrain.LAKE, Terrain.WASTELAND, Terrain.PLAINS, Terrain.SWAMP, Terrain.DESERT] case Terrain.WASTELAND: return [Terrain.WASTELAND, Terrain.DESERT, Terrain.MOUNTAIN, Terrain.PLAINS, Terrain.LAKE, Terrain.FOREST, Terrain.SWAMP] case Terrain.SWAMP: return [Terrain.SWAMP, Terrain.LAKE, Terrain.PLAINS, Terrain.FOREST, Terrain.WASTELAND, Terrain.DESERT, Terrain.MOUNTAIN]