From c2add7c301b1c638fa51b697c37dca64333a2638 Mon Sep 17 00:00:00 2001 From: Svornost <11434-svornost@users.noreply.gitgud.io> Date: Mon, 12 Sep 2022 19:12:46 -0400 Subject: [PATCH] Fix case where no neighbor adoption can occur --- src/endWeek/economics/neighborsDevelopment.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/endWeek/economics/neighborsDevelopment.js b/src/endWeek/economics/neighborsDevelopment.js index 8081f9f1480..6c9faae48cc 100644 --- a/src/endWeek/economics/neighborsDevelopment.js +++ b/src/endWeek/economics/neighborsDevelopment.js @@ -2568,18 +2568,20 @@ App.EndWeek.neighborsDevelopment = function() { if (opposed.length > 0) { r.push(`${arc.name} is culturally opposed with ${toSentence(opposed)} socially, encouraging it to resist adopting ${opposed.length > 1 ? 'their' : 'its'} cultural values.`); } - const chosen = usableCandidates.random(); - if (chosen.candidate === "FSSubjugationist") { - r.push(`It <span class="yellow">adopts ${chosen.arc2.FSSubjugationistRace} Subjugation</span> due to influence from its trading partner ${chosen.arc2.name}.`); - arc.FSSubjugationist = 5; - arc.FSSubjugationistRace = chosen.arc2.FSSubjugationistRace; - } else if (chosen.candidate === "FSSupremacist") { - r.push(`It <span class="yellow">adopts ${chosen.arc2.FSSupremacistRace} Supremacy</span> due to influence from its trading partner ${chosen.arc2.name}.`); - arc.FSSupremacist = 5; - arc.FSSupremacistRace = chosen.arc2.FSSupremacistRace; - } else { - r.push(`It <span class="yellow">adopts ${FutureSocieties.displayName(chosen.candidate)}</span> due to influence from its trading partner ${chosen.arc2.name}.`); - arc[chosen.candidate] = 5; + if (usableCandidates.length > 0) { + const chosen = usableCandidates.random(); + if (chosen.candidate === "FSSubjugationist") { + r.push(`It <span class="yellow">adopts ${chosen.arc2.FSSubjugationistRace} Subjugation</span> due to influence from its trading partner ${chosen.arc2.name}.`); + arc.FSSubjugationist = 5; + arc.FSSubjugationistRace = chosen.arc2.FSSubjugationistRace; + } else if (chosen.candidate === "FSSupremacist") { + r.push(`It <span class="yellow">adopts ${chosen.arc2.FSSupremacistRace} Supremacy</span> due to influence from its trading partner ${chosen.arc2.name}.`); + arc.FSSupremacist = 5; + arc.FSSupremacistRace = chosen.arc2.FSSupremacistRace; + } else { + r.push(`It <span class="yellow">adopts ${FutureSocieties.displayName(chosen.candidate)}</span> due to influence from its trading partner ${chosen.arc2.name}.`); + arc[chosen.candidate] = 5; + } return; } -- GitLab