fix: add subfolder for ennemies

This commit is contained in:
Kazhnuz 2020-08-04 13:32:23 +02:00
parent 871ccb250f
commit 216a047d3a
6 changed files with 17 additions and 7 deletions

View file

@ -2,8 +2,11 @@ return {
name = "Motobug",
fullname = "E-03 Motobug",
type = "badnics",
rarity = 0,
isAerial = false,
distAttack = false,
turns = 2,
move = 3,
giveExp = 20,
giveRings = 30,
}

View file

@ -0,0 +1,3 @@
return {
"classic",
}

View file

@ -2,25 +2,29 @@ AbstractMobParent = require "game.abstractmobs.parent"
AbstractEnnemy = AbstractMobParent:extend()
function AbstractEnnemy:new(name)
function AbstractEnnemy:new(directory, name)
self.simplename = name
self.directory = directory
self.super.new(self)
end
function AbstractEnnemy:getDirectory()
return "datas.gamedata.ennemies." .. self.directory .. "."
end
function AbstractEnnemy:initBasicElements()
self.data = require("datas.gamedata.ennemies." .. self.simplename)
self.data = require(self:getDirectory() .. self.simplename)
self.name = self.data.name
self.fullname = self.data.fullname
self.turns = self.data.turns
end
function AbstractEnnemy:createStats()
return require("datas.gamedata.ennemies." .. self.simplename .. ".stats")
return require(self:getDirectory() .. self.simplename .. ".stats")
end
function AbstractEnnemy:createSkills()
return require("datas.gamedata.ennemies." .. self.simplename .. ".skills")
return require(self:getDirectory() .. self.simplename .. ".skills")
end
return AbstractEnnemy

View file

@ -7,7 +7,7 @@ function EnnemyManager:new(controller)
end
function EnnemyManager:getEnnemyData(ennemy)
return AbstractEnnemy(ennemy)
return AbstractEnnemy("classics", ennemy)
end
return EnnemyManager