def __init__(self):
     self.system = VS.getSystemName()
     playa = VS.getPlayer()
     self.msgColor = ("#9999FF", "#FF9999")
     if (playa):
         confed = faction_ships.factions[faction_ships.confed]
         pirates = faction_ships.factions[faction_ships.pirates]
         illustrious = launch.launch_wave_around_unit(
             'Illustrious', confed, faction_ships.getRandomCapitol(confed),
             'default', 1, 1000, 4000, playa)
         launch.launch_wave_around_unit(
             'Illustrious', confed, faction_ships.getRandomCapitol(confed),
             'default', 2, 1000, 2000, illustrious)
         launch.launch_wave_around_unit(
             'Illustrious', confed, faction_ships.getRandomFighter(confed),
             'default', 4, 100, 200, illustrious)
         launch.launch_wave_around_unit(
             'SlaverGuild', pirates,
             faction_ships.getRandomFighter(pirates), 'default', 4, 100,
             200, illustrious)
         launch.launch_wave_around_unit(
             'SlaverGuild', pirates,
             faction_ships.getRandomCapitol(pirates), 'default', 2, 100,
             200, illustrious)
         VS.IOmessage(
             3, "[Computer]", "privateer", self.msgColor[0] +
             "Scans show the remnants of the Slaver Guild being cleaned up by Special Forces."
         )
Example #2
0
 def __init__(self):
     playa = VS.getPlayer()
     if (playa):
         confed = faction_ships.factions[faction_ships.confed]
         pirates = faction_ships.factions[faction_ships.pirates]
         illustrious = launch.launch_wave_around_unit(
             'Illustrious', confed, faction_ships.getRandomCapitol(confed),
             'default', 1, 1000, 4000, playa)
         launch.launch_wave_around_unit(
             'Illustrious', confed, faction_ships.getRandomCapitol(confed),
             'default', 2, 1000, 2000, illustrious)
         launch.launch_wave_around_unit(
             'Illustrious', confed, faction_ships.getRandomFighter(confed),
             'default', 4, 100, 200, illustrious)
         launch.launch_wave_around_unit(
             'SlaverGuild', pirates,
             faction_ships.getRandomFighter(pirates), 'default', 4, 100,
             200, illustrious)
         launch.launch_wave_around_unit(
             'SlaverGuild', pirates,
             faction_ships.getRandomCapitol(pirates), 'default', 2, 100,
             200, illustrious)
         VS.IOmessage(
             3, "game", "all",
             "[Computer] Scans show the remnants of the Slaver Guild being cleaned up by Special Forces."
         )
 def __init__ (self):
     playa = VS.getPlayer()
     if (playa):
         confed = faction_ships.factions[faction_ships.confed]
         pirates = faction_ships.factions[faction_ships.pirates]
         illustrious=launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',1,1000,4000,playa)
         launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',2,1000,2000,illustrious)
         launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomFighter(confed),'default',4,100,200,illustrious)
         launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomFighter(pirates),'default',4,100,200,illustrious)
         launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomCapitol(pirates),'default',2,100,200,illustrious)
         VS.IOmessage (3,"game","all","[Computer] Scans show the remnants of the Slaver Guild being cleaned up by Special Forces.")
Example #4
0
 def __init__ (self):
     self.system = VS.getSystemName()
     playa = VS.getPlayer()
     self.msgColor = ("#9999FF","#FF9999")
     if (playa):
         confed = faction_ships.factions[faction_ships.confed]
         pirates = faction_ships.factions[faction_ships.pirates]
         illustrious=launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',1,1000,4000,playa)
         launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',2,1000,2000,illustrious)
         launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomFighter(confed),'default',4,100,200,illustrious)
         launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomFighter(pirates),'default',4,100,200,illustrious)
         launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomCapitol(pirates),'default',2,100,200,illustrious)
         VS.IOmessage (3,"[Computer]","privateer",self.msgColor[0]+"Scans show the remnants of the Slaver Guild being cleaned up by Special Forces.")
def launch_dockable_around_unit(fg,
                                faction,
                                ai,
                                radius,
                                myunit,
                                garbage_collection_distance,
                                logo='',
                                fgappend='',
                                skipdj=0):
    import fg_util
    for i in fg_util.LandedShipsInFG(fg, faction):
        if (i[0] == 'Mule.stock' or i[0] == 'Mule'
                or faction_ships.isCapital(i[0])):
            un = launch_types_around(fg, faction, [i], ai, radius, myunit,
                                     garbage_collection_distance, logo,
                                     fgappend, skipdj)
            if (un.isDockableUnit()):
                return un
    if (fgappend == 'Base'):
        fg = fgappend
    else:
        fg = fg + fgappend
    return launch.launch_wave_around_unit(
        fg, faction, faction_ships.getRandomCapitol(faction), ai, 1, radius,
        radius * 1.5, myunit, logo, 1, skipdj)
	def LaunchAlly(self):
		import launch
		import faction_ships
		import universe
		L = launch.Launch()
		L.faction=self.friendlyfaction
		L.fg="Patrol_Wing"
		L.dynfg=""
		L.minradius=3000.0
		L.maxradius=4000.0
		try:
			L.minradius*=faction_ships.launch_distance_factor
			L.maxradius*=faction_ships.launch_distance_factor
		except:
			pass
		L.num=1
		L.ai="default"
		L.type = faction_ships.getRandomCapitol(self.friendlyfaction)
		self.allyobj=VS.addObjective("Protect the %s"%L.type)
		self.ally = L.launch(self.you)
		L.type = faction_ships.getRandomFighter(self.friendlyfaction)
		import vsrandom
		L.num=vsrandom.randrange(3,6)
		L.launch(self.you)

		universe.greet(self.allygreetingtext,self.ally,self.you)
