Commit Graph

365 Commits

Author SHA1 Message Date
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 470b3e9286.
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
yairm210
4f436e98bd rename: changeImprovement -> setImprovement 2024-06-13 12:23:25 +03:00
SomeTroglodyte
cf7f5a1c52
Remove 'Strategic Balance' and 'Legendary Start' from resource abundance select (#11699)
* Convert MapResources into an Enum

* Fix IsPartOfGameInfoSerialization where actually only the String is part of serialization

* Refactor MapResources to own file, package mapgenerator

* Refactor MapSize/MapSizeNew to own file and rename
2024-06-08 21:58:19 +03:00
SomeTroglodyte
a046e43dbf
UI candy: WLTK fireworks (#11616)
* Particle effect fireworks for WLTK

* Refactor fireworks, try another location calculation

* Save todo list

* Fireworks assets

* ParticleEffectAnimation framework refactor and FasterUIDevelopment

* ParticleEffectAnimation rework - works correctly now

* ParticleEffectAnimation - credits and fine-tune

* ParticleEffectAnimation - atlas

* ParticleEffectAnimation - clean up testing code

* ParticleEffectAnimation - fix bungled texture move
2024-06-04 18:00:44 +03:00
yairm210
bed8d3b176 minor docs and city resource conditional test 2024-05-31 13:55:38 +03:00
yairm210
a45c057b48 Better location for resource tests 2024-05-31 13:47:14 +03:00
SomeTroglodyte
9e5c113ee8
UI: Allow any mod sound to be selected as a multiplayer turn notification sound (#11623)
* Linting

* Fix potential crash when having a multiplayer notification sound configured that is no longer available

* New media finder architecture

* Unit tests for new media finder architecture

* Apply new media finder architecture to solve "allow all mod sounds as multiplayer notifications" request
2024-05-29 23:59:57 +03:00
SomeTroglodyte
e1ec448f81
Cleaner Json custom serialization and unit tests (#11624)
* Barbarian encampments are no longer a HashMap since #9374 so that old compat code is unreachable

* Rename SerializationTests to GameSerializationTests and add a barb camp to the game

* Add SerializationTests (roundtrip tests for classes with custom serialization)

* Convert setSerializer to implement Json.Serializable where possible
2024-05-27 12:37:49 +03:00
Yair Morgenstern
11cee77fb9
"for every [countable]" unique modifier (#11641)
* "for every [countable]" unique modifier

* detekt fix

* Test city-unique edge cases
2024-05-27 12:32:12 +03:00
SomeTroglodyte
c5df845611
Fix bug in ModConstants handling (#11645)
* Fix a few unhelpful mod checker warnings

* Fix a problems with ModConstants and unit tests for them

* Minor linting
2024-05-27 12:30:51 +03:00
Oskar Niesen
8b27de26d5
Declare War Reason (#11490)
* Created DeclareWarReason enum

* Created a new notifyOfWar function and a DeclareWarReason class

* moved handleCityStateDirectAttack to it's own function

* Moved changing modifiers to its own function

* Moved notifyOfWar above onWarDeclared

* Fixed defensive pact canceling notifications

* Added more comments

* Fixed DiplomacyManagerTests

* Warmongering does not stack with defensive pacts

* Reworked how shared enemy modifiers are given out

* Fixed JoinWar notifications

* Added join war translations

* Added missing defensive pact translations

* Fixed translation parameter problems

* Changed "canceled" to "cancelled"
2024-04-24 00:01:26 +03:00
SomeTroglodyte
9dcfb963e3
Multi-filter improve code clarity and more unit tests (#11503)
* Some linting and region reorder

* Make MultiFilter accept a negated "and" list plus more unit tests

* MultiFilter gets 'or' capability

* Revert "MultiFilter gets 'or' capability"

This reverts commit 9f6e7c794a.
2024-04-24 00:00:40 +03:00