Example #1
0
 def __init__ (self, creds, faction, quantity, category, returntobase, var_when_done=''):
     Director.Mission.__init__ (self)
     self.newship=""
     self.mplay="all"
     self.obj=0
     self.enemy=VS.Unit()
     self.curiter=0
     self.content=""
     self.quantity=quantity
     self.arrived=0
     self.faction = faction
     self.cred=creds
     self.category=category
     self.donevar=var_when_done
     sysfile = VS.getSystemFile()
     self.newship=faction_ships.getRandomFighter('merchant')
     self.you=VS.getPlayer()
     self.pos=self.you.Position()
     self.gosig=go_somewhere_significant(self.you,0,10000.)
     self.mplay=universe.getMessagePlayer(self.you)
     if (self.you):
         VS.IOmessage (0,"plunder mission",self.mplay,"Your mission is to destroy a %s merchant unit." % (self.newship))
         VS.IOmessage (1,"plunder mission",self.mplay,"It is orbiting around the %s planet in the system." % (unit.getUnitFullName(self.gosig.SignificantUnit())))
         VS.IOmessage (2,"plunder mission",self.mplay,"After it is destroyed, pick up all %s cargo that got ejected."%self.category)
         VS.IOmessage (3,"plunder mission",self.mplay,"Then return to a %s base with your cargo. #00ff00Good luck!"%self.faction)
     else:
         print("aboritng plunder constructor...")
         VS.terminateMission (0)
Example #2
0
 def __init__(self,
              creds,
              faction,
              quantity,
              category,
              returntobase,
              var_when_done=''):
     Director.Mission.__init__(self)
     self.newship = ""
     self.mplay = "all"
     self.obj = 0
     self.enemy = VS.Unit()
     self.curiter = 0
     self.content = ""
     self.quantity = quantity
     self.arrived = 0
     self.faction = faction
     self.cred = creds
     self.category = category
     self.donevar = var_when_done
     sysfile = VS.getSystemFile()
     self.newship = faction_ships.getRandomFighter('merchant')
     self.you = VS.getPlayer()
     self.pos = self.you.Position()
     self.gosig = go_somewhere_significant(self.you, 0, 10000.)
     self.mplay = universe.getMessagePlayer(self.you)
     if (self.you):
         VS.IOmessage(
             0, "plunder mission", self.mplay,
             "Your mission is to destroy a %s merchant unit." %
             (self.newship))
         VS.IOmessage(
             1, "plunder mission", self.mplay,
             "It is orbiting around the %s planet in the system." %
             (unit.getUnitFullName(self.gosig.SignificantUnit())))
         VS.IOmessage(
             2, "plunder mission", self.mplay,
             "After it is destroyed, pick up all %s cargo that got ejected."
             % self.category)
         VS.IOmessage(
             3, "plunder mission", self.mplay,
             "Then return to a %s base with your cargo. #00ff00Good luck!" %
             self.faction)
     else:
         print "aboritng plunder constructor..."
         VS.terminateMission(0)
Example #3
0
    def Execute(self):
        isSig = 0
        if (self.you.isNull()):
            self.Lose(1)
            return
        if (self.arrived == 3):
            self.gosig.Execute()
            cargquant = self.you.GetCargo(self.content).GetQuantity()
            if cargquant < self.quantity:
                #             print "ohnooohnoohno!!!!!!!"
                VS.IOmessage(
                    0, "plunder mission", self.mplay,
                    'Not enough of %s cargo... Get more until you have %d.' %
                    (self.quantity))
                VS.setCompleteness(self.obj, 0.)
            elif self.you.isDocked(self.gosig.SignificantUnit(
            )) or self.gosig.SignificantUnit().isDocked(self.you):
                #             print "du hast gewonnen!"
                self.you.removeCargo(self.content, self.quantity, 1)
                self.Win(self.you, 1)
