c1_lua/lua/app/userdata/battle/skill/battle_skill_entity.lua
2023-04-12 23:10:22 +08:00

33 lines
1.1 KiB
Lua

local BattleSkillEntity = class("BattleSkillEntity", BaseData)
function BattleSkillEntity:ctor(skillId, skillType, owner)
self.skillType = skillType
self.skillId = skillId
self.owner = owner
self:init()
end
function BattleSkillEntity:init()
self.skillInfo = ConfigManager:getConfig("skill")[self.skillId]
end
function BattleSkillEntity:getMoveType()
return self.skillInfo.position
end
function BattleSkillEntity:getRandomNormalAttackName()
if self.normalSkillNameList == nil then
self.normalSkillNameList = {"attack01", "attack02", "attack03"}
end
if self.normalSkillNameIndex == nil then
self.normalSkillNameIndex = math.random(1, #self.normalSkillNameList)
else
local temp = self.normalSkillNameList[#self.normalSkillNameList]
self.normalSkillNameList[#self.normalSkillNameList] = self.normalSkillNameList[self.normalSkillNameIndex]
self.normalSkillNameList[self.normalSkillNameIndex] = temp
self.normalSkillNameIndex = math.random(1, #self.normalSkillNameList - 1)
end
return self.normalSkillNameList[self.normalSkillNameIndex]
end
return BattleSkillEntity