Advertisement
daixso

Fight System Test

Aug 3rd, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.99 KB | None | 0 0
  1. import random
  2. """
  3.     I need cannot get playerMana to decrement when they cast fireball... I don't get it :/ I have used multiple methods.
  4.     I tried to do playerMana-=50 but that did not work either...
  5.     Skype: wetdog54
  6. """
  7. #player stats
  8. playerLevel = 1
  9. playerHp = 85+15*playerLevel
  10. playerMana = 130+20*playerLevel
  11. playerExp = 75
  12. ressurects = 3
  13.  
  14. #experience calculations
  15. playerExpForLevel = playerLevel*100
  16. playerExpToLevel = playerExpForLevel - playerExp
  17. playerExpPercent = (playerExp / playerExpForLevel) * 100
  18.  
  19. #boss or regular mob
  20. randNum=8 #random.randint(1,10)
  21.  
  22. if randNum >= 7:
  23.     print "A boss has appeared!\n"
  24.     bossHp=random.randint(100,200)*playerLevel
  25.     while bossHp > 0:
  26.         print "The boss has " + `bossHp` + " HP!\n"
  27.         print "You are level " + `playerLevel` + "!\nYour HP: " + `playerHp` + "!\nYour Mana: " + `playerMana`
  28.         print "You are " + `playerExpPercent` + "% through this level, and need " + `playerExpToLevel` + " more exp!\n"
  29.         print "Choose an attack...\n1. Fireball (50% hit, 50 mana)\n2. Melee (80% hit, 0 mana)"
  30.         attack=raw_input("Attack: ")
  31.         if attack == 1:
  32.             playerMana=playerMana-50
  33.             hitChance = random.randint(1,10)
  34.             if hitChance >= 5:
  35.                 critChance = random.randint(1,10)
  36.                 if critChance >= 8:
  37.                     #player does critical hit, adding 10 damage, plus an additional 5 per level
  38.                     fireballHit = random.randint(35,85)*playerLevel
  39.                     bossDamage = fireballHit + 5*playerLevel
  40.                     bossHp-=bossDamage
  41.                     print "You crit the boss for " + `bossDamage` + " HP!\n\n"
  42.                 else:
  43.                     #player does regular hit
  44.                     fireballHit = random.randint(25,75)*playerLevel
  45.                     bossHp-= fireballHit
  46.                     print "You hit the boss for " + `fireballHit` + " HP!\n\n"
  47.             else:
  48.                 print "You miss the boss, and deal no damage!\n\n"
  49.         else:
  50.             #melee attack, no mana consumption
  51.             hitChance = random.randint(1,10)
  52.             if hitChance <= 8:
  53.                 #player will hit
  54.                 critChance = random.randint(1,10)
  55.                 if critChance >= 8:
  56.                     #player does critical hit, adding10 damage, plus an additional 5 per level
  57.                     meleeHit=random.randint(30,60)*playerLevel
  58.                     bossDamage = meleeHit + 4*playerLevel
  59.                     bossHp-=bossDamage
  60.                     print "You crit the boss for " + `bossDamage` + " HP!\n\n"
  61.                 else:
  62.                     #player does normal hit
  63.                     meleeHit=random.randint(20,50)*playerLevel
  64.                     bossHp-=meleeHit
  65.                     print "You crit the boss for " + `meleeHit` + " HP!\n\n"
  66.             else:
  67.                 print "You miss the boss, and deal no damage!\n\n"
  68.                
  69.        
  70. else:
  71.     print "A mob has appeared!\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement