Compare commits

..

10 commits

Author SHA1 Message Date
Kazhnuz
5be98ee175 feat: ajout tests initiaux 2024-08-10 19:50:13 +02:00
Kazhnuz
13df70437a feat: ajout du lvlup des armes et armures 2024-08-10 19:32:28 +02:00
Kazhnuz
856df9d32f fix: correction du remplacement dans les listes 2024-08-09 12:28:30 +02:00
Kazhnuz
42ca9a48ca fix: corrections canides 2024-08-08 20:18:27 +02:00
Kazhnuz
8b6141146c feat: ajout de plusieurs canidés 2024-08-07 19:57:34 +02:00
Kazhnuz
c5d6deee85 fix: correction du statholder 2024-08-07 19:57:11 +02:00
Kazhnuz
9a6eb606c0 feat: ajout des pallier de competences 2024-08-07 19:57:02 +02:00
Kazhnuz
d916bbc15a fix: petite amelioration des canides 2024-08-07 19:56:49 +02:00
Kazhnuz
e77ee1719f feat: split loup en une base et un fichier de creature 2024-08-07 07:23:08 +02:00
Kazhnuz
55172401dd feat(statholder): ajout des valeurs mins/max 2024-08-07 07:20:34 +02:00
27 changed files with 343 additions and 54 deletions

View file

@ -0,0 +1,46 @@
local ArmesHolder = Object:extend()
local function applyBoost(level, mode, value)
return math.floor(value * boosts.getBoost(level, mode))
end
function ArmesHolder:new(key, datas)
self.key = key
self.datas = datas
self.list = {}
end
function ArmesHolder:applyCommand(command, args)
if (command == "") then
self:add(args)
elseif (command == "reset") then
self:reset()
elseif (command == "replace") then
self:replace(args)
end
end
function ArmesHolder:reset()
self.list = {}
end
function ArmesHolder:add(datas)
table.insert(self.list, {nom = datas[1], force = tonumber(datas[2]) or "0"})
end
function ArmesHolder:replace(datas)
for index, args in ipairs(self.list) do
if (args.nom == datas[1]) then
self.list[index] = {nom = datas[1], force = tonumber(datas[2] or "0")}
end
end
end
function ArmesHolder:reduce(level, mode)
for key, value in pairs(self.list) do
value.force = applyBoost(level, mode, value.force)
end
return self.list
end
return ArmesHolder

View file

@ -0,0 +1,28 @@
local ArmureHolder = Object:extend()
function ArmureHolder:new(key, datas)
self.key = key
self.datas = datas
self.commands = {}
end
function ArmureHolder:applyCommand(command, args)
self.commands[command] = args
end
function ArmureHolder:reduce(level, mode)
local stat = self:getBase(level, mode) + ((self.commands.lvl or 0) * level) + (self.commands.add or 0) + (self.commands.bonus or 0)
local modulo = commands.structs[self.key].modulo or 1
datas = commands.structs[self.key]
stat = math.floor(stat / modulo) * modulo
stat = math.min(stat, datas.max or 999999)
stat = math.max(stat, datas.min or -99999)
return stat
end
function ArmureHolder:getBase(level, mode)
return math.floor(self.commands.base * boosts.getBoost(level, mode))
end
return ArmureHolder

View file

@ -10,9 +10,11 @@ function Competence:new(name)
end
function Competence:reduce(level)
local baseValue = self.base + (self.lvl * level) + self.bonus + self.add
return {
name = self.name,
value = self.base + (self.lvl * level) + self.bonus + self.add
value = math.floor(baseValue / 5) * 5
}
end

View file

@ -27,7 +27,7 @@ end
function ListHolder:replace(datas)
for index, args in ipairs(self.list) do
if (args[1] == datas[1]) then
self.list[index] = args
self.list[index] = datas
end
end
end

View file

