• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python logic.create_random_companion_record函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了create_random_companion_record函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: test_exclude__different_data

    def test_exclude__different_data(self):
        cards = []

        companions_models.CompanionRecord.objects.all().delete()
        companions_storage.companions.refresh()

        for rarity, rarity_abilities in companions_helpers.RARITIES_ABILITIES.iteritems():
            companions_logic.create_random_companion_record(
                "%s companion" % rarity,
                mode=companions_relations.MODE.AUTOMATIC,
                abilities=rarity_abilities,
                state=companions_relations.STATE.ENABLED,
            )

        for i in xrange(len(relations.CARD_TYPE.records)):
            card = self.hero.cards.get_new_card(exclude=cards)
            cards.append(card)

        self.assertEqual(self.hero.cards.get_new_card(exclude=cards), None)

        cards[0].data = {"fake-data": True}
        self.assertEqual(cards[0].type, self.hero.cards.get_new_card(exclude=cards).type)

        self.assertEqual(set(card.type for card in cards), set(relations.CARD_TYPE.records))
开发者ID:lshestov,项目名称:the-tale,代码行数:24,代码来源:test_container.py


示例4: set_hero_companion

    def set_hero_companion(self):
        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_level_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)

        self.hero.set_companion(logic.create_companion(companion_record))
开发者ID:Alkalit,项目名称:the-tale,代码行数:16,代码来源:game_test_hero_in_levels_corridor.py


示例5: _test_companion_death_speed

    def _test_companion_death_speed(self):
        current_time = game_prototypes.TimePrototype.get_current_time()

        companion_record = logic.create_random_companion_record('test companion',
                                                                state=relations.STATE.ENABLED,
                                                                dedication=relations.DEDICATION.BRAVE)#,#,;
                                                                # abilities=abilities_container.Container(start=(effects.ABILITIES.BODYGUARD,)),# effects.ABILITIES.PUNY)),
                                                                # dedication=relations.DEDICATION.HEROIC)
                                                                # abilities=abilities_container.Container(common=(effects.ABILITIES.COWARDLY, )),
                                                                # dedication=relations.DEDICATION.INDECISIVE)
        companion = logic.create_companion(companion_record)
        self.hero.set_companion(companion)
        # self.hero.preferences.set_companion_dedication(heroes_relations.COMPANION_DEDICATION.EGOISM)
        self.hero.preferences.set_companion_dedication(heroes_relations.COMPANION_DEDICATION.NORMAL)
        # self.hero.preferences.set_companion_dedication(heroes_relations.COMPANION_DEDICATION.ALTRUISM)
        # self.hero.preferences.set_companion_dedication(heroes_relations.COMPANION_DEDICATION.EVERY_MAN_FOR_HIMSELF)

        old_health = self.hero.companion.health

        print 'defend_probability: ', self.hero.companion.defend_in_battle_probability

        # for i in xrange(50):
        #     self.hero.randomized_level_up(increment_level=True)

        while self.hero.companion:
            self.hero.companion.coherence = 50

            self.storage.process_turn()
            current_time.increment_turn()

            self.hero.randomized_level_up()

            if not self.hero.is_alive:
                if hasattr(self.hero.actions.current_action, 'fast_resurrect'):
                    self.hero.actions.current_action.fast_resurrect()
                print '!'

            if self.hero.companion:
                if old_health != self.hero.companion.health:
                    print '%.2f:\t%s -> %s [%s] c%s' % ( (current_time.turn_number / c.TURNS_IN_HOUR / 24.0),
                                                          self.hero.companion.health - self.hero.companion.max_health,
                                                          self.hero.companion.health,
                                                          self.hero.companion.health - old_health,
                                                          self.hero.companion.coherence)

                old_health = self.hero.companion.health
开发者ID:Alkalit,项目名称:the-tale,代码行数:46,代码来源:test_common.py


