Commit Graph

364 Commits

Author SHA1 Message Date
SomeTroglodyte
2d4e8bc83e
Clean up github runner output (#11451) 2024-04-11 21:45:25 +03:00
Oskar Niesen
ef9965e218
Espionage Uniques, Buildings and Policy (#11401)
* Added OneTimeSpiesLevelUp, OneTimeGainSpy, SpyEffectiveness, EnemySpyEffectiveness and HiddenWithoutEspionage Uniques

* Spy effectiveness affects stealing tech and rigging elections

* Fixed HiddenWithoutEspionage

* Added Constabulary and Police Station

* Added cityFilter to SpyEffectiveness

* Added national Intelligence agency

* Added Great Firewall

* Fixed great firewall having a float value

* EspionageManager addSpy now returns Spy instead of name

* Added some simple espionage tests

* Fixed OneTimeSpiesLevelUp still wanting parameter

* Spy efficiency occurs after skill modifier

* Added another test

* Added Police State spy efficiency reduction unique

* Fixed "Hidden when espionage is disabled" wording

* Fixed "effectiveness" wording

* Changed "enemy spy effectiveness" unique to use negative matters

* Spy effectiveness only affect tech steal rate

* Changed "Gain an extra spy" and "Promotes all spies" uniques

* Removed Police State comment that is no longer accurate

* Changed spy effectiveness to be multiplicative
2024-04-09 23:12:21 +03:00
SeventhM
91f87fec9f
Allow improvements that don't need removal to build (#11299)
* Fix improvements that remove features only not checking for all terrains

* Allow improvements that don't need removal to build without improving resource

* spot the missing import

* Add in tests

* typo

* Assert Forest is still there
2024-03-17 23:12:24 +02:00
Oskar Niesen
c6058cdf73
Melee Escort Attacking Fix (#11310)
* Added a test

* Fixed melee units attack moving into tiles that the escorting unit can't move to

* Added tests

* Update core/src/com/unciv/logic/battle/TargetHelper.kt

---------

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
2024-03-15 11:30:37 +02:00
SeventhM
b60dabc089
Allow resources from follower beliefs (#11252)
* Allow resources from follower beliefs

* incorporate suggestions
2024-03-13 23:19:18 +02:00
Yair Morgenstern
b577f5ee9a
Fix double-count of civ-wide resources, while allowing propagation of city-wide resources via uniques (#11236)
* Fix double-count of civ-wide resources, while allowing propagation of city-wide resources via uniques

* Added test to ensure civ-wide resources propagate between cities (they do)

GetResourceAmount -> GetAvailableResourceAmount

* Extra clarity in function names! Better than possible confusion.
2024-03-03 20:02:21 +02:00
SomeTroglodyte
6a61a71c36
Type declaration colon blanks linting (#11216) 2024-02-28 23:46:21 +02:00
Oskar Niesen
04083de766
Added unit escorting formation!!! (#11057)
* Added escort button

* Added basic escort movement

* Improved escort movement

* Swapping breaks escorting

* Added stop escorting button

* Added link icon to unit

* getDistanceToTiles() now automatically includes escorting

* Multi-turn movement with different units works somewhat

* Escorting units persist to escort across saves

* Escorting units are only idle if their partner unit is idle as well

* Fixed multi-turn escort movement where one unit has more movement points left over

* Added basic tests

* Added a test for formation idle units

* Added some basic movement tests

* Added some canMoveTo tests

* getDistanceToTiles only caches when includeEscort is true

* added getDistanceToTiles test

* An entire commit to remove one line of white space just for you! And yes, there are no semi-colons;

* Added translations

* Added more stopEscorting() calls when the unit is removed

* Added extra comments and refactoring

* Refactored removeAllTilesNotInSet to use a mutableIterator

* Refactored code based on review

* Refactored removing tiles in PathsToTilesWithinTurn that aren't in another PathsToTilesWithinTurn
2024-02-24 22:39:04 +02:00
Yair Morgenstern
23edf07a41
Terraforming! (#11152)
* Terraforming!

* comment

* whoops

* And better tests, that actually output text.

* SomeTrog caught this doc error :)

* Fix natural wonder placement, it better belongs with base terrain
Also, normalize tiles to ruleset after plonking a new terrain

* Out Of Cheese Error, Redo From Start

- Only terrains, no improvements - one problem at a time
- Fit new functional trigger format
- Respect occursOn
- Teleport units out of tiles if they can't pass through (nat wonders for example)
- No need for terrainFeature unique parameter
- Tested with "Turn this tile into a [Grand Mesa] tile <for [0] movement>", "Turn this tile into a [Forest] tile <for [0] movement>" uniques

* Don't allow city tiles to turn into water/wonders etc kudos @SomeTrog
2024-02-20 23:38:23 +02:00
SomeTroglodyte
df7072b550
Clean up console output of unit test runs (#11134)
* Allow tests to discard console output selectively, by default collect and discard unless result is failure

* Fix debug change and a little source clarification
2024-02-16 11:57:42 +02:00
Yair Morgenstern
e7a2b94c60
SomeTrog's versioning test - compile on jdk 17 FOR jre 11, includes gradle upgrade (#11111) 2024-02-10 19:44:47 +02:00
SeventhM
d53766b7d7
Unify unit and civ triggers (#11011)
* 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>
2024-01-28 11:06:43 +02:00
SomeTroglodyte
e576b03fc6
Unit actions "paging" new architecture (#10988)
* 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
2024-01-24 23:43:31 +02:00
SeventhM
dabd105cf8
Allow units to upgrade to more than one unit (#10947)
* 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()
2024-01-24 23:43:07 +02:00
SomeTroglodyte
77c12fcae4
Unit actions builders use sequence (#10966)
* Change actionTypeToFunctions signature to use Sequence

* Linting and a little left pad for the unit action buttons
2024-01-21 19:14:54 +02:00
Oskar Niesen
169ccf5d03
AI worker road priority rework (#10918)
* 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
2024-01-21 19:12:14 +02:00
Oskar Niesen
c3a4b5f7af
Worker remove feature AI fix (#10917)
* Workers now value the improvement that they want to build after removing a terrain feature

* Restructured getImprovementRanking
2024-01-15 18:55:45 +02:00
SomeTroglodyte
975b2ba165
Unit test against unmatched placeholders in a translation (#10863) 2024-01-09 12:42:04 +02:00
SeventhM
665b5aa87c
Add unique to allow for generalized great generals (#10828)
* 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
2024-01-04 09:03:14 +02:00
Yair Morgenstern
35c19bf9de Fixed tests 2023-12-31 22:59:33 +02:00
Yair Morgenstern
783f846761 Remove source compatibility to java 8, in preparation for Gradle 8.5 upgrade
See #10740
2023-12-28 23:07:24 +02:00
Oskar Niesen
7745cd1c88
Worker AI Rework (#10776)
* 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
2023-12-28 22:42:11 +02:00
Yair Morgenstern
b56a168e86
Save city focus as string, to allow changes in available city focuses without breaking games (#10794) 2023-12-22 10:07:28 +02:00
dHannasch
4b5bb54b72
Add BaseUnit.automaticallyUpgradedInProductionToUnitByTech() (#10664)
* Update BaseUnit.kt

* Update RulesetValidator.kt

* Update BasicTests.kt

* Update BaseUnit.kt

* Update TechManager.kt

* Update BaseUnit.kt

* Update BaseUnit.kt
2023-12-17 22:00:45 +02:00
Yair Morgenstern
2ae5a018de Added initial pathfinding tests 2023-12-08 14:48:48 +02:00
Yair Morgenstern
cce678800f Fixed pillage tests 2023-12-08 14:10:56 +02:00
Yair Morgenstern
8f049f45f1 Standardized 'create improvement' uniques - need to remember to deprecate the water improvements! 2023-12-07 19:47:45 +02:00
dHannasch
155498dc43
Wrap BaseUnit.obsoleteTech into function (#10648)
* Update BaseUnit.kt

* Update BaseUnit.kt

* Update TechManager.kt

* Update BaseUnit.kt

* Update RulesetValidator.kt

* Update BasicTests.kt
2023-12-03 22:26:16 +02:00
Oskar Niesen
f1ceaa216a
Get distance to nearest enemy rework (#10481)
* 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>
2023-11-25 20:11:10 +02:00
SomeTroglodyte
987f67d9cd
[code quality] Reorg, clean up and comment a few things (#10527)
* 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)
2023-11-19 23:52:15 +02:00
Yair Morgenstern
fb1e57668e Added tests for parameters for complex filters, fixed nested complex filter returning 'possible filtering' when it should have been known 2023-11-19 00:06:34 +02:00
Framonti
8c9e6b07e0
Test/add tests for cityexpansionmanager (#10510)
* improve error message and add test for precondition checking

* add tests for CityExpansionManager
2023-11-18 22:34:26 +02:00
Yair Morgenstern
dc6413d707 Modding: Added "non-[filter]" filtering for unit filters
Cleaned up unit filter validations to match actual filters
2023-11-18 22:16:43 +02:00
SomeTroglodyte
cfeed82800
Whitespace linting for opening curly braces and inheritance colon (#10490) 2023-11-13 22:11:55 +02:00
Framonti
02844e51d7
add tests for CityFounder (#10439)
* 🎨 add spaces to better format code

*  add tests for CityFounder

* ️ exploit early returns to avoid computing some values
2023-11-07 10:39:34 +02:00
Framonti
e9b3ec5282
fix flaky tests by properly assigning pop to work on specific tile (#10421) 2023-11-04 21:24:26 +02:00
Yair Morgenstern
e43d870b43 Fastlane fixes 2023-10-30 12:43:28 +02:00
Yair Morgenstern
f9134c90dc @Framonti
This test seems to be flaky - works from my computer but fails sometimes on github
2023-10-30 11:11:11 +02:00
Framonti
f27fa7bab6
💚 add tests for city population manager (#10347) 2023-10-29 18:59:38 +02:00
SomeTroglodyte
13e3baac74
Split Fonts.kt (#10267)
* 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
2023-10-08 22:03:53 +03:00
Yair Morgenstern
2bd65f9f42 chore: Extracted all 'next turn' logic from DiplomacyManager to DiplomacyTurnManager 2023-10-08 11:48:33 +03:00
SomeTroglodyte
49e2979427
Align ruleset icons in text to font metrics (#10233)
* 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
2023-10-07 22:00:30 +03:00
SomeTroglodyte
5db8489bcb
Tweak FasterUIDevelopment to offer normal Scene2D debugging, and some linting (#10263) 2023-10-07 21:58:19 +03:00
Framonti
3a3abd20fa
add golden age manager tests (#10226)
* 🚚 move test to right package

* 💚 add tests for golden age manager
2023-10-03 13:04:44 +03:00
SeventhM
98533b91f9
Reimplement and fix #10142 (#10213)
* 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
2023-10-03 12:10:43 +03:00
Framonti
b01353eee7
Test city conquest functions (#10196)
* 💚 add tests covering most city conquest functions

* ♻️ change var to val when values don't change
2023-09-29 16:27:43 +03:00
Yair Morgenstern
190d488c06 modding: Mod checker displays *all* unknown uniques 2023-09-28 20:46:31 +03:00
Yair Morgenstern
d1b2d652e3 reorg: Separated UnitActions into 3 files:
- UnitActionsFromUniques
- UnitActionModifiers
- UnitActions retains actions relevant to all units
2023-09-28 15:30:39 +03:00
Yair Morgenstern
b6f3c8571f chore: Move files to correct folders 2023-09-27 13:19:13 +03:00
Yair Morgenstern
0d942ac175 Reload images when downloading or removing a mod 2023-09-21 14:58:23 +03:00
Framonti
26bae52508
💚 add tests covering most nukes functionalities (#10146) 2023-09-19 10:31:39 +03:00
Framonti
fba3198887
Unit tests for Battle.kt (#10127)
*  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
2023-09-14 18:53:40 +03:00
Oskar Niesen
ee81b3e84e
Defensive pact Tests (#10088) 2023-09-11 09:06:09 +03:00
Framonti
885675bea3
💚 add tests for Diplomacy manager (#10087) 2023-09-09 21:27:03 +03:00
Yair Morgenstern
30570747a8
Unify placeholder parsing for unique parameters (#10072)
* Unify placeholder parsing for unique parameters

* Remove double "remove conditional" call - kudos @SomeTroglodyte
2023-09-07 09:57:40 +03:00
Yair Morgenstern
55a3fa2a75 cleanup: Copy Zero vectors before passing to localToStageCoordinates (#10048) 2023-09-06 12:38:14 +03:00
Framonti
538330db87
Test/refactor target helper and test it (#10048)
* ♻️ 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
2023-09-05 22:25:28 +03:00
Yair Morgenstern
93f882d3c8 tests: Load vanilla game test fixed 2023-09-04 17:08:52 +03:00
Yair Morgenstern
df03f36207 chore: Added missing imports 2023-09-04 16:09:55 +03:00
Yair Morgenstern
f4c7dc4890 chore: Reorg tests, so /testing folder contains only test-helper classes 2023-09-04 16:06:06 +03:00
Framonti
7952366afb
Refactor BattleDamage object and test it (#9992)
* 💡 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
2023-08-30 23:37:10 +03:00
Yair Morgenstern
5585dfa470 Resolved #10005 - Great person points for units not in ruleset are ignored, and warned against 2023-08-30 23:10:14 +03:00
SeventhM
bda3215006
Refactor: Remove unnecessary ruleset checks (#9973)
* address unnecessary ruleset checks

* Add missing imports

* Fix units not getting the ability uses set if it the city has your own religion

* Remove unnecessary cityConstructions check

* Remove more cases of unnecessary ruleset checks
2023-08-27 22:48:20 +03:00
Framonti
53748a40d7
Add tests for city class and introduce small refactor (#9965)
* ♻ extract methods to improve readability

* 💚 introduce tests for city logic
2023-08-24 17:14:02 +03:00
SeventhM
67adabb78f
Additional unit tests (#9866)
* Additional unit tests

* Missing import

* Changing stuff solely to avoid an import

* Example of the test, in different orders

* New PromotionTree test

* Add functions to make PromotionTree easier to work with

* Changing values to be lateinit variables
2023-08-17 09:17:23 +03:00
Yair Morgenstern
0561a7951c Much more accurate improvement stat effects 2023-08-09 00:46:33 +03:00
Yair Morgenstern
60ea752c1f chore: Modernized DiplomacyManagerTests 2023-08-08 23:55:37 +03:00
Yair Morgenstern
3cbd447620 Removed HandleImprovementCompletion function, added test for citadel tile takeover 2023-08-08 22:00:18 +03:00
Yair Morgenstern
55b4191be3 changeImprovement now contains 'terrain feature removal' logic 2023-08-08 19:25:51 +03:00
Yair Morgenstern
d9ceb9290d 4.7.12-patch1 2023-08-04 09:21:51 +03:00
SomeTroglodyte
bcb26b6d2a
Treat remaining untyped Uniques in default rulesets (#9763)
* Treat remaining untyped Uniques in default rulesets, make unit test catch them

* Change untyped filtering Uniques check to Validation by inclusion in GlobalUniques instead of UniqueType.AircraftMarker

* Wiki for untyped filtering Uniques

* Re-include the "Who knows" of Future Tech on the Tech picker
2023-08-03 11:38:50 +03:00
Yair Morgenstern
fc40da11d9
Added tests to ensure that resources from buildings behave as expected (#9860)
* Added tests to ensure that resources from buildings behave as expected

* More tests suggested by @SeventhM

* Caught an edge case - if you pillage your own tile improvement, your resources would not have updated!

* Actually every time an improvement changes you could have a resource change

* Update resources eon every improvement change because they could be providing resources via uniques
2023-08-03 11:38:36 +03:00
SeventhM
eb17398d78
Modernize Connection Tests (#9831) 2023-07-23 08:18:39 +03:00
SeventhM
1ca9766811
Fix issues when transferring capitals (#9801)
* Revert previous patches

* Fix the unit test, I guess
2023-07-18 18:08:30 +03:00
SeventhM
1e66c2e131
Avoid built buildings (#9806)
* Removing most interactions with builtBuildings

* Might as well edit this too

* Fix issues and edit isBuilt

* Simplify isAllBuilt
2023-07-16 23:01:17 +03:00
Yair Morgenstern
ee092a5851
City-level resources (#9774)
* City-level resources are...
- Not displayed in civ top bar
- Not considered civ-level resources (for trade, non-city conditionals, etc)
- Are explicitly treated in city conditionals
- ARE considered for constructing buildings requiring resource
- ARE NOT considered for construction units requiring resource

* getCityResources separates resources by origin so we need to sum them - kudos @SeventhM

* CR fixes

* Added new Civilization.getResourceAmount function

* More usages of civInfo.getResourceAmount()

* Don't add city resource table if it's empty
2023-07-10 16:24:50 +03:00
Yair Morgenstern
19bf15558d Fixed India's 'double unhappiness' unique 2023-07-05 21:10:22 +03:00
Yair Morgenstern
c787ab1a30 chore: Modernized WorkerAutomationTest 2023-07-04 15:09:40 +03:00
Yair Morgenstern
86cde678b3 chore: Modernized TileImprovementConstructionTests 2023-07-03 23:43:03 +03:00
Yair Morgenstern
537ebdcbdd chore: Modernized VisibilityTest 2023-07-03 22:28:04 +03:00
Yair Morgenstern
06377feaeb 4.7.6-patch2
Resolved crash when moving cities between civs, added tests to ensure future changes do not break city moving functionality
2023-07-03 14:13:31 +03:00
Yair Morgenstern
afbf772d3d Modernized UnitMovementTests to use TestGane 2023-07-03 13:33:35 +03:00
Yair Morgenstern
6eeb630b6c chore: 'cityInfo' purge (changed to 'city' everywhere) 2023-06-28 23:38:01 +03:00
Jack Rainy
82ebb01a20
Zoom in/out of the history charts (#9660)
* Do not recreate the Line Chart every time

* Simplifed the Line Chart creation

* Do not create objects in draw(): VictoryScreenCivGroup table

* Do not create objects in draw(): Labels

* Create labels without negative Y

* Lift the X axis if there is an negative number

* Arbitrary number of -Y labels

* Autoscale by Y axis

* Zoom in/out by click

* Autoscale by X axis

* Unit tests for LineChart

* Rework of the line chart rendering
2023-06-25 09:37:08 +03:00
Xander Lenstra
aa0fb9ed8b
More unit unique tests (#9639) 2023-06-25 09:35:31 +03:00
Xander Lenstra
639d34e28d
Reordered the region of other global uniques and wrote a few unique tests (#9611) 2023-06-17 20:59:51 +03:00
SomeTroglodyte
936b9e34ef
Fix and unit-test Hakkapeliitta TransferMovement ability (#9539) 2023-06-07 13:35:53 +03:00
janarvid
ff9d5ff9c1
Fix bug worker will not replace improvement to enable strategy resour… (#9449)
* Fix bug worker will not replace improvement to enable strategy resources #9328

* Make test logic more clear and add some comments
2023-05-28 17:52:37 +03:00
alexban011
91116f8df3
Fixed more warnings (#9401)
* fix: fix FunctionParameterNaming warnings

* fix: fix InvalidPackageDeclaration warnings

* fix: fix MatchingDeclarationName warnings

* fix: fix WrongEqualsTypeParameter warnings

* fix: fix UnusedPrivateProperty warnings

* fix: fix UseCheckOrError warningsU

* fix: fix UseRequire warningsU

* detekt: disabled SpreadOperator rule

* fix: resolve MemberNameEqualsClassName rule

* detekt: disabled ForbiddenComment rule

* fix: resolved SwallowedException warning

* fix: resolved ThrowingExceptionsWithoutMessageOrCause warning

* fix: resolved EmptyFunctionBlock warning

* fix: resolved EmptyFunctionBlock warning

* fix: resolved InstanceOfCheckForError warning

* detekt: disable TooGenericExceptionCaught warning

* detekt: disable TooGenericExceptionThrown warning

* fix: resolve part of NestedBlockDepth warnings
2023-05-18 10:12:33 +03:00
alexban011
f3e80a4021
Fixed a couple warnings reported by code analysis (#9364)
* fix: resolve EmptyCatchBlock warnings

* fix: resolve PrintStackTrace warnings

* fix: resolve SwallowedException warnings

* fix: resolve ThrowingExceptionsWithoutMessageOrCause warnings

* fix: resolve ConstructorParameterNaming warnings

* fix: resolve FunctionParameterNaming warnings

* fix: resolve InvalidPackageDeclaration warnings

* fix: resolve ForEachOnRange warnings

* fix: resolve ImplicitDefaultLocale warnings

* fix: resolve MayBeConst warnings

* fix: resolve NewLineAtEndOfFile warnings

* fix: resolve UnusedParameter warnings

* fix: resolve UtilityClassWithPublicConstructor warnings

* fix: resolve WildcardImport warnings
2023-05-10 11:43:53 +03:00
Yair Morgenstern
ac63a6453b Fix tests 2023-04-25 18:02:37 +03:00
Yair Morgenstern
cb20d91822 Battle table displays bonuses according to tile that unit will attack from, not the current tile it's on 2023-04-08 21:34:55 +03:00
SomeTroglodyte
2150fc2244
Random nation count (#9118)
* Fix game starter problems with random number of players

* Some cleanup to use new Player constructor signature
2023-04-04 23:41:45 +03:00
Yair Morgenstern
a37391781a Fixed tests 2023-04-03 13:56:13 +03:00
SomeTroglodyte
45d66f0580
Civilopedia Welcome, moddable (#8940) 2023-03-31 14:58:07 +03:00
SomeTroglodyte
da7786a2cb
More Spectator/Barbarians fixes related to income (#9011)
* Prevent Barbarians and Spectator having income or Allies

* Prevent Barbarians and Spectator having income or Allies - fix test
2023-03-23 23:57:23 +02:00
WhoIsJohannes
11be6e2804
Silently log ranking stats for each major civ every turn (#8964)
* Record each stat each round for each civilization.

* Implement custom serialization and encapsulate logic in separate CivRankingHistory.kt

* Address comments

* Address comments and add RankingTypeTest.kt
2023-03-21 14:38:22 +02:00
SomeTroglodyte
dabd26ac0d
Fix Great Person Create Improvement requiring Resource (#8979)
* Fix GP create with Improvement requiring Resource

* Unit Test: GP create with Improvement requiring Resource
2023-03-21 14:06:35 +02:00
Yair Morgenstern
2d6a88f3e3 Resolved #8968 - stats for notifications string'd without special characters 2023-03-20 00:41:58 +02:00
Yair Morgenstern
a37eb28964 UnitMovementAlgorithms -> UnitMovement and modernized city connections tests 2023-03-20 00:20:34 +02:00