I also had to add int getIHealRateChange()
Is this typo in your code or just this post? It should be just getHealRateChange(), without the I.
I also had to add int getIHealRateChange()
Is there any way to weight a spell so much that the AI will cast it immediately
'Promote to City' for the Kuroutaites, as in my current game they have just 3 settlements left after their core was conquered, and have had them for quite a while now.
Is there a way to use python to determine whether a vote has passed?
def cannotTrain(self,argsList):
pCity = argsList[0]
eUnit = argsList[1]
bContinue = argsList[2]
bTestVisible = argsList[3]
bIgnoreCost = argsList[4]
bIgnoreUpgrades = argsList[5]
ePlayer = pCity.getOwner()
pPlayer = gc.getPlayer(ePlayer)
eUnitClass = gc.getUnitInfo(eUnit).getUnitClassType()
eTeam = gc.getTeam(pPlayer.getTeam())
if eUnitClass == gc.getInfoTypeForString('UNITCLASS_NIGHTWATCH'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_COUNCIL_OF_ESUS'):
return False
if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_MEMBERSHIP')) == gc.getInfoTypeForString('CIVIC_UNDERCOUNCIL'):
if CyGame().isVotePassed(gc.getInfoTypeForString('VOTE_ENLIST_THE_NIGHTWATCH')):
return False
return True
if eUnitClass == gc.getInfoTypeForString('UNITCLASS_RADIANT_GUARD'):
if pPlayer.getStateReligion() == gc.getInfoTypeForString('RELIGION_THE_EMPYREAN'):
return False
if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_MEMBERSHIP')) == gc.getInfoTypeForString('CIVIC_OVERCOUNCIL'):
if CyGame().isVotePassed(gc.getInfoTypeForString('VOTE_ENLIST_THE_GUARD')):
return False
return True
if iProjectType == gc.getInfoTypeForString('PROJECT_INFERNAL_PACT'):
demonList = []
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_HYBOREM')):
demonList.append(gc.getInfoTypeForString('LEADER_HYBOREM'))
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_JUDECCA')):
demonList.append(gc.getInfoTypeForString('LEADER_JUDECCA'))
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_SALLOS')):
demonList.append(gc.getInfoTypeForString('LEADER_SALLOS'))
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_OUZZA')):
demonList.append(gc.getInfoTypeForString('LEADER_OUZZA'))
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_MERESIN')):
demonList.append(gc.getInfoTypeForString('LEADER_MERESIN'))
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_STATIUS')):
demonList.append(gc.getInfoTypeForString('LEADER_STATIUS'))
if not CyGame().isLeaderEverActive(gc.getInfoTypeForString('LEADER_LETHE')):
demonList.append(gc.getInfoTypeForString('LEADER_LETHE'))
if len(demonList)>0:
iDemonLord = demonList[CyGame().getSorenRandNum(len(demonList), "Infernal Pact")]
iInfernalPlayer = cf.getOpenPlayer()
pBestPlot = -1
iBestPlot = -1
for i in range (CyMap().numPlots()):
pPlot = CyMap().plotByIndex(i)
iPlot = -1
if pPlot.isWater() == False:
if pPlot.getNumUnits() == 0:
if pPlot.isCity() == False:
if pPlot.isImpassable() == False:
iPlot = CyGame().getSorenRandNum(500, "Place Hyborem")
iPlot = iPlot + (pPlot.area().getNumTiles() * 2)
iPlot = iPlot + (pPlot.area().getNumUnownedTiles() * 10)
if pPlot.isOwned() == False:
iPlot = iPlot + 500
if pPlot.getOwner() == iPlayer:
iPlot = iPlot + 200
if iPlot > iBestPlot:
iBestPlot = iPlot
pBestPlot = pPlot
if (iInfernalPlayer != -1 and pBestPlot != -1):
CyGame().addPlayerAdvanced(iInfernalPlayer, -1, iDemonLord, gc.getInfoTypeForString('CIVILIZATION_INFERNAL'))
iFounderTeam = gc.getPlayer(iPlayer).getTeam()
eFounderTeam = gc.getTeam(gc.getPlayer(iPlayer).getTeam())
iInfernalTeam = gc.getPlayer(iInfernalPlayer).getTeam()
eInfernalTeam = gc.getTeam(iInfernalTeam)
for iTech in range(gc.getNumTechInfos()):
if eFounderTeam.isHasTech(iTech):
eInfernalTeam.setHasTech(iTech, true, iInfernalPlayer, true, false)
iBarbTeam = gc.getPlayer(gc.getBARBARIAN_PLAYER()).getTeam()
eFounderTeam.makePeace(iBarbTeam)
eInfernalTeam.makePeace(iBarbTeam)
for iTeam in range(gc.getMAX_TEAMS()):
if iTeam != iBarbTeam:
eTeam = gc.getTeam(iTeam)
if eTeam.isAlive():
if eFounderTeam.isAtWar(iTeam):
eInfernalTeam.declareWar(iTeam, false, WarPlanTypes.WARPLAN_LIMITED)
pInfernalPlayer = gc.getPlayer(iInfernalPlayer)
pInfernalPlayer.AI_changeAttitudeExtra(iPlayer,4)
eFounderTeam.signOpenBorders(iInfernalTeam)
eInfernalTeam.signOpenBorders(iFounderTeam)
eFounderTeam.signDefensivePact(iInfernalTeam)
eInfernalTeam.signDefensivePact(iFounderTeam)
pAshCity = cf.getAshenVeilCity(1)
if pAshCity != -1 and not gc.getGame().isNetworkMultiPlayer():
pInfernalPlayer.acquireCity(pAshCity,false,false)
pBestPlot = pAshCity.plot()
else:
newUnit0 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_SETTLER'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit0.setHasPromotion(gc.getInfoTypeForString('PROMOTION_STARTING_SETTLER'), true)
pBestPlot.setImprovementType(gc.getInfoTypeForString('IMPROVEMENT_HELLFIRE'))
if iDemonLord ==gc.getInfoTypeForString('LEADER_HYBOREM'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_HYBOREM'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit1.setHasPromotion(gc.getInfoTypeForString('PROMOTION_IMMORTAL'), true)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL"
if iDemonLord ==gc.getInfoTypeForString('LEADER_JUDECCA'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_JUDECCA'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL_JUDECCA"
if iDemonLord ==gc.getInfoTypeForString('LEADER_SALLOS'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_SALLOS'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL_SALLOS"
if iDemonLord ==gc.getInfoTypeForString('LEADER_OUZZA'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_OUZZA'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL_OUZZA"
if iDemonLord ==gc.getInfoTypeForString('LEADER_MERESIN'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_MERESIN'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL_MERESIN"
if iDemonLord ==gc.getInfoTypeForString('LEADER_STATIUS'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_STATIUS'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL_STATIUS"
if iDemonLord ==gc.getInfoTypeForString('LEADER_LETHE'):
newUnit1 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_LETHE'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
sInfernal = "TXT_KEY_POPUP_CONTROL_INFERNAL_LETHE"
newUnit2 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_LONGBOWMAN'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit2.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MOBILITY1'), true)
newUnit3 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_LONGBOWMAN'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit3.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MOBILITY1'), true)
newUnit4 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_CHAMPION'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit4.setHasPromotion(gc.getInfoTypeForString('PROMOTION_IRON_WEAPONS'), true)
newUnit4.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MOBILITY1'), true)
newUnit5 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_CHAMPION'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit5.setHasPromotion(gc.getInfoTypeForString('PROMOTION_IRON_WEAPONS'), true)
newUnit5.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MOBILITY1'), true)
newUnit6 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_WORKER'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit6.setHasPromotion(gc.getInfoTypeForString('PROMOTION_DEMON'), true)
newUnit7 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_IMP'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit7.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MOBILITY1'), true)
newUnit8 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_MANES'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit9 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_MANES'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
newUnit10 = pInfernalPlayer.initUnit(gc.getInfoTypeForString('UNIT_MANES'), pBestPlot.getX(), pBestPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
if gc.getPlayer(iPlayer).isHuman():
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON)
popupInfo.setText(CyTranslator().getText(sInfernal,()))
popupInfo.setData1(iPlayer)
popupInfo.setData2(iInfernalPlayer)
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_YES", ()), "")
popupInfo.addPythonButton(CyTranslator().getText("TXT_KEY_POPUP_NO", ()), "")
popupInfo.setOnClickedPythonCallback("reassignPlayer")
popupInfo.addPopup(iPlayer)
if pPlayer.getStateReligion() != gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
pPlayer.setAlignment(gc.getInfoTypeForString('ALIGNMENT_EVIL'))
for pUnit in (iPlayer).getUnitList():
if pUnit.getReligion() ==-1:
pUnit.setReligion(gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'))
Could someone help me figure out what is wrong with this code? It seemed to be working juts fine during two test games this afternoon, but in the past few hours it has caused a CtD every time I complete the ritual even though I'm pretty sure that the code has not changed.