c0000.hks

Created Diff never expires
11 removals
Words removed24
Total words2436
Words removed (%)0.99
754 lines
10 additions
Words added34
Total words2446
Words added (%)1.39
753 lines
------------------------------------------
------------------------------------------
-- Fixed decompiled c0000.hks for ELDEN RING
-- Fixed decompiled c0000.hks for ELDEN RING
-- Refined from decompiles by Vawser
-- Refined from decompiles by Vawser
-- Curated at: https://github.com/ividyon/EldenRingHKS
-- Curated at: https://github.com/ividyon/EldenRingHKS
------------------------------------------
------------------------------------------
-- Version 17 (For ER HKS last updated in 1.15.1)
-- Version 17 (For ER HKS last updated in 1.15.1)
------------------------------------------
------------------------------------------
-- Changelog:
-- Changelog:
-- 2022-12-15 - AshenOne: ExecMagic (line 2090), moving an if block so left-hand casting works as intended
-- 2022-12-15 - AshenOne: ExecMagic (line 2090), moving an if block so left-hand casting works as intended
-- 2022-12-16 - ivi: Updated for 1.08.1
-- 2022-12-16 - ivi: Updated for 1.08.1
-- 2022-12-28 - Kirnifr: fixed Torrent dash
-- 2022-12-28 - Kirnifr: fixed Torrent dash
-- 2023-01-27 - Massive overhaul and improvements by Vawser from Vigil
-- 2023-01-27 - Massive overhaul and improvements by Vawser from Vigil
-- Properly fixes Torrent dash as well as flick animation issues
-- Properly fixes Torrent dash as well as flick animation issues
-- proper act/env naming instead of IDs, proper spacing, useful comments
-- proper act/env naming instead of IDs, proper spacing, useful comments
-- 2023-01-27 - ivi: Minor oversight fixes
-- 2023-01-27 - ivi: Minor oversight fixes
-- 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)


if weight == WEIGHT_LIGHT then
if weight == WEIGHT_LIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_LIGHT)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_LIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_LIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_LIGHT)
elseif weight == WEIGHT_NORMAL then
elseif weight == WEIGHT_NORMAL then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_NORMAL)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_NORMAL)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_MEDIUM)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_MEDIUM)
elseif weight == WEIGHT_HEAVY then
elseif weight == WEIGHT_HEAVY then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif weight == WEIGHT_OVERWEIGHT then
elseif weight == WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_OVERWEIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_OVERWEIGHT)
elseif weight == WEIGHT_SUPERLIGHT then
elseif weight == WEIGHT_SUPERLIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_SUPERLIGHT)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_SUPERLIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_SUPERLIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_SUPERLIGHT)
else
else
SetVariable("MoveWeightIndex", 0)
SetVariable("MoveWeightIndex", 0)
end
end


if env(GetSpEffectID, 503520) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
if env(GetSpEffectID, 503520) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 5520) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
elseif env(GetSpEffectID, 5520) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 425) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
elseif env(GetSpEffectID, 425) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 4101) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
elseif env(GetSpEffectID, 4101) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 4100) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
elseif env(GetSpEffectID, 4100) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
elseif env(GetSpEffectID, 19670) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
elseif env(GetSpEffectID, 19670) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
end
end
end
end


function SetAIActionState()
function SetAIActionState()
act(SetAIAttackState, env(GetNpcAIAttackRequestIDAfterBlend))
act(SetAIAttackState, env(GetNpcAIAttackRequestIDAfterBlend))
end
end


function SetAttackHand(hand)
function SetAttackHand(hand)
act(WeaponParameterReference, hand)
act(WeaponParameterReference, hand)
end
end


function SetGuardHand(hand)
function SetGuardHand(hand)
act(SetThrowPossibilityState_Attacker, hand)
act(SetThrowPossibilityState_Attacker, hand)
end
end


function SetEnableAimMode()
function SetEnableAimMode()
if env(ActionDuration, ACTION_ARM_ACTION) > 0 then
if env(ActionDuration, ACTION_ARM_ACTION) > 0 then
return
return
end
end


local style = c_Style
local style = c_Style
local isRide = env(IsOnMount)
local isRide = env(IsOnMount)


