Commit e948f0a3 by BellCodeEditor

save project

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