* Unify unit and civ triggers
* Update conditionalsApply check
* add tile in the city override
* Add StateForConditionals for unit uniques when founding a city
* Accidentally removed unit triggers from uponBuildingImprovement
* Accidentally removed parenthesis
* add "tile = tile" to improvement trigger's StateForContitionals
* Add unit's tile to default tile
Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
* Accidentally did getMatchingUniques instead of getTriggeredUniqued
* Merge triggerUnitWideUniques into TrigerUniques
* checkOnGameInfo Helper to shorten line length
* StateForConditionals secondary constructors
* accidentally deleted
* also accidentally deleted
---------
Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
* Linting (and prioritize addGiftAction efficiency over the get used only by unit test)
* Move "paging" out of MapUnit, drop Normal/Additional getter split, "page" preference via UnitActionType
* Optimize UnitActions API a little - fallback does not enumerate actionTypeToFunctions again
* Cleaner access to GiftUnit action from unit test
* Allow freely switching from Sleep to Sleep-until-healed and back
* Allow units to upgrade to more than one unit
* Actaully add changes to Base Unit
* And actually add the unique
* Kdocs fixes
* upgradeUnits to getUpgradeUnits and add missing state for condititonalss
* unique.params[0] shouldn't be empty..., right?
* Make old var first in the list, in case it matters
* wait... We're never yielding a null result
* Remove unnecessary function call
* Remove some indentation in RulesetValidation
* isEmpty instead none
* min cost instead of first
* Ruleset helper functions
* Imports
* helper functions part 2
* sanity check in case the unit actually isn't upgradable here
* I missed a spot
* This is NOT using a filter, itis looking for a unitName. Also, why do we use "unit" instead of "unitName"?
* Avoid crash in Scene2dExtentions, part 1
* Avoid crash in Scene2dExtentions, part 2
* inevitable request to move it to its own function
* Upgrade to the correct unit when upgrading all units
* Kdocs I overlooked
* Whoops
* Revert kdocs changes
* Should probably make sure action isn't null
* Fix loop in checkUnitRulesetInvariant
* Minor irrelevant fix
* No response, Removing getUpgradePath part 1 as it's redundant if we upgrade one at a time
* Move to UnitAutomation
* Imports
* Irrelevant fix: ignore consturctionRejections for upgrades
* Irrelevant fix: We should be able to upgrade to obsolete units, just not build new ones
* Simplify for clarity
* Irrelevant fix: unit is not destroyed is it doesn't upgrade
* Whoops
* Imports
* Remove getUpgradePath part 2: simplify UnitAutomation
* Remove now unnecessary circular reference check. We already check if it upgrades to itself
* Whoops, if we use a special upgrade, we should go back to a normal upgrade if we find no special upgrade unique
* Basic tests for last commit
* Forgot special to normal upgrade test
* whoops, forgot to change comment
* Not at computer: List.isEmpty to Sequence.none
* Not at computer: List.size to Sequence.count()
* WorkerAutomation now caches the roads to use
* Workers now build roads differently
* Fixed error if unit movement is zero
* Fixed civ researching an unwanted tech in a test
* Fixed spelling
* Increased road building priority
* getRoadConnectionBetweenCities no longer does unnecessary sorting
* roadsToConnectCitiesCache no longer stores roads that are already built
* ChooseImprovement now builds roads on resource tiles!
* Fixed tryConnectingCities error related to using minByOrNull instead of firstOrNull
* Roads can't have a negative value if they are bigger
* Add unique to allow for generalized great generals
* Don't add compatibility for rulesets with conditional generals
* Add to rulesets
* add in pre Kotlin 9 parenthesis
* whoops missed a parenthesis
* I guess pre Kotlin 9 parenthesis was unnecessary, whoops
* Add back old variables to clone function
* Move the list of all potential generals to Ruleset
* Move list of unit construction rejections to IConstruction
* flip !any{} to none{}
* Fix imports
* Typo
* WorkerAutomation now uses UnitAutomations's getDangerous tiles
* getPriority now values the current unit tile
* getPriority now values if the tile is worked instead of if it provides a yield
* getPriority prioritises clearing fallout
* getPriority prioritises new resources
* Fixed error in WorkerAutomationTest
* FindTileToWork now uses tilesToAvoid instead of checking for enemies itself
* Workers prioritise their own tile first
* Began reworking tile priority
* Changed getBasePriority() to account for tile damage
* findTileToWork now groups tiles and finds the best tile from the top group
* Fixed method calling findTileToWork()
* Workers don't build roads if their GPT is below 20
* Workers have multiple stages of wanting to connect cities
* Workers prioritise best tiles based on closeness
* Changed stuff
* Fixed a situation where a worker would be on a tile without improving it
* Reduced city connection priority
* Worker prioritises improving closer tiles more
* Worker prioritises improvements that are closer to being finished
* Reverted changes that broke tryConnectingCities more (it is already a little broken)
* Improved repair priority
* Added cityDistanceWant to tryConnectingCities
* Created a partial Test
* Finished first test
* Fixed a merge issue
* Fixed tileHasWorkToDo not accounting for base improvement values
* Added a failing test
* CityPopulationManager now assigns population to tiles in a predictable way for the Worker BasePriority tileProvidesYield
* Added an extra test with two cities and no roads
* Fixed Test creating new workers which ends up failing the test
* Test no longer research and have unnecessary research
* Test no longer include city center tiles as improvements built
* Added a failing test and removed a tryConnectCity filter
* Workers now improve tiles with unseeable resources on them
* Added a resource test
* Fixed should build roads in turns test
* Added an extra test
* tryConnectingCities takes into account the improvement priority
* Separated the improvement stat bonus from the base priority for tryConnectCities
* getBasePriority() now ranks a tile based on its base stats
* replaced mostUnderdevelopedCity with closestUnderDevelopedCity
* changed build road distances wanted
* getImprovementRanking now accounts for resources
* tilePriority now uses a float instead of an int
* Fixed float to int conversion in SpecificUnitAutomation
* Added a test for pillaging
* Initial refactor
* Moved checking if a tile has an enemy to a new method
* Rewrote getDistanceToEnemyUnit
* changed the position of the logic of checking if the enemy is still there
* Changed some of the other methods to use the ThreatManager getClosestEnemy()
* Added a new getTilesWithEnemyUnitsInDistance method
* Added a new getEnemyMilitaryUnitsInDistance method
* Converted a few lines to use ThreatManager
* Changed Air units to use threat manager
* Fixed tileWithEnemy error
* distanceToClosestEnemyTiles now clears at the start of every turn
* Added blank lines to end of ThreatManager.kt
* Renamed tilesInRange to tilesWithEnemyUnitsInRange
* Changed ArrayList return to a MutableList
* Removed ClosestEnemyTileData being a data class
* Improved commenting
* Improved commenting2
* getEnemyMilitaryUnitsInDistance now uses a flatMap and moved getDangerousTiles to threat manager
* Created a new helper method getEnemyUnitsOnTiles
* Renamed clearThreatData to clear
* Added shortcut if maxDist is less than or equal to distanceSearched
* Fixed distanceWithNoEnemies in getTilesWithEnemyUnitsInDistance
* Fixed notFoundDistance being higher than maxDistance when takeLargerValues is false
* Added some ThreatManager tests
* Added some more ThreatManager tests
* Removed visible map after use
* getTilesWithEnemyUnitsInDistance doesn't search distances <= tileData.distanceSearched (previously was <)
* Added 3 more tests
---------
Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
* UncivGame is a pure class file again, GUI split off
* Purify GameSettings step 1 - non-multiplayer nested classes
* Purify GameSettings step 2 - multiplayer nested classes
* Purify GameParameters - BaseRuleset to own file
* Rework WindowState to centralize minimum/maximum treatment
* Rename MultiplayerTurnNotifierDesktop to UncivWindowListener
* Clarifications on what the WindowListener actually does (and now the attention-getting does something on non-Windows too)
* Fix font "symbols" not showing
* Move Fonts.kt to sub-package
* Re-sort imports
* Move top-level constants to prepare split
* Split Fonts.kt each existing class to its own file
* Split off FontRulesetIcons
* Linting and comments
* Try to respect actual font layout, so fontSizeMultiplier works for ruleset icons too
* Replace font-based nation symbol in top bar with statically sized actor
* Reuse getReadonlyPixmap in extractPixmapFromTextureRegion
* Tweak topbar selected civ vertical align to be more pleasing to the human eye
* FasterUIDevelopment missing implementation of FontMetricsCommon
* Address hardcoded pixel coordinates comment
* Readability and comment cleanup
* More readability changes
* Test Free Buildings
* Flip the order of logging free buildings to avoid loops with stat buildings
* unprivate constructionComplete for the notification and add validating the queue to addBuilding
* reimplement #10142
* Switch free buildings in cityFilter to also use constructionComplete for consistency
* ✨ add testing helper function to create the barbarian civilization
* add tests for Battle class
* add more tests for Battle class
* ♻️ let compiler infer types
* add helper test methods to create unit with uniques
* use unit with unique explicitly created to loose tests from specific ruleset
* add even more tests for Battle
* ♻️ merge together two branches executing same code
* ♻️ swap if-else chain with when to improve readability
* ⚡️ swap conditions to first check the lighter computationally-wise
* ♻️ extract method to increase readability
* 💚 add some tests for TargetHelper
* 💡 add comment explaining how Unciv grid system works using a graphical example
* 💚 add other tests
* ♻️ change method name to better reflect what it does
* 🐛 fix import after rebase
* 🔥 remove parameter when value is the default and use static field for Vector2(0f, 0f)
* ♻️ split setTileTerrainAndFeatures in two different methods
* ♻️ update older tests to use the new functions
* 💡 add some comments providing examples
* ♻ refactor getGeneralModifiers to increase readability
* ♻ refactor getAttackModifiers to increase readability
* 🏗 move constants expressed as magic number to separated class to increase maintainability and expressivity
* ♻ invert condition to remove continue statement and simplify code
* 💚 add some tests for battle damage class