Example #7
0
 def Execute(self):
     if (VS.getPlayer()):
         iter = 0
         for base in self.fac:
             if (base.getDistance(VS.getPlayer()) < 0):
                 if (VS.GetGameTime() - self.delay > 4):
                     self.delay = VS.GetGameTime()
                     facname = self.facnames[iter]
                     if (facname == "random"):
                         facname = self.facnames[vsrandom.randrange(
                             0, len(self.facnames))]
                     type = faction_ships.getRandomFighter(facname)
                     if (iter >= len(self.facnames) / 2):
                         type = faction_ships.getRandomCapitol(facname)
                     tmp = launch.launch_wave_around_unit(
                         "Shadow_" + facname, facname, type, "default", 1,
                         200, 250, VS.getPlayer(), '', 0)
                     #                        tmp.upgrade("basic_armor",0,0,1,0)
                     #                        tmp.upgrade("shield_4_Level1",0,0,1,0)
                     #                        tmp.upgrade("reactor_level_2",0,0,1,0)
                     #                        tmp.upgrade("add_ablative_hull_coating",0,0,1,0)
                     #                        tmp.upgrade("add_sublimative_hull_coating",0,0,1,0)
                     VS.getPlayer().upgrade("tungsten", 0, 0, 1, 0)
                     VS.getPlayer().upgrade("tungsten_hull", 0, 0, 1, 0)
                 else:
                     VS.IOmessage(
                         0, "spawner", "all",
                         "Going to spawn " + self.facnames[iter] +
                         "starships in %d seconds at." %
                         (10 - (VS.GetGameTime() - self.delay)))
             iter += 1
Example #8
0
 def launch_new_wave(self):
     un = VS.getPlayer()
     if (vsrandom.randrange(0,4)==0):
         if (un):
             currentsystem = VS.getSystemFile()
             numadj=VS.GetNumAdjacentSystems(currentsystem)
             if (numadj):
                 cursys=VS.GetAdjacentSystem(currentsystem,vsrandom.randrange(0,numadj))
             else:
                 cursys = 'enigma_sector/heavens_gate'
             debug.info("TJ: jumping to "+cursys)
             un.JumpTo(cursys)
         else:
             debug.info("TJ: jumping to [ERROR: you are null]")
     side = vsrandom.randrange(0,2)
     faction="confed"
     ai = vsrandom.randrange(0,6)
     if (0 and ai==0):
         ai = "printhello.py"
     else:
         ai = "default"
     if (side==0):
         faction=faction_ships.get_enemy_of("confed")
     else:
         faction=faction_ships.get_friend_of("confed")
     launched = launch.launch_wave_around_unit ("Shadow",faction,faction_ships.getRandomFighter(faction),ai,vsrandom.randrange(1,10),100.0,2000.0,VS.getPlayer(),'')
     if (vsrandom.randrange(0,10)==0):
         launch.launch_wave_around_unit ("ShadowCap",faction,faction_ships.getRandomCapitol(faction),ai,1,2000.0,4000.0,VS.getPlayer(),'')
def launch_wave_around(fg,
                       faction,
                       ai,
                       nr_ships,
                       capship,
                       radius,
                       myunit,
                       garbage_collection_distance,
                       logo,
                       skipdj=0):
    pos = whereTo(radius, myunit)
    debug.debug("before" + str(nr_ships))
    (nr_ships, pos) = look_for(fg, faction, nr_ships, myunit, pos,
                               garbage_collection_distance)
    debug.debug("after " + str(nr_ships))
    while (nr_ships > 0):
        type = ""
        if (capship):
            type = faction_ships.getRandomCapitol(faction)
        else:
            type = faction_ships.getRandomFighter(faction)
        pos = LaunchNext(fg, faction, type, ai, pos, logo)
        nr_ships -= 1
    if (not skipdj):
        dj_lib.PlayMusik(0, dj_lib.HOSTILE_NEWLAUNCH_DISTANCE)
Example #10
0
	def LaunchAlly(self):
		import launch
		import faction_ships
		import universe
		L = launch.Launch()
		L.faction=self.friendlyfaction
		L.fg="Patrol_Wing"
		L.dynfg=""
		L.minradius=3000.0
		L.maxradius=4000.0
		try:
			L.minradius*=faction_ships.launch_distance_factor
			L.maxradius*=faction_ships.launch_distance_factor
		except:
			pass
		L.num=1
		L.ai="default"
		L.type = faction_ships.getRandomCapitol(self.friendlyfaction)
		self.ally = L.launch(self.you)
		self.ally.setMissionRelevant()
		self.allyobj=VS.addObjective("Protect the %s"%unit.getUnitFullName(self.ally))
		L.type = faction_ships.getRandomFighter(self.friendlyfaction)
		import vsrandom
		L.num=vsrandom.randrange(3,6)
		L.launch(self.you)

		universe.greet(self.allygreetingtext,self.ally,self.you)
