376 Commits

Author SHA1 Message Date
yairm210
4ff8442023 chore: Added test that battle triggers work, investigating #13291 2025-05-05 21:04:56 +03:00
SomeTroglodyte
e38e76b5c6
Expressions as Countable (#13218)
* Redefine ICountable.matches, getDeprecationAnnotation is not part of the "engine" character of that interface

* Add a way to mark not-yet-finished Countables

* Add an empty framework for @AutumnPizazz's Expression engine

* Make "which does not fit parameter type" constant for pattern match robustness

* New expression evaluator engine

* Fix countable tests: correct expected failures

* All syntax errors MUST indicate position.
Otherwise, modders can't actually debug.

* Better positions + documentation

* Get rid of functions that modders *should not* be using

* Fix tests given the new changes

* Add modder-visible expression parsing errors

* Revert Countables to current state

* Fix the rest of the damn owl - compilation, not tests

* Fix all tests as well

* Detect countables at parse; Don't crash

* Add error detection for all types of expression errors

* Better documentation

* Countables catches first matching, to avoid parsing known countables as Expressions

---------

Co-authored-by: yairm210 <yairm210@hotmail.com>
2025-05-01 20:26:21 +03:00
SomeTroglodyte
a6da025705
Another countables test (#13184)
* Faster TestGame class

* Fix fragile unit tests

* Prerequisites for a Countables.FilteredBuildings unit test

* A Countables.FilteredBuildings unit test

* Revert buildingFilter duplicate tagUnique support
2025-04-11 14:13:20 +03:00
SomeTroglodyte
b0c9295372
More improvements to internal Countables handling (#13187)
* TranslationFileWriter support for Countables

* Minor Countables Kdoc update

* Code deduplication in UniqueTriggerActivation, also for future reuse

* Sync UniqueParameterType.PolicyFilter checks and doc with implementation

* Improve testRulesetValidation
2025-04-11 08:09:07 +03:00
SomeTroglodyte
2025d2ae7a
Countables : Next "pass" (#13168)
* Fix equalsPlaceholderText again

* Fix implementation details and linting

* Fix placeholder parameters validation

* Edit Kdoc to match new structure and improve clarity

* Add unit test checking the Class itself for convention violations

* Split off the ForEveryCountable test from testRulesetValidation and give it full coverage

* Silence warnings
2025-04-08 10:56:05 +03:00
yairm210
80e6e7a548 Added test to ensure countable parameters are proper parameter types 2025-04-07 10:47:28 +03:00
SomeTroglodyte
2a04e0d9a3
Refactor Countables into an enum with better validation, tests, and auto documentation (#13161)
* Make deprecated Uniques that are no longer implemented show up in Red in mod checker

* Refactor Countables into an empowered enum

* Refactor Countables into an empowered enum: RulesetValidator support

* Refactor Countables into an empowered enum: UniqueDocsWriter support

* Refactor Countables into an empowered enum: More unit tests

* Refactor Countables into an empowered enum: Streamline a little

* Refactor Countables into an empowered enum: Deprecation support with unit test

* Deprecation level ERROR now shown as Orange as requested
2025-04-07 09:25:54 +03:00
SomeTroglodyte
1c7a50e1c9
Reworked Locale handling + deprecations + linting (#13142)
* Linting and deprecations

* Trial and error for Locale factories

* Reworked Locale handling

* Clean up fastlane for Rusyn

* Decide open question in favour of supported methods
2025-04-06 11:45:29 +03:00
yairm210
9e658eb012 modding: "Not shown on world screen" applies to promotions and statuses 2025-03-10 09:57:13 +02:00
SeventhM
45347cc928
Add a field for global unit uniques (#12775)
* Add a field for global unit uniques

* Whoops

* docs

* Fix this check only ever being done once

* Revert

* Add ruleset uniques when adding rulesets together

* Add ruleset to unitTypes for tests in case it's relevant

* My suggested changes: Implement a separate rulesetMap for units, remove any additional checks to the type where unnecessary

* Remove unit type code, update ruleset info by setter rather than by lazy

* Type information is needed before we set the ruleset here

* So should unique information
2025-01-22 17:41:20 +02:00
yairm210
565653c3f0 Fix water adjacency test 2025-01-02 21:24:50 +02:00
yairm210
d0a3b37f74 Resolved #12572 - "Stats from tiles" uniques work with terrain + improvement filter combos 2024-12-05 22:19:15 +02:00
SeventhM
dffef35779
Cache state for units, civs, and cities (#12491)
* Cache unit state

* Cache city state

* Cache civ state

* Have to update state after getting gameInfo
2024-11-19 09:02:41 +02:00
yairm210
cfdfb839c5 Fix tests 2024-11-12 23:09:19 +02:00
yairm210
2cfe78a197 Clearer pop change limit redux - kudos @SeventhM
Resolves #12435
2024-11-09 22:27:57 +02:00
yairm210
8cc3c50c24 4.14.2 2024-10-31 10:28:07 +02:00
yairm210
9f3f5a3a09 chore: CheckModLinks -> GetErrorList 2024-09-17 20:05:13 +03:00
yairm210
3536218fc8 Don't allow constructing stockpiled-resource-requiring constructions when lacking the resources 2024-08-29 10:32:31 +03:00
yairm210
3c42d44ec4 Consume stockpiled resources when purchasing constructions that require them 2024-08-29 10:22:21 +03:00
yairm210
9129e11687 Fixed test 2024-08-25 01:25:30 +03:00
yairm210
9d13303db6 test: Added test to ensure stockpiled resources are consumed when starting work on "Costs [amount] [stockpiledResource]" construction 2024-08-23 10:41:33 +03:00
yairm210
b587bfa591 Improvement uniqueTo can apply to civ *filters* 2024-08-14 21:50:39 +03:00
Yair Morgenstern
210895295f
Added support for new historyranking serialization - saved ~10% of save file size (#12079)
* Added support for new historyranking serialization - saved ~10% of save file size!

* Convert RankingType strings to chars

* Join to string using ranking char instead of generic delimiter

* Keep writing old format for now :)

* Handle negative rankings

* Fix test

* Minor perf

* Revert "Minor perf"

This reverts commit 470b3e92861e8a5f7be0fe3fe74d9b7ca110c67b.
2024-08-08 14:54:33 +03:00
Yair Morgenstern
b9f907e74d
Use custom Vector2 serialization - reduces total file size by 4% (#12077) 2024-08-08 14:38:59 +03:00
yairm210
f764f7c467 Fix tests 2024-08-08 14:16:34 +03:00
yairm210
0c4814eae4 minor perf: Map getTile does one lookup instead of two 2024-08-07 22:24:23 +03:00
yairm210
cf2b1cdf8e Unique.conditionals -> unique.modifiers
It's high time
2024-08-04 16:33:13 +03:00
yairm210
053f5b9442 chore: retire deprecated uniques 2024-08-01 18:59:22 +03:00
yairm210
3e7bbce9fe Fixed tests, since "1 radius with world wrap" does not fit 1-radius map tests 2024-07-29 15:24:17 +03:00
yairm210
255ba1d9c6 Fix tests 2024-07-27 23:45:34 +03:00
yairm210
f03c30ed5c - Desktop: Allow specifying data directory (for "local" files, in GDX terms) separate from installed files directory (What GDX terms "internal").
- Added helper functions for common paths
- Does not include a way to specify said directory - pending tests
2024-07-27 23:13:27 +03:00
Oskar Niesen
155082471b
Made Gold Gifting moddable (#11995)
* Made gold gifting moddable

* Made gold gift degradation moddable

* Removed unused import statement
2024-07-24 16:31:57 +03:00
Oskar Niesen
2ffcc48bbf
Escort movement fix (#11810)
* Wrote some failing unit tests to simulate the crash

* Fix escort movement crash

* getDistanceToTiles now searches once using both escorting units

* Added an extra test

* Moved checking for escort unit movement outside of getMovementCostBetweenAdjacentTiles
2024-07-14 09:22:28 +03:00
SomeTroglodyte
3b40620cd6
UX: Notifications for map units select better when tapped (#11921)
* Use MapUnitAction for more notifications

* Enable MapUnitAction to select by ID

* Forgot "[N] of your cities can bombard..."
2024-07-09 17:25:38 +03:00
SomeTroglodyte
1483ac54b3
Fix TranslationFileWriter changing diacritic-using languages (#11913)
* Fix TranslationFileWriter so it works with original translations, not fake-alphabet-mapped ones.

* Kdoc and remove redundant code as per review
2024-07-05 16:10:24 +03:00
Md. Touhidur Rahman
461a7ac99d
Translate numbers to selected language (#11898)
* implement number translation

* fix previous error

* maybe this will fix things?

* try to make the regex more concise and fix the issues

* update implementation

* Transient cache

* implement Number.tr()

* Update core/src/com/unciv/models/metadata/GameSettings.kt

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>

* fix formatting

* move getNumberFormatFromLanguage() to Translations.kt and cache NumberFormat

* remove null cases and resolve suggestions

* why was I doing this? I forgot.

* move getLocaleFromLanguage() to Translations.kt

* add tests

* Update TranslationTests.kt

fix issues

* also remove also

* fix all given cases

* fix missing language param

---------

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2024-07-05 16:09:19 +03:00
yairm210
d9deb12df9 perf: Calculate resource modifiers *once* when calculating resources 2024-07-04 00:02:14 +03:00
yairm210
9c864c34f0 4.12.7 2024-07-02 22:10:47 +03:00
SomeTroglodyte
b5622df92d
Support for languages using Diacritics as multi-codepoint joiners (#11806)
* Diacritics support - achieving 1-Char-Per-Glyph via a fake alphabet

* Diacritics support - Redesign state engine and polishing

* Diacritics support - Unit test

* Diacritics support - Expand unit test to cover more cases

* Diacritics support - Expand unit test to cover more cases

* Clarify a function name

* Change format of diacritic definitions

* Refactor DiacriticSupport to per-language class with statics in Companion

* Update DiacriticSupport to use CharCategory and enable support of surrogate pairs

* Documentation
2024-06-29 23:39:46 +03:00
yairm210
0f2a697ba6 Many lazies for things that remain permanent, and profiling shows are frequently used 2024-06-29 23:39:10 +03:00
yairm210
c9bcf10f2a naming: TradeType -> TradeOfferType 2024-06-27 23:18:16 +03:00
yairm210
1da5410324 Religion beliefs are private, uniques are cached 2024-06-27 00:33:31 +03:00
SomeTroglodyte
77f02600fd
Unit test to catch game loading problems with religion enabled (#11821)
* Lint regions in UncivFiles

* Create a load-predefined-game test that catches the 4.12.2 bug
2024-06-23 19:18:58 +03:00
yairm210
d12c6c10e7 Fix tests 2024-06-21 19:02:01 +03:00
Yair Morgenstern
79be14e291 Resolved #11082 - Added "Will not be replaced by automated units" unique 2024-06-17 23:12:50 +03:00
Oskar Niesen
bbea08364b
TechDebt: Made getDiplomacyManger() nullable (#11771)
* Made getDiplomacyManager nullable and added getDiplomacyMangerOrMeet

* Fixed AI Automation having problems when playing as a oneCityChallenger civ
2024-06-16 23:40:45 +03:00
SomeTroglodyte
3c91647fb2
Streamline and thereby reduce size of the save game json (#11728) 2024-06-14 17:39:59 +03:00
SomeTroglodyte
e74897469c
Improvement queue (#11677)
* Improvement queue: Framework

* Improvement queue: Minimal UI

* Remove debug code

* Fix merge error

* Address tuvus's input

* Implement tuvus's UI wishes

* Fix merge errors

* Fix more merge errors
2024-06-14 17:39:46 +03:00
Oskar Niesen
728713dc3e
Giving the AI good trades is stored as credit (#11326)
* AI Civs now are happy for good trades

* Each gift point is worth 100 gold without inflation

* Gifts can now be used as credit for future trades

* Fixed giftAmount conversions

* Fixed get inflation returning NAN when gpt is negative

* diplomatic gifts are now rounded when checking trade acceptability

* Changed gold gift scaling to account for relationship level

* Fixed percent based value reduction

* Added gold gifting functions to DiplomacyManager

* Added tests

* Declaring war removes gold gifts

* Reversed trade evaluation

* Added more tests for trading

* Fixed who the gifts are given to

* Added more comments

* Added more tests and fixed stuff

* Gifting does not occur with trade treaties

* Renamed handleGoldGifted to GiftGold

* Added two more tests

* Improved comments

* Liberating a civ no longer gives positive relations from open borders
2024-06-14 17:38:54 +03:00
yairm210
3160416138 Fix tests 2024-06-13 13:50:00 +03:00