Commit 3a5c05d5 by BellCodeEditor

save project

parent 9a581ef4
Showing with 10 additions and 6 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.le = 1
self.hp = 250
self.attack = 40
self.name = name
self.at = 40
self.na = name
def combat(): # 攻击
???
def combat(p1,p2):
p2.hp-= p1.at
a1=p1.na+"攻击"+p2.na
a2="造成"+str(p1.at)+"伤害" # 攻击
a3=p2.na+"还剩"+str(p2.hp)
print(a1+a2+a3)
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