Example #11
0
    def Execute(self):
        if (VS.getPlayer()):
            iter = 0
            for base in self.fac:

                if (base.getDistance(VS.getPlayer()) < 0):
                    if (VS.GetGameTime() - self.delay > 10):
                        self.delay = VS.GetGameTime()
                        type = faction_ships.getRandomFighter(
                            self.facnames[iter])
                        if (iter >= len(self.facnames) / 2):
                            type = faction_ships.getRandomCapitol(
                                self.facnames[iter])
                        launch.launch_wave_around_unit(
                            "Shadow_" + self.facnames[iter],
                            self.facnames[iter], type, "default", 1, 200, 250,
                            VS.getPlayer(), '', 0)
                        VS.getPlayer().upgrade("tungsten", 0, 0, 1, 0)
                        VS.getPlayer().upgrade("tungsten_hull", 0, 0, 1, 0)
                    else:
                        VS.IOmessage(
                            0, "spawner", "all",
                            "Going to spawn " + self.facnames[iter] +
                            "starships in %d seconds at." %
                            (10 - (VS.GetGameTime() - self.delay)))
                iter += 1
def AddFighterTo(fgname,fac,isNew=False):
    sys = VS.getSystemFile()
    #print 'add fighter'
    import generate_dyn_universe
    numsystems = generate_dyn_universe.systemcount[fac]
    if (VS.GetGalaxyFaction(sys)!=fac):
        try:
            homeworlds=faction_ships.production_centers
        except:
            homeworlds=faction_ships.homeworlds
        if fac in homeworlds:
            if type(homeworlds[fac])==type(""):
                sys=homeworlds[fac]
            else:
                sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))]
    numfighters = int(generate_dyn_universe.XProductionRate(fac,faction_ships.fighterProductionRate)*numsystems)
    try:
        if fac in faction_ships.staticFighterProduction:
            numfighters+=faction_ships.staticFighterProduction[fac]
    except:
        pass
    if (numfighters<1):
        if (vsrandom.uniform(0,1)<numfighters):
            numfighters=1
    #print "Generating "+str(numfighters)+ " fighters for "+fac+" at "+sys
    if isNew:
        fgk=fg_util.AllFGsInSystem(fac,sys)        
        if len(fgk):
            fgname=fgk[vsrandom.randrange(0,len(fgk))]
            stat=6
            if fac in faction_ships.fightersPerFG:
                stat=faction_ships.fightersPerFG[fac]
            elif "default" in faction_ships.fightersPerFG:
                stat=faction_ships.fightersPerFG["default"]
            if fg_util.NumShipsInFG(fgname,fac)+numfighters<=numfighters+stat:
                isNew=False
        if isNew:
            fgname=generate_dyn_universe.GetNewFGName(fac)
    if numfighters>=1:
        fg_util.AddShipsToFG (fgname,fac,((faction_ships.getRandomFighter(fac),int(numfighters)),),sys)
    numcapships = generate_dyn_universe.XProductionRate(fac,faction_ships.capitalProductionRate)*numsystems
    if (numcapships<1):
        if (vsrandom.uniform(0,1)>numcapships):
            return
        numcapships=1
    sys = fg_util.FGSystem(fgname,fac)
    if (1 or VS.GetGalaxyFaction(sys)!=fac):
        try:
            homeworlds=faction_ships.production_centers
        except:
            homeworlds=faction_ships.homeworlds
        if fac in homeworlds:
            if type(homeworlds[fac])==type(""):
                sys=homeworlds[fac]
            else:
                sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))]
    cap =faction_ships.getRandomCapitol(fac)
    #print "Generating "+str(numcapships)+ " capship "+cap+" for "+fac+" at "+sys
    fg_util.AddShipsToFG(fgname,fac,((cap,int(numcapships)),),sys)
Example #13
0
def AddFighterTo(fgname,fac,isNew=False):
    sys = VS.getSystemFile()
    #debug.debug('add fighter')
    numsystems = generate_dyn_universe.systemcount[fac]
    if (VS.GetGalaxyFaction(sys)!=fac):
        try:
            homeworlds=faction_ships.production_centers
        except:
            homeworlds=faction_ships.homeworlds
        if fac in homeworlds:
            if type(homeworlds[fac])==type(""):
                sys=homeworlds[fac]
            else:
                sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))]
    numfighters = int(generate_dyn_universe.XProductionRate(fac,faction_ships.fighterProductionRate)*numsystems)
    try:
        if fac in faction_ships.staticFighterProduction:
            numfighters+=faction_ships.staticFighterProduction[fac]
    except:
        pass
    if (numfighters<1):
        if (vsrandom.uniform(0,1)<numfighters):
            numfighters=1
    #debug.debug("Generating "+str(numfighters)+ " fighters for "+fac+" at "+sys)
    if isNew:
        fgk=fg_util.FGsInSystem(fac,sys)        
        if len(fgk):
            fgname=fgk[vsrandom.randrange(0,len(fgk))]
            stat=6
            if fac in faction_ships.fightersPerFG:
                stat=faction_ships.fightersPerFG[fac]
            elif "default" in faction_ships.fightersPerFG:
                stat=faction_ships.fightersPerFG["default"]
            if fg_util.NumShipsInFG(fgname,fac)+numfighters<=numfighters+stat:
                isNew=False
        if isNew:
            fgname=generate_dyn_universe.GetNewFGName(fac)
    if numfighters>=1:
        fg_util.AddShipsToFG (fgname,fac,((faction_ships.getRandomFighter(fac),int(numfighters)),),sys)
    numcapships = generate_dyn_universe.XProductionRate(fac,faction_ships.capitalProductionRate)*numsystems
    if (numcapships<1):
        if (vsrandom.uniform(0,1)>numcapships):
            return
        numcapships=1
    sys = fg_util.FGSystem(fgname,fac)
    if (1 or VS.GetGalaxyFaction(sys)!=fac):
        try:
            homeworlds=faction_ships.production_centers
        except:
            homeworlds=faction_ships.homeworlds
        if fac in homeworlds:
            if type(homeworlds[fac])==type(""):
                sys=homeworlds[fac]
            else:
                sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))]
    cap =faction_ships.getRandomCapitol(fac)
    #debug.debug("Generating "+str(numcapships)+ " capship "+cap+" for "+fac+" at "+sys)
    fg_util.AddShipsToFG(fgname,fac,((cap,int(numcapships)),),sys)
