improvement: transform aerial badnic in protectype

This commit is contained in:
Kazhnuz 2021-05-15 14:50:12 +02:00
parent eab1b4b456
commit a22871dcbc
6 changed files with 26 additions and 4 deletions

View file

@ -2,6 +2,8 @@ return {
name = "Motobug", name = "Motobug",
fullname = "E-03 Motobug", fullname = "E-03 Motobug",
type = "badnics", type = "badnics",
element = "none",
protectypes = {},
rarity = 0, rarity = 0,
isAerial = false, isAerial = false,
distAttack = false, distAttack = false,

View file

@ -2,6 +2,8 @@ return {
name = "Spinner", name = "Spinner",
fullname = "E-06 Spinner", fullname = "E-06 Spinner",
type = "badnics", type = "badnics",
element = "none",
protectypes = {"aerial"},
rarity = 0, rarity = 0,
isAerial = true, isAerial = true,
distAttack = false, distAttack = false,

View file

@ -10,6 +10,14 @@ function AbstractEnnemy:new(directory, name)
self.super.new(self) self.super.new(self)
end 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() function AbstractEnnemy:initBasicElements()
self.data = ennutils.getData(self.directory, self.simplename) self.data = ennutils.getData(self.directory, self.simplename)
self.name = self.data.name self.name = self.data.name

View file

@ -16,6 +16,14 @@ function AbstractMobParent:initBasicElements()
self.turns = 2 self.turns = 2
end end
function AbstractMobParent:haveProtecType()
return false
end
function AbstractMobParent:getProtecTypes()
return {}
end
function AbstractMobParent:createStats() function AbstractMobParent:createStats()
local stats = {} local stats = {}

View file

@ -9,7 +9,7 @@ function Ennemy:new(world, x, y, owner)
self.actionPerTurn = 2 self.actionPerTurn = 2
self:initSprite() self:initSprite()
if (self.owner.abstract.data.isAerial == true) then if (self.owner:haveProtecType("aerial")) then
self.z = 10 self.z = 10
end end
self.sprHeight = self.owner.abstract.data.hudHeight + 14 self.sprHeight = self.owner.abstract.data.hudHeight + 14

View file

@ -72,6 +72,10 @@ function FighterParent:updateHP()
-- Fonction vide -- Fonction vide
end end
function FighterParent:haveProtecType(type)
return self.abstract:haveProtecType(type)
end
function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial) function FighterParent:sendDamage(target, value, accuracy, isSpecial, isAerial)
local stats = self:getStats() local stats = self:getStats()
local value = value / 10 local value = value / 10
@ -97,9 +101,7 @@ function FighterParent:receiveDamage(value, accuracy, isSpecial, isAerial, fromW
value = value / stats.defense value = value / stats.defense
end end
print(self.abstract.data.isArieal) if (self:haveProtecType("aerial") and not isAerial) then
if (self.abstract.data.isAerial and not isAerial) then
accuracy = accuracy * AERIAL_ACCURACY_FACTOR accuracy = accuracy * AERIAL_ACCURACY_FACTOR
end end