Ajout des derniers développement #1

Merged
kazhnuz merged 68 commits from chronicles-cbs into master 2020-08-02 11:14:18 +02:00
2 changed files with 46 additions and 28 deletions
Showing only changes of commit 6c409cc1ba - Show all commits

View file

@ -0,0 +1,32 @@
local StatsUtils = {}
local CONST = {}
CONST.EXP_MULTIPLICATOR = 4
CONST.EXP_RATIO = 5
CONST.BASE_STAT = 5
CONST.BASE_HP = 15
CONST.BASE_MP = 8
CONST.MULT_STAT = 2
CONST.MULT_HP = 2.7
CONST.MULT_MP = 1.5
function StatsUtils.getExpValue(level)
return math.floor( ( CONST.EXP_MULTIPLICATOR * ( level ^ 3 ) ) / CONST.EXP_RATIO )
end
function StatsUtils.getStatValue(level, base)
return math.floor( (((base * CONST.MULT_STAT) * level)/100) ) + CONST.BASE_STAT
end
function StatsUtils.getHPValue(level, base)
return math.floor( (((base * CONST.MULT_HP) * level)/100) ) + CONST.BASE_HP + level
end
function StatsUtils.getPPValue(level, base)
return math.floor( (((base * CONST.MULT_MP) * level)/100) ) + CONST.BASE_MP
end
return StatsUtils

View file

@ -24,6 +24,8 @@
local CharacterManager = Object:extend()
local statsutils = require "game.abstractmobs.utils"
function CharacterManager:new(controller)
self.controller = controller
self.namelist = require "datas.gamedata.characters"
@ -59,8 +61,8 @@ function CharacterManager:initCharacter(id)
local character = self:getCharacterData(id)
stats.level = character.startlevel
stats.exp = self:getExpValue(stats.level)
stats.exp_next = self:getExpValue(stats.level + 1)
stats.exp = statsutils.getExpValue(stats.level)
stats.exp_next = statsutils.getExpValue(stats.level + 1)
stats.hpmax = character.base_stats.hpmax
stats.ppmax = character.base_stats.ppmax
stats.attack = character.base_stats.attack
@ -83,16 +85,12 @@ function CharacterManager:initCharacter(id)
self.list[id] = character
end
function CharacterManager:getExpValue(level)
return math.floor( ( 4 * ( level ^ 3 ) ) / 5 )
end
function CharacterManager:setLevel(id, newlevel)
self.list[id].stats.level = newlevel
local stats = self.list[id].stats
local exp, exp_next, exp_current
exp = self:getExpValue(stats.level)
exp_next = self:getExpValue(stats.level + 1)
exp = statsutils.getExpValue(stats.level)
exp_next = statsutils.getExpValue(stats.level + 1)
exp_current = self.list[id].stats.exp
self.list[id].stats.exp = math.max(math.min(exp_current, exp_next - 1), exp)
@ -105,31 +103,19 @@ function CharacterManager:levelUp(id)
self:setLevel(id, self.list[id].stats.level + 1)
end
function CharacterManager:getStatValue(level, base)
return math.floor( (((base * 2) * level)/100) ) + 5
end
function CharacterManager:getHPValue(level, base)
return math.floor( (((base * 2.7) * level)/100) ) + 15 + level
end
function CharacterManager:getPPValue(level, base)
return math.floor( (((base * 1.5) * level)/100) ) + 8
end
function CharacterManager:recalculateStats(id)
local character = self.list[id]
local stats = character.stats
local base_stats = character.base_stats
stats.hpmax = self:getHPValue(stats.level, base_stats.hpmax)
stats.ppmax = self:getPPValue(stats.level, base_stats.ppmax)
stats.attack = self:getStatValue(stats.level, base_stats.attack)
stats.power = self:getStatValue(stats.level, base_stats.power)
stats.defense = self:getStatValue(stats.level, base_stats.defense)
stats.mind = self:getStatValue(stats.level, base_stats.mind)
stats.technic = self:getStatValue(stats.level, base_stats.technic)
stats.speed = self:getStatValue(stats.level, base_stats.speed)
stats.hpmax = statsutils.getHPValue(stats.level, base_stats.hpmax)
stats.ppmax = statsutils.getPPValue(stats.level, base_stats.ppmax)
stats.attack = statsutils.getStatValue(stats.level, base_stats.attack)
stats.power = statsutils.getStatValue(stats.level, base_stats.power)
stats.defense = statsutils.getStatValue(stats.level, base_stats.defense)
stats.mind = statsutils.getStatValue(stats.level, base_stats.mind)
stats.technic = statsutils.getStatValue(stats.level, base_stats.technic)
stats.speed = statsutils.getStatValue(stats.level, base_stats.speed)
end
function CharacterManager:getSkillList(id)