Example #14
0
def launch_dockable_around_unit (fg,faction,ai,radius,myunit,garbage_collection_distance,logo='',fgappend=''):
    for i in fg_util.LandedShipsInFG(fg,faction):
        if (i[0]=='mule.blank' or i[0]=='mule' or faction_ships.isCapital(i[0])):
            un=launch_types_around (fg,faction,[i],ai,radius,myunit,garbage_collection_distance,logo,fgappend)
            if (un.isDockableUnit()):
                return un
    if (fgappend=='Base'):
        fg=fgappend
    else:
        fg=fg+fgappend
    return launch.launch_wave_around_unit(fg,faction,faction_ships.getRandomCapitol(faction),ai,1,radius,radius*1.5,myunit,logo)
Example #15
0
 def DeletePatrolPoint(self, num, nam):
     import vsrandom
     if (vsrandom.random() < self.encounterprob):
         import faction_ships
         fac = self.faction
         if (type(fac) is list or type(fac) is tuple):
             fac = fac[vsrandom.randrange(0, len(fac))]
         dynfg = ""
         import fg_util
         import VS
         allfg = fg_util.AllFGsInSystem(fac, VS.getSystemFile())
         if (len(allfg)):
             dynfg = allfg[vsrandom.randrange(0, len(allfg))]
         for i in range(vsrandom.randrange(self.minships,
                                           self.maxships + 1)):
             import launch
             L = launch.Launch()
             if self.fgname == "":
                 fgname = "Patrol"
             else:
                 fgname = self.fgname
             L.fg = fgname
             L.dynfg = dynfg
             if (vsrandom.random() < self.capshipprob):
                 L.type = faction_ships.getRandomCapitol(fac)
             else:
                 L.type = faction_ships.getRandomFighter(fac)
             L.ai = "default"
             L.faction = fac
             L.num = 1
             L.minradius = 3000.0
             L.maxradius = 4000.0
             if i == 0:
                 L.fgappend = ""
             else:
                 L.fgappend = "_" + str(i)
             try:
                 L.minradius *= faction_ships.launch_distance_factor
                 L.maxradius *= faction_ships.launch_distance_factor
             except:
                 pass
             if (self.patrolpoints[num]):
                 newun = L.launch(self.patrolpoints[num])
                 if (self.forceattack):
                     lead = newun.getFlightgroupLeader()
                     if (lead):
                         lead.SetTarget(self.you)
                     else:
                         newun.setFlightgroupLeader(newun)
                     newun.SetTarget(self.you)
                     newun.setFgDirective("A.")
                 self.Track(newun)
     patrol.patrol.DeletePatrolPoint(self, num, nam)
Example #16
0
 def DeletePatrolPoint(self,num,nam):
     import vsrandom
     if (vsrandom.random()<self.encounterprob):
         import faction_ships
         fac=self.faction
         if (type(fac) is list or type(fac) is tuple):
             fac = fac[vsrandom.randrange(0,len(fac))]
         dynfg=""
         import fg_util
         import VS
         allfg=fg_util.AllFGsInSystem(fac,VS.getSystemFile())
         if (len(allfg)):
             dynfg = allfg[vsrandom.randrange(0,len(allfg))]
         for i in range(vsrandom.randrange(self.minships,self.maxships+1)):
             import launch
             L=launch.Launch()
             if self.fgname=="":
                 fgname="Patrol"
             else:
                 fgname = self.fgname
             L.fg = fgname
             L.dynfg=dynfg
             if (vsrandom.random()<self.capshipprob):
                 L.type=faction_ships.getRandomCapitol(fac)
             else:
                 L.type=faction_ships.getRandomFighter(fac)
             L.ai="default"
             L.faction=fac
             L.num=1
             L.minradius=3000.0
             L.maxradius=4000.0
             if i == 0:
                 L.fgappend=""
             else:
                 L.fgappend="_"+str(i)
             try:
                 L.minradius*=faction_ships.launch_distance_factor
                 L.maxradius*=faction_ships.launch_distance_factor
             except:
                 pass
             if (self.patrolpoints[num]):
                 newun=L.launch(self.patrolpoints[num])
                 if (self.forceattack):
                     lead=newun.getFlightgroupLeader()
                     if (lead):
                         lead.SetTarget(self.you)
                     else:
                         newun.setFlightgroupLeader(newun)
                     newun.SetTarget(self.you)
                     newun.setFgDirective("A.")
                 self.Track(newun)
     patrol.patrol.DeletePatrolPoint(self,num,nam)
