Commit Graph

303 Commits

Author SHA1 Message Date
Yair Morgenstern
5585dfa470 Resolved #10005 - Great person points for units not in ruleset are ignored, and warned against 2023-08-30 23:10:14 +03:00
SeventhM
bda3215006
Refactor: Remove unnecessary ruleset checks (#9973)
* address unnecessary ruleset checks

* Add missing imports

* Fix units not getting the ability uses set if it the city has your own religion

* Remove unnecessary cityConstructions check

* Remove more cases of unnecessary ruleset checks
2023-08-27 22:48:20 +03:00
Framonti
53748a40d7
Add tests for city class and introduce small refactor (#9965)
* ♻ extract methods to improve readability

* 💚 introduce tests for city logic
2023-08-24 17:14:02 +03:00
SeventhM
67adabb78f
Additional unit tests (#9866)
* Additional unit tests

* Missing import

* Changing stuff solely to avoid an import

* Example of the test, in different orders

* New PromotionTree test

* Add functions to make PromotionTree easier to work with

* Changing values to be lateinit variables
2023-08-17 09:17:23 +03:00
Yair Morgenstern
0561a7951c Much more accurate improvement stat effects 2023-08-09 00:46:33 +03:00
Yair Morgenstern
60ea752c1f chore: Modernized DiplomacyManagerTests 2023-08-08 23:55:37 +03:00
Yair Morgenstern
3cbd447620 Removed HandleImprovementCompletion function, added test for citadel tile takeover 2023-08-08 22:00:18 +03:00
Yair Morgenstern
55b4191be3 changeImprovement now contains 'terrain feature removal' logic 2023-08-08 19:25:51 +03:00
Yair Morgenstern
d9ceb9290d 4.7.12-patch1 2023-08-04 09:21:51 +03:00
SomeTroglodyte
bcb26b6d2a
Treat remaining untyped Uniques in default rulesets (#9763)
* Treat remaining untyped Uniques in default rulesets, make unit test catch them

* Change untyped filtering Uniques check to Validation by inclusion in GlobalUniques instead of UniqueType.AircraftMarker

* Wiki for untyped filtering Uniques

* Re-include the "Who knows" of Future Tech on the Tech picker
2023-08-03 11:38:50 +03:00
Yair Morgenstern
fc40da11d9
Added tests to ensure that resources from buildings behave as expected (#9860)
* Added tests to ensure that resources from buildings behave as expected

* More tests suggested by @SeventhM

* Caught an edge case - if you pillage your own tile improvement, your resources would not have updated!

* Actually every time an improvement changes you could have a resource change

* Update resources eon every improvement change because they could be providing resources via uniques
2023-08-03 11:38:36 +03:00
SeventhM
eb17398d78
Modernize Connection Tests (#9831) 2023-07-23 08:18:39 +03:00
SeventhM
1ca9766811
Fix issues when transferring capitals (#9801)
* Revert previous patches

* Fix the unit test, I guess
2023-07-18 18:08:30 +03:00
SeventhM
1e66c2e131
Avoid built buildings (#9806)
* Removing most interactions with builtBuildings

* Might as well edit this too

* Fix issues and edit isBuilt

* Simplify isAllBuilt
2023-07-16 23:01:17 +03:00
Yair Morgenstern
ee092a5851
City-level resources (#9774)
* City-level resources are...
- Not displayed in civ top bar
- Not considered civ-level resources (for trade, non-city conditionals, etc)
- Are explicitly treated in city conditionals
- ARE considered for constructing buildings requiring resource
- ARE NOT considered for construction units requiring resource

* getCityResources separates resources by origin so we need to sum them - kudos @SeventhM

* CR fixes

* Added new Civilization.getResourceAmount function

* More usages of civInfo.getResourceAmount()

* Don't add city resource table if it's empty
2023-07-10 16:24:50 +03:00
Yair Morgenstern
19bf15558d Fixed India's 'double unhappiness' unique 2023-07-05 21:10:22 +03:00
Yair Morgenstern
c787ab1a30 chore: Modernized WorkerAutomationTest 2023-07-04 15:09:40 +03:00
Yair Morgenstern
86cde678b3 chore: Modernized TileImprovementConstructionTests 2023-07-03 23:43:03 +03:00
Yair Morgenstern
537ebdcbdd chore: Modernized VisibilityTest 2023-07-03 22:28:04 +03:00
Yair Morgenstern
06377feaeb 4.7.6-patch2
Resolved crash when moving cities between civs, added tests to ensure future changes do not break city moving functionality
2023-07-03 14:13:31 +03:00
Yair Morgenstern
afbf772d3d Modernized UnitMovementTests to use TestGane 2023-07-03 13:33:35 +03:00
Yair Morgenstern
6eeb630b6c chore: 'cityInfo' purge (changed to 'city' everywhere) 2023-06-28 23:38:01 +03:00
Jack Rainy
82ebb01a20
Zoom in/out of the history charts (#9660)
* Do not recreate the Line Chart every time

* Simplifed the Line Chart creation

* Do not create objects in draw(): VictoryScreenCivGroup table

* Do not create objects in draw(): Labels

* Create labels without negative Y

* Lift the X axis if there is an negative number

* Arbitrary number of -Y labels

* Autoscale by Y axis

* Zoom in/out by click

* Autoscale by X axis

* Unit tests for LineChart

* Rework of the line chart rendering
2023-06-25 09:37:08 +03:00
Xander Lenstra
aa0fb9ed8b
More unit unique tests (#9639) 2023-06-25 09:35:31 +03:00
Xander Lenstra
639d34e28d
Reordered the region of other global uniques and wrote a few unique tests (#9611) 2023-06-17 20:59:51 +03:00
SomeTroglodyte
936b9e34ef
Fix and unit-test Hakkapeliitta TransferMovement ability (#9539) 2023-06-07 13:35:53 +03:00
janarvid
ff9d5ff9c1
Fix bug worker will not replace improvement to enable strategy resour… (#9449)
* Fix bug worker will not replace improvement to enable strategy resources #9328

* Make test logic more clear and add some comments
2023-05-28 17:52:37 +03:00
alexban011
91116f8df3
Fixed more warnings (#9401)
* fix: fix FunctionParameterNaming warnings

* fix: fix InvalidPackageDeclaration warnings

* fix: fix MatchingDeclarationName warnings

* fix: fix WrongEqualsTypeParameter warnings

* fix: fix UnusedPrivateProperty warnings

* fix: fix UseCheckOrError warningsU

* fix: fix UseRequire warningsU

* detekt: disabled SpreadOperator rule

* fix: resolve MemberNameEqualsClassName rule

* detekt: disabled ForbiddenComment rule

* fix: resolved SwallowedException warning

* fix: resolved ThrowingExceptionsWithoutMessageOrCause warning

* fix: resolved EmptyFunctionBlock warning

* fix: resolved EmptyFunctionBlock warning

* fix: resolved InstanceOfCheckForError warning

* detekt: disable TooGenericExceptionCaught warning

* detekt: disable TooGenericExceptionThrown warning

* fix: resolve part of NestedBlockDepth warnings
2023-05-18 10:12:33 +03:00
alexban011
f3e80a4021
Fixed a couple warnings reported by code analysis (#9364)
* fix: resolve EmptyCatchBlock warnings

* fix: resolve PrintStackTrace warnings

* fix: resolve SwallowedException warnings

* fix: resolve ThrowingExceptionsWithoutMessageOrCause warnings

* fix: resolve ConstructorParameterNaming warnings

* fix: resolve FunctionParameterNaming warnings

* fix: resolve InvalidPackageDeclaration warnings

* fix: resolve ForEachOnRange warnings

* fix: resolve ImplicitDefaultLocale warnings

* fix: resolve MayBeConst warnings

* fix: resolve NewLineAtEndOfFile warnings

* fix: resolve UnusedParameter warnings

* fix: resolve UtilityClassWithPublicConstructor warnings

* fix: resolve WildcardImport warnings
2023-05-10 11:43:53 +03:00
Yair Morgenstern
ac63a6453b Fix tests 2023-04-25 18:02:37 +03:00
Yair Morgenstern
cb20d91822 Battle table displays bonuses according to tile that unit will attack from, not the current tile it's on 2023-04-08 21:34:55 +03:00
SomeTroglodyte
2150fc2244
Random nation count (#9118)
* Fix game starter problems with random number of players

* Some cleanup to use new Player constructor signature
2023-04-04 23:41:45 +03:00
Yair Morgenstern
a37391781a Fixed tests 2023-04-03 13:56:13 +03:00
SomeTroglodyte
45d66f0580
Civilopedia Welcome, moddable (#8940) 2023-03-31 14:58:07 +03:00
SomeTroglodyte
da7786a2cb
More Spectator/Barbarians fixes related to income (#9011)
* Prevent Barbarians and Spectator having income or Allies

* Prevent Barbarians and Spectator having income or Allies - fix test
2023-03-23 23:57:23 +02:00
WhoIsJohannes
11be6e2804
Silently log ranking stats for each major civ every turn (#8964)
* Record each stat each round for each civilization.

* Implement custom serialization and encapsulate logic in separate CivRankingHistory.kt

* Address comments

* Address comments and add RankingTypeTest.kt
2023-03-21 14:38:22 +02:00
SomeTroglodyte
dabd26ac0d
Fix Great Person Create Improvement requiring Resource (#8979)
* Fix GP create with Improvement requiring Resource

* Unit Test: GP create with Improvement requiring Resource
2023-03-21 14:06:35 +02:00
Yair Morgenstern
2d6a88f3e3 Resolved #8968 - stats for notifications string'd without special characters 2023-03-20 00:41:58 +02:00
Yair Morgenstern
a37eb28964 UnitMovementAlgorithms -> UnitMovement and modernized city connections tests 2023-03-20 00:20:34 +02:00
Yair Morgenstern
a46870c862 Deprecation of old components - ConstructionFilter, Ruleset.maxXpFromBarbarians, GameParameters.gameSpeed 2023-03-16 22:53:22 +02:00
SomeTroglodyte
db08c30363
Make City center minimum tile yields moddable (#8804)
* Slight cleanup of TileStatFunctions

* Make City center minimum tile yields moddable

* Make City center minimum tile yields moddable - patch1

* Make City center minimum tile yields moddable - patch1
2023-03-13 17:02:08 +02:00
vegeta1k95
494fde53cf
Cleaning: platform specifics and UncivGame (#8773)
* Cleanup: platform specifics + UncivGame

* Fix tests

* Fix requests not clearing

---------

Co-authored-by: vegeta1k95 <vfylfhby>
2023-02-28 18:56:57 +02:00
vegeta1k95
c593056e42
Modding: allow mods to supply custom fonts (#8715)
* Modding: allow mods to supply custom fonts

* Cleanup

* Code cleanup

---------

Co-authored-by: vegeta1k95 <vfylfhby>
2023-02-21 23:09:11 +02:00
Yair Morgenstern
c6b888e6ed Fix android build 2023-02-19 16:35:20 +02:00
Yair Morgenstern
70f81d1657 chore: huge code reorg for ui classes
Separated into screens, popups, and UI components, with screen-specific components located together with their screens
2023-02-19 07:47:29 +02:00
lishaoxia1985
4a3f7f0250
Some modifications for performance optimization (#8631) 2023-02-09 15:42:37 +01:00
Yair Morgenstern
0548b3b472 chore: renamed GameInfo.ruleSet -> ruleset 2023-02-03 13:06:32 +02:00
Yair Morgenstern
e84887b8c2 chore: separated unit cached values into separate file 2023-02-02 19:50:00 +02:00
Yair Morgenstern
7d93b24d8c Renamed MapUnit.civInfo -> civ 2023-02-02 19:31:41 +02:00
Yair Morgenstern
6414ad95ae Renamed City.civInfo -> civ 2023-02-02 19:21:12 +02:00
Yair Morgenstern
ba097cee9d Stats serialize to notifications - see #8446 2023-02-02 18:16:51 +02:00
Yair Morgenstern
d565bf8f64 Fixed tests 2023-01-23 11:04:32 +02:00
Yair Morgenstern
783a469da5 chore: separated unit actions into several files 2023-01-23 00:42:45 +02:00
Yair Morgenstern
d662df9e2f chore: Rename CivilizationInfo -> Civilization 2023-01-22 00:28:15 +02:00
Yair Morgenstern
81a5e15413 chore: Rename CityInfo -> City 2023-01-22 00:24:02 +02:00
Yair Morgenstern
82010e8564 chore: Rename TileInfo -> Tile 2023-01-22 00:19:25 +02:00
Yair Morgenstern
801116551b Chore: Moved tile stat functions to separate class 2023-01-19 21:56:44 +02:00
Yair Morgenstern
69393eafce Chore: Moved tile improvement functions to separate class 2023-01-19 21:32:58 +02:00
Yair Morgenstern
504a15b9a5 map file reorg 2023-01-19 18:42:24 +02:00
Yair Morgenstern
5ebfcc3a90 chore: Split CityInfo functions into CityTurnMAnager and CityFounder 2023-01-18 21:34:41 +02:00
Yair Morgenstern
e56d53dcd9 chore: Moved diplomacy functions to DiplomacyFunctions 2023-01-18 18:11:18 +02:00
Yair Morgenstern
4488a6fe51 chore: Moved unit functions to UnitManager 2023-01-18 17:32:47 +02:00
Yair Morgenstern
e272a1408d chore: Removed turn management functions from CivInfo 2023-01-18 15:51:25 +02:00
Yair Morgenstern
e8f54cc2f5 chore: File reorg 2023-01-18 15:25:25 +02:00
Yair Morgenstern
5279a11c2f chore: File reorg 2023-01-18 15:17:32 +02:00
Yair Morgenstern
bdc239fd34 chore: moved statsForNextTurn and happiness transients into civ stats 2023-01-18 14:49:25 +02:00
Yair Morgenstern
1ae75f22be Better indication of cached-updating functions for civinfo 2023-01-18 13:35:01 +02:00
Yair Morgenstern
68daac5660 Advanced game options hidden by default for faster initial game
Better alignment on new game screen for options and mods
2023-01-17 22:30:24 +02:00
Yair Morgenstern
0ada7c476e Fixed broken test, faster local tests 2023-01-17 21:49:12 +02:00
Yair Morgenstern
879a5b230f Resolved #8387 - Fixed Reliquary belief
Got rid of multiple uniques with the same text
2023-01-16 13:05:11 +02:00
Yair Morgenstern
864145acbb Differentiated attackable from visible tiles per Civ V 2023-01-15 11:19:32 +02:00
Yair Morgenstern
31acb7e469 Tiles 1 step out of bounds of visibility are visible if they're higher than current tile 2023-01-15 11:05:19 +02:00
Yair Morgenstern
d1a9caaa88 New tile visibility framework! 2023-01-15 10:54:41 +02:00
Yair Morgenstern
924dbf70d0 Added framework for tile visibility testing 2023-01-15 08:05:43 +02:00
Yair Morgenstern
6964c66d73 Fixed tests 2023-01-09 08:56:39 +02:00
itanasi
f244c36b57
Update all improvement and road writes to use TileInfo setters (#8136) 2022-12-15 07:18:47 +02:00
Yair Morgenstern
545b4afc5a Generalized "Stats per policies" unique 2022-11-26 21:39:26 +02:00
Yair Morgenstern
2e5e221158 CityStateType overhaul!!!! 2022-11-21 20:30:52 +02:00
Yair Morgenstern
7d9db1e119 CityStateType deprecation p1 2022-11-21 20:03:05 +02:00
Yair Morgenstern
8530de7de1 Can now use [stats] unique to add happiness globally 2022-11-21 11:33:29 +02:00
Yair Morgenstern
0cf5c33475 Can now use [stats] unique for e.g. techs, policies, etc, to add gold/faith/culture/science to the global pool 2022-11-21 11:21:42 +02:00
Yair Morgenstern
61b98120a8 Fixed tests failing due to removing "crutches" 2022-11-20 00:24:59 +02:00
Leonard Günther
4522ab4c6b
Added "How to create a UI skin for Unciv" to wiki (#7976)
* Replaced all occurrences of deprecated NinePatch

function calls

This makes a lot of UI elements already moddable but documentation is still missing

* Added "How to create a UI skin for Unciv" to wiki

* Added image

* Fixed two typos and updated directory image

Old image was missing a folder
2022-11-06 22:53:55 +02:00
Yair Morgenstern
f0ad7581bc Resolved crash when mods make 2 techs require each other 2022-10-13 22:55:12 +03:00
Xander Lenstra
35eb71c937
Removes the option for disabling religion (#7606)
* Removes the option for disabling religion

* Deprecated religionEnabled variable, set default to `true` and removed in cases where it shouldn't have effect
2022-08-05 11:46:06 -04:00
OptimizedForDensity
53d18095ee
Add unit test for unique translation template keys (#7557) 2022-07-30 10:32:40 +03:00
Yair Morgenstern
8574ad4624
Save all tile terrains and terrain uniques in transients, for better performance (#7490)
* Save all tile terrains and terrain uniques in transients, for better performance
Also minor changes in other places for performance reasons

* CR changes + test fix
2022-07-20 16:38:42 +03:00
Xander Lenstra
160b51d578
Added more unit tests (#7448) 2022-07-14 10:27:06 +03:00
Timo T
83d5d1ab36
Add a simple GDX application to help with developing UI components (#7411)
* Add a simple GDX application to help with developing UI components

* Add UI development docs
2022-07-13 21:58:43 +03:00
Xander Lenstra
ae5a0221ed
Refactorings & three more unit tests for uniques (#7412) 2022-07-10 23:19:45 +02:00
Yair Morgenstern
3422e161ad Removed deprecated uniques 2022-07-08 15:48:33 +03:00
SomeTroglodyte
64ab79faf3
Moddable prettier Tutorials - Step 1 (#7326)
* Moddable prettier Tutorials - Step 1

* Moddable prettier Tutorials - TranslationFileWriter

* Moddable prettier Tutorials - Kdoc

* Moddable prettier Tutorials - UX for open options task
2022-07-01 09:36:11 +03:00
Timo T
57ed61af41
Save compatibility handling (#7255)
* Add serialization version to GameInfo

* Add handling of incompatible saves due to a dfiferent save version

* Fix compilation?

* Fix ios compilation

* Refactor: Make it clearer that GameInfo serialization version is only supposed to be incremented when it's guaranteed to cause issues & rename to compatibility version

* Update initial version

* Update initial version

* Fix merge mistake
2022-07-01 09:34:41 +03:00
Timo T
bc9a42e452
Save uncaught exception to file (#7247)
* Refactor: Rename GameSaver to UncivFiles

* Save last uncaught exception to file

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2022-06-25 22:30:27 +03:00
OptimizedForDensity
e69789a683
Allow modded harbor-type buildings to connect cities to capital (#7254) 2022-06-23 20:53:32 +02:00
Azzurite
18b91bba1e Change all translation test output checking for translator's errors back to println 2022-06-20 14:27:52 +02:00
OptimizedForDensity
c922f134e6
Moddable game speeds (#6856)
* Move GameSpeed definition to JSON files

* Add game speeds civilopedia page
2022-06-18 23:27:46 +02:00
SomeTroglodyte
e2b7891248
Two new Unit Tests (#7001)
* MapGenerator fixes

* MainMenu Background Map scaled to Screen

* Easter Eggs - Code only

* Easter Eggs - Graphics
2022-06-16 21:07:30 +03:00
alexban011
564f7b476c
small fixes (#7181)
* fixes

* relaced translations with _

* better displayCutout
2022-06-16 18:56:18 +03:00
Timo T
a5f9623dbe
Fix OutOfMemory error when loading game state after already having a game loaded (#7145)
* Fix OutOfMemory error when loading game state after already having a game loaded

* Fix screen resize not being handled correctly

* Add withContext shortcut functions

* Add more logging

* Fix multiplayer games sometimes being loaded twice

* Make the loading screen nicer

* Make the loading screen hide previous popups for making the screenshot

* Don't do custom rendering & dispose the texture

Sometimes it makes sense to understand the library you're using...

* Fix missing GL context

* Refactor: increase readability of loadGame function
2022-06-14 21:09:09 +03:00