战场经验
This commit is contained in:
parent
0f2a085877
commit
5328e6dc7c
@ -895,7 +895,13 @@ function BattleUnitComp:takeDamageOrCure(atker, buff, num, effectType, effectSta
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
local shieldHpBefore = self.unitEntity:getShieldHp()
|
local shieldHpBefore = self.unitEntity:getShieldHp()
|
||||||
self.unitEntity:takeDamageOrCure(num)
|
local hpRealReduce = self.unitEntity:takeDamageOrCure(num)
|
||||||
|
if hpRealReduce < 0 and self.side == BattleConst.SIDE_DEF then -- 实际掉血了
|
||||||
|
local exp = self.unitEntity:getExp()
|
||||||
|
if exp > 0 then
|
||||||
|
self.battleController:addBattleExp(math.floor(exp/self.unitEntity:getMaxHp()*-hpRealReduce))
|
||||||
|
end
|
||||||
|
end
|
||||||
local shieldHpDiff = self.unitEntity:getShieldHp() - shieldHpBefore
|
local shieldHpDiff = self.unitEntity:getShieldHp() - shieldHpBefore
|
||||||
if shieldHpDiff < 0 then -- 说明护盾减少了
|
if shieldHpDiff < 0 then -- 说明护盾减少了
|
||||||
self:handleShield(shieldHpDiff, self)
|
self:handleShield(shieldHpDiff, self)
|
||||||
|
|||||||
@ -416,6 +416,7 @@ function BattleData:addMonster(monsterId, newTeam)
|
|||||||
normalSkillCount = monsterInfo.hurt_num,
|
normalSkillCount = monsterInfo.hurt_num,
|
||||||
assistingSkill = nil,
|
assistingSkill = nil,
|
||||||
isBoss = monsterInfo.is_boss,
|
isBoss = monsterInfo.is_boss,
|
||||||
|
exp = monsterInfo.monster_exp or 0,
|
||||||
attr = {
|
attr = {
|
||||||
hp = hp,
|
hp = hp,
|
||||||
max_hp = hp,
|
max_hp = hp,
|
||||||
|
|||||||
@ -129,6 +129,10 @@ function BattleTeamEntity:getHp()
|
|||||||
return self.attr.hp
|
return self.attr.hp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeamEntity:getMaxHp()
|
||||||
|
return self.attr.max_hp
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeamEntity:getHpPercent()
|
function BattleTeamEntity:getHpPercent()
|
||||||
return self.attr.hp / self.attr.max_hp
|
return self.attr.hp / self.attr.max_hp
|
||||||
end
|
end
|
||||||
@ -216,7 +220,7 @@ function BattleTeamEntity:takeDamageOrCure(num)
|
|||||||
hurtEventNum = num
|
hurtEventNum = num
|
||||||
else -- 满血了
|
else -- 满血了
|
||||||
-- 这是加血
|
-- 这是加血
|
||||||
hurtEventNum = 0
|
hurtEventNum = self.attr.max_hp - hpBefore
|
||||||
self.attr.hp = self.attr.max_hp
|
self.attr.hp = self.attr.max_hp
|
||||||
end
|
end
|
||||||
return hurtEventNum
|
return hurtEventNum
|
||||||
|
|||||||
@ -177,6 +177,10 @@ function BattleUnitEntity:getHp()
|
|||||||
return self.team:getHp()
|
return self.team:getHp()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getMaxHp()
|
||||||
|
return self.team:getMaxHp()
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitEntity:getHpPercent()
|
function BattleUnitEntity:getHpPercent()
|
||||||
return self.team:getHpPercent()
|
return self.team:getHpPercent()
|
||||||
end
|
end
|
||||||
@ -237,6 +241,10 @@ function BattleUnitEntity:getBlock()
|
|||||||
return self.team:getBlock()
|
return self.team:getBlock()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUnitEntity:getExp()
|
||||||
|
return self.unitData.exp
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUnitEntity:addSkillExtraUseTimes(skillId, count)
|
function BattleUnitEntity:addSkillExtraUseTimes(skillId, count)
|
||||||
if self.skillExtraUseTimes == nil then
|
if self.skillExtraUseTimes == nil then
|
||||||
self.skillExtraUseTimes = {}
|
self.skillExtraUseTimes = {}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user