--逐鹿中原(大乱斗)第三层 local EventSystem = require('Event/EventSystem') local Base = require("Battle/Logic/Level/LevelFunction/FightThroneBaseLevelFunction") local FightThroneThirdFloorLevelFunction = class("FightThroneThirdFloorLevelFunction",Base) local EStatisticType = LuaConst.EStatisticType function FightThroneThirdFloorLevelFunction:InitLevel() Base.InitLevel(self) self.shouldSnatchShard = false end function FightThroneThirdFloorLevelFunction:InitPlayerStatistic(statistic) Base.InitPlayerStatistic(self, statistic) statistic[EStatisticType.DamageBossHP] = FP.newV1(0) end function FightThroneThirdFloorLevelFunction:OnPlayerActived(playerID) Base.OnPlayerActived(self, playerID) SystemManager.SetFightMode(playerID, LuaConst.EFightMode.TEAM_GUILD, true) end --这个方法已经提了公共方法了,SyncLevelFunction:TryAddDamageBossHPStatistic function FightThroneThirdFloorLevelFunction:OnHpChange(entity ,caster, delta,op) Base.OnHpChange(self,entity ,caster, delta,op) if entity:IsBoss() then local sourceEntity = nil if delta < FP.Const.Zero and op == "sub" and caster then sourceEntity = caster:GetOriginEntity() end if sourceEntity then local playerRoomID = sourceEntity:GetPlayerID() if playerRoomID > 0 then self.PlayerStatisticDic[playerRoomID][EStatisticType.DamageBossHP]:Sub(delta) end end end end -- 获取战斗积分和结果 (只给服务器使用的代码) --未完成HYW now now now now 此处代码可以跟 SyncGuildBossLevelFunction:OnHpChange 合并提到Base里去 local temp_dmgDic = {} function FightThroneThirdFloorLevelFunction:GetGuildBossDamageRecord() table.clear(temp_dmgDic) local info = {} for _,playerID in ipairs(LevelPlayerManager.SyncPlayerIDList) do local playerInfo = LevelPlayerManager.GetPlayerInfoByPlayerIDInRoom(playerID) -- 玩家基础信息 local statisticInfo = self.PlayerStatisticDic[playerID] -- 玩法统计数据 if statisticInfo then -- 有些玩家只传入了playerInfo ,没有创建entity ,所以就没有数据 local acid = playerInfo.acid local guildID = playerInfo.guildID -- 公会id local damage = math.floor( FP.tonumberV1(statisticInfo[EStatisticType.DamageBossHP]) ) local playerName = playerInfo.name if temp_dmgDic[acid] then -- 这个玩家退出后又进来玩了,前后伤害算在一起 temp_dmgDic[acid] = temp_dmgDic[acid] + damage damage = temp_dmgDic[acid] else temp_dmgDic[acid] = damage end table.insert(info, acid) table.insert(info, guildID) table.insert(info, damage) table.insert(info, playerName) end end return info end return FightThroneThirdFloorLevelFunction