1 /**
2  * @file
3  * @brief Functions used during combat.
4 **/
5 
6 #pragma once
7 
8 #include <list>
9 #include <functional>
10 
11 #include "target.h"
12 #include "wu-jian-attack-type.h"
13 
14 enum stab_type
15 {
16     STAB_NO_STAB,                    //    0
17     STAB_DISTRACTED,
18     STAB_CONFUSED,
19     STAB_FLEEING,
20     STAB_INVISIBLE,
21     STAB_HELD_IN_NET,
22     STAB_PETRIFYING,
23     STAB_PETRIFIED,
24     STAB_PARALYSED,
25     STAB_SLEEPING,
26     STAB_ALLY,
27     NUM_STABS
28 };
29 
30 bool fight_melee(actor *attacker, actor *defender, bool *did_hit = nullptr,
31                  bool simu = false);
32 
33 int resist_adjust_damage(const actor *defender, beam_type flavour,
34                          int rawdamage);
35 
36 int apply_chunked_AC(int dam, int ac);
37 
38 int melee_confuse_chance(int HD);
39 
40 bool wielded_weapon_check(const item_def *weapon, string attack_verb="");
41 
42 stab_type find_stab_type(const actor *attacker,
43                          const actor &defender,
44                          bool actual = true);
45 
46 int stab_bonus_denom(stab_type stab);
47 
48 bool force_player_cleave(coord_def target);
49 bool attack_cleaves(const actor &attacker, int which_attack = -1);
50 void get_cleave_targets(const actor &attacker, const coord_def& def,
51                         list<actor*> &targets, int which_attack = -1);
52 void attack_cleave_targets(actor &attacker, list<actor*> &targets,
53                            int attack_number = 0,
54                            int effective_attack_number = 0,
55                            wu_jian_attack_type wu_jian_attack
56                                = WU_JIAN_ATTACK_NONE,
57                            bool is_projected = false);
58 
59 class attack;
60 int to_hit_pct(const monster_info& mi, attack &atk, bool melee);
61 int mon_to_hit_base(int hd, bool skilled, bool ranged);
62 int mon_to_hit_pct(int to_land, int ev);
63 int mon_shield_bypass(int hd);
64 int mon_beat_sh_pct(int shield_bypass, int shield_class);
65 
66 int weapon_min_delay_skill(const item_def &weapon);
67 int weapon_min_delay(const item_def &weapon, bool check_speed = true);
68 
69 int mons_weapon_damage_rating(const item_def &launcher);
70 int mons_missile_damage(monster* mons, const item_def *launch,
71                         const item_def *missile);
72 int mons_usable_missile(monster* mons, item_def **launcher);
73 
74 bool bad_attack(const monster *mon, string& adj, string& suffix,
75                 bool& would_cause_penance,
76                 coord_def attack_pos = coord_def(0, 0));
77 
78 bool stop_attack_prompt(const monster* mon, bool beam_attack,
79                         coord_def beam_target, bool *prompted = nullptr,
80                         coord_def attack_pos = coord_def(0, 0));
81 
82 bool stop_attack_prompt(targeter &hitfunc, const char* verb,
83                         function<bool(const actor *victim)> affects = nullptr,
84                         bool *prompted = nullptr,
85                         const monster *mons = nullptr);
86 
87 string rude_stop_summoning_reason();
88 bool rude_stop_summoning_prompt(string verb = "summon");
89 
90 bool can_reach_attack_between(coord_def source, coord_def target);
91