Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
ambush Class Reference
Inheritance diagram for ambush:
directions_mission ambush_scan patrol_ambush

Public Member Functions

def privateSetupPlayer
 
def __init__
 
def setupPlayer
 
def Launch
 
def terminate
 
def Execute
 
- Public Member Functions inherited from directions_mission
def dir_privateSetupPlayer
 
def setupPlayer
 
def __init__
 
def takeCargoAndTerminate
 
def findUnit
 
def getCargo
 
def checkCargo
 
def Execute
 

Data Fields

 timer
 
 inescapable
 
 havelaunched
 
 terminated
 
 faction
 
 systems
 
 numenemies
 
 dyntype
 
 dynfg
 
 greetingText
 
 cp
 
 delay
 
 AdjustFaction
 
 enemy
 
- Data Fields inherited from directions_mission
 arrived
 
 wasnull
 
 you
 
 adjsys
 
 var
 
 savedCargo
 
 jumps
 
 cp
 
 base
 
 destination
 
 mplay
 
 obj
 

Detailed Description

Definition at line 9 of file ambush.py.

Constructor & Destructor Documentation

def __init__ (   self,
  savevar,
  systems,
  delay,
  faction,
  numenemies,
  dyntype = '',
  dynfg = '',
  greetingText = ["Hello there,
  smuggler,
  Prepare,
  to,
  die,
  The,
  price,
  on,
  your,
  head,
  is,
  big,
  enough,
  that,
  I,
  missed,
  my,
  lunch,
  directions = [],
  destination = '',
  AdjustFaction = True 
)

Definition at line 16 of file ambush.py.

16 
17  def __init__(self,savevar,systems,delay,faction,numenemies,dyntype='',dynfg='',greetingText=["Hello there, smuggler. Prepare to die!", "The price on your head is big enough that I missed my lunch"], directions=[], destination='',AdjustFaction=True):
18  directions_mission.directions_mission.__init__ (self,savevar,directions,destination)
19  print 'Ambush: Starting'
20  self.faction=faction
21  self.systems=systems
22  if type(systems)!=tuple and type(systems)!=list :
23  self.systems=(systems,)
24  self.numenemies=numenemies
25  self.dyntype=dyntype
26  self.dynfg=dynfg
27  self.greetingText=greetingText
28  self.cp=VS.getCurrentPlayer()
29  self.delay=delay
self.AdjustFaction=AdjustFaction

Member Function Documentation

def Execute (   self)

Definition at line 96 of file ambush.py.

References ambush.cp, ambush.delay, CacheFTPHandler.delay, directions_mission.Execute(), ambush.inescapable, ambush.Launch(), ambush.systems, ambush.terminate(), ambush.terminated, ambush.timer, waitjump.timer, ai_escortpatrol.timer, and Profile.timer.

96 
97  def Execute(self):
99  if (self.terminated==1):
100  return
101  you=VS.getPlayerX(self.cp)
102  if you.isNull():
103  return
104  sys=you.getUnitSystemFile()
105  if(not self.inescapable):
106  for i in self.systems:
107  where=sys.find(i)
108  if (where>0):
109  if (sys[where-1]=='/'):
110  where=0
111  if (where==0):
112  #print 'Ambush: wait before launching ship...'
113  self.inescapable=1
114  self.timer=VS.GetGameTime()
115  if (self.inescapable and ((self.delay==0) or (VS.GetGameTime()-self.timer>=self.delay))):
116  self.Launch(you)
117  self.terminate()
118 # print "it's unavoidable, my young apprentice... in "+str(self.delay)+" seconds from "+str(self.timer)
119 
def Launch (   self,
  you 
)

Definition at line 36 of file ambush.py.

References ambush.AdjustFaction, ambush.dynfg, Launch.dynfg, ambush.dyntype, SystemInformation.faction, ambush.faction, ShipTracker.faction, go_to_adjacent_systems.faction, Launch.faction, ClearFactionRecord.faction, PushRelation.faction, PopRelation.faction, LaunchWingmen.faction, ChangeSystemOwner.faction, ChangeShipOwners.faction, faction_ships.getRandomFighter(), ambush.havelaunched, and ambush.numenemies.

36 
37  def Launch(self,you):
38  if (self.havelaunched==0):
39  if (type(self.numenemies)==type(1)):
40  self.numenemies=(self.numenemies,)
41  self.faction=(self.faction,)
42  self.dyntype=(self.dyntype,)
43  self.dynfg=(self.dynfg,)
44  if (type(self.AdjustFaction)!=type( () ) and type (self.AdjustFaction)!=type([])):
45  self.AdjustFaction=(self.AdjustFaction,)
46  for i in xrange(len(self.faction)):
47  numenemies=self.numenemies[i]
48  faction=self.faction[i]
49  for z in xrange(numenemies):
50  AdjustFaction=self.AdjustFaction[-1]
51  if (i<len(self.AdjustFaction)):
52  AdjustFaction=self.AdjustFaction[i]
53  dynfg=""
54  if (len(self.dynfg)>i):
55  dynfg=self.dynfg[i]
56  dyntype=""
57  if (len(self.dyntype)>i):
58  dyntype=self.dyntype[i]
59  print 'Ambush: Launch ships!'
60  self.havelaunched=1
61  L=launch.Launch()
62  L.fg="Shadow"
63  if (dyntype==""):
64  dyntype=faction_ships.getRandomFighter(faction)
65  L.dynfg=dynfg
66  L.type=dyntype
67  L.num=1
68  L.fgappend="X"
69  L.minradius=6000
70  L.maxradius=8000
71  try:
72  L.minradius*=faction_ships.launch_distance_factor
73  L.maxradius*=faction_ships.launch_distance_factor
74  except:
75  pass
76  L.faction=faction
77  enemy=L.launch(you)
78  lead=enemy.getFlightgroupLeader()
79  enemy.SetTarget(you)
80  if (lead):
81  lead.SetTarget(you)
82  else:
83  enemy.setFlightgroupLeader(enemy)
84  enemy.setFgDirective("A.")
85  self.enemy=lead
86  rel=VS.GetRelation(faction,"privateer")
87  if (AdjustFaction and rel>=0):
88  VS.AdjustRelation(faction,"privateer",-.02-rel,1.0)
89  rel=VS.GetRelation("privateer",faction)
90  VS.AdjustRelation("privateer",faction,-.02-rel,1.0)
91  if (i==len(self.faction)-1 and z==0):
92  universe.greet(self.greetingText,enemy,you)
93  #print "launchin"
print 'Ambush: Ships have been launched. Exiting...'
def privateSetupPlayer (   self)

Definition at line 10 of file ambush.py.

10 
11  def privateSetupPlayer(self):
12  self.timer=0
13  self.inescapable=0
14  self.havelaunched=0
15  self.terminated=0
def setupPlayer (   self,
  cp 
)

Definition at line 31 of file ambush.py.

References ambush.privateSetupPlayer(), and directions_mission.setupPlayer().

31 
32  def setupPlayer(self,cp):
33  print "ambush setting player up"
35  self.privateSetupPlayer()
def terminate (   self)

Definition at line 94 of file ambush.py.

References ambush.terminated.

94 
95  def terminate(self):
self.terminated=1#VS.terminateMission(0)

Field Documentation

AdjustFaction

Definition at line 30 of file ambush.py.

cp

Definition at line 27 of file ambush.py.

delay

Definition at line 28 of file ambush.py.

dynfg

Definition at line 25 of file ambush.py.

dyntype

Definition at line 24 of file ambush.py.

enemy

Definition at line 84 of file ambush.py.

faction

Definition at line 19 of file ambush.py.

greetingText

Definition at line 26 of file ambush.py.

havelaunched

Definition at line 13 of file ambush.py.

inescapable

Definition at line 12 of file ambush.py.

numenemies

Definition at line 23 of file ambush.py.

systems

Definition at line 20 of file ambush.py.

terminated

Definition at line 14 of file ambush.py.

timer

Definition at line 11 of file ambush.py.


The documentation for this class was generated from the following file: