def setup(self): """ Setup test case """ self.creature_config = {} self.model = mock() self.rng = Random() self.creature_config['rat'] = creature_config(name='rat', body=4, finesse=12, mind=2, hp=2, speed=2, icons=[100, 101], attack=2, ai=MockAI) self.creature_config['spider'] = creature_config( name='spider', body=6, finesse=12, mind=8, hp=6, speed=1, icons=[102], attack=4, ai=MockAI, effect_handles=[EffectHandle(trigger='on attack hit', effect='minor poison', parameters=None, charges=100)]) self.creature_config['skeleton warrior'] = creature_config( name='skeleton warrior', body=8, finesse=11, mind=0, hp=8, speed=2.5, icons=[110], attack=2, ai=MockAI, effects=[DamageModifier(modifier=2, damage_type='crushing', duration=None, frequency=None, tick=None, icon=101, title='title', description='description')]) self.creatures = partial(generate_creature, configuration=self.creature_config, model=self.model, rng=self.rng, item_generator=mock())
def init_creatures(context): """ Initialise creatures :returns: list of creature configurations :rtype: [CreatureConfiguration] """ config = [] surface_manager = context.surface_manager crimson_jaw_f0 = surface_manager.add_icon("crimson jaw_f0", ":crimson-jaw_f0.png", "&", ["bold", "red"]) crimson_jaw_f1 = surface_manager.add_icon("crimson jaw_f1", ":crimson-jaw_f1.png", "&", ["bold", "red"]) config.append( creature_config( name="crimson jaw", body=12, finesse=9, mind=12, hp=30, speed=3, icons=(crimson_jaw_f0, crimson_jaw_f1), attack=8, inventory=[inventory_config(item_name="whip of ashmque", min_amount=0, max_amount=1, probability=100)], ai=SkeletonWarriorAI, ) ) return config
def init_creatures(context): """ Initialise creatures :returns: list of creature configurations :rtype: [CreatureConfiguration] """ config = [] surface_manager = context.surface_manager crimson_jaw_f0 = surface_manager.add_icon('crimson jaw_f0', ':crimson-jaw_f0.png', '&', ['bold', 'red']) crimson_jaw_f1 = surface_manager.add_icon('crimson jaw_f1', ':crimson-jaw_f1.png', '&', ['bold', 'red']) config.append(creature_config(name = 'crimson jaw', body = 12, finesse = 9, mind = 12, hp = 30, speed = 3, icons = (crimson_jaw_f0, crimson_jaw_f1), attack = 8, inventory = [inventory_config( item_name = 'whip of ashmque', min_amount = 0, max_amount = 1, probability = 100)], ai = SkeletonWarriorAI)) return config
def setup(self): """ Setup testcases """ self.model = mock() self.rng = Random() inventory = [inventory_config('dagger', 1, 1, 100)] self.skeleton_config = creature_config( name='skeleton warrior', body=8, finesse=11, mind=0, hp=8, speed=2.5, icons=[405], attack=2, ai=MockAI, inventory=inventory) self.creature_config = {} self.creature_config['skeleton warrior'] = self.skeleton_config item_config = ItemConfigurations(self.rng) item_config.add_item(ItemConfiguration(name='dagger', cost=2, weight=2, icons='foo', types=['item'], rarity='common')) items = ItemGenerator(item_config) self.creatures = partial(generate_creature, self.creature_config, self.model, items, self.rng)
def setup(self): """ Setup testcases """ self.model = mock() self.rng = Random() inventory = [inventory_config('dagger', 1, 1, 100)] self.skeleton_config = creature_config(name='skeleton warrior', body=8, finesse=11, mind=0, hp=8, speed=2.5, icons=[405], attack=2, ai=MockAI, inventory=inventory) self.creature_config = {} self.creature_config['skeleton warrior'] = self.skeleton_config item_config = ItemConfigurations(self.rng) item_config.add_item( ItemConfiguration(name='dagger', cost=2, weight=2, icons='foo', types=['item'], rarity='common')) items = ItemGenerator(item_config) self.creatures = partial(generate_creature, self.creature_config, self.model, items, self.rng)
def init_creatures(context): """ Initialise creatures'' :returns: list of configuration items :rtype: [CreatureConfiguration] """ surface_manager = context.surface_manager config = [] fungus_f0 = surface_manager.add_icon('fungus_f0', ':fungus_f0.png', 'F', ['yellow', 'dim']) fungus_f1 = surface_manager.add_icon('fungus_f1', ':fungus_f1.png', 'F', ['yellow', 'dim']) config.append(creature_config(name = 'fungus', body = 4, finesse = 2, mind = 1, hp = 7, speed = 8, icons = (fungus_f0, fungus_f1), attack = 3, ai = FungusAI)) great_fungus_f0 = surface_manager.add_icon('great_fungus_f0', ':great_fungus_f0.png', 'F', ['white', 'bold']) great_fungus_f1 = surface_manager.add_icon('great_fungus_f1', ':great_fungus_f1.png', 'F', ['white', 'bold']) config.append(creature_config(name = 'great fungus', body = 6, finesse = 1, mind = 3, hp = 12, speed = 8, icons = (great_fungus_f0, great_fungus_f1), attack = 5, ai = GreatFungusAI)) spider_f0 = surface_manager.add_icon('spider_f0', ':masked-spider_f0.png', 's', ['white', 'dim']) spider_f1 = surface_manager.add_icon('spider_f1', ':masked-spider_f1.png', 's', ['white', 'dim']) config.append(creature_config(name = 'spider', body = 6, finesse = 12, mind = 8, hp = 6, speed = 1, icons = (spider_f0, spider_f1), attack = 4, ai = RatAI, effect_handles = [EffectHandle( trigger = 'on attack hit', effect = 'minor poison', parameters = None, charges = 100)])) mouse_f0 = surface_manager.add_icon('rat_f0', ':mouse_f0.png', 'r', ['yellow', 'dim']) mouse_f1 = surface_manager.add_icon('rat_f1', ':mouse_f1.png', 'r', ['yellow', 'dim']) config.append(creature_config(name = 'rat', body = 4, finesse = 12, mind = 2, hp = 2, speed = 2, icons = (mouse_f0, mouse_f1), attack = 1, ai = RatAI)) firebeetle_f0 = surface_manager.add_icon('fire beetle_f0', ':scarab-beetle_f0.png', 'a', ['red']) firebeetle_f1 = surface_manager.add_icon('fire beetle_f1', ':scarab-beetle_f1.png', 'a', ['red']) config.append(creature_config(name = 'fire beetle', body = 10, finesse = 11, mind = 2, hp = 4, speed = 3, icons = (firebeetle_f0, firebeetle_f1), attack = 2, ai = FireBeetleAI)) skeleton_inventory = [inventory_config(item_name = 'sword', min_amount = 0, max_amount = 1, probability = 100)] skeleton_effects = [DamageModifier(modifier = 2, damage_type = CRUSHING_DAMAGE, duration = None, frequency = None, tick = None, icon = 0, title = '', description = ''), DamageModifier(modifier = 2, damage_type = LIGHT_DAMAGE, duration = None, frequency = None, tick = None, icon = 0, title = '', description = ''), DamageModifier(modifier = -2, damage_type = PIERCING_DAMAGE, duration = None, frequency = None, tick = None, icon = 0, title = '', description = ''), DamageModifier(modifier = -2, damage_type = POISON_DAMAGE, duration = None, frequency = None, tick = None, icon = 0, title = '', description = '')] skeleton_f0 = surface_manager.add_icon('skeleton warrior_f0', ':blade-bite_f0.png', 'Z', ['white', 'bold']) skeleton_f1 = surface_manager.add_icon('skeleton warrior_f1', ':blade-bite_f1.png', 'Z', ['white', 'bold']) config.append(creature_config(name = 'skeleton warrior', body = 8, finesse = 11, mind = 0, hp = 8, speed = 4, icons = (skeleton_f0, skeleton_f1), attack = 1, ai = SkeletonWarriorAI, inventory = skeleton_inventory, effects = skeleton_effects)) bat_effects = [MovementModeModifier(mode = 'fly', duration = None, frequency = None, tick = None, icon = 0, title = '', description = '')] bat_f0 = surface_manager.add_icon('bat_f0', ':characters/bat_f0.png', 'B', ['yellow', 'dim']) bat_f1 = surface_manager.add_icon('bat_f1', ':characters/bat_f1.png', 'B', ['yellow', 'dim']) config.append(creature_config(name = 'bat', body = 1, finesse = 1, mind = 1, hp = 1, speed = 1, icons = (bat_f0, bat_f1), attack = 1, ai = FireBeetleAI, effects = bat_effects)) return config
def init_players(context): """ Initialise creatures :returns: list of creature configurations :rtype: [CreatureConfiguration] """ config = [] surface_manager = context.surface_manager adventurer_f0 = surface_manager.add_icon('adventurer_f0', ':pc_adventurer_f0.png', '@', ['white', 'bold']) adventurer_f1 = surface_manager.add_icon('adventurer_f1', ':pc_adventurer_f1.png', '@', ['white', 'bold']) config.append(creature_config(name = 'Adventurer', body = 6, finesse = 7, mind = 8, hp = 12, speed = 2.5, icons = (adventurer_f0, adventurer_f1), attack = 1, ai = None, effect_handles = None, inventory = [inventory_config( item_name = 'spade', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'sword', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'leather armour', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'bow', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'arrow', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'war arrow', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'blunt arrow', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'healing potion', min_amount = 1, max_amount = 2, probability = 50), inventory_config( item_name = 'bag of small caltrops', min_amount = 1, max_amount = 1, probability = 20)], description = '\n'.join(['A skillful adventurer.', '', 'Adventurer is armed and ready to explore any dungeon he sees. He is strong enough to survive combat with some of the dangers, while some he definitely should avoid', 'Adventurer also carries some potions that will help him on his journey.']))) warrior_f0 = surface_manager.add_icon('warrior_f0', ':pc_warrior_f0.png', '@', ['white', 'bold']) warrior_f1 = surface_manager.add_icon('warrior_f1', ':pc_warrior_f1.png', '@', ['white', 'bold']) config.append(creature_config(name = 'Warrior', body = 8, finesse = 7, mind = 6, hp = 16, speed = 2.5, icons = (warrior_f0, warrior_f1), attack = 2, ai = None, effect_handles = None, inventory = [inventory_config( item_name = 'sword', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'warhammer', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'scale mail', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'dagger', min_amount = 1, max_amount = 1, probability = 100)], description = '\n'.join(['A stout warrior', '', 'Warrior is armed to teeth and tends to solve his problems with brute force.', 'Warrior has nice selection of weapons to use but very little of anything else.']))) surface_manager.add_icon('engineer_f0', ':/characters/pc_engineer_f0.png', '@', ['white', 'bold']) surface_manager.add_icon('engineer_f1', ':/characters/pc_engineer_f1.png', '@', ['white', 'bold']) config.append(creature_config(name = 'Master Engineer', body = 3, finesse = 5, mind = 11, hp = 8, speed = 2.5, icons = ('engineer_f0', 'engineer_f1'), attack = 1, ai = None, effect_handles = None, inventory = [inventory_config( item_name = 'dagger', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'robes', min_amount = 1, max_amount = 1, probability = 100), inventory_config( item_name = 'healing potion', min_amount = 1, max_amount = 2, probability = 50), inventory_config( item_name = 'bag of brutal caltrops', min_amount = 1, max_amount = 2, probability = 100), inventory_config( item_name = 'greater bag of caltrops', min_amount = 1, max_amount = 2, probability = 100)], description = '\n'.join(['A master engineer.', '', 'Master engineer is physically weak and should avoid direct combat with enemies. Their skill lies in various tools and gadgets that can be used to defeat the foes.', 'Master engineer also carries some potions that are useful while exploring dungeons.']))) date = datetime.date.today() events = get_special_events(date.year, date.month, date.day) if False and SpecialTime.aprilfools in events: platino_f0 = surface_manager.add_icon('platino_f0', ':platino_f0.png', '@', ['white', 'bold']) platino_f1 = surface_manager.add_icon('platino_f1', ':platino_f1.png', '@', ['white', 'bold']) config.append(creature_config(name = 'Dragon de Platino', body = 6, finesse = 7, mind = 8, hp = 9, speed = 2.5, icons = (platino_f0, platino_f1), attack = 1, ai = None, effect_handles = None, inventory = [], description = '\n'.join(['Dragon de Platino', '', 'Mysterious dragon who comes and goes as he wishes...']))) if False and SpecialTime.christmas in events: for character in config: character.inventory.append(inventory_config(item_name = 'idol of snowman', min_amount = 1, max_amount = 1, probability = 100)) return config
def setup(self): """ Setup test case """ self.creature_config = {} self.model = mock() self.rng = Random() self.creature_config['rat'] = creature_config(name='rat', body=4, finesse=12, mind=2, hp=2, speed=2, icons=[100, 101], attack=2, ai=MockAI) self.creature_config['spider'] = creature_config( name='spider', body=6, finesse=12, mind=8, hp=6, speed=1, icons=[102], attack=4, ai=MockAI, effect_handles=[ EffectHandle(trigger='on attack hit', effect='minor poison', parameters=None, charges=100) ]) self.creature_config['skeleton warrior'] = creature_config( name='skeleton warrior', body=8, finesse=11, mind=0, hp=8, speed=2.5, icons=[110], attack=2, ai=MockAI, effects=[ DamageModifier(modifier=2, damage_type='crushing', duration=None, frequency=None, tick=None, icon=101, title='title', description='description') ]) self.creatures = partial(generate_creature, configuration=self.creature_config, model=self.model, rng=self.rng, item_generator=mock())
def init_players(context): """ Initialise creatures :returns: list of creature configurations :rtype: [CreatureConfiguration] """ config = [] surface_manager = context.surface_manager adventurer_f0 = surface_manager.add_icon('adventurer_f0', ':pc_adventurer_f0.png', '@', ['white', 'bold']) adventurer_f1 = surface_manager.add_icon('adventurer_f1', ':pc_adventurer_f1.png', '@', ['white', 'bold']) config.append( creature_config( name='Adventurer', body=6, finesse=7, mind=8, hp=12, speed=2.5, icons=(adventurer_f0, adventurer_f1), attack=1, ai=None, effect_handles=None, inventory=[ inventory_config(item_name='spade', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='sword', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='leather armour', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='bow', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='arrow', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='war arrow', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='blunt arrow', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='healing potion', min_amount=1, max_amount=2, probability=50), inventory_config(item_name='bag of small caltrops', min_amount=1, max_amount=1, probability=20) ], description='\n'.join([ 'A skillful adventurer.', '', 'Adventurer is armed and ready to explore any dungeon he sees. He is strong enough to survive combat with some of the dangers, while some he definitely should avoid', 'Adventurer also carries some potions that will help him on his journey.' ]))) warrior_f0 = surface_manager.add_icon('warrior_f0', ':pc_warrior_f0.png', '@', ['white', 'bold']) warrior_f1 = surface_manager.add_icon('warrior_f1', ':pc_warrior_f1.png', '@', ['white', 'bold']) config.append( creature_config( name='Warrior', body=8, finesse=7, mind=6, hp=16, speed=2.5, icons=(warrior_f0, warrior_f1), attack=2, ai=None, effect_handles=None, inventory=[ inventory_config(item_name='sword', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='warhammer', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='scale mail', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='dagger', min_amount=1, max_amount=1, probability=100) ], description='\n'.join([ 'A stout warrior', '', 'Warrior is armed to teeth and tends to solve his problems with brute force.', 'Warrior has nice selection of weapons to use but very little of anything else.' ]))) surface_manager.add_icon('engineer_f0', ':/characters/pc_engineer_f0.png', '@', ['white', 'bold']) surface_manager.add_icon('engineer_f1', ':/characters/pc_engineer_f1.png', '@', ['white', 'bold']) config.append( creature_config( name='Master Engineer', body=3, finesse=5, mind=11, hp=8, speed=2.5, icons=('engineer_f0', 'engineer_f1'), attack=1, ai=None, effect_handles=None, inventory=[ inventory_config(item_name='dagger', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='robes', min_amount=1, max_amount=1, probability=100), inventory_config(item_name='healing potion', min_amount=1, max_amount=2, probability=50), inventory_config(item_name='bag of brutal caltrops', min_amount=1, max_amount=2, probability=100), inventory_config(item_name='greater bag of caltrops', min_amount=1, max_amount=2, probability=100) ], description='\n'.join([ 'A master engineer.', '', 'Master engineer is physically weak and should avoid direct combat with enemies. Their skill lies in various tools and gadgets that can be used to defeat the foes.', 'Master engineer also carries some potions that are useful while exploring dungeons.' ]))) date = datetime.date.today() events = get_special_events(date.year, date.month, date.day) if False and SpecialTime.aprilfools in events: platino_f0 = surface_manager.add_icon('platino_f0', ':platino_f0.png', '@', ['white', 'bold']) platino_f1 = surface_manager.add_icon('platino_f1', ':platino_f1.png', '@', ['white', 'bold']) config.append( creature_config( name='Dragon de Platino', body=6, finesse=7, mind=8, hp=9, speed=2.5, icons=(platino_f0, platino_f1), attack=1, ai=None, effect_handles=None, inventory=[], description='\n'.join([ 'Dragon de Platino', '', 'Mysterious dragon who comes and goes as he wishes...' ]))) if False and SpecialTime.christmas in events: for character in config: character.inventory.append( inventory_config(item_name='idol of snowman', min_amount=1, max_amount=1, probability=100)) return config
def init_creatures(context): """ Initialise creatures'' :returns: list of configuration items :rtype: [CreatureConfiguration] """ surface_manager = context.surface_manager config = [] fungus_f0 = surface_manager.add_icon('fungus_f0', ':fungus_f0.png', 'F', ['yellow', 'dim']) fungus_f1 = surface_manager.add_icon('fungus_f1', ':fungus_f1.png', 'F', ['yellow', 'dim']) config.append( creature_config(name='fungus', body=4, finesse=2, mind=1, hp=7, speed=8, icons=(fungus_f0, fungus_f1), attack=3, ai=FungusAI)) great_fungus_f0 = surface_manager.add_icon('great_fungus_f0', ':great_fungus_f0.png', 'F', ['white', 'bold']) great_fungus_f1 = surface_manager.add_icon('great_fungus_f1', ':great_fungus_f1.png', 'F', ['white', 'bold']) config.append( creature_config(name='great fungus', body=6, finesse=1, mind=3, hp=12, speed=8, icons=(great_fungus_f0, great_fungus_f1), attack=5, ai=GreatFungusAI)) spider_f0 = surface_manager.add_icon('spider_f0', ':masked-spider_f0.png', 's', ['white', 'dim']) spider_f1 = surface_manager.add_icon('spider_f1', ':masked-spider_f1.png', 's', ['white', 'dim']) config.append( creature_config(name='spider', body=6, finesse=12, mind=8, hp=6, speed=1, icons=(spider_f0, spider_f1), attack=4, ai=RatAI, effect_handles=[ EffectHandle(trigger='on attack hit', effect='minor poison', parameters=None, charges=100) ])) mouse_f0 = surface_manager.add_icon('rat_f0', ':mouse_f0.png', 'r', ['yellow', 'dim']) mouse_f1 = surface_manager.add_icon('rat_f1', ':mouse_f1.png', 'r', ['yellow', 'dim']) config.append( creature_config(name='rat', body=4, finesse=12, mind=2, hp=2, speed=2, icons=(mouse_f0, mouse_f1), attack=1, ai=RatAI)) firebeetle_f0 = surface_manager.add_icon('fire beetle_f0', ':scarab-beetle_f0.png', 'a', ['red']) firebeetle_f1 = surface_manager.add_icon('fire beetle_f1', ':scarab-beetle_f1.png', 'a', ['red']) config.append( creature_config(name='fire beetle', body=10, finesse=11, mind=2, hp=4, speed=3, icons=(firebeetle_f0, firebeetle_f1), attack=2, ai=FireBeetleAI)) skeleton_inventory = [ inventory_config(item_name='sword', min_amount=0, max_amount=1, probability=100) ] skeleton_effects = [ DamageModifier(modifier=2, damage_type=CRUSHING_DAMAGE, duration=None, frequency=None, tick=None, icon=0, title='', description=''), DamageModifier(modifier=2, damage_type=LIGHT_DAMAGE, duration=None, frequency=None, tick=None, icon=0, title='', description=''), DamageModifier(modifier=-2, damage_type=PIERCING_DAMAGE, duration=None, frequency=None, tick=None, icon=0, title='', description=''), DamageModifier(modifier=-2, damage_type=POISON_DAMAGE, duration=None, frequency=None, tick=None, icon=0, title='', description='') ] skeleton_f0 = surface_manager.add_icon('skeleton warrior_f0', ':blade-bite_f0.png', 'Z', ['white', 'bold']) skeleton_f1 = surface_manager.add_icon('skeleton warrior_f1', ':blade-bite_f1.png', 'Z', ['white', 'bold']) config.append( creature_config(name='skeleton warrior', body=8, finesse=11, mind=0, hp=8, speed=4, icons=(skeleton_f0, skeleton_f1), attack=1, ai=SkeletonWarriorAI, inventory=skeleton_inventory, effects=skeleton_effects)) bat_effects = [ MovementModeModifier(mode='fly', duration=None, frequency=None, tick=None, icon=0, title='', description='') ] bat_f0 = surface_manager.add_icon('bat_f0', ':characters/bat_f0.png', 'B', ['yellow', 'dim']) bat_f1 = surface_manager.add_icon('bat_f1', ':characters/bat_f1.png', 'B', ['yellow', 'dim']) config.append( creature_config(name='bat', body=1, finesse=1, mind=1, hp=1, speed=1, icons=(bat_f0, bat_f1), attack=1, ai=FireBeetleAI, effects=bat_effects)) return config