def changeGold(self, iChange):
"""
Grants iChange of Gold. A negative value will subtract gold.
"""
giveGold(iChange, eRome)
def grantUnit(self, eUnit):
"""
Spawns one free unit in capital of eUnit type.
"""
spawnUnits(eRome, eUnitType, tCoords, iNum)
def grantGoldenAge(self, iNumTurns):
"""
Starts a Golden Age for iNumTurns.
"""
giveGoldenAge(eRome, iTurns)
def changeHappiness(self, iHappiness):
"""
Changes the happiness of all of Rome's cities, can also be used negatively
"""
lCities = getCityList("rome")
for pCity in (city.GetCy() for city in lCities):
pCity.changeExtraHappiness(iHappiness)
def grantUpgrade():
"""
Gives a random building increased defence or modifers for Rome ONLY
"""
pass
def grantBuilding(self):
"""
Gives a random building in a random city in rome
"""
targetCity = getRandCity("rome")
building = getRandBuilding(targetCity, bPresent=False)
if not isWonder(building):
targetCity.setNumRealBuilding(building, 1)
def grantCivic(self, pCivic = gc.getInfoTypeForString('CIVIC_REPUBLIC')):
"""
Gives the player an anarchy free civic swap to republic by default
"""
bBasic = True
pPlayer = gc.getPlayer(eRome) #instance("Rome").get(CyPlayer)?
if pPlayer.isCivic(pCivic):
pPlayer.setCivics(0, pCivic)
showPopup(senateHeader, freeCivicMessage)
else:
print "No usable civic for FreeCivic()"
def grantTech(self, header=freeTechMessage):
"""
Grants a free tech to the player
"""
pPlayer = instance("Rome").get(CyPlayer)
if pPlayer.isHuman():
pPlayer.chooseTech(1, header, False)
else:
pPlayer.AI_chooseFreeTech()
def CitySelect(self):
"""
As far as I know this was for a reward where the player gets to receive a free city (providing any spots are left...) This code will be difficult, I guess a random list of city locations could be collected from Historical cities (if it doesn't already exist in game) and presented to the player (giving them the name corosponding to the coords) to choose!
"""
pass
# penalties
def rebelUnit(self, eUnitType):
"""
Spawns a rebel unit somewhere in the radius of a random city!
"""
#I will do this easily!
spawnUnits(eItalianRebels, eUnitType, tCoords, iNum)
def destroyBuilding(self):
"""
Destroys a building in a random roman city (could be replaced by an arguement within the giveBuilding function changing
setNumRealBuilding and bPresent to a building destruction)
"""
targetCity = getRandCity("rome")
building = getRandBuilding(targetCity, bPresent=True)
if not isWonder(building):
targetCity.setNumRealBuilding(building, 0)
def anarchyTurns(self, iAnarchy):
"""
Gives iAnarchy turns of anarchy
"""
pPlayer = instance(player).get(CyPlayer)
pPlayer.changeAnarchyTurns(iAnarchy)
def civilWar(self):
"""
Starts a civil war in Rome, however I am not sure how the code would decide on the cities to use (this code is a bit of a mess
atm :p) any ideas?
"""
condition = False #this should be changed...
if condition:
lCities =
CivilWar.initCivilWar(instance("Rome"), lCities)
else:
lCities =
CivilWar.initCivilWar(instance("Rome"), lCities)