Example #17
0
def launch_wave_around ( fg, faction, ai, nr_ships, capship, radius, myunit, garbage_collection_distance,logo):
    pos = whereTo(radius, myunit)
    debug.info("launch_wave_around: before"+str(nr_ships))
    (nr_ships,pos) = look_for (fg,faction,nr_ships,myunit,pos,garbage_collection_distance)
    debug.info("launch_wave_around: after "+str(nr_ships))
    while (nr_ships>0):
        type=""
        if (capship):
            type = faction_ships.getRandomCapitol(faction)
        else:
            type = faction_ships.getRandomFighter(faction)
        pos = LaunchNext (fg,faction,type, ai, pos,logo)
        nr_ships-=1
Example #18
0
def launch_wave_around ( fg, faction, ai, nr_ships, capship, radius, myunit, garbage_collection_distance,logo,skipdj=0):
    pos = whereTo(radius, myunit)
    debug.debug("before"+str(nr_ships))
    (nr_ships,pos) = look_for (fg,faction,nr_ships,myunit,pos,garbage_collection_distance)
    debug.debug("after "+str(nr_ships))
    while (nr_ships>0):
        type=""
        if (capship):
            type = faction_ships.getRandomCapitol(faction)
        else:
            type = faction_ships.getRandomFighter(faction)
        pos = LaunchNext (fg,faction,type, ai, pos,logo)
        nr_ships-=1
    if (not skipdj):
        dj_lib.PlayMusik(0,dj_lib.HOSTILE_NEWLAUNCH_DISTANCE)
Example #19
0
    def Execute (self):
        if (VS.getPlayer()):
            iter=0
            for base in self.fac:

                if (base.getDistance(VS.getPlayer())<0):
                    if (VS.GetGameTime()-self.delay>10):
                        self.delay=VS.GetGameTime()
                        type=faction_ships.getRandomFighter(self.facnames[iter])
                        if (iter>=len(self.facnames)/2):
                            type=faction_ships.getRandomCapitol(self.facnames[iter])
                        launch.launch_wave_around_unit("Shadow_"+self.facnames[iter],self.facnames[iter],type,"default",1,200,250,VS.getPlayer(),'',0)
                        VS.getPlayer().upgrade("tungsten",0,0,1,0)
                        VS.getPlayer().upgrade("tungsten_hull",0,0,1,0)
                    else:
                        VS.IOmessage(0,"spawner","all","Going to spawn "+self.facnames[iter]+"starships in %d seconds at."%(10-(VS.GetGameTime()-self.delay)))
                iter+=1
Example #20
0
 def launch_new_wave(self):
     side = vsrandom.randrange(0, 2)
     faction = "confed"
     ai = vsrandom.randrange(0, 8)
     if (0 and ai == 0):
         ai = "printhello.py"
     else:
         ai = "default"
     if (side == 0):
         faction = faction_ships.get_enemy_of("confed")
     else:
         faction = "merchant"
     launched = launch.launch_wave_around_unit(
         "Shadow", faction, faction_ships.getRandomFighter(faction), ai,
         vsrandom.randrange(1, 5), 100.0, 2000.0, VS.getPlayer(), '')
     if (vsrandom.randrange(0, 10) == 0 or faction == "luddites"):
         launch.launch_wave_around_unit(
             "ShadowCap" + str(vsrandom.randrange(0, 10)), faction,
             faction_ships.getRandomCapitol(faction), ai, 1, 2000.0, 4000.0,
             VS.getPlayer(), '')
Example #21
0
    def Execute (self):
        if (VS.getPlayer()):
            iter=0
            for base in self.fac:                
                if (base.getDistance(VS.getPlayer())<0):
                    if (VS.GetGameTime()-self.delay>4):
                        self.delay=VS.GetGameTime()
                        facname = self.facnames[iter]
                        if (facname=="random"):
                            facname=self.facnames[vsrandom.randrange(0,len(self.facnames))]
                        type=faction_ships.getRandomFighter(facname)
                        if (iter>=len(self.facnames)/2):
                            type=faction_ships.getRandomCapitol(facname)
                        tmp=launch.launch_wave_around_unit("Shadow_"+facname,facname,type,"default",1,200,250,VS.getPlayer(),'',0)
#                        tmp.upgrade("basic_armor",0,0,1,0)
#                        tmp.upgrade("shield_4_Level1",0,0,1,0)
#                        tmp.upgrade("reactor_level_2",0,0,1,0)
#                        tmp.upgrade("add_ablative_hull_coating",0,0,1,0)
#                        tmp.upgrade("add_sublimative_hull_coating",0,0,1,0)
                        VS.getPlayer().upgrade("tungsten",0,0,1,0)
                        VS.getPlayer().upgrade("tungsten_hull",0,0,1,0)
                    else:
                        VS.IOmessage(0,"spawner","all","Going to spawn "+self.facnames[iter]+"starships in %d seconds at."%(10-(VS.GetGameTime()-self.delay)))
                iter+=1