if isRide == TRUE then
if isRide == TRUE then
if style == HAND_LEFT_BOTH then
if style == HAND_LEFT_BOTH then
if GetEquipType(HAND_LEFT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_CROSSBOW)
if GetEquipType(HAND_LEFT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_CROSSBOW)
== TRUE then
== TRUE then
act(SetIsPreciseShootingPossible)
act(SetIsPreciseShootingPossible)
end
end
elseif GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_CROSSBOW)
elseif GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_CROSSBOW)
== TRUE then
== TRUE then
act(SetIsPreciseShootingPossible)
act(SetIsPreciseShootingPossible)
end
end
elseif style == HAND_LEFT_BOTH then
elseif style == HAND_LEFT_BOTH then
if GetEquipType(HAND_LEFT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_LARGE_ARROW,
if GetEquipType(HAND_LEFT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_LARGE_ARROW,
WEAPON_CATEGORY_CROSSBOW, WEAPON_CATEGORY_BALLISTA) == TRUE then
WEAPON_CATEGORY_CROSSBOW, WEAPON_CATEGORY_BALLISTA) == TRUE then
act(SetIsPreciseShootingPossible)
act(SetIsPreciseShootingPossible)
end
end
elseif style == HAND_RIGHT_BOTH
elseif style == HAND_RIGHT_BOTH
and GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_LARGE_ARROW,
and GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_LARGE_ARROW,
WEAPON_CATEGORY_CROSSBOW, WEAPON_CATEGORY_BALLISTA) == TRUE then
WEAPON_CATEGORY_CROSSBOW, WEAPON_CATEGORY_BALLISTA) == TRUE then
act(SetIsPreciseShootingPossible)
act(SetIsPreciseShootingPossible)
end
end
end
end


function Replanning()
function Replanning()
act(DoAIReplanningAtCancelTiming)
act(DoAIReplanningAtCancelTiming)
end
end


function AddStamina(num)
function AddStamina(num)
act(SetStaminaRecoveryDisabled)
act(SetStaminaRecoveryDisabled)
act(ChangeStamina, num)
act(ChangeStamina, num)
end
end


function GetLocomotionState()
function GetLocomotionState()
local state = GetVariable("LowerDefaultState00")
local state = GetVariable("LowerDefaultState00")


if state == MOVE_DEF0 or state == STEALTHMOVE_DEF0 then
if state == MOVE_DEF0 or state == STEALTHMOVE_DEF0 then
if env(GetSpEffectID, 100000) == TRUE then
if env(GetSpEffectID, 100000) == TRUE then
return PLAYER_STATE_MOVE
return PLAYER_STATE_MOVE
elseif env(GetSpEffectID, 100001) == TRUE then
elseif env(GetSpEffectID, 100001) == TRUE then
return PLAYER_STATE_MOVE
return PLAYER_STATE_MOVE
elseif env(GetSpEffectID, 100002) == TRUE then
elseif env(GetSpEffectID, 100002) == TRUE then
return PLAYER_STATE_MOVE
return PLAYER_STATE_MOVE
end
end
end
end
return PLAYER_STATE_IDLE
return PLAYER_STATE_IDLE
end
end


function SetInterruptType(num)
function SetInterruptType(num)
act(AINotifyAttackType, num)
act(AINotifyAttackType, num)
end
end


function SetTurnSpeed(turn_speed)
function SetTurnSpeed(turn_speed)
act(SetTurnSpeed, turn_speed)
act(SetTurnSpeed, turn_speed)
end
end


function SetRollingTurnCondition(is_selftrans)
function SetRollingTurnCondition(is_selftrans)
local rolling_angle = "RollingAngleReal"
local rolling_angle = "RollingAngleReal"


if is_selftrans == TRUE then
if is_selftrans == TRUE then
rolling_angle = "RollingAngleRealSelftrans"
rolling_angle = "RollingAngleRealSelftrans"
end
end


if GetVariable("IsLockon") == true then
if GetVariable("IsLockon") == true then
local angle = GetVariable("TurnAngleReal")
local angle = GetVariable("TurnAngleReal")
if angle > 180 then
if angle > 180 then
SetTurnSpeed(0)
SetTurnSpeed(0)
elseif angle > 90 then
elseif angle > 90 then
SetTurnSpeed(360)
SetTurnSpeed(360)
end
end
elseif env(IsPrecisionShoot) == TRUE then
elseif env(IsPrecisionShoot) == TRUE then
SetTurnSpeed(0)
SetTurnSpeed(0)
SetVariable("TurnAngleReal", 300)
SetVariable("TurnAngleReal", 300)
elseif math.abs(GetVariable(rolling_angle)) > 0.0010000000474974513 then
elseif math.abs(GetVariable(rolling_angle)) > 0.0010000000474974513 then
SetTurnSpeed(0)
SetTurnSpeed(0)
elseif GetVariable("TurnAngleReal") > 200 then
elseif GetVariable("TurnAngleReal") > 200 then
SetTurnSpeed(0)
SetTurnSpeed(0)
end
end
end
end


