コード例 #1
0
 def inspiredCall(self):
     jobSelect = randint(0, 4)
     mood = progress = satiety = finances = 0
     name = ''
     if jobSelect == 0:
         # mood
         mood = self.inspired
         info = 'вас пропёрло на хорошое настроение'
     elif jobSelect == 1:
         # progress
         progress = self.inspired
         info = 'вас посетило вдохновение'
     elif jobSelect == 2:
         # satiety
         satiety = self.inspired
         info = 'вы очень хорошо покушали'
     else:
         # finances
         finances = self.inspired
         mood = self.inspired / 2
         info = 'вы нашли N рублей'
     # пока оставляю без изменения второе событие
     return quest.Quest(
         name, 'Вдохновение', {
             'mood': mood,
             'progress': progress,
             'satiety': satiety,
             'finances': finances
         }, '', {
             'mood': mood,
             'progress': progress,
             'satiety': satiety,
             'finances': finances
         }, self.xp, 1 / self.slowness, info)
コード例 #2
0
 def captainCall(self):
     mood = progress = satiety = 0
     name = 'звонок старосты '
     if self.progress <= -25:
         # bad
         info = 'вы плохо учились'
         mood = -self.inspired / 2
         progress = 5
     elif self.progress <= 50:
         # normal
         info = 'ошиблась номером'
         mood = -1
         progress = 1
     else:
         # good
         info = 'пришла стипендия'
         mood = self.inspired / 2
         progress = 5
     # пока оставляю без изменения второе событие
     return quest.Quest(name, 'Ответить на', {
         'mood': mood,
         'progress': progress,
         'satiety': 0,
         'finances': 0
     }, 'Игнорировать', {
         'mood': -mood,
         'progress': -progress,
         'satiety': 0,
         'finances': 0
     }, self.xp, 1, info)
コード例 #3
0
def kill_mini_boss(npc, room_name=None):
    quest_text = f"Elimate the local problem: {npc.name}."

    if room_name:
        quest_text = quest_text + f" You'll find them in {room_name}."

    q1 = quest.Quest("Cut off the head", quest_text, 100, target_npc=npc)

    return q1
コード例 #4
0
def kill_warlord():
    title = "Strike him down"
    description = "Time to take down the king of the hill. Or dungeon as it is in this case."

    q = quest.Quest(title, description, 500)
    q.kill = 1
    q.kill_type = "warlord"
    q.return_to_quest_giver = True

    return q
コード例 #5
0
def kill_vermin():
    key = choice(VERMIN_GENERATORS)
    value = SPECIES_STRINGS[key]
    title = "The Verminator"
    description = f"These caves are riddled with vermin. Clear out the {value}s."

    q = quest.Quest(title, description, 100)
    q.kill = randint(2, 5)
    q.kill_type = key
    q.return_to_quest_giver = True

    return q
コード例 #6
0
def level_one_chain(game_map):
    q1 = kill_vermin()
    q2 = quest.Quest(
        'Interloper',
        'Someone has been sneaking around here. Find them and take care of it.',
        100,
        start_func=level_one_goblin)
    q2.kill = 1
    q2.kill_type = Species.GOBLIN

    q1.next_quest = q2

    q2.next_quest = exit_level_quest(game_map)

    return q1
コード例 #7
0
def kill_humanoid(type=None):
    if not type:
        key = choice(HUMANOIDS)
        value = SPECIES_STRINGS[key]
    else:
        value = SPECIES_STRINGS[type]

    title = f"Tread on the {value}s."
    description = f"There is an awful lot of {value} in here. Get rid of them. I don't care how."

    q = quest.Quest(title, description, 100)
    q.kill = randint(2, 5)
    q.kill_type = type
    q.return_to_quest_giver = True

    return q
