Commit 2816015f by BellCodeEditor

save project

parent 9a581ef4
Showing with 16 additions and 5 deletions
...@@ -6,9 +6,19 @@ class Hero(object): ...@@ -6,9 +6,19 @@ class Hero(object):
self.attack = 40 self.attack = 40
self.name = name self.name = name
def combat(): # 攻击 def combat(self,dnd): # 攻击
??? dnd.hp-=self.attack
p1=self.name+'对'+dnd.name+'发起袭击'
yase = Hero("垭瑟") p2='造成'+str(self.attack)+'点绳命损失'
houyi= Hero("后羿") if dnd.hp>0:
p3=dnd.name+'剩余'+str(dnd.hp)+'点绳命'
p=p1+p2+p3
print(p)
else:
p3=dnd.name+'已嗝屁'
p=p1+p2+p3
print(p)
exit()
csj = Hero("穿山甲")
kk= Hero("练习时长两年半的坤坤")
yase.combat(houyi) 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