From 610d9b77a0f70894dc845ca268daf6c717da8378 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sun, 3 Feb 2019 19:46:24 +0100 Subject: [PATCH] src: remove the character files from radiance --- .../datas/gamedata/characters/baseteam.lua | 1 - .../datas/gamedata/characters/default.lua | 57 ----- .../datas/gamedata/characters/init.lua | 9 - .../datas/gamedata/characters/sonic.lua | 70 ------ sonic-radiance.love/game/characters.lua | 199 ------------------ 5 files changed, 336 deletions(-) delete mode 100644 sonic-radiance.love/datas/gamedata/characters/baseteam.lua delete mode 100644 sonic-radiance.love/datas/gamedata/characters/default.lua delete mode 100644 sonic-radiance.love/datas/gamedata/characters/init.lua delete mode 100644 sonic-radiance.love/datas/gamedata/characters/sonic.lua delete mode 100644 sonic-radiance.love/game/characters.lua diff --git a/sonic-radiance.love/datas/gamedata/characters/baseteam.lua b/sonic-radiance.love/datas/gamedata/characters/baseteam.lua deleted file mode 100644 index 765b627..0000000 --- a/sonic-radiance.love/datas/gamedata/characters/baseteam.lua +++ /dev/null @@ -1 +0,0 @@ -return {"sonic"} diff --git a/sonic-radiance.love/datas/gamedata/characters/default.lua b/sonic-radiance.love/datas/gamedata/characters/default.lua deleted file mode 100644 index 244037c..0000000 --- a/sonic-radiance.love/datas/gamedata/characters/default.lua +++ /dev/null @@ -1,57 +0,0 @@ -return { - name = "Default", - name_full = "Default the Character", - class = "Speedster", - startlevel = 1, - isUnlockedAtStart = true, - - base_stats = { - hpmax = 200, -- - ppmax = 50, -- - - attack = 50, -- - power = 50, -- - defense = 50, -- - technic = 50, -- - mind = 50, -- - speed = 50, -- - - turns = 3, -- number of attacks by turn (unused) - move = 2, -- how far the character can get in one turn - }, - - color = {1, 1, 1}, - - skill_list = { - --{attack_name, level}, - }, - - flags = { - canGoSuper = true, - }, - - assets = { - charset = {"", 1}, - lifeicon = 1, - spriteset = "sonic", - }, - - inventory = { - haveShoes = true, - haveMechs = false, - haveGlove = true, - haveHammer= false, - accessories_number = 3, - chao_number = 1, - }, - - boost_stats = { - spd = 5, - jmp = 3, - jumpaction = "doublejump", - jumpaction_power = 2, - action = "spinattack", - action_power = 1, - canBreakCraft = false, - } -} diff --git a/sonic-radiance.love/datas/gamedata/characters/init.lua b/sonic-radiance.love/datas/gamedata/characters/init.lua deleted file mode 100644 index 6fe4ebc..0000000 --- a/sonic-radiance.love/datas/gamedata/characters/init.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - "sonic", - "tails", - "knuckles", - "amy", - "cream", - "shadow", - "rouge", -} diff --git a/sonic-radiance.love/datas/gamedata/characters/sonic.lua b/sonic-radiance.love/datas/gamedata/characters/sonic.lua deleted file mode 100644 index 9b3bee1..0000000 --- a/sonic-radiance.love/datas/gamedata/characters/sonic.lua +++ /dev/null @@ -1,70 +0,0 @@ -return { - name = "Default", - name_full = "Default the Character", - class = "Speedster", - startlevel = 100, - isUnlockedAtStart = true, - - base_stats = { - hpmax = 200, -- - ppmax = 50, -- - - attack = 50, -- - power = 50, -- - defense = 50, -- - technic = 50, -- - mind = 50, -- - speed = 50, -- - - turns = 3, -- number of attacks by turn (unused) - move = 3, -- how far the character can get in one turn - }, - - color = {1, 1, 1}, - - skill_list = { - --{attack_name, level}, - {"spinattack", 2}, - {"spinjump", 3}, - {"spindash", 8}, - {"hommingattack", 11}, - {"spinattack", 15}, - {"sonicflare", 18}, - {"bluetornado", 22}, - {"spindash", 26}, - {"soniccracker", 30}, - {"hommingattack", 35}, - {"bluetornado", 40}, - {"boost", 62}, - {"lightspeedattack", 70}, - }, - - flags = { - canGoSuper = true, - }, - - assets = { - charset = {"", 1}, - lifeicon = 1, - spriteset = "sonic", - }, - - inventory = { - haveShoes = true, - haveMechs = false, - haveGlove = true, - haveHammer= false, - accessories_number = 3, - chao_number = 1, - }, - - boost_stats = { - spd = 5, - jmp = 3, - jumpaction = "doublejump", - jumpaction_power = 2, - action = "spinattack", - action_power = 1, - canBreakCraft = false, - } -} diff --git a/sonic-radiance.love/game/characters.lua b/sonic-radiance.love/game/characters.lua deleted file mode 100644 index ab60ef6..0000000 --- a/sonic-radiance.love/game/characters.lua +++ /dev/null @@ -1,199 +0,0 @@ --- game/characters :: The character handler. This object handle all the character --- and is able to get and set datas about them. - ---[[ - Copyright © 2019 Kazhnuz - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - the Software, and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -]] - -local CharacterManager = Object:extend() - -function CharacterManager:new(controller) - self.controller = controller - self.namelist = require "datas.characters" - self.list = {} - self.team = require "datas.characters.baseteam" - self.active = 1 - self:init() -end - -function CharacterManager:init() - for k, v in pairs(self.namelist) do - local dir = "datas/characters/" .. v .. ".lua" - local fileinfo = love.filesystem.getInfo(dir) - if fileinfo ~= nil then - self:initCharacter(v) - end - end -end - -function CharacterManager:getCharacterData(charname) - -- va eprmettre de récupérer les données d'un personnage - return require("datas.characters." .. charname) -end - -function CharacterManager:initCharacter(id) - local stats = {} - local character = self:getCharacterData(id) - - stats.level = character.startlevel - stats.exp = self:getExpValue(stats.level) - stats.exp_next = self:getExpValue(stats.level + 1) - stats.hpmax = character.base_stats.hpmax - stats.ppmax = character.base_stats.ppmax - stats.attack = character.base_stats.attack - stats.power = character.base_stats.power - stats.defense = character.base_stats.defense - stats.technic = character.base_stats.technic - stats.mind = character.base_stats.mind - stats.speed = character.base_stats.speed - stats.turns = character.base_stats.turns - - character.stats = stats - self.list[id] = character - - self:recalculateStats(id) - - stats.hp = stats.hpmax - stats.pp = stats.ppmax - stats.status = 0 - - character.stats = stats - 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_current = self.list[id].stats.exp - - self.list[id].stats.exp = math.max(math.min(exp_current, exp_next - 1), exp) - self.list[id].stats.exp_next = exp_next - - self:recalculateStats(id) -end - -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) -end - -function CharacterManager:getSkillList(id) - local character = self.list[id] - local learnedlist = {} - - for i, v in ipairs(character.skill_list) do - local tech_name, tech_level, isLearned = v[1], v[2], false - if tech_level <= character.stats.level then - - if learnedlist[tech_name] == nil then - learnedlist[tech_name] = 1 - else - learnedlist[tech_name] = learnedlist[tech_name] + 1 - end - - end - -- On continue ensuite d'itérer dans la liste - end - - return learnedlist -end - -function CharacterManager:getData() - local data = {} - data.list = self.list - data.team = self.team - return data -end - -function CharacterManager:setData(data) - local data = data - self.list = data.list - self.team = data.team -end - -function CharacterManager:heal(id) - self.list[id].stats.hp = self.list[id].stats.hpmax - self.list[id].stats.hp = self.list[id].stats.ppmax - self.list[id].stats.status = 0 -end - -function CharacterManager:addToTeam(id) - self:heal(id) - table.insert(self.team, id) -end - -function CharacterManager:removeToTeam(teamid) - self.team[teamid] = "" -end - -function CharacterManager:getActiveCharacter() - return self.team[self.active] -end - --- DEBUG FUNCTIONS - -function CharacterManager:printCharacter(id) - local character = self.list[id] - local stats = character.stats - print(id .. ". " .. character.fullname) - print("Lvl " .. character.stats.level .. " (" .. stats.exp .. "/" .. stats.exp_next .. " exp)") -end - -function CharacterManager:printTeam() - for i,v in ipairs(self.team) do - self:printCharacter(v) - print("-----") - end -end - -return CharacterManager