1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
2 | // For more information, see LICENCE in the main folder |
---|
3 | |
---|
4 | #ifndef _UNIT_H_ |
---|
5 | #define _UNIT_H_ |
---|
6 | |
---|
7 | //#include "map.h" |
---|
8 | struct block_list; |
---|
9 | struct unit_data; |
---|
10 | struct map_session_data; |
---|
11 | |
---|
12 | #include "map.h" // struct block_list |
---|
13 | #include "path.h" // struct walkpath_data |
---|
14 | #include "skill.h" // struct skill_timerskill, struct skill_unit_group, struct skill_unit_group_tickset |
---|
15 | |
---|
16 | struct unit_data { |
---|
17 | struct block_list *bl; |
---|
18 | struct walkpath_data walkpath; |
---|
19 | struct skill_timerskill *skilltimerskill[MAX_SKILLTIMERSKILL]; |
---|
20 | struct skill_unit_group *skillunit[MAX_SKILLUNITGROUP]; |
---|
21 | struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; |
---|
22 | short attacktarget_lv; |
---|
23 | short to_x,to_y; |
---|
24 | short skillx,skilly; |
---|
25 | short skillid,skilllv; |
---|
26 | int skilltarget; |
---|
27 | int skilltimer; |
---|
28 | int target; |
---|
29 | int attacktimer; |
---|
30 | int walktimer; |
---|
31 | int chaserange; |
---|
32 | unsigned int attackabletime; |
---|
33 | unsigned int canact_tick; |
---|
34 | unsigned int canmove_tick; |
---|
35 | uint8 dir; |
---|
36 | unsigned char walk_count; |
---|
37 | struct { |
---|
38 | unsigned change_walk_target : 1 ; |
---|
39 | unsigned skillcastcancel : 1 ; |
---|
40 | unsigned attack_continue : 1 ; |
---|
41 | unsigned walk_easy : 1 ; |
---|
42 | unsigned running : 1; |
---|
43 | unsigned speed_changed : 1; |
---|
44 | } state; |
---|
45 | }; |
---|
46 | |
---|
47 | struct view_data { |
---|
48 | unsigned short |
---|
49 | class_, |
---|
50 | weapon, |
---|
51 | shield, //Or left-hand weapon. |
---|
52 | head_top, |
---|
53 | head_mid, |
---|
54 | head_bottom, |
---|
55 | hair_style, |
---|
56 | hair_color, |
---|
57 | cloth_color; |
---|
58 | char sex; |
---|
59 | unsigned dead_sit : 2; |
---|
60 | }; |
---|
61 | |
---|
62 | // PC, MOB, PET ɀʷéðPÂÉÜÆßévæ |
---|
63 | |
---|
64 | // àsJn |
---|
65 | // ßèlÍA0 ( ¬÷ ), 1 ( žs ) |
---|
66 | int unit_walktoxy( struct block_list *bl, short x, short y, int easy); |
---|
67 | int unit_walktobl( struct block_list *bl, struct block_list *target, int range, int easy); |
---|
68 | int unit_run(struct block_list *bl); |
---|
69 | |
---|
70 | // àsâ~ |
---|
71 | // typeÍȺÌgÝí¹ : |
---|
72 | // 1: ÊuîñÌM( ±ÌÖÌãÉÊuîñðM·éêÍsv ) |
---|
73 | // 2: _[WfBCLè |
---|
74 | // 4: sŸ(MOBÌÝH) |
---|
75 | int unit_stop_walking(struct block_list *bl,int type); |
---|
76 | int unit_can_move(struct block_list *bl); |
---|
77 | int unit_is_walking(struct block_list *bl); |
---|
78 | int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type); |
---|
79 | |
---|
80 | int unit_escape(struct block_list *bl, struct block_list *target, short dist); |
---|
81 | // Êu̧ڮ(«òεÈÇ) |
---|
82 | int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath); |
---|
83 | int unit_warp(struct block_list *bl, short map, short x, short y, int type); |
---|
84 | int unit_setdir(struct block_list *bl,unsigned char dir); |
---|
85 | uint8 unit_getdir(struct block_list *bl); |
---|
86 | |
---|
87 | // »±ÜÅàsÅœÇè
¯é©Ì»è |
---|
88 | bool unit_can_reach_pos(struct block_list *bl,int x,int y,int easy); |
---|
89 | bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range, int easy, short *x, short *y); |
---|
90 | |
---|
91 | // UÖA |
---|
92 | int unit_stop_attack(struct block_list *bl); |
---|
93 | int unit_attack(struct block_list *src,int target_id,int continuous); |
---|
94 | int unit_cancel_combo(struct block_list *bl); |
---|
95 | |
---|
96 | // XLgp |
---|
97 | int unit_skilluse_id(struct block_list *src, int target_id, short skill_num, short skill_lv); |
---|
98 | int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv); |
---|
99 | |
---|
100 | // XLgp( â³ÏÝLXgÔALZsÂÝèt« ) |
---|
101 | int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel); |
---|
102 | int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv, int casttime, int castcancel); |
---|
103 | |
---|
104 | // r¥LZ |
---|
105 | int unit_skillcastcancel(struct block_list *bl,int type); |
---|
106 | |
---|
107 | int unit_counttargeted(struct block_list *bl,int target_lv); |
---|
108 | |
---|
109 | // unit_data Ìú» |
---|
110 | void unit_dataset(struct block_list *bl); |
---|
111 | |
---|
112 | int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2); |
---|
113 | // »ÌŒ |
---|
114 | struct unit_data* unit_bl2ud(struct block_list *bl); |
---|
115 | void unit_remove_map_pc(struct map_session_data *sd, int clrtype); |
---|
116 | void unit_free_pc(struct map_session_data *sd); |
---|
117 | #define unit_remove_map(bl,clrtype) unit_remove_map_(bl,clrtype,__FILE__,__LINE__,__func__) |
---|
118 | int unit_remove_map_(struct block_list *bl, int clrtype, const char* file, int line, const char* func); |
---|
119 | int unit_free(struct block_list *bl, int clrtype); |
---|
120 | int unit_changeviewsize(struct block_list *bl,short size); |
---|
121 | |
---|
122 | // ú»[` |
---|
123 | int do_init_unit(void); |
---|
124 | int do_final_unit(void); |
---|
125 | |
---|
126 | extern const short dirx[8]; |
---|
127 | extern const short diry[8]; |
---|
128 | |
---|
129 | #endif /* _UNIT_H_ */ |
---|