function IsLowerQuickTurn()
function IsLowerQuickTurn()
if GetVariable("LowerDefaultState00") == QUICKTURN_DEF0 and env(GetSpEffectID, 100010) == TRUE then
if GetVariable("LowerDefaultState00") == QUICKTURN_DEF0 and env(GetSpEffectID, 100010) == TRUE then
return TRUE
return TRUE
end
end
return FALSE
return FALSE
end
end


function IsLowerBackStep()
function IsLowerBackStep()
if GetVariable("LowerDefaultState00") == BACKSTEP_DEF0 then
if GetVariable("LowerDefaultState00") == BACKSTEP_DEF0 then
return TRUE
return TRUE
end
end
return FALSE
return FALSE
end
end


function IsDualBladeSpecific(hand)
function IsDualBladeSpecific(hand)
if hand == HAND_LEFT then
if hand == HAND_LEFT then
return env(IsTwinSwords, 0)
return env(IsTwinSwords, 0)
else
else
return env(IsTwinSwords, 1)
return env(IsTwinSwords, 1)
end
end
end
end


function GetEquipType(hand, ...)
function GetEquipType(hand, ...)
local buff = {...}
local buff = {...}
local kind = {}
local kind = {}
local num = 1
local num = 1


if hand == HAND_BOTH then
if hand == HAND_BOTH then
kind[1] = env(GetEquipWeaponCategory, HAND_LEFT)
kind[1] = env(GetEquipWeaponCategory, HAND_LEFT)
kind[2] = env(GetEquipWeaponCategory, HAND_RIGHT)
kind[2] = env(GetEquipWeaponCategory, HAND_RIGHT)
num = 2
num = 2
else
else
kind[1] = env(GetEquipWeaponCategory, hand)
kind[1] = env(GetEquipWeaponCategory, hand)
end
end


for i = 1, num, 1 do
for i = 1, num, 1 do
for j = 1, #buff, 1 do
for j = 1, #buff, 1 do
if kind[i] == buff[j] then
if kind[i] == buff[j] then
return TRUE
return TRUE
end
end
end
end
end
end
return FALSE
return FALSE
end
end


function GetEquipTypeHandStyle(arg)
function GetEquipTypeHandStyle(arg)
if c_Style == HAND_LEFT_BOTH then
if c_Style == HAND_LEFT_BOTH then
local kind = env(GetEquipWeaponCategory, HAND_LEFT)
local kind = env(GetEquipWeaponCategory, HAND_LEFT)
return kind
return kind
else
else
local kind = env(GetEquipWeaponCategory, HAND_RIGHT)
local kind = env(GetEquipWeaponCategory, HAND_RIGHT)
return kind
return kind
end
end
end
end


function IsHandStyleBoth(arg)
function IsHandStyleBoth(arg)
if c_Style == HAND_RIGHT_BOTH or c_Style == HAND_LEFT_BOTH then
if c_Style == HAND_RIGHT_BOTH or c_Style == HAND_LEFT_BOTH then
return TRUE
return TRUE
end
end
return FALSE
return FALSE
end
end


function SetVariable(name, value)
function SetVariable(name, value)
act(SetHavokVariable, name, value)
act(SetHavokVariable, name, value)
end
end


function IsWeaponCanGuard()
function IsWeaponCanGuard()
local style = c_Style
local style = c_Style
local kind = 0
local kind = 0
local pos = 0
local pos = 0
if style == HAND_RIGHT then
if style == HAND_RIGHT then
kind = env(GetEquipWeaponCategory, HAND_LEFT)
kind = env(GetEquipWeaponCategory, HAND_LEFT)
pos = 2
pos = 2
elseif style == HAND_LEFT_BOTH then
elseif style == HAND_LEFT_BOTH then
kind = env(GetEquipWeaponCategory, HAND_LEFT)
kind = env(GetEquipWeaponCategory, HAND_LEFT)
pos = 3
pos = 3
else
else
kind = env(GetEquipWeaponCategory, HAND_RIGHT)
kind = env(GetEquipWeaponCategory, HAND_RIGHT)
pos = 3
pos = 3
end
end


