Commit 79fd67ff by BellCodeEditor

save project

parent 9a581ef4
Showing with 9 additions and 2 deletions
...@@ -6,8 +6,12 @@ class Hero(object): ...@@ -6,8 +6,12 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(): # 攻击 def combat(self, ememy): # 攻击
??? ememy.hp = ememy.hp - self.attack
if ememy.hp < 0 or ememy.hp == 0:
print(str(ememy.name),'阵亡,游戏结束')
else:
print(str(self.name)+'使用了攻击,对'+str(ememy.name)+'造成了'+str(self.attack)+'点伤害,'+str(ememy.name)+'还剩'+str(ememy.hp)+'点血量')
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
......
变量 = 'hello world!'
print(变量)
\ 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