Page 1 of 1

Partisan question

Posted: Sun Mar 20, 2022 8:22 pm
by MikeDuk
Hi.

I would like to know more about partisan appearance. Does the number of partisans depend on the conquered city size? What other variables are involved (appart from the requirements of Guerrilla Warfare and Democracy/Communism)?

What is the GitHub source file that codes this effect?

Thanks!

Re: Partisan question

Posted: Sun Mar 20, 2022 9:04 pm
by Ignatus
https://github.com/freeciv/freeciv/blob ... efault.lua:

Code: Select all

local partisans = random(0, 1 + (city.size + 1) / 2) + 1
  if partisans > 8 then
    partisans = 8
  end

Re: Partisan question

Posted: Mon Mar 21, 2022 6:40 am
by MikeDuk
Thank you, Ignatus.

Two more questions regarding this.
- Is the division by 2 a "floor division", meaning it yields the "nearest lower integer"? That is, "7 / 2" would be "3".
- Is "city.size" computed before or after the city is conquered? Because conquering a city reduces the population by one.

Thanks.

Re: Partisan question

Posted: Mon Mar 21, 2022 4:13 pm
by Ignatus
MikeDuk wrote: - Is the division by 2 a "floor division", meaning it yields the "nearest lower integer"? That is, "7 / 2" would be "3".
- Is "city.size" computed before or after the city is conquered? Because conquering a city reduces the population by one.
- Lua always uses real numbers, rounds down only at pass to random(,) function
- The city size is reduced at the callback.