fix the generals problems

This commit is contained in:
Richard 2024-02-11 18:24:16 +01:00
parent 53867a3257
commit 4daf8cfb7d
3 changed files with 15 additions and 6 deletions

View File

@ -42,7 +42,7 @@ class General:
return False
traders = [s for s in self.store.all('Ship') if s.role == 'trader']
safe_buffer = len(traders) * 100000 + 100000
#print(safe_buffer, price, sy)
if self.agent.credits < safe_buffer + price:
return # cant afford it!
ship = self.c.api.purchase(stype, sy)
@ -88,8 +88,11 @@ class General:
return 'trade'
def phase_trade(self):
# 20? traders
pass
self.maybe_purchase('SHIP_LIGHT_HAULER', 'trader')
traders = list([s for s in self.store.all('Ship') if s.role == 'trader'])
if len(traders) >= 19:
return 'mine'
def phase_mine(self):
# metal mining crew

View File

@ -196,6 +196,11 @@ class BaseMission(Mission):
loc = self.ship.location
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):
delivery = self.st('delivery')
if delivery == 'sell':

View File

@ -14,9 +14,10 @@ class SitMission(BaseMission):
def steps(self):
return {
**self.travel_steps('to', 'dest', 'sit'),
**self.travel_steps('to', 'dest', '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):