本文整理汇总了Python中IPlayer.IPlayer.processINITPhase方法的典型用法代码示例。如果您正苦于以下问题:Python IPlayer.processINITPhase方法的具体用法?Python IPlayer.processINITPhase怎么用?Python IPlayer.processINITPhase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer.IPlayer
的用法示例。
在下文中一共展示了IPlayer.processINITPhase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processINITPhase
# 需要导入模块: from IPlayer import IPlayer [as 别名]
# 或者: from IPlayer.IPlayer import processINITPhase [as 别名]
def processINITPhase(self, tran, obj, data):
IPlayer.processINITPhase(self, tran, obj, data)
obj.lastLogin = time.time()
# delete itself if there are no fleets and planets
# delete the account as well
# unregister it from the AI system
if not obj.fleets and not obj.planets:
self.cmd(obj).delete(tran, obj)
示例2: processINITPhase
# 需要导入模块: from IPlayer import IPlayer [as 别名]
# 或者: from IPlayer.IPlayer import processINITPhase [as 别名]
def processINITPhase(self, tran, obj, data):
IPlayer.processINITPhase(self, tran, obj, data)
if (len(obj.techs) == 0):
log.warning('Renegade player in INIT phase without techs; granting again')
self.cmd(obj).update(tran, obj) #grant the techs because something screwed up
obj.lastLogin = time.time()
# delete itself if there are no fleets and planets
if not obj.fleets and not obj.planets:
self.cmd(obj).delete(tran, obj)
示例3: processINITPhase
# 需要导入模块: from IPlayer import IPlayer [as 别名]
# 或者: from IPlayer.IPlayer import processINITPhase [as 别名]
def processINITPhase(self, tran, obj, data):
IPlayer.processINITPhase(self, tran, obj, data)
obj.lastLogin = time.time()
log.debug("NATURE - asteroids", len(obj.fleets), obj.fleets)
示例4: processINITPhase
# 需要导入模块: from IPlayer import IPlayer [as 别名]
# 或者: from IPlayer.IPlayer import processINITPhase [as 别名]
def processINITPhase(self, tran, obj, data):
IPlayer.processINITPhase(self, tran, obj, data)
# TODO -- remove following lines
obj.lastLogin = time.time()
# delete itself if there are no fleets and planets
if not obj.fleets and not obj.planets:
self.cmd(obj).delete(tran, obj)
# "AI" behavior -> construct pirate bases on system AI owns
for planetID in obj.planets:
planet = tran.db[planetID]
#@log.debug(obj.oid, "PIRATEAI - scanning", planetID, len(planet.prodQueue), len(planet.slots), planet.plSlots, planet.plMaxSlots)
if planet.prodQueue:
# something is in production queue
continue
if not Rules.Tech.PIRATEBREWERY in obj.techs:
log.warning('Pirate player in INIT phase without techs; granting again')
self.cmd(obj).update(tran, obj) #grant the techs because something screwed up
if planet.plSlots > len(planet.slots):
# build PIRBASE
log.debug(obj.oid, "PIRATEAI - building pirate base", planet.oid)
self.cmd(planet).startConstruction(tran, planet, Rules.Tech.PIRATEBASE, 1, planet.oid, False, False, OID_NONE)
continue
else:
# no room
# try to build on another planets
system = tran.db[planet.compOf]
build = False
for targetID in system.planets:
target = tran.db[targetID]
if target.owner == OID_NONE and target.plSlots > 0:
log.debug(obj.oid, "PIRATEAI - colonizing planet", target.oid)
self.cmd(planet).startConstruction(tran, planet, Rules.Tech.PIRATEBASE, 1, targetID, False, False, OID_NONE)
build = True
if build:
break
if build:
continue
# try to expand slots
if Rules.Tech.ADDSLOT3 in obj.techs and planet.plSlots < planet.plMaxSlots:
log.debug(obj.oid, "PIRATEAI - building surface expansion", planet.oid)
self.cmd(planet).startConstruction(tran, planet, Rules.Tech.ADDSLOT3, 1, planet.oid, False, False, OID_NONE)
build = True
if build:
continue
#try to assemble/condense planets
if Rules.Tech.PLASSEMBL5 in obj.techs or Rules.Tech.PLCOND5 in obj.techs:
for targetID in system.planets:
target = tran.db[targetID]
if target.plType == 'A' and Rules.Tech.PLASSEMBL5 in obj.techs:
log.debug(obj.oid, "PIRATEAI - assembling asteroid", target.oid)
self.cmd(planet).startConstruction(tran, planet, Rules.Tech.PLASSEMBL5, 1, planet.oid, False, False, OID_NONE)
build = True
elif target.plType == 'G' and Rules.Tech.PLCOND5 in obj.techs:
log.debug(obj.oid, "PIRATEAI - assembling asteroid", target.oid)
self.cmd(planet).startConstruction(tran, planet, Rules.Tech.PLCOND5, 1, planet.oid, False, False, OID_NONE)
build = True
if build:
break
continue
#grant time based techs as needed:
if obj.galaxies:
if not (Rules.Tech.ADDSLOT3 in obj.techs and Rules.Tech.PLASSEMBL5 in obj.techs and Rules.Tech.PLCOND5 in obj.techs):
galaxy = tran.db[obj.galaxies[0]]
if galaxy.creationTime + Rules.pirateGrantHSE < time.time() and not Rules.Tech.ADDSLOT3 in obj.techs:
obj.techs[Rules.Tech.ADDSLOT3] = Rules.techMaxImprovement
if galaxy.creationTime + Rules.pirateGrantASSEM < time.time() and not Rules.Tech.PLASSEMBL5 in obj.techs:
obj.techs[Rules.Tech.PLASSEMBL5] = Rules.techMaxImprovement
if galaxy.creationTime + Rules.pirateGrantCOND < time.time() and not Rules.Tech.PLCOND5 in obj.techs:
obj.techs[Rules.Tech.PLCOND5] = Rules.techMaxImprovement