sonic-radiance/sonic-radiance.love/game/abstractmobs/ennemy/init.lua

48 lines
1.3 KiB
Lua
Raw Permalink Normal View History

2021-04-03 10:39:34 +02:00
local AbstractMobParent = require "game.abstractmobs.parent"
2020-07-19 13:13:54 +02:00
2021-04-03 10:39:34 +02:00
local AbstractEnnemy = AbstractMobParent:extend()
2021-05-16 10:06:20 +02:00
local elements = require "datas.gamedata.battles.elements"
2021-07-03 10:12:56 +02:00
local EnnemyStatManager = require "game.abstractmobs.ennemy.statmanager"
2020-07-19 13:13:54 +02:00
2020-08-04 13:32:23 +02:00
function AbstractEnnemy:new(directory, name)
2020-07-19 13:13:54 +02:00
self.simplename = name
2020-08-04 13:32:23 +02:00
self.directory = directory
2021-07-03 10:12:56 +02:00
AbstractEnnemy.super.new(self, nil, nil, EnnemyStatManager)
2020-07-19 13:13:54 +02:00
end
2021-05-16 10:06:20 +02:00
function AbstractEnnemy:getWeaknesses()
local elementData = elements[self.data.element] or elements["none"]
return elementData.weakTo
end
function AbstractEnnemy:getResistences()
local elementData = elements[self.data.element] or elements["none"]
return elementData.resists
end
function AbstractEnnemy:haveProtecType(protectype)
return utils.table.contain(self.data.protectypes, protectype)
end
function AbstractEnnemy:getProtecTypes()
return self.data.protectypes
end
2020-07-19 13:13:54 +02:00
function AbstractEnnemy:initBasicElements()
self.data = core.datas:get("ennemies", self.simplename)
2020-07-19 13:13:54 +02:00
self.name = self.data.name
self.fullname = self.data.fullname
self.turns = self.data.turns
end
function AbstractEnnemy:createSkills()
return self.data.skills
2020-07-19 13:13:54 +02:00
end
2021-07-03 10:12:56 +02:00
function AbstractEnnemy:setBonus(pvFactor, statFactor)
self.stats:setBonus(pvFactor, statFactor)
self.hp = self.stats:get(self.stats.HPMAX)
end
2020-07-19 13:13:54 +02:00
return AbstractEnnemy