初始化提交

This commit is contained in:
2025-07-09 01:08:35 +08:00
parent d3296791cf
commit 62e0f56c60
618 changed files with 173543 additions and 0 deletions

View File

@ -0,0 +1,58 @@
local _M = {}
local GameplayEventData = import("GameplayEventData")
local GetGameplayTag = require("GamePlay.Utils").GetGameplayTag
local BusyGamePlayLibrary = import("BusyGamePlayLibrary")
local BusyActorManagerSubSystem = import("BusyActorManagerSubSystem")
local AbilitySystemBlueprintLibrary = import("AbilitySystemBlueprintLibrary")
function _M.ChangeHealth(role, value)
local asc = AbilitySystemBlueprintLibrary.GetAbilitySystemComponent(role)
local ge = asc.AbilityEffectConfigs:Get("ChangeHealth")
local cost_handle = asc:MakeOutgoingSpec(ge, 1, asc:MakeEffectContext())
AbilitySystemBlueprintLibrary.AssignTagSetByCallerMagnitude(
cost_handle, GetGameplayTag("Change.Role.Health"),
role:CalcRealChangeByHealth(value)
)
asc:BP_ApplyGameplayEffectSpecToSelf(cost_handle)
end
function _M.ChangeHunger(role, value)
local asc = AbilitySystemBlueprintLibrary.GetAbilitySystemComponent(role)
local ge = asc.AbilityEffectConfigs:Get("ChangeHunger")
local hunger_cost, health_cost = role:CalcRealChangeByHunger(value)
local cost_handle = asc:MakeOutgoingSpec(ge, 1, asc:MakeEffectContext())
AbilitySystemBlueprintLibrary.AssignTagSetByCallerMagnitude(
cost_handle, GetGameplayTag("Change.Role.Health"), health_cost
)
AbilitySystemBlueprintLibrary.AssignTagSetByCallerMagnitude(
cost_handle, GetGameplayTag("Change.Role.Hunger"), hunger_cost
)
asc:BP_ApplyGameplayEffectSpecToSelf(cost_handle)
end
function _M.GetRole(wco)
local mgr = BusyActorManagerSubSystem.Get(wco)
return mgr.current_role
end
function _M.EatFood(wco, item_id)
local role = _M.GetRole(wco)
local EventData = GameplayEventData()
EventData.EventMagnitude = item_id
role:TryActiveAbility("Ability.Role.EatFood", EventData)
end
function _M.GetRoleConfig(role_id)
local data_table = BusyGamePlayLibrary.GetGameDataTable("RoleConfig")
local row_data = data_table:FindRow(role_id, "error in here")
print(row_data)
end
return _M