Commit 6e4aedee by BellCodeEditor

save project

parent 9a581ef4
Showing with 12 additions and 3 deletions
...@@ -3,11 +3,20 @@ class Hero(object): ...@@ -3,11 +3,20 @@ class Hero(object):
def __init__(self, name): def __init__(self, name):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 249.9649237289
self.name = name self.name = name
def combat(): # 攻击 def combat(self,wanker):
??? wanker.hp -= self.attack
print(f'{self.name}对{wanker.name}发出了攻击,造成{self.attack}点伤害',end='')
if wanker.hp<=0:
print(f',游戏结束,恭喜{self.name}获得胜利')
exit()
else:
print(f',{wanker.name}还剩下{wanker.hp}点血量')
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= 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