Add trade

This commit is contained in:
Nate Bowman
2026-11-07 18:50:46 -05:00
parent 0d40fe5dc0
commit 4d9da78842
8 changed files with 62 additions and 6 deletions

View File

@@ -140,4 +140,5 @@ class Costs():
Units.ARCHER: (0, 25, 45, 0),
Units.MONK: (0, 0, 100, 0),
Units.FISHINGSHIP: (0, 75, 0, 0),
Units.TRADECOG: (0, 100, 50, 0),
}

View File

@@ -271,4 +271,5 @@ class Dependencies():
Units.ARCHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE],
Units.MONK: [Ages.CASTLE, Buildings.MONASTERY],
Units.FISHINGSHIP: [Ages.FEUDAL, Buildings.DOCK],
Units.TRADECOG: [Ages.FEUDAL, Buildings.DOCK],
}

View File

@@ -55,6 +55,16 @@ class Gameplay():
(initial_task,)))
def queue_trade_cog(self, action_time):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_trade_cog, ()))
def queue_trade_cart(self, action_time):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_trade_cart, ()))
def queue_unit(self, action_time, unit):
self._check_time(action_time)
self.actions[action_time].append((self.world.queue_unit, (unit,)))

View File

@@ -27,6 +27,7 @@ class Production():
Units.ARCHER: Buildings.ARCHERYRANGE,
Units.MONK: Buildings.MONASTERY,
Units.FISHINGSHIP: Buildings.DOCK,
Units.TRADECOG: Buildings.DOCK,
Research.TOWNWATCH: Buildings.TOWNCENTER,
Research.TOWNPATROL: Buildings.TOWNCENTER,
Research.TREADMILLCRANE: Buildings.UNIVERSITY,

View File

@@ -137,4 +137,5 @@ class Times():
Units.ARCHER: 35,
Units.MONK: 51,
Units.FISHINGSHIP: 40,
Units.TRADECOG: 36,
}

View File

@@ -173,3 +173,4 @@ class Units(Enum):
ARCHER = auto()
MONK = auto()
FISHINGSHIP = auto()
TRADECOG = auto()

View File

@@ -43,16 +43,11 @@ class World():
# to farms with the highest capacity.
# We keep track of only the closest upcoming farm deletion.
# TODO fishing ships
# TODO relics
# TODO trade carts
# TODO fishtraps
# TODO allow automation:
# reseeding of farms
# queuing of villagers
# possibly other things
# TODO gathering boars and hunting
# spend villager time in exchange for adding gatherable resource
# TODO food spoilage
# TODO use market for buy/sell
@@ -419,6 +414,10 @@ class World():
if not initial_task:
initial_task = Tasks.FISH_SHIP_IDLE
self.villager_tasks[initial_task] += 1
elif thing == Units.TRADECOG:
self.villager_tasks[Tasks.TRADECOG] += 1
elif thing == Units.TRADECART:
self.villager_tasks[Tasks.TRADECART] += 1
def _start_producing(self, thing, initial_task):
@@ -455,6 +454,14 @@ class World():
self._queue_thing(Units.FISHINGSHIP, initial_task)
def queue_trade_cog(self):
self._queue_thing(Units.TRADECOG)
def queue_trade_cart(self):
self._queue_thing(Units.TRADECART)
def _handle_events(self):
for func, args in self.events[self.current_time]:
func(*args)