Commit 4df47e89 by BellCodeEditor

save project

parent 095cbe6b
Showing with 9 additions and 5 deletions
...@@ -4,11 +4,15 @@ class Hero(): ...@@ -4,11 +4,15 @@ class Hero():
self.name = name self.name = name
self.hp = hp self.hp = hp
self.att = att self.att = att
def up(self): def zhandou(self,diren):
diren.hp -= self.att
print(f'{self.name}对{diren.name}发起进攻。')
print(f'{diren.name}HP剩余{diren.hp}')
if diren.hp <= 0:
# def up(self):
self.lv += 1 self.lv += 1
self.hp += 50 self.hp += 50
self.att += 5 self.att += 5
yase = Hero("亚瑟",300,20) yase = Hero("亚瑟",300,20)
print(yase.hp) houyi = Hero("后羿",200,30)
yase.up() \ No newline at end of file
print(yase.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