File: throw.h

package info (click to toggle)
crawl 2%3A0.34.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 100,188 kB
  • sloc: cpp: 363,709; ansic: 27,765; javascript: 9,516; python: 8,463; perl: 3,293; java: 3,132; xml: 2,380; makefile: 1,835; sh: 611; objc: 250; cs: 15; sed: 9; lisp: 3
file content (62 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download | duplicates (2)
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
/**
 * @file
 * @brief Throwing and launching stuff.
**/

#pragma once

#include <string>

#include "enum.h"
#include "quiver.h"
#include "ranged-attack.h"

// TODO: this whole thing is a mess
enum fire_type
{
    FIRE_NONE      = 0x0000,
    FIRE_DART      = 0x0001,
    FIRE_STONE     = 0x0002,
    FIRE_JAVELIN   = 0x0004,
    FIRE_ROCK      = 0x0008,
    FIRE_NET       = 0x0010,
    FIRE_BOOMERANG = 0x0020,
    FIRE_THROWING  = FIRE_DART | FIRE_STONE | FIRE_JAVELIN | FIRE_ROCK
                               | FIRE_NET | FIRE_BOOMERANG,
    FIRE_LAUNCHER  = 0x0040,
    FIRE_INSCRIBED = 0x1000,   // Only used for _get_fire_order
    FIRE_SPELL     = 0x2000, // TODO: more fine-grained
    FIRE_EVOKABLE  = 0x4000,
    FIRE_ABILITY   = 0x8000
};

struct bolt;
class dist;

// A simple wrapper around the beams used to fire ranged attacks.
struct ranged_attack_beam
{
    bolt beam;
    ranged_attack atk;

    ranged_attack_beam(actor& agent, item_def& item);
    ranged_attack_beam(actor& agent, item_def& item, bolt& beam);

    void fire();

private:
    void initialise_beam(actor &agent, item_def &item);
};

bool is_penetrating_attack(const item_def& weapon);
bool fire_warn_if_impossible(bool silent, item_def *weapon);
shared_ptr<quiver::action> get_ammo_to_shoot(int item, dist &target, bool teleport = false);
void untargeted_fire(quiver::action &a);
void fire_item_no_quiver(dist *target=nullptr);

void aim_player_ranged_attack(quiver::action &a);
bool do_player_ranged_attack(const coord_def& targ, item_def* thrown_projectile = nullptr,
                             bool auto_abort = false);

bool mons_throw(monster* mons, ranged_attack_beam& beam, bool teleport = false,
                bool was_redirected = false);