local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity"
local DungeonShardsEntity = class("DungeonShardsEntity", DungeonBaseEntity)

-- 碎片副本数据

function DungeonShardsEntity:init(data)
    if self.maxPassedId then
        ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_DUNGEON_SHARDS, data.max_chapter_shards_id - self.maxPassedId)
    end
    self.totalChallengeCount = data.total_challenge_count
    self.todayChallengeCount = data.today_challenge_count
    self.maxPassedId = data.max_chapter_shards_id
end

function DungeonShardsEntity:getTotalChallengeCount()
    return self.totalChallengeCount
end

function DungeonShardsEntity:getTodayChallengeCount()
    return self.todayChallengeCount
end

function DungeonShardsEntity:getPassedMaxId()
    return self.maxPassedId
end

function DungeonShardsEntity:getModuleKey()
    return ModuleManager.MODULE_KEY.DUNGEON_SHARDS
end

function DungeonShardsEntity:getOpenWeekCycle()
    if self.openWeek == nil then
        self.openWeek = {1,3,5,7}
    end
    return self.openWeek
end

function DungeonShardsEntity:getConfigName()
    return "chapter_dungeon_shards"
end

function DungeonShardsEntity:getTitleString()
    return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_TITLE)
end

function DungeonShardsEntity:getRuleString()
    return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_HELP)
end

function DungeonShardsEntity:getOpenWeekString()
    return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_OPEN)
end

function DungeonShardsEntity:getBossBuff(id)
    return self:getConfig()[id].effect[1]
end

function DungeonShardsEntity:getIcon()
    if self.dungeonIcon == nil then
        self.dungeonIcon = {GConst.ATLAS_PATH.DUNGEON,"dungeon_dec_2"}
    end
    return self.dungeonIcon
end

function DungeonShardsEntity:getBanner()
    return "assets/arts/textures/background/dungeon/dungeon_bg_2.png"
end

function DungeonShardsEntity:getOpenTextColor()
    return "#E4F5FE"
end

function DungeonShardsEntity:getChallengeHpCost()
    return GFunc.getConstReward("dungeon_shards_cost")
end

function DungeonShardsEntity:getTodayMaxCount()
	return GFunc.getConstIntValue("dungeon_shards_limit")
end

function DungeonShardsEntity:getBoardShowRewardId()
	return 20
end

function DungeonShardsEntity:getFirstRewardNum(id)
    local cfg = ConfigManager:getConfig("chapter_dungeon_shards")[id]
    return cfg.times_a + cfg.times_b
end

function DungeonShardsEntity:getPassRewardNum(id)
    local cfg = ConfigManager:getConfig("chapter_dungeon_shards")[id]
    local pass = cfg.times_d
    local wave = cfg.times_c * #cfg.monster
	return pass + wave
end

return DungeonShardsEntity