Commit ac4bf4bb by BellCodeEditor

save project

parent 9a581ef4
Showing with 45 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack,defense):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
self.defense = defense
# self.speed = speed
# self.SA = SA
# self.SD = SD
# ,speed,SA,SD,skill
def combat(self,enemy):
enemy.hp - self.attack
info1 = self.name + '对' +enemy.name + '发动了抓击!'
info2 = enemy.name + '收到了' + str(self.attack - enemy.defense*0.2) + '点伤害!'
enemy.hp -= self.attack - enemy.defense*0.2
if enemy.hp > 0:
info3 = enemy.name+'剩余'+str(enemy.hp)+'血量!'
info = info1 + info2 + info3
print(info)
else:
info3 = enemy.name+'的hp不足,进入濒死状态'+self.name+'胜利'
a = Hero('亚瑟',300,25,30)
b = Hero('后羿',250,30,25)
a.combat(b)
# a = Pokemon('妙蛙种子',45,49,49,45,65,65,'寄生种子')
# b = Pokemon('小火龙',39,52,43,65,60,50,'火花')
# c = Pokemon('杰尼龟',44,48,65,50,64,43,'水沫')
# a.upgrade()
# b.upgrade()
# c.upgrade()
# def upgrade(self):
# self.level = self.level+1
# self.hp = self.hp+self.hp*0.3
# self.attack = self.attack+self.attack*0.2
# self.defense = self.defense+self.defense*0.2
# self.speed = self.speed+self.speed*0.2
# self.SA = self.SA+self.SA*0.3
# self.SD = self.SD+self.SD*0.3
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