|
发表于 2023-10-7 21:45:45
|
查看: 2463 |
回复: 0
local ThrowDamageNumMediator = class('ThrowDamageNumMediator', framework.Mediator)
ThrowDamageNumMediator.NAME = "ThrowDamageNumMediator"
local optionsUtils = requireProxy( "optionsUtils" )
function ThrowDamageNumMediator:handle_enemy( launchActorID, actor, actorID )
local petActorID = -1
local heroActorID = global.gamePlayerController:GetMainHeroID()
local mainPlayerID = global.gamePlayerController:GetMainPlayerID()
if not launchActorID then
return nil
end
-- 怪物不记录
local launchActor = global.actorManager:GetActor( launchActorID )
if launchActor and launchActor:GetType() == global.MMO.ACTOR_MONSTER then
return nil
end
-- 我的宠物/元神/主角造成伤害
if launchActorID == petActorID or launchActorID == heroActorID or launchActorID == mainPlayerID then
return nil
end
-- 攻击 我的宠物/元神/主角
if not (actorID == petActorID or actorID == heroActorID or actorID == mainPlayerID) then
return nil
end
global.Facade:sendNotification( global.NoticeTable.AddEnemyActor, launchActorID )
end
function ThrowDamageNumMediator:handle_MSG_SC_NET_ACTOR_DAMAGE_NUMBER_SHOW( msg )
local jsonData = ParseRawMsgToJson( msg )
if not jsonData then
return -1
end
local numID = jsonData.Id
if not numID then
return -1
end
local damageProxy = self:getFacade():retrieveProxy( global.ProxyTable.ThrowDamageNumProxy)
local actorID = jsonData.UserID
local launchActorID = jsonData.TargetID
local actor = global.actorManager:GetActor( actorID )
local mainPlayerID = global.gamePlayerController:GetMainPlayerID()
local mainHeroID = global.gamePlayerController:GetMainHeroID()
local isMainHero = (global.gamePlayerController:GetMainHeroID() == launchActorID)
-- 飘血
self:handle_throwDamageNum( actor, actorID, mainPlayerID, jsonData, isMainHero )
-- 受击表现
self:handle_hitAction( numID, actor )
-- 仇敌列表 攻击你的玩家列表
self:handle_enemy( launchActorID, actor, actorID )
-- 主玩家攻击了someone
if mainPlayerID == launchActorID then
self:getFacade():sendNotification( global.NoticeTable.PlayerAttackedSomeone, actorID )
end
-- 主玩家被攻击了
-- if mainPlayerID == actorID and damageProxy:IsBeDamaged( numID ) then
-- self:getFacade():sendNotification( global.NoticeTable.PlayerBeDamaged)
-- end
-- 英雄被攻击了
if mainHeroID == actorID and damageProxy:IsBeDamaged( numID ) then
self:getFacade():sendNotification( global.NoticeTable.HeroBeDamaged)
end
if numID then
self:getFacade():sendNotification( global.NoticeTable.ActorBeDamaged, {actorID = actorID, damage = numID})
end
end
|
游戏安全课程 学员办理咨询联系QQ150330575 手机 139 9636 2600 免费课程 在 www.bilibili.com 搜 郁金香灬老师
|
|