Commit a73847d5 by BellCodeEditor

save project

parent 9a581ef4
Showing with 7 additions and 4 deletions
# 英雄角色类 # 英雄角色类
def pr(a):
print(a)
class Hero(object): 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 combat(self,InFrontOfMySelf): # 攻击
def combat(): # 攻击 InFrontOfMySelf.hp-=self.attack
??? pr(self.name+'对'+InFrontOfMySelf.name+'发起进攻!'+'造成'+str(self.attack)+'点伤害,'+InFrontOfMySelf.name+'还剩下'+str(InFrontOfMySelf.hp)+'点血量。')
yase = Hero("垭瑟") yase = Hero("垭瑟")
houyi= Hero("后羿") houyi= Hero("后羿")
......
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