Exemplo n.º 1
0
    def test_serialization__bonuses_saved(self):
        self.quest_info.experience_bonus = 666
        self.quest_info.power_bonus = 777
        self.assertEqual(self.quest_info.serialize(), QuestInfo.deserialize(self.quest_info.serialize()).serialize())

        new_quest_info = QuestInfo.deserialize(self.quest_info.serialize())

        self.assertEqual(new_quest_info.experience_bonus, 666)
        self.assertEqual(new_quest_info.power_bonus, 777)
Exemplo n.º 2
0
    def test_serialization__bonuses_saved(self):
        self.quest_info.experience_bonus = 666
        self.quest_info.power_bonus = 777
        self.assertEqual(self.quest_info.serialize(), QuestInfo.deserialize(self.quest_info.serialize()).serialize())

        new_quest_info = QuestInfo.deserialize(self.quest_info.serialize())

        self.assertEqual(new_quest_info.experience_bonus, 666)
        self.assertEqual(new_quest_info.power_bonus, 777)
Exemplo n.º 3
0
    def setUp(self):
        super(QuestInfoTests, self).setUp()

        self.place_1, self.place_2, self.place_3 = create_test_map()

        account = self.accounts_factory.create_account(is_fast=True)

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

        self.action_idl = self.hero.actions.current_action
        self.action_idl.state = self.action_idl.STATE.QUEST

        self.quest = self.create_quest()

        self.start = next(self.quest.knowledge_base.filter(facts.Start))

        with mock.patch('the_tale.game.quests.writers.get_writer', lambda **kwargs: FakeWriter(fake_uid='q', **kwargs)):
            self.quest_info = QuestInfo.construct(type=self.start.type,
                                                  uid=self.start.uid,
                                                  knowledge_base=self.quest.knowledge_base,
                                                  experience=100,
                                                  power=1000,
                                                  hero=self.hero)
Exemplo n.º 4
0
    def setUp(self):
        super(QuestInfoTests, self).setUp()

        self.place_1, self.place_2, self.place_3 = create_test_map()

        account = self.accounts_factory.create_account(is_fast=True)

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

        self.action_idl = self.hero.actions.current_action
        self.action_idl.state = self.action_idl.STATE.QUEST

        self.quest = self.create_quest()

        self.start = next(self.quest.knowledge_base.filter(facts.Start))

        with mock.patch('the_tale.game.quests.writers.get_writer',
                        lambda **kwargs: FakeWriter(fake_uid='q', **kwargs)):
            self.quest_info = QuestInfo.construct(
                type=self.start.type,
                uid=self.start.uid,
                knowledge_base=self.quest.knowledge_base,
                experience=100,
                power=1000,
                hero=self.hero)
Exemplo n.º 5
0
    def setUp(self):
        super(QuestInfoTests, self).setUp()

        self.place_1, self.place_2, self.place_3 = create_test_map()

        result, account_id, bundle_id = register_user('test_user')

        self.storage = LogicStorage()
        self.storage.load_account_data(AccountPrototype.get_by_id(account_id))
        self.hero = self.storage.accounts_to_heroes[account_id]

        self.action_idl = self.hero.actions.current_action
        self.action_idl.state = self.action_idl.STATE.QUEST

        self.quest = self.create_quest()

        self.start = self.quest.knowledge_base.filter(facts.Start).next()

        with mock.patch('the_tale.game.quests.writers.get_writer',
                        lambda **kwargs: FakeWriter(fake_uid='q', **kwargs)):
            self.quest_info = QuestInfo.construct(
                type=self.start.type,
                uid=self.start.uid,
                knowledge_base=self.quest.knowledge_base,
                hero=self.hero)
Exemplo n.º 6
0
    def setUp(self):
        super(QuestInfoTests, self).setUp()

        self.place_1, self.place_2, self.place_3 = create_test_map()

        result, account_id, bundle_id = register_user('test_user')

        self.storage = LogicStorage()
        self.storage.load_account_data(AccountPrototype.get_by_id(account_id))
        self.hero = self.storage.accounts_to_heroes[account_id]

        self.action_idl = self.hero.actions.current_action
        self.action_idl.state = self.action_idl.STATE.QUEST

        self.quest = self.create_quest()

        self.start = self.quest.knowledge_base.filter(facts.Start).next()

        with mock.patch('the_tale.game.quests.writers.get_writer', lambda **kwargs: FakeWriter(fake_uid='q', **kwargs)):
            self.quest_info = QuestInfo.construct(type=self.start.type,
                                                  uid=self.start.uid,
                                                  knowledge_base=self.quest.knowledge_base,
                                                  hero=self.hero)
Exemplo n.º 7
0
 def test_serialization(self):
     self.assertEqual(self.quest_info.serialize(), QuestInfo.deserialize(self.quest_info.serialize()).serialize())
Exemplo n.º 8
0
 def test_serialization(self):
     self.assertEqual(
         self.quest_info.serialize(),
         QuestInfo.deserialize(self.quest_info.serialize()).serialize())