/
skill.hpp
2240 lines (2088 loc) · 53.2 KB
/
skill.hpp
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
// Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef SKILL_HPP
#define SKILL_HPP
#include "../common/cbasetypes.hpp"
#include "../common/db.hpp"
#include "../common/mmo.hpp" // MAX_SKILL, struct square
#include "../common/timer.hpp"
#include "map.hpp" // struct block_list
enum damage_lv : uint8;
enum sc_type : int16;
enum send_target : uint8;
enum e_damage_type : uint8;
struct map_session_data;
struct homun_data;
struct skill_unit;
struct skill_unit_group;
struct status_change_entry;
#define MAX_SKILL_PRODUCE_DB 280 /// Max Produce DB
#define MAX_PRODUCE_RESOURCE 12 /// Max Produce requirements
#define MAX_SKILL_ARROW_DB 150 /// Max Arrow Creation DB
#define MAX_ARROW_RESULT 5 /// Max Arrow results/created
#define MAX_SKILL_ABRA_DB 160 /// Max Skill list of Abracadabra DB
#define MAX_SKILL_IMPROVISE_DB 30 /// Max Skill for Improvise
#define MAX_SKILL_LEVEL 13 /// Max Skill Level (for skill_db storage)
#define MAX_MOBSKILL_LEVEL 100 /// Max monster skill level (on skill usage)
#define MAX_SKILL_CRIMSON_MARKER 3 /// Max Crimson Marker targets (RL_C_MARKER)
#define SKILL_NAME_LENGTH 31 /// Max Skill Name length
#define SKILL_DESC_LENGTH 31 /// Max Skill Desc length
extern DBMap* skilldb_name2id;
/// Constants to identify a skill's nk value (damage properties)
/// The NK value applies only to non INF_GROUND_SKILL skills
/// when determining skill castend function to invoke.
enum e_skill_nk : uint16 {
NK_NO_DAMAGE = 0x01,
NK_SPLASH = 0x02|0x04, // 0x4 = splash & split
NK_SPLASHSPLIT = 0x04,
NK_NO_CARDFIX_ATK = 0x08,
NK_NO_ELEFIX = 0x10,
NK_IGNORE_DEF = 0x20,
NK_IGNORE_FLEE = 0x40,
NK_NO_CARDFIX_DEF = 0x80,
NK_CRITICAL = 0x100,
};
/// Constants to identify the skill's inf value:
enum e_skill_inf {
INF_ATTACK_SKILL = 0x01,
INF_GROUND_SKILL = 0x02,
INF_SELF_SKILL = 0x04, // Skills casted on self where target is automatically chosen
// 0x08 not assigned
INF_SUPPORT_SKILL = 0x10,
INF_TARGET_TRAP = 0x20,
};
/// A skill with 3 would be no damage + splash: area of effect.
/// Constants to identify a skill's inf2 value.
enum e_skill_inf2 {
INF2_QUEST_SKILL = 0x00001,
INF2_NPC_SKILL = 0x00002, //NPC skills are those that players can't have in their skill tree.
INF2_WEDDING_SKILL = 0x00004,
INF2_SPIRIT_SKILL = 0x00008,
INF2_GUILD_SKILL = 0x00010,
INF2_SONG_DANCE = 0x00020,
INF2_ENSEMBLE_SKILL = 0x00040,
INF2_TRAP = 0x00080,
INF2_TARGET_SELF = 0x00100, //Refers to ground placed skills that will target the caster as well (like Grandcross)
INF2_NO_TARGET_SELF = 0x00200,
INF2_PARTY_ONLY = 0x00400,
INF2_GUILD_ONLY = 0x00800,
INF2_NO_ENEMY = 0x01000,
INF2_AUTOSHADOWSPELL = 0x02000, // Skill that available for SC_AUTOSHADOWSPELL
INF2_CHORUS_SKILL = 0x04000, // Chorus skill
INF2_NO_BG_DMG = 0x08000, // Skill that ignore bg reduction
INF2_NO_GVG_DMG = 0x10000, // Skill that ignore gvg reduction
INF2_NO_NEARNPC = 0x20000, // disable to cast skill if near with NPC [Cydh]
INF2_HIT_TRAP = 0x40000, // can hit trap-type skill (INF2_TRAP) [Cydh]
};
/// Skill info type 3
enum e_skill_inf3 {
INF3_NOLP = 0x000001, // Skill that can ignore Land Protector
INF3_FREE = 0x000002, // Free
INF3_USABLE_HIDING = 0x000004, // Skill that can be use in hiding
INF3_USABLE_DANCE = 0x000008, // Skill that can be use while in dancing state
INF3_HIT_EMP = 0x000010, // Skill that could hit emperium
INF3_STASIS_BL = 0x000020, // Skill that can ignore SC_STASIS
INF3_KAGEHUMI_BL = 0x000040, // Skill blocked by kagehumi
INF3_EFF_VULTURE = 0x000080, // Skill range affected by AC_VULTURE
INF3_EFF_SNAKEEYE = 0x000100, // Skill range affected by GS_SNAKEEYE
INF3_EFF_SHADOWJUMP = 0x000200, // Skill range affected by NJ_SHADOWJUMP
INF3_EFF_RADIUS = 0x000400, // Skill range affected by WL_RADIUS
INF3_EFF_RESEARCHTRAP = 0x000800, // Skill range affected by RA_RESEARCHTRAP
INF3_NO_EFF_HOVERING = 0x001000, // Skill that does not affect user that has SC_HOVERING active
INF3_USABLE_WARG = 0x002000, // Skill that can be use while riding warg
INF3_USABLE_MADO = 0x004000, // Skill that can be used while on Madogear
INF3_USABLE_MANHOLE = 0x008000, // Skill that can be used to target while under SC__MANHOLE effect
INF3_HIT_HIDING = 0x010000, // Skill that affects hidden targets
INF3_SC_GLOOMYDAY_SK = 0x020000, // Skill that affects SC_GLOOMYDAY_SK
INF3_SC_DANCEWITHWUG = 0x040000, // Skill that is affected by SC_DANCEWITHWUG
INF3_BITE_BLOCK = 0x080000, // Skill blocked by RA_WUGBITE
INF3_NO_EFF_AUTOGUARD = 0x100000, // Skill is not blocked by SC_AUTOGUARD (physical-skill only)
INF3_NO_EFF_CICADA = 0x200000, // Skill is not blocked by SC_UTSUSEMI or SC_BUNSINJYUTSU (physical-skill only)
};
/// Walk intervals at which chase-skills are attempted to be triggered.
/// If you change this, make sure it's an odd value (for icewall block behavior).
#define WALK_SKILL_INTERVAL 5
/// Time that's added to canact delay on castbegin and substracted on castend
/// This is to prevent hackers from sending a skill packet after cast but before a timer triggers castend
const t_tick SECURITY_CASTTIME = 100;
/// Flags passed to skill_attack/skill_area_sub
enum e_skill_display {
SD_LEVEL = 0x1000, // skill_attack will send -1 instead of skill level (affects display of some skills)
SD_ANIMATION = 0x2000, // skill_attack will use '5' instead of the skill's 'type' (this makes skills show an animation). Also being used in skill_attack for splash skill (NK_SPLASH) to check status_check_skilluse
SD_SPLASH = 0x4000, // skill_area_sub will count targets in skill_area_temp[2]
SD_PREAMBLE = 0x8000, // skill_area_sub will transmit a 'magic' damage packet (-30000 dmg) for the first target selected
};
#define MAX_SKILL_ITEM_REQUIRE 10 /// Maximum required items
#define MAX_SKILL_STATUS_REQUIRE 3 /// Maximum required statuses
#define MAX_SKILL_EQUIP_REQUIRE 10 /// Maximum required equipped item
/// Single skill requirement. !TODO: Cleanup the variable types
struct skill_condition {
int32 hp; ///< HP cost
int32 mhp; ///< Max HP to trigger
int32 sp; /// SP cost
int16 hp_rate; /// HP cost (%)
int16 sp_rate; /// SP cost (%)
uint32 zeny; /// Zeny cost
uint32 weapon; /// Weapon type. Combined bitmask of enum weapon_type (1<<weapon)
uint16 ammo; /// Ammo type. Combine bitmask of enum ammo_type (1<<ammo)
int8 ammo_qty; /// Amount of ammo
uint8 state; /// State/condition. @see enum e_require_state
int8 spiritball; /// Spiritball cost
uint16 itemid[MAX_SKILL_ITEM_REQUIRE]; /// Required item
uint16 amount[MAX_SKILL_ITEM_REQUIRE]; /// Amount of item
uint16 *eqItem; /// List of equipped item
enum sc_type *status; /// List of Status required (SC)
uint8 status_count, /// Count of SC
eqItem_count; /// Count of equipped item
};
/// Skill requirement structure. !TODO: Cleanup the variable types that use array [MAX_SKILL_LEVEL]
struct s_skill_require {
int hp[MAX_SKILL_LEVEL]; ///< HP cost
int mhp[MAX_SKILL_LEVEL]; ///< Max HP to trigger
int sp[MAX_SKILL_LEVEL]; /// SP cost
int hp_rate[MAX_SKILL_LEVEL]; /// HP cost (%)
int sp_rate[MAX_SKILL_LEVEL]; /// SP cost (%)
int zeny[MAX_SKILL_LEVEL]; /// Zeny cost
uint32 weapon; /// Weapon type. Combined bitmask of enum weapon_type (1<<weapon)
uint16 ammo; /// Ammo type. Combine bitmask of enum ammo_type (1<<ammo)
int ammo_qty[MAX_SKILL_LEVEL]; /// Amount of ammo
uint8 state; /// State/condition. @see enum e_require_state
int spiritball[MAX_SKILL_LEVEL]; /// Spiritball cost
uint16 itemid[MAX_SKILL_ITEM_REQUIRE]; /// Required item
uint16 amount[MAX_SKILL_ITEM_REQUIRE]; /// Amount of item
uint16 *eqItem; /// List of equipped item
enum sc_type *status; /// List of Status required (SC)
uint8 status_count, /// Count of SC
eqItem_count; /// Count of equipped item
};
/// Database skills. !TODO: Cleanup the variable types that use array [MAX_SKILL_LEVEL]
struct s_skill_db {
// skill_db.txt
uint16 nameid; ///< Skill ID
char name[SKILL_NAME_LENGTH]; ///< AEGIS_Name
char desc[SKILL_DESC_LENGTH]; ///< English Name
int range[MAX_SKILL_LEVEL]; ///< Range
int8 hit; ///< Hit type
uint8 inf; ///< Inf: 0- passive, 1- enemy, 2- place, 4- self, 16- friend, 32- trap
int element[MAX_SKILL_LEVEL]; ///< Element
uint16 nk; ///< Damage properties
int splash[MAX_SKILL_LEVEL]; ///< Splash effect
uint8 max; ///< Max level
int num[MAX_SKILL_LEVEL]; ///< Number of hit
bool castcancel; ///< Cancel cast when being hit
int16 cast_def_rate; ///< Def rate during cast a skill
uint16 skill_type; ///< Skill type
int blewcount[MAX_SKILL_LEVEL]; ///< Blew count
uint32 inf2; ///< Skill flags @see enum e_skill_inf2
uint32 inf3; ///< Skill flags @see enum e_skill_inf3
int maxcount[MAX_SKILL_LEVEL]; ///< Max number skill can be casted in same map
// skill_castnodex_db.txt
uint8 castnodex; ///< 1 - Not affected by dex, 2 - Not affected by SC, 4 - Not affected by item
uint8 delaynodex; ///< 1 - Not affected by dex, 2 - Not affected by SC, 4 - Not affected by item
// skill_nocast_db.txt
uint32 nocast; ///< Skill cannot be casted at this zone
// skill_unit_db.txt
uint16 unit_id[2]; ///< Unit ID. @see enum s_skill_unit_id
int unit_layout_type[MAX_SKILL_LEVEL]; ///< Layout type. -1 is special layout, others are square with lenght*width: (val*2+1)^2
int unit_range[MAX_SKILL_LEVEL]; ///< Unit cell effect range
int16 unit_interval; ///< Interval
uint32 unit_target; ///< Unit target. @see enum e_battle_check_target
uint32 unit_flag; ///< Unit flags. @see enum e_skill_unit_flag
// skill_cast_db.txt
int cast[MAX_SKILL_LEVEL]; ///< Variable casttime
#ifdef RENEWAL_CAST
int fixed_cast[MAX_SKILL_LEVEL]; ///< If -1 means 20% than 'cast'
#endif
int walkdelay[MAX_SKILL_LEVEL]; ///< Delay to walk after casting
int delay[MAX_SKILL_LEVEL]; ///< Global delay (delay before reusing all skills)
int cooldown[MAX_SKILL_LEVEL]; ///< Cooldown (delay before reusing same skill)
int upkeep_time[MAX_SKILL_LEVEL]; ///< Duration
int upkeep_time2[MAX_SKILL_LEVEL]; ///< Duration2
// skill_require_db.txt
struct s_skill_require require; ///< Skill requirement
// skill_nonearnpc_db.txt
uint8 unit_nonearnpc_range; //additional range for UF_NONEARNPC or INF2_NO_NEARNPC [Cydh]
uint8 unit_nonearnpc_type; //type of NPC [Cydh]
// skill_damage_db.txt
struct s_skill_damage damage;
// skill_copyable_db.txt
struct s_copyable { // [Cydh]
uint8 option;
uint16 joballowed, req_opt;
} copyable;
};
extern struct s_skill_db **skill_db;
#define MAX_SQUARE_LAYOUT 7 // 15*15 unit placement maximum
#define MAX_SKILL_UNIT_LAYOUT (48+MAX_SQUARE_LAYOUT) // 47 special ones + the square ones
#define MAX_SKILL_UNIT_LAYOUT2 17
#define MAX_SKILL_UNIT_COUNT ((MAX_SQUARE_LAYOUT*2+1)*(MAX_SQUARE_LAYOUT*2+1))
struct s_skill_unit_layout {
int count;
int dx[MAX_SKILL_UNIT_COUNT];
int dy[MAX_SKILL_UNIT_COUNT];
};
struct s_skill_nounit_layout {
int count;
int dx[MAX_SKILL_UNIT_COUNT];
int dy[MAX_SKILL_UNIT_COUNT];
};
#define MAX_SKILLTIMERSKILL 50
struct skill_timerskill {
int timer;
int src_id;
int target_id;
int map;
short x,y;
uint16 skill_id,skill_lv;
int type; // a BF_ type (NOTE: some places use this as general-purpose storage...)
int flag;
};
#define MAX_SKILLUNITGROUP 25 /// Maximum skill unit group (for same skill each source)
/// Skill unit group
struct skill_unit_group {
int src_id; /// Caster ID/RID, if player is account_id
int party_id; /// Party ID
int guild_id; /// Guild ID
int bg_id; /// Battleground ID
int map; /// Map
int target_flag; /// Holds BCT_* flag for battle_check_target
int bl_flag; /// Holds BL_* flag for map_foreachin* functions
t_tick tick; /// Tick when skill unit initialized
t_tick limit; /// Life time
int interval; /// Timer interval
uint16 skill_id, /// Skill ID
skill_lv; /// Skill level
int val1, val2, val3; /// Values
char *valstr; /// String value, used for HT_TALKIEBOX & RG_GRAFFITI
int unit_id; /// Unit ID (for client effect)
int group_id; /// Skill Group ID
int link_group_id; /// Linked group that should be deleted if this one is deleted
int unit_count, /// Number of unit at this group
alive_count; /// Number of alive unit
int item_id; /// Store item used.
struct skill_unit *unit; /// Skill Unit
struct {
unsigned ammo_consume : 1; // Need to consume ammo
unsigned song_dance : 2; //0x1 Song/Dance, 0x2 Ensemble
unsigned guildaura : 1; // Guild Aura
} state;
};
/// Skill unit
struct skill_unit {
struct block_list bl;
struct skill_unit_group *group; /// Skill group reference
t_tick limit;
int val1, val2;
short range;
unsigned alive : 1;
unsigned hidden : 1;
};
#define MAX_SKILLUNITGROUPTICKSET 25
struct skill_unit_group_tickset {
t_tick tick;
int id;
};
enum e_skill_unit_flag {
UF_DEFNOTENEMY = 0x00001, // If 'defunit_not_enemy' is set, the target is changed to 'friend'
UF_NOREITERATION = 0x00002, // Spell cannot be stacked
UF_NOFOOTSET = 0x00004, // Spell cannot be cast near/on targets
UF_NOOVERLAP = 0x00008, // Spell effects do not overlap
UF_PATHCHECK = 0x00010, // Only cells with a shootable path will be placed
UF_NOPC = 0x00020, // May not target players
UF_NOMOB = 0x00040, // May not target mobs
UF_SKILL = 0x00080, // May target skills
UF_DANCE = 0x00100, // Dance
UF_ENSEMBLE = 0x00200, // Duet
UF_SONG = 0x00400, // Song
UF_DUALMODE = 0x00800, // Spells should trigger both ontimer and onplace/onout/onleft effects.
UF_NOKNOCKBACK = 0x01000, // Skill unit cannot be knocked back
UF_RANGEDSINGLEUNIT = 0x02000, // hack for ranged layout, only display center
UF_CRAZYWEED_IMMUNE = 0x04000, // Immune to Crazy Weed removal
UF_REM_FIRERAIN = 0x08000, // removed by Fire Rain
UF_KNOCKBACK_GROUP = 0x10000, // knockback skill unit with its group instead of single unit
UF_HIDDEN_TRAP = 0x20000, // Hidden trap [Cydh]
};
/// Enum for skill_blown
enum e_skill_blown {
BLOWN_NONE = 0x00,
BLOWN_DONT_SEND_PACKET = 0x01, // Position update packets must not be sent to the client
BLOWN_IGNORE_NO_KNOCKBACK = 0x02, // Ignores players' special_state.no_knockback
// These flags return 'count' instead of 0 if target is cannot be knocked back
BLOWN_NO_KNOCKBACK_MAP = 0x04, // On a WoE/BG map
BLOWN_MD_KNOCKBACK_IMMUNE = 0x08, // If target is MD_KNOCKBACK_IMMUNE
BLOWN_TARGET_NO_KNOCKBACK = 0x10, // If target has 'special_state.no_knockback'
BLOWN_TARGET_BASILICA = 0x20, // If target is in Basilica area
};
/// Create Database item
struct s_skill_produce_db {
unsigned short nameid; /// Product ID
unsigned short req_skill; /// Required Skill
unsigned char req_skill_lv, /// Required Skill Level
itemlv; /// Item Level
unsigned short mat_id[MAX_PRODUCE_RESOURCE], /// Materials needed
mat_amount[MAX_PRODUCE_RESOURCE]; /// Amount of each materials
};
extern struct s_skill_produce_db skill_produce_db[MAX_SKILL_PRODUCE_DB];
/// Creating database arrow
struct s_skill_arrow_db {
unsigned short nameid, /// Material ID
cre_id[MAX_ARROW_RESULT], /// Arrow created
cre_amount[MAX_ARROW_RESULT]; /// Amount of each arrow created
};
extern struct s_skill_arrow_db skill_arrow_db[MAX_SKILL_ARROW_DB];
/// Abracadabra database
struct s_skill_abra_db {
uint16 skill_id; /// Skill ID
char name[SKILL_NAME_LENGTH]; /// Shouted skill name
int per[MAX_SKILL_LEVEL]; /// Probability summoned
};
extern struct s_skill_abra_db skill_abra_db[MAX_SKILL_ABRA_DB];
extern unsigned short skill_abra_count;
void do_init_skill(void);
void do_final_skill(void);
/// Cast type
enum { CAST_GROUND, CAST_DAMAGE, CAST_NODAMAGE };
/// Returns the cast type of the skill: ground cast, castend damage, castend no damage
int skill_get_casttype(uint16 skill_id); //[Skotlex]
const char* skill_get_name( uint16 skill_id ); // [Skotlex]
const char* skill_get_desc( uint16 skill_id ); // [Skotlex]
int skill_tree_get_max( uint16 skill_id, int b_class ); // Celest
// Accessor to the skills database
int skill_get_index_( uint16 skill_id, bool silent, const char *func, const char *file, int line );
#define skill_get_index(skill_id) skill_get_index_((skill_id), false, __FUNCTION__, __FILE__, __LINE__) /// Get skill index from skill_id (common usage on source)
#define skill_get_index2(skill_id) skill_get_index_((skill_id), true, __FUNCTION__, __FILE__, __LINE__) /// Get skill index from skill_id (used when reading skill_db files)
int skill_get_type( uint16 skill_id );
enum e_damage_type skill_get_hit( uint16 skill_id );
int skill_get_inf( uint16 skill_id );
int skill_get_ele( uint16 skill_id , uint16 skill_lv );
int skill_get_nk( uint16 skill_id );
int skill_get_max( uint16 skill_id );
int skill_get_range( uint16 skill_id , uint16 skill_lv );
int skill_get_range2(struct block_list *bl, uint16 skill_id, uint16 skill_lv, bool isServer);
int skill_get_splash( uint16 skill_id , uint16 skill_lv );
int skill_get_num( uint16 skill_id ,uint16 skill_lv );
int skill_get_cast( uint16 skill_id ,uint16 skill_lv );
int skill_get_delay( uint16 skill_id ,uint16 skill_lv );
int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv );
int skill_get_time( uint16 skill_id ,uint16 skill_lv );
int skill_get_time2( uint16 skill_id ,uint16 skill_lv );
int skill_get_castnodex( uint16 skill_id );
int skill_get_castdef( uint16 skill_id );
int skill_get_nocast( uint16 skill_id );
int skill_get_unit_id(uint16 skill_id,int flag);
int skill_get_inf2( uint16 skill_id );
int skill_get_castcancel( uint16 skill_id );
int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv );
int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv );
int skill_get_unit_flag( uint16 skill_id );
int skill_get_cooldown( uint16 skill_id, uint16 skill_lv );
int skill_get_unit_target( uint16 skill_id );
int skill_get_inf3( uint16 skill_id );
// Accessor for skill requirements
int skill_get_hp( uint16 skill_id ,uint16 skill_lv );
int skill_get_mhp( uint16 skill_id ,uint16 skill_lv );
int skill_get_sp( uint16 skill_id ,uint16 skill_lv );
int skill_get_status_count( uint16 skill_id );
int skill_get_hp_rate( uint16 skill_id, uint16 skill_lv );
int skill_get_sp_rate( uint16 skill_id, uint16 skill_lv );
int skill_get_zeny( uint16 skill_id ,uint16 skill_lv );
int skill_get_weapontype( uint16 skill_id );
int skill_get_ammotype( uint16 skill_id );
int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv );
int skill_get_state(uint16 skill_id);
//int skill_get_status( uint16 skill_id, int idx );
int skill_get_status_count( uint16 skill_id );
int skill_get_spiritball( uint16 skill_id, uint16 skill_lv );
int skill_get_itemid( uint16 skill_id, int idx );
int skill_get_itemqty( uint16 skill_id, int idx );
unsigned short skill_dummy2skill_id(unsigned short skill_id);
int skill_name2id(const char* name);
uint16 skill_idx2id(uint16 idx);
uint16 SKILL_MAX_DB(void);
int skill_isammotype(struct map_session_data *sd, unsigned short skill_id);
TIMER_FUNC(skill_castend_id);
TIMER_FUNC(skill_castend_pos);
int skill_castend_map( struct map_session_data *sd,uint16 skill_id, const char *map);
int skill_cleartimerskill(struct block_list *src);
int skill_addtimerskill(struct block_list *src,t_tick tick,int target,int x,int y,uint16 skill_id,uint16 skill_lv,int type,int flag);
// Results? Added
int skill_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,enum damage_lv dmg_lv,t_tick tick);
int skill_counter_additional_effect( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,int attack_type,t_tick tick);
short skill_blown(struct block_list* src, struct block_list* target, char count, int8 dir, enum e_skill_blown flag);
int skill_break_equip(struct block_list *src,struct block_list *bl, unsigned short where, int rate, int flag);
int skill_strip_equip(struct block_list *src,struct block_list *bl, unsigned short where, int rate, int lv, int time);
// Skills unit
struct skill_unit_group *skill_id2group(int group_id);
struct skill_unit_group *skill_unitsetting(struct block_list* src, uint16 skill_id, uint16 skill_lv, int16 x, int16 y, int flag);
struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2, bool hidden);
int skill_delunit(struct skill_unit *unit);
struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, uint16 skill_id, uint16 skill_lv, int unit_id, t_tick limit, int interval);
int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int line, const char* func);
#define skill_delunitgroup(group) skill_delunitgroup_(group,__FILE__,__LINE__,__func__)
void skill_clear_unitgroup(struct block_list *src);
int skill_clear_group(struct block_list *bl, int flag);
void ext_skill_unit_onplace(struct skill_unit *unit, struct block_list *bl, t_tick tick);
int64 skill_unit_ondamaged(struct skill_unit *unit,int64 damage);
// Skill unit visibility [Cydh]
void skill_getareachar_skillunit_visibilty(struct skill_unit *su, enum send_target target);
void skill_getareachar_skillunit_visibilty_single(struct skill_unit *su, struct block_list *bl);
int skill_castfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv);
int skill_castfix_sc(struct block_list *bl, double time, uint8 flag);
#ifdef RENEWAL_CAST
int skill_vfcastfix(struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv);
#endif
int skill_delayfix(struct block_list *bl, uint16 skill_id, uint16 skill_lv);
void skill_toggle_magicpower(struct block_list *bl, uint16 skill_id);
// Skill conditions check and remove [Inkfish]
bool skill_check_condition_castbegin(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
bool skill_check_condition_castend(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
int skill_check_condition_char_sub (struct block_list *bl, va_list ap);
void skill_consume_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv, short type);
struct skill_condition skill_get_requirement(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv);
int skill_disable_check(struct status_change *sc, uint16 skill_id);
bool skill_pos_maxcount_check(struct block_list *src, int16 x, int16 y, uint16 skill_id, uint16 skill_lv, enum bl_type type, bool display_failure);
int skill_check_pc_partner(struct map_session_data *sd, uint16 skill_id, uint16 *skill_lv, int range, int cast_flag);
int skill_unit_move(struct block_list *bl,t_tick tick,int flag);
void skill_unit_move_unit_group( struct skill_unit_group *group, int16 m,int16 dx,int16 dy);
void skill_unit_move_unit(struct block_list *bl, int dx, int dy);
int skill_sit(struct map_session_data *sd, bool sitting);
void skill_repairweapon(struct map_session_data *sd, int idx);
void skill_identify(struct map_session_data *sd,int idx);
void skill_weaponrefine(struct map_session_data *sd,int idx); // [Celest]
int skill_autospell(struct map_session_data *md,uint16 skill_id);
int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal);
bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce);
// Abnormal status
void skill_enchant_elemental_end(struct block_list *bl, int type);
bool skill_isNotOk(uint16 skill_id, struct map_session_data *sd);
bool skill_isNotOk_hom(struct homun_data *hd, uint16 skill_id, uint16 skill_lv);
bool skill_isNotOk_mercenary(uint16 skill_id, struct mercenary_data *md);
bool skill_isNotOk_npcRange(struct block_list *src, uint16 skill_id, uint16 skill_lv, int pos_x, int pos_y);
// Item creation
short skill_can_produce_mix( struct map_session_data *sd, unsigned short nameid, int trigger, int qty);
bool skill_produce_mix( struct map_session_data *sd, uint16 skill_id, unsigned short nameid, int slot1, int slot2, int slot3, int qty, short produce_idx );
bool skill_arrow_create( struct map_session_data *sd, unsigned short nameid);
// skills for the mob
int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
int skill_castend_damage_id( struct block_list* src, struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
int skill_castend_pos2( struct block_list *src, int x,int y,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag);
int skill_blockpc_start(struct map_session_data*, int, t_tick);
int skill_blockpc_get(struct map_session_data *sd, int skillid);
int skill_blockpc_clear(struct map_session_data *sd);
TIMER_FUNC(skill_blockpc_end);
int skill_blockhomun_start (struct homun_data*,uint16 skill_id,int);
int skill_blockmerc_start (struct mercenary_data*,uint16 skill_id,int);
// (Epoque:) To-do: replace this macro with some sort of skill tree check (rather than hard-coded skill names)
#define skill_ischangesex(id) ( \
((id) >= BD_ADAPTATION && (id) <= DC_SERVICEFORYOU) || ((id) >= CG_ARROWVULCAN && (id) <= CG_MARIONETTE) || \
((id) >= CG_LONGINGFREEDOM && (id) <= CG_TAROTCARD) || ((id) >= WA_SWING_DANCE && (id) <= WM_UNLIMITED_HUMMING_VOICE))
// Skill action, (return dmg,heal)
int64 skill_attack( int attack_type, struct block_list* src, struct block_list *dsrc,struct block_list *bl,uint16 skill_id,uint16 skill_lv,t_tick tick,int flag );
void skill_reload(void);
/// List of State Requirements
enum e_require_state {
ST_NONE,
ST_HIDDEN,
ST_RIDING,
ST_FALCON,
ST_CART,
ST_SHIELD,
ST_RECOV_WEIGHT_RATE,
ST_MOVE_ENABLE,
ST_WATER,
ST_RIDINGDRAGON,
ST_WUG,
ST_RIDINGWUG,
ST_MADO,
ST_ELEMENTALSPIRIT,
ST_ELEMENTALSPIRIT2,
ST_PECO,
};
/// List of Skills
enum e_skill {
NV_BASIC = 1,
SM_SWORD,
SM_TWOHAND,
SM_RECOVERY,
SM_BASH,
SM_PROVOKE,
SM_MAGNUM,
SM_ENDURE,
MG_SRECOVERY,
MG_SIGHT,
MG_NAPALMBEAT,
MG_SAFETYWALL,
MG_SOULSTRIKE,
MG_COLDBOLT,
MG_FROSTDIVER,
MG_STONECURSE,
MG_FIREBALL,
MG_FIREWALL,
MG_FIREBOLT,
MG_LIGHTNINGBOLT,
MG_THUNDERSTORM,
AL_DP,
AL_DEMONBANE,
AL_RUWACH,
AL_PNEUMA,
AL_TELEPORT,
AL_WARP,
AL_HEAL,
AL_INCAGI,
AL_DECAGI,
AL_HOLYWATER,
AL_CRUCIS,
AL_ANGELUS,
AL_BLESSING,
AL_CURE,
MC_INCCARRY,
MC_DISCOUNT,
MC_OVERCHARGE,
MC_PUSHCART,
MC_IDENTIFY,
MC_VENDING,
MC_MAMMONITE,
AC_OWL,
AC_VULTURE,
AC_CONCENTRATION,
AC_DOUBLE,
AC_SHOWER,
TF_DOUBLE,
TF_MISS,
TF_STEAL,
TF_HIDING,
TF_POISON,
TF_DETOXIFY,
ALL_RESURRECTION,
KN_SPEARMASTERY,
KN_PIERCE,
KN_BRANDISHSPEAR,
KN_SPEARSTAB,
KN_SPEARBOOMERANG,
KN_TWOHANDQUICKEN,
KN_AUTOCOUNTER,
KN_BOWLINGBASH,
KN_RIDING,
KN_CAVALIERMASTERY,
PR_MACEMASTERY,
PR_IMPOSITIO,
PR_SUFFRAGIUM,
PR_ASPERSIO,
PR_BENEDICTIO,
PR_SANCTUARY,
PR_SLOWPOISON,
PR_STRECOVERY,
PR_KYRIE,
PR_MAGNIFICAT,
PR_GLORIA,
PR_LEXDIVINA,
PR_TURNUNDEAD,
PR_LEXAETERNA,
PR_MAGNUS,
WZ_FIREPILLAR,
WZ_SIGHTRASHER,
WZ_FIREIVY,
WZ_METEOR,
WZ_JUPITEL,
WZ_VERMILION,
WZ_WATERBALL,
WZ_ICEWALL,
WZ_FROSTNOVA,
WZ_STORMGUST,
WZ_EARTHSPIKE,
WZ_HEAVENDRIVE,
WZ_QUAGMIRE,
WZ_ESTIMATION,
BS_IRON,
BS_STEEL,
BS_ENCHANTEDSTONE,
BS_ORIDEOCON,
BS_DAGGER,
BS_SWORD,
BS_TWOHANDSWORD,
BS_AXE,
BS_MACE,
BS_KNUCKLE,
BS_SPEAR,
BS_HILTBINDING,
BS_FINDINGORE,
BS_WEAPONRESEARCH,
BS_REPAIRWEAPON,
BS_SKINTEMPER,
BS_HAMMERFALL,
BS_ADRENALINE,
BS_WEAPONPERFECT,
BS_OVERTHRUST,
BS_MAXIMIZE,
HT_SKIDTRAP,
HT_LANDMINE,
HT_ANKLESNARE,
HT_SHOCKWAVE,
HT_SANDMAN,
HT_FLASHER,
HT_FREEZINGTRAP,
HT_BLASTMINE,
HT_CLAYMORETRAP,
HT_REMOVETRAP,
HT_TALKIEBOX,
HT_BEASTBANE,
HT_FALCON,
HT_STEELCROW,
HT_BLITZBEAT,
HT_DETECTING,
HT_SPRINGTRAP,
AS_RIGHT,
AS_LEFT,
AS_KATAR,
AS_CLOAKING,
AS_SONICBLOW,
AS_GRIMTOOTH,
AS_ENCHANTPOISON,
AS_POISONREACT,
AS_VENOMDUST,
AS_SPLASHER,
NV_FIRSTAID,
NV_TRICKDEAD,
SM_MOVINGRECOVERY,
SM_FATALBLOW,
SM_AUTOBERSERK,
AC_MAKINGARROW,
AC_CHARGEARROW,
TF_SPRINKLESAND,
TF_BACKSLIDING,
TF_PICKSTONE,
TF_THROWSTONE,
MC_CARTREVOLUTION,
MC_CHANGECART,
MC_LOUD,
AL_HOLYLIGHT,
MG_ENERGYCOAT,
NPC_PIERCINGATT,
NPC_MENTALBREAKER,
NPC_RANGEATTACK,
NPC_ATTRICHANGE,
NPC_CHANGEWATER,
NPC_CHANGEGROUND,
NPC_CHANGEFIRE,
NPC_CHANGEWIND,
NPC_CHANGEPOISON,
NPC_CHANGEHOLY,
NPC_CHANGEDARKNESS,
NPC_CHANGETELEKINESIS,
NPC_CRITICALSLASH,
NPC_COMBOATTACK,
NPC_GUIDEDATTACK,
NPC_SELFDESTRUCTION,
NPC_SPLASHATTACK,
NPC_SUICIDE,
NPC_POISON,
NPC_BLINDATTACK,
NPC_SILENCEATTACK,
NPC_STUNATTACK,
NPC_PETRIFYATTACK,
NPC_CURSEATTACK,
NPC_SLEEPATTACK,
NPC_RANDOMATTACK,
NPC_WATERATTACK,
NPC_GROUNDATTACK,
NPC_FIREATTACK,
NPC_WINDATTACK,
NPC_POISONATTACK,
NPC_HOLYATTACK,
NPC_DARKNESSATTACK,
NPC_TELEKINESISATTACK,
NPC_MAGICALATTACK,
NPC_METAMORPHOSIS,
NPC_PROVOCATION,
NPC_SMOKING,
NPC_SUMMONSLAVE,
NPC_EMOTION,
NPC_TRANSFORMATION,
NPC_BLOODDRAIN,
NPC_ENERGYDRAIN,
NPC_KEEPING,
NPC_DARKBREATH,
NPC_DARKBLESSING,
NPC_BARRIER,
NPC_DEFENDER,
NPC_LICK,
NPC_HALLUCINATION,
NPC_REBIRTH,
NPC_SUMMONMONSTER,
RG_SNATCHER,
RG_STEALCOIN,
RG_BACKSTAP,
RG_TUNNELDRIVE,
RG_RAID,
RG_STRIPWEAPON,
RG_STRIPSHIELD,
RG_STRIPARMOR,
RG_STRIPHELM,
RG_INTIMIDATE,
RG_GRAFFITI,
RG_FLAGGRAFFITI,
RG_CLEANER,
RG_GANGSTER,
RG_COMPULSION,
RG_PLAGIARISM,
AM_AXEMASTERY,
AM_LEARNINGPOTION,
AM_PHARMACY,
AM_DEMONSTRATION,
AM_ACIDTERROR,
AM_POTIONPITCHER,
AM_CANNIBALIZE,
AM_SPHEREMINE,
AM_CP_WEAPON,
AM_CP_SHIELD,
AM_CP_ARMOR,
AM_CP_HELM,
AM_BIOETHICS,
AM_BIOTECHNOLOGY,
AM_CREATECREATURE,
AM_CULTIVATION,
AM_FLAMECONTROL,
AM_CALLHOMUN,
AM_REST,
AM_DRILLMASTER,
AM_HEALHOMUN,
AM_RESURRECTHOMUN,
CR_TRUST,
CR_AUTOGUARD,
CR_SHIELDCHARGE,
CR_SHIELDBOOMERANG,
CR_REFLECTSHIELD,
CR_HOLYCROSS,
CR_GRANDCROSS,
CR_DEVOTION,
CR_PROVIDENCE,
CR_DEFENDER,
CR_SPEARQUICKEN,
MO_IRONHAND,
MO_SPIRITSRECOVERY,
MO_CALLSPIRITS,
MO_ABSORBSPIRITS,
MO_TRIPLEATTACK,
MO_BODYRELOCATION,
MO_DODGE,
MO_INVESTIGATE,
MO_FINGEROFFENSIVE,
MO_STEELBODY,
MO_BLADESTOP,
MO_EXPLOSIONSPIRITS,
MO_EXTREMITYFIST,
MO_CHAINCOMBO,
MO_COMBOFINISH,
SA_ADVANCEDBOOK,
SA_CASTCANCEL,
SA_MAGICROD,
SA_SPELLBREAKER,
SA_FREECAST,
SA_AUTOSPELL,
SA_FLAMELAUNCHER,
SA_FROSTWEAPON,
SA_LIGHTNINGLOADER,
SA_SEISMICWEAPON,
SA_DRAGONOLOGY,
SA_VOLCANO,
SA_DELUGE,
SA_VIOLENTGALE,
SA_LANDPROTECTOR,
SA_DISPELL,
SA_ABRACADABRA,
SA_MONOCELL,
SA_CLASSCHANGE,
SA_SUMMONMONSTER,
SA_REVERSEORCISH,
SA_DEATH,
SA_FORTUNE,
SA_TAMINGMONSTER,
SA_QUESTION,
SA_GRAVITY,
SA_LEVELUP,
SA_INSTANTDEATH,
SA_FULLRECOVERY,
SA_COMA,
BD_ADAPTATION,
BD_ENCORE,
BD_LULLABY,
BD_RICHMANKIM,
BD_ETERNALCHAOS,
BD_DRUMBATTLEFIELD,
BD_RINGNIBELUNGEN,
BD_ROKISWEIL,
BD_INTOABYSS,
BD_SIEGFRIED,
BD_RAGNAROK,
BA_MUSICALLESSON,
BA_MUSICALSTRIKE,
BA_DISSONANCE,
BA_FROSTJOKER,
BA_WHISTLE,
BA_ASSASSINCROSS,
BA_POEMBRAGI,
BA_APPLEIDUN,
DC_DANCINGLESSON,
DC_THROWARROW,
DC_UGLYDANCE,
DC_SCREAM,
DC_HUMMING,
DC_DONTFORGETME,
DC_FORTUNEKISS,
DC_SERVICEFORYOU,
NPC_RANDOMMOVE,
NPC_SPEEDUP,
NPC_REVENGE,
WE_MALE,
WE_FEMALE,
WE_CALLPARTNER,
ITM_TOMAHAWK,
NPC_DARKCROSS,
NPC_GRANDDARKNESS,
NPC_DARKSTRIKE,
NPC_DARKTHUNDER,
NPC_STOP,
NPC_WEAPONBRAKER,
NPC_ARMORBRAKE,
NPC_HELMBRAKE,
NPC_SHIELDBRAKE,
NPC_UNDEADATTACK,
NPC_CHANGEUNDEAD,
NPC_POWERUP,
NPC_AGIUP,
NPC_SIEGEMODE,
NPC_CALLSLAVE,
NPC_INVISIBLE,
NPC_RUN,
LK_AURABLADE,
LK_PARRYING,
LK_CONCENTRATION,
LK_TENSIONRELAX,
LK_BERSERK,
LK_FURY,
HP_ASSUMPTIO,
HP_BASILICA,
HP_MEDITATIO,
HW_SOULDRAIN,
HW_MAGICCRASHER,
HW_MAGICPOWER,
PA_PRESSURE,
PA_SACRIFICE,
PA_GOSPEL,
CH_PALMSTRIKE,
CH_TIGERFIST,
CH_CHAINCRUSH,
PF_HPCONVERSION,
PF_SOULCHANGE,
PF_SOULBURN,
ASC_KATAR,
ASC_HALLUCINATION,
ASC_EDP,
ASC_BREAKER,
SN_SIGHT,
SN_FALCONASSAULT,
SN_SHARPSHOOTING,
SN_WINDWALK,
WS_MELTDOWN,
WS_CREATECOIN,
WS_CREATENUGGET,
WS_CARTBOOST,
WS_SYSTEMCREATE,
ST_CHASEWALK,
ST_REJECTSWORD,
ST_STEALBACKPACK,
CR_ALCHEMY,
CR_SYNTHESISPOTION,
CG_ARROWVULCAN,
CG_MOONLIT,
CG_MARIONETTE,
LK_SPIRALPIERCE,
LK_HEADCRUSH,
LK_JOINTBEAT,
HW_NAPALMVULCAN,
CH_SOULCOLLECT,
PF_MINDBREAKER,
PF_MEMORIZE,
PF_FOGWALL,
PF_SPIDERWEB,
ASC_METEORASSAULT,