Faster cottage upgrades

cfkane

Emperor
Joined
Feb 7, 2006
Messages
1,196
I'm trying to figure out how to program a unit that can increase the speed at which a cottage can upgrade. So, when the unit is on a tile that has a cottage or one of its variants, that tile counts as being worked. If it's already being worked, the presence of the unit would decrease the time until it upgrades.

How would you program this?
 
Good question. One trick I have used is to use a probability of upgrade per turn, instead of a fixed rate increase. For example, suppose one unit takes ten turns to produce, and another unit has a 10% chance to appear per turn: they are different, but similar. After 100 turns, you will probably have 10 of each unit.

So, you could easily write a loop at the end of the turn, which finds all instances of your unit. If the unit is on a cottage, 5% chance to upgrade to hamlet, and so forth. That is not the exact mechanic you wanted, but it has a similar effect.
 
Top Bottom