summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/ranged_attack.h
blob: d9d6c6e483190cb0d74309c4c557c82eb4c3df5c (plain) (blame)
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
#ifndef RANGED_ATTACK_H
#define RANGED_ATTACK_H

#include "attack.h"

class ranged_attack : public attack
{
// Public Properties
public:
    int range_used;
    bool reflected;

// Public Methods
public:
    ranged_attack(actor *attacker, actor *defender, item_def *projectile,
                  bool teleport, actor *blame = 0);

    int calc_to_hit(bool random);

    // Applies attack damage and other effects.
    bool attack();

private:
    /* Attack Phases */
    bool handle_phase_attempted();
    bool handle_phase_blocked();
    bool handle_phase_dodged();
    bool handle_phase_hit();

    /* Combat Calculations */
    bool using_weapon();
    int weapon_damage();
    int calc_base_unarmed_damage();
    int calc_mon_to_hit_base();
    int apply_damage_modifiers(int damage, int damage_max, bool &half_ac);
    bool attack_ignores_shield(bool verbose);
    bool apply_damage_brand(const char *what = NULL);
    special_missile_type random_chaos_missile_brand();
    bool blowgun_check(special_missile_type type);
    int blowgun_duration_roll(special_missile_type type);
    bool apply_missile_brand();

    /* Weapon Effects */
    bool check_unrand_effects();

    /* Attack Effects */
    bool mons_attack_effects();
    void player_stab_check();
    int  player_stab_tier();

    /* Output */
    void adjust_noise();
    void set_attack_verb();
    void announce_hit();

private:
    const item_def *projectile;
    bool teleport;
    int orig_to_hit;
    bool should_alert_defender;
};

#endif