for i = 1, #WeaponCategoryID, 1 do
for i = 1, #WeaponCategoryID, 1 do
if WeaponCategoryID[i][1] == kind then
if WeaponCategoryID[i][1] == kind then
local canguard = WeaponCategoryID[i][pos]
local canguard = WeaponCategoryID[i][pos]
return canguard
return canguard
end
end
end
end
end
end


function IsEnableGuard()
function IsEnableGuard()
local style = c_Style
local style = c_Style
local hand = HAND_LEFT
local hand = HAND_LEFT


if style == HAND_RIGHT_BOTH then
if style == HAND_RIGHT_BOTH then
hand = HAND_RIGHT
hand = HAND_RIGHT
end
end


local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, hand)
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, hand)


if style == HAND_RIGHT and GetEquipType(hand, WEAPON_CATEGORY_STAFF) == TRUE then
if style == HAND_RIGHT and GetEquipType(hand, WEAPON_CATEGORY_STAFF) == TRUE then
return FALSE
return FALSE
end
end
-- Power Stance Mod : Rellana Twin Blade Fix
--[[
if sp_kind == 249 and (style == HAND_LEFT_BOTH or style == HAND_RIGHT_BOTH) then
if sp_kind == 249 and (style == HAND_LEFT_BOTH or style == HAND_RIGHT_BOTH) then
return FALSE
return FALSE
end
]] --

-- Power Stance Mod : Dual Wielded Weapons can guard
if IsWeaponCanGuard() == FALSE and IsEnableDualWielding() == HAND_RIGHT then
return TRUE
end
end
if IsWeaponCanGuard() == FALSE then
if IsWeaponCanGuard() == FALSE then
return FALSE
return FALSE
end
end
if IsEnableDualWielding() ~= -1 then
if IsEnableDualWielding() ~= -1 then
return FALSE
return FALSE
end
end
return TRUE
return TRUE
end
end


function ExecGuard(event, blend_type)
function ExecGuard(event, blend_type)
if env(ActionDuration, ACTION_ARM_ACTION) > 0 then
if env(ActionDuration, ACTION_ARM_ACTION) > 0 then
return FALSE
return FALSE
end
end
if c_IsStealth == TRUE then
if c_IsStealth == TRUE then
blend_type = ALLBODY
blend_type = ALLBODY
end
end
if env(ActionRequest, ACTION_ARM_L1) == TRUE or env(ActionDuration, ACTION_ARM_L1) > 0 then
if env(ActionRequest, ACTION_ARM_L1) == TRUE or env(ActionDuration, ACTION_ARM_L1) > 0 then
if env(GetStamina) <= 0 then
if env(GetStamina) <= 0 then
return FALSE
return FALSE
end
end
if IsEnableGuard() == TRUE then
if IsEnableGuard() == TRUE then
local style = c_Style
local style = c_Style
local hand = HAND_LEFT
local hand = HAND_LEFT


if style == HAND_RIGHT_BOTH then
if style == HAND_RIGHT_BOTH then
hand = HAND_RIGHT
hand = HAND_RIGHT
end
end


local kind = env(GetEquipWeaponCategory, hand)
local kind = env(GetEquipWeaponCategory, hand)
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, hand)
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, hand)
local guardindex = env(GetGuardMotionCategory, hand)
local guardindex = env(GetGuardMotionCategory, hand)


if kind == WEAPON_CATEGORY_DUELING_SHIELD then
if kind == WEAPON_CATEGORY_DUELING_SHIELD then
guardindex = GUARD_STYLE_DUELINGSHIELD
guardindex = GUARD_STYLE_DUELINGSHIELD
end
end


-- Set Torch Color
-- Set Torch Color
if kind == WEAPON_CATEGORY_TORCH and style == HAND_RIGHT then
if kind == WEAPON_CATEGORY_TORCH and style == HAND_RIGHT then
guardindex = GUARD_STYLE_TORCH
guardindex = GUARD_STYLE_TORCH


