Commit bae5ed7e by BellCodeEditor

save project

parent 9a581ef4
Showing with 12 additions and 4 deletions
# 英雄角色类
class Hero(object):
class Hero():
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(): # 攻击
???
while True:
def combat(self,enemy): # 攻击
self.hp-=enemy.attack
into1=self.name+"受到了"+str(enemy.attack)+"剩余"+srt(self.hp)
into2=enemy.name+"受到了"+str(self.attack)+"剩余"+srt(enemy.hp)
if int(self.hp)>0:
print(into1+into2)
else:
into3=self.name+"死亡"
print(into1+into2+into3)
exit()
yase = Hero("垭瑟")
houyi= Hero("后羿")
......
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