72 lines
2.8 KiB
Lua
72 lines
2.8 KiB
Lua
|
local EventAction_PlayerDeadUpdateInfo = {
|
|||
|
DeadPlayerKey = -1;
|
|||
|
KillerPlayerKey = -1;
|
|||
|
WeaponID = -1;
|
|||
|
}
|
|||
|
-- 触发器激活时,将执行Action的Execute
|
|||
|
function EventAction_PlayerDeadUpdateInfo:Execute(...)
|
|||
|
if not UGCGameSystem.IsServer() then return end
|
|||
|
|
|||
|
-- 判断是否在游戏
|
|||
|
if UGCGameSystem.GameState.GameStateType ~= CustomEnum.EGameState.Playing and UGCGameSystem.GameState.GameStateType ~= CustomEnum.EGameState.Waiting then
|
|||
|
return true
|
|||
|
end
|
|||
|
|
|||
|
UGCLogSystem.Log("[EventAction_PlayerDeadUpdateInfo_Execute] DeadPlayerKey:%s, KillerPlayerKey:%s", tostring(self.DeadPlayerKey), tostring(self.KillerPlayerKey))
|
|||
|
|
|||
|
-- 击杀队友不计算得分
|
|||
|
if UGCPlayerStateSystem.GetTeamID(self.DeadPlayerKey) == UGCPlayerStateSystem.GetTeamID(self.KillerPlayerKey) and self.DeadPlayerKey ~= self.KillerPlayerKey then
|
|||
|
return true
|
|||
|
end
|
|||
|
|
|||
|
if self.DeadPlayerKey ~= self.KillerPlayerKey and self.KillerPlayerKey > 0 then
|
|||
|
-- 增加击杀得分
|
|||
|
PlayerScoreSystem.AddPlayerScoreData(self.KillerPlayerKey, PlayerScoreSystem.Config.EScoreType.Kills, 1)
|
|||
|
-- 增加队伍得分
|
|||
|
UGCGameSystem.GameState:AddTeamScore(UGCPlayerStateSystem.GetTeamID(self.KillerPlayerKey), 1)
|
|||
|
-- 额外得分逻辑
|
|||
|
self:OtherKillSucceedLogic()
|
|||
|
end
|
|||
|
-- 更新死亡玩家信息
|
|||
|
self:UpdateDeadPlayerLogic()
|
|||
|
-- 记录死亡数
|
|||
|
PlayerScoreSystem.AddPlayerScoreData(self.DeadPlayerKey, PlayerScoreSystem.Config.EScoreType.Deaths, 1)
|
|||
|
|
|||
|
return true
|
|||
|
end
|
|||
|
|
|||
|
function EventAction_PlayerDeadUpdateInfo:OtherKillSucceedLogic()
|
|||
|
|
|||
|
local KillerPC = UGCGameSystem.GetPlayerControllerByPlayerKey(self.KillerPlayerKey)
|
|||
|
local DeadPC = UGCGameSystem.GetPlayerControllerByPlayerKey(self.DeadPlayerKey)
|
|||
|
local DeadPlayerIsGod = DeadPC:PlayerIsGod()
|
|||
|
if KillerPC then
|
|||
|
-- 增加一个buff
|
|||
|
KillerPC:AddCanObtainIncreaseCount()
|
|||
|
if DeadPlayerIsGod then
|
|||
|
-- 死者为战神则额外增加一个buff
|
|||
|
KillerPC:AddCanObtainIncreaseCount()
|
|||
|
-- 播放诛神广播
|
|||
|
UGCSendRPCSystem.RPCEvent(nil, EventEnum.AddTip, TipConfig.TipType.KillingGod, self.KillerPlayerKey)
|
|||
|
end
|
|||
|
-- 增加一个战神进度
|
|||
|
KillerPC:AddToGodSchedule(1)
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
function EventAction_PlayerDeadUpdateInfo:UpdateDeadPlayerLogic()
|
|||
|
if GodOfWarConfig.RebirthSaveProgress then
|
|||
|
local DeadPC = UGCGameSystem.GetPlayerControllerByPlayerKey(self.DeadPlayerKey)
|
|||
|
if DeadPC then
|
|||
|
local DeadPlayerIsGod = DeadPC:PlayerIsGod()
|
|||
|
if DeadPlayerIsGod then
|
|||
|
DeadPC:SetOwnedIncrease({})
|
|||
|
DeadPC:SetToGodSchedule(0)
|
|||
|
DeadPC:SetCanObtainIncreaseCount(0)
|
|||
|
DeadPC:SetNowCanSelectIncrease({})
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
end
|
|||
|
|
|||
|
return EventAction_PlayerDeadUpdateInfo
|