53 lines
1.8 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class UGCGameMode_C:BP_UGCGameBase_C
--Edit Below--
---@type AUGCGameModeBase
local UGCGameMode = {};
function UGCGameMode:ReceiveBeginPlay()
self.bIsOpenShovelingAbility = DefaultSettings.OpenShovel;
-- 拿到本身
GameMode = self;
UGCBlueprintFunctionLibrary.InitGameModeStates();
UGCBlueprintFunctionLibrary.ChangeGameModeState("FightingState");
self.SuperClass.ReceiveBeginPlay(self);
end
-- function UGCGameMode:ReceiveTick(DeltaTime) end
-- function UGCGameMode:ReceiveEndPlay() end
function UGCGameMode:LuaModifyDamage(Damage, DamageType, InstigatorPlayerState, VictimPlayerState)
UGCLogSystem.Log("[UGCGameMode:LuaModifyDamage] 接收到基准伤害:%f", Damage);
local Instigator = nil;
local Causer = nil;
if InstigatorPlayerState ~= nil and UE.IsValid(InstigatorPlayerState) then
Instigator = UGCGameSystem.GetPlayerControllerByPlayerKey(InstigatorPlayerState.PlayerKey);
Causer = UGCGameSystem.GetPlayerPawnByPlayerKey(InstigatorPlayerState.PlayerKey);
end
-- 处理击杀者的伤害
if Causer then
Damage = Damage * Causer:GetDamageScale();
end
-- 处理护甲
local Victim = UGCGameSystem.GetPlayerPawnByPlayerKey(VictimPlayerState.PlayerKey);
Damage = Victim:HandleDamage(Damage);
-- 判断是否可以忽略伤害
if Victim.IgnoreHitTimes > 0 then
Victim.IgnoreHitTimes = Victim.IgnoreHitTimes - 1;
Damage = 0;
end
return table.func(UGCGameSystem.GameState.MiniGameManager, "OnPlayerDamage", Victim, Damage, DamageType, Instigator);
end
---@param PlayerController UGCPlayerController_C
---@param Target APickUpWrapperActor
---@param ItemID int32
---@param Count int32
function UGCGameMode:UGC_PlayerPickUpEvent(PlayerController, Target, ItemID, Count)
PluginManager:OnPlayerPickup(PlayerController, Target, ItemID, Count)
end
return UGCGameMode;