fix the generals problems
This commit is contained in:
parent
53867a3257
commit
4daf8cfb7d
@ -42,7 +42,7 @@ class General:
|
|||||||
return False
|
return False
|
||||||
traders = [s for s in self.store.all('Ship') if s.role == 'trader']
|
traders = [s for s in self.store.all('Ship') if s.role == 'trader']
|
||||||
safe_buffer = len(traders) * 100000 + 100000
|
safe_buffer = len(traders) * 100000 + 100000
|
||||||
|
#print(safe_buffer, price, sy)
|
||||||
if self.agent.credits < safe_buffer + price:
|
if self.agent.credits < safe_buffer + price:
|
||||||
return # cant afford it!
|
return # cant afford it!
|
||||||
ship = self.c.api.purchase(stype, sy)
|
ship = self.c.api.purchase(stype, sy)
|
||||||
@ -88,8 +88,11 @@ class General:
|
|||||||
return 'trade'
|
return 'trade'
|
||||||
|
|
||||||
def phase_trade(self):
|
def phase_trade(self):
|
||||||
# 20? traders
|
self.maybe_purchase('SHIP_LIGHT_HAULER', 'trader')
|
||||||
pass
|
traders = list([s for s in self.store.all('Ship') if s.role == 'trader'])
|
||||||
|
if len(traders) >= 19:
|
||||||
|
return 'mine'
|
||||||
|
|
||||||
|
|
||||||
def phase_mine(self):
|
def phase_mine(self):
|
||||||
# metal mining crew
|
# metal mining crew
|
||||||
|
@ -196,6 +196,11 @@ class BaseMission(Mission):
|
|||||||
loc = self.ship.location
|
loc = self.ship.location
|
||||||
self.api.marketplace(loc)
|
self.api.marketplace(loc)
|
||||||
|
|
||||||
|
def step_shipyard(self):
|
||||||
|
loc = self.ship.location
|
||||||
|
if 'SHIPYARD' in loc.traits:
|
||||||
|
self.api.shipyard(loc)
|
||||||
|
|
||||||
def step_unload(self):
|
def step_unload(self):
|
||||||
delivery = self.st('delivery')
|
delivery = self.st('delivery')
|
||||||
if delivery == 'sell':
|
if delivery == 'sell':
|
||||||
|
@ -14,9 +14,10 @@ class SitMission(BaseMission):
|
|||||||
|
|
||||||
def steps(self):
|
def steps(self):
|
||||||
return {
|
return {
|
||||||
**self.travel_steps('to', 'dest', 'sit'),
|
**self.travel_steps('to', 'dest', 'market'),
|
||||||
'sit': (self.step_sit, 'market'),
|
'sit': (self.step_sit, 'market'),
|
||||||
'market': (self.step_market, 'sit')
|
'market': (self.step_market, 'shipyard'),
|
||||||
|
'shipyard': (self.step_shipyard, 'sit')
|
||||||
}
|
}
|
||||||
|
|
||||||
def step_sit(self):
|
def step_sit(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user