Ejemplo n.º 1
0
    def setUp(self):
        super(MobsStorageTests, self).setUp()
        create_test_map()

        self.mob_1, self.mob_2, self.mob_3 = mobs_storage.all()

        self.mob_1.type = MOB_TYPE.CIVILIZED
        self.mob_1.save()

        self.mob_2.type = MOB_TYPE.BARBARIAN
        self.mob_2.save()

        self.mob_3.type = MOB_TYPE.CIVILIZED
        self.mob_3.save()

        self.bandit = MobRecordPrototype.create(uuid='bandit',
                                                level=1,
                                                utg_name=names.generator.get_test_name(name='bandint'),
                                                description='description',
                                                abilities=['hit'],
                                                terrains=[TERRAIN.PLANE_SAND],
                                                type=MOB_TYPE.CIVILIZED,
                                                state=MOB_RECORD_STATE.ENABLED)
        self.bandint_wrong = MobRecordPrototype.create(uuid='bandit_wrong',
                                                       level=1,
                                                       utg_name=names.generator.get_test_name(name='bandit_wrong'),
                                                       description='bandit_wrong description',
                                                       abilities=['hit'],
                                                       terrains=[TERRAIN.PLANE_SAND],
                                                       type=MOB_TYPE.CIVILIZED,
                                                       state=MOB_RECORD_STATE.DISABLED)
Ejemplo n.º 2
0
    def setUp(self):
        super(MobsStorageTests, self).setUp()
        create_test_map()

        self.mob_1, self.mob_2, self.mob_3 = mobs_storage.all()

        self.mob_1.type = MOB_TYPE.CIVILIZED
        self.mob_1.save()

        self.mob_2.type = MOB_TYPE.BARBARIAN
        self.mob_2.save()

        self.mob_3.type = MOB_TYPE.CIVILIZED
        self.mob_3.save()

        self.bandit = MobRecordPrototype.create(
            uuid='bandit',
            level=1,
            utg_name=names.generator.get_test_name(name='bandint'),
            description='description',
            abilities=['hit'],
            terrains=[TERRAIN.PLANE_SAND],
            type=MOB_TYPE.CIVILIZED,
            state=MOB_RECORD_STATE.ENABLED)
        self.bandint_wrong = MobRecordPrototype.create(
            uuid='bandit_wrong',
            level=1,
            utg_name=names.generator.get_test_name(name='bandit_wrong'),
            description='bandit_wrong description',
            abilities=['hit'],
            terrains=[TERRAIN.PLANE_SAND],
            type=MOB_TYPE.CIVILIZED,
            state=MOB_RECORD_STATE.DISABLED)
Ejemplo n.º 3
0
    def test_mob_attributes(self):
        MobRecordPrototype.create(uuid='bandit',
                                  level=1,
                                  utg_name=names.generator.get_test_name(name='bandit'),
                                  description='bandint',
                                  abilities=['hit', 'thick', 'slow', 'extra_strong'],
                                  terrains=TERRAIN.records,
                                  type=MOB_TYPE.CIVILIZED,
                                  archetype=game_relations.ARCHETYPE.NEUTRAL,
                                  state=MOB_RECORD_STATE.ENABLED)
        mobs_storage.sync(force=True)

        bandit = MobPrototype(record_id=mobs_storage.get_by_uuid('bandit').id, level=1)

        self.assertEqual(bandit.health_cooficient, 1.025)
        self.assertEqual(bandit.initiative, 0.975)
        self.assertEqual(bandit.damage_modifier, 1.05)
Ejemplo n.º 4
0
    def test_mob_attributes(self):
        MobRecordPrototype.create(uuid='bandit',
                                  level=1,
                                  utg_name=names.generator.get_test_name(name='bandit'),
                                  description='bandint',
                                  abilities=['hit', 'thick', 'slow', 'extra_strong'],
                                  terrains=TERRAIN.records,
                                  type=game_relations.BEING_TYPE.CIVILIZED,
                                  archetype=game_relations.ARCHETYPE.NEUTRAL,
                                  state=MOB_RECORD_STATE.ENABLED)
        mobs_storage.sync(force=True)

        bandit = MobPrototype(record_id=mobs_storage.get_by_uuid('bandit').id, level=1)

        self.assertEqual(bandit.health_cooficient, 1.025)
        self.assertEqual(bandit.initiative, 0.975)
        self.assertEqual(bandit.damage_modifier, 1.05)
    def construct_mob_with_abilities(abilities, index):
        from the_tale.game.mobs.prototypes import MobRecordPrototype
        from the_tale.game.mobs.relations import MOB_RECORD_STATE

        uuid = 'test_mob %d' % index
        mob_record =  MobRecordPrototype.create(uuid,
                                                level=1,
                                                utg_name=names.generator.get_test_name(uuid),
                                                description='',
                                                abilities=abilities,
                                                terrains=[],
                                                type=game_relations.BEING_TYPE.CIVILIZED,
                                                state=MOB_RECORD_STATE.ENABLED)
        return MobPrototype(level=1, record_id=mob_record.id)
Ejemplo n.º 6
0
    def construct_mob_with_abilities(abilities, index):
        from the_tale.game.mobs.prototypes import MobRecordPrototype
        from the_tale.game.mobs.relations import MOB_RECORD_STATE

        uuid = 'test_mob %d' % index
        mob_record = MobRecordPrototype.create(
            uuid,
            level=1,
            utg_name=names.generator.get_test_name(uuid),
            description='',
            abilities=abilities,
            terrains=[],
            type=game_relations.BEING_TYPE.CIVILIZED,
            state=MOB_RECORD_STATE.ENABLED)
        return MobPrototype(level=1, record_id=mob_record.id)
Ejemplo n.º 7
0
    def setUp(self):
        super(MobsStorageTests, self).setUp()
        create_test_map()

        self.mob_1, self.mob_2, self.mob_3 = mobs_storage.all()

        self.mob_1.type = game_relations.BEING_TYPE.CIVILIZED
        self.mob_1.save()

        self.mob_2.type = game_relations.BEING_TYPE.CIVILIZED
        self.mob_2.is_mercenary = False
        self.mob_2.save()

        self.mob_3.type = game_relations.BEING_TYPE.CIVILIZED
        self.mob_3.save()

        self.bandit = MobRecordPrototype.create(
            uuid="bandit",
            level=1,
            utg_name=names.generator.get_test_name(name="bandint"),
            description="description",
            abilities=["hit"],
            terrains=[map_relations.TERRAIN.PLANE_SAND],
            type=game_relations.BEING_TYPE.CIVILIZED,
            state=MOB_RECORD_STATE.ENABLED,
        )
        self.bandint_wrong = MobRecordPrototype.create(
            uuid="bandit_wrong",
            level=1,
            utg_name=names.generator.get_test_name(name="bandit_wrong"),
            description="bandit_wrong description",
            abilities=["hit"],
            terrains=[map_relations.TERRAIN.PLANE_SAND],
            type=game_relations.BEING_TYPE.CIVILIZED,
            state=MOB_RECORD_STATE.DISABLED,
        )