if sp_kind == 291 then
if sp_kind == 291 then
SetVariable("IndexTorchColor", 1) -- Ghostflame Torch
SetVariable("IndexTorchColor", 1) -- Ghostflame Torch
elseif sp_kind == 292 then
elseif sp_kind == 292 then
SetVariable("IndexTorchColor", 2) -- St. Trina's Torch
SetVariable("IndexTorchColor", 2) -- St. Trina's Torch
elseif sp_kind == 288 then
elseif sp_kind == 288 then
SetVariable("IndexTorchColor", 3) -- Nanaya's Torch
SetVariable("IndexTorchColor", 3) -- Nanaya's Torch
else
else
SetVariable("IndexTorchColor", 0) -- Torch
SetVariable("IndexTorchColor", 0) -- Torch
end
end
elseif sp_kind == 240 and style == HAND_RIGHT then
elseif sp_kind == 240 and style == HAND_RIGHT then
guardindex = GUARD_STYLE_TORCH
guardindex = GUARD_STYLE_TORCH
elseif style == HAND_RIGHT_BOTH or style == HAND_LEFT_BOTH then
elseif style == HAND_RIGHT_BOTH or style == HAND_LEFT_BOTH then
if env(GetStayAnimCategory) ~= 15 and env(GetStayAnimCategory) ~= 0 and env(GetStayAnimCategory) ~= 2
if env(GetStayAnimCategory) ~= 15 and env(GetStayAnimCategory) ~= 0 and env(GetStayAnimCategory) ~= 2
and env(GetStayAnimCategory) ~= 3 then
and env(GetStayAnimCategory) ~= 3 then
guardindex = GUARD_STYLE_DEFAULT
guardindex = GUARD_STYLE_DEFAULT
end
end
if kind == WEAPON_CATEGORY_DUELING_SHIELD then
if kind == WEAPON_CATEGORY_DUELING_SHIELD then
guardindex = GUARD_STYLE_DUELINGSHIELD
guardindex = GUARD_STYLE_DUELINGSHIELD
end
end
end
end


if env(GetSpEffectID, 172) == TRUE then
if env(GetSpEffectID, 172) == TRUE then
SetVariable("GuardStartType", 1)
SetVariable("GuardStartType", 1)
else
else
SetVariable("GuardStartType", 0)
SetVariable("GuardStartType", 0)
end
end


SetVariable("IndexGuardStyle", guardindex)
SetVariable("IndexGuardStyle", guardindex)


if blend_type == ALLBODY and MoveStart(LOWER, Event_MoveLong, FALSE) == TRUE then
if blend_type == ALLBODY and MoveStart(LOWER, Event_MoveLong, FALSE) == TRUE then
blend_type = UPPER
blend_type = UPPER
end
end


if env(GetSpEffectID, 102000) == TRUE and event ~= Event_GuardOn then
if env(GetSpEffectID, 102000) == TRUE and event ~= Event_GuardOn then
local is_after_additive_just_guard = FALSE
local is_after_additive_just_guard = FALSE
if env(GetSpEffectID, 102020) == TRUE or env(GetSpEffectID, 102022) == TRUE then
if env(GetSpEffectID, 102020) == TRUE or env(GetSpEffectID, 102022) == TRUE then
is_after_additive_just_guard = TRUE
is_after_additive_just_guard = TRUE
end
end
if env(GetSpEffectID, 102002) == TRUE and is_after_additive_just_guard == FALSE then
if env(GetSpEffectID, 102002) == TRUE and is_after_additive_just_guard == FALSE then
event = Event_GuardStart_JustGuard2
event = Event_GuardStart_JustGuard2
elseif env(GetSpEffectID, 102003) == TRUE and is_after_additive_just_guard == FALSE then
elseif env(GetSpEffectID, 102003) == TRUE and is_after_additive_just_guard == FALSE then
event = Event_GuardStart_JustGuard3
event = Event_GuardStart_JustGuard3
elseif env(GetSpEffectID, 102004) == TRUE and is_after_additive_just_guard == FALSE then
elseif env(GetSpEffectID, 102004) == TRUE and is_after_additive_just_guard == FALSE then
if IsNodeActive("GuardStart_JustGuard4_Upper Selector") == TRUE then
if IsNodeActive("GuardStart_JustGuard4_Upper Selector") == TRUE then
event = Event_GuardStart_JustGuard4_SelfTrans
event = Event_GuardStart_JustGuard4_SelfTrans
else
else
event = Event_GuardStart_JustGuard4
event = Event_GuardStart_JustGuard4
end
end
elseif event ~= Event_GuardStart then
elseif event ~= Event_GuardStart then
elseif IsNodeActive("GuardStart_JustGuard_Upper Selector") == TRUE then
elseif IsNodeActive("GuardStart_JustGuard_Upper Selector") == TRUE then
event = Event_GuardStart_JustGuard_SelfTrans
event = Event_GuardStart_JustGuard_SelfTrans
else
else
event = Event_GuardStart_JustGuard
event = Event_GuardStart_JustGuard
end
end
end
end


