feat: add inbattle stats bonus
This commit is contained in:
parent
109ed7c9b2
commit
295f98ebd9
2 changed files with 22 additions and 1 deletions
|
@ -70,4 +70,6 @@ createBattleStat("ppregen", 10)
|
||||||
|
|
||||||
CONST.ARMOR_AND_DAMAGE_RATIO = .5
|
CONST.ARMOR_AND_DAMAGE_RATIO = .5
|
||||||
|
|
||||||
|
CONST.BONUS = {0.75, 0.8125, 0.875, 0.9375, 1, 1.125, 1.25, 1.375, 1.5}
|
||||||
|
|
||||||
return CONST
|
return CONST
|
||||||
|
|
|
@ -23,6 +23,7 @@ function FighterParent:new(owner, isHero, id)
|
||||||
self.isDefending = false
|
self.isDefending = false
|
||||||
|
|
||||||
self.action = nil
|
self.action = nil
|
||||||
|
self.statsBonus = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- LIFE handling functions
|
-- LIFE handling functions
|
||||||
|
@ -163,7 +164,25 @@ function FighterParent:getNbrActionPerTurn()
|
||||||
end
|
end
|
||||||
|
|
||||||
function FighterParent:getStat(statname)
|
function FighterParent:getStat(statname)
|
||||||
return self.abstract.stats:get(statname)
|
local stat = (self.abstract.stats:get(statname) * self:getStatBonusValue(statname))
|
||||||
|
print(statname, stat)
|
||||||
|
return stat
|
||||||
|
end
|
||||||
|
|
||||||
|
function FighterParent:getStatBonusValue(statname)
|
||||||
|
return STATS.BONUS[self:getStatBonus(statname) + 5]
|
||||||
|
end
|
||||||
|
|
||||||
|
function FighterParent:getStatBonus(statname)
|
||||||
|
return self.statsBonus[statname] or 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function FighterParent:setStatBonus(statname, value, relative)
|
||||||
|
local statBonus = 0
|
||||||
|
if (relative) then
|
||||||
|
statBonus = self:getStatBonus(statname)
|
||||||
|
end
|
||||||
|
self.statsBonus[statname] = math.max(-4, math.min(statBonus + value, 4))
|
||||||
end
|
end
|
||||||
|
|
||||||
function FighterParent:getStats()
|
function FighterParent:getStats()
|
||||||
|
|
Loading…
Reference in a new issue