Commit 63824017 by BellCodeEditor

save project

parent 82e9976a
Showing with 11 additions and 3 deletions
class Hore: class Hore:
def __init__ (self,name,HP,attack): def __init__ (self,name,HP,attack):
self.level=1 self.level=1
self.name=name
self.HP=HP self.HP=HP
self.attack=attack self.attack=attack
def upgrade():
yase.level=yase.level+1
yase.HP=yase.HP+50
yase.attack=yase.attack+4
yase = Hore("亚瑟",300,20) yase = Hore("亚瑟",300,20)
houyi = Hore("后羿",250,25) print("亚瑟初始血量为:",yase.HP)
print("后羿攻击力",houyi.attack) upgrade()
print("亚瑟攻击力",yase.attack) upgrade()
print("亚瑟升级后血量为:",yase.HP)
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