Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

bellcode / lesson12-1

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 0b46145d authored 4 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent c7b75db0
Hide whitespace changes
Inline Side-by-side
Showing with 7 additions and 7 deletions
  • 2-16-diy4治疗术优化.py
2-16-diy4治疗术优化.py
View file @ 0b46145d
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:
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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