#           else:
#             print 'hihohohiho'
        elif (self.arrived == 2):
            cargquant = self.you.GetCargo(self.content).GetQuantity()
            VS.setCompleteness(self.obj,
                               float(cargquant) / float(self.quantity))
            if cargquant == self.quantity:
                self.arrived = 3
                self.gosig = go_somewhere_significant(self.you, 1, 3000., 1,
                                                      "pirates")
                self.gosig.SignificantUnit().setCombatRole("INERT")
                VS.IOmessage(
                    0, "plunder mission", self.mplay,
                    'Give all of your cargo to the %s unit.' %
                    (unit.getUnitFullName(self.gosig.SignificantUnit())))
        elif (self.arrived == 1):
            if (self.enemy):
                self.pos = self.enemy.Position()
                curun = VS.getUnit(self.curiter)
                self.curiter += 1
                if (curun == self.enemy):
                    self.enemy.SetTarget(self.you)
                elif (curun.isNull()):
                    self.curiter = 0
            if (self.enemy.isNull()):
                VS.setCompleteness(self.obj, 1.)
                self.arrived = 2
                self.enemy = []
                for i in range(self.quantity * 2):
                    launch.launch_wave_around_area("shadow", "upgrades",
                                                   "generic_cargo",
                                                   "sitting_duck", 1, 5., 10.,
                                                   self.pos, '',
                                                   0).setName(self.content)
                self.obj = VS.addObjective("Pick up %d %s cargo" %
                                           (self.quantity, self.content))
                VS.IOmessage(
                    0, "plunder mission", self.mplay,
                    'You must now pick up at least %d of the %s cargo.' %
                    (self.quantity, self.content))
        else:
            significant = self.gosig.SignificantUnit()
            if (significant.isNull()):
                print "sig null"
                VS.terminateMission(0)
                return
            else:
                if (self.you.getSignificantDistance(significant) < 10000.0):
                    if (self.newship == ""):
                        self.newship = faction_ships.getRandomFighter(
                            'merchant')
                    carg = VS.getRandCargo(self.quantity, self.category)
                    if (carg.GetQuantity() == 0):
                        carg = VS.getRandCargo(
                            self.quantity, "")  #oh no... could be starships...
                    self.content = carg.GetContent()
                    carg.SetQuantity(self.quantity * 2)
                    self.enemy = launch.launch_wave_around_unit(
                        "shadow", "merchant", self.newship, "default", 1,
                        200.0, 500.0, self.you)
                    self.enemy.addCargo(carg)
                    VS.setCompleteness(self.gosig.obj, 1.)
                    VS.IOmessage(
                        0, "plunder mission", self.mplay,
                        'You must now destroy the %s ship.' % self.newship)
                    VS.IOmessage(
                        0, "plunder mission", self.mplay,
                        'That fighter contains the wanted %s cargo in its hold.'
                        % self.content)
                    self.obj = VS.addObjective(
                        "Destroy the %s ship." %
                        (unit.getUnitFullName(self.enemy)))
                    if (self.enemy):
                        self.arrived = 1
                    else:
                        print "enemy null"
                        VS.terminateMission(0)
                        return
 def Execute(self):
     isSig = 0
     if self.you.isNull():
         self.Lose(1)
         return
     if self.arrived == 3:
         self.gosig.Execute()
         cargquant = self.you.GetCargo(self.content).GetQuantity()
         if cargquant < self.quantity:
             #             print "ohnooohnoohno!!!!!!!"
             VS.IOmessage(
                 0,
                 "plunder mission",
                 self.mplay,
                 "Not enough of %s cargo... Get more until you have %d." % (self.quantity),
             )
             VS.setCompleteness(self.obj, 0.0)
         elif self.you.isDocked(self.gosig.SignificantUnit()) or self.gosig.SignificantUnit().isDocked(self.you):
             #             print "du hast gewonnen!"
             self.you.removeCargo(self.content, self.quantity, 1)
             self.Win(self.you, 1)
     #           else:
     #             print 'hihohohiho'
     elif self.arrived == 2:
         cargquant = self.you.GetCargo(self.content).GetQuantity()
         VS.setCompleteness(self.obj, float(cargquant) / float(self.quantity))
         if cargquant == self.quantity:
             self.arrived = 3
             self.gosig = go_somewhere_significant(self.you, 1, 3000.0, 1, "pirates")
             self.gosig.SignificantUnit().setCombatRole("INERT")
             VS.IOmessage(
                 0,
                 "plunder mission",
                 self.mplay,
                 "Give all of your cargo to the %s unit." % (self.gosig.SignificantUnit().getName()),
             )
     elif self.arrived == 1:
         if self.enemy:
             self.pos = self.enemy.Position()
             curun = VS.getUnit(self.curiter)
             self.curiter += 1
             if curun == self.enemy:
                 self.enemy.SetTarget(self.you)
             elif curun.isNull():
                 self.curiter = 0
         if self.enemy.isNull():
             VS.setCompleteness(self.obj, 1.0)
             self.arrived = 2
             self.enemy = []
             for i in range(self.quantity * 2):
                 launch.launch_wave_around_area(
                     "shadow", "upgrades", "generic_cargo", "sitting_duck", 1, 5.0, 10.0, self.pos, "", 0
                 ).setName(self.content)
             self.obj = VS.addObjective("Pick up %d %s cargo" % (self.quantity, self.content))
             VS.IOmessage(
                 0,
                 "plunder mission",
                 self.mplay,
                 "You must now pick up at least %d of the %s cargo." % (self.quantity, self.content),
             )
     else:
         significant = self.gosig.SignificantUnit()
         if significant.isNull():
             print "sig null"
             VS.terminateMission(0)
             return
         else:
             if self.you.getSignificantDistance(significant) < 10000.0:
                 if self.newship == "":
                     self.newship = faction_ships.getRandomFighter("merchant")
                 carg = VS.getRandCargo(self.quantity, self.category)
                 if carg.GetQuantity() == 0:
                     carg = VS.getRandCargo(self.quantity, "")  # oh no... could be starships...
                 self.content = carg.GetContent()
                 carg.SetQuantity(self.quantity * 2)
                 self.enemy = launch.launch_wave_around_unit(
                     "shadow", "merchant", self.newship, "default", 1, 200.0, 500.0, self.you
                 )
                 self.enemy.addCargo(carg)
                 VS.setCompleteness(self.gosig.obj, 1.0)
                 VS.IOmessage(0, "plunder mission", self.mplay, "You must now destroy the %s ship." % self.newship)
                 VS.IOmessage(
                     0,
                     "plunder mission",
                     self.mplay,
                     "That fighter contains the wanted %s cargo in its hold." % self.content,
                 )
                 self.obj = VS.addObjective("Destroy the %s ship." % (self.enemy.getName()))
                 if self.enemy:
                     self.arrived = 1
                 else:
                     print "enemy null"
                     VS.terminateMission(0)
                     return
 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)
                 import universe
                 universe.greet(self.greetingText,self.enemy,self.you)
                 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.")
Example #6
0
 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."
                 )