Commit 0fb50f79 by BellCodeEditor

save project

parent e9add8d7
Showing with 12 additions and 5 deletions
...@@ -4,7 +4,10 @@ class Hero(object): ...@@ -4,7 +4,10 @@ class Hero(object):
self.level = 1 self.level = 1
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.name = name self.max_hp = self.hp
def cure(self):
c=randm
def combat(self,a): # 攻击 def combat(self,a): # 攻击
a.hp=a.hp-self.attack a.hp=a.hp-self.attack
...@@ -18,6 +21,10 @@ class Hero(object): ...@@ -18,6 +21,10 @@ class Hero(object):
b3=a.name+'已阵亡,游戏结束' b3=a.name+'已阵亡,游戏结束'
b=b1+b2+b3 b=b1+b2+b3
print(b) print(b)
yase = Hero("垭瑟")
houyi= Hero("后羿") class Player(Hero)
yase.combat(houyi) def __init__(self,name,type):
\ No newline at end of file super().__init__(name)
self.hp = 200
self.attack = 50
self.max_hp = self.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