diff --git a/aoe/costs.py b/aoe/costs.py index 106d185..e6f5b53 100644 --- a/aoe/costs.py +++ b/aoe/costs.py @@ -138,4 +138,5 @@ class Costs(): Units.KNIGHT: (60, 0, 75, 0), Units.SKIRMISHER: (25, 35, 0, 0), Units.ARCHER: (0, 25, 45, 0), + Units.MONK: (0, 0, 100, 0), } diff --git a/aoe/dependencies.py b/aoe/dependencies.py index b80a3b4..e71fa55 100644 --- a/aoe/dependencies.py +++ b/aoe/dependencies.py @@ -269,4 +269,5 @@ class Dependencies(): Units.KNIGHT: [Ages.CASTLE, Buildings.STABLE], Units.SKIRMISHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE], Units.ARCHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE], + Units.MONK: [Ages.CASTLE, Buildings.MONASTERY], } diff --git a/aoe/gameplay.py b/aoe/gameplay.py index 935a699..1058feb 100644 --- a/aoe/gameplay.py +++ b/aoe/gameplay.py @@ -60,6 +60,12 @@ class Gameplay(): (old_task, new_task, count,))) + def get_relic(self, action_time, walking_time=60): + self._check_time(action_time) + self.actions[action_time].append((self.world.get_relic, + (walking_time,))) + + def lure_huntable_with_villager(self, action_time, previous_task, diff --git a/aoe/gather.py b/aoe/gather.py index 7edc853..a3f698f 100644 --- a/aoe/gather.py +++ b/aoe/gather.py @@ -144,6 +144,7 @@ class Gather(): if task in [ Tasks.IDLE, Tasks.BUILD, + Tasks.MONK_IDLE, Tasks.LURE, ]: return @@ -281,6 +282,8 @@ class Gather(): Tasks.BUILD, Tasks.LURE, Tasks.IDLE, + Tasks.MONK_IDLE, + Tasks.MONK_GET_RELIC, ]: continue diff --git a/aoe/production.py b/aoe/production.py index 4ca00d1..ebdae11 100644 --- a/aoe/production.py +++ b/aoe/production.py @@ -25,6 +25,7 @@ class Production(): Units.KNIGHT: Buildings.STABLE, Units.SKIRMISHER: Buildings.ARCHERYRANGE, Units.ARCHER: Buildings.ARCHERYRANGE, + Units.MONK: Buildings.MONASTERY, Research.TOWNWATCH: Buildings.TOWNCENTER, Research.TOWNPATROL: Buildings.TOWNCENTER, Research.TREADMILLCRANE: Buildings.UNIVERSITY, diff --git a/aoe/times.py b/aoe/times.py index 2df0a18..b9708dc 100644 --- a/aoe/times.py +++ b/aoe/times.py @@ -135,4 +135,5 @@ class Times(): Units.KNIGHT: 30, Units.SKIRMISHER: 22, Units.ARCHER: 35, + Units.MONK: 51, } diff --git a/aoe/types.py b/aoe/types.py index 84ebd39..a8a06bb 100644 --- a/aoe/types.py +++ b/aoe/types.py @@ -61,6 +61,8 @@ class Tasks(Enum): FISHTRAP = auto() WOOD = auto() GOLD = auto() + MONK_IDLE = auto() + MONK_GET_RELIC = auto() RELIC = auto() TRADECART = auto() TRADECOG = auto() @@ -168,3 +170,4 @@ class Units(Enum): KNIGHT = auto() SKIRMISHER = auto() ARCHER = auto() + MONK = auto() diff --git a/aoe/world.py b/aoe/world.py index 0b77b80..745d0c0 100644 --- a/aoe/world.py +++ b/aoe/world.py @@ -153,6 +153,18 @@ class World(): if self.villager_tasks[previous_task] < count: raise IllegalVillagerMoveException + non_assignable_tasks = [ + Tasks.MONK_GET_RELIC, + Tasks.MONK_IDLE, + Tasks.RELIC, + Tasks.TRADECART, + Tasks.TRADECOG, + ] + + if new_task in non_assignable_tasks or \ + previous_task in non_assignable_tasks: + raise IllegalVillagerMoveException + if new_task: self.gather.check_gather(self, new_task, count) self.villager_tasks[new_task] += count @@ -183,6 +195,32 @@ class World(): self.assign_villager(task, Tasks.BUILD, count) + def get_relic(self, walking_time=60): + if self.villager_tasks[Tasks.MONK_IDLE] < 1: + self.relics_waiting_for_monk.append(walking_time) + return + + self.villager_tasks[Tasks.MONK_IDLE] -= 1 + self.villager_tasks[Tasks.MONK_GET_RELIC] += 1 + + update_time = self.current_time + walking_time + + self.events[update_time].append((self._add_relic, ())) + + + def _add_relic(self): + self.villager_tasks[Tasks.MONK_IDLE] += 1 + self.villager_tasks[Tasks.MONK_GET_RELIC] -= 1 + self.villager_tasks[Tasks.RELIC] += 1 + self._get_next_waiting_relic() + + + def _get_next_waiting_relic(self): + if len(self.relics_waiting_for_monk) > 0: + walking_time = self.relics_waiting_for_monk.pop() + self.get_relic(walking_time) + + def build(self, building, villagers_from, villagers_to, building_tasks=None): if type(villagers_from) == Tasks: villagers_from = [villagers_from] @@ -360,6 +398,9 @@ class World(): self.villagers += 1 self.villager_tasks[Tasks.IDLE] += 1 self.assign_villager(Tasks.IDLE, initial_task) + elif thing == Units.MONK: + self.villager_tasks[Tasks.MONK_IDLE] += 1 + self._get_next_waiting_relic() def _start_producing(self, thing, initial_task): @@ -437,6 +478,7 @@ class World(): self.production_available = {b: 0 for b in Buildings} self.production_available[Buildings.TOWNCENTER] = 1 self.production_queue = [] + self.relics_waiting_for_monk = [] self.current_time = 0 self.events = defaultdict(list)