@ -10,10 +10,13 @@ function StatHolder:applyCommand(command, args)
self.commands[command] = args
end
function StatHolder:reduce(level)
function StatHolder:reduce(level, mode)
local stat = self.commands.base + ((self.commands.lvl or 0) * level) + (self.commands.add or 0) + (self.commands.bonus or 0)
local modulo = commands.structs[self.key].modulo or 1
datas = commands.structs[self.key]
stat = math.floor(stat / modulo) * modulo
stat = math.min(stat, datas.max or 999999)
stat = math.max(stat, datas.min or -99999)
return stat
end

View file

@ -5,6 +5,8 @@ local ListHolder = require "classes.dataholders.listholder"
local SimpleHolder = require "classes.dataholders.simpleholder"
local StatHolder = require "classes.dataholders.statholder"
local CompetenceHolder = require "classes.dataholders.competenceholder"
local ArmesHolder = require "classes.dataholders.armesholder"
local ArmureHolder = require "classes.dataholders.armureholder"
function RawData.fromLine(line)
line = utils.removeComment(line)
@ -56,6 +58,10 @@ function DataList.getHolder(key, value)
return CompetenceHolder(key, value)
elseif (value.dataType == "stat") then
return StatHolder(key, value)
elseif (value.dataType == "armure") then
return ArmureHolder(key, value)
elseif (value.dataType == "armes") then
return ArmesHolder(key, value)
end
return SimpleHolder(key, value)
end
@ -79,12 +85,17 @@ end
function DataList:reduce()
local level = 0
local mode = "creature"
for _, rawdata in ipairs(self.list) do
if (rawdata.name == "level") then
level = rawdata.arguments
end
if (rawdata.name == "mode") then
mode = rawdata.arguments
end
end
if (self.forceLevel ~= nil) then
level = self.forceLevel
end
@ -97,7 +108,7 @@ function DataList:reduce()
for key, holder in pairs(self.holders) do
--self.reducedList[key] = holder:reduce(level)
self:addToReducedList(key, holder:reduce(level))
self:addToReducedList(key, holder:reduce(level, mode))
end
if (self.forceLevel ~= nil) then

3
data/animaux/chien.beast Normal file
View file

@ -0,0 +1,3 @@
mixins;generique/canides
name;Chien // nom de la créature

View file

@ -0,0 +1,3 @@
mixins;generique/canides
name;Chien-Loup // nom de la créature
level;2

View file

@ -1,43 +1,3 @@
mixins;generique/canides
name;Loup
level;4
type;bete
atk.base;50
hab.base;70
int.base;35
sag.base;40
vol.base;60
cha.base;60
dis.base;60
per.base;70
atk.lvl;4
hab.lvl;5
dis.lvl;3
con.lvl;3
pv.lvl;5
pe.lvl;1
armurephy.base;3 | 5
armurepsy.base;0 | 5
armurespe.base;1 | 5
armurephy.base;6 | 10
armurepsy.base;1 | 10
armurespe.base;2 | 10
armurephy.base;9 | 15
armurepsy.base;2 | 15
armurespe.base;3 | 15
competence;Chasse;10;
competence.lvl;Chasse;5;
competence;Pistage;10;
competence.lvl;Pistage;5;
armes;Griffe;2;
armes;Croc;3;
skill;Morsure;Une attaque qui utilise les crocs et fait 1 blessure;
skill;Griffure;Fait deux attaques à -30% de chance d'échouer;
level;5

View file

@ -0,0 +1,5 @@
mixins;animaux/loup
name;Loup en Chef // nom de la créature
level;6
skill;Chef de meute;Peut ajouter +1 dégat brut à une attaque par loup présent, mais perdra 50% pour esquiver et encaisser au tour suivant. Cinq tours de cooldown;

View file

@ -0,0 +1,16 @@
atk.base;60
con.base;50
hab.base;50
int.base;30
sag.base;30
vol.base;50
cha.base;50
dis.base;50
rel.base;60
per.base;50
pv.base;12
pe.base;12

