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",
fullname = "E-03 Motobug",
type = "badnics",
element = "none",
protectypes = {},
rarity = 0,
isAerial = false,
distAttack = false,

View file

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

View file

@ -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

View file

@ -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 = {}

View file

@ -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

View file

@ -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