Commit 6ff4bea8 by BellCodeEditor

save project

parent 6bd968f5
Showing with 10 additions and 11 deletions
...@@ -4,7 +4,12 @@ class Hero: ...@@ -4,7 +4,12 @@ class Hero:
self.name = name self.name = name
self.HP = HP self.HP = HP
self.ATAC = ATAC self.ATAC = ATAC
def upLevel(self,Level):
self.level += Level
def upHP(self,HP):
self.HP += HP
def upATAC(self,ATAC):
self.ATAC += ATAC
WZJ = Hero("王昭君",4830,400) WZJ = Hero("王昭君",4830,400)
YL = Hero("亚连",3400,270) YL = Hero("亚连",3400,270)
...@@ -12,20 +17,13 @@ print("王昭君等级:",WZJ.level) ...@@ -12,20 +17,13 @@ print("王昭君等级:",WZJ.level)
print("王昭君血量:",WZJ.HP) print("王昭君血量:",WZJ.HP)
print("亚连攻击力:",YL.ATAC) print("亚连攻击力:",YL.ATAC)
def upLevel(name):
name.level += 1
def upHP(name,HP):
name.HP += HP
def upATAC(name,ATAC):
name.ATAC += ATAC
print() print()
upLevel(WZJ) WZJ.upLevel(1)
print("王昭君等级:",WZJ.level) print("王昭君等级:",WZJ.level)
upHP(WZJ,308) WZJ.upHP(308)
print("王昭君血量:",WZJ.HP) print("王昭君血量:",WZJ.HP)
upATAC(YL,138) YL.upATAC(138)
print("亚连攻击力:",YL.ATAC) print("亚连攻击力:",YL.ATAC)
\ 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