Commit 5a25c240 by BellCodeEditor

auto save

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