LoneGazebo / Community-Patch-DLL

Community Patch for Civilization V - Brave New World
Other
286 stars 158 forks source link

Strange interactions between Himeji castle and Shoshone (boost to CS in friendly lands) #1652

Closed oalzubbi closed 8 years ago

oalzubbi commented 8 years ago

I have Himeji castle built in one of my cities (granting +15% cs in friendly lands). I am at war with the Shoshone. We are both getting the friendly lands bonus when his units are in my lands and vice versa.

http://steamcommunity.com/sharedfiles/filedetails/?id=671434251

http://steamcommunity.com/sharedfiles/filedetails/?id=671741344

LoneGazebo commented 8 years ago

@ilteroi , any ideas here?

ilteroi commented 8 years ago

can't even find where the bonus from wonders is applied ...

i did see a merge error or a copy/paste error though which might affect the bonus in enemy lands. but that's not the bug we're looking for :)

LoneGazebo commented 8 years ago

might be if there's an issue where the shoshone should have had that bonus.

I think wonder bonuses are applied at the plot level, right?

ilteroi commented 8 years ago

ok, observations. unfortunately there are many variables here. so let's try to look at both modifiers separately first.

shorthand for below: H - himeiji castle owner S - shoshone T - third party N - neutral

shoshone only:

  1. S in S plot vs T in S plot : (+15,0)
  2. S in T plot vs T in T plot : (0,0)
  3. S in N plot vs T in N plot : (0,0)
  4. S in S plot vs T in T plot : (0,0) -> unclear

himeiji only:

  1. H in H plot vs T in H plot : (0,0) -> NOK
  2. H in T plot vs T in T plot : (+15,0) -> NOK
  3. H in N plot vs T in N plot : (0,0)
  4. H in N plot vs T in T plot : (+15,0) -> NOK

it seems himeiji bonus is applied if the defender is in its own territory. interesting effect but i don't think that was the plan.

now in the screenshots the situations are

  1. H in S plot vs S in S plot : (+15,+15) -> explained by strange himeiji behavior
  2. H in H plot vs S in H plot : (+15,+15) -> UNEXPLAINED but also not reproducable - see screenshot below

also, keep in mind that nobody guarantees that the preview (lua) and the actual combat (dll) are in sync!

open questions:

which plot should considered - attacker or defender or both? is ranged combat different from melee combat here? it uses different code for sure on dll side, i don't see where the bonus would be applied there but it's shown in the preview.

then what is friendly territory? does it include open borders? vassals? cs allies? does is include water? currently neither shoshone bonus nor himeiji works on ships.

image

ilteroi commented 8 years ago

ok, now it gets interesting.

  1. ranged units also profit from CS enhancing promotions, not only RCS. is that intended? it means they are double dipping ...
  2. himeiji is a promotion. there is piece of code called getFriendlyLandsModifier() which is affected by it.
  3. ranged units consider the attacker plot while melee units consider the defender plot when deciding whether friendly or not. don't know if that is optimal ...
  4. in the DLL everything is fine, the bonuses are applied correctly. also the damage prediction should be fine. only the modifiers are shown incorrectly on lua side.

is there any lua wizard here who can fix that?

LoneGazebo commented 8 years ago

Fix what, specifically?

ilteroi commented 8 years ago

the combat preview.

sorry, it was meant to align with item 4 there

ilteroi commented 8 years ago

but there are a bunch of open questions you can weigh in on. i'll consider this done for now

LoneGazebo commented 8 years ago

I think friendly territory should be owned territory, and (for bonuses) you should have to be in it, or end up in it, for it to count. So melee attacking into owned, or from owned, or ranged attacked into/from owned, should count.