Commit Graph

4419 Commits

Author SHA1 Message Date
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