LoneGazebo / Community-Patch-DLL

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

unsneaky sneak attack #2725

Closed ilteroi closed 7 years ago

ilteroi commented 7 years ago

this is supposed to be a sneak attack ... on sparta!

image

maybe target selection needs to be tweaked a bit

LoneGazebo commented 7 years ago

They should DOW the next turn though, as they've encountered the enemy.

Also fixed a typo in setupsinglearmy. Naval attacks always fail because the pDeployPlot->iswater() should be negative, not positive!

Enrico-Swagolo commented 7 years ago

What are those yellow promo icons above? What is the mod called? Do tell me, for I desire to get them myself.

ilteroi commented 7 years ago

nah. they moved over to sparta, then made a demand i didn't want to fulfill, then declared war and turned on corinth after all. conquered it after two turns of siege. smooth, except for the lost time, which i could have used to build an army.

the mod is called flag promotions (not to be confused with thal's flag promotions, that one is not compatible)

LoneGazebo commented 7 years ago

That's odd, did we remove the trigger for the AI to 'successfully end' operations if they run into a target unit or target land?

ilteroi commented 7 years ago

i made the conditions a bit stricter, yes.

enemy units are handled now without disbanding the operation.

for sneak ops they aren't enemies yet, so they have special code. but in this case there was no enemy unit adjacent to the army, so no trigger. probably should check visibility instead.

LoneGazebo commented 7 years ago

That makes sense.

ilteroi commented 7 years ago

nevertheless corinth should have been the target in the first place. can you take a look?

LoneGazebo commented 7 years ago

Yeah, looking at it now. Going to amp up the desirability for the 'closest' city for a sneak attack.

LoneGazebo commented 7 years ago

@ilteroi, quick question - is StableSortItems in cvmilitaryAI sorting high > low, or high < low? I can't seem to find the code.

ilteroi commented 7 years ago

depends on the definition of operator < for the item type

LoneGazebo commented 7 years ago

Nevermind, looks fine, false alarm.

LoneGazebo commented 7 years ago

Another question:

In int CvMilitaryAI::GetCachedAttackTargetLandDistance should a value of -1 be permitted as a cached value? Seems like it should, as land distances don't change (and aren't affected by things like ocean movement or coastal movement). Thoughts? (I see lots of calls to refresh the land distance cache in custommods.csv).

ilteroi commented 7 years ago

well, -1 would mean unreachable right? so it's valid. but it might change anyway because of open borders or razed cities. so you need to refresh it nevertheless.

ilteroi commented 7 years ago

switched to a visibility check and it works beautifully. no chance to defend.

LoneGazebo commented 7 years ago

Great!