Beispiel #1
0
    def use_ability(self, user):
        print(f"{user.name} is preparing to Backstab {user.target.name}...")
        sounds.sword_slash.play()
        main.smart_sleep(0.75)

        damage_multiplier = (
            125 + battle.temp_stats[user.name]['attributes']['dex']) / 100
        base_damage = damage_multiplier * units.deal_damage(
            user, user.target, "physical", do_criticals=False)

        if user.target.ability_vars['poison_pow']:
            print("Inject Poison increases Backstab damage by 1.5x!")

        base_damage = math.ceil(base_damage)

        if user.target.ability_vars['knockout_turns']:
            user.hp += math.ceil(0.1 * base_damage)
            units.fix_stats()
            print(
                f"Knockout Gas causes Backstab to lifesteal for {math.ceil(0.1*base_damage)} HP!"
            )

        if user.target.ability_vars['disarmed']:
            user.target.dfns = math.ceil(user.target.dfns * 0.9)
            print(
                f"Disarming Blow lowers {user.target.name}'s defense by {math.floor(user.target.dfns*0.1)}!"
            )

        sounds.enemy_hit.play()
        user.target.hp -= base_damage
        print(
            f"{user.name}'s Backstab deals {base_damage} to the {user.target.name}!"
        )
    def use_magic(self, user, is_battle):
        Spell.use_mana(self, user)
        target = user.target

        # Healing spells will always restore a minimum of target.hp*thresh.
        # e.g. A spell that heals 20 HP but has a 20% threshold will restore 20 HP for someone
        # with 45 max HP, but will restore 32 HP for someone with 160 max HP.
        # In addition to this, the target restores an additional 1 HP for every point of wisdom the user has
        if self.health < target.hp*self.thresh:
            total_heal = target.hp*self.thresh + user.attributes['wis']

        else:
            total_heal = self.health + user.attributes['wis']

        target.hp += total_heal
        target.hp = math.ceil(target.hp)
        units.fix_stats()

        if is_battle:
            print(ascii_art.player_art[user.class_.title()] % f"{user.name} is making a move!\n")
            print(f"{user.name} is preparing to cast {self.name}...")
            sounds.ability_cast.play()
            main.smart_sleep(0.75)

            print(f'Using "{self.name}", {target.name} is healed by {total_heal} HP!')
            sounds.magic_healing.play()

        else:
            print('-'*save_load.divider_size)
            print(f'Using "{self.name}", {target.name} is healed by {total_heal} HP!')
            sounds.magic_healing.play()
            main.s_input("\nPress enter/return ")
            print('-'*save_load.divider_size)
Beispiel #3
0
def bat_stats():
    units.fix_stats()
    print('-' * save_load.divider_size)

    # Player Stats
    player_pad1 = max([len(x.name) for x in enabled_pcus])
    player_pad2 = len(
        max([f'{unit.hp}/{unit.max_hp} HP' for unit in enabled_pcus], key=len))
    player_pad3 = len(
        max([f'{unit.mp}/{unit.max_mp} MP' for unit in enabled_pcus], key=len))

    print("Your party: ")
    for pcu in enabled_pcus:
        print(
            "  {0}{pad1} | {1}/{2} HP {pad2}| {3}/{4} MP {pad3}| LVL: {5} | STATUS: {6}"
            .format(
                pcu.name,
                pcu.hp,
                pcu.max_hp,
                pcu.mp,
                pcu.max_mp,
                pcu.lvl,
                ', '.join([x.title() for x in pcu.status_ail]),
                pad1=' ' * (player_pad1 - len(pcu.name)),
                pad2=' ' * (player_pad2 - len(f'{pcu.hp}/{pcu.max_hp} HP')),
                pad3=' ' * (player_pad3 - len(f'{pcu.mp}/{pcu.max_mp} MP'))))

    # Monster Stats
    monster_pad1 = max([len(x.name) for x in m_list])
    monster_pad2 = len(
        max([f'{unit.hp}/{unit.max_hp} HP' for unit in m_list], key=len))
    monster_pad3 = len(
        max([f'{unit.mp}/{unit.max_mp} MP' for unit in m_list], key=len))

    print("\nEnemy Team: ")
    for each_monster in m_list:
        print(
            "  {0}{pad1} | {1}/{2} HP {pad2}| {3}/{4} MP {pad3}| LVL: {5} | STATUS: {6}"
            .format(each_monster.name,
                    each_monster.hp,
                    each_monster.max_hp,
                    each_monster.mp,
                    each_monster.max_mp,
                    each_monster.lvl,
                    ', '.join([x.title() for x in each_monster.status_ail]),
                    pad1=' ' * (monster_pad1 - len(each_monster.name)),
                    pad2=' ' *
                    (monster_pad2 -
                     len(f'{each_monster.hp}/{each_monster.max_hp} HP')),
                    pad3=' ' *
                    (monster_pad3 -
                     len(f'{each_monster.mp}/{each_monster.max_mp} MP'))))

    print('-' * save_load.divider_size)
