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", name = "Motobug",
fullname = "E-03 Motobug", fullname = "E-03 Motobug",
type = "badnics", type = "badnics",
rarity = 0,
isAerial = false, isAerial = false,
distAttack = false, distAttack = false,
turns = 2, 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() AbstractEnnemy = AbstractMobParent:extend()
function AbstractEnnemy:new(name) function AbstractEnnemy:new(directory, name)
self.simplename = name self.simplename = name
self.directory = directory
self.super.new(self) self.super.new(self)
end end
function AbstractEnnemy:getDirectory()
return "datas.gamedata.ennemies." .. self.directory .. "."
end
function AbstractEnnemy:initBasicElements() function AbstractEnnemy:initBasicElements()
self.data = require("datas.gamedata.ennemies." .. self.simplename) self.data = require(self:getDirectory() .. self.simplename)
self.name = self.data.name self.name = self.data.name
self.fullname = self.data.fullname self.fullname = self.data.fullname
self.turns = self.data.turns self.turns = self.data.turns
end end
function AbstractEnnemy:createStats() function AbstractEnnemy:createStats()
return require("datas.gamedata.ennemies." .. self.simplename .. ".stats") return require(self:getDirectory() .. self.simplename .. ".stats")
end end
function AbstractEnnemy:createSkills() function AbstractEnnemy:createSkills()
return require("datas.gamedata.ennemies." .. self.simplename .. ".skills") return require(self:getDirectory() .. self.simplename .. ".skills")
end end
return AbstractEnnemy return AbstractEnnemy

View file

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