Commit Graph

125 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
f217ce7055 Added check for deprecated uniques referencing other deprecated uniques (can happen if we replace uniques in quick succession and we forget to modify the older deprecated unique when we introduce the new one) 2022-02-02 11:25:35 +02:00
Yair Morgenstern
483a8eab1a Added test to ensure that deprecation texts are accurate to existing uniquetypes and conditionals
Tested that this does indeed break if you add a random space :)
2022-02-02 11:21:02 +02:00
Yair Morgenstern
b121563b99
Converted TileInfo.isCityCenter to use a transient var (#6058) 2022-01-27 00:57:38 -08: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
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
Xander Lenstra
6a8f88f202
Added a few more unit tests for global uniques (#6018) 2022-01-23 06:18:15 -08:00
Xander Lenstra
3e6a190ab4
Unit tests for uniques (#5945)
* Added a unit test file for uniques

* Added a few tests
2022-01-10 22:01:14 +02:00
yairm210
1999364b9e Chore - more typified unit uniques 2022-01-10 21:53:13 +02:00
Xander Lenstra
687ecb83f1
Merged some uniques and added a new one for not allowing to build units (#5731)
* Print stacktraces in more cases when crashing, useful for debugging

* Conditionalized no oceans before astronomy unique

* Cannot be built on tile before tech conditionalized

* Added "Cannot build unitFilter units" unique

* Fixed tests failing

* Merge branch master into some-uniques

* Fixed typo

* Apparently I made the same mistake twice

* Globalized unique
2021-12-31 12:13:09 +02:00
Xander Lenstra
003f2434c1
Differentiating Vanilla & G&K (#5654)
* Fixed tests checking for mod correctness

* Update G&K jsons to current vanilla versions

* First pass over buildings & beliefs

* First pass over nations

* First pass over eras.json

* Fully updated tech tree

* First pass over units

* Second pass over buildings -- fixed techs

* Fixed last prerequisites and row numbers of tech

* Went through the entire tech tree and moved things to their correct spot

* Fixed tests
2021-11-09 06:23:30 +02:00
SomeTroglodyte
6cc55dd1a9
Since TileInfo.tileResource is no lazy, a single test tile cannot change its resource around (#5522) 2021-10-20 16:38:15 +03:00
SomeTroglodyte
d25adacec7
Minimum city distance across continents (#5404) 2021-10-06 22:51:52 +03:00
SomeTroglodyte
726a1942db
Sharpen unit tests for UniqueTypes (and mod checker too) (#5398)
* Sharpen unit tests for UniqueTypes (and mod checker too)

* Sharpen unit tests for UniqueTypes - fix newly found problems
2021-10-05 09:08:41 +03:00
SomeTroglodyte
2e72fd52c8
Double movement unique parameterized (#5319)
* Double movement unique parameterized

* Double movement unique - all filters
2021-09-27 12:35:38 +03:00
Xander Lenstra
b7467d3467
Added support for conditionals to some more uniques (#5280)
* Added support for conditionals to some more uniques

* Implemented a new conditional

* Added the new conditional to the translations file

* Fixed tests

* Implemented requested changes
2021-09-22 09:24:16 +03:00
Xander Lenstra
f47f427b05
Adds conditionals to most of the uniques currently in the enum (#5270)
* Moved uniques to their own folder

* Added support for conditionals to most of the uniques in the current enum

* Deprecation > removal, of course

* Fixed tests & added `.removeConditionals` before checking for placeholders
2021-09-19 18:43:32 +03:00
Xander Lenstra
01bfd17594
Implementation of conditionals, but better than before (#5187)
* Implementation of conditionals, but better than before

* Updated the unique while I was at it

* Fixed bug where conditionals would never apply

* Capitalization

* Minor code cleaning

* Better documentation & variable names

* Changed translation strategy

* Added missing import?
2021-09-18 23:07:53 +03:00
Xander Lenstra
3722fab38d
From the indstrial era onwards, things change in religion (#5095)
* Improved redability

* From the industrial era onwards, religion goes into 'second phase'

* Fixed tests

* Fixed formula for buying great prophets starting from the industrial era

* Added `getMatchingUniques`, `hasUnique` to `IHasUniques`, cleaned up some code

* Fix compilation errors
2021-09-08 21:24:26 +03:00
Xander Lenstra
d1135f3d20
Fixes incorrect default paramter for starting era (#5119) 2021-09-08 20:44:50 +03:00
SomeTroglodyte
69e2828a0e
SerializationTests restore settings file (#5110) 2021-09-06 18:32:34 +03:00
Xander Lenstra
486e2a7a8a
Deprecate all mods without an eras.json file (#4809)
* Enforce the existence of an eras.json file for mods

* Merged `getEra()` and `getEraObject()`

* Hide mods we have deemed outdated

* Fixed compile errors that I didn't notice before

* Fixed unit tests
2021-09-06 14:50:38 +03:00
Xander Lenstra
9575b5bf66
Implemented renaming of religions (#5057)
* Implemented renaming of religions

* Made AskForText display error on invalid input, implemented recommended changes

* Almost forgot the translatable strings in the new popup
2021-09-02 17:40:10 +03:00
SomeTroglodyte
3b5489a3b4
Persistent new game setup (#5016)
* Persistent new game setup

* Persistent new game setup - comments
2021-08-29 20:40:13 +03:00
SomeTroglodyte
9df58ed240
Stats rework part 2 (#4983)
- Nicer iterators
- Callers adapted to simpler syntax
- CityStats changed to non-serializable
2021-08-25 19:02:42 +03:00
yairm210
5779bdaa4f Upgraded mockito versions.
Instead of forcing reflection to depend on latest kotlin version, I have a feeling the dependency is due to older mockito depending on older reflection.
2021-08-20 15:45:46 +03:00
yairm210
85ed8a27d3 Bumped sourceCompatibility to Java 7
Released in 2011 and by now technically out of support for 2 years.
Gotta roll with the times, but roll slowly.
2021-08-20 15:24:02 +03:00
SomeTroglodyte
076128a37e
Unit test catching un-annotated lazies (#4886) 2021-08-17 13:52:41 +03:00
SomeTroglodyte
8fdff9a940
Stats optimization (#4830)
* Stats rework part 1

* Stats rework part 1 -patch1

* Stats rework part 1 - documentation
2021-08-15 20:52:55 +03:00
SomeTroglodyte
ee32392ecd
Bring allUnitActionsHaveTranslation test up to date (#4688)
* Bring `allUnitActionsHaveTranslation` test up to date

* Bring allUnitActionsHaveTranslation test up to date - revert enum prop
2021-08-06 14:38:10 +03:00
SomeTroglodyte
9499471986
Change defeat conditions (#4761)
* Change defeat conditions

* Change defeat conditions - unit tests setup

* Change defeat conditions - patch1
2021-08-05 18:12:30 +03:00
Xander Lenstra
3b4b9a27bf
Split up unit types to its own JSON file (#4717)
* Split off unitTypes to its own json, only containing the domain it can travel in for now

* Updated translationFileWriter to handle this file correctly

* Updated promotions file

* Implemented requested changes

* Units without a sprite use the sprite of a first unit with the same type

* Implemented proposed changes
2021-08-03 19:06:59 +03:00
SomeTroglodyte
aa3be63492
Fix canImprovementBeBuiltHere regression (#4623) 2021-07-24 21:45:51 +03:00
SomeTroglodyte
6791dd3340
Deprecate "Can only be built on coastal tiles" unique (#4581)
* Deprecate "Can only be built on Coastal tiles"

* Deprecate "Cannot be built on bonus resource"

* Deprecate "Can only be built on Coastal tiles" - bump 'as of'
2021-07-23 13:19:35 +03:00
Xander Lenstra
253e62de72
City states give gold when met; updates to city state gold gifts (#4435)
* City States now give gold when met

* City States can now receive different amounts of gold, and the amount of influence gained from gifts follows the base game

* Implemented requested changes

* Fixed tests
2021-07-10 21:51:11 +03:00
Yair Morgenstern
20db11e73f Added a test to ensure that translations don't crash 2021-06-27 22:16:15 +03:00
SomeTroglodyte
21aa371cc3
Re-show redundant tech prereq mod errors without impeding playability (#4046)
* Re-show redundant tech prereq mod errors without impeding playability

* Re-enable playability of mods with less severe errors - fun version
2021-06-08 06:44:25 +03:00
Yair Morgenstern
3a22a1127e Gradle upgrade 2021-05-07 13:18:48 +03:00
Yair Morgenstern
738bc6caac Fixed tests 2021-05-05 18:45:48 +03:00
GGGuenni
b35d5d3121
changed hill to terrain Feature (#3707)
* changed hill to terrain Feature

* Update Terrains.json

* Update Terrains.json

* Snow with capital S

* Fixed tests failing

* Added check for ruleset supports hill as terrain feature
2021-05-05 17:48:47 +03:00
GGGuenni
b12c5df28e
last refactoring of terrain feature (#3702)
* last terrainFeature refactorings

* cut down terrainFeature as much as possible

* aerialDistanceTo fixed

wrapped distance should only be considered on wrapped worlds

* Adding spaces

* fixed tests not compiling

* prevent floodplains from spawning on oasis

* Check if terrain feature can be placed on tile in editor

* Adding reviewed changes
2021-03-18 13:54:52 +02:00