act(AddSpEffect, 102021)
act(AddSpEffect, 102021)
ExecEventHalfBlend(event, blend_type)
ExecEventHalfBlend(event, blend_type)


return TRUE
return TRUE
end
end
end
end
return FALSE
return FALSE
end
end


function ResetRequest()
function ResetRequest()
act(ResetInputQueue)
act(ResetInputQueue)
end
end


function CheckActionRequest()
function CheckActionRequest()
return env(HasActionRequest)
return env(HasActionRequest)
end
end


function ExecStop()
function ExecStop()
-- 100200 "[HKS] Gesture Anim"
-- 100200 "[HKS] Gesture Anim"


if GetVariable("MoveSpeedLevel") > 0 and env(GetSpEffectID, 100200) == FALSE then
if GetVariable("MoveSpeedLevel") > 0 and env(GetSpEffectID, 100200) == FALSE then
return FALSE
return FALSE
end
end


local stop_speed = GetVariable("MoveSpeedLevelReal")
local stop_speed = GetVariable("MoveSpeedLevelReal")
local movedirection = GetVariable("MoveDirection")
local movedirection = GetVariable("MoveDirection")
local stop_speed_threshold = 0.3499999940395355
local stop_speed_threshold = 0.3499999940395355


SetVariable("ToggleDash", 0)
SetVariable("ToggleDash", 0)
SetWeightIndex()
SetWeightIndex()


if GetVariable("EvasionWeightIndex") == EVASION_WEIGHT_INDEX_OVERWEIGHT and stop_speed > 0.3499999940395355 then
if GetVariable("EvasionWeightIndex") == EVASION_WEIGHT_INDEX_OVERWEIGHT and stop_speed > 0.3499999940395355 then
stop_speed = stop_speed_threshold
stop_speed = stop_speed_threshold
end
end


if stop_speed >= 0 and stop_speed <= 1 then
if stop_speed >= 0 and stop_speed <= 1 then
if stop_speed <= stop_speed_threshold then
if stop_speed <= stop_speed_threshold then
if c_IsStealth == TRUE then
if c_IsStealth == TRUE then
ExecEventAllBody("W_Stealth_Idle")
ExecEventAllBody("W_Stealth_Idle")
else
else
ExecEventAllBody("W_Idle")
ExecEventAllBody("W_Idle")
end
end
elseif c_IsStealth == TRUE then
elseif c_IsStealth == TRUE then
if movedirection == 0 then
if movedirection == 0 then
ExecEventAllBody("W_StealthRunStopFront")
ExecEventAllBody("W_StealthRunStopFront")
elseif movedirection == 1 then
elseif movedirection == 1 then
ExecEventAllBody("W_StealthRunStopBack")
ExecEventAllBody("W_StealthRunStopBack")
elseif movedirection == 2 then
elseif movedirection == 2 then
ExecEventAllBody("W_StealthRunStopLeft")
ExecEventAllBody("W_StealthRunStopLeft")
elseif movedirection == 3 then
elseif movedirection == 3 then
ExecEventAllBody("W_StealthRunStopRight")
ExecEventAllBody("W_StealthRunStopRight")
end
end
elseif movedirection == 0 then
elseif movedirection == 0 then
ExecEventAllBody("W_RunStopFront")
ExecEventAllBody("W_RunStopFront")
elseif movedirection == 1 then
elseif movedirection == 1 then
ExecEventAllBody("W_RunStopBack")
ExecEventAllBody("W_RunStopBack")
elseif movedirection == 2 then
elseif movedirection == 2 then
ExecEventAllBody("W_RunStopLeft")
ExecEventAllBody("W_RunStopLeft")
elseif movedirection == 3 then
elseif movedirection == 3 then
ExecEventAllBody("W_RunStopRight")
ExecEventAllBody("W_RunStopRight")
end
end
elseif stop_speed > 1 then
elseif stop_speed > 1 then
if c_IsStealth == TRUE then
if c_IsStealth == TRUE then
ExecEventAllBody("W_StealthDashStop")
ExecEventAllBody("W_StealthDashStop")
else
else
ExecEventAllBody("W_DashStop")
ExecEventAllBody("W_DashStop")
end
end
elseif c_IsStealth == TRUE then
elseif c_IsStealth == TRUE then
ExecEventAllBody("W_Stealth_Idle")
ExecEventAllBody("W_Stealth_Idle")
else
else
ExecEventAllBody("W_Idle")
ExecEventAllBody("W_Idle")
end
end
return TRUE
return TRUE
end
end


