def AddBuilding(self, building, b_modules=0): if building.identifier not in self.__yard: slot = AStruct() slot.building = building slot.b_modules = b_modules self.__yard[building.identifier] = slot return STATUS_CODES.SUCCESS else: return STATUS_CODES.FAILURE
def PopReadyBuildings(self): result = AStruct() result.b_modules = 0 result.buildings = [] for building_id in self.__yard.copy(): slot = self.__yard[building_id] if slot.building.progress == 100: self.__yard.pop(building_id) result.b_modules += slot.b_modules result.buildings.append(slot.building) else: continue return result
def RemoveBuilding(self, building_id=0): result = AStruct() if building_id in self.__yard: slot = self.__yard.pop(building_id) result.b_modules = slot.b_modules result.remainder = slot.building.cost * ( (100 - slot.building.progress) / 100) result.remainder = int(round(result.remainder)) else: result.b_modules = 0 result.remainder = 0 return result
def RemoveBuilding(self, building_id=0): result = AStruct() if building_id in self.__yard: slot = self.__yard.pop(building_id) result.b_modules = slot.b_modules result.remainder = slot.building.cost * ((100 - slot.building.progress) / 100) result.remainder = int(round(result.remainder)) else: result.b_modules = 0 result.remainder = 0 return result
# coding: utf-8 from helpers import AStruct PRECISION = 2 RECRUIT = 0 SOLDIER = 1 CAPTAIN = 2 GENERAL = 3 DISCIPLINE = "dis" ATTACK = "att" DEFENCE = "def" LOGISTICS = "log" LEADERSHIP = "lead" STATUS_CODES = AStruct() STATUS_CODES.SUCCESS = True STATUS_CODES.FAILURE = False
"PRICE_FACTOR": 100, "PRODUCTIVITY_GROWTH_FACTOR": 0.1, "EFFICIENCY_GROWTH_FACTOR": 1, "TECH_LEVEL_GROWTH_FACTOR": 1, "PRODUCTIVITY_FACTOR": 100, } DIVISION = {"COMMANDER_LEADERSHIP_FACTOR": 5} HUMAN = {"GAUSS_MU": 65, "GAUSS_SIGMA": 5, "MAX_HEALTH": 100, "VALIDITY_FACTOR": 50} SKILL = {"TALENT_MU": 2, "TALENT_SIGMA": 1, "MAXIMUM_MU": 15, "MAXIMUM_SIGMA": 5} WAREHOUSE = {"CAPACITY_FACTOR": 100, "INCREASE_CAPACITY_COST": 1000, "DECREASE_CAPACITY_COST": 500} BUILDINGS = AStruct() BUILDINGS.FACTORY = AStruct() BUILDINGS.FACTORY.COST = 100000 BUILDINGS.FACTORY.COMPLEXITY = 50 BUILDINGS.FACTORY.VERBOSE_NAME = "factory" BUILDINGS.FACTORY.SHORT_NAME = "fc" BUILDINGS.MILITARY_UNIVERSITY = AStruct() BUILDINGS.MILITARY_UNIVERSITY.COST = 10000 BUILDINGS.MILITARY_UNIVERSITY.COMPLEXITY = 10 BUILDINGS.MILITARY_UNIVERSITY.VERBOSE_NAME = "military university" BUILDINGS.MILITARY_UNIVERSITY.SHORT_NAME = "mu" BUILDINGS.SOLDIER_SCHOOL = AStruct() BUILDINGS.SOLDIER_SCHOOL.COST = 5000
SKILL = { "TALENT_MU" : 2, "TALENT_SIGMA" : 1, "MAXIMUM_MU" : 15, "MAXIMUM_SIGMA" : 5, } WAREHOUSE = { "CAPACITY_FACTOR" : 100, "INCREASE_CAPACITY_COST": 1000, "DECREASE_CAPACITY_COST": 500, } BUILDINGS = AStruct() BUILDINGS.FACTORY = AStruct() BUILDINGS.FACTORY.COST = 100000 BUILDINGS.FACTORY.COMPLEXITY = 50 BUILDINGS.FACTORY.VERBOSE_NAME = "factory" BUILDINGS.FACTORY.SHORT_NAME = "fc" BUILDINGS.MILITARY_UNIVERSITY = AStruct() BUILDINGS.MILITARY_UNIVERSITY.COST = 10000 BUILDINGS.MILITARY_UNIVERSITY.COMPLEXITY = 10 BUILDINGS.MILITARY_UNIVERSITY.VERBOSE_NAME = "military university" BUILDINGS.MILITARY_UNIVERSITY.SHORT_NAME = "mu" BUILDINGS.SOLDIER_SCHOOL = AStruct() BUILDINGS.SOLDIER_SCHOOL.COST = 5000