116 lines
2.5 KiB
Lua
116 lines
2.5 KiB
Lua
local BattleSkillEntity = require "app/userdata/battle/skill/battle_skill_entity"
|
|
|
|
local BattleUnitEntity = class("BattleUnitEntity", BaseData)
|
|
|
|
function BattleUnitEntity:ctor()
|
|
end
|
|
|
|
function BattleUnitEntity:init(unitData, side, team)
|
|
self.unitData = unitData
|
|
self.side = side
|
|
self.team = team
|
|
self:initSkill()
|
|
end
|
|
|
|
function BattleUnitEntity:initSkill()
|
|
self.activeSkills = {}
|
|
if self.unitData.normalSkill then
|
|
self.normalSkill = BattleSkillEntity:create(self.unitData.normalSkill, GConst.BattleConst.SKILL_TYPE_ACTIVE, self)
|
|
end
|
|
if self.unitData.activeSkills then
|
|
for k, v in ipairs(self.unitData.activeSkills) do
|
|
local skill = BattleSkillEntity:create(v, GConst.BattleConst.SKILL_TYPE_ACTIVE, self)
|
|
table.insert(self.activeSkills, skill)
|
|
end
|
|
end
|
|
end
|
|
|
|
function BattleUnitEntity:addAttr(name, num, isPercent)
|
|
return self.team:addAttr(name, num, isPercent)
|
|
end
|
|
|
|
function BattleUnitEntity:getModelId()
|
|
return self.unitData.modelId
|
|
end
|
|
|
|
function BattleUnitEntity:getMatchType()
|
|
return self.unitData.matchType
|
|
end
|
|
|
|
function BattleUnitEntity:getSide()
|
|
return self.side
|
|
end
|
|
|
|
function BattleUnitEntity:setIsMainUnit(isMainUnit)
|
|
self.isMainUnit = isMainUnit
|
|
end
|
|
|
|
function BattleUnitEntity:getIsMainUnit()
|
|
return self.isMainUnit
|
|
end
|
|
|
|
function BattleUnitEntity:getNormalSkill()
|
|
return self.normalSkill
|
|
end
|
|
|
|
function BattleUnitEntity:takeDamageOrCure(num)
|
|
return self.team:takeDamageOrCure(num)
|
|
end
|
|
|
|
function BattleUnitEntity:getHp()
|
|
return self.team:getHp()
|
|
end
|
|
|
|
function BattleUnitEntity:getHpPercent()
|
|
return self.team:getHpPercent()
|
|
end
|
|
|
|
function BattleUnitEntity:getAtk()
|
|
return self.team:getAtk(self.unitData.matchType)
|
|
end
|
|
|
|
function BattleUnitEntity:getDmgAddition()
|
|
return self.team:getDmgAddition(self.unitData.matchType)
|
|
end
|
|
|
|
function BattleUnitEntity:getDmgDec()
|
|
return self.team:getDmgDec(self.unitData.matchType)
|
|
end
|
|
|
|
function BattleUnitEntity:getWeakness()
|
|
return self.team:getWeakness(self.unitData.matchType)
|
|
end
|
|
|
|
function BattleUnitEntity:getCrit()
|
|
return self.team:getCrit()
|
|
end
|
|
|
|
function BattleUnitEntity:getCrittime()
|
|
return self.team:getCrittime()
|
|
end
|
|
|
|
function BattleUnitEntity:getCureAddition()
|
|
return self.team:getCureAddition()
|
|
end
|
|
|
|
function BattleUnitEntity:getNormalAttackCount()
|
|
return self.team:getNormalAttackCount()
|
|
end
|
|
|
|
function BattleUnitEntity:addLimit(name)
|
|
self.team:addLimit(name)
|
|
end
|
|
|
|
function BattleUnitEntity:removeLimit(name)
|
|
self.team:removeLimit(name)
|
|
end
|
|
|
|
function BattleUnitEntity:addShield(num)
|
|
self.team:addShield(num)
|
|
end
|
|
|
|
function BattleUnitEntity:addMaxHp(num)
|
|
self.team:addMaxHp(num)
|
|
end
|
|
|
|
return BattleUnitEntity |