battle.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _BATTLE_H_
  4. #define _BATTLE_H_
  5. // state of a single attack attempt; used in flee/def penalty calculations when mobbed
  6. enum damage_lv {
  7. ATK_LUCKY=1, // attack was lucky-dodged
  8. ATK_FLEE, // attack was dodged
  9. ATK_DEF // attack connected
  10. };
  11. // ダメージ
  12. struct Damage {
  13. int damage,damage2;
  14. int type,div_;
  15. int amotion,dmotion;
  16. int blewcount;
  17. int flag;
  18. enum damage_lv dmg_lv; //ATK_LUCKY,ATK_FLEE,ATK_DEF
  19. };
  20. // 属性表(読み込みはpc.c、battle_attr_fixで使用)
  21. extern int attr_fix_table[4][10][10];
  22. struct map_session_data;
  23. struct mob_data;
  24. struct block_list;
  25. // ダメージ計算
  26. struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int count);
  27. int battle_calc_return_damage(struct block_list *bl, int damage, int flag);
  28. void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss);
  29. int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_type, int def_lv);
  30. // ダメージ最終計算
  31. int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
  32. int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
  33. enum { // 最終計算のフラグ
  34. BF_WEAPON = 0x0001,
  35. BF_MAGIC = 0x0002,
  36. BF_MISC = 0x0004,
  37. BF_SHORT = 0x0010,
  38. BF_LONG = 0x0040,
  39. BF_SKILL = 0x0100,
  40. BF_NORMAL = 0x0200,
  41. BF_WEAPONMASK=0x000f,
  42. BF_RANGEMASK= 0x00f0,
  43. BF_SKILLMASK= 0x0f00,
  44. };
  45. int battle_delay_damage (unsigned int tick, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay);
  46. // 通常攻撃処理まとめ
  47. enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,unsigned int tick,int flag);
  48. // 各種パラメータを得る
  49. struct block_list* battle_get_master(struct block_list *src);
  50. struct block_list* battle_gettargeted(struct block_list *target);
  51. struct block_list* battle_getenemy(struct block_list *target, int type, int range);
  52. int battle_gettarget(struct block_list *bl);
  53. int battle_getcurrentskill(struct block_list *bl);
  54. //New definitions [Skotlex]
  55. #define BCT_ENEMY 0x020000
  56. //This should be (~BCT_ENEMY&BCT_ALL)
  57. #define BCT_NOENEMY 0x1d0000
  58. #define BCT_PARTY 0x040000
  59. //This should be (~BCT_PARTY&BCT_ALL)
  60. #define BCT_NOPARTY 0x1b0000
  61. #define BCT_GUILD 0x080000
  62. //This should be (~BCT_GUILD&BCT_ALL)
  63. #define BCT_NOGUILD 0x170000
  64. #define BCT_ALL 0x1f0000
  65. #define BCT_NOONE 0x000000
  66. #define BCT_SELF 0x010000
  67. #define BCT_NEUTRAL 0x100000
  68. #define is_boss(bl) (status_get_mode(bl)&MD_BOSS) // Can refine later [Aru]
  69. int battle_check_undead(int race,int element);
  70. int battle_check_target(struct block_list *src, struct block_list *target,int flag);
  71. int battle_check_range(struct block_list *src,struct block_list *bl,int range);
  72. void battle_consume_ammo(struct map_session_data* sd, int skill, int lv);
  73. // 設定
  74. extern struct Battle_Config
  75. {
  76. int warp_point_debug;
  77. int enable_critical;
  78. int mob_critical_rate;
  79. int critical_rate;
  80. int enable_baseatk;
  81. int enable_perfect_flee;
  82. int cast_rate, delay_rate;
  83. int delay_dependon_dex, delay_dependon_agi;
  84. int sdelay_attack_enable;
  85. int left_cardfix_to_right;
  86. int skill_add_range;
  87. int skill_out_range_consume;
  88. int skillrange_by_distance; //[Skotlex]
  89. int use_weapon_skill_range; //[Skotlex]
  90. int pc_damage_delay_rate;
  91. int defnotenemy;
  92. int vs_traps_bctall;
  93. int traps_setting;
  94. int summon_flora; //[Skotlex]
  95. int clear_unit_ondeath; //[Skotlex]
  96. int clear_unit_onwarp; //[Skotlex]
  97. int random_monster_checklv;
  98. int attr_recover;
  99. int item_auto_get;
  100. int flooritem_lifetime;
  101. int item_first_get_time;
  102. int item_second_get_time;
  103. int item_third_get_time;
  104. int mvp_item_first_get_time;
  105. int mvp_item_second_get_time;
  106. int mvp_item_third_get_time;
  107. int base_exp_rate,job_exp_rate;
  108. int drop_rate0item;
  109. int death_penalty_type;
  110. int death_penalty_base,death_penalty_job;
  111. int pvp_exp; // [MouseJstr]
  112. int gtb_sc_immunity;
  113. int zeny_penalty;
  114. int restart_hp_rate;
  115. int restart_sp_rate;
  116. int mvp_exp_rate;
  117. int mvp_hp_rate;
  118. int monster_hp_rate;
  119. int monster_max_aspd;
  120. int view_range_rate;
  121. int chase_range_rate;
  122. int atc_gmonly;
  123. int atc_spawn_quantity_limit;
  124. int atc_slave_clone_limit;
  125. int partial_name_scan;
  126. int gm_allskill;
  127. int gm_allequip;
  128. int gm_skilluncond;
  129. int gm_join_chat;
  130. int gm_kick_chat;
  131. int skillfree;
  132. int skillup_limit;
  133. int wp_rate;
  134. int pp_rate;
  135. int monster_active_enable;
  136. int monster_damage_delay_rate;
  137. int monster_loot_type;
  138. int mob_skill_rate; //[Skotlex]
  139. int mob_skill_delay; //[Skotlex]
  140. int mob_count_rate;
  141. int no_spawn_on_player; //[Skotlex]
  142. int force_random_spawn; //[Skotlex]
  143. int mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex]
  144. int slaves_inherit_mode;
  145. int slaves_inherit_speed;
  146. int summons_trigger_autospells;
  147. int pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex]
  148. int walk_delay_rate; //Adjusts can't walk delay after being hit. [Skotlex]
  149. int multihit_delay; //Adjusts can't walk delay per hit on multi-hitting skills. [Skotlex]
  150. int quest_skill_learn;
  151. int quest_skill_reset;
  152. int basic_skill_check;
  153. int guild_emperium_check;
  154. int guild_exp_limit;
  155. int guild_max_castles;
  156. int emergency_call;
  157. int guild_aura;
  158. int pc_invincible_time;
  159. int pet_catch_rate;
  160. int pet_rename;
  161. int pet_friendly_rate;
  162. int pet_hungry_delay_rate;
  163. int pet_hungry_friendly_decrease;
  164. int pet_status_support;
  165. int pet_attack_support;
  166. int pet_damage_support;
  167. int pet_support_min_friendly; //[Skotlex]
  168. int pet_support_rate;
  169. int pet_attack_exp_to_master;
  170. int pet_attack_exp_rate;
  171. int pet_lv_rate; //[Skotlex]
  172. int pet_max_stats; //[Skotlex]
  173. int pet_max_atk1; //[Skotlex]
  174. int pet_max_atk2; //[Skotlex]
  175. int pet_no_gvg; //Disables pets in gvg. [Skotlex]
  176. int skill_min_damage;
  177. int finger_offensive_type;
  178. int heal_exp;
  179. int max_heal_lv;
  180. int max_heal; //Mitternacht
  181. int resurrection_exp;
  182. int shop_exp;
  183. int combo_delay_rate;
  184. int item_check;
  185. int item_use_interval; //[Skotlex]
  186. int wedding_modifydisplay;
  187. int wedding_ignorepalette; //[Skotlex]
  188. int xmas_ignorepalette; // [Valaris]
  189. int summer_ignorepalette; // [Zephyrus]
  190. int natural_healhp_interval;
  191. int natural_healsp_interval;
  192. int natural_heal_skill_interval;
  193. int natural_heal_weight_rate;
  194. int arrow_decrement;
  195. int max_aspd;
  196. int max_walk_speed; //Maximum walking speed after buffs [Skotlex]
  197. int max_hp;
  198. int max_sp;
  199. int max_lv, aura_lv;
  200. int max_parameter, max_baby_parameter;
  201. int max_cart_weight;
  202. int skill_log;
  203. int battle_log;
  204. int save_log;
  205. int error_log;
  206. int etc_log;
  207. int save_clothcolor;
  208. int undead_detect_type;
  209. int auto_counter_type;
  210. int min_hitrate; //[Skotlex]
  211. int max_hitrate; //[Skotlex]
  212. int agi_penalty_target;
  213. int agi_penalty_type;
  214. int agi_penalty_count;
  215. int agi_penalty_num;
  216. int vit_penalty_target;
  217. int vit_penalty_type;
  218. int vit_penalty_count;
  219. int vit_penalty_num;
  220. int weapon_defense_type;
  221. int magic_defense_type;
  222. int skill_reiteration;
  223. int skill_nofootset;
  224. int pc_cloak_check_type;
  225. int monster_cloak_check_type;
  226. int estimation_type;
  227. int gvg_short_damage_rate;
  228. int gvg_long_damage_rate;
  229. int gvg_weapon_damage_rate;
  230. int gvg_magic_damage_rate;
  231. int gvg_misc_damage_rate;
  232. int gvg_flee_penalty;
  233. int gvg_eliminate_time;
  234. int pk_short_damage_rate;
  235. int pk_long_damage_rate;
  236. int pk_weapon_damage_rate;
  237. int pk_magic_damage_rate;
  238. int pk_misc_damage_rate;
  239. int mob_changetarget_byskill;
  240. int attack_direction_change;
  241. int land_skill_limit;
  242. int party_skill_penalty;
  243. int monster_class_change_recover;
  244. int produce_item_name_input;
  245. int display_skill_fail;
  246. int chat_warpportal;
  247. int mob_warp;
  248. int dead_branch_active;
  249. int vending_max_value;
  250. int vending_tax;
  251. int show_steal_in_same_party;
  252. int party_share_type;
  253. int party_hp_mode;
  254. int party_show_share_picker;
  255. int attack_attr_none;
  256. int item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss,
  257. item_rate_equip, item_rate_equip_boss, item_rate_heal, item_rate_heal_boss, item_rate_use,
  258. item_rate_use_boss, item_rate_treasure, item_rate_adddrop;
  259. int logarithmic_drops;
  260. int item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^
  261. int item_drop_card_min,item_drop_card_max;
  262. int item_drop_equip_min,item_drop_equip_max;
  263. int item_drop_mvp_min,item_drop_mvp_max; // End Addition
  264. int item_drop_heal_min,item_drop_heal_max; // Added by Valatris
  265. int item_drop_use_min,item_drop_use_max; //End
  266. int item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex]
  267. int item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex]
  268. int prevent_logout; // Added by RoVeRT
  269. int alchemist_summon_reward; // [Valaris]
  270. int drops_by_luk;
  271. int drops_by_luk2;
  272. int equip_natural_break_rate; //Base Natural break rate for attacks.
  273. int equip_self_break_rate; //Natural & Penalty skills break rate
  274. int equip_skill_break_rate; //Offensive skills break rate
  275. int pet_equip_required;
  276. int multi_level_up;
  277. int max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
  278. int pk_mode;
  279. int pk_level_range;
  280. int manner_system; // end additions [Valaris]
  281. int show_mob_info;
  282. int agi_penalty_count_lv;
  283. int vit_penalty_count_lv;
  284. int gx_allhit;
  285. int gx_disptype;
  286. int devotion_level_difference;
  287. int player_skill_partner_check;
  288. int hide_GM_session;
  289. int invite_request_check;
  290. int skill_removetrap_type;
  291. int disp_experience;
  292. int disp_zeny;
  293. int castle_defense_rate;
  294. int backstab_bow_penalty;
  295. int hp_rate;
  296. int sp_rate;
  297. int gm_cant_drop_min_lv;
  298. int gm_cant_drop_max_lv;
  299. int disp_hpmeter;
  300. int bone_drop;
  301. int buyer_name;
  302. // eAthena additions
  303. int night_at_start; // added by [Yor]
  304. int day_duration; // added by [Yor]
  305. int night_duration; // added by [Yor]
  306. int ban_hack_trade; // added by [Yor]
  307. int hack_info_GM_level; // added by [Yor]
  308. int any_warp_GM_min_level; // added by [Yor]
  309. int packet_ver_flag; // added by [Yor]
  310. int min_hair_style; // added by [MouseJstr]
  311. int max_hair_style; // added by [MouseJstr]
  312. int min_hair_color; // added by [MouseJstr]
  313. int max_hair_color; // added by [MouseJstr]
  314. int min_cloth_color; // added by [MouseJstr]
  315. int max_cloth_color; // added by [MouseJstr]
  316. int pet_hair_style; // added by [Skotlex]
  317. int castrate_dex_scale; // added by [MouseJstr]
  318. int area_size; // added by [MouseJstr]
  319. int max_def, over_def_bonus; //added by [Skotlex]
  320. int zeny_from_mobs; // [Valaris]
  321. int mobs_level_up; // [Valaris]
  322. int mobs_level_up_exp_rate; // [Valaris]
  323. int pk_min_level; // [celest]
  324. int skill_steal_type; // [celest]
  325. int skill_steal_rate; // [celest]
  326. int skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
  327. int motd_type; // [celest]
  328. int finding_ore_rate; // orn
  329. int exp_calc_type;
  330. int exp_bonus_attacker;
  331. int exp_bonus_max_attacker;
  332. int min_skill_delay_limit;
  333. int default_walk_delay;
  334. int no_skill_delay;
  335. int attack_walk_delay;
  336. int require_glory_guild;
  337. int idle_no_share;
  338. int party_update_interval;
  339. int party_even_share_bonus;
  340. int delay_battle_damage;
  341. int hide_woe_damage;
  342. int display_version;
  343. int who_display_aid;
  344. int display_hallucination; // [Skotlex]
  345. int use_statpoint_table; // [Skotlex]
  346. int ignore_items_gender; //[Lupus]
  347. int copyskill_restrict; // [Aru]
  348. int berserk_cancels_buffs; // [Aru]
  349. int debuff_on_logout; // Removes a few "official" negative Scs on logout. [Skotlex]
  350. int mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex]
  351. int hom_setting; //Configures various homunc settings which make them behave unlike normal characters.. [Skotlex]
  352. int dynamic_mobs; // Dynamic Mobs [Wizputer] - battle_athena flag implemented by [random]
  353. int mob_remove_damaged; // Dynamic Mobs - Remove mobs even if damaged [Wizputer]
  354. int mob_remove_delay; // Dynamic Mobs - delay before removing mobs from a map [Skotlex]
  355. int show_hp_sp_drain, show_hp_sp_gain; //[Skotlex]
  356. int mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex]
  357. int mob_clear_delay; // [Valaris]
  358. int character_size; // if riders have size=2, and baby class riders size=1 [Lupus]
  359. int mob_max_skilllvl; // Max possible skill level [Lupus]
  360. int rare_drop_announce; // chance <= to show rare drops global announces
  361. int retaliate_to_master; //Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex]
  362. int title_lvl1; // Players titles [Lupus]
  363. int title_lvl2; // Players titles [Lupus]
  364. int title_lvl3; // Players titles [Lupus]
  365. int title_lvl4; // Players titles [Lupus]
  366. int title_lvl5; // Players titles [Lupus]
  367. int title_lvl6; // Players titles [Lupus]
  368. int title_lvl7; // Players titles [Lupus]
  369. int title_lvl8; // Players titles [Lupus]
  370. int duel_allow_pvp; // [LuzZza]
  371. int duel_allow_gvg; // [LuzZza]
  372. int duel_allow_teleport; // [LuzZza]
  373. int duel_autoleave_when_die; // [LuzZza]
  374. int duel_time_interval; // [LuzZza]
  375. int duel_only_on_same_map; // [Toms]
  376. int skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza]
  377. int allow_skill_without_day; // [Komurka]
  378. int allow_es_magic_pc; // [Skotlex]
  379. int skill_wall_check; // [Skotlex]
  380. int cell_stack_limit; // [Skotlex]
  381. int skill_caster_check; // [Skotlex]
  382. int sc_castcancel; // [Skotlex]
  383. int pc_sc_def_rate; // [Skotlex]
  384. int mob_sc_def_rate;
  385. int pc_luk_sc_def;
  386. int mob_luk_sc_def;
  387. int pc_max_sc_def;
  388. int mob_max_sc_def;
  389. int sg_angel_skill_ratio;
  390. int sg_miracle_skill_ratio;
  391. int sg_miracle_skill_duration;
  392. int autospell_stacking; //Enables autospell cards to stack. [Skotlex]
  393. int override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
  394. int min_chat_delay; //Minimum time between client messages. [Skotlex]
  395. int friend_auto_add; //When accepting friends, both get friended. [Skotlex]
  396. int hvan_explosion_intimate; // fix [albator]
  397. int hom_rename;
  398. int homunculus_show_growth ; //[orn]
  399. int homunculus_friendly_rate;
  400. int quest_exp_rate;
  401. } battle_config;
  402. void do_init_battle(void);
  403. void do_final_battle(void);
  404. extern int battle_config_read(const char *cfgName);
  405. extern void battle_validate_conf(void);
  406. extern void battle_set_defaults(void);
  407. int battle_set_value(const char* w1, const char* w2);
  408. int battle_get_value(const char* w1);
  409. #endif /* _BATTLE_H_ */