View file

@ -0,0 +1,16 @@
atk.base;65
con.base;65
hab.base;70
int.base;15
sag.base;30
vol.base;30
cha.base;60
dis.base;60
rel.base;40
per.base;70
pv.base;18
pe.base;9

View file

@ -0,0 +1,16 @@
atk.base;60
con.base;55
hab.base;65
int.base;15
sag.base;30
vol.base;30
cha.base;60
dis.base;70
rel.base;20
per.base;70
pv.base;15
pe.base;9

View file

@ -0,0 +1,16 @@
atk.base;60
con.base;30
hab.base;70
int.base;15
sag.base;30
vol.base;30
cha.base;50
dis.base;50
rel.base;40
per.base;65
pv.base;15
pe.base;9

View file

@ -0,0 +1,8 @@
// Créature grande (ours)
atk.bonus;15
con.bonus;15
hab.bonus;-15
per.bonus;-15
pv.bonus;3;
armurephy.bonus;1;

View file

@ -0,0 +1,10 @@
// Créature minuscule (insecte)
atk.bonus;-30
con.bonus;-30
hab.bonus;30
per.bonus;30
pv.bonus;0;
pv.base;1;
pv.lvl;0;
armurephy.bonus;-1;

View file

@ -0,0 +1,8 @@
// Créature petite (chat à chien)
atk.bonus;-15
con.bonus;-15
hab.bonus;15
per.bonus;15
pv.bonus;-3;
armurephy.bonus;-1;

View file

@ -0,0 +1,8 @@
// Créature très grande (rhino / éléphant)
atk.bonus;25
con.bonus;25
hab.bonus;-25
per.bonus;-25
pv.bonus;6;
armurephy.bonus;2;

View file

@ -0,0 +1,8 @@
// Créature très petite (rat, etc)
atk.bonus;-25
con.bonus;-25
hab.bonus;25
per.bonus;25
pv.bonus;-6;
armurephy.bonus;-1;

View file

@ -0,0 +1,28 @@
type;bete
mixins;bases/corps/quadripede
// 10~11 points de stats à distribuer par niveaux
atk.lvl;3
hab.lvl;2
dis.lvl;1
con.lvl;3
int.lvl;1
pv.lvl;4
pe.lvl;2
armurephy.base;2
armurepsy.base;0
armurespe.base;1
competence;Chasse;10;
competence.lvl;Chasse;3;
competence;Pistage;10;
competence.lvl;Pistage;3;
armes;Griffe;3;
armes;Croc;4;
skill;Morsure;Une attaque qui utilise les crocs et fait 1 blessure;
skill;Griffure;Fait deux attaques à -30% de chance de toucher;
skill;Bêtes de meute;+5% pour toucher des zones difficiles par créature de meute présente;

View file

@ -0,0 +1,27 @@
type;bete
mixins;bases/corps/quadripede
// 10~11 points de stats à distribuer par niveaux
atk.lvl;2
hab.lvl;3
dis.lvl;3
con.lvl;1
int.lvl;2
pv.lvl;4
pe.lvl;2
armurephy.base;1
armurepsy.base;0
armurespe.base;1
competence;Chasse;10;
competence.lvl;Chasse;3;
competence;Pistage;10;
competence.lvl;Pistage;3;
armes;Griffe;3;
armes;Croc;4;
skill;Morsure;Une attaque qui utilise les crocs et fait 1 blessure;
skill;Griffure;Fait deux attaques à -30% de chance de toucher;

View file

@ -0,0 +1,26 @@
type;bete
mixins;bases/corps/quadripede
mixins;bases/tailles/grand
// 10~11 points de stats à distribuer par niveaux
atk.lvl;4
cha.lvl;2
con.lvl;4
pv.lvl;6
pe.lvl;1
armurephy.base;4
armurepsy.base;0
armurespe.base;2
competence;Chasse;10;
competence.lvl;Chasse;3;
competence;Pistage;10;
competence.lvl;Pistage;3;
armes;Griffe;4;
armes;Croc;5;
skill;Morsure;Une attaque qui utilise les crocs et fait 1 blessure;
skill;Griffure;Fait deux attaques à -30% de chance de toucher;