Example #22
0
    def __init__ (self,you, landable_only, distance_away_to_trigger,base_only=0,capshipfaction="", dyn_fg="", showObjective=1, forcestarship=0):
        self.obj=0
        self.showObjective=showObjective
        self.orbitee=""
        self.capship=0
        self.you = you
        self.arrivedarea=0
        self.distfrombase=distance_away_to_trigger
        significant=VS.Unit()
        aroundthe=""
        self.sysfil=VS.getSystemFile()
        if (landable_only or base_only):
            randint=vsrandom.randrange(0,128)
            lim=1
            if landable_only and not base_only:
                lim=10
            for i in xrange(lim):
                significant = unit.getSignificant (randint,landable_only,base_only)
                
                if significant.isPlanet():
                    break
                else:
                    randint+=1
            if (landable_only and not unit.isLandable(significant)) or forcestarship:
                self.capship=1
                if (capshipfaction==""):
                    capshipfaction="merchant"
            if (self.capship and capshipfaction!=""):
                if (significant.isNull()):
                    significant=you
                self.orbitee="%s" % (significant.getName())
                self.capship=1
                print "orbitee %s " % self.orbitee
                if (dyn_fg==""):
                    newship=faction_ships.getRandomCapitol(capshipfaction)
                    found=False
                    near=2000.0
                    far=5000.0
                    try:
                        near*=faction_ships.launch_distance_factor
                        far*=faction_ships.launch_distance_factor
                    except:
                        pass

                    i=VS.getUnitList()
                    while i.notDone():
                        testun = i.current()
                        i.advance()
                        if testun.getFactionName()==capshipfaction and faction_ships.isCapital(testun.getName()):
                           significant=moveUnitTo(testun,significant,near)
                           found=True
                           break
                    if (not found):
                        significant=launch.launch_wave_around_unit("Base",capshipfaction,newship,"sitting_duck",1,near,far,significant,"")
                else:
                    near=5000.0
                    try:
                        near*=faction_ships.launch_distance_factor
                    except:
                        pass
                    found=False
                    aroundthe=" near "+unit.getUnitFullName(significant,True);
                    i = VS.getUnitList()
                    while i.notDone():
                        testun = i.current()
                        i.advance()
                        if testun.getFactionName()==capshipfaction and faction_ships.isCapital(testun.getName()):
                           significant=moveUnitTo(testun,significant,near)
                           found=True
                           break
                    if (not found):
                        significant=launch_recycle.launch_dockable_around_unit(dyn_fg,capshipfaction,"sitting_duck",near,significant,4*near,'','Base')
                    significant.setFullname(dyn_fg)
        else:
            significant = universe.getRandomJumppoint ()
        if (significant.isNull()):
            print "ERROR: no significants found in starsystem %s" % (self.sysfil)
            self.significantun=VS.getPlayer()
        else:
            self.significantun=significant
            self.significantun.setMissionRelevant()
            #qualifier="the "
            #if (significant.isPlanet() and significant.isDockableUnit()):
            #    qualifier=""
            if (self.showObjective):
                self.obj=VS.addObjective("Visit %s %s" % (self.getSignificantFullName (),aroundthe))
                VS.setOwner(self.obj,VS.getPlayer())
