Commit 0233c79b by BellCodeEditor

auto save

parent cfcd7a9a
Showing with 19 additions and 12 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(): # 攻击
???
yase = Hero("垭瑟")
houyi= Hero("后羿")
class Hero:
def __init__(self,name,hp,attack):
self.Name=name
self.Level=1
self.Hp=hp
self.Attack=attack
def Hup(self,a):
self.Attack+=5*a
self.Hp+=50*a
self.Level+=1*a
def combat(self,enemy):
enemy.Hp-=self.Attack
info1=self.Name+'对'+enemy.Name+'发起了进攻'
info2='造成'+str(self.Attack)+'的伤害'
if enemy.Hp>0:
info3=enemy.Name+str(enemy.Hp)+'血量'
H=Hero('亚瑟',100,100)
D=Hero('后羿',55,90)
yase.combat(houyi)
\ 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