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

Public Member Functions

def __init__
 
def Win
 
def Lose
 
def Execute
 
def initbriefing
 
def loopbriefing
 
def endbriefing
 

Data Fields

 newship
 
 mplay
 
 obj
 
 enemy
 
 curiter
 
 content
 
 quantity
 
 arrived
 
 faction
 
 cred
 
 category
 
 donevar
 
 you
 
 pos
 
 gosig
 

Detailed Description

Definition at line 11 of file plunder.py.

Constructor & Destructor Documentation

def __init__ (   self,
  creds,
  faction,
  quantity,
  category,
  returntobase,
  var_when_done = '' 
)

Definition at line 13 of file plunder.py.

13 
14  def __init__ (self, creds, faction, quantity, category, returntobase, var_when_done=''):
15  Director.Mission.__init__ (self)
16  self.newship=""
17  self.mplay="all"
18  self.obj=0
19  self.enemy=VS.Unit()
20  self.curiter=0
21  self.content=""
22  self.quantity=quantity
23  self.arrived=0
24  self.faction = faction
25  self.cred=creds
26  self.category=category
27  self.donevar=var_when_done
28  sysfile = VS.getSystemFile()
30  self.you=VS.getPlayer()
31  self.pos=self.you.Position()
32  self.gosig=go_somewhere_significant(self.you,0,10000.)
34  if (self.you):
35  VS.IOmessage (0,"plunder mission",self.mplay,"Your mission is to destroy a %s merchant unit." % (self.newship))
36  VS.IOmessage (1,"plunder mission",self.mplay,"It is orbiting around the %s planet in the system." % (unit.getUnitFullName(self.gosig.SignificantUnit())))
37  VS.IOmessage (2,"plunder mission",self.mplay,"After it is destroyed, pick up all %s cargo that got ejected."%self.category)
38  VS.IOmessage (3,"plunder mission",self.mplay,"Then return to a %s base with your cargo. #00ff00Good luck!"%self.faction)
39  else:
40  print "aboritng plunder constructor..."
41  VS.terminateMission (0)

Member Function Documentation

def endbriefing (   self)

Definition at line 140 of file plunder.py.

141  def endbriefing(self):
142  print "ending briefing"
143 
def Execute (   self)

Definition at line 62 of file plunder.py.

References defend.arrived, escort_mission.arrived, escort_local.arrived, plunder.arrived, directions_mission.arrived, bounty.arrived, cargo_mission.arrived, plunder.category, plunder.content, plunder.curiter, bounty.curiter, plunder.enemy, bounty.enemy, ambush.enemy, faction_ships.getRandomFighter(), unit.getUnitFullName(), plunder.gosig, launch.launch_wave_around_area(), launch.launch_wave_around_unit(), plunder.Lose(), bounty.Lose(), plunder.mplay, escort_mission.mplay, defend.mplay, patrol.mplay, patrol_ambush.mplay, bounty.mplay, escort_local.mplay, directions_mission.mplay, cargo_mission.mplay, plunder.newship, bounty.newship, plunder.obj, bounty.obj, go_to_adjacent_systems.obj, directions_mission.obj, plunder.pos, _Subfile.pos, StringIO.pos, Launch.pos, MatchObject.pos, AddrlistClass.pos, AddSprite.pos, plunder.quantity, defend.quantity, patrol.quantity, patrol_ambush.quantity, escort_local.quantity, cargo_mission.quantity, plunder.Win(), bounty.Win(), escort_mission.you, patrol.you, plunder.you, directions_mission.you, go_to_adjacent_systems.you, bounty.you, defend.you, escort_local.you, and cargo_mission.you.

