Commit e2328666 by BellCodeEditor

save project

parent 9a581ef4
Showing with 11 additions and 3 deletions
......@@ -6,9 +6,16 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,enemy):
enemy.hp-=self.attack
into=str(self.name)+"对"+str(enemy.name)+"发起进攻"
into1=str(enemy.name)+"受到"str(self.attack)+"伤害"
into2=str(enemy.name)+"还剩下"+str(enemy.hp) # 攻击
if enemy.hp>0:
into3=into+into1+into2
print(into3)
else:
print(into+into1+str(enemy.name)+"已阵亡")
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