feat: add statuses stat effect
This commit is contained in:
parent
dfa1d659ff
commit
6e93a11fef
7 changed files with 105 additions and 1 deletions
38
sonic-radiance.love/datas/gamedata/statuses.lua
Normal file
38
sonic-radiance.love/datas/gamedata/statuses.lua
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
return {
|
||||||
|
hidden = {
|
||||||
|
{"evasion", 30},
|
||||||
|
},
|
||||||
|
focus = {
|
||||||
|
{"critical", 30},
|
||||||
|
},
|
||||||
|
shielded = {
|
||||||
|
{"armor", 20}
|
||||||
|
},
|
||||||
|
hyper = {
|
||||||
|
{"damage", 25},
|
||||||
|
{"critical", 20}
|
||||||
|
},
|
||||||
|
lucky = {
|
||||||
|
{"evasion", 20},
|
||||||
|
{"luck", 20},
|
||||||
|
},
|
||||||
|
regen = {
|
||||||
|
{"hpregen", 8}
|
||||||
|
},
|
||||||
|
poison = {
|
||||||
|
{"hpregen", -15}
|
||||||
|
},
|
||||||
|
weakened = {
|
||||||
|
{"damage", -20}
|
||||||
|
},
|
||||||
|
vulnerable = {
|
||||||
|
{"armor", -20}
|
||||||
|
},
|
||||||
|
cursed = {
|
||||||
|
{"evasion", 0},
|
||||||
|
{"luck", -30}
|
||||||
|
},
|
||||||
|
distracted = {
|
||||||
|
{"accuracy", -30}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ return {
|
||||||
["addGFX"] = {'sprite', "origin", "x", "y", "z", "affectedByDirection", 'blockProcess'},
|
["addGFX"] = {'sprite', "origin", "x", "y", "z", "affectedByDirection", 'blockProcess'},
|
||||||
["playSFX"] = {"sfx"},
|
["playSFX"] = {"sfx"},
|
||||||
["sendDamage"] = {"power", "type", "element", "isSpecial"},
|
["sendDamage"] = {"power", "type", "element", "isSpecial"},
|
||||||
|
["sendStatus"] = {"status", "duration", "force"},
|
||||||
["goTo"] = {"who", "origin", "x", "y", "duration", "blockProcess"},
|
["goTo"] = {"who", "origin", "x", "y", "duration", "blockProcess"},
|
||||||
["goTo3D"] = {"who", "origin", "x", "y", "z", "duration", "blockProcess"},
|
["goTo3D"] = {"who", "origin", "x", "y", "z", "duration", "blockProcess"},
|
||||||
["setAnimation"] = {"who", "animation", "blockProcess"},
|
["setAnimation"] = {"who", "animation", "blockProcess"},
|
||||||
|
|
|
@ -2,6 +2,8 @@ local Serializable = require "birb.classes.serializable"
|
||||||
local AbstractMobParent = Serializable:extend()
|
local AbstractMobParent = Serializable:extend()
|
||||||
local StatManager = require "game.abstractmobs.statmanager"
|
local StatManager = require "game.abstractmobs.statmanager"
|
||||||
|
|
||||||
|
local statutStatList = require "datas.gamedata.statuses"
|
||||||
|
|
||||||
function AbstractMobParent:new(serializeFields, listSerializable, statManager)
|
function AbstractMobParent:new(serializeFields, listSerializable, statManager)
|
||||||
local statManager = statManager or StatManager
|
local statManager = statManager or StatManager
|
||||||
self:initBasicElements()
|
self:initBasicElements()
|
||||||
|
@ -67,6 +69,18 @@ function AbstractMobParent:getStats()
|
||||||
return self.stats
|
return self.stats
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function AbstractMobParent:getStatutsStat(statName)
|
||||||
|
local stat = 0
|
||||||
|
for statut, _ in pairs(self.statuts) do
|
||||||
|
for _, statutStat in ipairs(statutStatList[statut]) do
|
||||||
|
if (statutStat[1] == statName) then
|
||||||
|
stat = stat + statutStat[2]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return stat
|
||||||
|
end
|
||||||
|
|
||||||
-- STATUT HANDLING
|
-- STATUT HANDLING
|
||||||
|
|
||||||
function AbstractMobParent:addStatut(name, duration)
|
function AbstractMobParent:addStatut(name, duration)
|
||||||
|
|
|
@ -82,6 +82,12 @@ function FighterParent:sendDamageToAll(listTarget, value, type, element, isSpeci
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function FighterParent:sendStatusToAll(listTarget, status, duration, force)
|
||||||
|
for _, target in ipairs(listTarget) do
|
||||||
|
self:sendStatus(target, status, duration, force)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function FighterParent:getTargets(ourSide)
|
function FighterParent:getTargets(ourSide)
|
||||||
if (self.isHero == ourSide) then
|
if (self.isHero == ourSide) then
|
||||||
return self.turnSystem.player:getTargets(true)
|
return self.turnSystem.player:getTargets(true)
|
||||||
|
@ -102,6 +108,19 @@ function FighterParent:sendDamage(target, value, type, element, isSpecial)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function FighterParent:sendStatus(target, status, duration, force)
|
||||||
|
core.debug:print("cbs/battler", "Sending status " .. status .." at " .. target.name)
|
||||||
|
if ((not force) or battleutils.rollDice(self:getStat(STATS.ACCURACY))) then
|
||||||
|
target:receiveStatus(status, duration, force)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FighterParent:receiveStatus(status, duration, force)
|
||||||
|
if (force or (not battleutils.rollDice(self:getStat(STATS.LUCK)))) then
|
||||||
|
self.abstract:addStatut(status, duration)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function FighterParent:receiveDamage(value, type, element, isSpecial, fromWho)
|
function FighterParent:receiveDamage(value, type, element, isSpecial, fromWho)
|
||||||
local damages = battleutils.computeReceivingDamages(value, self, isSpecial, self.isDefending)
|
local damages = battleutils.computeReceivingDamages(value, self, isSpecial, self.isDefending)
|
||||||
damages = battleutils.applyProtectTypes(damages, type, self.abstract:getProtecTypes())
|
damages = battleutils.applyProtectTypes(damages, type, self.abstract:getProtecTypes())
|
||||||
|
@ -178,7 +197,11 @@ function FighterParent:getNbrActionPerTurn()
|
||||||
end
|
end
|
||||||
|
|
||||||
function FighterParent:getStat(statname)
|
function FighterParent:getStat(statname)
|
||||||
return (self.abstract.stats:get(statname) * self:getStatBonusValue(statname))
|
local stat = (self.abstract.stats:get(statname) * self:getStatBonusValue(statname)) + self.abstract:getStatutsStat(statname)
|
||||||
|
if (self.abstract:haveStatuts("cursed") and (statname == "evasion")) then
|
||||||
|
return math.max(0, stat)
|
||||||
|
end
|
||||||
|
return stat
|
||||||
end
|
end
|
||||||
|
|
||||||
function FighterParent:getStatBonusValue(statname)
|
function FighterParent:getStatBonusValue(statname)
|
||||||
|
|
|
@ -46,6 +46,16 @@ function InfosMixin:sendDamage(power, type, element, isSpecial)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function InfosMixin:sendStatus(status, duration, force)
|
||||||
|
if (self.fighter.isAlive) then
|
||||||
|
if (self.target ~= nil) then
|
||||||
|
self.fighter:sendStatus(self.target, status, duration, force)
|
||||||
|
else
|
||||||
|
self.fighter:sendStatus(self.targetList, status, duration, force)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function InfosMixin:haveFrameSignal(signal)
|
function InfosMixin:haveFrameSignal(signal)
|
||||||
return self.actor:haveFrameSignal(signal)
|
return self.actor:haveFrameSignal(signal)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,7 @@ actions["jumpBack"] = require(baseURI .. "jumpBack")
|
||||||
actions["jump"] = require(baseURI .. "jump")
|
actions["jump"] = require(baseURI .. "jump")
|
||||||
actions["playSFX"] = require(baseURI .. "playSFX")
|
actions["playSFX"] = require(baseURI .. "playSFX")
|
||||||
actions["sendDamage"] = require(baseURI .. "sendDamage")
|
actions["sendDamage"] = require(baseURI .. "sendDamage")
|
||||||
|
actions["sendStatus"] = require(baseURI .. "sendStatus")
|
||||||
actions["setAnimation"] = require(baseURI .. "setAnimation")
|
actions["setAnimation"] = require(baseURI .. "setAnimation")
|
||||||
actions["setAnimSpeed"] = require(baseURI .. "setAnimSpeed")
|
actions["setAnimSpeed"] = require(baseURI .. "setAnimSpeed")
|
||||||
actions["wait"] = require(baseURI .. "wait")
|
actions["wait"] = require(baseURI .. "wait")
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
local StepParent = require "scenes.battlesystem.controllers.fighters.systems.choregraphy.step.parent"
|
||||||
|
local SendStatus = StepParent:extend()
|
||||||
|
|
||||||
|
function SendStatus:new(system, args)
|
||||||
|
SendStatus.super.new(self, system, args)
|
||||||
|
end
|
||||||
|
|
||||||
|
function SendStatus:start()
|
||||||
|
local status = self.arguments.status
|
||||||
|
local force = self.arguments.force
|
||||||
|
local duration = self.arguments.duration
|
||||||
|
|
||||||
|
self.choregraphy:sendStatus(status, duration, force)
|
||||||
|
self:finish()
|
||||||
|
end
|
||||||
|
|
||||||
|
return SendStatus
|
Loading…
Reference in a new issue