Guest User

Untitled

a guest
Jan 8th, 2022
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. def char_select():
  2. char_decision = 'n'
  3. classes = [0, warrior, tanker, thief, archer, mage, healer, assassin]
  4. char_choose = 'stupid value'
  5. while char_decision.lower() != 'y':
  6. char_choose = int(input('What class do you want to choose? \n1. Warrior \n2. Tanker \n'
  7. '3. Thief \n4. Archer \n5. Mage \n6. Healer \n7. Assassin \n'))
  8. if char_choose > 7 or char_choose < 0:
  9. print('You chose the wrong value! \n>Enter value from 1 to 7 ')
  10. if char_choose < 7 :
  11. print('Selected class:')
  12. classes[char_choose].printstats()
  13. char_decision = input((f'Do you want to play as {classes[char_choose].name}\n'))
  14. return classes[char_choose]
  15.  
  16.  
  17. def monster_select():
  18. monster_pointer = [goblin,blackgoblin,magegoblin,summonergoblin,wolfyoung,wolfold,molerat,flasheater,kelpie,skylight]
  19. monster_select = ri(0,9)
  20. print('Summoned monster: ')
  21. monster_pointer[monster_select].printstats()
  22. return monster_pointer[monster_select]
  23.  
  24.  
  25. def damage_ratio(character_helper,monster_helper):
  26.  
  27. while monster_helper.health >= 0 and character_helper.health > 0:
  28. core_ch = abs(4 + (monster_helper.strength * 1.5) + (monster_helper.magic * 2) + (monster_helper.agility * 1) - (character_helper.defense * 1.5)) # Got player
  29. core_m = abs(4 + (character_helper.strength * 2) + (character_helper.magic * 3) + (character_helper.agility * 2) - (monster_helper.defense * 1.5)) # Got monster
  30. crit_chance = ri(0,1)
  31. if crit_chance == 0:
  32. character_helper.health = character_helper.health - core_ch
  33. monster_helper.health = monster_helper.health - core_m
  34.  
  35. if crit_chance == 1:
  36. core_m = core_m * 2
  37. core_ch = core_ch * 2
  38. character_helper.health = character_helper.health - core_ch
  39. monster_helper.health = monster_helper.health - core_m
  40. print("\nYou dealt to " + str(monster_helper.name) + ": " + str(core_m) + " Health "+ str(monster_helper.name) + ": "+ str(monster_helper.health))
  41. print("\n" +str(monster_helper.name) + "dealt to you: " + str(core_ch) + " Your health: " + str(character_helper.health))
  42. return monster_helper.health and character_helper.health
  43.  
  44.  
  45. def monster_defeated(monster_bounty):
  46. monster_defeated = ['You defeated: ',]
  47. if monster_bounty > 0:
  48. print("\nšŸ‘‘ " + monster_helper.name + " defeated! šŸ‘‘")
  49. monster_helper.printbounty()
  50. monster_defeated.append(monster_helper.name)
  51. print(monster_defeated)
  52. if monster_bounty < 0:
  53. print("šŸ’€ You died! šŸ’€ \nZacznij nowa gre")
  54.  
  55.  
  56. if __name__ == '__main__':
  57. character_helper = char_select()
  58. monster_helper = monster_select()
  59. monster_bounty = damage_ratio(character_helper,monster_helper)
  60. monster_defeated(monster_bounty)
  61. damage_ratio(character_helper,monster_helper)
Advertisement
Add Comment
Please, Sign In to add comment