fire-eggs / CivOne

An open source implementation of Sid Meier's Civilization 1 using C# and .NET.
Creative Commons Zero v1.0 Universal
21 stars 4 forks source link

Hut mercenaries not owned by nearby city #63

Open fire-eggs opened 5 years ago

fire-eggs commented 5 years ago

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

fire-eggs commented 5 years ago

Ditto for units converted by diplomat

fire-eggs commented 5 years ago
  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 commented 3 years ago

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 commented 3 years ago

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

fire-eggs commented 3 years ago

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