-- 2023-01-27 - ivi: Put on GitHub via philiquaz' initiative
-- 2023-01-27 - ivi: Put on GitHub via philiquaz' initiative
-- 2023-02-14 - ivi: Minor comment changes
-- 2023-02-14 - ivi: Minor comment changes
-- 2023-03-19 - ivi: Support for custom Ashes of War
-- 2023-03-19 - ivi: Support for custom Ashes of War
-- 2023-09-22 - Halvard: updated for 1.10
-- 2023-09-22 - Halvard: updated for 1.10
-- - fixed the function declaration of "ExecComboMagic", it was missing two parameters.
-- - fixed the function declaration of "ExecComboMagic", it was missing two parameters.
-- - removed an "act(SetAttackType, -1)" from the function "DamageBind_onUpdate()",
-- - removed an "act(SetAttackType, -1)" from the function "DamageBind_onUpdate()",
-- all act 109 were removed many patches ago, this one was overlooked when updating this file.
-- all act 109 were removed many patches ago, this one was overlooked when updating this file.
-- - Updated the function "DrawStanceRightLoop_Upper_onUpdate()" to match changes done in 1.09
-- - Updated the function "DrawStanceRightLoop_Upper_onUpdate()" to match changes done in 1.09
-- that change the follow-up attacks done after the "spinning wheel" ash of war.
-- that change the follow-up attacks done after the "spinning wheel" ash of war.
-- - Added a note in the "ExecJump()" function, as it is changed compared to the raw decompile
-- - Added a note in the "ExecJump()" function, as it is changed compared to the raw decompile
-- I'm not sure if this was intended by previous authors of this file or simply a mistake.
-- I'm not sure if this was intended by previous authors of this file or simply a mistake.
-- For now I'm only adding a note to highlight that it was changed and leaving it at that.
-- For now I'm only adding a note to highlight that it was changed and leaving it at that.
-- - manually read through the entire file to make sure no other changes done by
-- - manually read through the entire file to make sure no other changes done by
-- FromSoftware in previous patch updates were still missing.
-- FromSoftware in previous patch updates were still missing.
-- 2024-06-28 - Exelot: Updated to ER v1.12.1 [DLC Initial Release]
-- 2024-06-28 - Exelot: Updated to ER v1.12.1 [DLC Initial Release]
-- - Recreated the entire HKS file from a fresh (raw) decompiled.
-- - Recreated the entire HKS file from a fresh (raw) decompiled.
-- This added all the new functions that were missing.
-- This added all the new functions that were missing.
-- It also fixed a bunch of logic that was incorrect due to the non-raw decompile.
-- It also fixed a bunch of logic that was incorrect due to the non-raw decompile.
-- The reason for this is because of the attempt on a 1-on-1 update had a lot of issues with it.
-- The reason for this is because of the attempt on a 1-on-1 update had a lot of issues with it.
-- - Fixed a error in ExecAttack where the 9 in arts_cat == 9 replaced with:
-- - Fixed a error in ExecAttack where the 9 in arts_cat == 9 replaced with:
-- SWORD_ART_DIFF_CAT_LARGE_WEAPON_LARGE_SHIELD instead of
-- SWORD_ART_DIFF_CAT_LARGE_WEAPON_LARGE_SHIELD instead of
-- SWORD_ART_DIFF_CAT_POLEARM_LARGE_SHIELD.
-- SWORD_ART_DIFF_CAT_POLEARM_LARGE_SHIELD.
-- - Reintroduced missing variables that were in use (blend time related).
-- - Reintroduced missing variables that were in use (blend time related).
-- - Recreation fixed the torrent bugs
-- - Recreation fixed the torrent bugs
-- 2024-06-29 - ivi: Fixed a bug with IsAttackSwordArts which prevented Ashes of War from working
-- 2024-06-29 - ivi: Fixed a bug with IsAttackSwordArts which prevented Ashes of War from working
-- 2024-07-17 - Exelot:
-- 2024-07-17 - Exelot:
-- - Fixed a bug with SetSwordArtsPointInfo causing various ashes to not having the right Ash of War
-- - Fixed a bug with SetSwordArtsPointInfo causing various ashes to not having the right Ash of War
-- while not having enough stats.
-- while not having enough stats.
-- - Added a missing check for jumping.
-- - Added a missing check for jumping.
-- - Fixed a bug that would cause Ashes of War such as Carian Grandeur to not have the ability to be cast uncharged.
-- - Fixed a bug that would cause Ashes of War such as Carian Grandeur to not have the ability to be cast uncharged.
-- 2024-07-18 - ivi: Fixed SwordArtsDiffCategory & SwordArtsPutOppositeWeapon function changes not carried over from new common_define (Twinblade AotC: Wings)
-- 2024-07-18 - ivi: Fixed SwordArtsDiffCategory & SwordArtsPutOppositeWeapon function changes not carried over from new common_define (Twinblade AotC: Wings)
-- 2024-07-23 - Exelot:
-- 2024-07-23 - Exelot:
-- - Renamed env GetWeaponID into a less confusing name: GetSwordArtID
-- - Renamed env GetWeaponID into a less confusing name: GetSwordArtID
-- - Renamed act Test_SpEffectDelete into ClearSpEffect and added a comment for it's args.
-- - Renamed act Test_SpEffectDelete into ClearSpEffect and added a comment for it's args.
-- - Added a new logic expansion section with a new function that allows for easy addition of new Weapon Catalysts.
-- - Added a new logic expansion section with a new function that allows for easy addition of new Weapon Catalysts.
-- 2024-07-30 - Exelot: Updated to ER v1.13
-- 2024-07-30 - Exelot: Updated to ER v1.13
-- 2024-08-29 - ivi: Fixed SwordArtsCategory table missing variations of existing arts for new weapon types
-- 2024-08-29 - ivi: Fixed SwordArtsCategory table missing variations of existing arts for new weapon types
-- 2024-09-11 - Exelot: Updated to ER v1.14
-- 2024-09-11 - Exelot: Updated to ER v1.14
-- 2024-10-02 - ivi: Updated to ER v1.15
-- 2024-10-02 - ivi: Updated to ER v1.15
-- 2024-10-03 - Exelot: Named almost all remaining acts and envs thanks to a list provided by ElaDiDu. Some of the existing ones have been renamed.
-- 2024-10-03 - Exelot: Named almost all remaining acts and envs thanks to a list provided by ElaDiDu. Some of the existing ones have been renamed.
-- 2024-10-10 - ivi: Support for custom spells
-- 2024-10-10 - ivi: Support for custom spells
------------------------------------------
------------------------------------------
-- Known issues:
-- Known issues:
-- N/A
-- N/A
------------------------------------------
------------------------------------------
-- Core: Functions
-- Core: Functions
------------------------------------------
------------------------------------------
function ExecEvent(state)
function ExecEvent(state)
ResetRequest()
ResetRequest()
hkbFireEvent(state)
hkbFireEvent(state)
end
end
function ExecEventSync(state)
function ExecEventSync(state)
ResetRequest()
ResetRequest()
act(PlayEventSync, state)
act(PlayEventSync, state)
end
end
function ExecEventNoReset(state)
function ExecEventNoReset(state)
hkbFireEvent(state)
hkbFireEvent(state)
end
end
function ExecEventSyncNoReset(state)
function ExecEventSyncNoReset(state)
act(PlayEventSync, state)
act(PlayEventSync, state)
end
end
function ExecEvents(...)
function ExecEvents(...)
local buff = {...}
local buff = {...}
for i = 1, #buff, 1 do
for i = 1, #buff, 1 do
ExecEvent(buff[i])
ExecEvent(buff[i])
end
end
end
end
function GetVariable(variable)
function GetVariable(variable)
return hkbGetVariable(variable)
return hkbGetVariable(variable)
end
end
function ExecEventHalfBlend(event_table, blend_type)
function ExecEventHalfBlend(event_table, blend_type)
if blend_type == ALLBODY then
if blend_type == ALLBODY then
SetVariable("MoveSpeedLevelReal", 0)
SetVariable("MoveSpeedLevelReal", 0)
local lower_event = event_table[1]
local lower_event = event_table[1]
local upper_event = lower_event .. "_Upper"
local upper_event = lower_event .. "_Upper"
ExecEvents(lower_event, upper_event)
ExecEvents(lower_event, upper_event)
for i = 2, #event_table, 1 do
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
end
elseif blend_type == LOWER then
elseif blend_type == LOWER then
ExecEvent(event_table[1])
ExecEvent(event_table[1])
for i = 2, #event_table, 1 do
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
end
end
elseif blend_type == UPPER then
elseif blend_type == UPPER then
ExecEvent(event_table[1] .. "_Upper")
ExecEvent(event_table[1] .. "_Upper")
for i = 2, #event_table, 1 do
for i = 2, #event_table, 1 do
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
end
end
end
end
end
function ExecEventHalfBlendNoReset(event_table, blend_type)
function ExecEventHalfBlendNoReset(event_table, blend_type)
if blend_type == ALLBODY then
if blend_type == ALLBODY then
local lower_event = event_table[1]
local lower_event = event_table[1]
local upper_event = lower_event .. "_Upper"
local upper_event = lower_event .. "_Upper"
ExecEventNoReset(lower_event)
ExecEventNoReset(lower_event)
ExecEventNoReset(upper_event)
ExecEventNoReset(upper_event)
for i = 2, #event_table, 1 do
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
end
elseif blend_type == LOWER then
elseif blend_type == LOWER then
ExecEventNoReset(event_table[1])
ExecEventNoReset(event_table[1])
for i = 2, #event_table, 1 do
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
end
end
elseif blend_type == UPPER then
elseif blend_type == UPPER then
ExecEventNoReset(event_table[1] .. "_Upper")
ExecEventNoReset(event_table[1] .. "_Upper")
for i = 2, #event_table, 1 do
for i = 2, #event_table, 1 do
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
end
end
end
end
end
function ExecEventAllBody(event)
function ExecEventAllBody(event)
SetVariable("MoveSpeedLevelReal", 0)
SetVariable("MoveSpeedLevelReal", 0)
ExecEvent(event)
ExecEvent(event)
end
end
function IsNodeActive(...)
function IsNodeActive(...)
local buff = {...}
local buff = {...}
for i = 1, #buff, 1 do
for i = 1, #buff, 1 do
if hkbIsNodeActive(buff[i]) then
if hkbIsNodeActive(buff[i]) then
return TRUE
return TRUE
end
end
end
end
return FALSE
return FALSE
end
end
function ResetEventState()
function ResetEventState()
SetVariable("MoveSpeedLevelReal", 0)
SetVariable("MoveSpeedLevelReal", 0)
ResetRequest()
ResetRequest()
end
end
function ResetMimicry()
function ResetMimicry()
act(AddSpEffect, 503041)
act(AddSpEffect, 503041)
end
end
function SetEnableMimicry()
function SetEnableMimicry()
g_EnableMimicry = TRUE
g_EnableMimicry = TRUE
end
end
function SetWeightIndex()
function SetWeightIndex()
local weight = math.mod(env(GetMoveAnimParamID), 20)
local weight = math.mod(env(GetMoveAnimParamID), 20)