local Base = require("Battle/Logic/Level/LevelFunction/SyncGuildWarBaseLevelFunction") local SyncGuildWarMapMiddleLevelFunction = class("SyncGuildWarMapMiddleLevelFunction",Base) local guild_war_base_pb = require 'Proto/guild_war_base_pb' local INFOTYPE_LEFT_CATAPULT = LuaConst.EGuildWarAttackInfoType.MIDDLE_LEFT_CATAPULT local INFOTYPE_RIGHT_CATAPULT = LuaConst.EGuildWarAttackInfoType.MIDDLE_RIGHT_CATAPULT local INFOTYPE_CAMP1_CHONGCHE = LuaConst.EGuildWarAttackInfoType.CAMP1_CHONGCHE local INFOTYPE_CAMP2_CHONGCHE = LuaConst.EGuildWarAttackInfoType.CAMP2_CHONGCHE local EGuildWarInfoState = LuaConst.EGuildWarInfoState local LEFT_CATAPULT_ITEMID_1 = 2051 local LEFT_CATAPULT_ITEMID_2 = 2052 local RIGHT_CATAPULT_ITEMID_1 = 2041 local RIGHT_CATAPULT_ITEMID_2 = 2042 -- 投石车的MonsterFeatureID local Const_Catapult_FeatureID = 47 function SyncGuildWarMapMiddleLevelFunction:InitLevel() Base.InitLevel(self) self.leftCatapultDmgFrame = -99999 self.rightCatapultDmgFrame = -99999 end function SyncGuildWarMapMiddleLevelFunction:GetCampsiteCount() return 3 end function SyncGuildWarMapMiddleLevelFunction:GetMapAttackInfo() local msg = guild_war_base_pb.GuildWarMapAttackInfoList() for i,v in ipairs(self.catapultEntityList) do if v._logicInitData.OriginBornItemID == LEFT_CATAPULT_ITEMID_1 or v._logicInitData.OriginBornItemID == LEFT_CATAPULT_ITEMID_2 then local info = guild_war_base_pb.GuildWarMapAttackInfo() info.Id = INFOTYPE_LEFT_CATAPULT if LogicUpdateManager._clientHandleFrame - 20 <= self.leftCatapultDmgFrame then info.state = EGuildWarInfoState.ATTACKING else info.state = EGuildWarInfoState.NORMAL end if v.components.drive.BeDrivedByEntity then local playerInfo = LevelPlayerManager.GetPlayerInfoByPlayerIDInRoom(v.components.drive.BeDrivedByEntity:GetPlayerID()) info.Acid = playerInfo.acid end table.insert(msg.attackInfos, info) break end end for i,v in ipairs(self.catapultEntityList) do if v._logicInitData.OriginBornItemID == RIGHT_CATAPULT_ITEMID_1 or v._logicInitData.OriginBornItemID == RIGHT_CATAPULT_ITEMID_2 then local info = guild_war_base_pb.GuildWarMapAttackInfo() info.Id = INFOTYPE_RIGHT_CATAPULT if LogicUpdateManager._clientHandleFrame - 20 <= self.rightCatapultDmgFrame then info.state = EGuildWarInfoState.ATTACKING else info.state = EGuildWarInfoState.NORMAL end if v.components.drive.BeDrivedByEntity then local playerInfo = LevelPlayerManager.GetPlayerInfoByPlayerIDInRoom(v.components.drive.BeDrivedByEntity:GetPlayerID()) info.Acid = playerInfo.acid end table.insert(msg.attackInfos, info) break end end if self.camp1chongCheEntity then local info = guild_war_base_pb.GuildWarMapAttackInfo() info.Id = INFOTYPE_CAMP1_CHONGCHE table.insert(msg.attackInfos, info) end if self.camp2chongCheEntity then local info = guild_war_base_pb.GuildWarMapAttackInfo() info.Id = INFOTYPE_CAMP2_CHONGCHE table.insert(msg.attackInfos, info) end return msg:SerializeToString() end function SyncGuildWarMapMiddleLevelFunction:OnHpChange(entity, caster, delta, op) Base.OnHpChange(self, entity, caster, delta, op) if op == "sub" and delta < FP.Const.Zero then -- 先不考虑加血的情况 ,如果有 ,需要改下面代码 if caster:GetFeatureID() == Const_Catapult_FeatureID then if caster._logicInitData.OriginBornItemID == LEFT_CATAPULT_ITEMID_1 or caster._logicInitData.OriginBornItemID == LEFT_CATAPULT_ITEMID_2 then self.leftCatapultDmgFrame = LogicUpdateManager._clientHandleFrame else self.rightCatapultDmgFrame = LogicUpdateManager._clientHandleFrame end end end end return SyncGuildWarMapMiddleLevelFunction