39
libs/boosts.lua Normal file
View file

@ -0,0 +1,39 @@
local boost = {}
local BOOST_ARM_CREATURE = {
{lvl = 0, value = 1},
{lvl = 5, value = 1.5},
{lvl = 10, value = 2},
{lvl = 15, value = 3},
{lvl = 20, value = 3.5},
{lvl = 25, value = 4}
}
local BOOST_ARM_PNJ = {
{lvl = 0, value = 1},
{lvl = 6, value = 1.5},
{lvl = 10, value = 2},
{lvl = 15, value = 3}
}
local function getBoost(level, table)
local bestBoost = {lvl = -1, value = 1}
for _, boost in ipairs(table) do
if (level >= boost.lvl and boost.lvl > bestBoost.lvl) then
bestBoost = boost
end
end
return bestBoost.value
end
function boost.getBoost(level, mode)
if (mode == "pnj") then
return getBoost(level, BOOST_ARM_PNJ)
else
return getBoost(level, BOOST_ARM_CREATURE)
end
end
return boost

View file

@ -35,11 +35,11 @@ local function addListCommands(name, value)
end
for key, value in pairs(struct) do
if (value.dataType == "stat") then
if (value.dataType == "stat" or value.dataType == "armure") then
addStatCommands(key, value)
elseif (value.dataType == "list") then
addListCommands(key, value)
elseif (value.dataType == "comp") then
elseif (value.dataType == "comp" or value.dataType == "armes") then
addCompCommands(key, value)
else
addCommands(key, key, value.default)

View file

@ -1,3 +1,4 @@
utils = require "libs.utils"
Object = require "libs.classic"
commands = require "libs.commands"
commands = require "libs.commands"
boosts = require "libs.boosts"

View file

@ -1,5 +1,6 @@
return {
name={contentType = "string", preParse = true, to="name"},
mode={contentType = "string", preParse = true, to="mode", default = "creature"},
nomType={contentType = "string", to="type"},
categorie={contentType = "string", to="categorie"},
faiblesse={contentType = "list", args=1},
@ -20,10 +21,10 @@ return {
pv= {dataType= "stat", modulo= 1, default= 12, max=9999999, min=1, to="vita.pv", lvl=3},
pe= {dataType= "stat", modulo= 1, default= 12, max=9999999, min=1, to="vita.pe", lvl=3},
eclat= {dataType= "stat", modulo= 1, default= 10, max=200, min=1, to="vita.eclat"},
armurephy= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0, to="armure.phy"},
armurepsy= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0, to="armure.psy"},
armurespe= {dataType= "stat", modulo= 1, default= 0, max=9999999, min=0, to="armure.spe"},
armes= {dataType= "list", args=2},
armurephy= {dataType= "armure", modulo= 1, default= 0, max=9999999, min=0, to="armure.phy"},
armurepsy= {dataType= "armure", modulo= 1, default= 0, max=9999999, min=0, to="armure.psy"},
armurespe= {dataType= "armure", modulo= 1, default= 0, max=9999999, min=0, to="armure.spe"},
armes= {dataType= "armes", args=2},
competence= {dataType= "comp", args=3}, -- on va le gérer différemment comme du code lol sinon c'est trop relou
skill= {dataType= "list", args=2},
}

View file

@ -18,7 +18,7 @@ print("Armure", "Phy:" .. creature.armure.phy, "Psy:" .. creature.armure.psy, "S
print(" ", "------")
print("Armes:")
for key, value in ipairs(creature.armes) do
print(value[1], value[2])
print(value.nom, value.force)
end
print(" ", "------")
print("Competences:")