battle.hpp 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. // Copyright (c) rAthena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef BATTLE_HPP
  4. #define BATTLE_HPP
  5. #include <bitset>
  6. #include <common/cbasetypes.hpp>
  7. #include <common/mmo.hpp>
  8. #include <config/core.hpp>
  9. #include "map.hpp" //ELE_MAX
  10. #include "skill.hpp"
  11. //fwd declaration
  12. class map_session_data;
  13. struct mob_data;
  14. struct block_list;
  15. enum e_damage_type : uint8;
  16. /// State of a single attack attempt; used in flee/def penalty calculations when mobbed
  17. enum damage_lv : uint8 {
  18. ATK_NONE, /// Not an attack
  19. ATK_LUCKY, /// Attack was lucky-dodged
  20. ATK_FLEE, /// Attack was dodged
  21. ATK_MISS, /// Attack missed because of element/race modifier.
  22. ATK_BLOCK, /// Attack was blocked by some skills.
  23. ATK_DEF /// Attack connected
  24. };
  25. /// Flag for base damage calculation
  26. enum e_base_damage_flag : uint16 {
  27. BDMG_NONE = 0x0000, /// None
  28. BDMG_CRIT = 0x0001, /// Critical hit damage
  29. BDMG_ARROW = 0x0002, /// Add arrow attack and use ranged damage formula
  30. BDMG_MAGIC = 0x0004, /// Use MATK for base damage (e.g. Magic Crasher)
  31. BDMG_NOSIZE = 0x0008, /// Skip target size adjustment (e.g. Weapon Perfection)
  32. };
  33. /// Flag of the final calculation
  34. enum e_battle_flag : uint16 {
  35. BF_NONE = 0x0000, /// None
  36. BF_WEAPON = 0x0001, /// Weapon attack
  37. BF_MAGIC = 0x0002, /// Magic attack
  38. BF_MISC = 0x0004, /// Misc attack
  39. BF_SHORT = 0x0010, /// Short attack
  40. BF_LONG = 0x0040, /// Long attack
  41. BF_SKILL = 0x0100, /// Skill attack
  42. BF_NORMAL = 0x0200, /// Normal attack
  43. BF_WEAPONMASK = BF_WEAPON|BF_MAGIC|BF_MISC, /// Weapon attack mask
  44. BF_RANGEMASK = BF_SHORT|BF_LONG, /// Range attack mask
  45. BF_SKILLMASK = BF_SKILL|BF_NORMAL, /// Skill attack mask
  46. };
  47. /// Battle check target [Skotlex]
  48. enum e_battle_check_target : uint32 {
  49. BCT_NOONE = 0x000000, ///< No one
  50. BCT_SELF = 0x010000, ///< Self
  51. BCT_ENEMY = 0x020000, ///< Enemy
  52. BCT_PARTY = 0x040000, ///< Party members
  53. BCT_GUILDALLY = 0x080000, ///< Only allies, NOT guildmates
  54. BCT_NEUTRAL = 0x100000, ///< Neutral target
  55. BCT_SAMEGUILD = 0x200000, ///< Guildmates, No Guild Allies
  56. BCT_ALL = 0x3F0000, ///< All targets
  57. BCT_WOS = 0x400000, ///< Except self (currently used for skipping if src == bl in skill_area_sub)
  58. BCT_GUILD = BCT_SAMEGUILD|BCT_GUILDALLY, ///< Guild AND Allies (BCT_SAMEGUILD|BCT_GUILDALLY)
  59. BCT_NOGUILD = BCT_ALL&~BCT_GUILD, ///< Except guildmates
  60. BCT_NOPARTY = BCT_ALL&~BCT_PARTY, ///< Except party members
  61. BCT_NOENEMY = BCT_ALL&~BCT_ENEMY, ///< Except enemy
  62. BCT_ALLY = BCT_PARTY|BCT_GUILD,
  63. BCT_FRIEND = BCT_NOENEMY,
  64. };
  65. /// Check flag for common damage bonuses such as: ATKpercent, Refine, Passive Mastery, Spirit Spheres and Star Crumbs
  66. enum e_bonus_chk_flag : uint8 {
  67. BCHK_ALL, /// Check if all of the common damage bonuses apply to this skill
  68. BCHK_REFINE, /// Check if refine bonus is applied (pre-renewal only currently)
  69. BCHK_STAR, /// Check if Star Crumb bonus is applied (pre-renewal only currently)
  70. };
  71. /// Damage structure
  72. struct Damage {
  73. #ifdef RENEWAL
  74. int64 statusAtk, statusAtk2, weaponAtk, weaponAtk2, equipAtk, equipAtk2, masteryAtk, masteryAtk2, percentAtk, percentAtk2;
  75. #else
  76. int64 basedamage; /// Right hand damage that a normal attack would deal
  77. #endif
  78. int64 damage, /// Right hand damage
  79. damage2; /// Left hand damage
  80. enum e_damage_type type; /// Check clif_damage for type
  81. int16 div_; /// Number of hit
  82. int32 amotion,
  83. dmotion;
  84. int32 blewcount; /// Number of knockback
  85. int32 flag; /// chk e_battle_flag
  86. int32 miscflag;
  87. enum damage_lv dmg_lv; /// ATK_LUCKY,ATK_FLEE,ATK_DEF
  88. bool isspdamage; /// Display blue damage numbers in clif_damage
  89. };
  90. // Damage Calculation
  91. struct Damage battle_calc_attack(int32 attack_type,struct block_list *bl,struct block_list *target,uint16 skill_id,uint16 skill_lv,int32 flag);
  92. int64 battle_calc_return_damage(struct block_list *bl, struct block_list *src, int64 *, int32 flag, uint16 skill_id, bool status_reflect);
  93. void battle_drain(map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int32 race, int32 class_);
  94. int64 battle_attr_fix(struct block_list* src, struct block_list* target, int64 damage, int32 atk_elem, int32 def_type, int32 def_lv, int32 flag = 0);
  95. int32 battle_calc_cardfix(int32 attack_type, struct block_list *src, struct block_list *target, std::bitset<NK_MAX> nk, int32 s_ele, int32 s_ele_, int64 damage, int32 left, int32 flag);
  96. // Final calculation Damage
  97. int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int64 damage,uint16 skill_id,uint16 skill_lv);
  98. int64 battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int64 damage,uint16 skill_id,int32 flag);
  99. int64 battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int64 damage,uint16 skill_id,int32 flag);
  100. int64 battle_calc_pk_damage(block_list &src, block_list &bl, int64 damage, uint16 skill_id, int32 flag);
  101. int32 battle_damage(struct block_list *src, struct block_list *target, int64 damage, t_tick delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, uint16 attack_type, bool additional_effects, t_tick tick, bool spdamage);
  102. int32 battle_delay_damage (t_tick tick, int32 amotion, struct block_list *src, struct block_list *target, int32 attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, t_tick ddelay, bool additional_effects, bool spdamage);
  103. int32 battle_fix_damage(struct block_list* src, struct block_list* target, int64 damage, t_tick walkdelay, uint16 skill_id);
  104. int32 battle_calc_chorusbonus(map_session_data *sd);
  105. // Summary normal attack treatment (basic attack)
  106. enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,t_tick tick,int32 flag);
  107. // Accessors
  108. struct block_list* battle_get_master(struct block_list *src);
  109. struct block_list* battle_gettargeted(struct block_list *target);
  110. struct block_list* battle_getenemy(struct block_list *target, int32 type, int32 range);
  111. int32 battle_gettarget(struct block_list *bl);
  112. uint16 battle_getcurrentskill(struct block_list *bl);
  113. int32 battle_check_undead(int32 race,int32 element);
  114. int32 battle_check_target(struct block_list *src, struct block_list *target,int32 flag);
  115. bool battle_check_range(struct block_list *src,struct block_list *bl,int32 range);
  116. bool battle_check_coma(map_session_data& sd, struct block_list& target, e_battle_flag attack_type);
  117. void battle_consume_ammo(map_session_data* sd, int32 skill, int32 lv);
  118. bool is_infinite_defense(struct block_list *target, int32 flag);
  119. // Settings
  120. #define MIN_HAIR_STYLE battle_config.min_hair_style
  121. #define MAX_HAIR_STYLE battle_config.max_hair_style
  122. #define MIN_HAIR_COLOR battle_config.min_hair_color
  123. #define MAX_HAIR_COLOR battle_config.max_hair_color
  124. #define MIN_CLOTH_COLOR battle_config.min_cloth_color
  125. #define MAX_CLOTH_COLOR battle_config.max_cloth_color
  126. #define MIN_BODY_STYLE battle_config.min_body_style
  127. #define MAX_BODY_STYLE battle_config.max_body_style
  128. struct Battle_Config
  129. {
  130. int32 warp_point_debug;
  131. int32 enable_critical;
  132. int32 mob_critical_rate;
  133. int32 critical_rate;
  134. int32 enable_baseatk, enable_baseatk_renewal;
  135. int32 enable_perfect_flee;
  136. int32 cast_rate, delay_rate;
  137. int32 delay_dependon_dex, delay_dependon_agi;
  138. int32 sdelay_attack_enable;
  139. int32 left_cardfix_to_right;
  140. int32 cardfix_monster_physical;
  141. int32 skill_add_range;
  142. int32 skill_out_range_consume;
  143. int32 skill_amotion_leniency;
  144. int32 skillrange_by_distance; //[Skotlex]
  145. int32 use_weapon_skill_range; //[Skotlex]
  146. int32 pc_damage_delay_rate;
  147. int32 defnotenemy;
  148. int32 vs_traps_bctall;
  149. int32 traps_setting;
  150. int32 summon_flora; //[Skotlex]
  151. int32 clear_unit_ondeath; //[Skotlex]
  152. int32 clear_unit_onwarp; //[Skotlex]
  153. int32 random_monster_checklv;
  154. int32 attr_recover;
  155. int32 item_auto_get;
  156. int32 flooritem_lifetime;
  157. int32 item_first_get_time;
  158. int32 item_second_get_time;
  159. int32 item_third_get_time;
  160. int32 mvp_item_first_get_time;
  161. int32 mvp_item_second_get_time;
  162. int32 mvp_item_third_get_time;
  163. int32 base_exp_rate,job_exp_rate;
  164. int32 drop_rate0item;
  165. int32 death_penalty_type;
  166. int32 death_penalty_base,death_penalty_job;
  167. int32 pvp_exp; // [MouseJstr]
  168. int32 gtb_sc_immunity;
  169. int32 zeny_penalty;
  170. int32 restart_hp_rate;
  171. int32 restart_sp_rate;
  172. int32 mvp_exp_rate;
  173. int32 mvp_hp_rate;
  174. int32 monster_hp_rate;
  175. int32 view_range_rate;
  176. int32 chase_range_rate;
  177. int32 atc_spawn_quantity_limit;
  178. int32 atc_slave_clone_limit;
  179. int32 partial_name_scan;
  180. int32 skillfree;
  181. int32 skillup_limit;
  182. int32 wp_rate;
  183. int32 pp_rate;
  184. int32 monster_active_enable;
  185. int32 monster_damage_delay_rate;
  186. int32 monster_loot_type;
  187. int32 mob_skill_rate; //[Skotlex]
  188. int32 mob_skill_delay; //[Skotlex]
  189. int32 mob_count_rate;
  190. int32 no_spawn_on_player; //[Skotlex]
  191. int32 force_random_spawn; //[Skotlex]
  192. int32 mob_spawn_delay, plant_spawn_delay, boss_spawn_delay; // [Skotlex]
  193. int32 slaves_inherit_mode;
  194. int32 slaves_inherit_speed;
  195. int32 summons_trigger_autospells;
  196. int32 pc_walk_delay_rate; //Adjusts can't walk delay after being hit for players. [Skotlex]
  197. int32 walk_delay_rate; //Adjusts can't walk delay after being hit. [Skotlex]
  198. int32 multihit_delay; //Adjusts can't walk delay per hit on multi-hitting skills. [Skotlex]
  199. int32 quest_skill_learn;
  200. int32 quest_skill_reset;
  201. int32 basic_skill_check;
  202. int32 guild_emperium_check;
  203. int32 guild_exp_limit;
  204. int32 guild_max_castles;
  205. int32 guild_skill_relog_delay;
  206. int32 guild_skill_relog_type;
  207. int32 emergency_call;
  208. int32 guild_aura;
  209. int32 pc_invincible_time;
  210. int32 pet_catch_rate;
  211. int32 pet_rename;
  212. int32 pet_friendly_rate;
  213. int32 pet_hungry_delay_rate;
  214. int32 pet_hungry_friendly_decrease;
  215. int32 pet_status_support;
  216. int32 pet_attack_support;
  217. int32 pet_damage_support;
  218. int32 pet_support_min_friendly; //[Skotlex]
  219. int32 pet_support_rate;
  220. int32 pet_attack_exp_to_master;
  221. int32 pet_attack_exp_rate;
  222. int32 pet_lv_rate; //[Skotlex]
  223. int32 pet_max_stats; //[Skotlex]
  224. int32 pet_max_atk1; //[Skotlex]
  225. int32 pet_max_atk2; //[Skotlex]
  226. int32 pet_no_gvg; //Disables pets in gvg. [Skotlex]
  227. int32 pet_equip_required;
  228. int32 pet_unequip_destroy;
  229. int32 pet_master_dead;
  230. int32 skill_min_damage;
  231. int32 finger_offensive_type;
  232. int32 heal_exp;
  233. int32 max_heal_lv;
  234. int32 max_heal; //Mitternacht
  235. int32 resurrection_exp;
  236. int32 shop_exp;
  237. int32 combo_delay_rate;
  238. int32 item_check;
  239. int32 item_use_interval; //[Skotlex]
  240. int32 cashfood_use_interval;
  241. int32 wedding_modifydisplay;
  242. int32 wedding_ignorepalette; //[Skotlex]
  243. int32 xmas_ignorepalette; // [Valaris]
  244. int32 summer_ignorepalette; // [Zephyrus]
  245. int32 hanbok_ignorepalette;
  246. int32 oktoberfest_ignorepalette;
  247. int32 natural_healhp_interval;
  248. int32 natural_healsp_interval;
  249. int32 natural_heal_skill_interval;
  250. int32 natural_heal_weight_rate;
  251. int32 natural_heal_weight_rate_renewal;
  252. int32 arrow_decrement;
  253. int32 ammo_unequip;
  254. int32 ammo_check_weapon;
  255. int32 max_aspd;
  256. int32 max_walk_speed; //Maximum walking speed after buffs [Skotlex]
  257. int32 max_hp_lv99;
  258. int32 max_hp_lv150;
  259. int32 max_hp;
  260. int32 max_sp;
  261. int32 max_lv, aura_lv;
  262. int32 max_parameter, max_baby_parameter;
  263. int32 max_cart_weight;
  264. int32 skill_log;
  265. int32 battle_log;
  266. int32 etc_log;
  267. int32 save_clothcolor;
  268. int32 undead_detect_type;
  269. int32 auto_counter_type;
  270. int32 min_hitrate; //[Skotlex]
  271. int32 max_hitrate; //[Skotlex]
  272. int32 agi_penalty_target;
  273. int32 agi_penalty_type;
  274. int32 agi_penalty_count;
  275. int32 agi_penalty_num;
  276. int32 vit_penalty_target;
  277. int32 vit_penalty_type;
  278. int32 vit_penalty_count;
  279. int32 vit_penalty_num;
  280. int32 weapon_defense_type;
  281. int32 magic_defense_type;
  282. int32 skill_reiteration;
  283. int32 skill_nofootset;
  284. int32 pc_cloak_check_type;
  285. int32 monster_cloak_check_type;
  286. int32 estimation_type;
  287. int32 gvg_short_damage_rate;
  288. int32 gvg_long_damage_rate;
  289. int32 gvg_weapon_damage_rate;
  290. int32 gvg_magic_damage_rate;
  291. int32 gvg_misc_damage_rate;
  292. int32 gvg_flee_penalty;
  293. int32 pk_short_damage_rate;
  294. int32 pk_long_damage_rate;
  295. int32 pk_weapon_damage_rate;
  296. int32 pk_magic_damage_rate;
  297. int32 pk_misc_damage_rate;
  298. int32 mob_changetarget_byskill;
  299. int32 attack_direction_change;
  300. int32 land_skill_limit;
  301. int32 monster_class_change_recover;
  302. int32 produce_item_name_input;
  303. int32 display_skill_fail;
  304. int32 chat_warpportal;
  305. int32 mob_warp;
  306. int32 dead_branch_active;
  307. int32 vending_max_value;
  308. int32 vending_over_max;
  309. int32 vending_tax;
  310. int32 vending_tax_min;
  311. int32 show_steal_in_same_party;
  312. int32 party_share_type;
  313. int32 party_hp_mode;
  314. int32 party_show_share_picker;
  315. int32 show_picker_item_type;
  316. int32 attack_attr_none;
  317. int32 item_rate_mvp, item_rate_common, item_rate_common_boss, item_rate_card, item_rate_card_boss,
  318. item_rate_equip, item_rate_equip_boss, item_rate_heal, item_rate_heal_boss, item_rate_use,
  319. item_rate_use_boss, item_rate_treasure, item_rate_adddrop, item_group_rate;
  320. int32 item_rate_common_mvp, item_rate_heal_mvp, item_rate_use_mvp, item_rate_equip_mvp, item_rate_card_mvp;
  321. int32 logarithmic_drops;
  322. int32 item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^
  323. int32 item_drop_card_min,item_drop_card_max;
  324. int32 item_drop_equip_min,item_drop_equip_max;
  325. int32 item_drop_mvp_min,item_drop_mvp_max; // End Addition
  326. int32 item_drop_mvp_mode; //rAthena addition [Playtester]
  327. int32 item_drop_heal_min,item_drop_heal_max; // Added by Valatris
  328. int32 item_drop_use_min,item_drop_use_max; //End
  329. int32 item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex]
  330. int32 item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex]
  331. int32 item_group_drop_min,item_group_drop_max;
  332. int32 prevent_logout; // Added by RoVeRT
  333. int32 prevent_logout_trigger;
  334. int32 land_protector_behavior;
  335. int32 npc_emotion_behavior;
  336. int32 alchemist_summon_reward; // [Valaris]
  337. int32 drops_by_luk;
  338. int32 drops_by_luk2;
  339. int32 equip_natural_break_rate; //Base Natural break rate for attacks.
  340. int32 equip_self_break_rate; //Natural & Penalty skills break rate
  341. int32 equip_skill_break_rate; //Offensive skills break rate
  342. int32 multi_level_up;
  343. int32 multi_level_up_base;
  344. int32 multi_level_up_job;
  345. int32 max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
  346. int32 pk_mode;
  347. int32 pk_mode_mes;
  348. int32 pk_level_range;
  349. int32 manner_system; // end additions [Valaris]
  350. int32 show_mob_info;
  351. int32 gx_allhit;
  352. int32 gx_disptype;
  353. int32 devotion_level_difference;
  354. int32 player_skill_partner_check;
  355. int32 invite_request_check;
  356. int32 skill_removetrap_type;
  357. int32 disp_experience;
  358. int32 disp_zeny;
  359. int32 backstab_bow_penalty;
  360. int32 hp_rate;
  361. int32 sp_rate;
  362. int32 bone_drop;
  363. int32 buyer_name;
  364. int32 dancing_weaponswitch_fix;
  365. // eAthena additions
  366. int32 night_at_start; // added by [Yor]
  367. int32 day_duration; // added by [Yor]
  368. int32 night_duration; // added by [Yor]
  369. int32 ban_hack_trade; // added by [Yor]
  370. int32 min_hair_style; // added by [MouseJstr]
  371. int32 max_hair_style; // added by [MouseJstr]
  372. int32 min_hair_color; // added by [MouseJstr]
  373. int32 max_hair_color; // added by [MouseJstr]
  374. int32 min_cloth_color; // added by [MouseJstr]
  375. int32 max_cloth_color; // added by [MouseJstr]
  376. int32 pet_hair_style; // added by [Skotlex]
  377. int32 castrate_dex_scale; // added by [MouseJstr]
  378. int32 area_size; // added by [MouseJstr]
  379. int32 max_def, over_def_bonus; //added by [Skotlex]
  380. int32 zeny_from_mobs; // [Valaris]
  381. int32 mobs_level_up; // [Valaris]
  382. int32 mobs_level_up_exp_rate; // [Valaris]
  383. int32 pk_min_level; // [celest]
  384. int32 skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
  385. int32 skill_steal_random_options;
  386. int32 motd_type; // [celest]
  387. int32 exp_calc_type;
  388. int32 exp_bonus_attacker;
  389. int32 exp_bonus_max_attacker;
  390. int32 min_skill_delay_limit;
  391. int32 default_walk_delay;
  392. int32 no_skill_delay;
  393. int32 attack_walk_delay;
  394. int32 require_glory_guild;
  395. int32 idle_no_share;
  396. int32 party_update_interval;
  397. int32 party_even_share_bonus;
  398. int32 delay_battle_damage;
  399. int32 hide_woe_damage;
  400. int32 display_version;
  401. int32 display_hallucination; // [Skotlex]
  402. int32 use_statpoint_table; // [Skotlex]
  403. int32 debuff_on_logout; // Removes a few "official" negative Scs on logout. [Skotlex]
  404. int32 mob_ai; //Configures various mob_ai settings to make them smarter or dumber(official). [Skotlex]
  405. int32 hom_setting; //Configures various homunc settings which make them behave unlike normal characters.. [Skotlex]
  406. int32 dynamic_mobs; // Dynamic Mobs [Wizputer] - battle_athena flag implemented by [random]
  407. int32 mob_remove_damaged; // Dynamic Mobs - Remove mobs even if damaged [Wizputer]
  408. int32 mob_remove_delay; // Dynamic Mobs - delay before removing mobs from a map [Skotlex]
  409. int32 mob_active_time; //Duration through which mobs execute their Hard AI after players leave their area of sight.
  410. int32 boss_active_time;
  411. int32 show_hp_sp_drain, show_hp_sp_gain; //[Skotlex]
  412. int32 mob_npc_event_type; //Determines on who the npc_event is executed. [Skotlex]
  413. int32 character_size; // if riders have size=2, and baby class riders size=1 [Lupus]
  414. int32 mob_max_skilllvl; // Max possible skill level [Lupus]
  415. int32 rare_drop_announce; // chance <= to show rare drops global announces
  416. int32 drop_rate_cap; // Drop rate can't be raised above this amount by drop bonus items
  417. int32 drop_rate_cap_vip;
  418. int32 retaliate_to_master; //Whether when a mob is attacked by another mob, it will retaliate versus the mob or the mob's master. [Skotlex]
  419. int32 duel_allow_pvp; // [LuzZza]
  420. int32 duel_allow_gvg; // [LuzZza]
  421. int32 duel_allow_teleport; // [LuzZza]
  422. int32 duel_autoleave_when_die; // [LuzZza]
  423. int32 duel_time_interval; // [LuzZza]
  424. int32 duel_only_on_same_map; // [Toms]
  425. int32 skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza]
  426. int32 allow_skill_without_day; // [Komurka]
  427. int32 allow_es_magic_pc; // [Skotlex]
  428. int32 skill_wall_check; // [Skotlex]
  429. int32 official_cell_stack_limit; // [Playtester]
  430. int32 custom_cell_stack_limit; // [Skotlex]
  431. int32 skill_caster_check; // [Skotlex]
  432. int32 sc_castcancel; // [Skotlex]
  433. int32 pc_sc_def_rate; // [Skotlex]
  434. int32 mob_sc_def_rate;
  435. int32 pc_max_sc_def;
  436. int32 mob_max_sc_def;
  437. int32 sg_angel_skill_ratio;
  438. int32 sg_miracle_skill_ratio;
  439. int32 sg_miracle_skill_duration;
  440. int32 autospell_stacking; //Enables autospell cards to stack. [Skotlex]
  441. int32 override_mob_names; //Enables overriding spawn mob names with the mob_db names. [Skotlex]
  442. int32 min_chat_delay; //Minimum time between client messages. [Skotlex]
  443. int32 friend_auto_add; //When accepting friends, both get friended. [Skotlex]
  444. int32 hvan_explosion_intimate; // fix [albator]
  445. int32 hom_rename;
  446. int32 homunculus_show_growth ; //[orn]
  447. int32 homunculus_friendly_rate;
  448. int32 quest_exp_rate;
  449. int32 autotrade_mapflag;
  450. int32 at_timeout;
  451. int32 homunculus_autoloot;
  452. int32 idle_no_autoloot;
  453. int32 max_guild_alliance;
  454. int32 ksprotection;
  455. int32 auction_feeperhour;
  456. int32 auction_maximumprice;
  457. int32 homunculus_auto_vapor; //Keep Homunculus from Vaporizing when master dies. [L0ne_W0lf]
  458. int32 display_status_timers; //Show or hide skill buff/delay timers in recent clients [Sara]
  459. int32 skill_add_heal_rate; //skills that bHealPower has effect on [Inkfish]
  460. int32 eq_single_target_reflectable;
  461. int32 invincible_nodamage;
  462. int32 mob_slave_keep_target;
  463. int32 autospell_check_range; //Enable range check for autospell bonus. [L0ne_W0lf]
  464. int32 knockback_left;
  465. int32 client_reshuffle_dice; // Reshuffle /dice
  466. int32 client_sort_storage;
  467. int32 feature_buying_store;
  468. int32 feature_search_stores;
  469. int32 searchstore_querydelay;
  470. int32 searchstore_maxresults;
  471. int32 display_party_name;
  472. int32 cashshop_show_points;
  473. int32 mail_show_status;
  474. int32 client_limit_unit_lv;
  475. int32 hom_max_level;
  476. int32 hom_S_max_level;
  477. int32 hom_S_growth_level;
  478. // [BattleGround Settings]
  479. int32 bg_update_interval;
  480. int32 bg_short_damage_rate;
  481. int32 bg_long_damage_rate;
  482. int32 bg_weapon_damage_rate;
  483. int32 bg_magic_damage_rate;
  484. int32 bg_misc_damage_rate;
  485. int32 bg_flee_penalty;
  486. // rAthena
  487. int32 max_third_parameter;
  488. int32 max_baby_third_parameter;
  489. int32 max_trans_parameter;
  490. int32 max_third_trans_parameter;
  491. int32 max_extended_parameter;
  492. int32 max_summoner_parameter;
  493. int32 max_fourth_parameter;
  494. int32 max_third_aspd;
  495. int32 max_summoner_aspd;
  496. int32 vcast_stat_scale;
  497. int32 mvp_tomb_enabled;
  498. int32 mvp_tomb_delay;
  499. int32 atcommand_suggestions_enabled;
  500. int32 min_npc_vendchat_distance;
  501. int32 atcommand_mobinfo_type;
  502. int32 mob_size_influence; // Enable modifications on earned experience, drop rates and monster status depending on monster size. [mkbu95]
  503. int32 skill_trap_type;
  504. int32 allow_consume_restricted_item;
  505. int32 allow_equip_restricted_item;
  506. int32 max_walk_path;
  507. int32 item_enabled_npc;
  508. int32 item_onfloor; // Whether to drop an undroppable item on the map or destroy it if inventory is full.
  509. int32 bowling_bash_area;
  510. int32 drop_rateincrease;
  511. int32 feature_auction;
  512. int32 feature_banking;
  513. int32 vip_storage_increase;
  514. int32 vip_base_exp_increase;
  515. int32 vip_job_exp_increase;
  516. int32 vip_zeny_penalty;
  517. int32 vip_bm_increase;
  518. int32 vip_drop_increase;
  519. int32 vip_gemstone;
  520. int32 vip_exp_penalty_base;
  521. int32 vip_exp_penalty_job;
  522. int32 vip_disp_rate;
  523. int32 mon_trans_disable_in_gvg;
  524. int32 discount_item_point_shop;
  525. int32 update_enemy_position;
  526. int32 devotion_rdamage;
  527. int32 feature_itemlink;
  528. int32 feature_mesitemlink;
  529. int32 feature_mesitemlink_brackets;
  530. int32 feature_mesitemlink_dbname;
  531. int32 feature_mesitemicon;
  532. int32 feature_mesitemicon_dbname;
  533. // autotrade persistency
  534. int32 feature_autotrade;
  535. int32 feature_autotrade_direction;
  536. int32 feature_autotrade_head_direction;
  537. int32 feature_autotrade_sit;
  538. int32 feature_autotrade_open_delay;
  539. // Fame points
  540. int32 fame_taekwon_mission;
  541. int32 fame_refine_lv1;
  542. int32 fame_refine_lv2;
  543. int32 fame_refine_lv3;
  544. int32 fame_forge;
  545. int32 fame_pharmacy_3;
  546. int32 fame_pharmacy_5;
  547. int32 fame_pharmacy_7;
  548. int32 fame_pharmacy_10;
  549. int32 disp_servervip_msg;
  550. int32 warg_can_falcon;
  551. int32 path_blown_halt;
  552. int32 rental_mount_speed_boost;
  553. int32 warp_suggestions_enabled;
  554. int32 taekwon_mission_mobname;
  555. int32 teleport_on_portal;
  556. int32 cart_revo_knockback;
  557. int32 guild_notice_changemap;
  558. int32 transcendent_status_points;
  559. int32 taekwon_ranker_min_lv;
  560. int32 revive_onwarp;
  561. int32 mail_delay;
  562. int32 autotrade_monsterignore;
  563. int32 idletime_option;
  564. int32 spawn_direction;
  565. int32 arrow_shower_knockback;
  566. int32 devotion_rdamage_skill_only;
  567. int32 max_extended_aspd;
  568. int32 mob_chase_refresh; //How often a monster should refresh its chase [Playtester]
  569. int32 mob_icewall_walk_block; //How a normal monster should be trapped in icewall [Playtester]
  570. int32 boss_icewall_walk_block; //How a boss monster should be trapped in icewall [Playtester]
  571. int32 snap_dodge; // Enable or disable dodging damage snapping away [csnv]
  572. int32 stormgust_knockback;
  573. int32 default_fixed_castrate;
  574. int32 default_bind_on_equip;
  575. int32 pet_ignore_infinite_def; // Makes fixed damage of petskillattack2 ignores infinite defense
  576. int32 homunculus_evo_intimacy_need;
  577. int32 homunculus_evo_intimacy_reset;
  578. int32 monster_loot_search_type;
  579. int32 feature_roulette;
  580. int32 feature_roulette_bonus_reward;
  581. int32 monster_hp_bars_info;
  582. int32 min_body_style;
  583. int32 max_body_style;
  584. int32 save_body_style;
  585. int32 mob_eye_range_bonus; //Vulture's Eye and Snake's Eye range bonus
  586. int32 mob_stuck_warning; //Show warning if a monster is stuck too long
  587. int32 skill_eightpath_algorithm; //Official path algorithm
  588. int32 skill_eightpath_same_cell;
  589. int32 death_penalty_maxlv;
  590. int32 exp_cost_redemptio;
  591. int32 exp_cost_redemptio_limit;
  592. int32 mvp_exp_reward_message;
  593. int32 can_damage_skill; //Which BL types can damage traps
  594. int32 atcommand_levelup_events;
  595. int32 atcommand_disable_npc;
  596. int32 block_account_in_same_party;
  597. int32 tarotcard_equal_chance; //Official or equal chance for each card
  598. int32 change_party_leader_samemap;
  599. int32 dispel_song; //Can songs be dispelled?
  600. int32 guild_maprespawn_clones; // Should clones be killed by maprespawnguildid?
  601. int32 hide_fav_sell;
  602. int32 mail_daily_count;
  603. int32 mail_zeny_fee;
  604. int32 mail_attachment_price;
  605. int32 mail_attachment_weight;
  606. int32 banana_bomb_duration;
  607. int32 guild_leaderchange_delay;
  608. int32 guild_leaderchange_woe;
  609. int32 guild_alliance_onlygm;
  610. int32 feature_achievement;
  611. int32 allow_bound_sell;
  612. int32 autoloot_adjust;
  613. int32 feature_petevolution;
  614. int32 feature_pet_autofeed;
  615. int32 feature_pet_autofeed_rate;
  616. int32 pet_autofeed_always;
  617. int32 broadcast_hide_name;
  618. int32 skill_drop_items_full;
  619. int32 switch_remove_edp;
  620. int32 feature_homunculus_autofeed;
  621. int32 feature_homunculus_autofeed_rate;
  622. int32 summoner_race;
  623. int32 summoner_size;
  624. int32 homunculus_autofeed_always;
  625. int32 feature_attendance;
  626. int32 feature_privateairship;
  627. int32 rental_transaction;
  628. int32 min_shop_buy;
  629. int32 min_shop_sell;
  630. int32 feature_equipswitch;
  631. int32 pet_walk_speed;
  632. int32 blacksmith_fame_refine_threshold;
  633. int32 mob_nopc_idleskill_rate;
  634. int32 mob_nopc_move_rate;
  635. int32 boss_nopc_idleskill_rate;
  636. int32 boss_nopc_move_rate;
  637. int32 hom_idle_no_share;
  638. int32 idletime_hom_option;
  639. int32 devotion_standup_fix;
  640. int32 feature_bgqueue;
  641. int32 bgqueue_nowarp_mapflag;
  642. int32 homunculus_exp_gain;
  643. int32 rental_item_novalue;
  644. int32 ping_timer_interval;
  645. int32 ping_time;
  646. int32 show_skill_scale;
  647. int32 achievement_mob_share;
  648. int32 slave_stick_with_master;
  649. int32 slave_active_with_master;
  650. int32 at_logout_event;
  651. int32 homunculus_starving_rate;
  652. int32 homunculus_starving_delay;
  653. int32 drop_connection_on_quit;
  654. int32 mob_spawn_variance;
  655. int32 mercenary_autoloot;
  656. int32 mer_idle_no_share;
  657. int32 idletime_mer_option;
  658. int32 feature_refineui;
  659. int32 rndopt_drop_pillar;
  660. int32 pet_legacy_formula;
  661. int32 pet_distance_check;
  662. int32 pet_hide_check;
  663. int32 instance_block_leave;
  664. int32 instance_block_leaderchange;
  665. int32 instance_block_invite;
  666. int32 instance_block_expulsion;
  667. // 4th Jobs Stuff
  668. int32 trait_points_job_change;
  669. int32 use_traitpoint_table;
  670. int32 max_trait_parameter;
  671. int32 max_res_mres_ignored;
  672. int32 max_ap;
  673. int32 ap_rate;
  674. int32 restart_ap_rate;
  675. int32 loose_ap_on_death;
  676. int32 loose_ap_on_map;
  677. int32 keep_ap_on_logout;
  678. int32 attack_machine_level_difference;
  679. int32 feature_barter;
  680. int32 feature_barter_extended;
  681. int32 break_mob_equip;
  682. int32 macro_detection_retry;
  683. int32 macro_detection_timeout;
  684. int32 macro_detection_punishment;
  685. int32 macro_detection_punishment_time;
  686. int32 macrochecker_delay;
  687. int32 feature_dynamicnpc_timeout;
  688. int32 feature_dynamicnpc_rangex;
  689. int32 feature_dynamicnpc_rangey;
  690. int32 feature_dynamicnpc_direction;
  691. int32 mob_respawn_time;
  692. int32 mob_unlock_time;
  693. int32 map_edge_size;
  694. int32 randomize_center_cell;
  695. int32 feature_stylist;
  696. int32 feature_banking_state_enforce;
  697. int32 instance_allow_reconnect;
  698. int32 synchronize_damage;
  699. int32 item_stacking;
  700. int32 hom_delay_reset_vaporize;
  701. int32 hom_delay_reset_warp;
  702. int32 loot_range;
  703. int32 assist_range;
  704. #include <custom/battle_config_struct.inc>
  705. };
  706. extern struct Battle_Config battle_config;
  707. void do_init_battle(void);
  708. void do_final_battle(void);
  709. extern int32 battle_config_read(const char *cfgName);
  710. extern void battle_set_defaults(void);
  711. int32 battle_set_value(const char* w1, const char* w2);
  712. int32 battle_get_value(const char* w1);
  713. //
  714. struct block_list* battle_getenemyarea(struct block_list *src, int32 x, int32 y, int32 range, int32 type, int32 ignore_id);
  715. /**
  716. * Royal Guard
  717. **/
  718. int32 battle_damage_area( struct block_list *bl, va_list ap);
  719. #endif /* BATTLE_HPP */