Commit 1c2f037c by BellCodeEditor

save project

parent 92b6f17e
Showing with 9 additions and 7 deletions
class Hero: class Hero:
def__init__(self,name,hp,ac): def __init__(self,name,hp,ac):
self.lv = 1 self.lv = 1
self.name = name self.name = name
self.hp = hp self.hp = hp
self.ac = ac self.ac = ac
def ug(self):
def ug(): self.lv+=1
yase.lv+=1 self.hp+=100
yase.hp+=100 self.ac+=50
yase.ac+=50
yase = Hero("亚瑟",300,25) yase = Hero("亚瑟",300,25)
print("亚瑟的血量为:",yase.hp)
yase.ug()
print("亚瑟的血量为:",yase.hp)
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