-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathc0000.hks
26547 lines (23651 loc) · 838 KB
/
c0000.hks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
------------------------------------------
-- Fixed decompiled c0000.hks for ELDEN RING
-- Refined from decompiles by Vawser
-- Curated at: https://github.com/ividyon/EldenRingHKS
------------------------------------------
-- Version 17 (For ER HKS last updated in 1.15.1)
------------------------------------------
-- Changelog:
-- 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-28 - Kirnifr: fixed Torrent dash
-- 2023-01-27 - Massive overhaul and improvements by Vawser from Vigil
-- Properly fixes Torrent dash as well as flick animation issues
-- proper act/env naming instead of IDs, proper spacing, useful comments
-- 2023-01-27 - ivi: Minor oversight fixes
-- 2023-01-27 - ivi: Put on GitHub via philiquaz' initiative
-- 2023-02-14 - ivi: Minor comment changes
-- 2023-03-19 - ivi: Support for custom Ashes of War
-- 2023-09-22 - Halvard: updated for 1.10
-- - fixed the function declaration of "ExecComboMagic", it was missing two parameters.
-- - 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.
-- - 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.
-- - 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.
-- 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
-- FromSoftware in previous patch updates were still missing.
-- 2024-06-28 - Exelot: Updated to ER v1.12.1 [DLC Initial Release]
-- - Recreated the entire HKS file from a fresh (raw) decompiled.
-- 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.
-- 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:
-- SWORD_ART_DIFF_CAT_LARGE_WEAPON_LARGE_SHIELD instead of
-- SWORD_ART_DIFF_CAT_POLEARM_LARGE_SHIELD.
-- - Reintroduced missing variables that were in use (blend time related).
-- - Recreation fixed the torrent bugs
-- 2024-06-29 - ivi: Fixed a bug with IsAttackSwordArts which prevented Ashes of War from working
-- 2024-07-17 - Exelot:
-- - Fixed a bug with SetSwordArtsPointInfo causing various ashes to not having the right Ash of War
-- while not having enough stats.
-- - 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.
-- 2024-07-18 - ivi: Fixed SwordArtsDiffCategory & SwordArtsPutOppositeWeapon function changes not carried over from new common_define (Twinblade AotC: Wings)
-- 2024-07-23 - Exelot:
-- - Renamed env GetWeaponID into a less confusing name: GetSwordArtID
-- - 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.
-- 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-09-11 - Exelot: Updated to ER v1.14
-- 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-10 - ivi: Support for custom spells
------------------------------------------
-- Known issues:
-- N/A
------------------------------------------
-- Core: Functions
------------------------------------------
function ExecEvent(state)
ResetRequest()
hkbFireEvent(state)
end
function ExecEventSync(state)
ResetRequest()
act(PlayEventSync, state)
end
function ExecEventNoReset(state)
hkbFireEvent(state)
end
function ExecEventSyncNoReset(state)
act(PlayEventSync, state)
end
function ExecEvents(...)
local buff = {...}
for i = 1, #buff, 1 do
ExecEvent(buff[i])
end
end
function GetVariable(variable)
return hkbGetVariable(variable)
end
function ExecEventHalfBlend(event_table, blend_type)
if blend_type == ALLBODY then
SetVariable("MoveSpeedLevelReal", 0)
local lower_event = event_table[1]
local upper_event = lower_event .. "_Upper"
ExecEvents(lower_event, upper_event)
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
elseif blend_type == LOWER then
ExecEvent(event_table[1])
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
end
elseif blend_type == UPPER then
ExecEvent(event_table[1] .. "_Upper")
for i = 2, #event_table, 1 do
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
end
end
function ExecEventHalfBlendNoReset(event_table, blend_type)
if blend_type == ALLBODY then
local lower_event = event_table[1]
local upper_event = lower_event .. "_Upper"
ExecEventNoReset(lower_event)
ExecEventNoReset(upper_event)
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
elseif blend_type == LOWER then
ExecEventNoReset(event_table[1])
for i = 2, #event_table, 1 do
SetVariable("LowerDefaultState0" .. i - 2, event_table[i])
end
elseif blend_type == UPPER then
ExecEventNoReset(event_table[1] .. "_Upper")
for i = 2, #event_table, 1 do
SetVariable("UpperDefaultState0" .. i - 2, event_table[i])
end
end
end
function ExecEventAllBody(event)
SetVariable("MoveSpeedLevelReal", 0)
ExecEvent(event)
end
function IsNodeActive(...)
local buff = {...}
for i = 1, #buff, 1 do
if hkbIsNodeActive(buff[i]) then
return TRUE
end
end
return FALSE
end
function ResetEventState()
SetVariable("MoveSpeedLevelReal", 0)
ResetRequest()
end
function ResetMimicry()
act(AddSpEffect, 503041)
end
function SetEnableMimicry()
g_EnableMimicry = TRUE
end
function SetWeightIndex()
local weight = math.mod(env(GetMoveAnimParamID), 20)
if weight == WEIGHT_LIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_LIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_LIGHT)
elseif weight == WEIGHT_NORMAL then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_NORMAL)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_MEDIUM)
elseif weight == WEIGHT_HEAVY then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif weight == WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_OVERWEIGHT)
elseif weight == WEIGHT_SUPERLIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_SUPERLIGHT)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_SUPERLIGHT)
else
SetVariable("MoveWeightIndex", 0)
end
if env(GetSpEffectID, 503520) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 5520) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 425) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 4101) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
elseif env(GetSpEffectID, 4100) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
elseif env(GetSpEffectID, 19670) == TRUE and weight ~= WEIGHT_OVERWEIGHT then
SetVariable("MoveWeightIndex", MOVE_WEIGHT_HEAVY)
SetVariable("EvasionWeightIndex", EVASION_WEIGHT_INDEX_HEAVY)
end
end
function SetAIActionState()
act(SetAIAttackState, env(GetNpcAIAttackRequestIDAfterBlend))
end
function SetAttackHand(hand)
act(WeaponParameterReference, hand)
end
function SetGuardHand(hand)
act(SetThrowPossibilityState_Attacker, hand)
end
function SetEnableAimMode()
if env(ActionDuration, ACTION_ARM_ACTION) > 0 then
return
end
local style = c_Style
local isRide = env(IsOnMount)
if isRide == TRUE then
if style == HAND_LEFT_BOTH then
if GetEquipType(HAND_LEFT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_CROSSBOW)
== TRUE then
act(SetIsPreciseShootingPossible)
end
elseif GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_CROSSBOW)
== TRUE then
act(SetIsPreciseShootingPossible)
end
elseif style == HAND_LEFT_BOTH then
if GetEquipType(HAND_LEFT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_LARGE_ARROW,
WEAPON_CATEGORY_CROSSBOW, WEAPON_CATEGORY_BALLISTA) == TRUE then
act(SetIsPreciseShootingPossible)
end
elseif style == HAND_RIGHT_BOTH
and GetEquipType(HAND_RIGHT, WEAPON_CATEGORY_SMALL_ARROW, WEAPON_CATEGORY_ARROW, WEAPON_CATEGORY_LARGE_ARROW,
WEAPON_CATEGORY_CROSSBOW, WEAPON_CATEGORY_BALLISTA) == TRUE then
act(SetIsPreciseShootingPossible)
end
end
function Replanning()
act(DoAIReplanningAtCancelTiming)
end
function AddStamina(num)
act(SetStaminaRecoveryDisabled)
act(ChangeStamina, num)
end
function GetLocomotionState()
local state = GetVariable("LowerDefaultState00")
if state == MOVE_DEF0 or state == STEALTHMOVE_DEF0 then
if env(GetSpEffectID, 100000) == TRUE then
return PLAYER_STATE_MOVE
elseif env(GetSpEffectID, 100001) == TRUE then
return PLAYER_STATE_MOVE
elseif env(GetSpEffectID, 100002) == TRUE then
return PLAYER_STATE_MOVE
end
end
return PLAYER_STATE_IDLE
end
function SetInterruptType(num)
act(AINotifyAttackType, num)
end
function SetTurnSpeed(turn_speed)
act(SetTurnSpeed, turn_speed)
end
function SetRollingTurnCondition(is_selftrans)
local rolling_angle = "RollingAngleReal"
if is_selftrans == TRUE then
rolling_angle = "RollingAngleRealSelftrans"
end
if GetVariable("IsLockon") == true then
local angle = GetVariable("TurnAngleReal")
if angle > 180 then
SetTurnSpeed(0)
elseif angle > 90 then
SetTurnSpeed(360)
end
elseif env(IsPrecisionShoot) == TRUE then
SetTurnSpeed(0)
SetVariable("TurnAngleReal", 300)
elseif math.abs(GetVariable(rolling_angle)) > 0.0010000000474974513 then
SetTurnSpeed(0)
elseif GetVariable("TurnAngleReal") > 200 then
SetTurnSpeed(0)
end
end
function IsLowerQuickTurn()
if GetVariable("LowerDefaultState00") == QUICKTURN_DEF0 and env(GetSpEffectID, 100010) == TRUE then
return TRUE
end
return FALSE
end
function IsLowerBackStep()
if GetVariable("LowerDefaultState00") == BACKSTEP_DEF0 then
return TRUE
end
return FALSE
end
function IsDualBladeSpecific(hand)
if hand == HAND_LEFT then
return env(IsTwinSwords, 0)
else
return env(IsTwinSwords, 1)
end
end
function GetEquipType(hand, ...)
local buff = {...}
local kind = {}
local num = 1
if hand == HAND_BOTH then
kind[1] = env(GetEquipWeaponCategory, HAND_LEFT)
kind[2] = env(GetEquipWeaponCategory, HAND_RIGHT)
num = 2
else
kind[1] = env(GetEquipWeaponCategory, hand)
end
for i = 1, num, 1 do
for j = 1, #buff, 1 do
if kind[i] == buff[j] then
return TRUE
end
end
end
return FALSE
end
function GetEquipTypeHandStyle(arg)
if c_Style == HAND_LEFT_BOTH then
local kind = env(GetEquipWeaponCategory, HAND_LEFT)
return kind
else
local kind = env(GetEquipWeaponCategory, HAND_RIGHT)
return kind
end
end
function IsHandStyleBoth(arg)
if c_Style == HAND_RIGHT_BOTH or c_Style == HAND_LEFT_BOTH then
return TRUE
end
return FALSE
end
function SetVariable(name, value)
act(SetHavokVariable, name, value)
end
function IsWeaponCanGuard()
local style = c_Style
local kind = 0
local pos = 0
if style == HAND_RIGHT then
kind = env(GetEquipWeaponCategory, HAND_LEFT)
pos = 2
elseif style == HAND_LEFT_BOTH then
kind = env(GetEquipWeaponCategory, HAND_LEFT)
pos = 3
else
kind = env(GetEquipWeaponCategory, HAND_RIGHT)
pos = 3
end
for i = 1, #WeaponCategoryID, 1 do
if WeaponCategoryID[i][1] == kind then
local canguard = WeaponCategoryID[i][pos]
return canguard
end
end
end
function IsEnableGuard()
local style = c_Style
local hand = HAND_LEFT
if style == HAND_RIGHT_BOTH then
hand = HAND_RIGHT
end
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, hand)
if style == HAND_RIGHT and GetEquipType(hand, WEAPON_CATEGORY_STAFF) == TRUE then
return FALSE
end
if sp_kind == 249 and (style == HAND_LEFT_BOTH or style == HAND_RIGHT_BOTH) then
return FALSE
end
if IsWeaponCanGuard() == FALSE then
return FALSE
end
if IsEnableDualWielding() ~= -1 then
return FALSE
end
return TRUE
end
function ExecGuard(event, blend_type)
if env(ActionDuration, ACTION_ARM_ACTION) > 0 then
return FALSE
end
if c_IsStealth == TRUE then
blend_type = ALLBODY
end
if env(ActionRequest, ACTION_ARM_L1) == TRUE or env(ActionDuration, ACTION_ARM_L1) > 0 then
if env(GetStamina) <= 0 then
return FALSE
end
if IsEnableGuard() == TRUE then
local style = c_Style
local hand = HAND_LEFT
if style == HAND_RIGHT_BOTH then
hand = HAND_RIGHT
end
local kind = env(GetEquipWeaponCategory, hand)
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, hand)
local guardindex = env(GetGuardMotionCategory, hand)
if kind == WEAPON_CATEGORY_DUELING_SHIELD then
guardindex = GUARD_STYLE_DUELINGSHIELD
end
-- Set Torch Color
if kind == WEAPON_CATEGORY_TORCH and style == HAND_RIGHT then
guardindex = GUARD_STYLE_TORCH
if sp_kind == 291 then
SetVariable("IndexTorchColor", 1) -- Ghostflame Torch
elseif sp_kind == 292 then
SetVariable("IndexTorchColor", 2) -- St. Trina's Torch
elseif sp_kind == 288 then
SetVariable("IndexTorchColor", 3) -- Nanaya's Torch
else
SetVariable("IndexTorchColor", 0) -- Torch
end
elseif sp_kind == 240 and style == HAND_RIGHT then
guardindex = GUARD_STYLE_TORCH
elseif style == HAND_RIGHT_BOTH or style == HAND_LEFT_BOTH then
if env(GetStayAnimCategory) ~= 15 and env(GetStayAnimCategory) ~= 0 and env(GetStayAnimCategory) ~= 2
and env(GetStayAnimCategory) ~= 3 then
guardindex = GUARD_STYLE_DEFAULT
end
if kind == WEAPON_CATEGORY_DUELING_SHIELD then
guardindex = GUARD_STYLE_DUELINGSHIELD
end
end
if env(GetSpEffectID, 172) == TRUE then
SetVariable("GuardStartType", 1)
else
SetVariable("GuardStartType", 0)
end
SetVariable("IndexGuardStyle", guardindex)
if blend_type == ALLBODY and MoveStart(LOWER, Event_MoveLong, FALSE) == TRUE then
blend_type = UPPER
end
if env(GetSpEffectID, 102000) == TRUE and event ~= Event_GuardOn then
local is_after_additive_just_guard = FALSE
if env(GetSpEffectID, 102020) == TRUE or env(GetSpEffectID, 102022) == TRUE then
is_after_additive_just_guard = TRUE
end
if env(GetSpEffectID, 102002) == TRUE and is_after_additive_just_guard == FALSE then
event = Event_GuardStart_JustGuard2
elseif env(GetSpEffectID, 102003) == TRUE and is_after_additive_just_guard == FALSE then
event = Event_GuardStart_JustGuard3
elseif env(GetSpEffectID, 102004) == TRUE and is_after_additive_just_guard == FALSE then
if IsNodeActive("GuardStart_JustGuard4_Upper Selector") == TRUE then
event = Event_GuardStart_JustGuard4_SelfTrans
else
event = Event_GuardStart_JustGuard4
end
elseif event ~= Event_GuardStart then
elseif IsNodeActive("GuardStart_JustGuard_Upper Selector") == TRUE then
event = Event_GuardStart_JustGuard_SelfTrans
else
event = Event_GuardStart_JustGuard
end
end
act(AddSpEffect, 102021)
ExecEventHalfBlend(event, blend_type)
return TRUE
end
end
return FALSE
end
function ResetRequest()
act(ResetInputQueue)
end
function CheckActionRequest()
return env(HasActionRequest)
end
function ExecStop()
-- 100200 "[HKS] Gesture Anim"
if GetVariable("MoveSpeedLevel") > 0 and env(GetSpEffectID, 100200) == FALSE then
return FALSE
end
local stop_speed = GetVariable("MoveSpeedLevelReal")
local movedirection = GetVariable("MoveDirection")
local stop_speed_threshold = 0.3499999940395355
SetVariable("ToggleDash", 0)
SetWeightIndex()
if GetVariable("EvasionWeightIndex") == EVASION_WEIGHT_INDEX_OVERWEIGHT and stop_speed > 0.3499999940395355 then
stop_speed = stop_speed_threshold
end
if stop_speed >= 0 and stop_speed <= 1 then
if stop_speed <= stop_speed_threshold then
if c_IsStealth == TRUE then
ExecEventAllBody("W_Stealth_Idle")
else
ExecEventAllBody("W_Idle")
end
elseif c_IsStealth == TRUE then
if movedirection == 0 then
ExecEventAllBody("W_StealthRunStopFront")
elseif movedirection == 1 then
ExecEventAllBody("W_StealthRunStopBack")
elseif movedirection == 2 then
ExecEventAllBody("W_StealthRunStopLeft")
elseif movedirection == 3 then
ExecEventAllBody("W_StealthRunStopRight")
end
elseif movedirection == 0 then
ExecEventAllBody("W_RunStopFront")
elseif movedirection == 1 then
ExecEventAllBody("W_RunStopBack")
elseif movedirection == 2 then
ExecEventAllBody("W_RunStopLeft")
elseif movedirection == 3 then
ExecEventAllBody("W_RunStopRight")
end
elseif stop_speed > 1 then
if c_IsStealth == TRUE then
ExecEventAllBody("W_StealthDashStop")
else
ExecEventAllBody("W_DashStop")
end
elseif c_IsStealth == TRUE then
ExecEventAllBody("W_Stealth_Idle")
else
ExecEventAllBody("W_Idle")
end
return TRUE
end
function ExecStopHalfBlend(event, to_idle)
-- 100200 "[HKS] Gesture Anim"
if GetVariable("MoveSpeedLevel") > 0 and env(GetSpEffectID, 100200) == FALSE then
return FALSE
end
SetVariable("LocomotionState", 0)
if to_idle == TRUE then
ExecEventNoReset("W_Idle")
return TRUE
end
ExecEventHalfBlendNoReset(event, LOWER)
return TRUE
end
function MoveStart(blend_type, event, gen_hand)
-- 100200 "[HKS] Gesture Anim"
if GetVariable("MoveSpeedLevel") <= 0 then
return FALSE
end
if env(GetSpEffectID, 100200) == TRUE then
return FALSE
end
if blend_type ~= LOWER then
if gen_hand == FALSE then
SetVariable("ArtsTransition", 0)
else
SetArtsGeneratorTransitionIndex()
end
end
SetBonfireIndex()
local stealth_state = GetVariable("StealthState")
if (stealth_state == STEALTH_TO_STEALTHIDLE or stealth_state == STEALTH_TO_IDLE)
and GetVariable("StealthTransitionIndex") > 0 then
ExecEventHalfBlendNoReset(event, blend_type)
return TRUE
end
if GetLocomotionState() ~= PLAYER_STATE_MOVE then
SetVariable("MoveSpeedLevelReal", 0)
SpeedUpdate()
end
ExecEventHalfBlend(event, blend_type)
return TRUE
end
function MoveStartonCancelTiming(event, gen_hand)
if env(IsMoveCancelPossible) == TRUE then
if GetLocomotionState() == PLAYER_STATE_MOVE then
if MoveStart(UPPER, event, gen_hand) == TRUE then
return TRUE
end
elseif MoveStart(ALLBODY, event, gen_hand) == TRUE then
return TRUE
end
end
return FALSE
end
function SetBaseCategory()
SetVariable("IndexBaseCategory", GetBaseCategory())
end
function GetBaseCategory()
-- Stay Anim is Weapon Motion Position ID
local basecategoryid = 0
local index = 0
basecategoryid = env(GetStayAnimCategory)
if basecategoryid == 0 then
index = 0
elseif basecategoryid == 2 or basecategoryid == 12 then
index = 1
elseif basecategoryid == 3 or basecategoryid == 13 then
index = 2
end
return index
end
function SetArtCancelType()
if IsEnableSwordArts() == TRUE then
act(SetWeaponCancelType, env(GetWeaponCancelType, c_SwordArtsHand))
else
act(SetWeaponCancelType, 0)
end
end
function GetSwordArtInfo()
local style = c_Style
local is_both = FALSE
if style >= HAND_LEFT_BOTH then
is_both = TRUE
end
local art_id = 0
local art_hand = 0
if is_both == TRUE then
if style == HAND_RIGHT_BOTH then
art_hand = HAND_RIGHT
elseif style == HAND_LEFT_BOTH then
art_hand = HAND_LEFT
end
art_id = env(GetSwordArtID, art_hand)
else
local weaponswordartid = env(GetSwordArtID, HAND_LEFT)
if IsShieldArts(weaponswordartid) == FALSE and IsArrowStanceArts(weaponswordartid) == FALSE then
art_hand = HAND_RIGHT
art_id = env(GetSwordArtID, HAND_RIGHT)
else
art_hand = HAND_LEFT
art_id = weaponswordartid
end
end
if env(GetSpEffectID, 102150) == TRUE then
art_id = 0
elseif env(GetSpEffectID, 102151) == TRUE then
art_id = 0
end
return art_id, art_hand
end
function IsEnableSwordArts()
-- 17 is Torch Attack
local style = c_Style
local arts_id = c_SwordArtsID
local sp_kind = env(GetEquipWeaponSpecialCategoryNumber, HAND_LEFT)
if env(IsOnMount) == TRUE then
return FALSE
end
if style ~= HAND_LEFT_BOTH and c_SwordArtsHand == 0 then
if IsWeaponCatalyst(sp_kind) == TRUE then
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
end
if arts_id ~= 17 and arts_id ~= SWORDARTS_INVALID then
return TRUE
end
end
return FALSE
end
function GreyOutSwordArtFE()
if c_IsEnableSwordArts == FALSE then
act(SetArtsPointFEDisplayState, 1)
return
end
if c_SwordArtsID == SWORDARTS_PARRY then
act(SetArtsPointFEDisplayState, 1)
else
act(SetArtsPointFEDisplayState, 0)
end
end
function IsAttackSwordArts(arts_id)
local aow_blacklist = {
157, -- Raptor of the Mists
160 -- White Shadow's Lure
}
local aow_whitelist = {
273, -- Raging Beast
276, -- Blind Spot
313, -- Dynastic Sickleplay
348 -- Discus Hurl
}
if IsShieldArts(arts_id) == TRUE or IsRollingArts(arts_id) == TRUE or IsEnchantArts(arts_id) == TRUE
or Contains(aow_blacklist, arts_id) == TRUE then
if Contains(aow_whitelist, arts_id) then
return TRUE
else
return FALSE
end
else
return TRUE
end
end
function IsHalfBlendArts(arts_id)
local aow_list = {
20, -- Spinning Weapon
58, -- Gravitas
168, -- Zamor Ice Storm
182, -- Knowledge Above All
183, -- Devourer of Worlds
184, -- Familal Rancor
199, -- Spinning Weapon
202, -- Tongues of Fire
203, -- Oracular Bubble
206, -- Sea of Magma
213, -- Soul Stifler
217, -- Glintstone Dart
264, -- Wall of Sparks
328, -- Euporia Vortex
334, -- Feeble Lord's Frenzied Flame
335 -- Repeating Fire
}
if Contains(aow_list, arts_id) == TRUE then
return TRUE
else
return FALSE
end
end
function IsEnchantArts(arts_id)
if 130 <= arts_id and arts_id <= 140 then
return TRUE
else
return FALSE
end
end
function IsShieldArts(arts_id)
local aow_list = {
17, -- Torch Attack
71, -- Firebreather
90, -- Shield Bash
91, -- Barricade Shield
92, -- Parry
93, -- Buckler Parry
95, -- Carian Retaliation
96, -- Storm Wall
97, -- Golden Parry
98, -- Shield Crash
99, -- Thops's Barrier
151, -- Vow of the Indomitable
152, -- Holy Ground
195, -- Fires of Slumber
196, -- Golden Retaliation
197, -- Contagious Fury
201, -- Flame Spit
202, -- Tongues of Fire
207, -- Viper Bite
211, -- Bear Witness!
322, -- Sleep Evermore
324, -- Moore's Charge
348, -- Discus Hurl
352, -- Revenge of the Night
354, -- Blindfold of Happiness
355, -- Blindfold of Happiness (2?)
359, -- Roaring Bash
399, -- Shield Strike
334 -- Feeble Lord's Frenzied Flame
}
if Contains(aow_list, arts_id) == TRUE then
return TRUE
else
return FALSE
end
end
function IsStanceArts(arts_id)
local aow_list = {
10, -- Wild Strikes
11, -- Spinning Strikes
14, -- Unsheathe
15, -- Square Off
21, -- UNUSED
25, -- Spinning Chain
100, -- Through and Through
101, -- Barrage
102, -- Mighty Shot
103, -- Enchanted Shot
104, -- UNUSED
105, -- Rain of Arrows
106, -- UNUSED
107, -- UNUSED
108, -- Sky Shot
169, -- Radahn's Rain
178, -- Transient Moonlight
219, -- Night-and-Flame Stance
239, -- Spinning Wheel
278, -- Overhead Stance
279, -- Wing Stance
309, -- Unending Dance
318, -- Moon-and-Fire Stance
335, -- Repeating Fire
337, -- Fan Shot
340, -- UNUSED
341, -- UNUSED
342, -- UNUSED
343, -- UNUSED
346, -- UNUSED
347, -- UNUSED
357, -- Igor's Drake Hunt
371 -- Rancor Shot
}
if Contains(aow_list, arts_id) == TRUE then
return TRUE
else
return FALSE
end
end
function IsArrowStanceArts(arts_id)
local aow_list = {
100, -- Through and Through
101, -- Barrage
102, -- Mighty Shot
103, -- Enchanted Shot
104, -- UNUSED
105, -- Rain of Arrows
106, -- UNUSED
107, -- UNUSED
108, -- Sky Shot
169, -- Radahn's Rain
337, -- Fan Shot
357, -- Igor's Drake Hunt
371 -- Rancor Shot
}
if Contains(aow_list, arts_id) == TRUE then
return TRUE
else
return FALSE
end
end
function IsAttackStanceArts(arts_id)
local aow_list = {
10, -- Wild Strikes
11, -- Spinning Strikes
25, -- Spinning Chain
239, -- Spinning Wheel
309, -- Unending Dance
340, -- UNUSED
341 -- UNUSED
}
if Contains(aow_list, arts_id) == TRUE then
return TRUE
else
return FALSE
end
end
function IsRollingArts(arts_id)
local aow_list = {
155, -- Quickstep
156, -- Bloodhound's Step
273, -- Raging Beast
276, -- Blind Spot
313 -- Dynastic Sickleplay
}
if Contains(aow_list, arts_id) == TRUE then
return TRUE
else
return FALSE
end
end
function GetSwordArtsRequestNew()
local style = c_Style
local is_both = FALSE
local arts_hand = c_SwordArtsHand
local arts_id = c_SwordArtsID
local request = SWORDART_REQUEST_INVALID
local arts_category = arts_id + 600
local animID = SWORDARTS_ANIM_ID_RIGHT_NORMAL
if IsStanceArts(arts_id) == TRUE then
request = SWORDARTS_REQUEST_RIGHT_STANCE
animID = SWORDARTS_ANIM_ID_RIGHT_STANCE_START
elseif env(GetSpEffectID, 100052) == TRUE then
request = SWORDARTS_REQUEST_RIGHT_COMBO_1
animID = SWORDARTS_ANIM_ID_RIGHT_COMBO_1
elseif env(GetSpEffectID, 100053) == TRUE then
request = SWORDARTS_REQUEST_RIGHT_COMBO_2
animID = SWORDARTS_ANIM_ID_RIGHT_COMBO_2
elseif IsRollingArts(arts_id) == TRUE then