local AddHeroTriggerEvent = BaseClass("AddHeroTriggerEvent")
local AddHeroEffect = "VFX_xishou_gaotouchuxian_jiangli"

function AddHeroTriggerEvent:__init()
end

function AddHeroTriggerEvent:__delete()
end

function AddHeroTriggerEvent:Execute(param, extra)
  local spl = string.split(param.para, "|")
  local heros = {}
  for _, value in ipairs(spl) do
    table.insert(heros, tonumber(value))
  end
  local level = tonumber(extra) or 1
  if DataCenter.LWBattleManager.logic.AddMember then
    local addCount = 0
    for _, heroId in ipairs(heros) do
      DataCenter.LWBattleManager.logic:AddMember(heroId, level, true)
      addCount = addCount + 1
    end
    if DataCenter.LWBattleManager.logic.detailLog and DataCenter.LWBattleManager.logic.GetMemberCount then
      local memberCount = DataCenter.LWBattleManager.logic:GetMemberCount()
      Logger.LogInfo("parkour AddHeroTriggerEvent metaId : " .. param.id .. ". addCount : " .. addCount .. ". memberCount : " .. memberCount)
    end
    if DataCenter.LWBattleManager.logic.TryCheatTriggerItem then
      DataCenter.LWBattleManager.logic:TryCheatTriggerItem(param.id, addCount)
    end
  end
end

return AddHeroTriggerEvent