function ExecStopHalfBlend(event, to_idle)
function ExecStopHalfBlend(event, to_idle)
-- 100200 "[HKS] Gesture Anim"
-- 100200 "[HKS] Gesture Anim"


if GetVariable("MoveSpeedLevel") > 0 and env(GetSpEffectID, 100200) == FALSE then
if GetVariable("MoveSpeedLevel") > 0 and env(GetSpEffectID, 100200) == FALSE then
return FALSE
return FALSE
end
end


SetVariable("LocomotionState", 0)
SetVariable("LocomotionState", 0)
if to_idle == TRUE then
if to_idle == TRUE then
ExecEventNoReset("W_Idle")
ExecEventNoReset("W_Idle")
return TRUE
return TRUE
end
end


ExecEventHalfBlendNoReset(event, LOWER)
ExecEventHalfBlendNoReset(event, LOWER)
return TRUE
return TRUE
end
end


function MoveStart(blend_type, event, gen_hand)
function MoveStart(blend_type, event, gen_hand)
-- 100200 "[HKS] Gesture Anim"
-- 100200 "[HKS] Gesture Anim"


if GetVariable("MoveSpeedLevel") <= 0 then
if GetVariable("MoveSpeedLevel") <= 0 then
return FALSE
return FALSE
end
end


if env(GetSpEffectID, 100200) == TRUE then
if env(GetSpEffectID, 100200) == TRUE then
return FALSE
return FALSE
end
end


if blend_type ~= LOWER then
if blend_type ~= LOWER then
if gen_hand == FALSE then
if gen_hand == FALSE then
SetVariable("ArtsTransition", 0)
SetVariable("ArtsTransition", 0)
else
else
SetArtsGeneratorTransitionIndex()
SetArtsGeneratorTransitionIndex()
end
end
end
end


SetBonfireIndex()
SetBonfireIndex()


local stealth_state = GetVariable("StealthState")
local stealth_state = GetVariable("StealthState")


if (stealth_state == STEALTH_TO_STEALTHIDLE or stealth_state == STEALTH_TO_IDLE)
if (stealth_state == STEALTH_TO_STEALTHIDLE or stealth_state == STEALTH_TO_IDLE)
and GetVariable("StealthTransitionIndex") > 0 then
and GetVariable("StealthTransitionIndex") > 0 then
ExecEventHalfBlendNoReset(event, blend_type)
ExecEventHalfBlendNoReset(event, blend_type)
return TRUE
return TRUE
end
end


if GetLocomotionState() ~= PLAYER_STATE_MOVE then
if GetLocomotionState() ~= PLAYER_STATE_MOVE then
SetVariable("MoveSpeedLevelReal", 0)
SetVariable("MoveSpeedLevelReal", 0)
SpeedUpdate()
SpeedUpdate()
end
end


ExecEventHalfBlend(event, blend_type)
ExecEventHalfBlend(event, blend_type)


return TRUE
return TRUE
end
end


function MoveStartonCancelTiming(event, gen_hand)
function MoveStartonCancelTiming(event, gen_hand)
if env(IsMoveCancelPossible) == TRUE then
if env(IsMoveCancelPossible) == TRUE then
if GetLocomotionState() == PLAYER_STATE_MOVE then
if GetLocomotionState() == PLAYER_STATE_MOVE then
if MoveStart(UPPER, event, gen_hand) == TRUE then
if MoveStart(UPPER, event, gen_hand) == TRUE then
return TRUE
return TRUE
end
end
elseif MoveStart(ALLBODY, event, gen_hand) == TRUE then
elseif MoveStart(ALLBODY, event, gen_hand) == TRUE then
return TRUE
return TRUE
end
end
end
end
return FALSE
return FALSE
end
end


function SetBaseCategory()
function SetBaseCategory()
SetVariable("IndexBaseCategory", GetBaseCategory())
SetVariable("IndexBaseCategory", GetBaseCategory())
end
end


