Add fishing ships
This commit is contained in:
@@ -139,4 +139,5 @@ class Costs():
|
|||||||
Units.SKIRMISHER: (25, 35, 0, 0),
|
Units.SKIRMISHER: (25, 35, 0, 0),
|
||||||
Units.ARCHER: (0, 25, 45, 0),
|
Units.ARCHER: (0, 25, 45, 0),
|
||||||
Units.MONK: (0, 0, 100, 0),
|
Units.MONK: (0, 0, 100, 0),
|
||||||
|
Units.FISHINGSHIP: (0, 75, 0, 0),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,4 +270,5 @@ class Dependencies():
|
|||||||
Units.SKIRMISHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE],
|
Units.SKIRMISHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE],
|
||||||
Units.ARCHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE],
|
Units.ARCHER: [Ages.FEUDAL, Buildings.ARCHERYRANGE],
|
||||||
Units.MONK: [Ages.CASTLE, Buildings.MONASTERY],
|
Units.MONK: [Ages.CASTLE, Buildings.MONASTERY],
|
||||||
|
Units.FISHINGSHIP: [Ages.FEUDAL, Buildings.DOCK],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,12 @@ class Gameplay():
|
|||||||
(initial_task,)))
|
(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):
|
def queue_unit(self, action_time, unit):
|
||||||
self._check_time(action_time)
|
self._check_time(action_time)
|
||||||
self.actions[action_time].append((self.world.queue_unit, (unit,)))
|
self.actions[action_time].append((self.world.queue_unit, (unit,)))
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ class Gather():
|
|||||||
Tasks.IDLE,
|
Tasks.IDLE,
|
||||||
Tasks.MONK_IDLE,
|
Tasks.MONK_IDLE,
|
||||||
Tasks.MONK_GET_RELIC,
|
Tasks.MONK_GET_RELIC,
|
||||||
|
Tasks.FISH_SHIP_IDLE,
|
||||||
]:
|
]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -411,7 +412,8 @@ class Gather():
|
|||||||
Buildings.MININGCAMP: {Tasks.GOLD: 4*800,
|
Buildings.MININGCAMP: {Tasks.GOLD: 4*800,
|
||||||
Tasks.STONE: 4*350},
|
Tasks.STONE: 4*350},
|
||||||
Buildings.FARM: {Tasks.FARM: 175},
|
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,
|
Buildings.TOWNCENTER: {Tasks.WOOD: 2000,
|
||||||
Tasks.GOLD: 4*800,
|
Tasks.GOLD: 4*800,
|
||||||
Tasks.STONE: 4*350,
|
Tasks.STONE: 4*350,
|
||||||
@@ -428,9 +430,9 @@ class Gather():
|
|||||||
Tasks.BOAR: 0,
|
Tasks.BOAR: 0,
|
||||||
Tasks.HUNT: 0,
|
Tasks.HUNT: 0,
|
||||||
Tasks.FARM: 0,
|
Tasks.FARM: 0,
|
||||||
Tasks.FISH_VILLAGER: 0.5,
|
Tasks.FISH_VILLAGER: 0,
|
||||||
Tasks.FISH_SHIP_SHORE: 0.5,
|
Tasks.FISH_SHIP_SHORE: 0,
|
||||||
Tasks.FISH_SHIP_DEEP: 0,
|
Tasks.FISH_SHIP_DEEP: 0.5,
|
||||||
Tasks.FISHTRAP: 0,
|
Tasks.FISHTRAP: 0,
|
||||||
Tasks.WOOD: 0.85,
|
Tasks.WOOD: 0.85,
|
||||||
Tasks.GOLD: 0,
|
Tasks.GOLD: 0,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class Production():
|
|||||||
Units.SKIRMISHER: Buildings.ARCHERYRANGE,
|
Units.SKIRMISHER: Buildings.ARCHERYRANGE,
|
||||||
Units.ARCHER: Buildings.ARCHERYRANGE,
|
Units.ARCHER: Buildings.ARCHERYRANGE,
|
||||||
Units.MONK: Buildings.MONASTERY,
|
Units.MONK: Buildings.MONASTERY,
|
||||||
|
Units.FISHINGSHIP: Buildings.DOCK,
|
||||||
Research.TOWNWATCH: Buildings.TOWNCENTER,
|
Research.TOWNWATCH: Buildings.TOWNCENTER,
|
||||||
Research.TOWNPATROL: Buildings.TOWNCENTER,
|
Research.TOWNPATROL: Buildings.TOWNCENTER,
|
||||||
Research.TREADMILLCRANE: Buildings.UNIVERSITY,
|
Research.TREADMILLCRANE: Buildings.UNIVERSITY,
|
||||||
|
|||||||
@@ -136,4 +136,5 @@ class Times():
|
|||||||
Units.SKIRMISHER: 22,
|
Units.SKIRMISHER: 22,
|
||||||
Units.ARCHER: 35,
|
Units.ARCHER: 35,
|
||||||
Units.MONK: 51,
|
Units.MONK: 51,
|
||||||
|
Units.FISHINGSHIP: 40,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ class Tasks(Enum):
|
|||||||
LURE = auto()
|
LURE = auto()
|
||||||
FARM = auto()
|
FARM = auto()
|
||||||
FISH_VILLAGER = auto()
|
FISH_VILLAGER = auto()
|
||||||
|
FISH_SHIP_IDLE = auto()
|
||||||
FISH_SHIP_SHORE = auto()
|
FISH_SHIP_SHORE = auto()
|
||||||
FISH_SHIP_DEEP = auto()
|
FISH_SHIP_DEEP = auto()
|
||||||
FISHTRAP = auto()
|
FISHTRAP = auto()
|
||||||
@@ -171,3 +172,4 @@ class Units(Enum):
|
|||||||
SKIRMISHER = auto()
|
SKIRMISHER = auto()
|
||||||
ARCHER = auto()
|
ARCHER = auto()
|
||||||
MONK = auto()
|
MONK = auto()
|
||||||
|
FISHINGSHIP = auto()
|
||||||
|
|||||||
20
aoe/world.py
20
aoe/world.py
@@ -161,10 +161,22 @@ class World():
|
|||||||
Tasks.TRADECOG,
|
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 \
|
if new_task in non_assignable_tasks or \
|
||||||
previous_task in non_assignable_tasks:
|
previous_task in non_assignable_tasks:
|
||||||
raise IllegalVillagerMoveException
|
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:
|
if new_task:
|
||||||
self.gather.check_gather(self, new_task, count)
|
self.gather.check_gather(self, new_task, count)
|
||||||
self.villager_tasks[new_task] += count
|
self.villager_tasks[new_task] += count
|
||||||
@@ -401,6 +413,10 @@ class World():
|
|||||||
elif thing == Units.MONK:
|
elif thing == Units.MONK:
|
||||||
self.villager_tasks[Tasks.MONK_IDLE] += 1
|
self.villager_tasks[Tasks.MONK_IDLE] += 1
|
||||||
self._get_next_waiting_relic()
|
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):
|
def _start_producing(self, thing, initial_task):
|
||||||
@@ -433,6 +449,10 @@ class World():
|
|||||||
self._queue_thing(Units.VILLAGER, initial_task)
|
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):
|
def _handle_events(self):
|
||||||
for func, args in self.events[self.current_time]:
|
for func, args in self.events[self.current_time]:
|
||||||
func(*args)
|
func(*args)
|
||||||
|
|||||||
Reference in New Issue
Block a user