def onGameLoad(self, argsList): # Init things which require a game object or other game data to exist if not SdToolKit.sdObjectExists("AIAutoPlay", GAME): SdToolKit.sdObjectInit("AIAutoPlay", GAME, {}) SdToolKit.sdObjectSetVal("AIAutoPlay", GAME, "bCanCancelAuto", True) elif SdToolKit.sdObjectGetVal("AIAutoPlay", GAME, "bCanCancelAuto") is None: SdToolKit.sdObjectSetVal("AIAutoPlay", GAME, "bCanCancelAuto", True) for i in range(GC.getMAX_PC_PLAYERS()): CyPlayer = GC.getPlayer(i) if CyPlayer.isHumanDisabled() and not GAME.isForcedAIAutoPlay(i): GAME.setAIAutoPlay(i, 1)
def onCombatResult(argsList): CyUnitW, CyUnitL = argsList # Spartacus Capture Event if CyUnitW.getUnitClassType() == giSparticus: # Capture % Random # 0 to 3 or 25% if not GAME.getSorenRandNum(4, "Gods"): pClearPlot = findClearPlot(CyUnitL) CyPlot = CyUnitL.plot() if pClearPlot != -1 and CyPlot.getNumUnits() == 1: CyPlot = CyUnitL.plot() CyUnitL.setXY(pClearPlot.getX(), pClearPlot.getY(), False, True, True) else: CyPlot = CyUnitW.plot() iPlayer = CyUnitW.getOwner() GC.getPlayer(iPlayer).initUnit(giGladiator, CyPlot.getX(), CyPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH).finishMoves() CyUnitL.setDamage(100000, False) msg = TRNSLTR.getText("TXT_KEY_SPARTACUS_CAPTURE_SUCCESS",()) icon = ',Art/Interface/Buttons/Units/ICBM.dds,Art/Interface/Buttons/Warlords_Atlas_1.dds,3,11' CvUtil.sendMessage(msg, iPlayer, 15, icon, ColorTypes(44), CyUnitL.getX(), CyUnitL.getY(), True, True, 0, "", False) # Field Medic if CyUnitW.isHasPromotion(giFieldMedic): # 10% chance if not GAME.getSorenRandNum(10, "Gods"): if not SDTK.sdObjectExists('Heroes', CyUnitW): iHealTurn = -1 else: iHealTurn = SDTK.sdObjectGetVal( 'Heroes', CyUnitW, 'HealTurn' ) if iHealTurn == None or GAME.getGameTurn() > iHealTurn: CyUnitW.setDamage(0, False) if not SDTK.sdObjectExists('Heroes', CyUnitW): SDTK.sdObjectInit('Heroes', CyUnitW, {}) SDTK.sdObjectSetVal('Heroes', CyUnitW, 'HealTurn', GAME.getGameTurn())
def revObjectInit(object, VarDictionary={}): return SdToolKit.sdObjectInit('Revolution', object, VarDictionary)