function GetBaseCategory()
function GetBaseCategory()
-- Stay Anim is Weapon Motion Position ID
-- Stay Anim is Weapon Motion Position ID
local basecategoryid = 0
local basecategoryid = 0
local index = 0
local index = 0
basecategoryid = env(GetStayAnimCategory)
basecategoryid = env(GetStayAnimCategory)


if basecategoryid == 0 then
if basecategoryid == 0 then
index = 0
index = 0
elseif basecategoryid == 2 or basecategoryid == 12 then
elseif basecategoryid == 2 or basecategoryid == 12 then
index = 1
index = 1
elseif basecategoryid == 3 or basecategoryid == 13 then
elseif basecategoryid == 3 or basecategoryid == 13 then
index = 2
index = 2
end
end
return index
return index
end
end


function SetArtCancelType()
function SetArtCancelType()
if IsEnableSwordArts() == TRUE then
if IsEnableSwordArts() == TRUE then
act(SetWeaponCancelType, env(GetWeaponCancelType, c_SwordArtsHand))
act(SetWeaponCancelType, env(GetWeaponCancelType, c_SwordArtsHand))
else
else
act(SetWeaponCancelType, 0)
act(SetWeaponCancelType, 0)
end
end
end
end


function GetSwordArtInfo()
function GetSwordArtInfo()
local style = c_Style
local style = c_Style
local is_both = FALSE
local is_both = FALSE


if style >= HAND_LEFT_BOTH then
if style >= HAND_LEFT_BOTH then
is_both = TRUE
is_both = TRUE
end
end


local art_id = 0
local art_id = 0
local art_hand = 0
local art_hand = 0


if is_both == TRUE then
if is_both == TRUE then
if style == HAND_RIGHT_BOTH then
if style == HAND_RIGHT_BOTH then
art_hand = HAND_RIGHT
art_hand = HAND_RIGHT
elseif style == HAND_LEFT_BOTH then
elseif style == HAND_LEFT_BOTH then
art_hand = HAND_LEFT
art_hand = HAND_LEFT
end
end


art_id = env(GetSwordArtID, art_hand)
art_id = env(GetSwordArtID, art_hand)
else
else
local weaponswordartid = env(GetSwordArtID, HAND_LEFT)
local weaponswordartid = env(GetSwordArtID, HAND_LEFT)


if IsShieldArts(weaponswordartid) == FALSE and IsArrowStanceArts(weaponswordartid) == FALSE then
if IsShieldArts(weaponswordartid) == FALSE and IsArrowStanceArts(weaponswordartid) == FALSE then
art_hand = HAND_RIGHT
art_hand = HAND_RIGHT
art_id = env(GetSwordArtID, HAND_RIGHT)
art_id = env(GetSwordArtID, HAND_RIGHT)
else
else
art_hand = HAND_LEFT
art_hand = HAND_LEFT
art_id = weaponswordartid
art_id = weaponswordartid
end
end
end
end


if env(GetSpEffectID, 102150) == TRUE then
if env(GetSpEffectID, 102150) == TRUE then
art_id = 0
art_id = 0
elseif env(GetSpEffectID, 102151) == TRUE then
elseif env(GetSpEffectID, 102151) == TRUE then
art_id = 0
art_id = 0
end
end


return art_id, art_hand
return art_id, art_hand
end
end


function IsEnableSwordArts()
function IsEnableSwordArts()
-- 17 is Torch Attack
-- 17 is Torch Attack


local style = c_Style
local style = c_Style
local arts_id = c_SwordArtsID
local arts_id = c_SwordArtsID


local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, HAND_LEFT)
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, HAND_LEFT)


if env(IsOnMount) == TRUE then
if env(IsOnMount) == TRUE then
return FALSE
return FALSE
end
end


if style ~= HAND_LEFT_BOTH and c_SwordArtsHand == 0 then
if style ~= HAND_LEFT_BOTH and c_SwordArtsHand == 0 then
if IsWeaponCatalyst(sp_kind) == TRUE then
if IsWeaponCatalyst(sp_kind) == TRUE then
return FALSE
return FALSE
end
if IsShieldArts(arts_id) == TRUE then
return TRUE
else
return FALSE
end
else
if style == HAND_RIGHT and IsWeaponCatalyst(sp_kind) == TRUE then
return FALSE