Commit d16dee06 by BellCodeEditor

save project

parent 413fcf8d
Showing with 17 additions and 3 deletions
......@@ -5,11 +5,24 @@ class Hero(object):
self.attack = 388
self.name = name
def combat(self,enemy): # 攻击
def combat(self,enemy):
enemy.hp -= self.attack
info1=self.name+"对"+enemy.name+"发起攻击"
info2="造成"+str(self.name)+"点攻击"
if enemy.hp>0:
info3=enemy.name+"还剩下"+str(enemy.hp)
info=info1+info2+info3
print(info)
else:
inf3=enemy.name"阵亡"
info=info1+info2+info3
print(info)
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase = Hero("垭瑟(Aoe)")
houyi= Hero("后羿(Ejo)")
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