j_mie6
Deity
hmmm problem with the palace moving... would have to look through all cities to find the horses. I guess it's ok though as the code will pretty much never be triggered 

def vikings(*args):
"Power of Raiders - More gold from capturing/razing cities and pillaging"
if len(args) == 3: #doPillageGold
iImprovement, iOwner, iCurrentGold = args
if iOwner == eVikings:
iGold = int(round((iCurrentGold/100.0) * iVikingPercentMoney))
if Game.getActivePlayer() == eVikings:
addMessage(sVikingMessage1, (str(iGold),), eGreen)
return iGold
return 0
else: #onCityAquired
iNewOwner, pCity, bConquest = args
if iNewOwner == eVikings and bConquest:
iGold = pCity.getPopulation() * iVikingCityGold
giveGold(iGold, eVikings)
if Game.getActivePlayer() == eVikings:
addMessage(sVikingMessage2, (str(iGold), pCity.getName()), eGreen)
def mongols(*args):
"Power of the Horde - Horse always present at capital"
if len(args) == 3: # onCityAcquired
iPreviousOwner, iNewOwner, pCity = args
if iPreviousOwner != eMongols != iNewOwner: return
if iNewOwner == eMongols and pCity.isCapital():
lPlots = getCityRadiusTiles(pCity)
for pPlot in lPlots: if pPlot.getBonusType(-1) == eHorse: return
pPlot = pCity.plot() if pCity.plot().getBonusType(-1) == -1 else getPlot(getRandomCoords([pPlot for pPlot in lPlots if pPlot.getBonusType(-1) == -1 and pPlot.getOwner() == eMongols and pPlot.getFeatureType() != eOasis]))
pPlot.setScriptData("Mongol Horse")
pPlot.setBonusType(eHorse)
elif iPreviousOwner == eMongols:
for pPlot in getCityRadiusTiles(pCity):
if pPlot.getScriptData() == "Mongol Horse":
pPlot.setScriptData("")
pPlot.setBonusType(-1)
pMongols = pointer("Mongolia", CyPlayer)
if pMongols.isAlive():
lPlots = getCityRadiusTiles(pMongols.getCapitalCity())
for pPlot in lPlots: if pPlot.getBonusType(-1) == eHorse: return
pPlot = pMongols.getCapitalCity().plot() if pMongols.getCapitalCity().plot().getBonusType(-1) == -1 else getPlot(getRandomCoords([pPlot for pPlot in lPlots if pPlot.getBonusType(-1) == -1 and pPlot.getOwner() == eMongols and pPlot.getFeatureType() != eOasis]))
pPlot.setScriptData("Mongol Horse")
pPlot.setBonusType(eHorse)
else:
pCity, eBuilding = args
if eBuilding == ePalace and pCity.getOwner() == eMongols:
bBreak = False
for pOtherCity in (city.GetCy() for city in pointer("Mongolia", PyPlayer).getCityList()):
for pPlot in getCityRadiusTiles(pOtherCity):
if pPlot.getScriptData() == "Mongol Horse":
pPlot.setScriptData("")
pPlot.setBonusType(-1)
bBreak = True
break
if bBreak: break
lPlots = getCityRadiusTiles(pCity)
for pPlot in lPlots: if pPlot.getBonusType(-1) == eHorse: return
pPlot = pCity.plot() if pCity.plot().getBonusType(-1) == -1 else getPlot(getRandomCoords([pPlot for pPlot in lPlots if pPlot.getBonusType(-1) == -1 and pPlot.getOwner() == eMongols and pPlot.getFeatureType() != eOasis]))
pPlot.setScriptData("Mongol Horse")
pPlot.setBonusType(eHorse)
pTeam = gc.getTeam(iTeamX)
if pTeam.isVassal(iHasMetTeamY):
pPlayer = gc.getPlayer(pTeam.getLeaderID())
def doPillageGold(self, argsList):
"controls the gold result of pillaging"
pPlot = argsList[0]
pUnit = argsList[1]
iPillageGold = 0
iPillageGold = CyGame().getSorenRandNum(gc.getImprovementInfo(pPlot.getImprovementType()).getPillageGold(), "Pillage Gold 1")
iPillageGold += CyGame().getSorenRandNum(gc.getImprovementInfo(pPlot.getImprovementType()).getPillageGold(), "Pillage Gold 2")
iPillageGold += (pUnit.getPillageChange() * iPillageGold) / 100
iPillageGold += self.powers.vikings(pPlot.getImprovementType(), pUnit.getOwner(), iPillageGold)
return iPillageGold
def mongols(*args):
"Power of the Horde - Horse always present at capital"
if len(args) == 3: # onCityAcquired
iPreviousOwner, iNewOwner, pCity = args
if iPreviousOwner != eMongols != iNewOwner: return
if iNewOwner == eMongols and pCity.isCapital():
lPlots = getCityRadiusTiles(pCity)
for pPlot in lPlots: if pPlot.getBonusType(-1) == eHorse:
pPlot.setScriptData("Natural Horse")
return
pPlot = pCity.plot() if pCity.plot().getBonusType(-1) == -1 else getPlot(getRandomCoords([pPlot for pPlot in lPlots if pPlot.getBonusType(-1) == -1 and pPlot.getOwner() == eMongols and pPlot.getFeatureType() != eOasis]))
pPlot.setScriptData("Mongol Horse")
pPlot.setBonusType(eHorse)
elif iPreviousOwner == eMongols:
bCapital = False
for pPlot in getCityRadiusTiles(pCity):
if pPlot.getScriptData() == "Mongol Horse":
pPlot.setScriptData("")
pPlot.setBonusType(-1)
bCapital = True
elif pPlot.getScriptData() == "Natural Horse":
pPlot.setScriptData("")
bCapital = True
if bCapital:
pMongols = pointer("Mongolia", CyPlayer)
if pMongols.isAlive():
lPlots = getCityRadiusTiles(pMongols.getCapitalCity())
for pPlot in lPlots: if pPlot.getBonusType(-1) == eHorse:
pPlot.setScriptData("Natural Horse")
return
pPlot = pMongols.getCapitalCity().plot() if pMongols.getCapitalCity().plot().getBonusType(-1) == -1 else getPlot(getRandomCoords([pPlot for pPlot in lPlots if pPlot.getBonusType(-1) == -1 and pPlot.getOwner() == eMongols and pPlot.getFeatureType() != eOasis]))
pPlot.setScriptData("Mongol Horse")
pPlot.setBonusType(eHorse)
else:
pCity, eBuilding = args
if eBuilding == ePalace and pCity.getOwner() == eMongols:
bBreak = False
for pOtherCity in (city.GetCy() for city in pointer("Mongolia", PyPlayer).getCityList()):
for pPlot in getCityRadiusTiles(pOtherCity):
if pPlot.getScriptData() == "Mongol Horse":
pPlot.setScriptData("")
pPlot.setBonusType(-1)
bBreak = True
break
elif pPlot.getScriptData() == "Natural Horse":
pPlot.setScriptData("")
bBreak = True
break
if bBreak: break
lPlots = getCityRadiusTiles(pCity)
for pPlot in lPlots:
if pPlot.getBonusType(-1) == eHorse:
pPlot.setScriptData("Natural Horse")
return
pPlot = pCity.plot() if pCity.plot().getBonusType(-1) == -1 else getPlot(getRandomCoords([pPlot for pPlot in lPlots if pPlot.getBonusType(-1) == -1 and pPlot.getOwner() == eMongols and pPlot.getFeatureType() != eOasis]))
pPlot.setScriptData("Mongol Horse")
pPlot.setBonusType(eHorse)
def france(*args):
"Power of Chivalry - +1 relations with Civs of state religion"
if len(args) = 3: #onChangeStateReligion
iPlayer, iNewReligion, iOldReligion = args
pPlayer = gc.getPlayer(iPlayer)
if iPlayer != eFrance:
pFrance = pointer("France", CyPlayer)
if pFrance.canContact(iPlayer):
if iNewReligion == pFrance.getStateReligion():
pPlayer.AI_changeAttitudeExtra(eFrance, iFrenchRelations)
elif iOldReligion == pFrance.getStateReligion():
pPlayer.AI_changeAttitudeExtra(eFrance, -iFrenchRelations)
else:
for pPlayer in CivPlayer.getPlayers(True, CyPlayer):
if pPlayer.canContact(eFrance):
ePlayerReligion = pPlayer.getStateReligion()
if ePlayerReligion == iNewReligion:
pPlayer.AI_changeAttitudeExtra(eFrance, iFrenchRelations)
elif ePlayerReligion == iOldReligion:
pPlayer.AI_changeAttitudeExtra(eFrance, -iFrenchRelations)
return
elif len(args) == 2: #onFirstContact
iPlayerX, iPlayerY = args
if iPlayerX == eFrance or iPlayerY == eFrance:
pFrance = pointer("France", CyPlayer)
pPlayer = gc.getPlayer(iPlayerX if iPlayer != eFrance else iPlayerY)
if pPlayer.getStateReligion() == pFrance.getStateReligion():
pPlayer.AI_changeAttitudeExtra(eFrance, iFrenchRelations)
def france(*args):
"Power of Chivalry - +1 relations with Civs of state religion"
if len(args) == 3: #onChangeStateReligion
iPlayer, iNewReligion, iOldReligion = args
pPlayer = gc.getPlayer(iPlayer)
if iPlayer != eFrance:
pFrance = pointer("France", CyPlayer)
if pFrance.canContact(iPlayer):
if iNewReligion == pFrance.getStateReligion():
pPlayer.AI_changeAttitudeExtra(eFrance, iFrenchRelations)
elif iOldReligion == pFrance.getStateReligion():
pPlayer.AI_changeAttitudeExtra(eFrance, -iFrenchRelations)
else:
for pPlayer in CivPlayer.getPlayers(True, CyPlayer):
if pPlayer.canContact(eFrance):
ePlayerReligion = pPlayer.getStateReligion()
if ePlayerReligion == iNewReligion:
pPlayer.AI_changeAttitudeExtra(eFrance, iFrenchRelations)
elif ePlayerReligion == iOldReligion:
pPlayer.AI_changeAttitudeExtra(eFrance, -iFrenchRelations)
return
elif len(args) == 2: #onFirstContact
iPlayerX, iPlayerY = args
if iPlayerX != eFrance != iPlayerY: return
pFrance = pointer("France", CyPlayer)
if iPlayerX != eFrance:
pPlayer = gc.getPlayer(iPlayerX)
else:
pPlayer = gc.getPlayer(iPlayerY)
if pPlayer.getStateReligion() == pFrance.getStateReligion():
pPlayer.AI_changeAttitudeExtra(eFrance, iFrenchRelations)
def onUnitBuilt(self, argsList):
'Unit Completed'
city = argsList[0]
unit = argsList[1]
player = PyPlayer(city.getOwner())
## Flavian Amphitheatre Start ##
if city.getNumActiveBuilding(gc.getInfoTypeForString("BUILDING_FLAVIAN_AMPHITHEATRE")):
pPlayer = gc.getPlayer(city.getOwner())
if unit.getUnitType() == gc.getInfoTypeForString("UNIT_PLATYPING"):
if unit.getExperience() > 4:
pNewUnit = pPlayer.initUnit(gc.getInfoTypeForString("UNIT_HROCHLAND"), unit.getX(), unit.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
pNewUnit.convert(unit)
## Flavian Amphitheatre End ##