def Execute(self): escort_mission.escort_mission.Execute(self) sys = self.escortee.getUnitSystemFile() if sys in self.alternatesystems: for i in range(len(self.alternatesystems)): if sys == self.alternatesystems[i]: import quest quest.removeQuest(self.cp, self.alternatevariable, i) quest.removeQuest(self.cp, self.var_to_set, -1) import VS import launch L = launch.Launch() L.fg = "Escorts" L.faction = self.alternatefactions[i] L.dynfg = self.alternateflightgroups[i] L.type = self.alternatetypes[i] L.ai = "default" L.num = 6 L.minradius = 3000.0 L.maxradius = 4000.0 try: L.minradius *= faction_ships.launch_distance_factor L.minradius *= faction_ships.launch_distance_factor except: pass launched = L.launch(self.escortee) self.escortee.setFgDirective('f') self.escortee.setFlightgroupLeader(launched) self.escortee.setFactionName(self.alternatefactions[i]) import universe universe.greet(self.alternategreeting[i], launched, VS.getPlayerX(self.cp)) VS.terminateMission(1) return
def pick_and_start(self, job_id): (app, conf) = self.pick_pair() apk_file = app.get_apk_path() dev = conf.obtain_device() dev.check_config_template(True) logger.debug("config dev: %s" % dev.get_avd_name()) if settings.use_app_template: app_conf = app.obtain_config(conf) app_dev = app_conf.obtain_device() logger.debug("app dev: %s" % app_dev.get_avd_name()) if not app_dev.exists(): logger.info("app template does not exist, create it") app_dev.create_from_config_template() launcher = launch.Launch(app_dev, apk_file) logger.info("app template created. installing components") launcher.prepare_app_template() logger.info("app template ready") config_line = app_conf.encode() else: config_line = conf.encode() self.launch_job(apk_file, config_line, job_id)
def GenerateDefendee(self): import escort_mission escort_mission.escort_num += 1 L = launch.Launch() if self.dyndeffg == "": deffg = "Escort" L.fgappend = "_" + str(escort_mission.escort_num) else: deffg = self.dyndeffg L.fgappend = "" L.fg = deffg L.dynfg = "" L.faction = self.protectivefaction if (self.dyndeffg == '' and self.dyndeftype == ''): L.type = faction_ships.getRandomFighter(self.protectivefaction) else: L.type = self.dyndeftype L.ai = "default" L.num = 1 L.minradius = 2.0 * self.you.rSize() L.maxradius = 3.0 * self.you.rSize() L.forcetype = True escortee = L.launch(self.you) escortee.upgrade("jump_drive", 0, 0, 0, 1) escortee.setFlightgroupLeader(self.you) escortee.setFgDirective('F') return escortee
def FriendlyLaunch(self): self.havelaunched = 1 import launch L = launch.Launch() L.fg = "Shadow" if (self.dyntype == ""): import faction_ships self.dyntype = faction_ships.getRandomFighter(self.faction) L.type = self.dyntype L.dyntype = self.dyntype L.num = self.numenemies L.faction = self.faction L.minradius = 3000 L.maxradius = 4000 try: import faction_ships L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass you = VS.getPlayerX(self.cp) friendly = L.launch(you) import universe universe.greet(self.altGreetingText, friendly, you)
def setupFriendly(self, around): L = launch.Launch() L.fg = self.friendlyfg L.dynfg = self.friendlydynfg if self.friendlydyntype == '': self.friendlydyntype = faction_ships.getRandomFighter( self.friendlyfaction) L.type = self.friendlydyntype L.faction = self.friendlyfaction L.ai = "default" L.num = self.friendlynum L.minradius = 0 L.maxradius = self.mindist try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass friendly = L.launch(around) self.enemy.setCombatRole("FIGHTER") flead = friendly.getFlightgroupLeader() flead.SetTarget(self.enemy) flead.Threaten(self.enemy, 1) self.enemy.Threaten(flead, 1) friendly.setFgDirective('A.') friendly.DeactivateJumpDrive()
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)
def GenerateEnemies(self, jp, you): count = 0 VS.addObjective("Protect %s from %s" % (jp.getName(), self.faction)) self.objective = VS.addObjective("Destroy All %s Hostiles" % self.faction) VS.setCompleteness(self.objective, 0.0) debug.info("quantity " + str(self.quantity)) while (count < self.quantity): L = launch.Launch() if self.dynatkfg == "": atkfg = "Shadow" else: atkfg = self.dynatkfg L.fg = atkfg L.dynfg = "" if count == 0: L.fgappend = "" else: L.fgappend = "_" + str(count) if (self.dynatktype == ''): L.type = faction_ships.getRandomFighter(self.faction) else: L.type = self.dynatktype L.ai = "default" L.num = 1 L.minradius = 20000.0 L.maxradius = 25000.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = self.faction launched = L.launch(you) if (count == 0): self.you.SetTarget(launched) if (1): launched.SetTarget(jp) else: launched.SetTarget(you) if (self.dedicatedattack): launched.setFgDirective('B') self.attackers += [launched] count += 1 if (self.respawn == 0 and len(self.attackers) > 0): self.respawn = 1 import universe universe.greet(self.greetingText, self.attackers[0], you, self.dyndeffg) else: VS.IOmessage(0, "escort mission", self.mplay, "Eliminate all %s ships here" % self.faction) VS.IOmessage(0, "escort mission", self.mplay, "You must protect %s." % jp.getName()) self.quantity = 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)
def GenerateEnemies(self, jp, you): VS.IOmessage(0, "escort mission", self.mplay, "You must protect %s." % unit.getUnitFullName(jp, True)) count = 0 jp.setMissionRelevant() VS.addObjective("Protect %s from the %s" % (unit.getUnitFullName(jp), self.faction.capitalize().replace("_", " "))) self.objective = VS.addObjective("Destroy All %s Hostiles" % self.faction) VS.setCompleteness(self.objective, 0.0) print("quantity " + str(self.quantity)) while (count < self.quantity): L = launch.Launch() L.fg = "Shadow" L.dynfg = self.dynatkfg if (self.dynatktype == ''): L.type = faction_ships.getRandomFighter(self.faction) else: L.type = self.dynatktype L.ai = "default" L.num = 1 L.minradius = 2000.0 L.maxradius = 4500.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = self.faction launched = L.launch(you) if (count == 0): self.you.SetTarget(launched) if (self.defend): launched.SetTarget(jp) else: launched.SetTarget(you) if (self.dedicatedattack): launched.setFgDirective('B') self.attackers += [launched] count += 1 if (self.respawn == 0 and len(self.attackers) > 0): self.respawn = 1 import universe universe.greet(self.greetingText, self.attackers[0], you) else: VS.IOmessage(0, "escort mission", self.mplay, "Eliminate all %s ships here" % self.faction) self.quantity = 0
def __init__ (self, factionname, missiondifficulty, our_dist_from_jump, dist_from_jump, distance_from_base, creds, enemy_time, numsysaway, jumps=(), var_to_set='', fgname='', dyntype=''): Director.Mission.__init__(self); self.you = VS.getPlayer(); self.role= "ESCORTCAP" self.gametime=VS.GetGameTime() self.adjsys=go_to_adjacent_systems(self.you, numsysaway,jumps) self.var_to_set = var_to_set; debug.debug("e") self.adjsys.Print("You should start in the system named %s","Then jump to %s","Finally, jump to %s, your final destination","escort mission",1) debug.debug("f") self.distfrombase=distance_from_base debug.debug("g") self.faction=factionname global escort_num escort_num+=1 #self.escortee = launch.launch_wave_around_unit("Escort"+str(escort_num), # self.faction, # faction_ships.getRandomFighter("merchant"), # "default", # 1, # self.you.rSize(), # 2.0*self.you.rSize(), # self.you, # "") L=launch.Launch() if fgname == "": L.fg = "Escort" L.fgappend = "_"+str(escort_num) else: L.fg = fgname L.fgappend = "" L.faction=self.faction if (dyntype==''): L.type = faction_ships.getRandomFighter("merchant") else: L.type = dyntype L.forcetype=True L.dynfg = "" L.ai = "default" L.num=1 L.minradius = 2.0*self.you.rSize() L.maxradius = 3.0*self.you.rSize() self.escortee=L.launch(self.you) self.escortee.upgrade("jump_drive",0,0,0,1) self.you.SetTarget(self.escortee) debug.debug("h") self.escortee.setFlightgroupLeader(self.you) debug.debug("dd") self.difficulty=missiondifficulty self.creds = creds
def LaunchedEnemies(self, significant): bounty.bounty.LaunchedEnemies(self, significant) import launch L = launch.Launch() if self.helperfg == "": L.fg = "Shadow" else: L.fg = self.helperfg L.dynfg = "" L.faction = self.faction if type(self.helpertype) == type("") or len(self.helpertype) < 2: L.type = self.helpertype else: L.type = self.helpertype[0] L.faction = self.helpertype[1] if L.type == "": L.type = faction_ships.getRandomFighter(L.faction) L.ai = "default" L.num = self.numhelpers 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 if (self.numhelpers): tempship = L.launch(significant) tempship.SetTarget(self.you) for u in self.upgrades: args = (u, 0, 0, False) if (type(u) is list or type(u) is tuple): if (len(u) > 3): args = u elif (len(u) > 2): args = (u[0], u[1], u[2], False) elif (len(u) > 1): args = (u[0], u[1], 0, False) else: args = (u[0], 0, 0, False) self.enemy.upgrade(str(args[0]), int(args[1]), int(args[2]), 1, args[3])
def RealSuccessMission(self): cleansweep.cleansweep.RealSuccessMission(self) if (not self.launchedpirate): self.launchedpirate = True import launch L = launch.Launch() L.faction = "pirates" L.fg = "Drake" L.dynfg = "" L.minradius = 1000.0 L.maxradius = 1500.0 L.ai = "default" L.num = 1 import faction_ships L.type = faction_ships.getRandomFighter("pirates") pirate = L.launch(self.you) import universe pirate.SetTarget(universe.getRandomJumppoint()) pirate.ActivateJumpDrive(0) universe.greet(self.pirategreeting)
def setupEnemy(self): if not self.started: print 'Tail Error checking: ' + self.directions[0] print 'Tail Error checking: ' + self.directions[0].lower() if self.started: return True elif self.directions[0].lower().find( VS.getPlayerX(self.cp).getUnitSystemFile().lower()) != -1: L = launch.Launch() L.fg = self.enemyfg L.dynfg = self.enemydynfg if self.enemydyntype == '': self.enemydyntype = faction_ships.getRandomFighter( self.enemyfaction) L.type = self.enemydyntype L.faction = self.enemyfaction L.ai = "default" L.num = self.enemynum L.minradius = self.mindist L.maxradius = self.startdist try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass self.enemy = L.launch(VS.getPlayerX(self.cp)) self.enemy.upgrade("jump_drive", 0, 0, 0, 1) self.relation = self.enemy.getRelation(VS.getPlayerX(self.cp)) self.enemy.setCombatRole("INERT") self.updateEnemyObjective() VS.IOmessage( 0, "[Mission Computer]", "all", "Target %s detected! Proceed as per mission instructions." % self.enemy.getFullname()) self.objref = VS.addObjective( "Follow the %s until it broadcasts the signal" % self.enemy.getFullname()) self.started = True return True print "now NOT set up!" return False
def FriendlyLaunch(self): self.havelaunched = 1 L = launch.Launch() L.fg = "Shadow" if (self.dyntype == ""): self.dyntype = faction_ships.getRandomFighter(self.faction) L.type = self.dyntype L.dyntype = self.dyntype L.num = self.numenemies L.faction = self.faction L.minradius = 3000 L.maxradius = 4000 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: debug.debug( "failed to set up minradius and maxradius for faction_ships.launch" ) pass you = VS.getPlayerX(self.cp) friendly = L.launch(you) universe.greet(self.altGreetingText, friendly, you)
def test_net_string(self): ''' Test the NET string to ensure it contains a date. ''' l = launch.Launch() self.assertIn('2020', l.net)
def Launch(self, you): if (self.havelaunched == 0): for i in range(len(self.faction)): faction = self.faction[i] if len(self.numenemies) > i: numenemies = self.numenemies[i] else: numenemies = self.numenemies[0] if type(self.AdjustFaction) != bool: try: if len(self.AdjustFaction) > i: self.AdjustFaction = self.AdjustFaction[i] else: self.AdjustFaction = self.AdjustFaction[0] except: AjdustFaction = True if len(self.fgname) > i: fgname = self.fgname[i] else: fgname = self.fgname[0] if fgname == "": fgname = "Shadow" if len(self.dyntype) > i: dyntype = self.dyntype[i] else: dyntype = self.dyntype[0] for z in range(numenemies): debug.info('Ambush: Launch ships!') self.havelaunched = 1 import launch L = launch.Launch() L.fg = fgname L.dynfg = "" # dynfg tells launch to load flightgroup from SaveString if dyntype == "": import faction_ships dyntype = faction_ships.getRandomFighter(faction) L.type = dyntype L.num = 1 if z == 0: L.fgappend = "" else: L.fgappend = "_" + str(z) L.minradius = 6000 L.maxradius = 8000 try: import faction_ships L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = faction import universe enemy = L.launch(you) lead = enemy.getFlightgroupLeader() enemy.SetTarget(you) if lead: lead.SetTarget(you) else: enemy.setFlightgroupLeader(enemy) enemy.setFgDirective("A.") self.enemy = lead rel = VS.GetRelation(faction, "privateer") if self.AdjustFaction and rel >= 0: VS.AdjustRelation(faction, "privateer", -.02 - rel, 1.0) rel = VS.GetRelation("privateer", faction) VS.AdjustRelation("privateer", faction, -.02 - rel, 1.0) if i == 0 and z == 0: universe.greet(self.greetingText, enemy, you) debug.info('Ambush: Ships have been launched. Exiting...')
def test_mission(self): ''' Ensure the mission name is a string. ''' l = launch.Launch() self.assertIsInstance(l.mission, str)
def Execute(self): if (not self.you): VS.terminateMission(0) return if (not self.adjsys.Execute()): return if (self.arrived==0): self.adjsys=go_somewhere_significant.go_somewhere_significant(self.you,0,10000.) sys = VS.getSystemFile() import dynamic_battle if sys in dynamic_battle.rescuelist: del dynamic_battle.rescuelist[sys] self.arrived=1 elif (self.arrived==1): mymin=2500. mymax=3000. # try: # mymin*=faction_ships.launch_distance_factor # mymax*=faction_ships.launch_distance_factor # except: # pass self.eject = launch.launch_wave_around_unit("Rescue Pilot",self.faction,"eject","printhello.py",1,mymin,mymax,self.adjsys.SignificantUnit()) self.arrived=2 self.eject.setName("Pilot") self.eject.SetHull(25); L = launch.Launch() L.fg = "Shadow" L.faction=self.enfaction L.dynfg = self.enflightgroup L.type = faction_ships.getRandomFighter(self.enfaction) L.ai="default" L.num=self.numenemy L.minradius=5000 L.maxradius=15000 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass self.enemy=L.launch(self.adjsys.SignificantUnit()) self.enemy.SetTarget(self.eject) self.enemy.setFgDirective("A.") self.you.SetTarget(self.eject) VS.IOmessage(0,"eject",self.mplay,"This is ejector pod 0x4032 requesting immediate rescue and pickup") self.obj=VS.addObjective("Tractor Ejected Pilot") elif (self.arrived==2): if (self.eject): if (self.enemy): self.enemy.SetTarget(self.eject) self.numejectors=self.you.GetCargo("Pilot").GetQuantity() else: if (self.enemy): self.enemy.SetTarget(self.you) self.enemy.setFgDirective("A.") debug.info("numej "+str(self.numejectors)) if (self.numejectors<self.you.GetCargo("Pilot").GetQuantity()): self.you.removeCargo("Pilot",1,1) carg=VS.getRandCargo(1,"Passengers/Economy") carg.SetMissionFlag(1) VS.setCompleteness(self.obj,1) if (not self.you.addCargo(carg)): self.Win(self.you,1) else: self.arrived=3 self.cargname=carg.GetContent() debug.info("adding "+self.cargname) self.adjsys = go_somewhere_significant.go_somewhere_significant(self.you,1,25000) VS.IOmessage(0,"Passenger",self.mplay,"Please take me to my home base: %s so I may begin to recover. Thank you!"%self.adjsys.SignificantUnit().getName()) else: VS.IOmessage(0,"rescue_mission",self.mplay,"#ff0000You Lost the Pilot before you could drop the Pilot at the base. The Pilot's oxygen is currently empty. You fail.") self.Lose(1) elif (self.arrived==3): #check for dockal if (self.you.GetCargo(self.cargname).GetQuantity()==0): self.Lose(1) elif (self.adjsys.SignificantUnit().isDocked(self.you) or self.you.isDocked(self.adjsys.SignificantUnit()) or self.adjsys.SignificantUnit().getDistance(self.you)<10): if (self.you.removeCargo(self.cargname,1,1)): self.Win(self.you,1) else: self.Lose(1)
def test_img_url(self): ''' Test the img url to ensure it has a valid address. ''' l = launch.Launch() self.assertIn('http', l.img_url)
def test_mission_length(self): ''' Ensure the mission string is long enough to make sense. ''' l = launch.Launch() self.assertGreater(len(l.mission), 3)
#!/usr/bin/env python import device import apptest import launch app_apk_path = 'ShoppingList-1.4.1.apk' app_package = 'org.openintents.shopping' app_start_activity = 'org.openintents.shopping.ShoppingActivity' dev = device.Device(version='4.0') launcher = launch.Launch() launcher.prepare_to_run(dev, app_apk_path, app_package, app_start_activity)
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
def Execute(self): isSig = 0 if (self.you.isNull()): self.Lose(1) return if (self.arrived == 2): if (not self.runaway): if (not self.istarget): if (self.enemy): curun = VS.getUnit(self.curiter) self.curiter += 1 if (curun == self.enemy): self.enemy.SetTarget(self.you) elif (curun.isNull()): self.curiter = 0 else: if (VS.GetGameTime() > self.firsttime + 2.5 and self.enemy): self.firsttime += 1000000 self.AdjLocation() if (self.enemy.isNull()): self.Win(self.you, 1) return elif (self.arrived == 1): significant = self.adjsys.SignificantUnit() if (significant.isNull()): print "sig null" VS.terminateMission(0) return else: if (self.you.getSignificantDistance(significant) < self.adjsys.distfrombase): if (self.newship == ""): self.newship = faction_ships.getRandomFighter( self.faction) #self.enemy=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",1+self.difficulty,3000.0,4000.0,significant) L = launch.Launch() L.fg = "Shadow" L.dynfg = self.dynfg L.type = self.newship L.faction = self.faction L.ai = "default" L.num = 1 + self.difficulty 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 self.enemy = L.launch(significant) self.enemy.SetTarget(self.you) self.enemy.setFgDirective('B.') self.you.SetTarget(self.enemy) universe.greet(self.greetingText, self.enemy, self.you) str_faction = self.faction.split('_')[0] quest.playSoundCockpit('sounds/missions/' + str_faction + '_it-appears-we-have.ogg') self.obj = VS.addObjective( "Destroy %s." % (unit.getUnitFullName(self.enemy))) if (self.enemy): if (self.runaway): self.enemy.SetTarget( significant ) #CHANGE TO SetTarget ==>NOT setTarget<== self.enemy.ActivateJumpDrive(0) self.firsttime = VS.GetGameTime() #self.enemy.SetPosAndCumPos(Vector.Add(self.you.Position(),Vector.Vector(0,0,self.you.rSize()*1.2))) self.LaunchedEnemies(significant) self.arrived = 2 else: print "enemy null" VS.terminateMission(0) return else: if (self.adjsys.Execute()): self.arrived = 1 if (self.newship == "" and self.dynfg == ''): self.newship = faction_ships.getRandomFighter(self.faction) self.adjsys = go_somewhere_significant(self.you, self.dockable_unit, 10000.0, 0, '', '', self.displayLocation) if not self.displayLocation: VS.addObjective("Search/Destroy " + self.faction.capitalize() + " mark") localdestination = unit.getUnitFullName( self.adjsys.SignificantUnit(), True) tmpfg = self.dynfg if len(tmpfg) == 0: tmpfg = "shadow" VS.IOmessage( 3, "bounty mission", self.mplay, "Hunt the %s unit in the %s flightgroup in this system." % (self.newship, tmpfg)) if (self.runaway): #ADD OTHER JUMPING IF STATEMENT CODE HERE VS.IOmessage(4, "bounty mission", self.mplay, "Target is fleeing to the jump point!") VS.IOmessage( 5, "bounty mission", self.mplay, "Target Destination appears to be %s" % (localdestination)) elif (self.displayLocation): VS.IOmessage(4, "bounty mission", self.mplay, "Scanners detect bounty target!") VS.IOmessage( 5, "bounty mission", self.mplay, "Coordinates appear near %s" % (localdestination)) else: print "Location " + str(self.displayLocation) VS.IOmessage( 4, "bounty mission", self.mplay, "[Computer] Mission description indicates bounty target may be in this system." )
def Launch(self, you): if (self.havelaunched == 0): if (type(self.numenemies) == type(1)): self.numenemies = (self.numenemies, ) self.faction = (self.faction, ) self.dyntype = (self.dyntype, ) self.dynfg = (self.dynfg, ) if (type(self.AdjustFaction) != type(()) and type(self.AdjustFaction) != type([])): self.AdjustFaction = (self.AdjustFaction, ) for i in range(len(self.faction)): numenemies = self.numenemies[i] faction = self.faction[i] for z in range(numenemies): AdjustFaction = self.AdjustFaction[-1] if (i < len(self.AdjustFaction)): AdjustFaction = self.AdjustFaction[i] dynfg = "" if (len(self.dynfg) > i): dynfg = self.dynfg[i] dyntype = "" if (len(self.dyntype) > i): dyntype = self.dyntype[i] print('Ambush: Launch ships!') self.havelaunched = 1 L = launch.Launch() L.fg = "Shadow" if (dyntype == ""): dyntype = faction_ships.getRandomFighter(faction) L.dynfg = dynfg L.type = dyntype L.num = 1 L.fgappend = "X" L.minradius = 6000 L.maxradius = 8000 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = faction enemy = L.launch(you) lead = enemy.getFlightgroupLeader() enemy.SetTarget(you) if (lead): lead.SetTarget(you) else: enemy.setFlightgroupLeader(enemy) enemy.setFgDirective("A.") self.enemy = lead rel = VS.GetRelation(faction, "privateer") if (AdjustFaction and rel >= 0): VS.AdjustRelation(faction, "privateer", -.02 - rel, 1.0) rel = VS.GetRelation("privateer", faction) VS.AdjustRelation("privateer", faction, -.02 - rel, 1.0) if (i == len(self.faction) - 1 and z == 0): universe.greet(self.greetingText, enemy, you) #print "launchin" print('Ambush: Ships have been launched. Exiting...')
def launch_init(): '''Caches the launch data that is updated every ~5 minutes.''' data = launch.Launch() return data