Commit 311a5018 by BellCodeEditor

save project

parent 5f43c146
Showing with 20 additions and 11 deletions
......@@ -4,15 +4,24 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
yase=Hero('亚瑟',3648,224)
houyi=Hero('后羿',2674,276)
print(yase.hp)
print(houyi.hp)
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+500
yase.attack=yase.attack+80
upgrade()
print(yase.hp)
print(houyi.hp)
def upgrade(self):
self.level=self.level+1
self.hp=self.hp*1.2
self.attack=self.attack*1.2
yase=Hero('亚瑟',3600,224)
houyi=Hero('后羿',2600,276)
print('亚瑟的等级是',yase.level)
print('亚瑟的血量是',yase.hp)
print('亚瑟的攻击是',yase.attack)
print('后羿的等级是',houyi.level)
print('后羿的血量是',houyi.hp)
print('后羿的攻击是',houyi.attack)
yase.upgrade()
houyi.upgrade()
print('亚瑟的等级是',yase.level)
print('亚瑟的血量是',yase.hp)
print('亚瑟的攻击是',yase.attack)
print('后羿的等级是',houyi.level)
print('后羿的血量是',houyi.hp)
print('后羿的攻击是',houyi.attack)
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