Commit eb9fb0cb by BellCodeEditor

save project

parent 7a514f36
Showing with 8 additions and 13 deletions
...@@ -4,6 +4,11 @@ class Hero: ...@@ -4,6 +4,11 @@ class Hero:
self.name=name self.name=name
self.dps=dps self.dps=dps
self.hp=hp self.hp=hp
def AddHeroLevel(self):
self.level=self.level+1
self.dps=self.dps*2
self.hp=self.hp*2
h1=Hero('鸭瑟',1,1) h1=Hero('鸭瑟',1,1)
print('鸭瑟血量:',h1.hp) print('鸭瑟血量:',h1.hp)
h2=Hero('后裔',2,2) h2=Hero('后裔',2,2)
...@@ -11,15 +16,5 @@ print('后裔血量:',h2.hp) ...@@ -11,15 +16,5 @@ print('后裔血量:',h2.hp)
h3=Hero('小灰灰',200,200) h3=Hero('小灰灰',200,200)
print('小灰灰血量:',h3.hp) print('小灰灰血量:',h3.hp)
def AddH1Level(): h3.AddHeroLevel()
h1.level=h1.level+1 print('小灰灰升级后血量:',h3.hp)
h1.dps=h1.dps*2 \ No newline at end of file
h1.hp=h1.hp*2
def AddH2Level():
h2.level=h2.level+1
h2.dps=h2.dps*2
h2.hp=h2.hp*2
def AddH3Level():
h3.level=h3.level+1
h3.dps=h3.dps*2
h3.hp=h3.hp*2
\ 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