From 76e9935d83777a608e27013afb436d24e8768193 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Sat, 13 Sep 2025 15:29:15 -0400 Subject: [PATCH] Add `Adopt [policy/belief]` Unique (#13915) * Initial Adopt [belief] * Add tests * clean up the code * clean func --- .../jsons/translations/Afrikaans.properties | 2 +- .../jsons/translations/Bangla.properties | 2 +- .../jsons/translations/Belarusian.properties | 2 +- .../jsons/translations/Bosnian.properties | 2 +- .../Brazilian_Portuguese.properties | 2 +- .../jsons/translations/Bulgarian.properties | 2 +- .../jsons/translations/Catalan.properties | 2 +- .../jsons/translations/Croatian.properties | 2 +- .../jsons/translations/Czech.properties | 2 +- .../jsons/translations/Dutch.properties | 2 +- .../jsons/translations/English.properties | 2 +- .../jsons/translations/Filipino.properties | 2 +- .../jsons/translations/Finnish.properties | 2 +- .../jsons/translations/French.properties | 2 +- .../jsons/translations/Galician.properties | 2 +- .../jsons/translations/German.properties | 2 +- .../jsons/translations/Greek.properties | 2 +- .../jsons/translations/Hungarian.properties | 2 +- .../jsons/translations/Indonesian.properties | 2 +- .../jsons/translations/Italian.properties | 2 +- .../jsons/translations/Japanese.properties | 2 +- .../jsons/translations/Korean.properties | 2 +- .../jsons/translations/Latin.properties | 2 +- .../jsons/translations/Lithuanian.properties | 2 +- .../jsons/translations/Malay.properties | 2 +- .../jsons/translations/Norwegian.properties | 2 +- .../Persian_(Pinglish-DIN).properties | 2 +- .../Persian_(Pinglish-UN).properties | 2 +- .../jsons/translations/Polish.properties | 2 +- .../jsons/translations/Portuguese.properties | 2 +- .../jsons/translations/Romanian.properties | 2 +- .../jsons/translations/Russian.properties | 2 +- .../jsons/translations/Rusyn.properties | 2 +- .../Simplified_Chinese.properties | 2 +- .../jsons/translations/Spanish.properties | 2 +- .../jsons/translations/Swedish.properties | 2 +- .../assets/jsons/translations/Thai.properties | 2 +- .../Traditional_Chinese.properties | 2 +- .../jsons/translations/Turkish.properties | 2 +- .../jsons/translations/Ukrainian.properties | 2 +- .../jsons/translations/Vietnamese.properties | 2 +- .../assets/jsons/translations/Zulu.properties | 2 +- .../jsons/translations/template.properties | 1 + core/src/com/unciv/models/Religion.kt | 2 + core/src/com/unciv/models/UnitAction.kt | 2 +- .../ruleset/unique/UniqueTriggerActivation.kt | 43 +++++++++++-------- .../unciv/models/ruleset/unique/UniqueType.kt | 2 +- docs/Modders/uniques.md | 2 +- .../com/unciv/uniques/GlobalUniquesTests.kt | 21 +++++++++ 49 files changed, 94 insertions(+), 63 deletions(-) diff --git a/android/assets/jsons/translations/Afrikaans.properties b/android/assets/jsons/translations/Afrikaans.properties index d0caa62944..45e0c4a81e 100644 --- a/android/assets/jsons/translations/Afrikaans.properties +++ b/android/assets/jsons/translations/Afrikaans.properties @@ -4239,7 +4239,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Bangla.properties b/android/assets/jsons/translations/Bangla.properties index 33dc5dc82f..cc695c2ab3 100644 --- a/android/assets/jsons/translations/Bangla.properties +++ b/android/assets/jsons/translations/Bangla.properties @@ -3743,7 +3743,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Belarusian.properties b/android/assets/jsons/translations/Belarusian.properties index b4a950979a..d91755a472 100644 --- a/android/assets/jsons/translations/Belarusian.properties +++ b/android/assets/jsons/translations/Belarusian.properties @@ -3904,7 +3904,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Bosnian.properties b/android/assets/jsons/translations/Bosnian.properties index 0cbfc438e0..300d349c27 100644 --- a/android/assets/jsons/translations/Bosnian.properties +++ b/android/assets/jsons/translations/Bosnian.properties @@ -4473,7 +4473,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Brazilian_Portuguese.properties b/android/assets/jsons/translations/Brazilian_Portuguese.properties index ae2937049c..a7f0c9c50e 100644 --- a/android/assets/jsons/translations/Brazilian_Portuguese.properties +++ b/android/assets/jsons/translations/Brazilian_Portuguese.properties @@ -2493,7 +2493,7 @@ Free Great Person = Grande Personlidade Gratuita [amount] population [cityFilter] = [amount] população [cityFilter] [amount] population in a random city = [amount] de população em uma cidade aleatória Discover [tech] = Descobre [tech] -Adopt [policy] = Adota [policy] +Adopt [policy/belief] = Adota [policy/belief] Remove [policy] = Remover [policy] Remove [policy] and refund [amount]% of its cost = Remover [policy] e reembolsar [amount]% do seu custo Free Technology = Tecnologia Grátis diff --git a/android/assets/jsons/translations/Bulgarian.properties b/android/assets/jsons/translations/Bulgarian.properties index ff6d8a4a6f..eb0c08de79 100644 --- a/android/assets/jsons/translations/Bulgarian.properties +++ b/android/assets/jsons/translations/Bulgarian.properties @@ -3549,7 +3549,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Catalan.properties b/android/assets/jsons/translations/Catalan.properties index 890a4a406d..acd48fe90d 100644 --- a/android/assets/jsons/translations/Catalan.properties +++ b/android/assets/jsons/translations/Catalan.properties @@ -2515,7 +2515,7 @@ Free Great Person = Gran personatge de franc [amount] population [cityFilter] = [amount] de població [cityFilter] [amount] population in a random city = [amount] de població en una ciutat aleatòria Discover [tech] = Descobreix [tech] -Adopt [policy] = Adopta [policy] +Adopt [policy/belief] = Adopta [policy/belief] Remove [policy] = Trau [policy] Remove [policy] and refund [amount]% of its cost = Trau [policy] i retorna un [amount] % del seu cost. Free Technology = Tecnologia de franc diff --git a/android/assets/jsons/translations/Croatian.properties b/android/assets/jsons/translations/Croatian.properties index 519b518842..f7717d77cb 100644 --- a/android/assets/jsons/translations/Croatian.properties +++ b/android/assets/jsons/translations/Croatian.properties @@ -2501,7 +2501,7 @@ Free Great Person = Besplatni Velikan [amount] population [cityFilter] = [amount] stanovništva [cityFilter] [amount] population in a random city = [amount] stanovnika u nasumičnom gradu Discover [tech] = Otkrijte [tech] -Adopt [policy] = Usvoji [policy] +Adopt [policy/belief] = Usvoji [policy/belief] Remove [policy] = Ukloni [policy] Remove [policy] and refund [amount]% of its cost = Ukloni [policy] i povrati [amount]% njezine cijene Free Technology = Besplatna Tehnologija diff --git a/android/assets/jsons/translations/Czech.properties b/android/assets/jsons/translations/Czech.properties index ea3050c26d..8fc41ba641 100644 --- a/android/assets/jsons/translations/Czech.properties +++ b/android/assets/jsons/translations/Czech.properties @@ -2827,7 +2827,7 @@ Free Great Person = Velká osobnost zdarma # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Dutch.properties b/android/assets/jsons/translations/Dutch.properties index 8cf0644f58..731449c22e 100644 --- a/android/assets/jsons/translations/Dutch.properties +++ b/android/assets/jsons/translations/Dutch.properties @@ -2527,7 +2527,7 @@ Free Great Person = Gratis Groot Persoon [amount] population [cityFilter] = [amount] bevolking [cityFilter] [amount] population in a random city = [amount] bevolking in een willekeurige stad Discover [tech] = Ontdek [tech] -Adopt [policy] = Neem [policy] aan +Adopt [policy/belief] = Neem [policy/belief] aan Remove [policy] = Verwijder [policy] Remove [policy] and refund [amount]% of its cost = Verwijder [policy] en krijg [amount]% of de kosten terug Free Technology = Gratis Technologie diff --git a/android/assets/jsons/translations/English.properties b/android/assets/jsons/translations/English.properties index 3ff1c51a0e..0cbe0ed042 100644 --- a/android/assets/jsons/translations/English.properties +++ b/android/assets/jsons/translations/English.properties @@ -4656,7 +4656,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Filipino.properties b/android/assets/jsons/translations/Filipino.properties index 3fca03b3aa..5160cdf19d 100644 --- a/android/assets/jsons/translations/Filipino.properties +++ b/android/assets/jsons/translations/Filipino.properties @@ -2681,7 +2681,7 @@ Free Great Person = Libreng Dakilang Tao [amount] population [cityFilter] = [amount] populasyon [cityFilter] [amount] population in a random city = [amount] population sa isang di-matukoy na lungsod Discover [tech] = Tumuklas ng [tech] -Adopt [policy] = Magtatag ng [policy] +Adopt [policy/belief] = Magtatag ng [policy/belief] # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Finnish.properties b/android/assets/jsons/translations/Finnish.properties index 65f866e95b..631ec9a8d9 100644 --- a/android/assets/jsons/translations/Finnish.properties +++ b/android/assets/jsons/translations/Finnish.properties @@ -3707,7 +3707,7 @@ Free Great Person = Ilmainen Merkkihenkilö # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/French.properties b/android/assets/jsons/translations/French.properties index 9d2860b8fe..d6e7aad26a 100644 --- a/android/assets/jsons/translations/French.properties +++ b/android/assets/jsons/translations/French.properties @@ -2492,7 +2492,7 @@ Free Great Person = Personnage Illustre gratuit [amount] population [cityFilter] = [amount] Population [cityFilter] [amount] population in a random city = [amount] Population dans une ville aléatoire Discover [tech] = Découvrir [tech] -Adopt [policy] = Adopter [policy] +Adopt [policy/belief] = Adopter [policy/belief] Remove [policy] = Abandonner [policy] Remove [policy] and refund [amount]% of its cost = Abandonner [policy] et récupérer [amount]% de son coût Free Technology = Technologie gratuite diff --git a/android/assets/jsons/translations/Galician.properties b/android/assets/jsons/translations/Galician.properties index 1f14f03835..8c2aed2f8c 100644 --- a/android/assets/jsons/translations/Galician.properties +++ b/android/assets/jsons/translations/Galician.properties @@ -2499,7 +2499,7 @@ Free Great Person = Gran Personaxe gratis [amount] population [cityFilter] = [amount] poboación [cityFilter] [amount] population in a random city = [amount] poboación nunha cidade aleatoria Discover [tech] = Descobre [tech] -Adopt [policy] = Adopta [policy] +Adopt [policy/belief] = Adopta [policy/belief] Remove [policy] = Eliminar [policy] Remove [policy] and refund [amount]% of its cost = Elimina [policy] e reembolsa [amount]% do seu custo Free Technology = Tecnoloxía gratis diff --git a/android/assets/jsons/translations/German.properties b/android/assets/jsons/translations/German.properties index f7bd75cdf2..a1a4c454ad 100644 --- a/android/assets/jsons/translations/German.properties +++ b/android/assets/jsons/translations/German.properties @@ -2498,7 +2498,7 @@ Free Great Person = Kostenlose Große Persönlichkeit [amount] population [cityFilter] = [amount] Bevölkerung [cityFilter] [amount] population in a random city = [amount] Bevölkerung in einer zufälligen Stadt Discover [tech] = Erforsche [tech] -Adopt [policy] = Verabschiede [policy] +Adopt [policy/belief] = Verabschiede [policy/belief] Remove [policy] = Entferne [policy] Remove [policy] and refund [amount]% of its cost = [policy] entfernen und [amount]% ihrer Kosten zurückerhalten Free Technology = Kostenlose Technologie diff --git a/android/assets/jsons/translations/Greek.properties b/android/assets/jsons/translations/Greek.properties index ca2d4f5ee2..f633de4238 100644 --- a/android/assets/jsons/translations/Greek.properties +++ b/android/assets/jsons/translations/Greek.properties @@ -4237,7 +4237,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Hungarian.properties b/android/assets/jsons/translations/Hungarian.properties index 03ec4dc8ec..8bcaa8b8bf 100644 --- a/android/assets/jsons/translations/Hungarian.properties +++ b/android/assets/jsons/translations/Hungarian.properties @@ -2646,7 +2646,7 @@ Free Great Person = Ajándék Híres ember [amount] population [cityFilter] = [amount] lakos [cityFilter] [amount] population in a random city = [amount] lakos valamelyik városba Discover [tech] = [tech] felfedezése -Adopt [policy] = [policy] törvénybe iktatása +Adopt [policy/belief] = [policy/belief] törvénybe iktatása Remove [policy] = [policy] törlése Remove [policy] and refund [amount]% of its cost = [policy] törlése és [amount]% visszatérítése Free Technology = Ajándék technológia diff --git a/android/assets/jsons/translations/Indonesian.properties b/android/assets/jsons/translations/Indonesian.properties index b95fb4cc07..83dd5208c5 100644 --- a/android/assets/jsons/translations/Indonesian.properties +++ b/android/assets/jsons/translations/Indonesian.properties @@ -2492,7 +2492,7 @@ Free Great Person = Orang Hebat Gratis [amount] population [cityFilter] = [amount] populasi [cityFilter] [amount] population in a random city = [amount] populasi di kota acak Discover [tech] = Menemukan [tech] -Adopt [policy] = Menerapkan [policy] +Adopt [policy/belief] = Menerapkan [policy/belief] Remove [policy] = Cabut [policy] Remove [policy] and refund [amount]% of its cost = Cabut [policy] dan kembalikan [amount]% dananya Free Technology = Teknologi Gratis diff --git a/android/assets/jsons/translations/Italian.properties b/android/assets/jsons/translations/Italian.properties index adbdcb5b15..1e939649ba 100644 --- a/android/assets/jsons/translations/Italian.properties +++ b/android/assets/jsons/translations/Italian.properties @@ -2498,7 +2498,7 @@ Free Great Person = Ottieni un Grande Personaggio gratuito [amount] population [cityFilter] = [amount] abitanti [cityFilter] [amount] population in a random city = [amount] abitanti in una città casuale Discover [tech] = Scopri [tech] -Adopt [policy] = Adotta [policy] +Adopt [policy/belief] = Adotta [policy/belief] Remove [policy] = Rimuovi [policy] Remove [policy] and refund [amount]% of its cost = Rimuovi [policy] e rimborsa il [amount]% del suo costo Free Technology = Dona una tecnologia gratuita diff --git a/android/assets/jsons/translations/Japanese.properties b/android/assets/jsons/translations/Japanese.properties index 3be48acc27..171d1ad914 100644 --- a/android/assets/jsons/translations/Japanese.properties +++ b/android/assets/jsons/translations/Japanese.properties @@ -2509,7 +2509,7 @@ Free Great Person = 無償の偉人 [amount] population [cityFilter] = [cityFilter]人口[amount] [amount] population in a random city = ランダムな都市の人口[amount] Discover [tech] = [tech]を発見 -Adopt [policy] = [policy]を採用 +Adopt [policy/belief] = [policy/belief]を採用 Remove [policy] = [policy]を削除 Remove [policy] and refund [amount]% of its cost = [policy]を削除してそのコストの[amount]%を返却する Free Technology = テクノロジーを無償で1つ獲得 diff --git a/android/assets/jsons/translations/Korean.properties b/android/assets/jsons/translations/Korean.properties index 54c4340be4..70d3324afc 100644 --- a/android/assets/jsons/translations/Korean.properties +++ b/android/assets/jsons/translations/Korean.properties @@ -2527,7 +2527,7 @@ Free Great Person = 원하는 위인 1명이 무료로 출현 [amount] population [cityFilter] = [cityFilter]에 인구 [amount] [amount] population in a random city = 임의의 도시에 인구 [amount] 추가 Discover [tech] = [tech] 연구 -Adopt [policy] = [policy] 채택 +Adopt [policy/belief] = [policy/belief] 채택 Remove [policy] = [policy] 제거 Remove [policy] and refund [amount]% of its cost = [policy] 제거 및 비용의 [amount]% 환불 Free Technology = 무료 기술 획득 diff --git a/android/assets/jsons/translations/Latin.properties b/android/assets/jsons/translations/Latin.properties index d85dbf81bb..5cfbcaf875 100644 --- a/android/assets/jsons/translations/Latin.properties +++ b/android/assets/jsons/translations/Latin.properties @@ -2696,7 +2696,7 @@ Free Great Person = Persona Magna gratuita [amount] population [cityFilter] = [amount] multitudo [cityFilter] [amount] population in a random city = [amount] multitudo in urbem quæ decernatur passive (i.e. de cæcitate) Discover [tech] = Invenis [tech](m/s) -Adopt [policy] = Asciscas [policy](m/s/um/os) +Adopt [policy/belief] = Asciscas [policy/belief](m/s/um/os) Remove [policy] = Expellas [policy](m/s/um/os) Remove [policy] and refund [amount]% of its cost = Expellas [policy](m/s/um/os) et recipias [amount]% quam sumptum ejus Free Technology = Technologia gratuita diff --git a/android/assets/jsons/translations/Lithuanian.properties b/android/assets/jsons/translations/Lithuanian.properties index 7f89597ea4..7777a106f3 100644 --- a/android/assets/jsons/translations/Lithuanian.properties +++ b/android/assets/jsons/translations/Lithuanian.properties @@ -3037,7 +3037,7 @@ Free Great Person = Didis Žmogus dovanai # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Malay.properties b/android/assets/jsons/translations/Malay.properties index ba4dde38eb..6ea62f6802 100644 --- a/android/assets/jsons/translations/Malay.properties +++ b/android/assets/jsons/translations/Malay.properties @@ -3518,7 +3518,7 @@ Free Great Person = # Requires translation! [amount] population in a random city = Discover [tech] = Menemui [tech] -Adopt [policy] = Amalkan [policy] +Adopt [policy/belief] = Amalkan [policy/belief] # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Norwegian.properties b/android/assets/jsons/translations/Norwegian.properties index a4dd906202..71f6178b29 100644 --- a/android/assets/jsons/translations/Norwegian.properties +++ b/android/assets/jsons/translations/Norwegian.properties @@ -2864,7 +2864,7 @@ Free Great Person = Kostnadsfri stor person [amount] population [cityFilter] = [amount] folkemengd [cityFilter] [amount] population in a random city = [amount] folketal i ein tilfeldig by Discover [tech] = Oppdaga [tech] -Adopt [policy] = Vedtak [policy] +Adopt [policy/belief] = Vedtak [policy/belief] Remove [policy] = Fjerna [policy] # Requires translation! Remove [policy] and refund [amount]% of its cost = diff --git a/android/assets/jsons/translations/Persian_(Pinglish-DIN).properties b/android/assets/jsons/translations/Persian_(Pinglish-DIN).properties index 1ad8eb71e2..bf1a8f0191 100644 --- a/android/assets/jsons/translations/Persian_(Pinglish-DIN).properties +++ b/android/assets/jsons/translations/Persian_(Pinglish-DIN).properties @@ -4066,7 +4066,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Persian_(Pinglish-UN).properties b/android/assets/jsons/translations/Persian_(Pinglish-UN).properties index 8721a11480..87493b534b 100644 --- a/android/assets/jsons/translations/Persian_(Pinglish-UN).properties +++ b/android/assets/jsons/translations/Persian_(Pinglish-UN).properties @@ -3524,7 +3524,7 @@ Free Great Person = [amount] population in a random city = Discover [tech] = Kashf e [tech] # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = Remove [policy] = Hazf e [policy] # Requires translation! Remove [policy] and refund [amount]% of its cost = diff --git a/android/assets/jsons/translations/Polish.properties b/android/assets/jsons/translations/Polish.properties index 9e40b88681..4ec2e18eec 100644 --- a/android/assets/jsons/translations/Polish.properties +++ b/android/assets/jsons/translations/Polish.properties @@ -2534,7 +2534,7 @@ Free Great Person = Darmowy Wielki Człowiek [amount] population [cityFilter] = [amount] do populacji [cityFilter] [amount] population in a random city = [amount] populacji w losowym mieście Discover [tech] = Odkrywa [tech] -Adopt [policy] = Przyjmuje [policy] +Adopt [policy/belief] = Przyjmuje [policy/belief] Remove [policy] = Zrezygnuj z ustroju [policy] Remove [policy] and refund [amount]% of its cost = Zrezygnuj z ustroju społecznego [policy] i otrzymaj z powrotem [amount]% jego kosztu Free Technology = Otrzymasz 1 darmową technologię diff --git a/android/assets/jsons/translations/Portuguese.properties b/android/assets/jsons/translations/Portuguese.properties index 323c107517..a904f35aee 100644 --- a/android/assets/jsons/translations/Portuguese.properties +++ b/android/assets/jsons/translations/Portuguese.properties @@ -2492,7 +2492,7 @@ Free Great Person = Pessoa Experiente grátis [amount] population [cityFilter] = [amount] população [cityFilter] [amount] population in a random city = [amount] população numa cidade aleatória Discover [tech] = Descobre [tech] -Adopt [policy] = Adotar [policy] +Adopt [policy/belief] = Adotar [policy/belief] Remove [policy] = Retirar [policy] Remove [policy] and refund [amount]% of its cost = Retirar [policy] e reembolsar [amount]% do seu custo Free Technology = Tecnologia grátis diff --git a/android/assets/jsons/translations/Romanian.properties b/android/assets/jsons/translations/Romanian.properties index 863a56b9e7..14e608d440 100644 --- a/android/assets/jsons/translations/Romanian.properties +++ b/android/assets/jsons/translations/Romanian.properties @@ -2982,7 +2982,7 @@ Free Great Person = Persoană Extraordinară gratuit # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Russian.properties b/android/assets/jsons/translations/Russian.properties index 2bcaea1e4b..593785fe1b 100644 --- a/android/assets/jsons/translations/Russian.properties +++ b/android/assets/jsons/translations/Russian.properties @@ -2505,7 +2505,7 @@ Free Great Person = Бесплатный Великий человек [amount] population [cityFilter] = [amount] к населению [cityFilter] [amount] population in a random city = [amount] населения в случайном городе Discover [tech] = Открыть [tech] -Adopt [policy] = Принять [policy] +Adopt [policy/belief] = Принять [policy/belief] Remove [policy] = Удалить [policy] Remove [policy] and refund [amount]% of its cost = Удалите [policy] и верните [amount]% от его стоимости. Free Technology = Бесплатная технология diff --git a/android/assets/jsons/translations/Rusyn.properties b/android/assets/jsons/translations/Rusyn.properties index 354b82d6e3..22e8b165c2 100644 --- a/android/assets/jsons/translations/Rusyn.properties +++ b/android/assets/jsons/translations/Rusyn.properties @@ -3990,7 +3990,7 @@ Free Great Person = Промінент задарь [amount] population [cityFilter] = [amount] population in a random city = [amount] населення у випадковому місті Discover [tech] = Изучити [tech] -Adopt [policy] = Узяти [policy] +Adopt [policy/belief] = Узяти [policy/belief] # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Simplified_Chinese.properties b/android/assets/jsons/translations/Simplified_Chinese.properties index d6e345a374..da86fa4c5b 100644 --- a/android/assets/jsons/translations/Simplified_Chinese.properties +++ b/android/assets/jsons/translations/Simplified_Chinese.properties @@ -2499,7 +2499,7 @@ Free Great Person = 免费的伟人 [amount] population [cityFilter] = [cityFilter][amount]人口 [amount] population in a random city = 在一个随机城市中增加[amount]人口 Discover [tech] = 发现[tech] -Adopt [policy] = 立刻推行[policy] +Adopt [policy/belief] = 立刻推行[policy/belief] Remove [policy] = 取消推行[policy] Remove [policy] and refund [amount]% of its cost = 取消推行[policy]并返还[amount]%的文化花费 Free Technology = 获得1项免费科技 diff --git a/android/assets/jsons/translations/Spanish.properties b/android/assets/jsons/translations/Spanish.properties index 3cada5e183..93a000f33c 100644 --- a/android/assets/jsons/translations/Spanish.properties +++ b/android/assets/jsons/translations/Spanish.properties @@ -2496,7 +2496,7 @@ Free Great Person = Gran Personaje gratis [amount] population [cityFilter] = [amount] población [cityFilter] [amount] population in a random city = [amount] población en una ciudad aleatoria Discover [tech] = Descubre [tech] -Adopt [policy] = Adopta [policy] +Adopt [policy/belief] = Adopta [policy/belief] Remove [policy] = Remover [policy] Remove [policy] and refund [amount]% of its cost = Deshacer [policy] y reembolsar [amount]% de su costo Free Technology = Tecnología gratis diff --git a/android/assets/jsons/translations/Swedish.properties b/android/assets/jsons/translations/Swedish.properties index 3ce7a9c931..3015898df8 100644 --- a/android/assets/jsons/translations/Swedish.properties +++ b/android/assets/jsons/translations/Swedish.properties @@ -3045,7 +3045,7 @@ Free Great Person = Gratis Stor Person # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Thai.properties b/android/assets/jsons/translations/Thai.properties index 266d9455d9..c476937a8c 100644 --- a/android/assets/jsons/translations/Thai.properties +++ b/android/assets/jsons/translations/Thai.properties @@ -4172,7 +4172,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/Traditional_Chinese.properties b/android/assets/jsons/translations/Traditional_Chinese.properties index 64b5dbb6ab..ca1fd7959e 100644 --- a/android/assets/jsons/translations/Traditional_Chinese.properties +++ b/android/assets/jsons/translations/Traditional_Chinese.properties @@ -2527,7 +2527,7 @@ Free Great Person = 免費的偉人 [amount] population [cityFilter] = [cityFilter][amount]人口 [amount] population in a random city = 於一個隨機的城市[amount]人口 Discover [tech] = 發現[tech] -Adopt [policy] = 採行[policy] +Adopt [policy/belief] = 採行[policy/belief] Remove [policy] = 移除[policy] Remove [policy] and refund [amount]% of its cost = 移除[policy]並退還其成本的[amount]% Free Technology = 免費獲得1項科技 diff --git a/android/assets/jsons/translations/Turkish.properties b/android/assets/jsons/translations/Turkish.properties index e05b62f7ff..a0bb946097 100644 --- a/android/assets/jsons/translations/Turkish.properties +++ b/android/assets/jsons/translations/Turkish.properties @@ -2522,7 +2522,7 @@ Free Great Person = Ücretsiz Harika Kişi [amount] population [cityFilter] = [cityFilter] [amount] nüfus [amount] population in a random city = Rastgele bir şehirdeki [amount] nüfus Discover [tech] = [tech] teknolojisini keşfedin -Adopt [policy] = [policy] politikasını benimseyin +Adopt [policy/belief] = [policy/belief] politikasını benimseyin Remove [policy] = [policy] politikasını kaldırın Remove [policy] and refund [amount]% of its cost = [policy] politikasını kaldırın ve harcadığınız ücretin %[amount]'sini geri alın Free Technology = Ücretsiz Teknoloji diff --git a/android/assets/jsons/translations/Ukrainian.properties b/android/assets/jsons/translations/Ukrainian.properties index dcdb604882..74ef4f049f 100644 --- a/android/assets/jsons/translations/Ukrainian.properties +++ b/android/assets/jsons/translations/Ukrainian.properties @@ -2498,7 +2498,7 @@ Free Great Person = Безкоштовно зʼявляється Видатна [amount] population [cityFilter] = [amount] населення [cityFilter] [amount] population in a random city = [amount] населення у випадковому місті Discover [tech] = Дослідити Технологію [tech] -Adopt [policy] = Прийняти Політику [policy] +Adopt [policy/belief] = Прийняти Політику [policy/belief] Remove [policy] = Видалити [policy] Remove [policy] and refund [amount]% of its cost = Видалити [policy] і повернути [amount]% від її вартості Free Technology = Надає безкоштовну технологію diff --git a/android/assets/jsons/translations/Vietnamese.properties b/android/assets/jsons/translations/Vietnamese.properties index 0d4d7ef005..892f80c39f 100644 --- a/android/assets/jsons/translations/Vietnamese.properties +++ b/android/assets/jsons/translations/Vietnamese.properties @@ -2492,7 +2492,7 @@ Free Great Person = Người Vĩ đại tự do [amount] population [cityFilter] = [amount] dân số [cityFilter] [amount] population in a random city = [amount] dân số trong một thành phố ngẫu nhiên Discover [tech] = Khám phá [tech] -Adopt [policy] = Áp dụng [policy] +Adopt [policy/belief] = Áp dụng [policy/belief] Remove [policy] = Loại bỏ [policy] Remove [policy] and refund [amount]% of its cost = Loại bỏ [policy] và đền bù [amount]% chi phí của nó Free Technology = Công nghệ miễn phí diff --git a/android/assets/jsons/translations/Zulu.properties b/android/assets/jsons/translations/Zulu.properties index 2484cb6916..1ca1d8fc25 100644 --- a/android/assets/jsons/translations/Zulu.properties +++ b/android/assets/jsons/translations/Zulu.properties @@ -4119,7 +4119,7 @@ Free Great Person = # Requires translation! Discover [tech] = # Requires translation! -Adopt [policy] = +Adopt [policy/belief] = # Requires translation! Remove [policy] = # Requires translation! diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 1cc23751ca..cd001a7f97 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -1138,6 +1138,7 @@ Gained [stats] = You may choose a free Policy = You may choose [amount] free Policies = You gain the [policy] Policy = +You gain the [belief] Belief = You enter a Golden Age = You have gained [amount] [resourceName] = You have lost [amount] [resourceName] = diff --git a/core/src/com/unciv/models/Religion.kt b/core/src/com/unciv/models/Religion.kt index 515f4cda08..bcda3366e6 100644 --- a/core/src/com/unciv/models/Religion.kt +++ b/core/src/com/unciv/models/Religion.kt @@ -70,6 +70,8 @@ class Religion() : INamed, IsPartOfGameInfoSerialization { updateUniqueMaps() } + fun addBelief(belief: Belief) = addBeliefs(listOf(belief)) + @Readonly fun getIconName() = if (isPantheon()) "Pantheon" diff --git a/core/src/com/unciv/models/UnitAction.kt b/core/src/com/unciv/models/UnitAction.kt index 50b79af1fc..65a17057e2 100644 --- a/core/src/com/unciv/models/UnitAction.kt +++ b/core/src/com/unciv/models/UnitAction.kt @@ -48,7 +48,7 @@ open class UnitAction( UniqueType.OneTimeEnterGoldenAge, UniqueType.OneTimeEnterGoldenAgeTurns -> ImageGetter.getUnitActionPortrait("StartGoldenAge", size) UniqueType.GainFreeBuildings, UniqueType.RemoveBuilding, UniqueType.OneTimeSellBuilding, UniqueType.OneTimeFreeUnit, UniqueType.FreeSpecificBuildings -> ImageGetter.getConstructionPortrait(associatedUnique.params[0], size) UniqueType.OneTimeAmountFreeUnits -> ImageGetter.getConstructionPortrait(associatedUnique.params[1], size) - UniqueType.OneTimeFreePolicy, UniqueType.OneTimeAmountFreePolicies, UniqueType.OneTimeAdoptPolicy, UniqueType.OneTimeRemovePolicy, UniqueType.OneTimeRemovePolicyRefund -> ImageGetter.getUnitActionPortrait("HurryPolicy", size) + UniqueType.OneTimeFreePolicy, UniqueType.OneTimeAmountFreePolicies, UniqueType.OneTimeAdoptPolicyOrBelief, UniqueType.OneTimeRemovePolicy, UniqueType.OneTimeRemovePolicyRefund -> ImageGetter.getUnitActionPortrait("HurryPolicy", size) UniqueType.OneTimeRevealEntireMap, UniqueType.OneTimeRevealSpecificMapTiles, UniqueType.OneTimeRevealCrudeMap -> ImageGetter.getUnitActionPortrait("Explore", size) UniqueType.OneTimeConsumeResources, UniqueType.OneTimeProvideResources, UniqueType.OneTimeGainResource -> ImageGetter.getResourcePortrait(associatedUnique.params[1], size) UniqueType.OneTimeChangeTerrain -> ImageGetter.getUnitActionPortrait("Transform", size) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt b/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt index 76a4eb7af5..290a2596b9 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueTriggerActivation.kt @@ -41,6 +41,7 @@ import com.unciv.utils.addToMapOfSets import com.unciv.utils.randomWeighted import kotlin.math.roundToInt import kotlin.random.Random +import yairm210.purity.annotations.Readonly // Buildings, techs, policies, ancient ruins and promotions can have 'triggered' effects object UniqueTriggerActivation { @@ -96,7 +97,7 @@ object UniqueTriggerActivation { val relevantCity by lazy { city?: tile?.getCity() } - fun getApplicableCities(cityFilter: String) = + @Readonly fun getApplicableCities(cityFilter: String) = if (cityFilter == "in this city") sequenceOf(relevantCity).filterNotNull() else civInfo.cities.asSequence().filter { it.matchesFilter(cityFilter) } @@ -321,22 +322,27 @@ object UniqueTriggerActivation { true } } - UniqueType.OneTimeAdoptPolicy -> { - val policyName = unique.params[0] - if (civInfo.policies.isAdopted(policyName)) return null - val policy = civInfo.gameInfo.ruleset.policies[policyName] ?: return null - - return { - civInfo.policies.freePolicies++ - civInfo.policies.adopt(policy) - - val notificationText = getNotificationText( - notification, triggerNotificationText, - "You gain the [$policyName] Policy" - ) - if (notificationText != null) - civInfo.addNotification(notificationText, PolicyAction(policyName), NotificationCategory.General, NotificationIcon.Culture) - true + UniqueType.OneTimeAdoptPolicyOrBelief -> { + val name = unique.params[0] + val policy = civInfo.gameInfo.ruleset.policies[name] + val belief = civInfo.gameInfo.ruleset.beliefs[name] + when { + policy != null && !civInfo.policies.isAdopted(name) -> return { + civInfo.policies.freePolicies++ + civInfo.policies.adopt(policy) + getNotificationText(notification, triggerNotificationText, "You gain the [$name] Policy")?.let { + civInfo.addNotification(it, PolicyAction(name), NotificationCategory.General, NotificationIcon.Culture) + } + true + } + belief != null && civInfo.religionManager.religion?.hasBelief(name) == false -> return { + civInfo.religionManager.religion?.addBelief(belief) + getNotificationText(notification, triggerNotificationText, "You gain the [$name] Belief")?.let { + civInfo.addNotification(it, NotificationCategory.Religion, NotificationIcon.Faith) + } + true + } + else -> return null } } UniqueType.OneTimeRemovePolicy -> { @@ -1158,7 +1164,7 @@ object UniqueTriggerActivation { if (tilesToTakeOver.none()) return null /** Lower is better */ - fun cityPriority(city: City) = city.getCenterTile().aerialDistanceTo(tile) + (if (city.isBeingRazed) 5 else 0) + @Readonly fun cityPriority(city: City) = city.getCenterTile().aerialDistanceTo(tile) + (if (city.isBeingRazed) 5 else 0) val citiesWithAdjacentTiles = tilesToTakeOver.asSequence() .flatMap { it.neighbors + it } @@ -1213,6 +1219,7 @@ object UniqueTriggerActivation { } } + @Readonly private fun getNotificationText(notification: String?, triggerNotificationText: String?, effectNotificationText: String): String? { return if (!notification.isNullOrEmpty()) notification else if (triggerNotificationText != null) diff --git a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt index 2e19b02fba..9350b9cb39 100644 --- a/core/src/com/unciv/models/ruleset/unique/UniqueType.kt +++ b/core/src/com/unciv/models/ruleset/unique/UniqueType.kt @@ -827,7 +827,7 @@ enum class UniqueType( OneTimeGainPopulation("[amount] population [cityFilter]", UniqueTarget.Triggerable), // used in CN tower OneTimeGainPopulationRandomCity("[amount] population in a random city", UniqueTarget.Triggerable), OneTimeDiscoverTech("Discover [tech]", UniqueTarget.Triggerable), - OneTimeAdoptPolicy("Adopt [policy]", UniqueTarget.Triggerable), + OneTimeAdoptPolicyOrBelief("Adopt [policy/belief]", UniqueTarget.Triggerable), OneTimeRemovePolicy("Remove [policy]", UniqueTarget.Triggerable), OneTimeRemovePolicyRefund("Remove [policy] and refund [amount]% of its cost", UniqueTarget.Triggerable), OneTimeFreeTech("Free Technology", UniqueTarget.Triggerable), // used in Buildings diff --git a/docs/Modders/uniques.md b/docs/Modders/uniques.md index 4100c52f5d..89f7bf9874 100644 --- a/docs/Modders/uniques.md +++ b/docs/Modders/uniques.md @@ -69,7 +69,7 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl Applicable to: Triggerable -??? example "Adopt [policy]" +??? example "Adopt [policy/belief]" Example: "Adopt [Oligarchy]" Applicable to: Triggerable diff --git a/tests/src/com/unciv/uniques/GlobalUniquesTests.kt b/tests/src/com/unciv/uniques/GlobalUniquesTests.kt index 97e6d461ac..cae9a6f617 100644 --- a/tests/src/com/unciv/uniques/GlobalUniquesTests.kt +++ b/tests/src/com/unciv/uniques/GlobalUniquesTests.kt @@ -228,6 +228,27 @@ class GlobalUniquesTests { Assert.assertTrue(civInfo.stats.getStatMapForNextTurn()["Policies"]!!.science == 30f) } + @Test + fun uniqueTypeOneTimeAdoptPolicyOrBelief() { + val civ = game.addCiv() + val tile = game.getTile(Vector2.Zero) + val city = game.addCity(civ, tile, true) + + // Policy + Assert.assertFalse(civ.policies.isAdopted("Legalism")) + city.cityConstructions.addBuilding(game.createBuilding("Adopt [Legalism]")) + Assert.assertTrue(civ.policies.isAdopted("Legalism")) + + // Belief + Assert.assertFalse(civ.religionManager.religion?.hasBelief("Dance of the Aurora") ?: false) + city.cityConstructions.addBuilding(game.createBuilding("Adopt [Dance of the Aurora]")) // Expected to not work, since we require a Religion + Assert.assertFalse(civ.religionManager.religion?.hasBelief("Dance of the Aurora") ?: false) + game.addReligion(civ) // With the Religion, we should be able to adopt the belief + Assert.assertFalse(civ.religionManager.religion?.hasBelief("Dance of the Aurora") ?: false) + city.cityConstructions.addBuilding(game.createBuilding("Adopt [Dance of the Aurora]")) + Assert.assertTrue(civ.religionManager.religion?.hasBelief("Dance of the Aurora") ?: false) + } + @Test fun statsFromGlobalCitiesFollowingReligion() { val civ1 = game.addCiv()