Commit 47ec639b by BellCodeEditor

save project

parent 9a581ef4
Showing with 18 additions and 3 deletions
......@@ -6,9 +6,23 @@ class Hero(object):
self.attack = 40
self.name = name
def combat(): # 攻击
???
def combat(self,emt): # 攻击
emt.hp-=self.attack
ou1=str(emt.name)+'被'+str(self.name)+'打掉了'+str(self.attack)+'的血量,'
ou2='还剩'+str(emt.hp)+'的血量。'
ou3=str(emt.name)+'已阵亡。'
if emt.hp>0:
print(ou1+ou2)
else:
print(ou1+ou3)
exit()
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
yase.combat(houyi)
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