示例6: setUp

    def setUp(self):
        super(InPlaceActionCompanionStealingTest, self).setUp()
        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.action_inplace = prototypes.ActionInPlacePrototype.create(hero=self.hero)

        self.action_inplace.state = self.action_inplace.STATE.PROCESSED

        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))
开发者ID:Alkalit,项目名称:the-tale,代码行数:18,代码来源:test_action_inplace.py


示例7: test_healed_companion

    def test_healed_companion(self):
        self.companion_record = companions_logic.create_random_companion_record('companion', state=companions_relations.STATE.ENABLED)
        self.hero.set_companion(companions_logic.create_companion(self.companion_record))

        self.hero.companion.health = self.hero.companion.max_health

        while not self.hero.next_spending.is_HEAL_COMPANION:
            self.hero.switch_spending()

        money = self.hero.spend_amount

        self.hero.money = money + 666

        with self.check_not_changed(lambda: self.hero.statistics.money_spend):
            with self.check_not_changed(lambda: self.hero.statistics.money_spend_for_companions):
                with self.check_not_changed(lambda: self.hero.money):
                    self.storage.process_turn()

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


示例8: test_heal_companion

    def test_heal_companion(self):
        self.companion_record = companions_logic.create_random_companion_record('companion', state=companions_relations.STATE.ENABLED)
        self.hero.set_companion(companions_logic.create_companion(self.companion_record))

        self.hero.companion.health = 1

        while not self.hero.next_spending.is_HEAL_COMPANION:
            self.hero.switch_spending()

        money = self.hero.spend_amount

        self.hero.money = money + 666

        with self.check_increased(lambda: self.hero.companion.health):
            with self.check_delta(lambda: self.hero.money, -money):
                self.storage.process_turn()

        self.assertEqual(self.hero.statistics.money_spend, money)
        self.assertEqual(self.hero.statistics.money_spend_for_companions, money)

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


示例9: test_choose_ability__additional_companion_abilities

    def test_choose_ability__additional_companion_abilities(self):
        from the_tale.game.heroes.habilities import ABILITIES
        from the_tale.game.companions.abilities import effects as companions_effects
        from the_tale.game.companions.abilities import container as abilities_container
        from the_tale.game.companions import logic as companions_logic
        from the_tale.game.companions import relations as companions_relations

        abilities = [ability for ability in companions_effects.ABILITIES.records
                     if ( isinstance(ability.effect, companions_effects.BaseBattleAbility) and
                          ability.effect.ABILITY.get_id() != 'hit' )]
        companion_ability = random.choice(abilities)

        all_abilities = [ability(level=ability.MAX_LEVEL)
                         for ability in ABILITIES.values()
                         if ability.get_id() != companion_ability.effect.ABILITY.get_id()]

        active_abilities = set(ability.get_id() for ability in ABILITIES.values() if ability.ACTIVATION_TYPE.is_ACTIVE)

        companion_record = companions_logic.create_random_companion_record(u'battle',
                                                                           abilities=abilities_container.Container(start=(companion_ability,)),
                                                                           state=companions_relations.STATE.ENABLED)
        self.hero.set_companion(companions_logic.create_companion(companion_record))
        self.hero.health = 1 # allow regeneration

        actor = battle.Actor(self.hero, BattleContext())

        chosen_abilities = set()

        # mock abilities modify_attribute instead of hereos, since we test correct work of it
        def modify_attribute(self, modifier, value):
            if modifier.is_ADDITIONAL_ABILITIES:
                return all_abilities
            return value

        with mock.patch('the_tale.game.heroes.habilities.AbilitiesPrototype.modify_attribute', modify_attribute):
            for i in xrange(1000):
                chosen_abilities.add(actor.choose_ability().get_id())

        self.assertEqual(len(active_abilities), len(chosen_abilities) + 1)
        self.assertEqual(active_abilities - set([companion_ability.effect.ABILITY.get_id()]), chosen_abilities)
开发者ID:ruckysolis,项目名称:the-tale,代码行数:40,代码来源:test_battle.py


