Commit edbef57a by BellCodeEditor

auto save

parent 65587578
Showing with 6 additions and 5 deletions
......@@ -3,20 +3,20 @@ class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.attack = 999
self.name = name
def combat(self,duifang): # 攻击
duifang.hp-=self.attack
info1=self.name+"对"+duifang.name+"发起攻击"
info2="造成"+str(self.attack)+"点伤害"
if duifang.hp>0
info3=duifang.name+""+str(duifang.hp)+"血量"
if duifang.hp>0:
info3=duifang.name+"还剩"+str(duifang.hp)+"血量"
print(info1+info2+info3)
else:
info3=duifang.name+"已阵亡"
print(info1+info2+info3)
exit()
yase = Hero("咸水鸭")
houyi= Hero("北京烤鸭")
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