1 from go_somewhere_significant
import go_somewhere_significant
13 def __init__ (self, creds, faction, quantity, category, returntobase, var_when_done=''):
14 Director.Mission.__init__ (self)
27 sysfile = VS.getSystemFile()
29 self.
you=VS.getPlayer()
30 self.
pos=self.you.Position()
34 VS.IOmessage (0,
"plunder mission",self.
mplay,
"Your mission is to destroy a %s merchant unit." % (self.
newship))
35 VS.IOmessage (1,
"plunder mission",self.
mplay,
"It is orbiting around the %s planet in the system." % (
unit.getUnitFullName(self.gosig.SignificantUnit())))
36 VS.IOmessage (2,
"plunder mission",self.
mplay,
"After it is destroyed, pick up all %s cargo that got ejected."%self.
category)
37 VS.IOmessage (3,
"plunder mission",self.
mplay,
"Then return to a %s base with your cargo. #00ff00Good luck!"%self.
faction)
39 print "aboritng plunder constructor..."
40 VS.terminateMission (0)
42 def Win (self,un,terminate):
43 VS.IOmessage (0,
"plunder mission",self.
mplay,
"#00ff00Excellent work pilot.")
44 VS.IOmessage (0,
"plunder mission",self.
mplay,
"#00ff00You have been rewarded for your effort as agreed.")
45 VS.IOmessage (0,
"plunder mission",self.
mplay,
"#00ff00Your contribution to the war effort will be remembered.")
47 un.addCredits(self.
cred)
51 print "you win plunder mission!"
52 VS.terminateMission(1)
55 VS.IOmessage(0,
"plunder mission",self.
mplay,
"#ff0000You have failed this mission and will not be rewarded.")
59 print "lose plunder mission"
60 VS.terminateMission(0)
64 if (self.you.isNull()):
69 cargquant=self.you.GetCargo(self.
content).GetQuantity()
72 VS.IOmessage(0,
"plunder mission",self.
mplay,
'Not enough of %s cargo... Get more until you have %d.'%(self.
quantity))
73 VS.setCompleteness(self.
obj,0.)
74 elif self.you.isDocked(self.gosig.SignificantUnit())
or self.gosig.SignificantUnit().isDocked(self.
you):
81 cargquant=self.you.GetCargo(self.
content).GetQuantity()
82 VS.setCompleteness(self.
obj,float(cargquant)/float(self.
quantity))
86 self.gosig.SignificantUnit().setCombatRole(
"INERT")
87 VS.IOmessage(0,
"plunder mission",self.
mplay,
'Give all of your cargo to the %s unit.'%(
unit.getUnitFullName(self.gosig.SignificantUnit())))
90 self.
pos=self.enemy.Position()
93 if (curun==self.
enemy):
94 self.enemy.SetTarget(self.
you)
95 elif (curun.isNull()):
97 if (self.enemy.isNull()):
98 VS.setCompleteness(self.
obj,1.)
104 VS.IOmessage(0,
"plunder mission",self.
mplay,
'You must now pick up at least %d of the %s cargo.'%(self.
quantity,self.
content))
106 significant=self.gosig.SignificantUnit()
107 if (significant.isNull ()):
109 VS.terminateMission(0)
112 if (self.you.getSignificantDistance(significant)<10000.0):
116 if (carg.GetQuantity()==0):
117 carg = VS.getRandCargo(self.
quantity,
"")
121 self.enemy.addCargo(carg)
122 VS.setCompleteness(self.gosig.obj,1.)
123 VS.IOmessage(0,
"plunder mission",self.
mplay,
'You must now destroy the %s ship.'%self.
newship)
124 VS.IOmessage(0,
"plunder mission",self.
mplay,
'That fighter contains the wanted %s cargo in its hold.'%self.
content)
130 VS.terminateMission(0)
134 print "ending briefing"
137 print "loop briefing"
138 Briefing.terminate();
141 print "ending briefing"