Commit d8200ee5 by BellCodeEditor

auto save

parent 333183d9
Showing with 34 additions and 0 deletions
import random
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(self,duifang): # 攻击
duifang.hp-=self.attack
if duifang.hp>0:
print(self.name+"对"+duifang.name+"发起攻击,"+duifang.name+"减少"+str(self.attack)+"血量,"+duifang.name+"还剩"+str(duifang.hp)+"血量")
else:
print(duifang.name+"已阵亡,游戏结束")
print("You Win")
exit()
def zhiliao(self):
if self.hp<250:
self.hp+=40
else:
print("血量已满,加血无效!")
class computer(Hero):
def __init__(name):
super().__init__(name):
self.hp = 200
self.attack = 60
while True:
a=input("你要使用什么技能?(1回血/2攻击)")
yase = Hero("垭瑟")
houyi= Hero("后羿")
\ 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