* 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
* 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
* 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
* 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
* 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>
* 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>
* 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>
* 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
* 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>
* 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
* Change Embarked Defending Strength per era. Update Tutorial a little
* Use JSON implementation of EmbarkDefense
Co-authored-by: itanasi <spellman23@gmail.com>
* 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
* 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>
* 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
* 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
* Make multiple defense bonuses stack
* Switch to check base terrin and Natural Wonders using getAllTerrains()
Co-authored-by: itanasi <spellman23@gmail.com>
* 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
* 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
* 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>
* 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>
Fixed icon and text for resource stats improvements in Improvement Civilopedia pages
Fixed 'null' for improvement picker for some resource-only improvements
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
* 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>
- "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
- 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")
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
* 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
* 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
* 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
* 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
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
* 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
* 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
* 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)
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.
* 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
* 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
* 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
* 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
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!
* 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
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!
* 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
* 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>