コード例 #8
0
class Student:
    """ 
        границы изменения параметров [-100, 100]
        критические границы [-100, -80] U [80, 100]
    """
    # параметр: настроение (0 -- нейтральное)
    mood = 0
    # параметр: успеваемость (0 -- обычная)
    progress = 0
    # параметр: сытость (0 - ...)
    satiety = 0
    # параметр: финансы (0 - ...)
    finances = 0
    # текущее задание
    quest = quest.Quest()
    # вариант решения задания
    choice = 0
    log = None
    duration = 0
    # константы
    xp = 50
    inspired = 20
    slowness = 3
    """
        назначение: инициализации класса
        входные параметры:
            mood        -- настроение
            progress    -- успеваемость
            satiety     -- сытость
            finances    -- финансы
            quest       -- текущее задание
            choice      -- вариант решения задания
        выходные параметры:
            None
    """
    def __init__(self,
                 log,
                 mood=0,
                 progress=0,
                 satiety=0,
                 finances=0,
                 quest=quest,
                 choice=0):
        self.log = log
        self.mood = mood
        self.progress = progress
        self.satiety = satiety
        self.finances = finances
        # дальнейшие настройки
        self.quest = quest
        self.choice = choice

    """
        назначение: вывод информации о текущем состоянии студента
        входные параметры:
            None
        выходные параметры:
            None
    """

    def __str__(self):
        fmt_str = 'student: mood = {}, progress = {}, satiety = {}, finances = {} [{}]'
        return fmt_str.format(self.mood, self.progress, self.satiety,
                              self.finances, self.quest.duration)

    """
        назначение: изменение параметров студента
        входные параметры:
            vector      -- словарь изменений параметров
        выходные параметры:
            None
    """

    def change(self, vector):
        for i in vector:
            if i == 'mood':
                self.mood += vector[i]
                if self.mood > 100:
                    self.mood = 100
                elif self.mood < -100:
                    self.mood = -100
            elif i == 'progress':
                self.progress += vector[i]
                if self.progress > 100:
                    self.progress = 100
                elif self.progress < -100:
                    self.progress = -100
            elif i == 'satiety':
                self.satiety += vector[i]
                if self.satiety > 100:
                    self.satiety = 100
                elif self.satiety < -100:
                    self.satiety = -100
            else:
                self.finances += vector[i]
                if self.finances > 100:
                    self.finances = 100
                elif self.finances < -100:
                    self.finances = -100

    """
        назначение: изменение параметров во времени
        входные параметры:
            step        -- шаг
        выходные параметры:
            None
    """

    def step(self, step=10):
        # код отвечающий за изменение параметров
        # в соответствии с интервалом времени

        # с вероятностью 25% студенту станет скучнее
        if randint(0, 3) == 1:
            self.mood -= 1
        elif not randint(0, 2):
            # если не стало, то с вероятностью 33% ему станет веселее
            self.mood += 1
        # с вероятностью 33% студенту станет голоднее
        if randint(0, 2) == 1:
            self.satiety -= 1
        # продолжение квеста или же выбор нового
        self.duration += 1
        if self.quest.duration < self.duration:
            if self.choice:
                self.change(self.quest.one_impact)
            else:
                self.change(self.quest.two_impact)
            del self.quest
            # генерация задания
            st = [self.mood, self.progress, self.satiety, self.finances]
            chance = random()
            # подобрать вероятность для случайных событий
            if chance <= 0.05:
                self.quest = self.inspiredCall()
            elif chance <= 0.2 * atan(-self.progress / 25) / pi + 0.2:
                self.quest = self.captainCall()
            else:
                self.quest = quest.generate(st)
            self.choice = quest.auto_choice(st, self.quest)
            fmt_str = '{} {}'
            if self.choice:
                fmt_str = fmt_str.format(self.quest.one_name, self.quest.name)
            else:
                fmt_str = fmt_str.format(self.quest.two_name, self.quest.name)
            self.log.write('{}\n* {} *\n'.format(fmt_str, self.quest.info))
            self.duration = 0
            self.quest.duration *= self.slowness
        # вывод информации о студенте в текущий момент времени
        self.log.write(str(self) + '\n')

    def captainCall(self):
        mood = progress = satiety = 0
        name = 'звонок старосты '
        if self.progress <= -25:
            # bad
            info = 'вы плохо учились'
            mood = -self.inspired / 2
            progress = 5
        elif self.progress <= 50:
            # normal
            info = 'ошиблась номером'
            mood = -1
            progress = 1
        else:
            # good
            info = 'пришла стипендия'
            mood = self.inspired / 2
            progress = 5
        # пока оставляю без изменения второе событие
        return quest.Quest(name, 'Ответить на', {
            'mood': mood,
            'progress': progress,
            'satiety': 0,
            'finances': 0
        }, 'Игнорировать', {
            'mood': -mood,
            'progress': -progress,
            'satiety': 0,
            'finances': 0
        }, self.xp, 1, info)

    def inspiredCall(self):
        jobSelect = randint(0, 4)
        mood = progress = satiety = finances = 0
        name = ''
        if jobSelect == 0:
            # mood
            mood = self.inspired
            info = 'вас пропёрло на хорошое настроение'
        elif jobSelect == 1:
            # progress
            progress = self.inspired
            info = 'вас посетило вдохновение'
        elif jobSelect == 2:
            # satiety
            satiety = self.inspired
            info = 'вы очень хорошо покушали'
        else:
            # finances
            finances = self.inspired
            mood = self.inspired / 2
            info = 'вы нашли N рублей'
        # пока оставляю без изменения второе событие
        return quest.Quest(
            name, 'Вдохновение', {
                'mood': mood,
                'progress': progress,
                'satiety': satiety,
                'finances': finances
            }, '', {
                'mood': mood,
                'progress': progress,
                'satiety': satiety,
                'finances': finances
            }, self.xp, 1 / self.slowness, info)
