Commit 2617966b by BellCodeEditor

save project

parent 9a581ef4
Showing with 21 additions and 9 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.level = 90
self.hp = 32800
self.atk = 1875
self.name = name
def combat(): # 攻击
???
def combat(self,enemy): # 攻击
info1 = self.name+"hit"+enemy.name
info2 = ","+str(self.atk)
enemy.hp -= self.atk
if enemy.hp > 0:
info3 = "/"+str(enemy.hp)
info=info1+info2+info3
print(info)
else:
info3 = enemy.name+"died"
info=info1+info2+info3
print(info)
exit()
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
a= Hero("hutao")
b= Hero("darkdarkdeepya")
a.combat(b)
\ 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