yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.5k stars 1.58k forks source link

Unable to upgrade some units. #10603

Closed Dark0-04 closed 11 months ago

Dark0-04 commented 11 months ago

Is there an existing issue for this?

Game Version

4.9.1

Describe the bug

Units requiring a building cannot be upgraded, even when the required technology is unlocked and the necessary building is constructed. The bug only affects the Alpha Frontier mod.

Steps to Reproduce

  1. Create a game with Alpha Frontier
  2. Train a Rover Explorer
  3. Research “Robotics” technology and build a Rover Storage.
  4. Upgrade the already existing Rover Explorer : the upgrade button does not exist.
  5. Note that you can still train Combat Rovers, but existing Rover Explorers cannot improve. Also note that the bug seems to affect all units that require a building, almost half of the units.

Expected Behavior

The button “Upgrade to Combat Rover” should appear

Screenshots

Screenshot_20231127_211618_Unciv

Screenshot_20231114_114443_Unciv

Link to save file

No response

Operating System

Android

Additional Information

Bug already reported on discord and also spotted by other people

Dark0-04 commented 11 months ago

On my screens, I also use the Deciv in Alpha Frontier mod, but the bugs are also present on the original version of Alpha Frontier ! [Uploading Screenshot_20231127_211618_Unciv.jpg…]()

Dark0-04 commented 11 months ago

On the screenshots, I also used the "Deciv in Alpha Frontier" mod, but the bug also appears on the original version of Alpha Frontier.

Screenshot_20231127_211618_Unciv

SomeTroglodyte commented 11 months ago

... and how do you figure this is a bug in Unciv's code, not the mods?

yairm210 commented 11 months ago

Definitely an Alpha Frontier issue, not a general Unciv issue In fact, copy of #https://github.com/carriontrooper/Alpha-Frontier/issues/60

SomeTroglodyte commented 11 months ago

TLDR: Mod Error as in, not respecting the unwritten rule that OnlyAvailableWhen in the Unit upgrade code will only function with Conditionals testing the civ or unit itself, no others. Or - our error if we were to say we want that combo supported.

Long version: This raises questions...

![image](https://github.com/yairm210/Unciv/assets/63000004/f4069d65-e652-4fec-8162-45dd25bc7aaf)
SeventhM commented 11 months ago

...Or Alpha Frontier can use the Unbuildable unique. There's a slight bug there too, but it's definitely a faster PR to parse

SeventhM commented 11 months ago

For the record, imo the better solution is for the upgrade logic to know that city based should be considered irrelevant. Probably the easiest way actually should be that conditionals that relies on city data maybe should pass as true (as if they were never there). Idk if that'll have any consequences elsewhere. Though in this case, we happen to just have an alternative unique to make this a nonissue

hackedpassword commented 11 months ago

We have no declarative compatibility matrix which Conditionals can work on which UniqueTypes

Wow, the post I needed! Spent hoursssss deciphering unique-conditionals that look like they should work...

In general, a compatibility matrix would be a godsend for compatibility reference. These unwritten rules are doing neither the modder nor player any good. The Unciv documentation is great, but uniques behavioralisms could use a serious documentation injection. Idea:

The uniques page lists all individual uniques. As efficient and neat as it is to list each unique one time, because of fuzzy overlaps between uniques and conditionals (plus everything else), is it possible to have a drop-down compatibility revealer that then lists each specific compatible unique, for that unique?

Or:

Activate the wiki feature in the Unciv repo here, do the above, but in the form of say, Minecraft compatibility tables. Please look at that link, at the several tables shown. Unciv uniques have complexities that I believe can be mapped similar to how Minecraft has disambiguated N-dimensional assets and entity relationships.

yairm210 commented 11 months ago

There are 2 different issues One us "what unique good on what object" and for that there is a dropdown The other is "what conditionals go on what unique types" and that isn't mapped, should be mapped in the enum, not a problem but yes something we'll need to put thought into

That then leads to: