Exemplo n.º 1
0
def aa_deeper(adventure: Adventure):
    battle.qsab(adventure, Location.FOREST, 'C')
    bc = BonusChapter(tr(adventure.get_lang(), 'FOREST.EVENT5'))
    if random.random() < 0.5:
        bc.add_modifier(StatModifier(Stat.EVA, 3, StatModifierOperation.ADD))
    else:
        bc.add_modifier(StatModifier(Stat.SPD, 3, StatModifierOperation.ADD))
    adventure.add_chapter(bc)
    battle.qsab(adventure, Location.FOREST, 'C')

    cc = ChoiceChapter(Emoji.MUSHROOM, tr(adventure.get_lang(), 'FOREST.DECISION4_TEXT'))
    cc.add_choice(Emoji.RED, tr(adventure.get_lang(), 'FOREST.DECISION4_OPTION1'), eat_mushroom(0))
    cc.add_choice(Emoji.BLUE, tr(adventure.get_lang(), 'FOREST.DECISION4_OPTION2'), eat_mushroom(1))
    cc.add_choice(Emoji.GREEN, tr(adventure.get_lang(), 'FOREST.DECISION4_OPTION3'), eat_mushroom(2))
    adventure.add_chapter(cc)

    battle.qsab(adventure, Location.FOREST, 'B')
    ability_ai: AbilityAI = AbilityAI([
        AbilityDecision(0, 0.5, AbilityContainer(AbilityEnum.SUMMON, 100), max_uses=1)
    ])
    boss: BotEntity = battle.rnd(adventure, Location.FOREST, 'BOSS', ability_ai)
    battle.qcsab(adventure, boss,
                 icon=Emoji.FOREST,
                 pre_text=[tr(adventure.get_lang(), 'FOREST.BOSS1'),
                           tr(adventure.get_lang(), 'FOREST.BOSS2'),
                           tr(adventure.get_lang(), 'FOREST.BOSS3')])

    item: Equipment = RandomEquipmentBuilder(0).set_location(Location.FOREST).build()
    adventure.add_chapter(ItemRewardChapter(item))
Exemplo n.º 2
0
 def mushroom_effect(adventure: Adventure):
     bc = BonusChapter(tr(adventure.get_lang(), 'FOREST.EVENT6'))
     if color == 0:
         bc.add_modifier(StatModifier(Stat.DEF, -2, StatModifierOperation.ADD, 1))
     elif color == 1:
         bc.add_modifier(StatModifier(Stat.SPD, 5, StatModifierOperation.ADD))
     else:
         bc.add_persistent(Stat.HP, Stat.HP.get_value(4))
     adventure.insert_chapter(bc)
Exemplo n.º 3
0
 def use(lang: str, source: 'BattleEntity', target_entity: 'BattleEntity',
         tier: int) -> str:
     target_entity.add_temp_modifier(
         StatModifier(Stat.DEF, -3, StatModifierOperation.ADD, 3))
     target_entity.add_temp_modifier(
         StatModifier(Stat.STR, -4, StatModifierOperation.ADD, 3))
     return tr(lang,
               'ABILITIES.CLAW_USE',
               source=source.get_name(),
               target=target_entity.get_name())
Exemplo n.º 4
0
 def add_modifier(self, modifier: StatModifier) -> None:
     if modifier.persistent:
         self.set_persistent_value(
             modifier.stat,
             round(modifier.apply(self.get_persistent_value(
                 modifier.stat))))
     else:
         self._stat_modifiers.append(modifier)
Exemplo n.º 5
0
def ba_pick(adventure: Adventure):
    if random.random() < 0.5:
        bc: BonusChapter = BonusChapter(
            tr(adventure.get_lang(), 'LAKE.DECISION2_RESULT1'))
        if random.random() < 0.5:
            bc.add_modifier(
                StatModifier(Stat.STR, 2, StatModifierOperation.ADD))
        else:
            bc.add_modifier(
                StatModifier(Stat.DEF, 2, StatModifierOperation.ADD))
        adventure.add_chapter(bc)
        battle.qsab(adventure, Location.LAKE, 'A')
    else:
        battle.qsab(
            adventure,
            Location.LAKE,
            'B',
            pre_text=[tr(adventure.get_lang(), 'LAKE.DECISION2_RESULT2')])
    b_before_reward(adventure)
Exemplo n.º 6
0
def a_deep(adventure: Adventure):
    battle.qsab(adventure, Location.LAKE, 'B')
    battle.qsab(adventure, Location.LAKE, 'B')
    bc: BonusChapter = BonusChapter(tr(adventure.get_lang(), 'LAKE.EVENT1'))
    if random.random() < 0.5:
        bc.add_modifier(StatModifier(Stat.EVA, 3, StatModifierOperation.ADD))
    else:
        bc.add_modifier(StatModifier(Stat.CONT, 4, StatModifierOperation.ADD))
    bc.add_persistent(Stat.HP, 4)
    adventure.add_chapter(bc)
    adventure.add_chapter(
        ChoiceChapter(Emoji.LAKE,
                      tr(adventure.get_lang(),
                         'LAKE.DECISION3_TEXT')).add_choice(
                             Emoji.UP,
                             tr(adventure.get_lang(),
                                'LAKE.DECISION3_OPTION1'),
                             aa_deepest).add_choice(
                                 Emoji.RIGHT,
                                 tr(adventure.get_lang(),
                                    'LAKE.DECISION3_OPTION2'), ab_around))
Exemplo n.º 7
0
def ab_continue_path(adventure):
    if random.random() < 0.5:
        bc = BonusChapter(tr(adventure.get_lang(), 'FOREST.EVENT3'))
        bc.add_modifier(StatModifier(Stat.DEF, 3, StatModifierOperation.ADD))
        adventure.add_chapter(bc)
    else:
        bc = BonusChapter(tr(adventure.get_lang(), 'FOREST.EVENT4'))
        bc.add_persistent(Stat.HP, Stat.HP.get_value(2))
        adventure.add_chapter(bc)
    battle.qsab(adventure, Location.FOREST, 'A')
    battle.qsab(adventure, Location.FOREST, 'C')
    if random.random() < 0.5:
        adventure.add_chapter(MoneyRewardChapter(random.randint(100, 150)))
    else:
        item: Equipment = RandomEquipmentBuilder(0).set_location(Location.ANYWHERE) \
            .choose_rarity([ItemRarity.UNCOMMON, ItemRarity.RARE, ItemRarity.EPIC], [6, 3, 1]).build()
        adventure.add_chapter(ItemRewardChapter(item))
Exemplo n.º 8
0
async def invincible(cmd: Command):
    cmd.user.user_entity.add_modifier(
        StatModifier(Stat.EVA, 9999, StatModifierOperation.ADD))
    await cmd.send_hidden("invincible...")
Exemplo n.º 9
0
 def __init__(self, desc_id: int, data_dict: dict[str, Any]):
     super().__init__(desc_id, data_dict)
     self.stat_modifiers: list[StatModifier] = [StatModifier.from_dict(md) for md in data_dict['Modifiers']]