96 lines
4.3 KiB
Python
96 lines
4.3 KiB
Python
from aoe.types import *
|
|
|
|
|
|
|
|
class ResearchEffects():
|
|
|
|
|
|
# This assumes that the research effects will be the same for every civ.
|
|
# If not, we could make a separate function for each research that has an
|
|
# effect (e.g., def doublebitaxe(self, world)) and call the correct
|
|
# function from complete_research. That, along with instantiating the
|
|
# class, would allow modification of the relevant functions as necessary.
|
|
|
|
@classmethod
|
|
def complete_research(cls, world, research):
|
|
match research:
|
|
case Research.TREADMILLCRANE:
|
|
# TODO adjust times for all in-progress buildings
|
|
# Wouldn't be particularly hard, but I don't actually know
|
|
# how the effect is applied to in-progress buildings.
|
|
for item, time in enumerate(world.times.build_times):
|
|
new_time = 0.8*world.times.build_times[item]
|
|
world.times.build_times[item] = new_time
|
|
case Research.CONSCRIPTION:
|
|
# TODO adjust times for all in-progress units
|
|
# Wouldn't be particularly hard, but I don't actually know
|
|
# how the effect is applied to in-progress units.
|
|
|
|
# Note that this research also affects speed of research in
|
|
# those buildings (not just speed of unit production)
|
|
affected = [Buildings.ARCHERYRANGE,
|
|
Buildings.BARRACKS,
|
|
Buildings.STABLE,
|
|
Buildings.CASTLE,
|
|
#Buildings.DONJON,
|
|
]
|
|
for item, building in enumerate(world.production.building):
|
|
if building in affected:
|
|
new_time = 0.67*world.times.build_times[item]
|
|
world.times.build_times[item] = new_time
|
|
case Research.WHEELBARROW:
|
|
cls._modify_rates_with_wheelbarrow_line(world, 1.1, 1.11)
|
|
case Research.HANDCART:
|
|
cls._modify_rates_with_wheelbarrow_line(world, 1.1, 1.11)
|
|
case Research.DOUBLEBITAXE:
|
|
world.permanently_modify_gather_rate(Tasks.WOOD, 1.2)
|
|
case Research.BOWSAW:
|
|
world.permanently_modify_gather_rate(Tasks.WOOD, 1.2)
|
|
case Research.TWOMANSAW:
|
|
world.permanently_modify_gather_rate(Tasks.WOOD, 1.1)
|
|
case Research.HORSECOLLAR:
|
|
world.permanently_modify_farm_capacity(75)
|
|
case Research.HEAVYPLOW:
|
|
world.permanently_modify_farm_capacity(125)
|
|
case Research.CROPROTATION:
|
|
world.permanently_modify_farm_capacity(175)
|
|
case Research.GOLDMINING:
|
|
world.permanently_modify_gather_rate(Tasks.GOLD, 1.15)
|
|
case Research.GOLDSHAFTMINING:
|
|
world.permanently_modify_gather_rate(Tasks.GOLD, 1.15)
|
|
case Research.STONEMINING:
|
|
world.permanently_modify_gather_rate(Tasks.STONE, 1.15)
|
|
case Research.STONESHAFTMINING:
|
|
world.permanently_modify_gather_rate(Tasks.STONE, 1.15)
|
|
case Research.CARAVAN:
|
|
world.permanently_modify_gather_rate(Tasks.TRADECART, 1.20)
|
|
world.permanently_modify_gather_rate(Tasks.TRADECOG, 1.20)
|
|
#case Research.FISHINGLINES:
|
|
# probably looks like wheelbarrow
|
|
#case Research.GILLNETS:
|
|
# probably looks like wheelbarrow
|
|
#case Research.DOMESTICATION:
|
|
#case Research.PASTORALISM:
|
|
#case Research.TRANSHUMANCE:
|
|
#case Research.SHIPWRIGHT:
|
|
# do this one when you add ships
|
|
# just modify costs and times data structures
|
|
case _:
|
|
pass
|
|
|
|
|
|
@staticmethod
|
|
def _modify_rates_with_wheelbarrow_line(world, nonfarm_rate, farm_rate):
|
|
affected = [Tasks.BERRIES,
|
|
Tasks.SHEEP,
|
|
Tasks.BOAR,
|
|
Tasks.HUNT,
|
|
Tasks.FISH_VILLAGER,
|
|
Tasks.WOOD,
|
|
Tasks.GOLD,
|
|
Tasks.STONE]
|
|
for task in affected:
|
|
world.permanently_modify_gather_rate(task, non_farm_rate)
|
|
|
|
world.permanently_modify_gather_rate(Tasks.FARM, farm_rate)
|