improvement: transform aerial badnic in protectype
This commit is contained in:
parent
eab1b4b456
commit
a22871dcbc
6 changed files with 26 additions and 4 deletions
|
@ -2,6 +2,8 @@ return {
|
|||
name = "Motobug",
|
||||
fullname = "E-03 Motobug",
|
||||
type = "badnics",
|
||||
element = "none",
|
||||
protectypes = {},
|
||||
rarity = 0,
|
||||
isAerial = false,
|
||||
distAttack = false,
|
||||
|
|
|
@ -2,6 +2,8 @@ return {
|
|||
name = "Spinner",
|
||||
fullname = "E-06 Spinner",
|
||||
type = "badnics",
|
||||
element = "none",
|
||||
protectypes = {"aerial"},
|
||||
rarity = 0,
|
||||
isAerial = true,
|
||||
distAttack = false,
|
||||
|
|
|
@ -10,6 +10,14 @@ function AbstractEnnemy:new(directory, name)
|
|||
self.super.new(self)
|
||||
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 = ennutils.getData(self.directory, self.simplename)
|
||||
self.name = self.data.name
|
||||
|
|
|
@ -16,6 +16,14 @@ function AbstractMobParent:initBasicElements()
|
|||
self.turns = 2
|
||||
end
|
||||
|
||||
function AbstractMobParent:haveProtecType()
|
||||
return false
|
||||
end
|
||||
|
||||
function AbstractMobParent:getProtecTypes()
|
||||
return {}
|
||||
end
|
||||
|
||||
function AbstractMobParent:createStats()
|
||||
local stats = {}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ function Ennemy:new(world, x, y, owner)
|
|||
|
||||
self.actionPerTurn = 2
|
||||
self:initSprite()
|
||||
if (self.owner.abstract.data.isAerial == true) then
|
||||
if (self.owner:haveProtecType("aerial")) then
|
||||
self.z = 10
|
||||
end
|
||||
self.sprHeight = self.owner.abstract.data.hudHeight + 14
|
||||
|
|
|
@ -72,6 +72,10 @@ function FighterParent:updateHP()
|
|||
-- Fonction vide
|
||||
end
|
||||
|
||||
function FighterParent:haveProtecType(type)
|
||||
return self.abstract:haveProtecType(type)
|
||||
end
|
||||
|
||||
function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial)
|
||||
local stats = self:getStats()
|
||||
local value = value / 10
|
||||
|
@ -97,9 +101,7 @@ function FighterParent:receiveDamage(value, accuracy, isSpecial, isAerial, fromW
|
|||
value = value / stats.defense
|
||||
end
|
||||
|
||||
print(self.abstract.data.isArieal)
|
||||
|
||||
if (self.abstract.data.isAerial and not isAerial) then
|
||||
if (self:haveProtecType("aerial") and not isAerial) then
|
||||
accuracy = accuracy * AERIAL_ACCURACY_FACTOR
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue