Commit Graph

4580 Commits

Author SHA1 Message Date
SomeTroglodyte
4ffb21f525
Support more freely modded Worker-like units (#6339)
* TileImprovementTime UniqueType supports UniqueTarget.Unit

* Reduce UniqueType.ConstructImprovementConsumingUnit hardcoded Great People behaviour

* Some linting

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2022-03-13 22:49:54 +02:00
Yair Morgenstern
97787bd397
Resolved #6335 - now shows conditionals precluding construction of units (#6346)
* Resolved #6335 - now shows conditionals precluding construction of units

Built simply so that if we decide to expand the conditionals that should be shown it will simply be building a hashset of conditionalsToShow

* Added an instance wrapper, so the enum has the default values and the class has the actual values

* minor lint
2022-03-13 22:45:39 +02:00
Leonard Günther
cea63eb114
Multiplayer code cleanup (#6330)
* Fixed reviewed comments of PR 6273

* Cleanup of Dropbox.kt

- moved Dropbox.kt from ui\worldscreen\mainmenu to logic\multiplayer
- moved ServerMutex and OnlineMultiplayer to own files
- changed DropBoxFileConflictException to FileStorageConflictException to match FileStorage scheme
- merged FolderListEntry with DropboxMetaData as they were basicly the same
- introduced IFileMetaData to match FileStorage scheme and modified DropboxMetaData to use it
- removed some unused imports
2022-03-13 22:44:02 +02:00
SomeTroglodyte
d8e9563a7c
Religion overview improved (#6303)
* Improve handling of Religion PickerScreen with long lists

* Fix mouseover graying Labels bug

* Update Pantheon chooser visuals

* Some Color.lerp simplification

* Religion pickers - Merge common stuff of Pantheon and Religion Pickers

* Religion pickers - Linting

* Religion pickers - Move ReligionOverviewTable extra lines capability to Belief, Fix FormattedLine link+center

* Religion pickers - Belief Civilopedia linked description

* Religion overview tweaked

* Religion overview tweaked - patch1
2022-03-13 22:43:40 +02:00
SomeTroglodyte
e4b0afb7e3
Update ModConstants and start its documentation (#6309)
* Update ModConstants

* Update ModConstants - revert Ice, tweak formula

* Update ModConstants - comment on predefined MapSizes
2022-03-13 22:43:23 +02:00
SomeTroglodyte
88ba48d7f1
Mod checker minor improvements (#6341)
* Enabled unique "spellcheck" flag to be passed down into complex check

* Allow mod checker to list untyped uniques, behind "secret" switch
2022-03-13 22:40:12 +02:00
SomeTroglodyte
c51f3b47de
Fix 1 Spectator N AI games in seemingly endless loop (#6337) 2022-03-13 22:38:11 +02:00
Yair Morgenstern
877dedaa89 More unique cleanup 2022-03-13 16:43:56 +02:00
Yair Morgenstern
c3e345df27 Unique deprecation 2022-03-13 15:27:32 +02:00
SomeTroglodyte
a93d531b85
Religion/Pantheon pickers display selection Civilopedia-linked (#6302)
* Improve handling of Religion PickerScreen with long lists

* Fix mouseover graying Labels bug

* Update Pantheon chooser visuals

* Some Color.lerp simplification

* Religion pickers - Merge common stuff of Pantheon and Religion Pickers

* Religion pickers - Linting

* Religion pickers - Move ReligionOverviewTable extra lines capability to Belief, Fix FormattedLine link+center

* Religion pickers - Belief Civilopedia linked description
2022-03-10 19:46:15 +02:00
SomeTroglodyte
e5b36f5b9f
Unique units abilities that should be inherited by upgrades (#6304)
* Unique units abilities that should be inherited by upgrades

* Unique units abilities that should be inherited by upgrades - xlt

* Unique units abilities that should be inherited by upgrades - wiki
2022-03-10 19:45:32 +02:00
SomeTroglodyte
e97c95b7aa
Improve handling of Religion PickerScreen (#6287)
* Improve handling of Religion PickerScreen with long lists

* Fix mouseover graying Labels bug
2022-03-08 14:24:44 +02:00
SomeTroglodyte
12428835b3
Notifications location (#6282)
* LocationAction overhaul - groundwork

* LocationAction overhaul - instantiations, some simplifications

* LocationAction overhaul - ruin rewards can go to ruin ex-location

* LocationAction overhaul - obsolete construction refund simpler, notification points to city
2022-03-08 14:23:07 +02:00
Leonard Günther
e4607c9391
Added Server Sided Mutex (#5593)
* Added first iteration of server sided mutex

* Add Mutex-like interface for file locking in Multiplayer

* Fix my C++ habits

* Change retry interval to match Dropbox API guidelines

* Move lock implementation from OnlineMultiplayer to ServerMutex

* Removed unnecessary gameInfo to preview conversions

and fixed a problem regarding Dropbox fileNames

* Fixed wrongly named variable

* Check if lock is owned before unlocking

* Trying to implement forgotten lock release

but failed at Date.time ¯\_(ツ)_/¯

* Seems to be working now

* Updated to use FileStorage Interface

* Fixed missed fileStorage call

Co-authored-by: Colin Vanden Heuvel <colin.vandenheuvel@wisc.edu>
2022-03-08 14:20:17 +02:00
itanasi
a4cb49ea63
Return Stacking Terrain Bonus to Civ5 Rules (#6249)
* Make multiple defense bonuses stack

* Switch to check base terrin and Natural Wonders using getAllTerrains()

* Improved Tile Defense stacking

* Change to using 0f since no other maths happening

Co-authored-by: itanasi <spellman23@gmail.com>
2022-03-08 14:19:13 +02:00
SomeTroglodyte
6391a5c881
Constants.minimumMovementEpsilon cleanup (#6285) 2022-03-08 14:18:57 +02:00
SomeTroglodyte
deafc96d82
Update Pantheon chooser visuals (#6291) 2022-03-08 14:18:44 +02:00
SomeTroglodyte
6a6c5184ec
Some Color.lerp simplification (#6300) 2022-03-08 14:18:31 +02:00
lishaoxia1985
ea2b26370a
Some edits for fun getRejectionReasons in class building/unit and fun checkMod (#6165) 2022-03-08 14:18:15 +02:00
lishaoxia1985
b779896332
Replace YesNoButton with Checkbox (#6297) 2022-03-08 14:17:17 +02:00
청하늘
0a5223f721
Add "Starts with [policy] adopted" unique (#6296)
* Added "Starts with [policy] adopted" unique

* Polished "Starts with [policy] adopted"
2022-03-08 14:16:41 +02:00
itanasi
906d770443
Fix isEmbarked() Crash (#6290)
* 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

* Fix exception for when currentTile isn't initialized yet

* More precise solution

Co-authored-by: itanasi <spellman23@gmail.com>
2022-03-07 13:02:30 +02:00
SomeTroglodyte
fb7cb707e0
WLTK decorations (#6253)
* WLTK decoration png's and atlas

* UncivTooltip anchor to stage so tips won't get clipped by some ScrollPane

* Empire Overview Cities add WLTK column

* Make WLTK line on CityScreen stats box link to Civilopedia

* Make Civilopedia return to previous screen for _both_ ESC/Back and the Close Button

* Revive Civilopedia links in WorldScreen.TileInfoTable

* Festive decoration for WLTK day on CityScreen
2022-03-05 20:10:03 +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
SomeTroglodyte
70517b9c3d
Sort maps & accelerate playing a newly edited map (#6267)
* Sort map file lists

* Pre-select custom map if saved within last 15min
2022-03-05 20:04:55 +02:00
SomeTroglodyte
617f801558
Improve Unique.getReplacementText (#6265) 2022-03-05 20:03:34 +02:00
SomeTroglodyte
2f980abd72
Locate Mod Errors choose base ruleset to do complex check against (#6263)
* Some Ruleset linting

* Mod-check display remove unnecessary FormattedLine

* Mod-check can run on selectable base ruleset instead of Vanilla only

* Mod-check show final severity on Expander

* Mod-check base selectbox translatable
2022-03-05 20:03:28 +02:00
SomeTroglodyte
9f9e8c33c5
Fix next turn button disabled after leaving sub-screens from menu (#6261) 2022-03-05 20:03:20 +02:00
SomeTroglodyte
e7fc1a565f
Fix after-pillage display (#6255) 2022-03-05 20:03:09 +02:00
SomeTroglodyte
c503f840d1
Hide irrelevant items from CityInfoTable stats (#6254) 2022-03-05 20:02:54 +02:00
SomeTroglodyte
115a7f84bf
Fix broken border display on the smallest possible maps (#6266) 2022-03-05 20:01:49 +02:00
Leonard Günther
0e26ea2cc8
Added deep link to multiplayer games (#6273) 2022-03-05 20:00:56 +02:00
SomeTroglodyte
1b9e496db5
Swap order on diplomatic victory: voting result _then_ victory (#6270) 2022-03-05 19:55:14 +02:00
SomeTroglodyte
0390ec225f
Move automated units button was showing when it didn't do anything (#6271) 2022-03-05 19:54:54 +02:00
Yair Morgenstern
00c5ecb6a6 3.19.13 2022-02-28 22:49:11 +02:00
SomeTroglodyte
bca3d5645a
Fix Spaceship production boni (and key binding) (#6247)
* Fix spaceship part boni

* Key binding for 'Add part to spaceship'
2022-02-28 19:42:02 +02:00
SomeTroglodyte
e2945687f2
Fix Ctrl-Letter key bindings (#6232) 2022-02-28 19:41:46 +02:00
SomeTroglodyte
9870003e33
Fix Petra and Garden not allowed in some cases (#6245) 2022-02-28 19:41:35 +02:00
SomeTroglodyte
651dcff581
Fix Polynesia's Wayfinding (#6238)
* Fix Polynesia's Wayfinding

* Fix mod option to use other unit filters with UnitsMayEnterOcean
2022-02-28 19:41:22 +02:00
itanasi
f360eda047
Align (reduce) Embarked Defense Strength per Era (#6231)
* Change Embarked Defending Strength per era. Update Tutorial a little

* Use JSON implementation of EmbarkDefense

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-28 19:41:13 +02:00
Yair Morgenstern
8a6b4de84f Minor improvements from GPC 2022-02-28 19:39:44 +02:00
Yair Morgenstern
6bbab8a394 FINALLY removed CivInfo.getMatchingUniques(String)! 2022-02-27 16:57:21 +02:00
Yair Morgenstern
78f0ad768a
Step 1 of resolving #6186 freshwater crisis - unify adjacency to a single function, only rivers are outliers (#6219) 2022-02-25 13:39:34 +02:00
SomeTroglodyte
8cb73ac91b
UncivSlider fixes (#6222)
* Fix UncivSlider isDisabled and snapToValues with the +/- buttons

* Apply UncivSlider to convertGoldToScience

* Apply percent tooltip formatting to sound volume sliders

* Linting and guard against a border case
2022-02-25 13:39:22 +02:00
SomeTroglodyte
6db4ba586c
Less instantiations of listOf(HiddenToUsers) (#6220) 2022-02-24 23:20:04 +02:00
Yair Morgenstern
c767ebe2bf More unique typing isn't this fun 2022-02-24 16:29:09 +02:00
itanasi
f14a201afb
Fix Navies capturing Land Civilians (#6223)
* 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

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-24 13:38:17 +01:00
SomeTroglodyte
261e09e336
Rudimentary AI control over goldPercentConvertedToScience (#6221) 2022-02-24 13:36:41 +01:00
Yair Morgenstern
ae2b91dd67 Moved wiki links to new site links 2022-02-23 21:40:20 +02:00
Yair Morgenstern
b7211a582c Minor fix for global alert 2022-02-23 20:18:07 +02:00
Yair Morgenstern
6d7e8616ec 3.19.11-patch1 2022-02-23 18:44:40 +02:00
Yair Morgenstern
1fa1c6885a placeholder equality tests replaced with hasUnique() and getMAtchingUniques() instead 2022-02-23 12:16:09 +02:00
Yair Morgenstern
09089cb60d Added uniques and deprecations for "Requires" and "Unlocked by" uniques - #6165 2022-02-22 16:55:37 +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
SomeTroglodyte
d30ea86b27
Additional guard against no-barbarian games calling doRevoltSpawn (#6213) 2022-02-22 11:30:48 +02:00
Xander Lenstra
e0345bcb52
Reorganized the way city states grant resources & rounded a float to an int (#6210)
* Reorganized the way city states grant resources & rounded a float to an int

* Reworded a string so it sounds nicer
2022-02-22 11:30:33 +02:00
Xander Lenstra
90386bd4e7
Made spaceship parts units instead of buildings (#6203)
* Spaceship parts are units now

* Fixed tests

* Removed commented out lines

* `Spaceship Part` unique can also go on buildings in ods
2022-02-22 11:30:20 +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
itanasi
c9945ca7ba
Make multiple tile defense bonuses stack (#6193)
* Make multiple defense bonuses stack

* Switch to check base terrin and Natural Wonders using getAllTerrains()

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-22 11:27:58 +02:00
Xander Lenstra
1e24f04cf9
Added mod constants for the distance between two cities (#6211) 2022-02-22 11:17:22 +02:00
Yair Morgenstern
246d11bfc7 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-21 18:19:30 +02:00
Yair Morgenstern
91816d9c37 Added "copy to clipboard" button for mod errors 2022-02-21 10:51:23 +02:00
Yair Morgenstern
9595247d3b Finished unique typing for CivInfo.hasUnique() and removed string version!
Damn but there are a LOT of uniques that have accumulated over time
2022-02-20 21:17:58 +02:00
Yair Morgenstern
cd92f66c3a Resolved ANR when copying game data to clipboard 2022-02-20 19:53:19 +02:00
Yair Morgenstern
2786e0091c Massive unique deprecation 2022-02-20 18:27:40 +02:00
Yair Morgenstern
64b8d805c3 Resolved #6184 - don't display turns to relationship change for non-decreasing city-state relationships 2022-02-20 12:45:48 +02:00
Yair Morgenstern
4f9c17da0b Resolved untranslated string in improvment description - #6131 2022-02-19 23:08:19 +02:00
Yair Morgenstern
0a4df1ca9f Resolved #6188 - don't show 'missing cities that need to build X' for buildings already built in the city
It gives the impression that the buildings stop providing their bonus if the condition is no longer satisfied
2022-02-19 23:05:47 +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
Xander Lenstra
a8be359ed2
Damage in battle table is now the average damage done (#6176)
* Damage in battle table is now the average damage done

* Trailing comma's

* Fixed typo
2022-02-19 19:34:46 +02:00
itanasi
402a9ba825
Show Improvements that are buildable after Removing TerrainFeature (#6149)
* Initial working version!

* More comments

* Add missing .tr() translation calls

* add brackets

* Fixed

* Optimize checking for removable last feature
More complete tileInfo.clone()

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-19 19:34:27 +02:00
Xander Lenstra
f9bab01a64
Added conditional checking for tiles (#6187)
* Added conditional checking for tiles

* Fixed compile error

* I actually like this variable more over here
2022-02-19 19:33:44 +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
SomeTroglodyte
6e92ea4d29
Fix for #6178 music resumes after minimizing on android (#6195) 2022-02-19 18:40:52 +02:00
itanasi
2d60fe4565
Prevent Civilians from capturing Civilians (#6185)
* 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

* Add check so Civilian Units don't capture other Civilians

* Change logic to isMilitary()

Co-authored-by: temurakami <spellman23@gmail.com>
2022-02-19 18:37:38 +02:00
itanasi
4e338ae4f3
Embarking penalty logic fix (#6181)
* Fox naval unit Landind penalty is for attacking on to land

* Only Land unit should have Boarding penalty

* Unbreak logic

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-18 13:15:35 +01:00
Yair Morgenstern
82236fe2c8 More uniquetyping 2022-02-18 13:42:23 +02:00
Yair Morgenstern
0171ad168f #6131 fixes
Partially translated Uniques when picking a Pantheon
2022-02-18 00:19:45 +02:00
Yair Morgenstern
b8d8e11a86 #6131 fixes
Fixed icon and text for resource stats improvements in Improvement Civilopedia pages
Fixed 'null' for improvement picker for some resource-only improvements
2022-02-18 00:16:02 +02:00
Yair Morgenstern
1e6b0e248c Fixed icon and text for resource stats improvements in Improvement Civilopedia pages 0- #6131 2022-02-18 00:07:08 +02:00
Yair Morgenstern
4fe8450b69 Show json parsing errors for mods in the options menu 2022-02-17 23:55:03 +02:00
Yair Morgenstern
a38034ed91 AI only builds work boats for water resources whose improvement can actually be constructed 2022-02-17 23:39:49 +02:00
Yair Morgenstern
c41410812a Resolved #6175 - attack randomness is turn and tile based to avoid save-scumming 2022-02-16 12:29:28 +02:00
Yair Morgenstern
86cbe895be
In Civ VI there are certain units available only if a specific building is built, and this was raised as a request by modders as well. (#6160)
Instead of expanding the existing 'requires building' unique to units and adding limiters, it's both easier and more generalizable to add conditionals for cities with and without certain buildings to replace the uniques entirely
2022-02-15 11:40:47 +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
48bbed9fad Resolved #6164 - transported units reveal tiles as if they passed through the path of the transporting unit 2022-02-15 10:47:47 +02:00
Yair Morgenstern
1e44b1a235 Fixed misplaced back arrow 2022-02-14 22:00:33 +02:00
itanasi
9d1f463310
Add Amphibious penalty to Land attacking into Water and vice versa (#6127)
* Add Amphibious penalty to Land attacking into Water and vice versa

* Replace Landing with Amphibious in all translation files

* Fix trailing whitespace

* Revert translation files

* Change working of Amphibious
Set penalty to Landing and Boarding

* Type-ify Unique and add Depreciated
Add Promotion to Melee Naval
Add exception that Landing penalty is NOT against cities

* Fix Vanilla

* Rename to Landing Party
Icon doesn't work

* Properly regenerated game.atlas/game.png

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-14 19:21:53 +01:00
Yair Morgenstern
bce65a96f6 More unique typing 2022-02-14 19:05:54 +02:00
Yair Morgenstern
4d02cdeb3b Captured unit notifications now sent to the correct civ :) 2022-02-14 14:47:58 +02:00
Yair Morgenstern
2b4a9d0766 More uniquetyping 2022-02-13 21:03:35 +02:00
Yair Morgenstern
7887e7a238 Resolved untranslated texts as per #6131
- Don't show hidden uniques in unit short text ('Never appears as Barbarian unit')
2022-02-13 12:25:29 +02:00
Yair Morgenstern
4b2bde0365 Resolved untranslated texts as per #6131
- "Resources" in city-state diplomacy screen
- "When Friends"/"When Allies" in same
- "Enhance religion"
- "Choose a Religion" in religion screen
- Religion name in religion screen
- Translated drilldown items in city screen
- "null for wheat" in improvement Civilopedia entry
- "Type" and others in city-state civilopedia entry
2022-02-13 10:58:47 +02:00
Yair Morgenstern
0d3a0ef7e3 Resolved untranslated texts as per #6131
- Added unique targets as lines to translate so they'll appear in BattleTable
2022-02-13 10:34:50 +02:00
Yair Morgenstern
47dea93775 Resolved untranslated texts as per #6131
- Requires more population
- Religious
- "Requires" in Policy civilopedia text
- "for" in improvement civilopedia text
- Untranslated conditionals in battle table (listed as "when fighting in [tileFilter] tiles")
2022-02-13 10:30:31 +02:00
Yair Morgenstern
ce3b6dfb3a Unit upgrade can accept unit conditionals 2022-02-13 10:09:06 +02:00
Yair Morgenstern
63f927af83 Better fix, will also solve future problems of this sort 2022-02-12 22:04:08 +02:00
Yair Morgenstern
901c8a81a5 Plundering no longer gives huge amounts when attacking far weaker units 2022-02-12 22:01:20 +02:00
Yair Morgenstern
b62617c4d2 Resolved #6147 - can see improvement removal icons in Civilopedia 2022-02-12 20:14:52 +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
Xander Lenstra
f5e9952caf
Add uniques and constants for unit supply (#6146)
* Code readability

* Uniques & constants for unit supply

* Fixed tests

* Added a cityFilter to the 'supply per pop' unique
2022-02-12 19:22:17 +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
4fb4722e3a
Arbitrary conditionals can become timed conditionals! (#6134)
* Arbitrary conditionals can become timed conditionals!
triggerCivwideUniques is activated in 3 situations:
- Tech complete
- Policy adopted
- Building complete

So for each of the unique containers for these I added a catch saying 'if this unique is a temporary unique then don't save it yourself

This has been lying around in todos for a while and generalizes one of the nasty hardcoded messes that I hate about Civ V. Why would you introduce ONE timed effect in the whole game?! You can use them all the time like Humankind or never use them like Civ IV, but why have just one whyyy

One more thing in this PR, that needed to be solved by the by, is allowing parameters to have a '2' on the end so we can autoreplace multiple parameters of the same type.
Using a regex is slightly more inefficient, but since this is A. only used once per UniqueType.kt, and B. allows us to have as many 'amount's as we want which is important if we have a lot of conditionals, I feel this is justified.

* Fixed comments from PR
2022-02-12 19:03:11 +02:00
Yair Morgenstern
55d92b9735 Rendering performance improvements - only act on city button groups for tiles that are city centers, and only act on the group and not its subgroups 2022-02-11 10:49:07 +02:00
Yair Morgenstern
6a070358eb Rendering performance improvements - removed nation icon from minimap for less texture switching, set isTransform on vertical progress bars to false, added a ton of debug-help functions 2022-02-11 10:30:37 +02:00
Yair Morgenstern
a5ad6c5e81 Resolved #6106 - correctly recognize mod changes of content, not just metadata 2022-02-10 16:57:00 +02:00
Yair Morgenstern
680bd1a113 Resolved #6136 - Destroyed units on capture provide the correct notification 2022-02-10 16:54:12 +02:00
Yair Morgenstern
43e0fa21f1 No need for 'see also' in shortened tech text since the specific effects are detailed 2022-02-10 16:29:05 +02:00
Yair Morgenstern
c7db212c50 Forgot that lazies should always be unserialized 2022-02-10 16:12:59 +02:00
Yair Morgenstern
87e2764733 Better AI coordination - try and attack the area around the closest city to ours.
Also improves performance as AI only try and head towards a specific subset of cities.
2022-02-10 15:40:41 +02:00
Yair Morgenstern
505a78182c River adjacency and 'is land unit' saved in lazies for another pathfinding performance boost 2022-02-10 14:57:34 +02:00
Yair Morgenstern
8ee2a34a4d chooseMilitaryUnit optimized! 2022-02-10 14:42:52 +02:00
Yair Morgenstern
86450c54eb When pathfinding, only consider ZOC for the *current* turn since things will likely change next turn! This gives a massive performance boost by removing a possible wrong check entirely :) 2022-02-10 14:01:11 +02:00
Yair Morgenstern
dcdb0ca892 Loading a new game while nextTurn is running no longer reverts you to that game 2022-02-09 18:02:52 +02:00
Yair Morgenstern
13f052878b Merged all arrow images into one
Removed unnecessary filterNotNull from getTileBaseImageLocation
2022-02-09 16:59:05 +02:00
Yair Morgenstern
09ea1a869d 3.19.7 2022-02-09 12:31:08 +02:00
Yair Morgenstern
ccfe4386b8 Unique deprecation 2022-02-09 12:26:21 +02:00
Yair Morgenstern
90d459a9f4
Added conditional for 'first civilization to research a tech' (#6120)
* Techs with these kinds of conditional bonuses exist in Civ IV and VI

* Phrasing can now include long-term benefits :)

* Capitalization

* Triggered uniques now subject to conditionals

* Removed extraneous parameter

* Conditional placement

* Updated uniques.md to better phrasing
2022-02-09 12:21:20 +02:00
Yair Morgenstern
03f7af4360
Typified Obsolete unique, made luxury resources obsoletable (#6129)
* Typified Obsolete unique, made luxury resources obsoletable
Things that were luxuries in the past become uninteresting as time goes on

* Unified obsolescence handling for buildings, improvements and resources

* Obsolete icons have their x's in the right place

* All images &c are done - we have the skeleton of the mod in place!

* Revert "All images &c are done - we have the skeleton of the mod in place!"

This reverts commit 61553c17
2022-02-09 12:18:14 +02:00
Yair Morgenstern
644c61a851 Withdraw chances can stack 2022-02-09 12:15:21 +02:00
itanasi
967b70a4b9
Sea Unit can't capture Land Civilian (and vice versa) (#6128)
* Relevant Code

* Negate check

Co-authored-by: itanasi <spellman23@gmail.com>
2022-02-08 12:07:54 +01:00
itanasi
1420ad845c
Notify when Barbs don't give more XP (#6115)
* Updates to allow BarbXP gain check

* Remove from ICombatant

* Revert Battle.kt

* Fix code in BattleTable

* Add template.properties entry

* Fix space issue

* Silly autoformatting

Co-authored-by: temurakami <spellman23@gmail.com>
2022-02-08 11:42:24 +02:00
Yair Morgenstern
92f0be995d More -/+ unique deprecation fixes 2022-02-07 18:26:20 +02:00
Yair Morgenstern
fb77a9e6b1 Replace existing 'unique with condition' with a new Conditional, applicable everywhere 2022-02-07 17:15:10 +02:00
Yair Morgenstern
aa21cf8a28 More tilegroup performance improvements - Only run orFallback once per TileSetStrings and not for every tilegroup
We should probably have a dictionary of "original string to actual string" where orFallback only actually runs if the key isn't in the dictionary yet, otherwise it returns the stored value
2022-02-07 11:14:11 +02:00
Yair Morgenstern
efd576e195 Don't display empty civilopedia categories in mods that don't have them 2022-02-07 11:02:55 +02:00
Yair Morgenstern
a495e5c8fe Memory and performance improvements for tileGroup imagelocation 2022-02-07 11:02:55 +02:00
itanasi
77dd9f63f6
Fixing to also capture Civilian Unit when capturing during battle (#6114)
Co-authored-by: temurakami <spellman23@gmail.com>
2022-02-07 09:45:53 +01:00
lishaoxia1985
aa11602c9a
Delete unused var in the method getDescription/getShortDescription of the Class Building (#6117) 2022-02-07 10:11:53 +02:00
Yair Morgenstern
6403337da6
New unique to designate when you need at least N buildings of a certain kind (#6113) 2022-02-06 23:55:44 +01:00
Yair Morgenstern
c9d487638c Added button to reload all rulesets - very helpful if you're working on mods and adding things gradually :) 2022-02-06 22:07:56 +02:00
Yair Morgenstern
9da66c8c08 Notification icons are now on the RIGHT so you can scroll notifications and find interesting ones faster 2022-02-06 19:58:22 +02:00
Yair Morgenstern
9726b90b22 tileCanBeImproved was never actually called without a unit. 2022-02-06 19:40:22 +02:00
Yair Morgenstern
b0b16787e4 Nicer 'move unit to tile' button 2022-02-06 15:29:42 +02:00
Yair Morgenstern
8efcd8cc2b Exploring and automating workers are some of the most common actions, they don't deserve to be behind a 'get additional actions' click 2022-02-06 15:11:03 +02:00
Yair Morgenstern
e466db397c Better mod loading error messages 2022-02-06 15:05:44 +02:00
Yair Morgenstern
5e29b1321b
Generalized tile conditionals (#6110)
Tiles can come from either
A. attackedTile
B. unit tile
C. City tile

All tile conditionals now work for all tile sources
2022-02-06 14:05:59 +02:00
Yair Morgenstern
f40ca8469f Updated battle table UI 2022-02-04 11:24:50 +02:00
Yair Morgenstern
4817f49ce9 Flood plains no longer generate on desert hills 2022-02-03 22:59:38 +02:00
Yair Morgenstern
27e383631d A couple more that were in Son of War 2022-02-03 20:16:10 +02:00
Yair Morgenstern
6654acd92e Added more deprecated uniques that I found still existing in LOTR Unciv 2022-02-03 19:46:10 +02:00
Yair Morgenstern
3661ad8d5b
Find all replaceable uniques, generate replacement text, check for compatibility, and replace! (#6105)
* Find all replaceable uniques, generate replacement text, check for compatibility, and replace!

All of the work up until now has lead up to this point - since we already know what's out and what to replace it with, we can do 90%+ of the work ourselves and spare the sanity of our modders

For an example run:
- Download your favorite mod
- Check its deprecated uniques in the options menu
- Run the autoupdater from the same menu
- See how they disappear
- Bask in the glory

* A few unreplaced uniques raised problems in some of the replacement texts

* Old unusable deprecated uniques are suddenly important again, because they can help autoupdate mods!

I'm wondering if to remove outdated mods entirely from the uniques.md, since they're going to keep accumulating

* Padding for the 'autoupdate' button

* Only display autoupdate button if there are unique to update
Also, fixed some of the revived deprecated unique's replacement text thanks to fancy new tests :)
Tech uniques autoupdate!

* Toast now pops correctly, added translation entries
2022-02-03 14:58:17 +02:00
Xander Lenstra
02c37f19fe
Fixed a bug where units requiring nearby units for bonuses could find themselves (#6104)
* Fixed a bug where units requiring nearby units for bonuses could find themselves

* Added requested changes
2022-02-03 14:51:04 +02:00
Yair Morgenstern
6925fc6909 Add mod folder to mod info when initializing mods so we don't have files pretending to be mods everywhere we try and find mod folders 2022-02-03 12:15:28 +02:00
Yair Morgenstern
89958e27ff
Options checks mods gradually and has expander tabs (#6099)
* Change options mod checking to check each mod individually, part 1 - change cell to table

* Mod checker now posts each mod separately by posting a new runnable each time one has completed

* Each mod now has its own expandertab so you don't need to scroll endlessly if you have a lot of mods

* Only enable 'check against vanilla' mod checkbox after all mods have been checked
2022-02-03 10:56:55 +02:00
Xander Lenstra
6a12db23e1
Fixed a bug where stats from uniques would exponentially grow (#6101) 2022-02-03 07:32:48 +02:00
Yair Morgenstern
57ada6aa27 Separated single unique check to a different function, so we can use it individually 2022-02-02 11:11:14 +02:00
Yair Morgenstern
9696fa59f5
Added unique to convert terrain to other terrain if adjacent to something (#6094)
* Added unique to convert terrain to other terrain if adjacent to something

Terrain converting to other terrain when adjacent to rivers was using hardcoded stuff, so I un-hardcoded it
I thought I could use this to replace the 'coast' hardcoding, and if it wasn't for the maxCoastExtension then I could.
Modders CAN therefore add their own coast (Lava tiles and Ash tiles I dunno) but it will only be for directly close terrains.
This enables Deciv Redux to spawn huge maps.

* Also for Vanilla, which apparently had a different number of tabs than G&K for no apparent reason.

* Apparently terrain name wasn't a uniquetype yet

(cherry picked from commit 593fc257b5)
2022-02-02 00:59:37 -08:00
Yair Morgenstern
423a83275b Lower-case "deprecated as of" to look nicer to users 2022-02-02 10:49:54 +02:00
Yair Morgenstern
fe14918545 Turned 'getDeprecationAnnotation' and 'getReplacementText' to functions for reusability 2022-02-02 10:48:26 +02:00
Xander Lenstra
ff2fc02961
Fixed a bug where open borders, war delcarations and cities could not be traded (#6097) 2022-02-02 07:23:11 +02:00
Yair Morgenstern
3c30a5697f Greatly reduced game loading times and new game screen thinking time by removing misspelling checks always except for options menu 2022-02-01 22:05:49 +02:00
Yair Morgenstern
593fc257b5 Apparently terrain name wasn't a uniquetype yet 2022-02-01 17:22:08 +02:00
Yair Morgenstern
18a86bf472 Don't generate ice if it isn't in the ruleset 2022-02-01 17:18:58 +02:00
Yair Morgenstern
5b39b59a19 There were several places in getMatchingUniques where conditionals were checked multiple times - now they're all checked exactly once 2022-02-01 15:39:01 +02:00
Yair Morgenstern
5a01a319be Simplified CityInfo.getMatchingUniques 2022-02-01 15:32:07 +02:00
Yair Morgenstern
6d3eabde22 Code cleanup 2022-02-01 15:18:23 +02:00
Yair Morgenstern
b1df775217 Apparently the code already existed, the problem was that the uniquetype wasn't marked as such 2022-02-01 14:59:52 +02:00
Yair Morgenstern
2e9bc1604f "Must be next to [terrainFilter]" applicable for improvements, as requested 2022-02-01 14:58:07 +02:00
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