经验加成

This commit is contained in:
chenxi 2023-04-25 10:29:17 +08:00
parent 5bdf637e03
commit 5c4d0bf6b7
3 changed files with 14 additions and 1 deletions

View File

@ -1147,7 +1147,12 @@ function BattleUnitComp:takeDamageOrCure(atker, num, effectType, effectStatus)
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))
local expTime = atker.unitEntity:getExpTime()
local addExp = math.floor(exp/self.unitEntity:getMaxHp()*-hpRealReduce)
if expTime > 0 then
addExp = addExp * (DEFAULT_FACTOR + expTime) // DEFAULT_FACTOR
end
self.battleController:addBattleExp(addExp)
end
end
local shieldHpDiff = self.unitEntity:getShieldHp() - shieldHpBefore

View File

@ -169,6 +169,10 @@ function BattleTeamEntity:getNormalAttackAddCount()
return self.attr[ATTR_NAME.NORMAL_ATTACK_COUNT] or 0
end
function BattleTeamEntity:getExpTime()
return self.attr.exp_time or 0
end
function BattleTeamEntity:addMaxHp(num)
local hpBefore = self.attr.hp
local currPercent = hpBefore * DEFAULT_FACTOR // self.attr.max_hp

View File

@ -318,6 +318,10 @@ function BattleUnitEntity:getExp()
return self.unitData.exp
end
function BattleUnitEntity:getExpTime()
return self.team:getExpTime()
end
function BattleUnitEntity:getIsDead()
return self.team:getIsDead()
end