Commit e948f0a3 by BellCodeEditor

save project

parent c75a45e6
Showing with 11 additions and 11 deletions
...@@ -4,13 +4,13 @@ class Hero: ...@@ -4,13 +4,13 @@ class Hero:
self.name=name self.name=name
self.HP=HP self.HP=HP
self.attack=attack self.attack=attack
def upgrade(): def upgrade(self):
yase.level=yase.level+1 self.level=self.level+1
yase.HP=yase.HP*2-yase.HP/4 self.HP=self.HP*2-self.HP/4
yase.attack=yase.attack*4-yase.attack/2 self.attack=self.attack*4-self.attack/2
yase=Hero('亚瑟',300,20) kai=Hero('凯',170,40)
print("亚瑟初始攻击:",yase.attack) print("凯初始攻击:",kai.attack)
upgrade() kai.upgrade()
print("亚瑟升级一次攻击:",yase.attack) print("凯升级一次攻击:",kai.attack)
upgrade() kai.upgrade()
print("亚瑟升级二次攻击:",yase.attack) print("凯升级二次攻击:",kai.attack)
\ No newline at end of file \ 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