当前位置: 首页>>代码示例>>Python>>正文


Python logic.create_companion函数代码示例

本文整理汇总了Python中the_tale.game.companions.logic.create_companion函数的典型用法代码示例。如果您正苦于以下问题:Python create_companion函数的具体用法?Python create_companion怎么用?Python create_companion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create_companion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_politics_power_multiplier__all_effects

    def test_politics_power_multiplier__all_effects(self):
        with self.check_increased(self.hero.politics_power_multiplier):
            self.hero.might = 1000

        with self.check_increased(self.hero.politics_power_multiplier):
            self.hero.level = 100

        with self.check_increased(self.hero.politics_power_multiplier):
            self.hero.actual_bills.append(time.time())
            self.hero.actual_bills.append(time.time())

        with self.check_increased(self.hero.politics_power_multiplier):
            self.hero.preferences.set_risk_level(relations.RISK_LEVEL.VERY_HIGH)

        with self.check_increased(self.hero.politics_power_multiplier):
            self.hero.equipment.get(relations.EQUIPMENT_SLOT.PLATE).record.special_effect = artifacts_relations.ARTIFACT_EFFECT.GREAT_POWER

        with self.check_increased(self.hero.politics_power_multiplier):
            companion_record = companions_logic.create_random_companion_record(name='test-companion',
                                                                               state=companions_relations.STATE.ENABLED,
                                                                               abilities=companions_abilities_container.Container(start=(companions_effects.ABILITIES.KNOWN,)))
            companion = companions_logic.create_companion(companion_record)
            self.hero.set_companion(companion)

        with self.check_increased(self.hero.politics_power_multiplier):
            self.hero.abilities.add(nonbattle_abilities.DIPLOMATIC.get_id(), level=len(nonbattle_abilities.DIPLOMATIC.POWER_MULTIPLIER))
开发者ID:Jazzis18,项目名称:the-tale,代码行数:26,代码来源:test_logic_accessors.py

示例2: setUp

    def setUp(self):
        super(InPlaceActionCompanionLeaveTests, self).setUp()
        self.place_1, self.place_2, self.place_3 = create_test_map()

        self.account = self.accounts_factory.create_account()

        self.storage = LogicStorage()
        self.storage.load_account_data(self.account)
        self.hero = self.storage.accounts_to_heroes[self.account.id]

        self.action_idl = self.hero.actions.current_action

        self.companion_record = companions_logic.create_random_companion_record('thief', state=companions_relations.STATE.ENABLED)
        self.hero.set_companion(companions_logic.create_companion(self.companion_record))

        self.hero.money = f.expected_gold_in_day(self.hero.level)

        self.hero.position.set_place(self.place_1)
        self.hero.position.update_previous_place()
        self.hero.position.set_place(self.place_2)

        self.artifact = artifacts_storage.generate_artifact_from_list(artifacts_storage.loot, 1, rarity=RARITY.NORMAL)
        self.hero.put_loot(self.artifact)

        self.assertEqual(self.hero.bag.occupation, 1)

        self.hero.position.move_out_place()
开发者ID:Jazzis18,项目名称:the-tale,代码行数:27,代码来源:test_action_inplace.py

示例3: set_heroes_companion

def set_heroes_companion(hero_1, hero_2):
    from the_tale.game.companions import storage
    from the_tale.game.companions import models
    from the_tale.game.companions import logic

    COMPANION_NAME = u'test_hero_battle_companion'

    for companion in storage.companions.all():
        if companion.name.startswith(COMPANION_NAME):
            models.CompanionRecord.objects.filter(id=companion.id).delete()
            storage.companions.refresh()
            break

    companion_record = logic.create_random_companion_record(COMPANION_NAME)

    hero_1.set_companion(logic.create_companion(companion_record))
    hero_2.set_companion(logic.create_companion(companion_record))
开发者ID:Jazzis18,项目名称:the-tale,代码行数:17,代码来源:heroes_compare_abilities.py

示例4: use

    def use(self, task, storage, **kwargs): # pylint: disable=R0911,W0613
        card = task.hero.cards.get_card(task.data['card_uid'])

        companion = companions_logic.create_companion(companions_storage.companions[card.data['companion_id']])

        task.hero.set_companion(companion)

        return task.logic_result(message=u'Поздравляем! Ваш герой получил нового спутника.')
开发者ID:Alkalit,项目名称:the-tale,代码行数:8,代码来源:effects.py

