Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- number_of_heroes = int(input())
- def creating_party(party_range):
- heroes_in_party = {}
- for hero in range(party_range):
- current_hero = input().split()
- name_of_hero = current_hero[0]
- hp_current_hero = int(current_hero[1])
- mp_current_hero = int(current_hero[2])
- heroes_in_party[name_of_hero] = [hp_current_hero, mp_current_hero]
- return heroes_in_party
- our_hero_party = creating_party(number_of_heroes)
- def command_performing(type_commands: list):
- global our_hero_party
- current_perform = type_commands[0]
- hero_name = type_commands[1]
- if current_perform == "CastSpell":
- mp_needed = int(type_commands[2])
- spell_name = type_commands[3]
- if our_hero_party[hero_name][1] >= mp_needed:
- our_hero_party[hero_name][1] -= mp_needed
- return f"{hero_name} has successfully cast {spell_name} and now has {our_hero_party[hero_name][1]} MP!"
- else:
- return f"{hero_name} does not have enough MP to cast {spell_name}!"
- elif current_perform == "TakeDamage":
- damage = int(type_commands[2])
- attacker = type_commands[3]
- our_hero_party[hero_name][0] -= damage
- if our_hero_party[hero_name][0] > 0:
- return f"{hero_name} was hit for {damage} HP by {attacker} and now has {our_hero_party[hero_name][0]} HP left!"
- else:
- del (our_hero_party[hero_name])
- return f"{hero_name} has been killed by {attacker}!"
- elif current_perform == "Recharge":
- amount_mana = int(type_commands[2])
- our_hero_party[hero_name][1] += amount_mana
- if our_hero_party[hero_name][1] > 200:
- amount_mana -= our_hero_party[hero_name][1] - 200
- our_hero_party[hero_name][1] = 200
- return f"{hero_name} recharged for {amount_mana} MP!"
- elif current_perform == "Heal":
- healing = int(type_commands[2])
- our_hero_party[hero_name][0] += healing
- if our_hero_party[hero_name][0] > 100:
- healing -= our_hero_party[hero_name][0] - 100
- our_hero_party[hero_name][0] = 100
- return f"{hero_name} healed for {healing} HP!"
- commands = input().split(" - ")
- while commands[0] != "End":
- print(command_performing(commands))
- commands = input().split(" - ")
- for heroes_alive in our_hero_party:
- print(f"""{heroes_alive}
- HP: {our_hero_party[heroes_alive][0]}
- MP: {our_hero_party[heroes_alive][1]}""")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement