From ef181a4f4ccf43f77f9e451630cf51bb1d288811 Mon Sep 17 00:00:00 2001 From: givehub99 <71454921+givehub99@users.noreply.github.com> Date: Sun, 20 Sep 2020 10:29:04 -0700 Subject: [PATCH] Adds "Start with [] technology" unique (#3150) * Adds "Start with [] technology" unique, useful for mods and Hunnic civilization from official CIV 5 DLC Gods and Kings. This unique can be tested with this mod https://cdn.discordapp.com/attachments/670547794951405584/756223352930304140/Test_Start_Technology_Nation_Unique.zip which lets Babylon start with Pottery. * assigning the start technology unique parameter value to variable, changing the unique syntax to 'Starts with []' --- core/src/com/unciv/logic/GameStarter.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/com/unciv/logic/GameStarter.kt b/core/src/com/unciv/logic/GameStarter.kt index bbb934a429..dfe9b6c919 100644 --- a/core/src/com/unciv/logic/GameStarter.kt +++ b/core/src/com/unciv/logic/GameStarter.kt @@ -73,6 +73,16 @@ object GameStarter { for (tech in gameInfo.getDifficulty().aiFreeTechs) civInfo.tech.addTechnology(tech) + // generic start with technology unique + for(unique in civInfo.getMatchingUniques("Starts with []")) { + // get the parameter from the unique + val techName = unique.params[0] + + // check if the technology is in the ruleset and not already researched + if (ruleset.technologies.containsKey(techName) && !civInfo.tech.isResearched(techName)) + civInfo.tech.addTechnology(techName) + } + // add all techs to spectators if (civInfo.isSpectator()) for (tech in ruleset.technologies.values)