Commit a5bcc96e by BellCodeEditor

auto save

parent 9a581ef4
Showing with 19 additions and 2 deletions
......@@ -6,8 +6,23 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
class player(Hero):
def __init__(self,name):
super().__init__(name)
self.hp = 1
self.attack = 1
def combat(self,beigonji): # 攻击
beigonji.hp=beigonji.hp-self.attack
info1=self.name+"对"+beigonji.name+"发起了攻击!"
info2="造成"+str(self.attack)+"伤害!"
info3="剩余血量"+str(beigonji.hp)
info=info1+info2+info3
print(info)
yase = Hero("垭瑟")
houyi= Hero("后羿")
......
print("度过的时光防御高的")
\ 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