Example #23
0
 def Execute(self):
     isSig = 0
     if (self.you.isNull()):
         self.Lose(1)
         return
     if (self.arrived == 3):
         if (not self.runaway):
             if (not self.istarget):
                 quest_drone.drone.SetTarget(self.you)
         if quest_drone.drone:
             pos = quest_drone.drone.LocalPosition()
             yourpos = self.you.LocalPosition()
             if pos[0] < yourpos[0] - 10000 or pos[0] > yourpos[
                     0] + 10000 or pos[1] < yourpos[1] - 10000 or pos[
                         1] > yourpos[1] + 10000 or pos[2] < yourpos[
                             2] - 10000 or pos[2] > yourpos[2] + 10000:
                 quest_drone.drone.SetPosition(
                     (yourpos[0] - 1000, yourpos[1] - 4000,
                      yourpos[2] + 1000))
         else:
             self.Win(self.you, 1)
             return
     elif (self.arrived == 2):
         #significant=self.adjsys.SignificantUnit()
         #if (significant.isNull ()):
         #    debug.debug("sig null")
         #    VS.terminateMission(0)
         #    return
         if (1):
             if (1):
                 newshipgood = "broadsword"  #faction_ships.getRandomFighter(self.goodfaction)
                 #quest_drone.drone=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",4,3000.0,4000.0,significant)
                 L = launch.Launch()
                 L.fg = "AlphaPrime"
                 L.dynfg = ''
                 L.type = newshipgood
                 L.faction = self.goodfaction
                 L.ai = "default"
                 L.num = 4
                 L.minradius = 5000.0
                 L.maxradius = 6000.0
                 try:
                     L.minradius *= faction_ships.launch_distance_factor
                     L.maxradius *= faction_ships.launch_distance_factor
                 except:
                     pass
                 goodguysC = L.launch(self.you)
                 L.num = 1
                 L.type = faction_ships.getRandomCapitol(self.goodfaction)
                 goodguysA = L.launch(self.you)
                 if not quest_drone.drone:
                     L = launch.Launch()
                     L.fg = "Shadow"
                     L.dynfg = ''
                     L.type = self.newshipattack
                     L.faction = self.attackfaction
                     L.ai = "default"
                     L.num = 1
                     L.minradius = 15000.0
                     L.maxradius = 15000.0
                     try:
                         L.minradius *= faction_ships.launch_distance_factor
                         L.maxradius *= faction_ships.launch_distance_factor
                     except:
                         pass
                     quest_drone.drone = L.launch(self.you)
                 if quest_drone.drone.getUnitSystemFile(
                 ) != VS.getSystemFile():
                     quest_drone.drone.JumpTo(VS.getSystemFile())
                 goodguysC.SetTarget(quest_drone.drone)
                 goodguysA.SetTarget(quest_drone.drone)
                 self.you.SetTarget(quest_drone.drone)
                 self.obj = VS.addObjective("Destroy the %s ship." %
                                            (quest_drone.drone.getName()))
                 if (quest_drone.drone):
                     self.arrived = 3
                 else:
                     debug.info("enemy null")
                     VS.terminateMission(0)
                     return
                 #quest_drone.drone.SetHull(40.0)
     elif self.arrived == 1:
         if VS.getSystemFile() == self.helpsystem:
             if (VS.GetGameTime() - self.jumpingtime > 78):
                 self.you.JumpTo(self.lastjump)
                 self.jumpingtime = VS.GetGameTime() + 10000000.
             elif self.helper:
                 self.helper.DeactivateJumpDrive()
                 self.helper.SetTarget(VS.Unit())
                 #self.helper.SetVelocity( (0,0,0) )
                 #self.helper.SetPosition( self.helperpos )
         if (self.adjsys.Execute()):
             self.arrived = 2
             if (self.newshipattack == ""):
                 self.newshipattack = faction_ships.getRandomFighter(
                     self.attackfaction)
             #self.adjsys=go_somewhere_significant(self.you,0,10000.0,0,'','',self.displayLocation)
             #localdestination=self.adjsys.SignificantUnit().getName()
             tmpfg = "shadow"
             #VS.IOmessage (3,"defend mission",self.mplay,"Hunt the %s unit in the %s flightgroup in this system." % (self.newshipattack,tmpfg))
             #if (self.runaway):        #ADD OTHER JUMPING IF STATEMENT CODE HERE
             #    VS.IOmessage (4,"defend mission",self.mplay,"Target is fleeing to the jump point!")
             #    VS.IOmessage (5,"defend mission",self.mplay,"Target Destination appears to be %s" % (localdestination))
             VS.IOmessage(1, "Admiral Reismann", self.mplay,
                          "You're just in time for the massacre!")
             VS.IOmessage(
                 5, "Admiral Reismann", self.mplay,
                 "Cut the chatter and listen: This is Admiral Reismann. We'll hit the thing as soon as it arrives. Hold your position until it does. And, uh, feel free to join in. Reismann out."
             )
             VS.playSound("campaign/Reismann.wav", (0., 0., 0.),
                          (0., 0., 0.))
     else:
         if VS.getSystemFile() == self.helpsystem:
             debug.info("Launching helper ship!")
             if (self.newshiphelp == ""):
                 self.newshiphelp = faction_ships.getRandomFighter(
                     self.helpfaction)
             L = launch.Launch()
             L.fg = "Unknown"
             L.dynfg = ''
             L.type = self.newshiphelp
             L.faction = self.helpfaction
             L.ai = "default"
             L.num = 1
             L.minradius = 1500.0
             L.maxradius = 1600.0
             try:
                 L.minradius *= faction_ships.launch_distance_factor
                 L.maxradius *= faction_ships.launch_distance_factor
             except:
                 pass
             self.helper = L.launch(self.you)
             self.helperpos = self.helper.Position()
             self.you.SetTarget(self.helper)
             universe.greet(self.greetingText, self.helper, self.you)
             whichmount = self.you.removeWeapon("Steltek", 0, True)
             if (whichmount != -1):
                 self.you.upgrade('steltek_gun_boosted', whichmount,
                                  whichmount, True, True)
             self.jumpingtime = VS.GetGameTime()
             self.arrived = 1
