本文整理汇总了Python中IPlayer.IPlayer类的典型用法代码示例。如果您正苦于以下问题:Python IPlayer类的具体用法?Python IPlayer怎么用?Python IPlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
def update(self, tran, obj):
obj.techLevel = 99
obj.race = "m"
# # grant technologies
# obj.techs[Rules.Tech.EMCANNON] = Rules.techMaxImprovement
# obj.techs[Rules.Tech.SSROCKET] = Rules.techMaxImprovement
# obj.techs[Rules.Tech.TORPEDO] = Rules.techMaxImprovement
# obj.techs[Rules.Tech.FTLENG1] = 3
# obj.techs[Rules.Tech.SMALLHULL1] = 3
# obj.techs[Rules.Tech.SCOCKPIT1] = 3
# obj.techs[Rules.Tech.SCANNERMOD1] = 3
# obj.techs[Rules.Tech.CONBOMB1] = 3
# obj.techs[Rules.Tech.MUTANTBASE] = 3
# obj.techs[Rules.Tech.MUTANTBASE2] = 3
# obj.techs[Rules.Tech.MUTANTBASE3] = 3
# obj.techs[Rules.Tech.MUTANTBASE4] = 3
# obj.techs[Rules.Tech.MUTANTPP1] = 3
# obj.techs[Rules.Tech.MUTANTPP2] = 3
# obj.techs[Rules.Tech.MUTANTFACT1] = 3
# obj.techs[Rules.Tech.MUTANTFACT2] = 3
# obj.techs[Rules.Tech.MUTANTMINES] = 3
# # create two basic designs [they use modules not available to the
# # player otherwise so it has to be done this way]
# obj.shipDesigns[1] = ShipUtils.makeShipMinSpec(obj, 'Swarmer', Rules.Tech.SMALLHULL1,
# {Rules.Tech.SCOCKPIT1:1, Rules.Tech.EMCANNON:2, Rules.Tech.FTLENG1:2}, [])
# obj.shipDesigns[2] = ShipUtils.makeShipMinSpec(obj, 'Seeder', Rules.Tech.MEDIUMHULL2,
# {Rules.Tech.SCOCKPIT1:1, Rules.Tech.MUTANTPOD:1, Rules.Tech.FTLENG1:4}, [])
# obj.shipDesigns[3] = ShipUtils.makeShipMinSpec(obj, 'Seeker', Rules.Tech.SMALLHULL1,
# {Rules.Tech.SCOCKPIT1:1, Rules.Tech.SCANNERMOD1:1, Rules.Tech.FTLENG1:2}, [])
# obj.shipDesigns[4] = ShipUtils.makeShipMinSpec(obj, 'Sower', Rules.Tech.SMALLHULL1,
# {Rules.Tech.SCOCKPIT1:1, Rules.Tech.CONBOMB1:1, Rules.Tech.FTLENG1:2}, [])
# call super method
IPlayer.update(self, tran, obj)
示例2: init
def init(self, obj):
IPlayer.init(self, obj)
#
obj.name = u'Pirate'
obj.login = '*'
#
obj.pirateFame = 0
示例3: update
def update(self, tran, obj):
# call super method
IPlayer.update(self, tran, obj)
#
obj.techLevel = 99
# grant special technologies
obj.techs[Rules.Tech.PIRATEBASE] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEDEN] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATESD] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEBREWERY] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEPRISON] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEPRISON] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRSMCOLONYMOD] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEFTLENG] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRCOLONYMOD] = Rules.techMaxImprovement
# grant all TL1 ship techs except for colony module(s)
for techID in Rules.techs:
tech = Rules.techs[techID]
if tech.level == 1 and (tech.isShipEquip or tech.isShipHull) and not tech.unpackStruct:
obj.techs[techID] = Rules.techMaxImprovement
# convert enslavedPop
if hasattr(obj, "enslavedPop"):
obj.pirateFame = int(obj.enslavedPop * 0.0005)
log.debug(obj.oid, "New pirate fame is", obj.pirateFame, obj.enslavedPop)
del obj.enslavedPop
示例4: processINITPhase
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)
示例5: processINITPhase
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)
示例6: processFINALPhase
def processFINALPhase(self, tran, obj, data):
obj.govPwr = Rules.pirateGovPwr
IPlayer.processFINALPhase(self, tran, obj, data)
# get fame every 1:00 turns
if tran.db[OID_UNIVERSE].turn % Rules.turnsPerDay == 0:
Utils.sendMessage(tran, obj, MSG_GAINED_FAME, obj.oid, Rules.pirateSurvivalFame)
obj.pirateFame += Rules.pirateSurvivalFame
# fix goverment power
obj.govPwrCtrlRange = 10000
# bonus for gained fame
obj.prodEff += obj.pirateFame / 100.0
示例7: update
def update(self, tran, obj):
# TODO: remove in 0.5.59
if not hasattr(self, "techs"):
self.techs = {}
obj.techLevel = 99
obj.race = "p"
# call super method
IPlayer.update(self, tran, obj)
#
obj.techLevel = 99
示例8: init
def init(self, obj):
IPlayer.init(self, obj)
#
obj.name = u'Pirate'
obj.login = '*'
#
obj.pirateFame = 0
obj.techLevel = 3
# grant all TL1 ship techs except for colony module(s)
for techID in Rules.techs:
tech = Rules.techs[techID]
if tech.level == 1 and (tech.isShipEquip or tech.isShipHull) and not tech.unpackStruct:
obj.techs[techID] = Rules.techMaxImprovement
示例9: processFINALPhase
def processFINALPhase(self, tran, obj, data):
if not Rules.Tech.PIRATEBREWERY in obj.techs:
log.warning('Adding new pirate structures to human pirate player.')
self.cmd(obj).update(tran, obj) #grant the techs because something screwed up
obj.govPwr = Rules.pirateGovPwr
IPlayer.processFINALPhase(self, tran, obj, data)
# get fame every 1:00 turns
if tran.db[OID_UNIVERSE].turn % Rules.turnsPerDay == 0:
Utils.sendMessage(tran, obj, MSG_GAINED_FAME, obj.oid, Rules.pirateSurvivalFame)
obj.pirateFame += Rules.pirateSurvivalFame
# fix goverment power
obj.govPwrCtrlRange = 10000
# bonus for gained fame
obj.prodEff += obj.pirateFame / 100.0
示例10: update
def update(self, tran, obj):
obj.techLevel = 3
# grant technologies
obj.techs[Rules.Tech.LASCANNONTUR3] = Rules.techMaxImprovement
obj.techs[Rules.Tech.SSROCKET2] = Rules.techMaxImprovement
obj.techs[Rules.Tech.TORPEDO] = Rules.techMaxImprovement
# call super method
IPlayer.update(self, tran, obj)
#add TL99 techs
obj.techLevel = 99
obj.techs[Rules.Tech.EDENCANNON] = Rules.techMaxImprovement
obj.techs[Rules.Tech.EDENMISSILE] = Rules.techMaxImprovement
obj.techs[Rules.Tech.EDENTORP] = Rules.techMaxImprovement
obj.techs[Rules.Tech.EDENBOMB] = Rules.techMaxImprovement
obj.techs[Rules.Tech.EDENSTATION] = Rules.techMaxImprovement
示例11: isPactActive
def isPactActive(self, tran, obj, partnerID, pactID):
if partnerID == Const.OID_NONE:
return 0
partner = tran.db.get(partnerID, None)
if partner.type == Const.T_AIEDENPLAYER:
# force the peace!
if pactID in (Const.PACT_ALLOW_CIVILIAN_SHIPS, Const.PACT_ALLOW_MILITARY_SHIPS):
return Const.PACT_ACTIVE
# for other situations, handle it as proper player
return IPlayer.isPactActive(self, tran, obj, partnerID, pactID)
示例12: update
def update(self, tran, obj):
obj.techLevel = 99
obj.race = "p"
# call super method
IPlayer.update(self, tran, obj)
#
obj.techLevel = 99
# grant technologies
obj.techs[Rules.Tech.EMCANNONTUR] = Rules.techMaxImprovement
obj.techs[Rules.Tech.SSROCKET2] = Rules.techMaxImprovement
obj.techs[Rules.Tech.TORPEDO] = Rules.techMaxImprovement
# grant special technologies
obj.techs[Rules.Tech.PIRATEBASE] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEDEN] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATESD] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEBREWERY] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEPRISON] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRSMCOLONYMOD] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEFTLENG] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRCOLONYMOD] = Rules.techMaxImprovement
示例13: update
def update(self, tran, obj):
obj.techLevel = 99
obj.race = "r"
# grant technologies
# obj.techs[Rules.Tech.CANNON1] = 3
# obj.techs[Rules.Tech.SSROCKET] = 3
# obj.techs[Rules.Tech.RENEGADEBASE] = 3
# obj.techs[Rules.Tech.RENEGADEBASE2] = 3
# obj.techs[Rules.Tech.RENEGADEBASE2MINOR] = 3
# obj.techs[Rules.Tech.RENEGADEBASE3] = 3
# obj.techs[Rules.Tech.RENEGADEBASE3MINOR] = 3
# obj.techs[Rules.Tech.RENEGADECOSMODROME] = 3
# if not len(obj.shipDesigns) == 3:
# # three basic designs [they use modules not available to the player otherwise
# # so it has to be done this way]
# obj.shipDesigns[1] = ShipUtils.makeShipMinSpec(obj, 'Fighter', Rules.Tech.SMALLHULL1,
# {Rules.Tech.SCOCKPIT1:1, Rules.Tech.CANNON1:1}, [])
# obj.shipDesigns[2] = ShipUtils.makeShipMinSpec(obj, 'Corvette', Rules.Tech.SMALLHULL1,
# {Rules.Tech.SCOCKPIT1:1, Rules.Tech.CANNON1:2, Rules.Tech.STEELARM2:1}, [])
# obj.shipDesigns[3] = ShipUtils.makeShipMinSpec(obj, 'Frigate', Rules.Tech.MEDIUMHULL2,
# {Rules.Tech.SBRIDGE1:1, Rules.Tech.CANNON1:2, Rules.Tech.SSROCKET:2}, [])
# call super method
IPlayer.update(self, tran, obj)
示例14: update
def update(self, tran, obj):
# TODO: remove in 0.5.59
if not hasattr(self, "techs"):
self.techs = {}
obj.techLevel = 99
# call super method
IPlayer.update(self, tran, obj)
#
obj.techLevel = 99
# grant technologies
obj.techs[Rules.Tech.EMCANNONTUR] = Rules.techMaxImprovement
obj.techs[Rules.Tech.SSROCKET2] = Rules.techMaxImprovement
obj.techs[Rules.Tech.TORPEDO] = Rules.techMaxImprovement
# grant special technologies
obj.techs[Rules.Tech.PIRATEBASE] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEDEN] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATESD] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEBREWERY] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEPRISON] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEPRISON] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRSMCOLONYMOD] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRATEFTLENG] = Rules.techMaxImprovement
obj.techs[Rules.Tech.PIRCOLONYMOD] = Rules.techMaxImprovement
示例15: init
def init(self, obj):
IPlayer.init(self, obj)
#
obj.name = u'Renegade'
obj.login = '*'