Commit Graph

4419 Commits

Author SHA1 Message Date
Yair Morgenstern
0ac2c932f6 Added ruleset warnings for empty ally and friend bonuses
We currently use the defaults, but we should phase that out
2022-02-01 14:51:54 +02:00
Yair Morgenstern
8c4bc2927c Code cleanup 2022-02-01 12:36:08 +02:00
Yair Morgenstern
3c2dda3ad4 Use empty lists and maps for objects with no uniques for less memory consumption 2022-02-01 12:26:53 +02:00
Yair Morgenstern
3908fbc9cf
Fixed memory- and time-intensive unit maintenance checks (#6092)
Get all civwide unit discount uniques once, and then filter them by-conditional only when checking each specific unit.
This saves a LOT of memory allocation and time.
A result of the investigation at #5919.
2022-02-01 12:14:46 +02:00
Yair Morgenstern
0a336b3d99
Summarized civ resources, which were getting accessed all the time, are now cached and updated together with the detailed civ resources. (#6093) 2022-02-01 12:14:37 +02:00
Yair Morgenstern
cf6dacdcbe Only update CIV viewable tiles if the UNIT'S viewable tiles actually changed!
This will save SO much time and memory!
2022-02-01 11:28:26 +02:00
Yair Morgenstern
c3d185cce8 Deprecated old uniques 2022-02-01 10:03:47 +02:00
Xander Lenstra
6bc41a627c
Typed all healing uniques (#6087)
* Typed all healing uniques

* Fixed tests by replacing placeholder texts by types in BeliefAutomation
2022-02-01 09:43:37 +02:00
Xander Lenstra
0951e5d6fd
Fixed a bug where unit discounts would not work (#6081) 2022-02-01 09:43:25 +02:00
Yair Morgenstern
f6e22f60bf
Replace old uniques with *parameter-filled* new uniques! (#6077)
* Since we have the old unique typed, and the new replacement unique typed, we can show modders EXACTLY the new unique they'll need to have!
The final step of this process is having a 'replace old uniques' button which will automagically replace old uniques in a mod with the new versions. This will of course require some manual intervention since it's possible we added some parameters that didn't exist in the old one, but should work well for 95%+ of uniques.

* Also allow "[-amount]" replacements
Better replacements - "[+amount]" etc - where relevant

* Fixed misadded + in unique
2022-02-01 09:42:52 +02:00
Yair Morgenstern
9674ddf04e
Caught more mod failure conditions, removed certain assumptions from map creation (#6076)
* Caught more mod failure conditions, removed certain assumptions from map creation

* Military unit in Era can be "Era Specific Unit"

* Resolved #6078 - even more ruleset assumptions removed :)

* We now catch missing military units from the difficulties as well, as well as missing settler and worker units from eras
2022-02-01 09:42:25 +02:00
Xander Lenstra
499b5e5b2f
Possibly fixed a crash accessing gameInfo before it is initialized (#6062)
* Possibly fixed a crash accessing gameInfo before it is initialized

* Inlined an otherwise unused variable

* Alternative version using an extra constructor instead of weird getters/setters
2022-02-01 09:41:57 +02:00
Yair Morgenstern
461385fff6
Current map generation is extremely dependant on specific terrains existing in the ruleset. (#6067)
* Current map generation is extremely dependant on specific terrains existing in the ruleset.
This attempts to eliminate those dependencies.
All changes indicate areas where a crash occured before the change.

I still encounter problems in generateRegions when trying to generate a map with no water tiles - @SimorCedar I think the splitRegion doesn't like the fact that there are land tiles on edges of the map?

* Split 'equal fertility' regions as close to the center as possible
Also, don't crash if no luxury resources are defined
2022-01-29 23:28:00 +02:00
Xander Lenstra
a237e7bf82
Typed all remaining uniques using CityInfo.GetMatchingUniques and removed that function (#6071)
* Typed all remaining uniques using CityInfo.GetMatchingUniques and removed that function

* Fixed two NullPtrExceptions

* Fixed syntax
2022-01-29 23:27:48 +02:00
Xander Lenstra
39483d78bd
Resources can now again provide uniques applying to the entire civ (#6072) 2022-01-29 18:37:53 +02:00
Xander Lenstra
599a09176d
Fixed a few rare mod-specific crashes (#6070) 2022-01-29 18:36:50 +02:00
itanasi
6a98d8dd70
Minor logic cleanup (#6066)
Co-authored-by: temurakami <spellman23@gmail.com>
2022-01-28 09:56:10 +01:00
Yair Morgenstern
957d5b4008
Converted era parameter to a transient var (#6063)
The cost of casting getEra() constantly is definitely non-trivial, and why do we even generate the era every time? It only changes when we add a new tech! So we can save it as a transient in the civInfo.tech and be done with it!
2022-01-27 05:44:33 -08:00
Yair Morgenstern
7c478f4cd3 Don't run expensive canBePurchasedWithStat if you aren't going to buy the unit!!!
Also sped up the actual 'finding matching units' part so it's pretty invisible from a performance standpoint :)
2022-01-27 14:59:38 +02:00
Yair Morgenstern
2130cf20e0 Another small improvement, speeds up chooseNextConstruction by about 40%, but this wouldn't really be an issue if tileInfo.hasUnique was fast since that's the main time clog... 2022-01-27 14:50:44 +02:00
Yair Morgenstern
1732d951d2 The O(n^2) is noticable in the flame graphs, I kid you not 2022-01-27 14:00:10 +02:00
Xander Lenstra
cd05fe6ac8
Fixed a crash (#6057) (#6061) 2022-01-27 13:33:18 +02:00
Yair Morgenstern
b121563b99
Converted TileInfo.isCityCenter to use a transient var (#6058) 2022-01-27 00:57:38 -08:00
Yair Morgenstern
fbec7c836e Performance boost for GameInfo.setTransients - speeds up loadGame and nextTurn 2022-01-27 00:28:41 +02:00
Yair Morgenstern
6a969b98f5 A few quick wins for performance 2022-01-26 23:49:21 +02:00
Xander Lenstra
47af1ff1c3
Removed a function that is no longer used and should not be used imo (#6055) 2022-01-26 22:46:36 +02:00
Yair Morgenstern
84ef8944d0
Stat bonus drilldown (#6053)
* Step 1 - converted stat bonus list to tree.
No visual difference yet, since the stat bonus list is still generated in the same way.

* Step 2 - updateStatPercentBonusList converted to tree form

* Step 3 - buildings converted to tree form - now user visible!

* Step 4 - Bonuses from uniques are now drilldownable

* Removed unneeded todo

* Welp, turns out I forgot to apply conditionals
2022-01-26 22:42:05 +02:00
will-ca
824efcb1a9
Try to fix potential typos in stock rulesets. (#6028)
* Make mod checker pass status message translatable.

* Try to fix some possibly broken Uniques.

Move comma.
2022-01-26 22:36:24 +02:00
Yair Morgenstern
dcb1be8e9b Welp, turns out I forgot to apply conditionals 2022-01-26 22:31:31 +02:00
Yair Morgenstern
a56874282b Converted RulesetObject unique checks to work against a map for efficiency 2022-01-26 21:10:46 +02:00
Yair Morgenstern
231963f050 Game can now handle improvements with no special stats from resources 2022-01-26 18:20:21 +02:00
Yair Morgenstern
b26d2fc6e7 Removed 'local city uniques' parameter that was being passed around
Due to changes since that was written, the cityInfo.getMatchingUniques has a default parameter of 'local uniques that are of the unique type', so not only was it making a mess, it was also inefficient!
2022-01-26 16:11:13 +02:00
Yair Morgenstern
c51e7a5e1e It's about time for showPixelUnits to be on by default, we have all the base game units set up nicely :) 2022-01-25 22:58:47 +02:00
will-ca
88ecbc26b2
Make sure units always have starting promotions. (#6051) 2022-01-25 21:51:35 +02:00
Xander Lenstra
6a5d44c3e9
Adressed comments on the happiness PR after it was merged (#6047) 2022-01-24 22:23:26 +00:00
Xander Lenstra
b69507255f
Fixed the problems with the food carry-over unique (#6040) 2022-01-24 19:52:35 +02: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
Xander Lenstra
40cd2ba24b
Fixed a missing percentage sign in uniques (#6036)
* Fixed a missing percentage sign in uniques

* Oh, it needs a city filter of course
2022-01-24 17:11:39 +02: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
Yair Morgenstern
a8dbd4784c
Converted stat list to stat tree (#6022)
* Converted stat list to stat tree - current changes do not affect UI at all, since we're still going by the shallow mapping that existed beforehand

* Display details of both buildings and uniques

* Unique stats now add correctly to building base stats, good thing we have tests :)

* Stat details are now click-to-expand, and calculate correctly :)

* Added small +/- button to show it's expandable
2022-01-24 11:04:12 +02:00
Xander Lenstra
39ed8bd269
Typed some uniques, added more examples for parameters in unique documentation (#6020)
* Typed some uniques, etc.

* Missed a few square braces

* Missed a parameter

* Missed another parameter

* Made a conditional, spelling, added check to `isStatRelated`

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2022-01-24 11:03:40 +02:00
will-ca
7a1341c822
Check rulesets for potential typos. (#6027)
* Add fuzzy text comparison algorithm.

* Add mod validity check for probable misspellings.

* Code comment for super-corner-case/impossible error.
2022-01-24 11:00:11 +02:00
will-ca
5c7832acf4
Clear mod action Table when deleting mods; Avoid crashy nulls. (#6026) 2022-01-23 21:43:40 +02:00
will-ca
f285abaa26
Fix uneven fonts, unify font sizes. (#6014)
* Fix uneven font sizes.

* Unify standard uses of font size parameter.
2022-01-23 17:14:27 +00:00
Yair Morgenstern
822f0603fb
Start bias includes neighboring tiles for better effect (#6019)
This also means we don't need a special coastal check, since it's caught by the regular check
IIRC there are nations in Original Civ that have 'mountain' start bias - if so this will also enable that :)
2022-01-23 17:09:52 +00:00
will-ca
8461032a52
Try to fix a potentially miscapitalized/broken policy cost unique. (#6016)
* Try to fix a potentially miscapitalized/broken policy cost unique.

* Deprecate old capitalization.
2022-01-23 18:08:59 +01:00
will-ca
da748a96f9
Miscellaneous linting, Unique typifying, refactoring, bugfix/consistency to avoid broken links to disabled religious UBs. (#6012)
* Remove unused Constants.

* Remove outdated comments.

* Typified "Will not be displayed in Civilopedia" Unique.

* Fix pre-existing inconsistency that would display religious UBs with broken links in the Civilopedia when religion was disabled.

* Use Sequences, and fewer function params, in Nations' Civilopedia texts.

* Accidentally hid a Unique that should be visible.

* Oops… Missed a negation.

* Unhide limitations on Religious Ruin rewards— But I'm not sure they'll be displayed anywhere even so.
2022-01-23 18:08:26 +01:00
Yair Morgenstern
2b7e279b4d 2-digit numbers no longer clip with the outwards circle.
This is really minor.
2022-01-23 19:07:08 +02:00
Yair Morgenstern
f7b99541a1 Tech order is displayed in a much nicer, more standardized, and overall much more professional way.
This is one of the small things that's been bugging me for a while
2022-01-23 19:04:23 +02:00
Xander Lenstra
6a8f88f202
Added a few more unit tests for global uniques (#6018) 2022-01-23 06:18:15 -08:00
Yair Morgenstern
f9c05997dd
Typified some building uniques (#6017)
* Typified some building uniques
I noticed that the code allows "[stats] from every [buildingFilter]" but the UniqueType was limited to "[stats] from every [buildingName]", so now that that's available we don't actually need the "[stats] from every Wonder" unique :)

* buildings-only unique moved to buildings section
2022-01-23 06:03:50 -08:00
will-ca
fe67dfa1c4
Make "Help" button clearer and translatable, random nation indicators and labels translatable. (#6013)
* Make unknown nation placeholder translatable.

* Make MultiplayerScreen help button clearer and translatable.

* Use `Constants.spectator` more.

* Make random/unknown nation icon translatable.
2022-01-23 09:39:28 +01:00
Yair Morgenstern
7e59e28f1c
Added button to update an installed mod from its action menu (#6005)
Much easier and more intuitive than clicking on it, then on the equivalent online mod, then 'download'
2022-01-22 20:35:19 +02:00
Yair Morgenstern
bebc2c7e21
Converted all stat percent uniques to be iterated on efficiently once! (#6004)
This also makes a specific unique which was previously 'nation-only' to be applicable generally
2022-01-22 20:34:05 +02:00
Yair Morgenstern
080fc245d8
Removed ALL hardcoded decisions in worker AI - we're now fully moddable! (#6003)
I tested this out with RekMOD, 150 simulated turns, to see if this was working.
Not only did I discover that workers were squatting on Antiquity Sites since they had resource improvements that they couldn't build, I also discovered something much worse.
Even after fixing that, most cities were woefully underimproved.
Turns out, the construction automation would limit worker construction to a measly *3 workers* even for a *10 city* civ!
After removing this limitation and making civs aim for a 1:1 ratio between cities and workers, everything started looking much, much better.
I'm not sure what the exact effect on the AI will be but I'm _sure_ that this leads to a major improvement. More improved tiles means more stats means more everything.
2022-01-22 16:47:39 +00:00
Xander Lenstra
feb9b19d11
Removed a probably unnecessary check in unit.mayPassThrough() (#6008) 2022-01-22 08:32:55 -08:00
Xander Lenstra
f4716689a3
Fixed a conversion error in "% city strength from defensive buildings" unique (#6007) 2022-01-22 18:22:35 +02:00
yairm210
06c8eca43c More simplification and readability through naming 2022-01-19 19:47:04 +02:00
yairm210
30b7e0f343 Separated data download and data handling for more readable download flow and less indentation 2022-01-19 19:33:12 +02:00
yairm210
7ea5a12079 Deprecation text, label and cell were never actually in use. 2022-01-19 19:21:46 +02:00
yairm210
ab0ff2e33e Made some of this stuff more readable
I came to the mod management screen to add a functionality to download the latest version of an installed mod by adding a 'download latest version' button to its action menu.
I did not expect the code to be this intractable. I've been reading and writing Kotlin daily for the past 5 years now, and even I struggle to understand what's going on here.
(also instead of adding button and counting duplicate entries just to remove them from both UI and count, just - don't add them to begin with)
2022-01-19 19:20:34 +02:00
yairm210
871dcfaf7d Deprecated old uniques 2022-01-19 14:42:09 +02:00
Yair Morgenstern
8df762a2dd
Iterate once through all uniques to find those relevant to sat percent bonuses, instead of per-type (#5999)
The same change we made in the move to getStatsFromUniquesBySource()
This should be faster, more generic, more accurate (buildings vs wonders), and catch all usecases (i.e. stat bonuses from uniques attached to *techs* or who knows what else
2022-01-19 14:16:51 +02:00
Yair Morgenstern
0279adadb9
Worker AI for mods, step 2 (#5998)
* Worker AI for mods, step 2

Support for removing terrain features, both when we need to get rid of them for a resource, and when they plain reduce the yield of a tile

Note that the "Remove <improvement>" was implemented WAY before templating and uniques were a thing - the correct solution in these enlightened times would be to separate the improvement *name* from the *effect*, so we could have e.g. a "Deforestation" improvement which would contain botth ["Removes [Jungle]", "Removes [Forest]"] or whatnot.

For now I Constant'D the "Remove " so we can at least follow where it's used.

* Reverted some of the auto-formatting so the PR is cleaner

* Caught 'nullify yields' unique for terrain removal
2022-01-19 14:16:33 +02:00
will-ca
19927d89ba
Use .toTextButton() in more places. (#5994)
* Use toTextButton for WorldScreenTopbar "Overview".

* Use toTextButton for AddMultiplayerGameScreen "Paste gameID from clipboard".

* Use toTextButton in MultiplayerScreen.

* Use toTextButton for CityOverviewTable city.name.
2022-01-19 14:16:21 +02:00
will-ca
b0ffae0da0
Refactor and unify some buttons that have a label next to an icon. (#5992)
* Take Actor instead of image String for String.toButton icon.

* Remove superfluous Group size wrapper.

* Builder-style configuration for string icon buttons.

* Add a function to the big unify picker screen option buttons.

* Unify unit action string icon button.

* Unify TabbedPager string icon buttons.

* Unify EmpireOverviewScreen string icon buttons.

* Unify CivilopediaScreen string icon buttons.

* Unify GreaterPersonPickerScreen string icon buttons.

* Unify PromotionPickerScreen string icon buttons.

* Unify ImprovementPickerScreen string icon buttons.

* Unify DiplomaticVotePickerScreen string icon buttons.

* Unify OffersListScroll string icon buttons. (Also moves icon to left.)

* Unify UnitOverviewTable string icon buttons.

* Turn IconTextButton into a class.

* Separate icon parameters.

* Remove outdated arg and comment.

* Remove obsolete generic.
2022-01-19 14:16:08 +02:00
Yair Morgenstern
8846c158fb
Resolved #5988 - Allow modded improvements (#5989)
Current worker automation assumes A LOT about the current ruleset.
This is only step 1, which allows skipping irrelevant improvements to reach actually useful improvements.
Comments welcome.
2022-01-18 01:58:43 +00:00
yairm210
b4214baf1f Smaller stars on the promotions, so they don't 'leak' outside the promotion image 2022-01-16 22:07:44 +02:00
yairm210
e074ed7546 Added civ icon to Battle Table when attacking cities 2022-01-16 21:09:43 +02:00
yairm210
dd90b2bacc NewGameScreen threading normalized.
The NewGameScreen was written by a past version of myself that had no idea how to handle threading, and thus was extremely strange. Checking an object _on render_ and if it's set then activate? Totally clueless.
2022-01-16 19:10:30 +02:00
will-ca
9b121a478a
Clean up refactored pixel unit resolving. (#5979) 2022-01-16 18:43:49 +02:00
will-ca
f68c41e369
Explain when cities can't be razed. (#5976)
* Explain when cities can't be razed.

* Light refactoring and reword.

* Add update notice in translation strings.
2022-01-16 18:43:33 +02:00
ravignir
b1517f0cde
Made attacked civilians lose 40 hp as in civ5. (#5978)
Is it the smallest commit ever? xD
2022-01-16 18:39:41 +02:00
will-ca
ec59533f82
Tint colour and not alpha in CityTileGroup. (#5969) 2022-01-16 03:03:23 +01:00
will-ca
b7d3a6c581
Fix a tiny and limited memory leak. (#5968) 2022-01-16 03:03:06 +01:00
yairm210
f8e9b6912e Merge remote-tracking branch 'origin/master' 2022-01-15 23:16:42 +02:00
yairm210
790bfc10b7 Resolved #5980 - "Cannot be built with" catches building equivalents as well 2022-01-15 23:16:28 +02:00
itanasi
9584389864
Capturing Civilians Not an Attack (#5974)
* Change to not count civilian attacks

* Change to not count civilian attacks

Co-authored-by: temurakami <spellman23@gmail.com>
2022-01-15 22:43:11 +02:00
yairm210
a2f5941927 chore - Minor improvements to science and culture tutorial capitalization 2022-01-15 22:09:33 +02:00
Xander Lenstra
2986052397
Typed all tech uniques (#5967) 2022-01-14 17:44:53 +00:00
yairm210
8311e65120 Victory types capitalized 2022-01-14 12:21:53 +02:00
yairm210
e7042d24ea City state permutations normalized to "City-State"
#5963
2022-01-14 12:16:16 +02:00
yairm210
4dcb45408d Unique deprecation 2022-01-14 11:00:38 +02:00
Yair Morgenstern
6e95a07572
More unit unique typing (#5952)
* There are so many of these my gosh

* Fixed, good thing we have tests :)

* Fixed
2022-01-14 10:43:13 +02:00
Yair Morgenstern
398e7903ef
Resolved #5930 - removed extraneous stat icons + resolved sorting problem they caused in Civilopedia tutorials. (#5959) 2022-01-14 10:11:45 +02:00
Xander Lenstra
7cb58eb82d
Typed all policy uniques (#5955)
* Typed all policy uniques

* Reworded golden age length
2022-01-14 10:11:30 +02:00
Yair Morgenstern
826b8f4826
Handling for multiplayer download errors (#5958) 2022-01-14 10:09:10 +02:00
Yair Morgenstern
4cce74253d
Abstracted file storage from the multiplayer data retrieval - this should allow implementations of both #5866 and #2679 for other implementations of IFileStorage (#5960) 2022-01-13 16:33:21 +00:00
Xander Lenstra
74d3854e45
Very likely fixed a bug that occasionally placed hills on top of mountains (#5946) 2022-01-11 23:30:25 +00:00
Xander Lenstra
8b846f8087
Typed a few unit uniques (#5951)
* Typed a few unit uniques

* Fixed tests

* Actually implemented a unique type :)
2022-01-11 23:24:58 +00:00
Yair Morgenstern
4308ad44ed
Removed silly crash for unteneble mods, and a try/catch that due to changes no longer caught hat it should have. (#5950) 2022-01-11 23:17:41 +00:00
Xander Lenstra
d809f3a132
Made all the other constants determining the strength of cities moddable (#5940) 2022-01-10 13:55:22 -08:00
Xander Lenstra
93a109b082
Fixed a bug where citadels did not damage nearby units (#5941)
* Fixed a bug where citadels did not damage nearby units

* Fixed tests
2022-01-10 13:32:48 -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
yairm210
c6a9f6a857 Chore - typified unit uniques 2022-01-10 21:13:59 +02:00
Xander Lenstra
86f8dff39b
Fixed a crash when using conditionals in transient unit uniques (#5939) 2022-01-10 11:53:00 +02:00
Yair Morgenstern
598f39e567
Deprecation of requiredBuildingInAllCities (#5922)
* Deprecation of requiredBuildingInAllCities

* Should be a warning not an error
2022-01-09 21:40:47 +02:00
Xander Lenstra
fc287bd9f3
Added a way to add moddable constants (#5921)
* Added a way to add moddable constants to unciv

* Fixed xp from barbarians problem

* Maybe I should test my code before pushing
2022-01-09 21:40:41 +02:00
Yair Morgenstern
44b262ec52
Remove support for stat-named specialists (#5923) 2022-01-09 21:39:32 +02:00
Yair Morgenstern
513b37583f
Converted "Can construct [improvementName]" to a uniqueType (#5924) 2022-01-09 21:39:27 +02:00
Yair Morgenstern
5f5aca6780
Simplified conditional checks - where I felt it would make it more readable (#5927)
* Simplified conditional checks - where I felt it would make it more readable.

Also added checks to ensure that era exists when checking era.

* Now passes tests

* Simplified unit tile checks
2022-01-09 21:39:20 +02:00
Xander Lenstra
9639365fd8
Fixed 'cannot built on [strategic resource]' not working (#5933) 2022-01-09 21:39:07 +02:00
will-ca
24dfad696c
New crash handler screen Part 2: Threads, runnables, more informative reports. (#5810)
* Add crashHandlingThread.

* Replace all uses of `thread` with `crashHandlingThread`.

* Add `postCrashHandlingRunnable`.

* Replace all uses of `Gdx.app.postRunnable` with `postCrashHandlingRunnable`.

* Remove CrashController and CrashReport; Strip down CrashReportSender to CrashReportSysInfo; Fold their functionality into CrashScreen.

* Typo in comments, rename `SafeCrashStage` to `CrashHandlingStage`.

* Tweak docs.

* Tweak docs, comments, text. Undo an accidentally recursive Replace All change.

* Remove replaced translations.

* More readable indentation handling in report template.
2022-01-09 11:33:45 +02:00
Yair Morgenstern
5931853c37
Check parameter types of conditionals as well as the main unique (#5928) 2022-01-07 16:49:33 +00:00
Xander Lenstra
7f38118dd9
Expanded the buildingFilter to include options for national wonders (#5900)
* Expanded the buildingFilter to include options national wonders

* Also instruct the translation file writer on the changes

* Typo

* Non-national -> World
2022-01-07 13:41:53 +02:00
Xander Lenstra
c1a6e05da6
Disables '[cityState] is afraid of your military power' for spectators & other non-major civs (#5918)
* Disables '[cityState] is afraid of your military power' for spectators

* Do the same for a few other similar notifications

* And more, for patronage complete policy
2022-01-06 14:19:29 -08:00
Yair Morgenstern
45ee382fba
Resolved #5801 - detailed sources of battle modifiers (#5916) 2022-01-06 13:46:45 -08:00
Xander Lenstra
d6a99a7848
Fixed a bug where great improvements could not be repaired after being pillaged (#5913)
* Fixed a bug where great improvements could not be repaired

* Formatting
2022-01-06 13:29:59 -08:00
will-ca
a5bba8dfb0
Refactor pixel unit image resolving. (Includes ImageAttempter) (#5897)
* Add ImageAttempter for finding available from candidate images.

* Remove zero-arg ImageAttempter constructor.

* Refactor pixel unit image resolving.
2022-01-04 21:02:32 +01:00
will-ca
96beed4b3e
Add tileScale in TileSetConfig. (#5874)
* Add `tileScale` in `TileSetConfig`.

* Right, KDoc.
2022-01-04 10:18:13 -08:00
Yair Morgenstern
0e64ff5592
Performance improvements - inspired by ANR errors for this callstack (#5896) 2022-01-03 16:51:21 +00:00
Xander Lenstra
89d4c046d4
Added more yield icons to the city stats table (#5894)
* Added more yield icons to the city stats table

* Replaced icons with Font.icon
2022-01-02 17:50:27 +00:00
Xander Lenstra
cdbdda366b
Revamped nukes again to closer match the original (#5892) 2022-01-02 04:04:43 -08:00
Xander Lenstra
f06242ebe1
Allowed follower beliefs to have more uniques, merged a unique and globalized some uniques (#5882) 2021-12-31 13:47:52 +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
ee65adb5e4
Fixed a bug where all global unit discounts would always apply, despite only being for certain units (#5879) 2021-12-31 11:07:59 +02:00
Xander Lenstra
dcbb0df4f9
Typefied spaceship part unique (#5878)
* Typefied spaceship part unique

* Removed unused imports

* Ah right, spaceship parts are still buildings
2021-12-30 18:33:01 +02:00
will-ca
1a8a86cb2c
Unify and improve moddability of more tile-based images. (#5873) 2021-12-29 18:21:34 +02:00
yairm210
6b2778fd0a Merge remote-tracking branch 'origin/master' 2021-12-29 00:14:36 +02:00
yairm210
7a00ebe2ec Can no longer promote units with 0 movement by sneaking into the promotion screen from elsewhere 2021-12-29 00:13:09 +02:00
will-ca
0056eba408
Move BorderImages to tileset. Set origin in setHexagonImageSize(). (#5868) 2021-12-29 00:05:56 +02:00
yairm210
af22ede437 Better map-to-ruleset incompatibility checks 2021-12-28 23:42:06 +02:00
yairm210
2ea97edb92 Can now load maps with extra lines at the end, as found in some mods in the wild 2021-12-28 23:33:52 +02:00
yairm210
9266ddc5d0 Fixed rare bug where captured civilian disappears before you can return it 2021-12-28 23:16:54 +02:00
yairm210
bd70500685 Fixed bug in inquisitor automation 2021-12-28 23:10:44 +02:00
yairm210
f90b22ad60 Resolved #5188 - stat names also include the stat icon :) 2021-12-28 23:03:17 +02:00
yairm210
d418e572f8 Resolved #4354 - can no longer 'cheat' the unit overlay by e.g. automating a unit and then try and swap it with another unit 2021-12-28 22:49:46 +02:00
yairm210
f3b4c2fa6f AI peace evaluation no longer hardocded - resolves first point of #5490 2021-12-28 22:43:23 +02:00
yairm210
66fa8db51c Resolved #5469 - 'tile to expand to' choice incorporates city-specific bonuses 2021-12-28 22:36:30 +02:00
yairm210
e3fb00d939 Resolved #5867 - fixed rare 'uninitialized continent sizes' bug 2021-12-28 21:28:31 +02:00
will-ca
f6d186445c
Try to fix #5729 as concurrency issue. (#5862)
* Try to fix #5729 as concurrency issue.

* Oh, remove comment about crash, I guess.
2021-12-28 09:15:34 +02:00
will-ca
005c465ee4
Use tileset fallbacks for missing images. (#5852)
* Use tileset fallbacks for missing images.

* Disable tileset fallback for FantasyHex.

* Tweak docs, remove debug signature.
2021-12-27 21:05:33 +02:00
will-ca
a1dfa53664
Save attacks per civ for arrows for cities, missiles, dead units. (#5855)
* Save attacks per civ for arrows for cities, missiles, dead units.

* Tweak docs.
2021-12-27 20:57:30 +02:00
Xander Lenstra
f14ec29468
Fixed a rare diplomacy voting bug in one-more-turn mode (#5845)
* Fixed a rare bug where in one-more-turn mode after conquering all other civs, players could be asked to vote, despite having no one to vote for

* Removed code duplication
2021-12-27 09:01:04 +02:00
Xander Lenstra
f03918f610
Fixed a few combat bugs and changed the religions founded label (#5846)
* Fixed a bug where bonusses applying 'in friendly tiles' would not apply

* Reworded something so it actually makes sense

* Fixed capitalization error leading to autocracy complete bonus no longer working

* Fixed save serialization errors and finally correctly implemented the time limit for autocracy bonus

* Made value const and static
2021-12-26 07:31:07 +02:00
will-ca
af941754cd
Show arrows on map for unit actions: Asset files. (#5825)
* Show arrows on map for unit actions.

* Don't wrap arrows unless world wrap is actually enabled.

* Fix transported air units always being treated like teleports.

* Simple reviews.

* Separate movement arrow visibility checks from WorldScreen.

* Assets for map arrows overlay.

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2021-12-25 22:29:19 +02:00
yairm210
b744acdc55 Exit CrashScreen normally, without exceptions 2021-12-25 22:28:43 +02:00
yairm210
d1b4fe6d1a Crash screen throws exception on a separate thread so the GCP logs record it 2021-12-25 22:24:37 +02:00
will-ca
e672bfb6d3
Show arrows on map for unit actions. (#5824)
* Show arrows on map for unit actions.

* Don't wrap arrows unless world wrap is actually enabled.

* Fix transported air units always being treated like teleports.

* Simple reviews.

* Separate movement arrow visibility checks from WorldScreen.

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2021-12-25 22:20:29 +02:00
Xander Lenstra
f3a2edf390
Converted the max turns drop down to a slider, idea courtesy of SomeTroglodyte (#5843)
* Converted the time victory drop down to a slider, idea courtesy of SomeTroglodyte

* Added a score breakdown to stat overview screen

* Removed score factors with value 0 & applied SomeTroglodyte's patch

* Removed 2000 max turns, should never be reached anyways
2021-12-25 17:57:02 +02:00
Xander Lenstra
ecadfb53fa
Typed some uniques and fixed a policy not working (#5848)
* Typed some uniques, fixing a policy not working

* Repurposed an unused function to remove .unit in some places

* Fixed compilation errors
2021-12-25 17:55:14 +02:00
Xander Lenstra
ea51c7155b
Fixed a bug where an empty improvement picker screen could open (#5815)
* Fixed a bug where an empty improvement picker screen could open

* Moved the check for constructing instead of building to the unit
2021-12-25 17:53:10 +02:00
Xander Lenstra
759366c912
Added score and time victory (#5842)
* Added a score calculation

* Added the score in multiple places of the UI

* Added time victory and a max turns

* Made time victory functional

* Added translation files
2021-12-24 14:31:36 +02:00
yairm210
730a3d8482 Merge remote-tracking branch 'origin/master' 2021-12-24 12:51:13 +02:00
yairm210
4c41536ed8 Resolved #4202 - AI cities now build workboats for use in other cities
Solves the 'landlocked but with water improvement' deadlock
2021-12-24 12:50:58 +02:00
will-ca
69450c5f4b
Added debug menu button that spawns and improves all strategic resources into your territory. (#5838)
* Added debug menu button that spawns and improves all strategic resources into your territory.

* Reviews.
2021-12-24 11:57:59 +02:00
yairm210
93268f53ee Another stab at #5729 after the toInt didn't help. 2021-12-23 21:22:40 +02:00
yairm210
eb4a76dcd0 Resolved #5823 2021-12-23 21:15:20 +02:00
yairm210
f4f673dc8a 3.18.11-patch1 2021-12-21 21:58:01 +02:00
will-ca
723aaf779c
Add new universal crash handlers and error reporting screen. (#5804)
* Add new crash handler and error reporting screen.

* Minor cleanup.

* Word choice.

* Rename `SafeCrashStage` to `CrashHandlingStage`.

* Reviews.

* Reference stack traces in comments for thread and postRunnable exceptions.

* Remove excessive line breaks, superfluous .apply{}.
2021-12-20 20:55:58 +02:00
Xander Lenstra
c9628c7fa7
Extended use for "in [tileFilter] tiles" conditionals (#5827)
* Changed 'in [tileFilter] tiles' to also apply outside of combat

* Changed unique docs writer to also sort applicables, so these are also not regenerated constantly
2021-12-20 13:53:03 +02:00
Xander Lenstra
b30576d115
Added an option to unlock all techs to the debug menu (#5820) 2021-12-18 20:05:34 +02:00
will-ca
1ab3041536
Refactor MiniMapHolder's little green map overlay toggle icons. (#5814)
* Refactor MiniMapHolder's little green map overlay toggle icons.

* Remove comment.

* Actually, don't hide those properties.
2021-12-18 17:56:50 +02:00
Yair Morgenstern
7aa7b8a4b2
Resolved #5790 - kudos to @xlenstra for finding the problem and providing reproduction! (#5812) 2021-12-17 08:47:07 +02:00
yairm210
8a93511a6a Merge remote-tracking branch 'origin/master' 2021-12-16 22:54:56 +02:00
yairm210
9d38ce75c4 @Interdice even after all that there was still a bug - we didn't check if the tiles we were sending the missionary/inquisitor to was actually reachable :) 2021-12-16 22:54:46 +02:00
Xander Lenstra
58cc3b517e
Fixed an infinite loop where foreign legion upgraded to the unit it replaced (#5808)
* Fixed an infinite loop where foreign legion upgraded to the unit it replaced

* Changed the wrong variable

* Maybe it is useful to also change its unlock tech

* Whoops, should only be for non-null values
2021-12-16 17:50:10 +02:00
itanasi
4fe7315478
Sort Maintenace Using Fixed Point (#5764)
* Add new UniqueType.NoMaintenance to support Guided Missile

* revert gradle
Add UnitMaintenanceDiscount
Rename UnitMaintenanceDiscount->UnitMaintenanceDiscountGlobal
Rework maintenance equation to account for overlapping reductions
Add maintenance variable to MapUnit

* Add square brackets in string (apparently didn't check in?)
More robust uniques check code so not assuming only one matching unique
Use toPercent()

* Proper toPercent() math

* Use fixed point Long to help in sorting to avoid float bug?

* Use fixed point Long to help in sorting to avoid float bug?

Co-authored-by: temurakami <spellman23@gmail.com>
2021-12-15 22:59:10 +02:00
yairm210
c655d69c78 Order unique docs by target type so we don't get reorderings all the time 2021-12-14 19:02:58 +02:00
GGGuenni
28d3c12142
Improvements to TurnChecker data usage (#5789)
* Added necessary utils

Added the FileNotFoundException which is also part of #5593

* Added preview download to MultiplayerScreen

* Added preview download to TurnChecker

* Fixed uncomplete commit

* Removed debug print in MultiplayerScreen
2021-12-13 21:14:30 +02:00
Interdice
3f6fe234b3
AI for Inquisitor and Missionary (#5590)
* First pull request to add missionaries and inquisitors

* First pull request to add missionaries and inquisitors

* First pull request to add missionaries and inquisitors

* First pull request to add missionaries and inquisitors

* Ai choice

* some fixes

* some fixes

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* adding a system for the ai to buy with faith

* finally done

* finally done

* some fixes

* some fixes

* some fixes

* some fixes

* some fixes

* some fixes

* some fixes
2021-12-12 12:27:09 +02:00
yairm210
0c1509bfe8 Resolved problem in new uniques with multiple parameters of the same name
Relevant to #5783 and #5781
2021-12-11 20:23:31 +02:00
yairm210
b537f9e386 Resolved #5779 - uniques and conditionals for translating are taken directly from the uniquetypes 2021-12-10 15:34:17 +02:00
yairm210
23bad8d961 Resolved #4921 - can gift improvements to city states also on water tiles and when other improvements have been built on top of the resource 2021-12-09 21:58:57 +02:00
yairm210
ed3a4accdd Resolved #5775 - don't try and set resource amounts for "image" tiles, like in map editor or civilopedia 2021-12-09 20:43:19 +02:00
yairm210
f3378f4ced 3.18.8-patch1
Resolved #5774 - removed demanded resource from city when resource is not in ruleset
2021-12-09 20:37:37 +02:00
Xander Lenstra
22b3997c28
Band-aided a bug where players in multiplayer games were waiting for themselves. (#5768) 2021-12-07 21:38:45 +02:00
SimonCeder
24bd2b66b0
Regions part 3 - resource placement, resource settings (#5690)
* placeLuxuries

* map resource settings

* strategic and bonus resources

* terrain fixes

* slight optimizations

* vanilla jsons

* fix luxury terrain distribution

* also for vanilla

* fix ruleset bug

* terrainfilter
2021-12-07 07:25:16 +02:00
yairm210
4bc8c83555 Merge remote-tracking branch 'origin/master' 2021-12-06 19:20:28 +02:00
yairm210
0088ddd18b Solved bug that made civilian units uncapturable 2021-12-06 19:19:37 +02:00
Xander Lenstra
2fa3228148
Fixed a crash that occasionally happened when liberating a city to a dead civ (#5762)
* Fixed a crash that occasionally happened when liberating a city to a dead civ

* Added descriptive comment
2021-12-06 11:54:10 +02:00
Xander Lenstra
40cb651433
Fixed the unique for giving sight to units no longer working (#5760) 2021-12-06 07:10:52 +02:00
Xander Lenstra
a46f638ef1
Fixed a bug where protected city states would have a red line to their protector in the diplomacy overview screen (#5761) 2021-12-06 07:10:05 +02:00
yairm210
31639aac9f Resolved #5752 - don't show 'fortify until healed' if the unit won't actually heal in this tile 2021-12-05 21:38:27 +02:00
yairm210
144d2738a4 Trying to find the cause of #5729 2021-12-05 21:33:04 +02:00
Xander Lenstra
ba36956990
Replaced a != sign by a == sign (#5753) 2021-12-05 12:58:32 +02:00
Xander Lenstra
b6ce8b2aac
Fixed a bug where 'requires a [buildingName] in this city' would not work (#5754) 2021-12-05 12:55:46 +02:00
SimonCeder
936a32300b
counteroffer fixes (#5749) 2021-12-04 23:25:43 +02:00
yairm210
623420039b Resolved #5727 - on multiplayer, game info is updated as each intermediate player finishes their turn 2021-12-04 23:24:34 +02:00
yairm210
9950e963bc Resolved #5742 - removed extraneous empty lines from translation files 2021-12-04 23:13:43 +02:00
Xander Lenstra
d1224a36cf
Fixed a bug where WLTKD would continue after conquering/trading a city (#5748) 2021-12-04 18:33:19 +02:00
yairm210
5697a6f912 Solved crash of #5728 - AIs ignore trade requests that have become invalid mid-turn
They also no longer spam each other with requests
2021-12-03 13:57:00 +02:00
yairm210
234b1b1741 Removed many "proxy functions" from civInfo to cityStateFunctions 2021-12-03 11:28:24 +02:00
yairm210
7169458943 More informative exceptions, to try and catch the "invalid city ID on trade" crash 2021-12-03 11:12:48 +02:00
yairm210
69db686101 Moved all fully deprecated uniques to their own region down below
Slight steps towards stat percent bonus calculation efficiency in CityStats
2021-12-03 11:01:55 +02:00
yairm210
0def261012 Added unique types, added regions for easier location 2021-12-03 10:48:39 +02:00
itanasi
7f07bcb9e5
Recycling center (#5738)
* Add support to UniqueType.MaxNumberBuilding (including rejectionReasons)
Add Recycling Center entry to JSON
Need Graphical Icon

* Fix typo
Add TODO

* adding Recycling Center icon

* Credit update for icon
Rephrase Rejection text
Updated .atlas and .png
Add code to block showing Recycling Center

* Fix using placeholderText
Set shouldShow to True so iot still appears while under construction but not completed

* Rejection Text now working
Remove debug prints

* Remove odd extra lines

* extra lines

* Remove excessive if statement in shouldBeDisplayed
Reword text. Unique can apply to Buildings and Units
Refactor Signature since not just Buildings

* Adding code to remove building in transferred city

Co-authored-by: temurakami <spellman23@gmail.com>
2021-12-03 10:15:51 +02:00
Xander Lenstra
06dd395efb
Fixed a bug where statue off Zeus would not work (#5732) 2021-11-30 14:42:19 +02:00
yairm210
57f3bf2bb2 Resolved #5713 - AI doesn't try attacking with non-attack units 2021-11-29 22:45:54 +02:00
yairm210
b9d2078442 Fixed niche bug that let you try and capture civilians in territory you can't enter 2021-11-29 22:41:55 +02:00
yairm210
e43e23b9a8 Disabled buggy counteroffer mechanic to release a stable version 2021-11-29 19:47:42 +02:00
will-ca
f86b765d38
Show which cities are missing required buildings for National Wonders. (#5718) 2021-11-29 15:57:36 +02:00
yairm210
0cef056c4d Typing for unit uniques 2021-11-28 08:28:55 +02:00
SimonCeder
10686d1d8f
We Love The King Day (#5705)
* we love the king day

* AI improvements

* Don't break old saves

* unused import

* tutorial

* proper growth when unhappy

* reviews
2021-11-27 19:59:19 +02:00
Xander Lenstra
4107ff3386
Added health conditionals (#5707)
* Added health conditionals

* Whenefied conditional
2021-11-27 19:52:54 +02:00
yairm210
15cbf8359f Resolved edge case crash when conquering the capital of a civ that has a unique capital city indicator 2021-11-24 18:33:51 +02:00
yairm210
5d160508d3 Fixed bug when attempting to load a game that uses mods you don't have 2021-11-24 18:33:44 +02:00
SimonCeder
2dd4415977
Counteroffer mechanic, updated trade valuations (#5702)
* counteroffer mechanic

* string template

* string template

* AI always counteroffers if able
2021-11-23 13:00:30 +02:00
yairm210
4113b810ff Simplified civ info stats happiness breakdown 2021-11-22 20:53:08 +02:00