Commit 700b0a9c by BellCodeEditor

save project

parent e77c00d5
Showing with 11 additions and 0 deletions
......@@ -4,6 +4,7 @@ class Hero:
self.hp=250
self.attack=40
self.name=name
self.max_hp=self.hp
def combat(self,enemy):
info1=self.name+"对"+enemy.name+"发起进攻"
info2="造成"+str(self.attack)+"点伤害"
......@@ -17,6 +18,15 @@ class Hero:
info=ifo1+info2+info3
print(info)
exit()
class Player(Hero):
def __init__(self,name):
super().__init__(name)
self.hp=200
self.attack=50
player=Player("后裔")
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