Commit bc8dd11e by BellCodeEditor

save project

parent 9a581ef4
Showing with 22 additions and 7 deletions
......@@ -3,12 +3,27 @@ class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.san = 40
self.name = name
def combat(): # 攻击
???
def combat(self,enemy):
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
enemy.hp-=self.san
info1=self.name+"对"+enemy.name+"大喊:让我看看!"
info2=enemy.name+"受到"+str(self.san)+"点精神攻击"
if enemy.hp>0:
info3=enemy.name+"还剩"+str(enemy.hp)+"点san值"
info=info1+info2+info3
print(info)
else:
info3=enemy.name+"被"+self.name+"看看了"
info=info1+info2+info3
print(info)
exit()
# 攻击
jiege = Hero("杰哥")
binbin = Hero("彬彬")
jiege.combat(binbin)
\ 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