j_mie6
Deity
If you think it will be too dificult then do the rest and we can work on that later 

Ok, I'm writing something related to this now, so these is my initial thoughts.one rebellion at a time and after 5 turns the civ can receive a new rebellion (even if the former has not ended) multiple rebellions can happen at the same time but only in different players
roman and gaul can both have a civil war spawn at the same turn!
tRebellionTurnPlayers = ([COLOR="Red"](0, 3)[/COLOR], (1, 2), (4, 5), (6, 9), (7, 8))
iIndex = iGameTurn % 4
tGameTurnPlayers = iIndex, iIndex + 4
def checkRebellion(iGameTurn):
iIndex = (iGameTurn + iRandomSeed) % 4
for pCivPlayer in (instance(iIndex), instance(iIndex + 4)):
if not pCivPlayer.get(CyPlayer).isAlive(): continue
lCities = pCivPlayer.get(PyPlayer).getCityList()
lCities.reverse()
for pCity in lCities:
if checkClasses(pCity):
break
def checkClasses(pCity):
for rebellionClass in tRebellionClasses:
if eval(rebellionClass + ".checkConditions(pCivPlayer, pCity)"):
eval(rebellionClass + ".initRebellion(pCivPlayer, pCity)"):
return True
By "original calculations" you mean "the highest of the number of foreign nationals - or the city's unhappy level minus city garrison size"? Because this is what the current Rebels module says:Type - Occupational Rebellion
Sample Conditions - Occupation (not too common)
Civ Claimant - Original owner
Number of Units - original calculations
Type - Original owner's tech level
Termination - None
Misc - Revival of civ, Chance of rebellion ends (therfore turning into domestic rebellions) after some turns after capture (not sure how many though...)
iNumRebels = max(iForeigners, pCity.unhappyLevel(0) - pCity.getMilitaryHappinessUnits())
def setNumUnits(self):
pCity = self.getCyCity()
iUnhappyLevel = pCity.unhappyLevel(0)
iPopulation = pCity.getPopulation()
self.iNumUnits = max(1, min(iUnhappyLevel, iPopulation))