Commit 0b6bb901 by BellCodeEditor

save project

parent 8f8774c1
Showing with 15 additions and 4 deletions
......@@ -2,13 +2,23 @@
class Hero:
def __init__(self, name):
self.level = 1
self.hp = 250
self.hp = 300
self.attack = 40
self.name = name
def combat(): # 攻击
???
self.max_hp=self.hp
def cure():
self.hp+=60
if self.hp>self.max_hp:
self.hp=self.max_hp
print(self.name,"用了治疗术,血量增加",60,"当前血量为",self.hp)
def combat(): # 攻击
class player(Hero):
def __init__(self,name):
super().__init__(name)
self.hp=250
self.attack=50
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ 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