Commit 84079cac by BellCodeEditor

save project

parent 9a581ef4
Showing with 16 additions and 7 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
class a(object):
def __init__(self,b):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
self.at = 40
self.b = b
def combat(): # 攻击
???
def combat(self,c): # 攻击
d=self.b+"攻击"+combat.c
e="伤害"+str(self.at)
combat.hp-=self.at
if combat.hp>0:
f=combat.c+"还剩"+str(combat.hp)+'血'
print(d+e+f)
else:
f=combat.c+"死了"
print(d+e+f)
exit()
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