Commit aa8568fe by BellCodeEditor

save project

parent 9c0f3dd3
Showing with 15 additions and 5 deletions
# 英雄角色类 # 英雄角色类
class Hero(object):
def __init__(self, name): def __init__(self, name):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.name = name self.name = name
def __init__(self,combat) yase = Hero("垭瑟")
houyi = Hero("后羿")
yase.combat(houyi)
def __init__(self,combat):
self.hp -= self.attack self.hp -= self.attack
off = () off1 = (yaes+"攻击了"+houyi+",造成了"+self.attack+"点攻击力")
\ No newline at end of file if self.hp <= 0:
off2 = (",游戏结束,"+yase+"胜")
else:
off2 = (",还剩下"+self.hp+"点生命")
off = off2 + off1
print(off)
\ 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