Helper function to make applying Pact Status less Verbose
Closed this issue · 1 comments
Is your feature request related to a problem? Please describe.
Currently, to apply the PACT_BLADE equipment status, as well as a status for the variants introduced in the library, you would need to make multiple ApplyEquipmentStatus() calls, which all get fairly wordy. It would be nice to have function which doesn't require as much input to utilize - perhaps make the parameters entirely optional.
Describe the solution you'd like
I have a current implementation as follows:
--[[ Optional replacement for ApplyEquipmentStatus specific to Pact Statuses -
Optional replacement for ApplyEquipmentStatus specific to Pact Statuses:
@positon: Is MainHand or OffHand, boolean, default to True (main)
@attribute: Attribute, string, default to 'CHA'
@chance: Chance to Apply, int, default to 100
@duration: Duration in Rounds, int, default to -1
]]--
function CL_ApplyEquipmentPactStatus(weaponEntity, attribute, chance, duration)
local weaponEntity = weaponEntity or GetActiveWeapon(context.Source, true)
local attribute = attribute or 'CHA'
local chance = chance or 100
local duration = duration or -1
local pact_stat = 'PACT_BLADE'
if attribute ~= 'CHA'
pact_stat = 'CL_' + pact_stat + '_' + attribute
end
return ApplyEquipmentStatus(weaponEntity, pact_stat, chance, duration)
end
Expected implementation would look something like:
ApplyEquipmentPactStatus()
= Apply PACT_BLADE on MainHand Weapon,
ApplyEquipmentPactStatus(false, DEX)
= Apply CL_PACT_BLADE_DEX on OffHand Weapon
ApplyEquipmentPactStatus(false, DEX, 50)
= Apply CL_PACT_BLADE_DEX on OffHand Weapon with 50% chance of success
ApplyEquipmentPactStatus(true, CON, 100, 5)
= Apply CL_PACT_BLADE_CON on MainHand Weapon with 100% chance of success for 5 rounds
However, it still needs some work, as currently it crashes the game on game start.
--[[ Optional replacement for ApplyEquipmentStatus specific to Pact Statuses -
Optional replacement for ApplyEquipmentStatus specific to Pact Statuses:
@positon: Is MainHand or OffHand, boolean, default to True (main)
@attribute: Attribute, string, default to 'CHA'
@chance: Chance to Apply, int, default to 100
@duration: Duration in Rounds, int, default to -1
]]--
function CL_ApplyEquipmentPactStatus(weapon, attribute, chance, duration)
local weapon = weapon or true
local attribute = attribute or 'CHA'
local chance = chance or 100
local duration = duration or -1
local pact_stat = 'PACT_BLADE'
if attribute ~= 'CHA' then
pact_stat = 'CL_' .. pact_stat .. '_' .. attribute
end
return ApplyEquipmentStatus(weapon, pact_stat, chance, duration)
end
Doesn't crash the game, but needs testing