parent
8e277d0505
commit
706468dad6
6 changed files with 86 additions and 1 deletions
|
@ -86,6 +86,9 @@ function AbstractCharacter:setLevel(newlevel)
|
||||||
end
|
end
|
||||||
|
|
||||||
function AbstractCharacter:levelUp()
|
function AbstractCharacter:levelUp()
|
||||||
|
if (game.difficulty:get("levelUpHeal")) then
|
||||||
|
self:heal()
|
||||||
|
end
|
||||||
self:setLevel(self.level + 1)
|
self:setLevel(self.level + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
29
sonic-radiance.love/game/difficulty.lua
Normal file
29
sonic-radiance.love/game/difficulty.lua
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
local Difficulty = Object:extend()
|
||||||
|
|
||||||
|
function Difficulty:new()
|
||||||
|
self.toggles = {}
|
||||||
|
self.toggles.hazardMakesKo = false
|
||||||
|
self.toggles.playerKoChar = true
|
||||||
|
self.toggles.easierBattles = false
|
||||||
|
self.toggles.checkPointRegen = false
|
||||||
|
self.toggles.levelUpHeal = false
|
||||||
|
self.toggles.allDamage = true
|
||||||
|
end
|
||||||
|
|
||||||
|
function Difficulty:toggle(toggleName)
|
||||||
|
self.toggles[toggleName] = (self.toggles[toggleName] == false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Difficulty:get(toggleName)
|
||||||
|
return self.toggles[toggleName]
|
||||||
|
end
|
||||||
|
|
||||||
|
function Difficulty:getData()
|
||||||
|
return self.toggles
|
||||||
|
end
|
||||||
|
|
||||||
|
function Difficulty:setData(toggles)
|
||||||
|
self.toggles = toggles
|
||||||
|
end
|
||||||
|
|
||||||
|
return Difficulty
|
|
@ -29,6 +29,7 @@ local Ennemies = require "game.ennemies"
|
||||||
local Skills = require "game.skills"
|
local Skills = require "game.skills"
|
||||||
local Loot = require "game.loot"
|
local Loot = require "game.loot"
|
||||||
local CBSCore = require "game.battle"
|
local CBSCore = require "game.battle"
|
||||||
|
local Difficulty = require "game.difficulty"
|
||||||
|
|
||||||
local binser = require "core.modules.gamesystem.libs.binser"
|
local binser = require "core.modules.gamesystem.libs.binser"
|
||||||
|
|
||||||
|
@ -61,6 +62,7 @@ function Game:setData(data)
|
||||||
self.actions = data.actions
|
self.actions = data.actions
|
||||||
self.characters:setData(data.characters)
|
self.characters:setData(data.characters)
|
||||||
self.loot:setData(data.loot)
|
self.loot:setData(data.loot)
|
||||||
|
self.difficulty:setData(data.difficulty)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Game:getData()
|
function Game:getData()
|
||||||
|
@ -68,6 +70,7 @@ function Game:getData()
|
||||||
data.gametime = self.gametime
|
data.gametime = self.gametime
|
||||||
data.characters = self.characters:getData()
|
data.characters = self.characters:getData()
|
||||||
data.loot = self.loot:getData()
|
data.loot = self.loot:getData()
|
||||||
|
data.difficulty = self.difficulty:getData()
|
||||||
data.flags = self.flags
|
data.flags = self.flags
|
||||||
data.destroyedGizmo = self.destroyedGizmo
|
data.destroyedGizmo = self.destroyedGizmo
|
||||||
data.variables = self.variables
|
data.variables = self.variables
|
||||||
|
@ -143,6 +146,7 @@ function Game:resetData()
|
||||||
self.skills = Skills(self)
|
self.skills = Skills(self)
|
||||||
self.loot = Loot(self)
|
self.loot = Loot(self)
|
||||||
self.cbs = CBSCore(self)
|
self.cbs = CBSCore(self)
|
||||||
|
self.difficulty = Difficulty(self)
|
||||||
|
|
||||||
self:initPosition()
|
self:initPosition()
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ function OptionsMenu:new()
|
||||||
self:addSubMenu("audio", "Audio")
|
self:addSubMenu("audio", "Audio")
|
||||||
--self:addSubMenu("langs", "langs")
|
--self:addSubMenu("langs", "langs")
|
||||||
self:addSubMenu("inputs", "Inputs")
|
self:addSubMenu("inputs", "Inputs")
|
||||||
|
self:addSubMenu("difficulty", "Difficulty")
|
||||||
|
|
||||||
Widgets.Resolution(self, "video")
|
Widgets.Resolution(self, "video")
|
||||||
Widgets.Switch(self, "video", "fullscreen", "Fullscreen")
|
Widgets.Switch(self, "video", "fullscreen", "Fullscreen")
|
||||||
|
@ -23,6 +24,7 @@ function OptionsMenu:new()
|
||||||
Widgets.Switch(self, "video", "vsync", "Vsync")
|
Widgets.Switch(self, "video", "vsync", "Vsync")
|
||||||
|
|
||||||
self:addPlayerMenus()
|
self:addPlayerMenus()
|
||||||
|
self:addDifficultyMenu()
|
||||||
|
|
||||||
--self:setLanguageMenu()
|
--self:setLanguageMenu()
|
||||||
|
|
||||||
|
@ -61,6 +63,15 @@ function OptionsMenu:addSubMenu(name, fullname)
|
||||||
self.menusystem.menus["main"]:addSubMenu(name, fullname)
|
self.menusystem.menus["main"]:addSubMenu(name, fullname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function OptionsMenu:addDifficultyMenu()
|
||||||
|
Widgets.DiffSwitch(self, "difficulty", "hazardMakesKo", "Hazards can make KO")
|
||||||
|
Widgets.DiffSwitch(self, "difficulty", "playerKoChar", "Play KO characters on maps")
|
||||||
|
Widgets.DiffSwitch(self, "difficulty", "easierBattles", "Easier battles")
|
||||||
|
Widgets.DiffSwitch(self, "difficulty", "checkPointRegen", "Checkpoints heal you")
|
||||||
|
Widgets.DiffSwitch(self, "difficulty", "levelUpHeal", "Gaining a level heal")
|
||||||
|
Widgets.DiffSwitch(self, "difficulty", "allDamage", "Hazards damage everybody")
|
||||||
|
end
|
||||||
|
|
||||||
function OptionsMenu:addPlayerMenus()
|
function OptionsMenu:addPlayerMenus()
|
||||||
for i,v in ipairs(core.input.data) do
|
for i,v in ipairs(core.input.data) do
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
local RadianceListMenu = require "game.modules.menus.list"
|
local RadianceListMenu = require "game.modules.menus.list"
|
||||||
|
|
||||||
local OptionMenu = RadianceListMenu.ListMenu:extend()
|
local OptionMenu = RadianceListMenu.ListMenu:extend()
|
||||||
local WIDTH = 128+32
|
local WIDTH = 128+108
|
||||||
local ITEMNUMBER = 6
|
local ITEMNUMBER = 6
|
||||||
|
|
||||||
function OptionMenu:new(scene, name)
|
function OptionMenu:new(scene, name)
|
||||||
|
|
|
@ -15,6 +15,7 @@ widgets.PlayerSubMenu = RadianceListMenu.DualTextWidget:extend()
|
||||||
widgets.Key = RadianceListMenu.DualTextWidget:extend()
|
widgets.Key = RadianceListMenu.DualTextWidget:extend()
|
||||||
widgets.Audio = RadianceListMenu.DualTextWidget:extend()
|
widgets.Audio = RadianceListMenu.DualTextWidget:extend()
|
||||||
widgets.Delete = RadianceListMenu.DualTextWidget:extend()
|
widgets.Delete = RadianceListMenu.DualTextWidget:extend()
|
||||||
|
widgets.DiffSwitch = RadianceListMenu.DualTextWidget:extend()
|
||||||
|
|
||||||
local defTransitions = require "core.modules.transitions"
|
local defTransitions = require "core.modules.transitions"
|
||||||
local ConfirmDialog = require "game.modules.confirmdialog"
|
local ConfirmDialog = require "game.modules.confirmdialog"
|
||||||
|
@ -259,4 +260,41 @@ function widgets.Audio:action()
|
||||||
core.options:write()
|
core.options:write()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Switch widget (One widget to handle graphical switch)
|
||||||
|
|
||||||
|
function widgets.DiffSwitch:new(scene, menu, keyname, label)
|
||||||
|
self.keyname = keyname
|
||||||
|
local label2 = self:getLabel()
|
||||||
|
widgets.Switch.super.new(self, scene, menu, label, label2)
|
||||||
|
self.order = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function widgets.DiffSwitch:modifyKey()
|
||||||
|
game.difficulty:toggle(self.keyname)
|
||||||
|
end
|
||||||
|
|
||||||
|
function widgets.DiffSwitch:getKey()
|
||||||
|
return game.difficulty:get(self.keyname)
|
||||||
|
end
|
||||||
|
|
||||||
|
function widgets.DiffSwitch:getLabel()
|
||||||
|
self.key = self:getKey()
|
||||||
|
local label = ""
|
||||||
|
if (self.key) then
|
||||||
|
label = "true"
|
||||||
|
else
|
||||||
|
label = "false"
|
||||||
|
end
|
||||||
|
|
||||||
|
return core.lang:translate("commons", label)
|
||||||
|
end
|
||||||
|
|
||||||
|
function widgets.DiffSwitch:action()
|
||||||
|
self:modifyKey()
|
||||||
|
self.scene.assets:playSFX("mSelect")
|
||||||
|
self.label2 = self:getLabel()
|
||||||
|
game:write()
|
||||||
|
self:invalidateCanvas()
|
||||||
|
end
|
||||||
|
|
||||||
return widgets
|
return widgets
|
||||||
|
|
Loading…
Reference in a new issue