Commit 67966cb5 by BellCodeEditor

save project

parent 7032163d
Showing with 21 additions and 11 deletions
...@@ -85,15 +85,7 @@ while True: ...@@ -85,15 +85,7 @@ while True:
player2.sj() player2.sj()
elif user_input == "3": elif user_input == "3":
player1.wk() player1.wk()
if random.randint(0,2) == 0: player2.combat(player1)
if player2.level >= 5:
player2.wk()
else:
player2.cure()
elif random.randint(0,2) == 1:
player2.combat(player1)
else:
player2.sj()
elif user_input == "4": elif user_input == "4":
player1.sj() player1.sj()
if random.randint(0,2) == 0: if random.randint(0,2) == 0:
......
class import random
\ No newline at end of file
name_log = []
hp_log = []
class yx:
def __init__(self,name,hp,lv):
self.name = name
self.lv = lv
self.hp = hp
self.att = random.randint(1,200)
print('角色',str(self.name),'创建成功!血量:',str(self.hp),'攻击力:',str(self.att),'等级:',str(self.lv))
def combat(self, name):
name.hp = name.hp - self.att
print(str(self.name),'向',str(name.name),'使用了',str(self.att),'点伤害,',str(name.name),'还剩',str(name.hp),'点血量')
a = yx('a',200,1)
b = yx('b',2000,1)
a.combat(b)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment