Commit 5a25c240 by BellCodeEditor

auto save

parent bc3b7d84
Showing with 8 additions and 101 deletions
......@@ -4,109 +4,17 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
yase=Hero(200,"亚瑟",40)
def combat(self,enemy)
enemy.hp-=self.attack
info1=self.name+"发起攻击"+enemy.name
info2=eneym.name+"造成"+str(self.attack)
if enemy.hp>0:
def combat(self,enemy):
enemy.hp-=self.attack
info1=self.name+"发起攻击"+enemy.name
info2=eneym.name+"造成"+str(self.attack)
def combat(self,enemy):
enemy.hp-=self.hp
info1=self.name+"对"+enemy.name+"发起攻击"
info2=enemy.name+"造成"+str(self.attack)+"点伤害"
if enemy.hp>0:
info3=enemy.name+"还剩下"+str(enemy.hp)
info=info1+info2+info3
print(info)
exit()
else:
info3=enemy.name+"阵亡"
info3="阵亡,游戏结束。"
info=info1+info2+info3
print(info)
\ No newline at end of file
print(info)
yase=Hero(200,"亚瑟",40)
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