CivOne icon indicating copy to clipboard operation
CivOne copied to clipboard

Hut mercenaries not owned by nearby city

Open fire-eggs opened this issue 6 years ago • 5 comments

When a hut generates mercenaries, they should be owned by a city nearby. (distance?)

fire-eggs avatar Jun 26 '19 22:06 fire-eggs

Ditto for units converted by diplomat

fire-eggs avatar Jun 28 '19 15:06 fire-eggs

  1. Need to establish what rule to use when establishing "ownership". It has been suggested that being closer to an enemy city instead of your own means no ownership; I think there is a distance to one of your own cities which determines if the unit is "owned" by said city.
  2. Use that rule in hut results
  3. Use that rule in unit conversion

fire-eggs avatar Aug 13 '19 21:08 fire-eggs

The hut code is in BaseUnitLand.cs, TribalHut(). The first switch statement, case HutResult.FriendlyTribe. The unit is created but is not assigned a city.

The code further down in the routine (case 3:) suggests that the "owning" city would be the closest player city that is nearer than 4 distance.

fire-eggs avatar Sep 24 '21 14:09 fire-eggs

Diplomat unit bribe logic is in DiplomatBribe.cs, Bribe().

fire-eggs avatar Sep 24 '21 14:09 fire-eggs

To set a unit's "owning" city, invoke the unit's SetHome method with the city.

fire-eggs avatar Sep 24 '21 14:09 fire-eggs