From d5c0d928b60eb44fc058a5b3b5c8648ca93f7fee Mon Sep 17 00:00:00 2001 From: Nate Bowman Date: Fri, 6 Nov 2026 19:22:15 -0500 Subject: [PATCH] Add fishing ships --- aoe/costs.py | 1 + aoe/dependencies.py | 1 + aoe/gameplay.py | 6 ++++++ aoe/gather.py | 10 ++++++---- aoe/production.py | 1 + aoe/times.py | 1 + aoe/types.py | 2 ++ aoe/world.py | 20 ++++++++++++++++++++ 8 files changed, 38 insertions(+), 4 deletions(-) diff --git a/aoe/costs.py b/aoe/costs.py index e6f5b53..41350b0 100644 --- a/aoe/costs.py +++ b/aoe/costs.py @@ -139,4 +139,5 @@ class Costs(): Units.SKIRMISHER: (25, 35, 0, 0), Units.ARCHER: (0, 25, 45, 0), Units.MONK: (0, 0, 100, 0), + Units.FISHINGSHIP: (0, 75, 0, 0), } diff --git a/aoe/dependencies.py b/aoe/dependencies.py index e71fa55..3e2c5dd 100644 --- a/aoe/dependencies.py +++ b/aoe/dependencies.py @@ -270,4 +270,5 @@ class Dependencies(): Units.SKIRMISHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE], Units.ARCHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE], Units.MONK: [Ages.CASTLE, Buildings.MONASTERY], + Units.FISHINGSHIP: [Ages.FEUDAL, Buildings.DOCK], } diff --git a/aoe/gameplay.py b/aoe/gameplay.py index 1058feb..c8ae4e8 100644 --- a/aoe/gameplay.py +++ b/aoe/gameplay.py @@ -49,6 +49,12 @@ class Gameplay(): (initial_task,))) + def queue_fishing_ship(self, action_time, initial_task=Tasks.FISH_SHIP_DEEP): + self._check_time(action_time) + self.actions[action_time].append((self.world.queue_fishing_ship, + (initial_task,))) + + def queue_unit(self, action_time, unit): self._check_time(action_time) self.actions[action_time].append((self.world.queue_unit, (unit,))) diff --git a/aoe/gather.py b/aoe/gather.py index a3f698f..3fa5888 100644 --- a/aoe/gather.py +++ b/aoe/gather.py @@ -284,6 +284,7 @@ class Gather(): Tasks.IDLE, Tasks.MONK_IDLE, Tasks.MONK_GET_RELIC, + Tasks.FISH_SHIP_IDLE, ]: continue @@ -411,7 +412,8 @@ class Gather(): Buildings.MININGCAMP: {Tasks.GOLD: 4*800, Tasks.STONE: 4*350}, Buildings.FARM: {Tasks.FARM: 175}, - #Buildings.DOCK: {Tasks.WOOD: 100}, + Buildings.DOCK: {Tasks.FISH_SHIP_SHORE: 100, + Tasks.FISH_SHIP_DEEP: 225*2}, Buildings.TOWNCENTER: {Tasks.WOOD: 2000, Tasks.GOLD: 4*800, Tasks.STONE: 4*350, @@ -428,9 +430,9 @@ class Gather(): Tasks.BOAR: 0, Tasks.HUNT: 0, Tasks.FARM: 0, - Tasks.FISH_VILLAGER: 0.5, - Tasks.FISH_SHIP_SHORE: 0.5, - Tasks.FISH_SHIP_DEEP: 0, + Tasks.FISH_VILLAGER: 0, + Tasks.FISH_SHIP_SHORE: 0, + Tasks.FISH_SHIP_DEEP: 0.5, Tasks.FISHTRAP: 0, Tasks.WOOD: 0.85, Tasks.GOLD: 0, diff --git a/aoe/production.py b/aoe/production.py index ebdae11..53c2a06 100644 --- a/aoe/production.py +++ b/aoe/production.py @@ -26,6 +26,7 @@ class Production(): Units.SKIRMISHER: Buildings.ARCHERYRANGE, Units.ARCHER: Buildings.ARCHERYRANGE, Units.MONK: Buildings.MONASTERY, + Units.FISHINGSHIP: Buildings.DOCK, Research.TOWNWATCH: Buildings.TOWNCENTER, Research.TOWNPATROL: Buildings.TOWNCENTER, Research.TREADMILLCRANE: Buildings.UNIVERSITY, diff --git a/aoe/times.py b/aoe/times.py index b9708dc..f48483a 100644 --- a/aoe/times.py +++ b/aoe/times.py @@ -136,4 +136,5 @@ class Times(): Units.SKIRMISHER: 22, Units.ARCHER: 35, Units.MONK: 51, + Units.FISHINGSHIP: 40, } diff --git a/aoe/types.py b/aoe/types.py index a8a06bb..7df363f 100644 --- a/aoe/types.py +++ b/aoe/types.py @@ -56,6 +56,7 @@ class Tasks(Enum): LURE = auto() FARM = auto() FISH_VILLAGER = auto() + FISH_SHIP_IDLE = auto() FISH_SHIP_SHORE = auto() FISH_SHIP_DEEP = auto() FISHTRAP = auto() @@ -171,3 +172,4 @@ class Units(Enum): SKIRMISHER = auto() ARCHER = auto() MONK = auto() + FISHINGSHIP = auto() diff --git a/aoe/world.py b/aoe/world.py index 745d0c0..2cefbc6 100644 --- a/aoe/world.py +++ b/aoe/world.py @@ -161,10 +161,22 @@ class World(): Tasks.TRADECOG, ] + fishing_tasks = [ + Tasks.FISH_SHIP_IDLE, + Tasks.FISH_SHIP_SHORE, + Tasks.FISH_SHIP_DEEP, + Tasks.FISHTRAP, + ] + if new_task in non_assignable_tasks or \ previous_task in non_assignable_tasks: raise IllegalVillagerMoveException + num_fishing_tasks = (int(new_task in non_assignable_tasks) + + int(previous_task in non_assignable_tasks)) + if num_fishing_tasks == 1: + raise IllegalVillagerMoveException + if new_task: self.gather.check_gather(self, new_task, count) self.villager_tasks[new_task] += count @@ -401,6 +413,10 @@ class World(): elif thing == Units.MONK: self.villager_tasks[Tasks.MONK_IDLE] += 1 self._get_next_waiting_relic() + elif thing == Units.FISHINGSHIP: + if not initial_task: + initial_task = Tasks.FISH_SHIP_IDLE + self.villager_tasks[initial_task] += 1 def _start_producing(self, thing, initial_task): @@ -433,6 +449,10 @@ class World(): self._queue_thing(Units.VILLAGER, initial_task) + def queue_fishing_ship(self, initial_task=Tasks.FISH_SHIP_DEEP): + self._queue_thing(Units.FISHINGSHIP, initial_task) + + def _handle_events(self): for func, args in self.events[self.current_time]: func(*args)