示例5: test_use__has_companion

    def test_use__has_companion(self):
        old_companion_record = random.choice(companions_storage.companions.all())
        self.hero.set_companion(companions_logic.create_companion(old_companion_record))

        result, step, postsave_actions = self.effect.use(**self.use_attributes(storage=self.storage, hero=self.hero, card_uid=self.card.uid))

        self.assertEqual((result, step, postsave_actions), (ComplexChangeTask.RESULT.SUCCESSED, ComplexChangeTask.STEP.SUCCESS, ()))

        self.assertEqual(self.hero.companion, None)
开发者ID:Alkalit,项目名称:the-tale,代码行数:9,代码来源:test_release_companion.py

示例6: test_companion_damage__bonus_damage__damage_from_heal

    def test_companion_damage__bonus_damage__damage_from_heal(self):
        companion_record = companions_storage.companions.enabled_companions().next()
        companion = companions_logic.create_companion(companion_record)
        self.hero.set_companion(companion)

        with mock.patch('the_tale.game.balance.constants.COMPANIONS_BONUS_DAMAGE_PROBABILITY', 666666):
            with mock.patch('the_tale.game.heroes.objects.Hero.companion_damage_probability', 0):
                with mock.patch('the_tale.game.heroes.objects.Hero.attribute_modifier', lambda s, t: 666 if t.is_COMPANION_DAMAGE else t.default()):
                    for i in xrange(1000):
                        self.assertEqual(self.hero.companion_damage, c.COMPANIONS_DAMAGE_PER_WOUND)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:10,代码来源:test_logic_accessors.py

示例7: test_heal_companion__on_heal_called

    def test_heal_companion__on_heal_called(self):
        companion_record = companions_storage.companions.enabled_companions().next()
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        self.hero.companion.health = 1

        with mock.patch('the_tale.game.actions.prototypes.ActionBase.on_heal_companion') as on_heal_companion:
            self.assertEqual(self.ability.use(**self.use_attributes), (ComplexChangeTask.RESULT.SUCCESSED, ComplexChangeTask.STEP.SUCCESS, ()))

        self.assertEqual(on_heal_companion.call_count, 1)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:10,代码来源:test_ability_help.py

示例8: test_sociability

    def test_sociability(self):
        self.assertEqual(companions.SOCIABILITY().modify_attribute(MODIFIERS.COMPANION_LIVING_COHERENCE_SPEED, 1), 1.2)
        self.assertEqual(companions.SOCIABILITY().modify_attribute(MODIFIERS.random(exclude=(MODIFIERS.COMPANION_LIVING_COHERENCE_SPEED,)), 1), 1)

        companion_record = companions_storage.companions.enabled_companions().next()
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        with mock.patch('the_tale.game.companions.objects.CompanionRecord.type', game_relations.BEING_TYPE.ANIMAL):
            self.assertEqual(self.hero.companion_coherence_speed, 1)
            self.hero.abilities.add(companions.SOCIABILITY.get_id(), 3)
            self.assertEqual(self.hero.companion_coherence_speed, 1.6)
开发者ID:alexudracul,项目名称:the-tale,代码行数:11,代码来源:test_habilities_companions.py

示例9: test_healing

    def test_healing(self):
        self.assertEqual(companions.HEALING().modify_attribute(MODIFIERS.COMPANION_LIVING_HEAL, 0), 0.0462962962962963)
        self.assertEqual(companions.HEALING().modify_attribute(MODIFIERS.random(exclude=(MODIFIERS.COMPANION_LIVING_HEAL,)), 0), 0)

        companion_record = companions_storage.companions.enabled_companions().next()
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        with mock.patch('the_tale.game.companions.objects.CompanionRecord.type', game_relations.BEING_TYPE.ANIMAL):
            self.assertEqual(self.hero.companion_heal_probability, 0)
            self.hero.abilities.add(companions.HEALING.get_id(), 3)
            self.assertEqual(self.hero.companion_heal_probability, 0.1388888888888889)
开发者ID:alexudracul,项目名称:the-tale,代码行数:11,代码来源:test_habilities_companions.py

