Ejemplo n.º 1
0
def simultaneous_damage(results_number_hero: int, Hero: Hero,
                        results_number_enemy: int, enemy: NPC) -> None:
    '''
        It is called whenever the Hero and the enemy cause mutual damage.
        Calculates damage, checks if both are hurt or dead and calls next round.
    '''

    new_hero_hp = Hero.hp - abs(results_number_enemy)
    Hero.hp = new_hero_hp
    Hero.set_status()

    new_enemy_hp = enemy.hp - abs(results_number_hero)
    enemy.hp = new_enemy_hp
    enemy.set_status()

    print('Current HPs after the simultaneous attack:')
    print(f'You: {Hero.hp}')
    print(f'{enemy.name}: {enemy.hp}')

    print_cinematics(Hero.declare_status)
    print_cinematics(enemy.declare_status)

    if Hero.status == 'dead' and enemy.status == 'dead':
        reset_rounds()
        death.mutual_death_by_combat(enemy)
    elif Hero.status == 'dead':
        reset_rounds()
        death.death_by_simultaneous_attack(enemy, results_number_hero)
    elif enemy.status == 'dead':
        reset_rounds()
        kills.killed_enemy_on_simultaneous_attack(Hero, enemy)
    else:
        cinematics_block()
        if results_number_hero > 0 and results_number_enemy > 0:
            print_cinematics(
                f'You and {enemy.name} hit each other at the same time, causing mutual damage.'
            )
        elif results_number_hero > 0:
            print_cinematics(
                f'You parry the {enemy.name} attack and hit {enemy.pronom[3]}, causing some damage.'
            )
        elif results_number_enemy > 0:
            print_cinematics(
                f'Taking advantage of your innefective attack, {enemy.name} strikes you a blow.'
            )
        else:
            print_cinematics(
                f'You clash with {enemy.name}, but but your attaks block each other.'
            )
        cinematics_block()
        print('\nStart next round.\n')
        next_round(Hero, enemy)
Ejemplo n.º 2
0
# ELEMENTS THAT CAN BE LIMITEDLY INTERACTED WITH.
testing_forest.ambient = ['trail', 'field']
testing_forest.far_away = ['river', 'old bridge']

# ELEMENTS THAT CAN BE USED AS SAFE PLACES FOT THE HERO TO HIDE AND REST.
testing_forest.safe_places = ['bushes']

# EXIT POINTS THAT CONNECT TO OTHER SCENARIOS.

# GLOBAL CONTAINERS FROM THE SCENARIO THAT CAN BE IMMEDIATELLY INTERACTED WITH.
trees = Container('trees', 'big and very green apple trees')

bushes = Container('bushes', '3 feet green bushes full of leaves')
bushes.searching_effect = [
    'You spend a very long time searching the bushes and start to feel tired.',
    lambda: Hero.set_status('tired')
]
# TODO: up one degree.. well -> tired -> very tired

# SPECIFIC ITEMS THAT CANNOT BE IMMEDIATELLY INTERACTED WITH.
trees.add_item(apple)
apple.add()
# apple.on_taking = lambda: 'keep'

bushes.add_item(golden_coin, 'hidden')
golden_coin.hidden = True

# ADDS GLOBAL CONTAINERS TO THE SCENARIO INSTANCE SO THEY CAN BE INTERACTED WITH.
testing_forest.add_to_scenario('bushes', bushes)
testing_forest.add_to_scenario('trees', trees)