Commit 67147d55 by BellCodeEditor

save project

parent 9a581ef4
Showing with 17 additions and 11 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
class Hero:
def __init__(self,n):
self.name = n
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
self.act = 40
def gongji(self,e):
e.hp -= self.act
info1 = self.name + "对" + e.name + "发起伤害"
info2 = "造成" + str(self.act) + "点伤害。"
info3 = e.name + "剩下" + str(e.hp) + "点Hp"
info=info1 + info2 + info3
print(info)
def combat(): # 攻击
???
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
yasa = Hero("亚瑟")
laoshi = Hero("解舒岩")
laoshi.gongji(yasa)
\ 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