示例10: test_heal_companion__swich_spending_on_full_health

    def test_heal_companion__swich_spending_on_full_health(self):
        self.companion_record = companions_logic.create_random_companion_record('companion', state=companions_relations.STATE.ENABLED)
        self.hero.set_companion(companions_logic.create_companion(self.companion_record))

        while not self.hero.next_spending.is_HEAL_COMPANION:
            self.hero.switch_spending()

        self.hero.companion.health = self.hero.companion.max_health

        money = self.hero.spend_amount

        self.hero.money = money + 666

        with self.check_not_changed(lambda: self.hero.companion.health):
            with self.check_not_changed(lambda: self.hero.money):
                with mock.patch('the_tale.game.heroes.objects.Hero.switch_spending') as switch_spending:
                    self.storage.process_turn()

        self.assertEqual(switch_spending.call_count, 1)

        self.assertEqual(self.hero.statistics.money_spend, 0)
        self.assertEqual(self.hero.statistics.money_spend_for_companions, 0)

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


示例11: create_test_map

def create_test_map():
    linguistics_logic.sync_static_restrictions()

    map_logic.create_test_my_info()

    p1 = PlacePrototype.create( x=1, y=1, size=1, utg_name=names.generator.get_test_name(name='1x1'))
    p2 = PlacePrototype.create( x=3, y=3, size=3, utg_name=names.generator.get_test_name(name='10x10'))
    p3 = PlacePrototype.create( x=1, y=3, size=3, utg_name=names.generator.get_test_name(name='1x10'))

    for place in places_storage.all():
        place.sync_persons(force_add=True)

    RoadPrototype.create(point_1=p1, point_2=p2).update()
    RoadPrototype.create(point_1=p2, point_2=p3).update()

    update_waymarks()

    update_nearest_cells()

    mob_1 = MobRecordPrototype.create_random('mob_1')
    mob_2 = MobRecordPrototype.create_random('mob_2')
    mob_3 = MobRecordPrototype.create_random('mob_3')

    ArtifactRecordPrototype.create_random('loot_1', mob=mob_1)
    ArtifactRecordPrototype.create_random('loot_2', mob=mob_2)
    ArtifactRecordPrototype.create_random('loot_3', mob=mob_3)

    ArtifactRecordPrototype.create_random('helmet_1', type_=ARTIFACT_TYPE.HELMET, mob=mob_1)
    ArtifactRecordPrototype.create_random('plate_1', type_=ARTIFACT_TYPE.PLATE, mob=mob_2)
    ArtifactRecordPrototype.create_random('boots_1', type_=ARTIFACT_TYPE.BOOTS, mob=mob_3)

    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.PANTS, type_=ARTIFACT_TYPE.PANTS)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.BOOTS, type_=ARTIFACT_TYPE.BOOTS)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.PLATE, type_=ARTIFACT_TYPE.PLATE)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.GLOVES, type_=ARTIFACT_TYPE.GLOVES)
    ArtifactRecordPrototype.create_random(DEFAULT_HERO_EQUIPMENT.WEAPON, type_=ARTIFACT_TYPE.MAIN_HAND)

    companions_logic.create_random_companion_record('companion_1', dedication=companions_relations.DEDICATION.HEROIC, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_2', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.ENABLED)
    companions_logic.create_random_companion_record('companion_3', dedication=companions_relations.DEDICATION.BOLD, state=companions_relations.STATE.DISABLED)

    return p1, p2, p3
开发者ID:alexudracul,项目名称:the-tale,代码行数:42,代码来源:logic.py


示例12: test_rarities_abilities

 def test_rarities_abilities(self):
     for rarity, rarity_abilities in helpers.RARITIES_ABILITIES.iteritems():
         companion = logic.create_random_companion_record('%s companion' % rarity,
                                                          abilities=rarity_abilities)
         self.assertEqual(companion.rarity, rarity)
开发者ID:Alkalit,项目名称:the-tale,代码行数:5,代码来源:test_common.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logic.load_hero函数代码示例发布时间:2022-05-27
下一篇:
Python logic.create_companion函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap