Commit 249387b3 by BellCodeEditor

save project

parent 9a581ef4
Showing with 16 additions and 5 deletions
......@@ -6,9 +6,19 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
yase = Hero("垭瑟")
houyi= Hero("后羿")
def combat(self,nam): # 攻击
nam.hp-=self.attack
a=self.name+"对"+nam.name+"发起攻击,"
b=nam.name+"受到了蜀汉军的大将赵云的"+str(self.attack)+"伤害,"
if nam.hp>0:
c=nam.name+"还剩下"+str(nam.hp)+"点血量。"
d=a+b+c
print(d)
else:
c=nam.name+"已在战场上阵亡"
d=a+b+c
print(d)
exit()
yase = Hero("赵云")
houyi= Hero("典韦")
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