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
def update(self, tran, obj): self.setStartingTechnologies(obj) self.setStartingShipDesigns(obj) # create two basic designs [they use modules not available to the # player otherwise so it has to be done this way] # call super method IPlayer.update(self, tran, obj)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Pirate' obj.login = '******' # obj.pirateFame = 0 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 # 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
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)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Pirate' obj.login = '******' # obj.pirateFame = 0
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)
def __init__(self, controller): IPlayer.__init__(self, "Computer", controller) self.hit_list = [] self.nearby_moves = [] # will hold the nearby tiles from the hit_list. # for example if in the hit_list we have (2,2), then in the nearby_moves # we will have [(1,2), (3, 2), (2, 1), (2, 3)] self.moves_made = [ ] # will hold all the moves (attacks) that were attempted by the computer, whether they
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)
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
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)
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
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)
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
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
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
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[Const.OID_UNIVERSE].turn % Rules.turnsPerDay == 0: Utils.sendMessage(tran, obj, Const.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
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)
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
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)
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
def update(self, tran, obj): obj.techLevel = 2 # grant technologies obj.techs[Rules.Tech.EMCANNON] = Rules.techMaxImprovement # call super method IPlayer.update(self, tran, obj)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'E.D.E.N.' obj.race = "e" obj.login = '******'
def init(self, obj): IPlayer.init(self, obj) obj.techLevel = 3 obj.race = "p" obj.pirateFame = 0
def processFINALPhase(self, tran, obj, data): IPlayer.processFINALPhase(self, tran, obj, data) # fix goverment power obj.govPwrCtrlRange = 10000
def processDIPLPhase(self, tran, obj, data): self.forceAllyWithEDEN(tran,obj) IPlayer.processDIPLPhase(self,tran, obj, data)
def init(self, obj): IPlayer.init(self, obj) obj.pirateFame = 0
def processINITPhase(self, tran, obj, data): IPlayer.processINITPhase(self, tran, obj, data) obj.lastLogin = time.time()
def update(self, tran, obj): obj.techLevel = 1 # grant technologies obj.techs[Rules.Tech.CANNON1] = Rules.techMaxImprovement # call super method IPlayer.update(self, tran, obj)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Renegade' obj.login = '******'
def init(self, obj): IPlayer.init(self, obj) # obj.name = u"NATURE" obj.login = "******"
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
def update(self, tran, obj): self.setStartingTechnologies(obj) self.setStartingShipDesigns(obj) IPlayer.update(self, tran, obj)
def update(self, tran, obj): # call super method IPlayer.update(self, tran, obj)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'NATURE' obj.login = '******'
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Rebels' obj.login = '******'
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)
def __init__(self, name: str, controller): IPlayer.__init__(self, name, controller)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Renegade' obj.race = "r" obj.login = '******'
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Mutant' obj.login = '******'
def processDIPLPhase(self, tran, obj, data): self.forceAllyWithEDEN(tran, obj) IPlayer.processDIPLPhase(self, tran, obj, data)
def init(self, obj): IPlayer.init(self, obj) # obj.name = u'Mutant' obj.race = "m" obj.login = '******'