yairm210 / Unciv

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

Force calculations getting massively screwed up in Wakanda mod #12001

Open SpacedOutChicken opened 3 months ago

SpacedOutChicken commented 3 months ago

Is there an existing issue for this?

Game Version

4.12.12-patch2

Describe the bug

Something about the Black Panther unit in my Wakanda for Unciv mod is messing up the force calculator. The unit itself has a base strength of 20, but it scales with era (maximum strength bonus is 400% during the Future era). Building this unit causes the force calculator to give the civilization a strength of over 800,000. The unit is not actually that overwhelmingly strong.

Steps to Reproduce

  1. Enable Wakanda for Unciv mod
  2. Build the Sacred Mound, causing the Black Panther unit to appear
  3. Wait one turn for the force calculator to catch up to the changes made
  4. The force displayed will now be unreasonably large

Screenshots

Screenshot (212)

Link to save file

https://github.com/SpacedOutChicken/Wakanda-for-Unciv

Operating System

Windows

Additional Information

No response

SomeTroglodyte commented 3 months ago

Seems like an overarching problem, not limited to era conditionals: https://github.com/yairm210/Unciv/blob/0f2a697ba65693f52570c9e4f9fc4ee728ed20ca/core/src/com/unciv/models/ruleset/unit/BaseUnit.kt#L488-L504 ... Any conditional not special-cased in that if (bad - should be when) decision tree is ignored and the Strength bonus evaluated as if unconditional, thus multiplying like rabbits. Simplest would be testing unique.conditionals.isEmpty and only applying full bonus in that case, dropping the else (so zero bonus if no known conditional recognized). Better would be to think of a system to force conditionals that can apply to Strength to define a power calculation weight.

SomeTroglodyte commented 3 months ago

Actually, adding a new metamodifier <Weight for AI force calculation = [amount]> or somesuch, then deprecating the big if might be the best answer...? ... PR done. If it is merged, I'd add <Weight for AI force calculation = [100]%> to the medieval one, which gives the BP ~500 points...

github-actions[bot] commented 6 days ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 15 days.