title: Text-based RPG Repeating Damage Done
body: <p>I'm a novice programmer working on a text-based RPG, and for some reason, when the enemy is hit with an arrow when you choose the bowman class, it does the same amount of damage multiple times when it is supposed to do random damage each time, and it doesn't subtract the enemy's health by the damage every time. My code is pretty messy, but please be patient. Also, if you have any advice for me in general, please let me know.</p>
  
  <pre><code>  while action == "attack":
          if player_class == "warrior":
              enemy_damage = 30
              enemy_health = enemy_health - enemy_damage
          elif player_class == "bowman":
              target_general = randint(1, 3)
              if target_general == 1:
                  action = input(f"You shot to the left of the {enemy}. What will you do now? Attack, evade or run?")
              elif target_general == 2:
                  target_specific = randint(1, 5)
                  if target_specific == 5:
                      enemy_damage = "way too much"
                      enemy_health = 0
                      print("Critical hit!")
                  else:
                      enemy_damage = target_specific * 10
                      enemy_health = enemy_health - enemy_damage
              else:
                  action = input(f"You shot to the right of the {enemy}. What will you do now? Attack, evade or run?")
          if enemy_health &lt; 0:
              enemy_health = 0
          if enemy_health == 0:
              player_gold = player_gold + treasure
              print(f"You defeated the {enemy}! You found {treasure} gold.")
              action = leave()
          elif action == "attack" and enemy_damage != 0:
              action = input(f"You attacked the {enemy}, and did {str(enemy_damage)} damage. The enemy has {enemy_health} health left. What will you do now?Attack, evade or run?")
  </code></pre>