Beispiel #4
0
    def use_ability(self, user):
        print(f"{user.name} is preparing to cast Mana Drain...")
        sounds.ability_cast.play()
        main.smart_sleep(0.75)

        drain = max(
            ((5 + battle.temp_stats[user.name]['attributes']['int']) / 100) *
            user.target.max_mp, 5)

        user.mp += drain
        user.target.mp -= drain

        units.fix_stats()

        sounds.buff_spell.play()
        print(f"The {user.target.name} lost {drain} MP!")
        print(f"{user.name} gained {drain} MP!")
Beispiel #5
0
    def use_ability(self, user):
        c_enemy = max(battle.m_list, key=lambda x: x.hp)
        c_ally = min(
            [x for x in battle.enabled_pcus if 'dead' not in x.status_ail],
            key=lambda x: x.hp)

        sounds.ability_cast.play()
        print(f"{user.name} is beginning to cast Aura Swap...")
        main.smart_sleep(0.75)

        if c_enemy.hp <= c_ally.hp:
            print("...But it failed!")
            sounds.debuff.play()

        else:
            sounds.buff_spell.play()
            beginning = [c_enemy.hp, c_ally.hp]

            if isinstance(c_enemy, units.Boss):
                c_ally.hp = c_enemy.hp

            else:
                c_enemy.hp, c_ally.hp = c_ally.hp, c_enemy.hp

            units.fix_stats()

            evad = max(
                math.floor((c_ally.hp - c_enemy.hp) / 5) *
                (5 + battle.temp_stats[user.name]['attributes']['str']), 5)
            battle.temp_stats[user.name]['evad'] += evad

            print(
                f"{c_ally.name}'s HP rose from {beginning[1]} to {c_ally.hp}!")

            if isinstance(c_enemy, units.Boss):
                print(f"{c_enemy.name}'s boss aura protected them!")

            else:
                print(
                    f"{c_enemy.name}'s HP dropped from {beginning[0]} to {c_enemy.hp}!"
                )

            print(f"{user.name}'s evasion increased by {evad}!")
    def use_magic(self, user, is_battle=True):
        Spell.use_mana(self, user)
        target = user.target

        print(ascii_art.player_art[user.class_.title()] % f"{user.name} is making a move!\n")
        print(f"{user.name} is preparing to cast {self.name}...")
        sounds.ability_cast.play()
        main.smart_sleep(0.75)

        if user == target:
            print(f"{user.name} raises their stats using the power of {self.name}!")

        else:
            print(f"{user.name} raises {target.name}'s stats using the power of {self.name}!")

        sounds.buff_spell.play()

        # Temp stats is, as the name suggests, a temporary stat dictionary that is only used in-battle.
        # The dictionary is cleared after every battle and re-created when a new one begins, so that
        # buff spells and other stat increases can be made temporary instead of permanent.
        battle.temp_stats[target.name][self.stat] *= 1 + self.increase
        battle.temp_stats[target.name][self.stat] = math.ceil(battle.temp_stats[user.name][self.stat])
        units.fix_stats()
 def use_mana(self, user):
     user.mp -= self.mana
     units.fix_stats()