Commit Graph

365 Commits

Author SHA1 Message Date
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
Timo T
b6a98e5540
Fix EventBus not being able to listen to events with more than one level of inheritance (#7009) 2022-06-14 21:08:43 +03:00
Yair Morgenstern
120c41dd15 Revert "Moddable prettier Tutorials - Step 1 (#7064)"
This reverts commit e91c0ff212.
2022-06-06 09:59:21 +03:00
SomeTroglodyte
e91c0ff212
Moddable prettier Tutorials - Step 1 (#7064) 2022-06-06 09:32:23 +03:00
Jack Rainy
862f368075
Bugfixes to the units' teleportation (#7071)
* Allow to pass other units when teleporting

* Teleport to the closest city tile

* Additional unit tests
2022-06-05 23:17:59 +03:00
Timo T
868e551ba9
Fix test logging not using format specifiers for arbitrary text (#7073) 2022-06-05 16:57:16 +02:00
OptimizedForDensity
12674ed69e
Fix aircraft disappearing when their carrier is teleported (#7035)
* Fix carrier teleporting without moving airplanes

* Unit test to ensure aircraft and carriers are teleported togother

* Fix other cases where teleportation may occur

* Simplify unit test condition

* Update linting and move return condition

* Allow override for teleporting transported units

* Make sure test catches if transported units get deleted

* Reviews
2022-06-01 22:28:11 +03:00
OptimizedForDensity
afce951724
Pillaging certain improvements may loot gold or other stat resources (#6993)
* Pillaging loots gold on certain improvements

* Add warning if improvement pillageGold > 0 and has UniqueType.Unpillagable

* Pillage yields as a UniqueType

* Forgot to undo demonstration

* Remove unused line

* Eliminate some redundancy

* Reword unique text

* Slight cleanup and add notification for pillage victim

* Reviews

* Made pillaging notifications more consistent with other hostile action notifications

* Missed a line
2022-06-01 19:13:04 +02:00
OptimizedForDensity
09195d6b62
More UniqueType unit tests and correct some broken uniques in JSON files (#6965)
* Add ruin reward unique check plus fix broken unique
2022-05-29 16:08:15 +02:00
Timo T
214fae6f59
Add simple logging solution (#6952)
* Add simple logging solution

* Fix Android compilation

For some reason I stashed this and didn't unstash.

* Add better logging explanation
2022-05-27 13:45:13 +03:00
Timo T
ea03b97639
#6914 Multiplayer Status Display (#6916)
* Handle subclassing of Events properly

Previously, you could only listen to the exact class

* Add relevant parent classes for the multiplayer events

* Refactor: use the old name as the main name in MultiplayerGameNameChanged event

* Add being able to stop listening to events in the EventBus

* Add tests for EventBus

* Refactor: Extract GameList into standalone file

* Refactor: safeUpdateIf to more generic throttle function

* Refactor: Extract multiplayer UI helper functions into separate file

* Refactor: Extract load/download multiplayer game into logic class from UI

* Make loading a multiplayer game automatically update the in-memory game in OnlineMultiplayer

* Refactor: Extract multiplayer settings into separate object

* Add multiplayer status display

* Fix error with multiplayer games not correctly being cleaned up after successful update

* Prevent loadLatestMultiplayerState() while next turn update is running

* Show "Working..." while waiting for next turn calculations instead of "Waiting for [civ]..."

* Fix race condition while updating online game state
2022-05-25 22:22:58 +02:00
Timo T
fc9668f2d0
Refactor: change GameSaver from singleton to single instance pattern & move autosave logic into GameSaver (#6846)
* Refactor: change GameSaver from singleton to single instance pattern & move autosave logic info GameSaver

Singleton just doesn't make sense anymore when we have to `init(..)` with different arguments, then we should just make a normal class out of it

* Fix not correctly checking for missing external files dir

* Refactor: use more appropriate library method

* Add logging for external files dir
2022-05-22 19:51:35 +03:00
SomeTroglodyte
a2c646ef8e
Fix Autocracy Complete including unit test (#6908) 2022-05-22 19:51:05 +03:00
Xander Lenstra
3754108391
Added more unit tests for uniques; added missing unique implementations (#6886)
* Added more unit tests for uniques; added missing implementations

* This of course shouldn't go here as there is another function for it

* Stylistic changes

* This generates better unique examples

* Reviews

* Reordered for efficiency

* Reverted improvement percentage bonuses applying to tiles
2022-05-22 13:12:10 +03:00
SomeTroglodyte
3e95e3f152
Fix effect of new Beliefs not immediately visible in top bar (#6888)
* Fix effect of new Beliefs not immediately visible in top bar

* Fix effect of new Beliefs not immediately visible - reviews
2022-05-21 21:37:06 +03:00
Yair Morgenstern
1f3890e2a0 welp these tests kind of existed before 2022-05-19 19:02:57 +03:00
Yair Morgenstern
1126a7c996 Added test that improvements can be built on their tiles 2022-05-19 14:27:01 +03:00
Timo T
5353f3337c
Fix Gdx.files being garbage collected in MultiplayerTurnCheckWorker (#6817)
* Add logging to MultiplayerTurnCheckWorker

* Fix NullPointerException in turn check worker: Gdx.files is null
2022-05-18 07:35:00 +03:00
Xander Lenstra
7b3a4c741f
Added more unit tests for uniques (#6841) 2022-05-17 15:42:27 +02:00
Jack Rainy
ab82328211
Missing typed uniques for the units - part 2 (#6749)
* Replacements for existing UniqueTypes

* More typed uniques are added

* Migration to the typed uniques

* Minor optimization

* More general approach on UniqueType usage

* Better wording for the UniqueType
2022-05-13 12:34:10 +03:00
Xander Lenstra
8fcfbf752b
Improved clarity and moddability of building improvements (#6712)
* Renamed tile.hasUnique, deprecated `Indestructable`, unique for citadels
Also refactored the consumption of (great) people out of UnitActions.

* Reworked when improvements can be build somewhere for more clarity

* Made resources improvable by multiple improvements; Offshore Platform

* Fix compatability

* WIP

* Fixed the tests, but better

* I suppose I might as well update this now that we're a version later
2022-05-11 00:35:21 +02:00
Timo T
86d5011da1
In-depth serialization improvement, fixes Barbarian Camps revealed by Honor not showing immediately in multiplayer
* Fix Barbarian Camp Spawned notification not revealing the camp on the map in multiplayer

* Fix lastSeenImprovement not being cloned

* Use HashMapVector2 in BarbarianManager

* Fix value not having its class written out for proper deserializing

* Refactor: various code improvements
2022-05-08 12:35:41 +02:00
Jack Rainy
569b51cb27
Missing uniques are added (#6721) 2022-05-08 11:23:55 +02:00
Jack Rainy
13eb49f55c
Allow trade routes via city-states (#6696)
* Allow trade routes via city-states

* One more unit test is added

* Minor refactoring
2022-05-06 10:06:22 +03:00
Jack Rainy
3b4881ffdd
Reviewed version of the unit's teleportation (#6698)
* Unit tests for the teleports

* Ensure that unit may technically reach the teleport tile

* Capture the civilian units being teleported on them
2022-05-06 10:05:57 +03:00
Timo T
cf6543bc29
Fix Sweden not being able to gift great people to city states (#6690) 2022-05-05 09:09:15 +03:00
Jack Rainy
5d1a09b214
Allow city connections via open borders and own harbors only (#6656)
* Simplified tileFilter predicate

* Use only own harbors

* Allow city connections via open borders only

* Basic unit tests

* Advanced unit tests

* The maps and the legend for the tests

* CR changes: barbarians will not let the trades happen

* CR changes: get rid of question signs, "let" "Elvis" pass away
2022-05-03 08:10:29 +03:00
Yair Morgenstern
702f477e49
Added placeholder parameter location in a way that enables nested translations (#6632)
* Added placeholder parameter location in a way that enables nested translations - see #6474

* Simplified
2022-04-28 13:32:55 +02:00
SomeTroglodyte
2e53656e59
Unit test for Fresh water filter (#6246)
* Unit test for Fresh water filter

* Fix map for fresh water tests - no rivers on map edges
2022-03-10 19:46:28 +02:00
itanasi
20f34eb5f5
Block Embarked from capturing Civilians on Water (#6224)
* Correct logic for blocking Naval Melee from capturing Civilians on Land

* Even better solution now that we can move on to unguarded Civilian tiles. But still won't let us capture Civilians if we can't get there

* Make Embarked unable to capture Civilians

* Embarked can't capture Water Civilians

* Fix Gradle Test

* Better unit test without making variable not internal

* attempt not working

* Just make currentTile not internal

* remove debug

* erronious import

Co-authored-by: itanasi <spellman23@gmail.com>
2022-03-05 20:06:06 +02:00
Yair Morgenstern
4ad9d58850 Some of the last remaining simple uniques, from now on it's more complicated ones 2022-02-22 16:38:52 +02:00
Yair Morgenstern
13af71e427
Autoupdates to uniques will multiple solutions now replace to the correct one (#6208)
* Autoupdates to uniques will multiple solutions now replace to the correct one

Problem - some deprecated uniques can lead to multiple possibilities of replacements, depending on the parameter type
This lead to replacements in the jsons that were either unparseable entirely or were causing errors, both of which needed to be corrected by hand
We now separate such deprecations into their constituent potential replacement uniques, and try and take only the unique that doesn't cause any errors
Works like a charmander :)

* Conditional name change

* Resolved #6179 - when changing units production due to deprecation, notification no longer counts the same city multiple times if it appears multiple times in its queue
2022-02-22 11:33:07 +02:00
Yair Morgenstern
ca5f48ad61
Terrainfeature objects transient (#6199)
* terrainFeatures is only set through the setTerrainFeatures function

* Use cached terrainFeatures for performance

* Fixed map editor error due to not setting tileinfo ruleset
Added private set to terrainfeatureobjects
2022-02-22 11:28:24 +02:00
Yair Morgenstern
970e535e62 3.19.10 2022-02-19 19:57:23 +02:00
Yair Morgenstern
6d48f99206
Trigger uniques by sacrificing units with conditional (#6157)
* Triggered uniques currently come from researching techs, adopting policies, and building buildings.
This adds a third way of triggering uniques, by attaching them to units with a "by consuming this unit" conditional, which will be added as a possible unit action.
So for example, "[amount] Free Technologies <by consuming this unit>", "Reveals the entire map <by consuming this unit>" etc.

* Added a new uniquetype for triggerable uniques, to make them separate from regular global uniques, so that triggerable uniques can become unit uniques when necessary

* And added translations so the tests will pass
2022-02-19 19:38:39 +02:00
Yair Morgenstern
22466a9d45
Make tileInfo.terrainFeatures immutable (#6180)
* Step 1 of saving terrain features as a transient - move all terrainFeature changes to new 'addTerrainFeature' and 'removeTerrainFeature' functions
This also included slight rewriting of functions for clarity, but NO functional changes.
Even though there's some logic that I would definitely change, this PR isn't the place for that.

* Fixed tests
2022-02-19 19:28:05 +02:00
Yair Morgenstern
97d74a3aef Enabled type check checking for uniques whose deprecation leads to multiple uniques!
This also enables auto-deprecating the Embark+Ocean unique
2022-02-15 11:29:32 +02:00
Yair Morgenstern
3bbfb0100c Finishing off #6133 - autoreplace cycles through deprecation replacements until it reaches a non-deprecated text
This is guaranteed to not cycle endlessly thanks to the added test
Checked by having 2 uniques' deprecation text reference each other and it failed as expected
2022-02-12 20:03:24 +02:00
Yair Morgenstern
e72dcc8b0d
Unified "X is only available under Y conditions" into a single unique (#6133)
* Unified "X is only available under Y conditions" into a single unique

There were a few problems with existing uniques - they weren't really composable, the offered things they didn't keep, etc

For example, "Incompatible with [policy/tech/promotion]", UniqueTarget.Policy, UniqueTarget.Tech, UniqueTarget.Promotion. In fact, promotions only checked promotion incompatibility, promotions - promotion incompat, etc

Additionally, with a few more changes, this could cover several other uniques - "Hidden until [amount] social policy branches have been completed", "Requires at least [amount] population", perhaps others

I have to say I think conditionals are the best thing ever and they make amazing composability possible :)

* Autoupdate correctly recognizes parameters
Updated ruleset jsons

* Deprecation texts should be allowed to forward to other deprecated uniques so we only need to change the leaves when introducing new uniques, not go through the whole tree
2022-02-12 19:03:30 +02:00
Yair Morgenstern
f217ce7055 Added check for deprecated uniques referencing other deprecated uniques (can happen if we replace uniques in quick succession and we forget to modify the older deprecated unique when we introduce the new one) 2022-02-02 11:25:35 +02:00
Yair Morgenstern
483a8eab1a Added test to ensure that deprecation texts are accurate to existing uniquetypes and conditionals
Tested that this does indeed break if you add a random space :)
2022-02-02 11:21:02 +02:00
Yair Morgenstern
b121563b99
Converted TileInfo.isCityCenter to use a transient var (#6058) 2022-01-27 00:57:38 -08:00
Xander Lenstra
f6cb2bd0d7
Made unhappiness effects moddable by adding a global uniques json; added revolts when < -20 happiness (#5932)
* Added a json file for unhappiness effects

* Change existing code to handle these effects

* Made a weird and unexpendable way to add unhappiness effects to the civilopedia

* Add the default unhappinesseffects to mods without the json

* Added revolts when at very low happiness

* Renamed a few often-used functions

* Added a file for uniques that are always active

* Fixed tests

* Nullifies [Food] -> Nullifies Growth
2022-01-24 17:19:51 +00:00
itanasi
1fd65b9ffa
Ranged capture (#5975)
* Initial attempt

* Allow Ranged to move into unguarded Civilian Unit

* Comment for clarity

* Fix unit test so that it doesn't segfault and checks you can't move into military units

* Unify that all units can move on to (and through) unguarded civilians that you are at war with
Add TileInfo.getUnguardedCivilian() to quickly respond if there is an unguarded Civilian on the tile
Something is bugged in movement code

* Fix MapUnit.moveThroughTile() so that it doesn't segfault by fixing getUnguardedCivilian()

* captureCivilianUnit() call is now redundant in postBattleMoveToAttackedTile() since canMoveTo() will now return true and capture will happen during the moveToTile() call

Co-authored-by: temurakami <spellman23@gmail.com>
2022-01-24 12:28:46 +02:00
Xander Lenstra
6a8f88f202
Added a few more unit tests for global uniques (#6018) 2022-01-23 06:18:15 -08:00
Xander Lenstra
3e6a190ab4
Unit tests for uniques (#5945)
* Added a unit test file for uniques

* Added a few tests
2022-01-10 22:01:14 +02:00
yairm210
1999364b9e Chore - more typified unit uniques 2022-01-10 21:53:13 +02:00
Xander Lenstra
687ecb83f1
Merged some uniques and added a new one for not allowing to build units (#5731)
* Print stacktraces in more cases when crashing, useful for debugging

* Conditionalized no oceans before astronomy unique

* Cannot be built on tile before tech conditionalized

* Added "Cannot build unitFilter units" unique

* Fixed tests failing

* Merge branch master into some-uniques

* Fixed typo

* Apparently I made the same mistake twice

* Globalized unique
2021-12-31 12:13:09 +02:00
Xander Lenstra
003f2434c1
Differentiating Vanilla & G&K (#5654)
* Fixed tests checking for mod correctness

* Update G&K jsons to current vanilla versions

* First pass over buildings & beliefs

* First pass over nations

* First pass over eras.json

* Fully updated tech tree

* First pass over units

* Second pass over buildings -- fixed techs

* Fixed last prerequisites and row numbers of tech

* Went through the entire tech tree and moved things to their correct spot

* Fixed tests
2021-11-09 06:23:30 +02:00
SomeTroglodyte
6cc55dd1a9
Since TileInfo.tileResource is no lazy, a single test tile cannot change its resource around (#5522) 2021-10-20 16:38:15 +03:00
SomeTroglodyte
d25adacec7
Minimum city distance across continents (#5404) 2021-10-06 22:51:52 +03:00
SomeTroglodyte
726a1942db
Sharpen unit tests for UniqueTypes (and mod checker too) (#5398)
* Sharpen unit tests for UniqueTypes (and mod checker too)

* Sharpen unit tests for UniqueTypes - fix newly found problems
2021-10-05 09:08:41 +03:00
SomeTroglodyte
2e72fd52c8
Double movement unique parameterized (#5319)
* Double movement unique parameterized

* Double movement unique - all filters
2021-09-27 12:35:38 +03:00
Xander Lenstra
b7467d3467
Added support for conditionals to some more uniques (#5280)
* Added support for conditionals to some more uniques

* Implemented a new conditional

* Added the new conditional to the translations file

* Fixed tests

* Implemented requested changes
2021-09-22 09:24:16 +03:00
Xander Lenstra
f47f427b05
Adds conditionals to most of the uniques currently in the enum (#5270)
* Moved uniques to their own folder

* Added support for conditionals to most of the uniques in the current enum

* Deprecation > removal, of course

* Fixed tests & added `.removeConditionals` before checking for placeholders
2021-09-19 18:43:32 +03:00
Xander Lenstra
01bfd17594
Implementation of conditionals, but better than before (#5187)
* Implementation of conditionals, but better than before

* Updated the unique while I was at it

* Fixed bug where conditionals would never apply

* Capitalization

* Minor code cleaning

* Better documentation & variable names

* Changed translation strategy

* Added missing import?
2021-09-18 23:07:53 +03:00
Xander Lenstra
3722fab38d
From the indstrial era onwards, things change in religion (#5095)
* Improved redability

* From the industrial era onwards, religion goes into 'second phase'

* Fixed tests

* Fixed formula for buying great prophets starting from the industrial era

* Added `getMatchingUniques`, `hasUnique` to `IHasUniques`, cleaned up some code

* Fix compilation errors
2021-09-08 21:24:26 +03:00
Xander Lenstra
d1135f3d20
Fixes incorrect default paramter for starting era (#5119) 2021-09-08 20:44:50 +03:00
SomeTroglodyte
69e2828a0e
SerializationTests restore settings file (#5110) 2021-09-06 18:32:34 +03:00
Xander Lenstra
486e2a7a8a
Deprecate all mods without an eras.json file (#4809)
* Enforce the existence of an eras.json file for mods

* Merged `getEra()` and `getEraObject()`

* Hide mods we have deemed outdated

* Fixed compile errors that I didn't notice before

* Fixed unit tests
2021-09-06 14:50:38 +03:00
Xander Lenstra
9575b5bf66
Implemented renaming of religions (#5057)
* Implemented renaming of religions

* Made AskForText display error on invalid input, implemented recommended changes

* Almost forgot the translatable strings in the new popup
2021-09-02 17:40:10 +03:00
SomeTroglodyte
3b5489a3b4
Persistent new game setup (#5016)
* Persistent new game setup

* Persistent new game setup - comments
2021-08-29 20:40:13 +03:00
SomeTroglodyte
9df58ed240
Stats rework part 2 (#4983)
- Nicer iterators
- Callers adapted to simpler syntax
- CityStats changed to non-serializable
2021-08-25 19:02:42 +03:00
yairm210
5779bdaa4f Upgraded mockito versions.
Instead of forcing reflection to depend on latest kotlin version, I have a feeling the dependency is due to older mockito depending on older reflection.
2021-08-20 15:45:46 +03:00
yairm210
85ed8a27d3 Bumped sourceCompatibility to Java 7
Released in 2011 and by now technically out of support for 2 years.
Gotta roll with the times, but roll slowly.
2021-08-20 15:24:02 +03:00
SomeTroglodyte
076128a37e
Unit test catching un-annotated lazies (#4886) 2021-08-17 13:52:41 +03:00
SomeTroglodyte
8fdff9a940
Stats optimization (#4830)
* Stats rework part 1

* Stats rework part 1 -patch1

* Stats rework part 1 - documentation
2021-08-15 20:52:55 +03:00
SomeTroglodyte
ee32392ecd
Bring allUnitActionsHaveTranslation test up to date (#4688)
* Bring `allUnitActionsHaveTranslation` test up to date

* Bring allUnitActionsHaveTranslation test up to date - revert enum prop
2021-08-06 14:38:10 +03:00
SomeTroglodyte
9499471986
Change defeat conditions (#4761)
* Change defeat conditions

* Change defeat conditions - unit tests setup

* Change defeat conditions - patch1
2021-08-05 18:12:30 +03:00
Xander Lenstra
3b4b9a27bf
Split up unit types to its own JSON file (#4717)
* Split off unitTypes to its own json, only containing the domain it can travel in for now

* Updated translationFileWriter to handle this file correctly

* Updated promotions file

* Implemented requested changes

* Units without a sprite use the sprite of a first unit with the same type

* Implemented proposed changes
2021-08-03 19:06:59 +03:00
SomeTroglodyte
aa3be63492
Fix canImprovementBeBuiltHere regression (#4623) 2021-07-24 21:45:51 +03:00
SomeTroglodyte
6791dd3340
Deprecate "Can only be built on coastal tiles" unique (#4581)
* Deprecate "Can only be built on Coastal tiles"

* Deprecate "Cannot be built on bonus resource"

* Deprecate "Can only be built on Coastal tiles" - bump 'as of'
2021-07-23 13:19:35 +03:00
Xander Lenstra
253e62de72
City states give gold when met; updates to city state gold gifts (#4435)
* City States now give gold when met

* City States can now receive different amounts of gold, and the amount of influence gained from gifts follows the base game

* Implemented requested changes

* Fixed tests
2021-07-10 21:51:11 +03:00
Yair Morgenstern
20db11e73f Added a test to ensure that translations don't crash 2021-06-27 22:16:15 +03:00
SomeTroglodyte
21aa371cc3
Re-show redundant tech prereq mod errors without impeding playability (#4046)
* Re-show redundant tech prereq mod errors without impeding playability

* Re-enable playability of mods with less severe errors - fun version
2021-06-08 06:44:25 +03:00
Yair Morgenstern
3a22a1127e Gradle upgrade 2021-05-07 13:18:48 +03:00
Yair Morgenstern
738bc6caac Fixed tests 2021-05-05 18:45:48 +03:00
GGGuenni
b35d5d3121
changed hill to terrain Feature (#3707)
* changed hill to terrain Feature

* Update Terrains.json

* Update Terrains.json

* Snow with capital S

* Fixed tests failing

* Added check for ruleset supports hill as terrain feature
2021-05-05 17:48:47 +03:00
GGGuenni
b12c5df28e
last refactoring of terrain feature (#3702)
* last terrainFeature refactorings

* cut down terrainFeature as much as possible

* aerialDistanceTo fixed

wrapped distance should only be considered on wrapped worlds

* Adding spaces

* fixed tests not compiling

* prevent floodplains from spawning on oasis

* Check if terrain feature can be placed on tile in editor

* Adding reviewed changes
2021-03-18 13:54:52 +02:00
Yair Morgenstern
bcab751f7c Linting 2021-01-28 16:21:25 +02:00
Yair Morgenstern
43d9813ce1 3.12.2-patch1 2020-12-21 20:59:47 +02:00
Yair Morgenstern
c1a717e4f8 Resolved #3289 - can place unbuildable improvements that can exist on tiles 2020-12-09 22:46:15 +02:00
Yair Morgenstern
f57955c8d5 Added a test to make sure that the base ruleset doesn't have any obvious bugs, so I don't shoot myself in the foot again 2020-12-08 21:34:00 +02:00
Yair Morgenstern
65524cb7dd Removed exitEvent from the UncivGameParameters, since Gdx.app.exit() does the same thing :) 2020-11-04 00:09:11 +02:00
Jack Rainy
296da5b205
Unit tests for the TileMap.getViewableTiles() (#3222) 2020-10-04 10:54:48 +03:00
Yair Morgenstern
12040c4920 Travis + Butler test 2020-09-03 20:56:41 +03:00
Yair Morgenstern
f9f0b93d4e "Make travis output test output" take 2 2020-09-03 17:33:56 +03:00
Yair Morgenstern
6de4300cb8 Testing how the test errors are displayed in Travis 2020-09-03 14:03:17 +03:00
Yair Morgenstern
2c66b53b27 Fixed tests 2020-08-26 16:52:10 +03:00
Yair Morgenstern
36f5d22a80 Mod management screen takes its list of mods from the Github API! 2020-08-26 15:57:15 +03:00
Yair Morgenstern
4cf4381f51 Mod download works on Mobile as well! 2020-08-26 12:39:07 +03:00
Yair Morgenstern
247227bdaa Can now download mods from Github repos! :D 2020-08-25 22:00:38 +03:00
Yair Morgenstern
3fdcbeeef6 3.10.4 2020-08-25 17:17:25 +03:00
Yair Morgenstern
a253a97940 Added Unzip functionality - we should soon be ready for mod management from within the game! 2020-08-25 16:38:55 +03:00
Yair Morgenstern
40f93461fa With new translation lines 2020-08-23 21:27:31 +03:00
Yair Morgenstern
9ef7d8770d Added a new test that ensures no two placeholders are the same
Fixed double 'param' parameter in existing translations
2020-08-23 21:20:17 +03:00
Yair Morgenstern
41615909df Translation tests are fixed - translators beware 2020-08-16 22:01:55 +03:00
Yair Morgenstern
1937e3f3c9 3.10.0 2020-08-15 23:31:52 +03:00
Yair Morgenstern
4cd4d5d89f All kinds of crazy translation fixes 2020-08-15 23:20:18 +03:00
Yair Morgenstern
4797b0622b Fixed tile improvement tests 2020-08-07 18:05:04 +03:00
Yair Morgenstern
066dd615b4 Created stat parameter parsing and translation!
Genericified "[stats] from [terrain] tile" building unique
2020-07-24 17:47:55 +03:00
lishaoxia1985
59f6e10511
some bug fix (#2817)
* Scout won't be built when research "Scientific Theory". Fix the word "Can only build water units in coastal cities".

* Fix the bugs when you delete all maps close button disappears and you can't go to main menu.

* Basictests don't check that Scout can't upgrade.

* If the unit is obsolete it will remove from construction queue.
2020-07-16 22:22:47 +03:00
Alexander Korolyov
e74f7608d1
transfer simulateUntilWin from UncivGame to GameInfo class. (#2849)
* transfer simulateUntilWin from UncivGame to GameInfo class.

* update tests

* Update description comments
2020-07-16 13:52:39 +03:00
Alexander Korolyov
c51879cc5f
OptionsPopup with two experimental switches: Spectator mode, Extended Map editor. (#2834) 2020-07-12 12:59:32 +03:00
Alexander Korolyov
5356e63249
Refactor UncivGame initialization - add UncivGameParameters. (#2779) 2020-06-29 20:05:58 +03:00
Yair Morgenstern
79ff8c2ecf Fixed broken tests due to 'impassible' changes 2020-06-28 20:48:51 +03:00
Alexander Korolyov
4c7970f5d7
Slightly change mechanics of simulateUntilWin (#2772)
* Slightly change mechanics of simulateUntilWin

* Forgot to turn off some debugging switch
2020-06-25 22:32:00 +03:00
Daniel Bälz
5753115c30
Fix not translated notifications (#2715)
* Translate notification strings before they are shown. Fixes #2703

* Respect translations from active mods for placeholder translations

* Revert translation call to avoid issues in multiplayer. Still works without it.
2020-06-24 23:58:16 +03:00
Alexander Korolyov
c3da044c43
Adding units on map editor. (#2667)
* Adding units to map editor.

* loadScenario checkbox Prototype added to MapOptions table.

* adds switch for Scenario and Unit editor debug

* New Scenario class

* Background step1:
1. Create a new class Scenario, containing TileMap, GameParameters and string name (doesn't really matter where, we can move it around later)
2. Create SaveScenario and LoadScenario functions in MapSaver (save to/ load from scenario name)

* Prototype of Save/Load scenario implementation.

* Add update method to NewGameOptionsTable

* First working Save/Load scenario prototype

* First working prototype of Load/Save scenario

* Added test conditions for the new debug modes

* Resolve merge conflict

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2020-06-13 22:53:04 +03:00
Daniel Bälz
47d7e8ef09
Gradle Kotlin DSL (#2634)
* Ease migration to Gradle Kotlin DSL by changing quotes, function calls and plugin definitions

* Migrate build scripts to Gradle Kotlin DSL
2020-05-19 00:14:01 +03:00
SomeTroglodyte
4ff1e96892
Make tr() a little faster (#2538)
* Make tr() a little faster

* Make tr() a little faster - more consistent whitespace

* Make tr() a little faster - fix translation file generator

* Make tr() a little faster - adapted unit tests
2020-04-29 19:02:48 +03:00
Yair Morgenstern
745d48c2ae Can now permanently disable barbarians in mods 2020-04-18 23:59:26 +03:00
Jack Rainy
bd5c8130d9
Speedup of canPassThrough() method (#2394)
* Unit tests for "canPathThrough"

* Refactoring of canEnterTiles() and isAtWarWith()

* Do not check isEmpty() twice

* Using of the cached MapUnit uniques
2020-04-13 10:46:28 +03:00
Jack Rainy
29a077a803
Forts and citadels (with AI) (#2325)
* Enabled Forts & Citadels

* Friendly territory checks

* Citadel damage & notifications

* Sprites, Icons, Translation & Atlas

* Obsolete tests are removed

* NullReferenceException code is fixed

* Refactoring: using the static object

* AI for the forts and citadels

* Display defence stats

* Exclude enemies tiles as candidates

Co-authored-by: r3versi <fluo392@gmail.com>
2020-04-03 11:22:27 +03:00
Jack Rainy
dde01738de
New wonders: Mausoleum of Halicarnassus, Statue of Zeus (#2301)
* New wonder: Mausoleum of Halicarnassus

* New wonder: Statue of Zeus

* Obsolete tests are removed
2020-04-01 20:12:25 +03:00
Yair Morgenstern
62e78dec1c 3.6.14 2020-03-30 22:54:40 +03:00
Yair Morgenstern
0387ce4ff6
Translations (#2273)
* Translations for unit ability withdraw before melee (#2255)

* update Chinese translation. (#2263)

* Update Czech.properties (#2262)

* Update Czech.properties

fixed typo, used better Iver88's translations lost due to conflict

* Update Czech.properties

correct "achaemenid" form

* Portuguese translations (#2271)

* Updated Portuguese translations

* Fixed typos and missing letters.

* Update Polish.properties (#2258)

* Update Polish.properties

* fix "x"

* hotfix v2

* Cities Translations

* Update Polish.properties

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

* Update Italian.properties (#2259)

* Translations (#2268)

* Translations

* Withdraw translations

* Translation file generation moved to game options,, so game modders can generate files in-game and not need to build Unciv from scratch

* Translation updates

Co-authored-by: proteus-anguinus <github2015@rheinig.de>
Co-authored-by: lishaoxia1985 <49801619+lishaoxia1985@users.noreply.github.com>
Co-authored-by: stoupa007 <60326342+stoupa007@users.noreply.github.com>
Co-authored-by: W Gomes <42829628+w-gomes@users.noreply.github.com>
Co-authored-by: RadioMagnetofonStereofoniczny <remixionmix@gmail.com>
Co-authored-by: Giuseppe D'Addio <41149920+Smashfanful@users.noreply.github.com>
Co-authored-by: Jack Rainy <JackRainy@users.noreply.github.com>
2020-03-28 22:32:32 +03:00
Yair Morgenstern
882ca6f22b Removed translation tests that are no longer necessary - 'check' passes successfully
'Wander' now gets its own distance to tiles, solving a really niche bug
2020-03-28 21:29:52 +03:00
Yair Morgenstern
136dac3582 Fixed Polish translations
Removed unnecessary (and breaking) unit unique translation tests
2020-03-26 11:09:00 +02:00
Jack Rainy
d7ac7f9173
Translation refactoring - part 3 (all JSONs) (#2205)
* Refactoring: Split reading and writing of translation files

* New generator of translation strings from JSONs

* Switch to the new strings generation approach

* Using the regex for similar strings + bugfix for Submarines

* Transfer of the existing translations

* Clean up of the template file and translated files based on it

* Unit tests are updated

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2020-03-21 20:32:04 +02:00
wrov
e308f1fe0c
Added logic to check Player- and Game-IDs according to new layout. (#2108)
Backwards compatible to old format.
2020-03-18 22:55:57 +02:00
Jack Rainy
dd438f16c8
Translation refactoring - part 2 (Tutorials) (#2114)
* Make TranslationFileReader as object class

* Generate strings from Tutorials.json

* Simplified storage and loading of the tutorials

* Transfer existing translations
2020-03-12 16:38:57 +02:00
Jack Rainy
15098d877c
Translations refactoring (#2096)
* Rename "translationsByLanguage" folder

* Minor refactoring

* Generate Nations strings

* Use the nations strings while creating the translation files

* Clean up of Nations files

* Transfer existing translations

* Get rid of the nation's translated name

* Transfer just few nations' translations for languages without Nations_Language.json

* Clean up of not used greetings

* Correct marking of not translated strings
2020-03-10 10:17:05 +02:00
JackRainy
241ce8b4f6
Make the test actually works (#2043)
* Make the test actually works

* Fix of Nations_German.json file
2020-02-29 20:10:55 +02:00
JackRainy
7a96a96d73
Unit tests for TileInfo (#1959) 2020-02-18 00:03:59 +02:00
Yair Morgenstern
4004c6ff76
Translation (#1951)
* Update Polish.properties (#1931)

* Update Russian.properties (#1932)

* Update Italian.properties (#1933)

Also added Research Agreement

* Update Japanese.properties (#1942)

* Update Japanese.properties

* Update Japanese.properties

* Update Japanese.properties

* Translations update (#1943)

* Translations update

* Render some missing characters in the Ukrainian translations

* More translations

* Fixed typo: Otto von Bismark -> Otto von Bismarck (#1954)

* Translation updates, added test to assure that translations in template file end with a space

* Disabled Maven - hopefully Travis check will not take 10 minutes and will pass

Co-authored-by: Freshy <60152907+GreenFreshy@users.noreply.github.com>
Co-authored-by: IraqLobster34 <56483230+IraqLobster34@users.noreply.github.com>
Co-authored-by: Smashfanful <41149920+Smashfanful@users.noreply.github.com>
Co-authored-by: paontv <57051667+paontv@users.noreply.github.com>
Co-authored-by: JackRainy <JackRainy@users.noreply.github.com>
Co-authored-by: schnippl0r <58435847+schnippl0r@users.noreply.github.com>
2020-02-17 19:38:14 +02:00
JackRainy
db5cc82ec7
"Sleep until healed" functionality (#1821)
* "Sleep until healed" functionality

* Unit test for actions translations is added

* "Fortify until healed" functionality

* Refactoring
2020-02-02 09:55:10 +02:00
lyrjie
58fa5d6dd5
Debug option: simulate game until certain turn (#1812) 2020-01-31 14:10:32 +02:00
Federico Luongo
f118be5d40 Adopted JSONC standard for assets files (#1674)
* Adopted JSONC standard for assets files

* Update Nations_Ukrainian.json

* Update Nations_Ukrainian.json

* Normalized Nations_Ukrainian too

Co-authored-by: Marerjh <40261003+Marerjh@users.noreply.github.com>
2020-01-13 19:01:27 +02:00
JackRainy
8a327fa7be Fix for the "Back button can't end Unciv (#1513)" (#1661)
* Callback to exit the game by 'Back' button

* Prompt dialog for the game exit

* Additional strings for translations are generated

* Do not show exit prompt dialog twice
2020-01-12 23:05:49 +02:00
lyrjie
5c6ae7c123 Added tests for development-only toggles (#1655)
* Added tests for development-only toggles

* Revert "Added tests for development-only toggles"

This reverts commit eee4de78

* Added the `rewriteTranslationFiles` check to debug test
2020-01-11 23:17:13 +02:00
Yair Morgenstern
c322a5da30 Fixed tests that I broke when changing ruleset logic 2020-01-05 23:00:03 +02:00
lyrjie
cedb6ff5e3 Added the notification for the third-party civilizations (#1558)
* Added the notification for the third-party civilizations

If a civilizations knows about some two civilizations, it will be notified when:
* They declare the war
* They make a peace
* They sign the declaration of peace
* One denounce the other

Additionally, when civ enters a new era, all civs that know about it get a notification

* Fixed the translation `.properties`

* Cleanup

* Fix: 2 notifications for each peace treaty

Russia and America...
America and Russia...

* Typo

* Code style changes

* Resolved conflicts

* Simple getCommonKnownCivs() tests
2019-12-30 18:12:14 +02:00
Vladimir Tanakov
1cc8227025 Fix civilopedia parsing, fix dialog does not call update to enable next turn button (#1553) 2019-12-30 18:04:12 +02:00
r3versi
aa034d73c2 Fix natural wonders (#1550)
* Natural Wonders Uniques

* Fix Natural Wonders in Map Editor

* Translation files

* Terrain uniques test

* GBR spawn update Fix #1552
2019-12-28 23:11:37 +02:00
Yair Morgenstern
87830bf8b2 Code cleanup - ruleset maps are now lowercased 2019-12-26 22:00:49 +02:00
lyrjie
539758b905 Translation placeholder testing (#1542)
* Added translation string placeholders test

* Fixed the placeholder typos in all translations

* [30] to 30 migration
2019-12-26 14:39:15 +02:00
Yair Morgenstern
fd8528af7a All tests are properly Koltinized! 2019-12-26 12:01:23 +02:00
Vladimir Tanakov
7f06ae0cce Refactor Tutorials and fix some issues, write tests (#1524) 2019-12-26 11:40:48 +02:00