diff --git a/src/assets/civilization/random.png b/src/assets/civilization/random.png new file mode 100644 index 0000000..969e752 Binary files /dev/null and b/src/assets/civilization/random.png differ diff --git a/src/components/setup/SelectCivilization.vue b/src/components/setup/SelectCivilization.vue index 74896d1..09217bc 100644 --- a/src/components/setup/SelectCivilization.vue +++ b/src/components/setup/SelectCivilization.vue @@ -17,6 +17,12 @@ +
  • +
  • + + + +
  • @@ -77,6 +83,13 @@ export default defineComponent({ this.civilizationName = name this.$emit('update:modelValue', name as string) }, + selectRandomCivilization() { + const allCivs = this.civilizationExpansions.map( + expansion => this.listCivilizations(expansion).map(civ => civ.name) + ).flat() + const randomEntry = allCivs[Math.floor(Math.random() * allCivs.length)] + this.selectCivilization(randomEntry) + }, listCivilizations(expansion? : Expansion) : Civilization[] { if (expansion == undefined) { return Civilizations.getForCoreBox() diff --git a/src/components/structure/CivilizationIconName.vue b/src/components/structure/CivilizationIconName.vue index bfbf9eb..73ac922 100644 --- a/src/components/structure/CivilizationIconName.vue +++ b/src/components/structure/CivilizationIconName.vue @@ -1,6 +1,7 @@ @@ -18,9 +19,13 @@ export default defineComponent({ return { t } }, props: { + isRandom: { + type: Boolean, + required: false + }, name: { type: String, - required: true + required: false }, showType: { type: Boolean, @@ -32,7 +37,7 @@ export default defineComponent({ return Civilizations.getOptional(this.name as CivilizationName) }, civilizationImageUrl() : string { - return new URL(`/src/assets/civilization/${this.name}.png`, import.meta.url).toString() + return new URL(`/src/assets/civilization/${this.isRandom ? 'random' : this.name}.png`, import.meta.url).toString() } } }) diff --git a/src/locales/en.json b/src/locales/en.json index 4fb71f7..1aea970 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -72,7 +72,8 @@ "japan": "Japan", "malians": "Malians", "mughals": "Mughals", - "zulu": "Zulu" + "zulu": "Zulu", + "random": "Random civilization" }, "civilizationType": { "aggressive": "Aggressive", diff --git a/src/locales/fr.json b/src/locales/fr.json index 01a6bdf..f32a547 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -67,7 +67,8 @@ "japan": "Japonais", "malians": "Maliens", "mughals": "Moghols", - "zulu": "Zoulous" + "zulu": "Zoulous", + "random": "Civilisation alĂ©atoire" }, "civilizationType": { "aggressive": "Aggresif",