Commit ac2f0fd0 by BellCodeEditor

save project

parent 4fa7f578
Showing with 11 additions and 3 deletions
......@@ -6,9 +6,16 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(self,enemy): # 攻击
def combat(self,enemy):
enemy.hp=enemy.hp-self.hp # 攻击
c1=self.name+"对"+enemy.name+"伤害"
c2="造成"+self.name+"伤害"
if enemy.hp>0:
c3=enemy.name+"还剩"+enemy.hp
elif :
c5=enemy.name+'已阵亡'
c4=c1+c2+c3
print(c4)
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