Commit Graph

4244 Commits

Author SHA1 Message Date
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