LoneGazebo / Community-Patch-DLL

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

Help solving vassal protection issue #6655

Closed RecursiveStar closed 4 years ago

RecursiveStar commented 4 years ago

@ilteroi So I've mostly fixed Putmalk's vassal protect/failed protect mechanics, however I'm having trouble with a specific nitpick.

The master should be held responsible for failing to protect his vassals from roaming enemies or Barbarians. However, if Barbarians or partisans spawn in a vassal's lands from unhappiness, razing cities, events, or the spy advanced action, it seems unfair to punish the master if those go around killing the vassal's units or pillaging their tiles.

The easiest fix is to simply disable it for Barbarians, but then the master is let off the hook if roaming Barbarians (or Barbarians from the master's unhappy/razing cities) come along to attack the vassal. It also doesn't fix partisans spawning from the vassal razing cities.

My thought is that maybe this could be solved by setting the Barbarian/partisan units' origin city to the enemy city they spawn in during these events, and then checking to see if the origin city belongs to the vassal. I'm not sure how to do that, however. :)

A potential issue I can see with this is that for partisan units spawned from razing, empire-wide instant yields that are applied to an origin city (which I suspect is the capital by default) might not trigger. This could be solved by adding the check: if origin city is not ours, then use the capital

RecursiveStar commented 4 years ago

Also, do partisans even still happen? I've never seen them in any of my games.

Padre19 commented 4 years ago

Yes. Partisans appeared in my last game when i raze a city.

ilteroi commented 4 years ago

i'm not familiar with that part of the code, but once vassalage becomes an option the barbarians are typically no longer an issue ... so just excluding them should not be a problem?

but the origin city also sounds promising. i really don't have much of an opinion here.

RecursiveStar commented 4 years ago

Oh, thought you would know.

I do know origin city is tracked, it used to be used for difficulty bonuses...hmm, I'll do some digging.