Ejemplo n.º 1
0
 def __init__(self,
              factionname,
              numsystemsaway,
              enemyquantity,
              distance_from_base,
              escape_distance,
              creds,
              defendthis,
              defend_base,
              protectivefactionname='',
              jumps=(),
              var_to_set='',
              dynamic_flightgroup='',
              dynamic_type='',
              dynamic_defend_fg='',
              waves=0,
              greetingText=[
                  'We will defeat your assets in this battle, privateer...',
                  'Have no doubt!'
              ]):
     Director.Mission.__init__(self)
     self.dedicatedattack = vsrandom.randrange(0, 2)
     self.arrived = 0
     self.waves = waves
     self.greetingText = greetingText
     self.protectivefaction = protectivefactionname
     self.var_to_set = var_to_set
     self.quantity = 0
     self.mplay = "all"
     self.defendbase = defend_base
     self.dynatkfg = dynamic_flightgroup
     self.dynatktype = dynamic_type
     self.dyndeffg = dynamic_defend_fg
     self.attackers = []
     self.objective = 0
     self.targetiter = 0
     self.ship_check_count = 0
     self.defend = defendthis
     self.defend_base = defend_base
     self.faction = factionname
     self.escdist = escape_distance
     minsigdist = unit.minimumSigDistApart()
     if (minsigdist * .5 < self.escdist):
         self.escdist = minsigdist
     self.cred = creds
     self.respawn = 0
     self.quantity = enemyquantity
     self.savedquantity = enemyquantity
     self.distance_from_base = distance_from_base
     self.defendee = VS.Unit()
     self.difficulty = 1
     self.you = VS.getPlayer()
     name = self.you.getName()
     self.mplay = universe.getMessagePlayer(self.you)
     self.adjsys = go_to_adjacent_systems(self.you, numsystemsaway, jumps)
     self.adjsys.Print("You are in the %s system,",
                       "Proceed swiftly to %s.",
                       "Your arrival point is %s.", "defend", 1)
     VS.IOmessage(2, "defend", self.mplay,
                  "And there eliminate any %s starships." % self.faction)
    def CalculateSignificantDistance(self):
        sysfile = VS.getSystemFile()
        self.cur.GeneratePhaseAndAmplitude()
        if sysfile in self.sig_distance_table:
            self.cur.significant_distance = self.sig_distance_table[sysfile][0]
            self.cur.detection_distance = self.sig_distance_table[sysfile][1]
            self.cur.prob_amplitude = self.sig_distance_table[sysfile][2]
            return
        minsig =  unit.minimumSigDistApart()
        if (self.sig_distance>minsig*0.15):
            self.cur.significant_distance=minsig*0.15
        else:
            self.cur.significant_distance=self.sig_distance
        if (self.det_distance>minsig*0.2):
            self.cur.detection_distance=minsig*0.2
        else:
            self.cur.detection_distance=self.det_distance

        print "resetting sigdist=%f detdist=%f" % (self.cur.significant_distance,self.cur.detection_distance)
Ejemplo n.º 3
0
 def __init__ (self,factionname,numsystemsaway, enemyquantity, distance_from_base, escape_distance, creds, defendthis, defend_base,protectivefactionname='',jumps=(),var_to_set='',dynamic_flightgroup='',dynamic_type='', dynamic_defend_fg='',waves=0, greetingText=['We will defeat your assets in this battle, privateer...','Have no doubt!']):
     Director.Mission.__init__(self)
     self.dedicatedattack=vsrandom.randrange(0,2)
     self.arrived=0
     self.waves=waves;
     self.greetingText=greetingText
     self.protectivefaction = protectivefactionname
     self.var_to_set=var_to_set
     self.quantity=0
     self.mplay="all"
     self.defendbase = defend_base   
     self.dynatkfg = dynamic_flightgroup     
     self.dynatktype = dynamic_type
     self.dyndeffg = dynamic_defend_fg
     self.attackers = []
     self.objective= 0
     self.targetiter = 0
     self.ship_check_count=0
     self.defend = defendthis
     self.defend_base = defend_base
     self.faction = factionname
     self.escdist = escape_distance
     minsigdist=unit.minimumSigDistApart()
     if (minsigdist*.5<self.escdist):
         self.escdist = minsigdist
     self.cred=creds
     self.respawn=0
     self.quantity=enemyquantity
     self.savedquantity=enemyquantity
     self.distance_from_base=distance_from_base
     self.defendee=VS.Unit()
     self.difficulty=1
     self.you=VS.getPlayer()
     self.younum=VS.getCurrentPlayer()
     name = self.you.getName ()
     self.mplay=universe.getMessagePlayer(self.you)
     self.adjsys = go_to_adjacent_systems(self.you,numsystemsaway,jumps)  
     self.adjsys.Print("You are in the %s system,","Proceed swiftly to %s.","Your arrival point is %s.","defend",1)
     VS.IOmessage (2,"defend",self.mplay,"And there eliminate any %s starships."  % self.faction)
     self.key=str(VS.getCurrentPlayer())+str(factionname)+str(numsystemsaway)+str(enemyquantity)+str(distance_from_base)+str(escape_distance)+str(creds)+str(defendthis)+str(defend_base)+str(protectivefactionname)+str(jumps)+str(var_to_set)+str(dynamic_flightgroup)+str(dynamic_type)+str(dynamic_defend_fg)+str(waves)+str(greetingText);
     global running_defend_missions
     running_defend_missions[self.key]=0
     self.run_def_mis=0
Ejemplo n.º 4
0
 def CalculateSignificantDistance(self):
     sysfile = VS.getSystemFile()
     self.cur.GeneratePhaseAndAmplitude()
     if sysfile in self.sig_distance_table:
         self.cur.significant_distance = self.sig_distance_table[sysfile][0]
         self.cur.detection_distance = self.sig_distance_table[sysfile][1]
         self.cur.prob_amplitude = self.sig_distance_table[sysfile][2]
         return
     minsig = unit.minimumSigDistApart()
     if (self.sig_distance > minsig * 0.15):
         self.cur.significant_distance = minsig * 0.15
     else:
         self.cur.significant_distance = self.sig_distance
     if (self.det_distance > minsig * 0.2):
         self.cur.detection_distance = minsig * 0.2
     else:
         self.cur.detection_distance = self.det_distance
     debug.debug(
         "resetting sigdist=%f detdist=%f" %
         (self.cur.significant_distance, self.cur.detection_distance))