Commit 0b46145d by BellCodeEditor

save project

parent c7b75db0
Showing with 7 additions and 7 deletions
import random
import random
......@@ -5,8 +5,8 @@ class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 250
self.attack = 40
self.hp = 10000
self.attack = 5
self.max_hp = self.hp
def cure(self): # 治疗
......@@ -32,15 +32,15 @@ class Hero(object):
class Player(Hero):
def __init__(self,hero_type,name):
super().__init__(name)
self.hp = 200
self.attack = 50
self.hp = 50
self.attack = 400
self.max_hp = self.hp
self.hero_type = hero_type
print("角色"+self.name+"创建成功,英雄类型为:", self.hero_type)
print("当前等级、血量、攻击力分别为:",self.level,self.hp,self.attack)
def cure(self): # 治疗
blood = random.randint(20,80)
blood = random.randint(30,70)
self.hp = self.hp + blood
if self.hp > self.max_hp:
self.hp = self.max_hp
......@@ -66,7 +66,7 @@ while True:
print("请重新输入1或者2")
continue
# 敌方攻击
status = random.randint(1, 3)
status = random.randint(1, 4)
if status == 1:
yase.cure()
else:
......
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