Commit b7485648 by BellCodeEditor

save project

parent 156f57fc
Showing with 53 additions and 0 deletions
class Cat:
def __init__(self):
self.footNum = 4 # 腿
self.eyeNum = 2 # 眼睛
self.head = 1 # 头
self.earsNum = 2 # 耳朵
self.skin = "black"
def run(self):
print("小猫飞快的跑起来")
def skill():
??
role = Cat()
role.skill("老鼠")
\ No newline at end of file
class Hero(object):
def __init__(self, name):
self.name = name
self.level = 1
self.hp = 350
self.attack = 88
self.max_hp = self.hp
def combat(self,enemy): # 攻击
info1 = self.name + '对' + enemy.name + '发起攻击,'
info2 = '造成' + str(self.attack) + '真实伤害,'
enemy.hp -= self.attack
if enemy.hp <= 0:
info3 = enemy.name + '阵亡'
else:
info3 = enemy.name + '还剩下' + str(enemy.hp) + '点生命值'
print(info1 + info2 + info3)
class player(Hero):
def __init__(self, name):
super().__init__(name)
self.hp = 200
self.attack = 110
self.h_t = h_t
player = player ('后羿','射手')
print('角色'+self.name+'创建成功,英雄类型为:',self.h_t)
print('当前等级,攻击力,血量为:',self.level,self.attack,self.hp)
h = player ('后羿','射手')
y = 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