Commit 9a759c33 by BellCodeEditor

auto save

parent 9a581ef4
Showing with 13 additions and 5 deletions
...@@ -6,9 +6,17 @@ class Hero(object): ...@@ -6,9 +6,17 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(): # 攻击 def combat(self,comp): # 攻击
??? comp.hp=comp.hp-self.attack
print('打了'+str(self.attack)+'点血量')
if comp.hp > 0:
print("还有"+str(comp.hp))
else:
print("死了")
exit()
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
yase.combat(houyi) while True:
\ No newline at end of file a=input()
if a=="1":
yase.combat(houyi)
\ 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