Commit fa148596 by BellCodeEditor

auto save

parent fb097064
Showing with 12 additions and 12 deletions
# 英雄角色类 # 英雄角色类
class Hero(object): class Hero:
def __init__(self, name): def __init__(self, name):
self.hp = 254 self.hp = 254
self.attack = 27 self.attack = 27
self.name = name self.name = name
Def 函数名(self,name1) def combat(self,name1):
info1=self.name+"对"+name1.name+"发起进攻"
info2="造成"+str(self.attack)+"点伤害"
name1.hp-=self.attack name1.hp-=self.attack
Info1=self.name+”还剩”+str(name1) if name1.hp>0:
Inof2=”造成”+str(self.attack)+”点伤害” info3=name1.name+"还剩下"+str(name1.hp)+"血量"
If name1.hp>0: info=info1+info2+info3
Info3=name1.”还剩下”+str(name1.hp)+”血量” print(info)
Info=info1+info2+info# else:
Print(info) info3= name1.name+"阵亡,游戏结束"
Else: info=info1+info2+info3
Info3= name1.name+”阵亡,游戏结束” print(info)
Info=info1+info2+info3
Print(info)
Tran = Hero("Tran") Tran = Hero("Tran")
......
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