Example #24
0
 def Execute (self):
     isSig=0
     if (self.you.isNull()):
         self.Lose (1)
         return
     if (self.arrived==3):
         if (not self.runaway):
             if (not self.istarget):
                 quest_drone.drone.SetTarget(self.you)
         if quest_drone.drone:
             pos=quest_drone.drone.LocalPosition()
             yourpos=self.you.LocalPosition()
             if pos[0]<yourpos[0]-10000 or pos[0]>yourpos[0]+10000 or pos[1]<yourpos[1]-10000 or pos[1]>yourpos[1]+10000 or pos[2]<yourpos[2]-10000 or pos[2]>yourpos[2]+10000:
                 quest_drone.drone.SetPosition((yourpos[0]-1000,yourpos[1]-4000,yourpos[2]+1000))
         else:
             self.Win(self.you,1)
             return
     elif (self.arrived==2):
         #significant=self.adjsys.SignificantUnit()
         #if (significant.isNull ()):
         #    debug.debug("sig null")
         #    VS.terminateMission(0)
         #    return
         if (1):
             if (1):
                 newshipgood="broadsword"#faction_ships.getRandomFighter(self.goodfaction)
                 #quest_drone.drone=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",4,3000.0,4000.0,significant)
                 L = launch.Launch()
                 L.fg="AlphaPrime"
                 L.dynfg=''
                 L.type = newshipgood
                 L.faction = self.goodfaction
                 L.ai = "default"
                 L.num=4
                 L.minradius=5000.0
                 L.maxradius = 6000.0
                 try:
                     L.minradius*=faction_ships.launch_distance_factor
                     L.maxradius*=faction_ships.launch_distance_factor
                 except:
                     pass
                 goodguysC=L.launch(self.you)
                 L.num=1
                 L.type=faction_ships.getRandomCapitol(self.goodfaction);
                 goodguysA=L.launch(self.you)
                 if not quest_drone.drone:
                         L = launch.Launch()
                         L.fg="Shadow"
                         L.dynfg=''
                         L.type = self.newshipattack
                         L.faction = self.attackfaction
                         L.ai = "default"
                         L.num=1
                         L.minradius=15000.0
                         L.maxradius = 15000.0
                         try:
                             L.minradius*=faction_ships.launch_distance_factor
                             L.maxradius*=faction_ships.launch_distance_factor
                         except:
                             pass
                         quest_drone.drone=L.launch(self.you)
                 if quest_drone.drone.getUnitSystemFile()!=VS.getSystemFile():
                     quest_drone.drone.JumpTo(VS.getSystemFile())
                 goodguysC.SetTarget(quest_drone.drone)
                 goodguysA.SetTarget(quest_drone.drone)
                 self.you.SetTarget(quest_drone.drone)
                 self.obj=VS.addObjective("Destroy the %s ship." % (quest_drone.drone.getName ()))
                 if (quest_drone.drone):
                     self.arrived=3
                 else:
                     debug.info("enemy null")
                     VS.terminateMission(0)
                     return
                 #quest_drone.drone.SetHull(40.0)
     elif self.arrived==1:
         if VS.getSystemFile()==self.helpsystem:
             if (VS.GetGameTime()-self.jumpingtime>78):
                 self.you.JumpTo(self.lastjump)
                 self.jumpingtime=VS.GetGameTime()+10000000.
             elif self.helper:
                 self.helper.DeactivateJumpDrive()
                 self.helper.SetTarget(VS.Unit())
                 #self.helper.SetVelocity( (0,0,0) )
                 #self.helper.SetPosition( self.helperpos )
         if (self.adjsys.Execute()):
             self.arrived=2
             if (self.newshipattack==""):
                 self.newshipattack=faction_ships.getRandomFighter(self.attackfaction)
             #self.adjsys=go_somewhere_significant(self.you,0,10000.0,0,'','',self.displayLocation)
             #localdestination=self.adjsys.SignificantUnit().getName()
             tmpfg="shadow"
             #VS.IOmessage (3,"defend mission",self.mplay,"Hunt the %s unit in the %s flightgroup in this system." % (self.newshipattack,tmpfg))
             #if (self.runaway):        #ADD OTHER JUMPING IF STATEMENT CODE HERE
             #    VS.IOmessage (4,"defend mission",self.mplay,"Target is fleeing to the jump point!")
             #    VS.IOmessage (5,"defend mission",self.mplay,"Target Destination appears to be %s" % (localdestination))
             VS.IOmessage (1,"Admiral Reismann",self.mplay,"You're just in time for the massacre!")
             VS.IOmessage (5,"Admiral Reismann",self.mplay,"Cut the chatter and listen: This is Admiral Reismann. We'll hit the thing as soon as it arrives. Hold your position until it does. And, uh, feel free to join in. Reismann out.")
             VS.playSound("campaign/Reismann.wav",(0.,0.,0.),(0.,0.,0.))
     else:
         if VS.getSystemFile()==self.helpsystem:
                 debug.info("Launching helper ship!")
                 if (self.newshiphelp==""):
                     self.newshiphelp=faction_ships.getRandomFighter(self.helpfaction)
                 L = launch.Launch()
                 L.fg="Unknown"
                 L.dynfg=''
                 L.type = self.newshiphelp
                 L.faction = self.helpfaction
                 L.ai = "default"
                 L.num=1
                 L.minradius=1500.0
                 L.maxradius = 1600.0
                 try:
                     L.minradius*=faction_ships.launch_distance_factor
                     L.maxradius*=faction_ships.launch_distance_factor
                 except:
                     pass
                 self.helper=L.launch(self.you)
                 self.helperpos=self.helper.Position()
                 self.you.SetTarget(self.helper)
                 universe.greet(self.greetingText,self.helper,self.you)
                 whichmount=self.you.removeWeapon("Steltek",0,True)
                 if (whichmount!=-1):
                     self.you.upgrade('steltek_gun_boosted',whichmount,whichmount,True,True)
                 self.jumpingtime=VS.GetGameTime()                
                 self.arrived=1
Example #25
0
 def launch_new_wave(self):
     side = vsrandom.randrange(0,2)
     faction="confed"
     ai = vsrandom.randrange(0,8)
     if (0 and ai==0):
         ai = "printhello.py"
     else:
         ai = "default"
     if (side==0):
         faction=faction_ships.get_enemy_of("confed")
     else:
         faction="merchant"
     launched = launch.launch_wave_around_unit ("Shadow",faction,faction_ships.getRandomFighter(faction),ai,vsrandom.randrange(1,5),100.0,2000.0,VS.getPlayer(),'')
     if (vsrandom.randrange(0,10)==0 or faction=="luddites"):
         launch.launch_wave_around_unit ("ShadowCap"+str(vsrandom.randrange(0,10)),faction,faction_ships.getRandomCapitol(faction),ai,1,2000.0,4000.0,VS.getPlayer(),'')