示例10: test_heal_companion__crit

    def test_heal_companion__crit(self):
        companion_record = companions_storage.companions.enabled_companions().next()
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        self.hero.companion.health = 1

        with self.check_delta(lambda: self.hero.companion.health, c.COMPANIONS_HEAL_CRIT_AMOUNT):
            with self.check_delta(lambda: self.hero.statistics.help_count, 1):
                self.assertEqual(self.ability.use(**self.use_attributes), (ComplexChangeTask.RESULT.SUCCESSED, ComplexChangeTask.STEP.SUCCESS, ()))

        self.assertFalse(self.hero.journal.messages[-1].key.is_ANGEL_ABILITY_HEAL_COMPANION)
        self.assertTrue(self.hero.journal.messages[-1].key.is_ANGEL_ABILITY_HEAL_COMPANION_CRIT)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:12,代码来源:test_ability_help.py

示例11: test_heal_companion__full_health

    def test_heal_companion__full_health(self):
        companion_record = companions_storage.companions.enabled_companions().next()
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        self.assertEqual(self.hero.companion.health, self.hero.companion.max_health)

        with self.check_not_changed(lambda: self.hero.companion.health):
            with self.check_not_changed(lambda: self.hero.statistics.help_count):
                self.assertEqual(self.ability.use(**self.use_attributes), (ComplexChangeTask.RESULT.FAILED, ComplexChangeTask.STEP.ERROR, ()))

        self.assertFalse(self.hero.journal.messages[-1].key.is_ANGEL_ABILITY_HEAL_COMPANION)
        self.assertFalse(self.hero.journal.messages[-1].key.is_ANGEL_ABILITY_HEAL_COMPANION_CRIT)
开发者ID:Jazzis18,项目名称:the-tale,代码行数:12,代码来源:test_ability_help.py

示例12: test_companion_heal_in_resort__healed_companion

    def test_companion_heal_in_resort__healed_companion(self):
        companion_record = companions_storage.companions.enabled_companions().next()
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        self.assertEqual(self.hero.companion.health, self.hero.companion.max_health)

        self.hero.position.place.set_modifier(places_modifiers.CITY_MODIFIERS.RESORT)

        prototypes.ActionInPlacePrototype.create(hero=self.hero)

        self.assertFalse(self.hero.journal.messages[-1].key.is_ACTION_INPLACE_COMPANION_HEAL)

        self.storage._test_save()
开发者ID:Jazzis18,项目名称:the-tale,代码行数:13,代码来源:test_action_inplace.py

示例13: prepair_bot

    def prepair_bot(cls, hero, enemy):
        if not hero.is_bot:
            return

        hero.preferences.set_archetype(random.choice(game_relations.ARCHETYPE.records))

        hero.reset_level()
        for i in xrange(enemy.level-1):
            hero.randomized_level_up(increment_level=True)
        hero.randomize_equip()

        if not companions_storage.companions.is_empty():
            companion_record = random.choice(companions_storage.companions.all())
            hero.set_companion(companions_logic.create_companion(companion_record))
开发者ID:Alkalit,项目名称:the-tale,代码行数:14,代码来源:meta_actions.py

示例14: setUp

    def setUp(self):
        super(HealCompanionTestMixin, self).setUp()
        create_test_map()

        self.account_1 = self.accounts_factory.create_account()

        self.storage = LogicStorage()
        self.storage.load_account_data(self.account_1)

        self.hero = self.storage.accounts_to_heroes[self.account_1.id]

        self.hero.set_companion(companions_logic.create_companion(random.choice(companions_storage.companions.all())))

        self.card = self.CARD()
开发者ID:Alkalit,项目名称:the-tale,代码行数:14,代码来源:test_heal_companion.py

示例15: test_heal_companion__on_heal_action_habits_not_changed

    def test_heal_companion__on_heal_action_habits_not_changed(self):
        habit_effect = random.choice([ability for ability in companions_effects.ABILITIES.records if not isinstance(ability.effect, companions_effects.ChangeHabits)])

        companion_record = companions_storage.companions.enabled_companions().next()
        companion_record.abilities = companions_container.Container(start=[habit_effect])
        self.hero.set_companion(companions_logic.create_companion(companion_record))

        self.hero.habit_honor.change(100)
        self.hero.habit_peacefulness.change(-100)

        self.hero.companion.health = 1

        with self.check_not_changed(lambda: self.hero.habit_honor.raw_value + self.hero.habit_peacefulness.raw_value):
            self.assertEqual(self.ability.use(**self.use_attributes), (ComplexChangeTask.RESULT.SUCCESSED, ComplexChangeTask.STEP.SUCCESS, ()))
开发者ID:Jazzis18,项目名称:the-tale,代码行数:14,代码来源:test_ability_help.py


注:本文中的the_tale.game.companions.logic.create_companion函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。