コード例 #9
0
    asmodeus_button = "C:\\project\\DBG_Automation\\img\\battle\\hunt\\asmodeus_button.PNG"
    asmodeus_1 = "C:\\project\\DBG_Automation\\img\\battle\\hunt\\asmodeus_1.PNG"
    asmodeus_2 = "C:\\project\\DBG_Automation\\img\\battle\\hunt\\asmodeus_2.PNG"


#Initialisation
json_dailies = "C:\\project\\DBG_Automation\\data\\dailies.json"
daily_status = file.load_json(json_dailies)

json_rewards = "C:\\project\\DBG_Automation\\data\\rewards.json"
rewards_list = file.load_json(json_rewards)
reward = reward.Rewards(rewards_list)

json_quest_list = "C:\\project\\DBG_Automation\\data\\quests.json"
quest_list = file.load_json(json_quest_list)
quest = quest.Quest(quest_list)

json_purchase_list = "C:\\project\\DBG_Automation\\data\\purchases.json"
purchase_list = file.load_json(json_purchase_list)
purchase = purchase.Purchase(purchase_list)

rewinder = rewinder.Rewinder()

#Main Loop
x = 0
#event.find_image(image.insufficient_slots.value)
battle.hunt(image.asmodeus_button.value, image.asmodeus_1.value,
            1)  # while x == 0:
#     try:

#         # if daily_status["status"]["all_completed"] == False:
コード例 #10
0
def exit_level_quest(game_map):
    return quest.Quest(
        'Ever deeper we go...',
        'More adventure awaits if you go deeper into the depths of this accursed place.',
        100,
        map_point=game_map.down_stairs.point)
コード例 #11
0
ファイル: shore.py プロジェクト: j18chu/garrison
import item
import random
import reward
import location

oldMan = questGiver.QuestGiver(
    "Old Man",
    "Doesn't matter where I came from. Doesn't matter where you came from, for that matter. All that matters is you're here to help me.",
    [
        quest.Quest(
            'Destroy the Brush',
            'An evil enemy known as the brush has taken over that hill over there. Go clear it for me, will you? I will know you did the deed if you bring me 12 grass clumps. There might even \nbe something in it for you.',
            'Have you destroyed the brush over on that hill over there and brought me my 12 grass clumps?',
            "Not bad, not bad. Here's the reward I promised you. You can also keep half the grass you collected.",
            reward.Reward("oldMan",
                          globals.player,
                          50,
                          100,
                          50,
                          [item.Item("old gold coin", "it's a coin", 5, 15)],
                          logs=10,
                          grass=6), lambda player: player.level >= 1,
            lambda player: player.inventory.removeGrass(12))
    ], globals.player.pLocation)


class ForgottenShore(location.Location):
    def __init__(self):
        location.Location.__init__(
            self, "Abandoned Shoals", "The Forgotten Shore",
            "The first thing you feel when you awake is a splitting headache. You slowly open your eyes, taking in the sand below you, the palm trees ringing your vision, and the small\ncrabs scuttling around you. You shut your eyes and massage your temples, trying to recall what happened. The last thing you remember was sailing the Blue Seas with your crew, being\nuniversally feared, and then the crash. You open your eyes up again, this time noticing the wreckage around you.\n"
        )