Untitled - Posted on September Tue 1st 2:55 PM (Never Expires) - Format: python - This is a modified post titled "with level".
  1. import time,random
  2. player_victory=0
  3. enemy_victory=0
  4.  
  5. for i in range(1,4):
  6.   time.sleep(1.5)
  7.   print('The is phase # '+ str(i))
  8.  
  9.   player_life=random.randint(100,150)
  10.   player_attact=random.randint(30,50)
  11.   enemy_life = random.randint(100,150)
  12.   enemy_attack = random.randint(30,50)
  13.  
  14.   print('You\n'+'HP:'+str(player_life)+'\nAttact:'+str(player_attact))
  15.   print('------------------------')
  16.   time.sleep(1)
  17.   print('Enemy\n'+'HP:'+str(enemy_life)+'\nAttact:'+str(enemy_attack))
  18.   print('------------------------')
  19.   time.sleep(1)
  20.  
  21.   while (player_life>0)and(enemy_life>0):
  22.      player_life=player_life-enemy_attack
  23.      enemy_life =enemy_life -player_attact
  24.      print('You acctact enemy, enemy HP left'+str(enemy_life))
  25.      print('Enemy attacked you, and your HP left'+ str(player_life))
  26.      print('------------------------')
  27.      time.sleep(1.5)
  28.  
  29.   if player_life > 0 and enemy_life <= 0:
  30.      player_victory +=1
  31.      print('敌人死翘翘了,你赢了')
  32.  
  33.   elif player_life <= 0 and enemy_life > 0:
  34.      enemy_victory +=1
  35.      print('悲催,敌人把你干掉了!')
  36.   else:
  37.      print('哎呀,你和敌人同归于尽了!')
  38.  
  39. if player_victory > enemy_victory :
  40.      time.sleep(1)
  41.      print('【最终结果:你赢了!】')
  42. elif enemy_victory > player_victory:
  43.   print('【最终结果:你输了!】')
  44. else:
  45.   print('【最终结果:平局!】')
  46.  
  47. while True:
  48.   final= input('do you want a play a new game?')
  49.   if final =='n':
  50.      break

New Paste

Paste Options

Recent Pastes

12 days ago

stripe

12 days ago

Untitled

13 days ago

run stripe liste

15 days ago

Untitled

16 days ago

remove duplicate

19 days ago

Untitled

21 days ago

Untitled

21 days ago

Untitled

22 days ago

Untitled

22 days ago

try this one