Commit 4daabbb5 by BellCodeEditor

save project

parent 92f4d88e
Showing with 17 additions and 2 deletions
...@@ -4,7 +4,21 @@ class Hero(): ...@@ -4,7 +4,21 @@ class Hero():
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
self.level = level self.level = level
yase=Hero("亚瑟",300,20,14) yase=Hero("亚瑟",300,20,1)
houyi=Hero("后羿",260,24,14) def upgrade():
yase.level = yase.level+1
yase.hp = yase.hp+50
yase.attack = yase.attack+30
upgrade()
upgrade()
houyi=Hero("后羿",260,24,1)
def npgrade():
houyi.level = houyi.level+1
houyi.hp = houyi.hp+25
houyi.attack = houyi.attack+55
npgrade()
npgrade()
npgrade()
npgrade()
print("亚瑟血量为:",yase.hp) print("亚瑟血量为:",yase.hp)
print("后羿血量为:",houyi.hp) print("后羿血量为:",houyi.hp)
\ 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