62 
63  def Execute (self):
64  isSig=0
65  if (self.you.isNull()):
66  self.Lose (1)
67  return
68  if (self.arrived==3):
69  self.gosig.Execute()
70  cargquant=self.you.GetCargo(self.content).GetQuantity()
71  if cargquant<self.quantity:
72 # print "ohnooohnoohno!!!!!!!"
73  VS.IOmessage(0,"plunder mission",self.mplay,'Not enough of %s cargo... Get more until you have %d.'%(self.quantity))
74  VS.setCompleteness(self.obj,0.)
75  elif self.you.isDocked(self.gosig.SignificantUnit()) or self.gosig.SignificantUnit().isDocked(self.you):
76 # print "du hast gewonnen!"
77  self.you.removeCargo(self.content,self.quantity,1)
78  self.Win(self.you,1)
79 # else:
80 # print 'hihohohiho'
81  elif (self.arrived==2):
82  cargquant=self.you.GetCargo(self.content).GetQuantity()
83  VS.setCompleteness(self.obj,float(cargquant)/float(self.quantity))
84  if cargquant==self.quantity:
85  self.arrived=3
86  self.gosig=go_somewhere_significant(self.you,1,3000.,1,"pirates")
87  self.gosig.SignificantUnit().setCombatRole("INERT")
88  VS.IOmessage(0,"plunder mission",self.mplay,'Give all of your cargo to the %s unit.'%(unit.getUnitFullName(self.gosig.SignificantUnit())))
89  elif (self.arrived==1):
90  if (self.enemy):
91  self.pos=self.enemy.Position()
92  curun=VS.getUnit(self.curiter)
93  self.curiter+=1
94  if (curun==self.enemy):
95  self.enemy.SetTarget(self.you)
96  elif (curun.isNull()):
97  self.curiter=0
98  if (self.enemy.isNull()):
99  VS.setCompleteness(self.obj,1.)
100  self.arrived=2
101  self.enemy=[]
102  for i in range(self.quantity*2):
103  launch.launch_wave_around_area("shadow","upgrades","generic_cargo","sitting_duck",1,5.,10.,self.pos,'',0).setName(self.content)
104  self.obj=VS.addObjective("Pick up %d %s cargo"%(self.quantity,self.content))
105  VS.IOmessage(0,"plunder mission",self.mplay,'You must now pick up at least %d of the %s cargo.'%(self.quantity,self.content))
106  else:
107  significant=self.gosig.SignificantUnit()
108  if (significant.isNull ()):
109  print "sig null"
110  VS.terminateMission(0)
111  return
112  else:
113  if (self.you.getSignificantDistance(significant)<10000.0):
114  if (self.newship==""):
115  self.newship=faction_ships.getRandomFighter('merchant')
116  carg=VS.getRandCargo(self.quantity,self.category)
117  if (carg.GetQuantity()==0):
118  carg = VS.getRandCargo(self.quantity,"") #oh no... could be starships...
119  self.content=carg.GetContent()
120  carg.SetQuantity(self.quantity*2)
121  self.enemy=launch.launch_wave_around_unit("shadow","merchant",self.newship,"default",1,200.0,500.0,self.you)
122  self.enemy.addCargo(carg)
123  VS.setCompleteness(self.gosig.obj,1.)
124  VS.IOmessage(0,"plunder mission",self.mplay,'You must now destroy the %s ship.'%self.newship)
125  VS.IOmessage(0,"plunder mission",self.mplay,'That fighter contains the wanted %s cargo in its hold.'%self.content)
126  self.obj=VS.addObjective("Destroy the %s ship." % (unit.getUnitFullName(self.enemy)))
127  if (self.enemy):
128  self.arrived=1
129  else:
130  print "enemy null"
131  VS.terminateMission(0)
132  return
def initbriefing (   self)

Definition at line 133 of file plunder.py.

134  def initbriefing(self):
135  print "ending briefing"
def loopbriefing (   self)

Definition at line 136 of file plunder.py.

137  def loopbriefing(self):
138  print "loop briefing"
139  Briefing.terminate();
def Lose (   self,
  terminate 
)

Definition at line 54 of file plunder.py.

References patrol.donevar, plunder.donevar, plunder.mplay, escort_mission.mplay, defend.mplay, patrol_ambush.mplay, patrol.mplay, escort_local.mplay, bounty.mplay, directions_mission.mplay, cargo_mission.mplay, and quest.removeQuest().

54 
55  def Lose (self,terminate):
56  VS.IOmessage(0,"plunder mission",self.mplay,"#ff0000You have failed this mission and will not be rewarded.")
57  if len(self.donevar):
58  quest.removeQuest(int(self.mplay[1:]),self.donevar,-1)
59  if (terminate):
60  print "lose plunder mission"
61  VS.terminateMission(0)
def Win (   self,
  un,
  terminate 
)

Definition at line 42 of file plunder.py.

References patrol.cred, patrol_ambush.cred, plunder.cred, bounty.cred, defend.cred, escort_local.cred, cargo_mission.cred, patrol.donevar, plunder.donevar, plunder.mplay, escort_mission.mplay, defend.mplay, patrol_ambush.mplay, patrol.mplay, escort_local.mplay, bounty.mplay, directions_mission.mplay, cargo_mission.mplay, and quest.removeQuest().

42 
43  def Win (self,un,terminate):
44  VS.IOmessage (0,"plunder mission",self.mplay,"#00ff00Excellent work pilot.")
45  VS.IOmessage (0,"plunder mission",self.mplay,"#00ff00You have been rewarded for your effort as agreed.")
46  VS.IOmessage (0,"plunder mission",self.mplay,"#00ff00Your contribution to the war effort will be remembered.")
47  print "do you win?"
48  un.addCredits(self.cred)
49  if len(self.donevar):
50  quest.removeQuest(self.you.isPlayerStarship(),self.donevar,1)
51  if (terminate):
52  print "you win plunder mission!"
53  VS.terminateMission(1)

Field Documentation

arrived

Definition at line 22 of file plunder.py.

category

Definition at line 25 of file plunder.py.

content

Definition at line 20 of file plunder.py.

cred

Definition at line 24 of file plunder.py.

curiter

Definition at line 19 of file plunder.py.

donevar

Definition at line 26 of file plunder.py.

enemy

Definition at line 18 of file plunder.py.

faction

Definition at line 23 of file plunder.py.

gosig

Definition at line 31 of file plunder.py.

mplay

Definition at line 16 of file plunder.py.

newship

Definition at line 15 of file plunder.py.

obj

Definition at line 17 of file plunder.py.

pos

Definition at line 30 of file plunder.py.

quantity

Definition at line 21 of file plunder.py.

you

Definition at line 29 of file plunder.py.


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