45 lines
1.1 KiB
Lua
45 lines
1.1 KiB
Lua
local AbstractMobParent = require "game.abstractmobs.parent"
|
|
|
|
local AbstractEnnemy = AbstractMobParent:extend()
|
|
local elements = require "datas.gamedata.battles.elements"
|
|
|
|
function AbstractEnnemy:new(directory, name)
|
|
self.simplename = name
|
|
self.directory = directory
|
|
self.super.new(self)
|
|
end
|
|
|
|
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
|
|
|
|
function AbstractEnnemy:initBasicElements()
|
|
self.data = core.datas:get("ennemies", self.simplename)
|
|
self.name = self.data.name
|
|
self.fullname = self.data.fullname
|
|
self.turns = self.data.turns
|
|
end
|
|
|
|
function AbstractEnnemy:createStats()
|
|
return self.data.stats
|
|
end
|
|
|
|
function AbstractEnnemy:createSkills()
|
|
return self.data.skills
|
|
end
|
|
|
|
return AbstractEnnemy
|