File: ghost.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 (122 lines) | stat: -rw-r--r-- 2,983 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
 * @file
 * @brief Player ghost and random Pandemonium demon handling.
**/

#pragma once

#include <vector>

#include "enchant-type.h"
#include "enum.h"
#include "god-type.h"
#include "item-prop-enum.h"
#include "job-type.h"
#include "mon-enum.h"
#include "mutant-beast.h"
#include "species-type.h"

using std::vector;

#define MIRRORED_GHOST_KEY "mirrored_ghost"

// Keys for mgen_data to create the right type of apostle
#define APOSTLE_TYPE_KEY "apostle_type"
#define APOSTLE_POWER_KEY "apostle_power"
#define APOSTLE_BAND_POWER_KEY "apostle_band_power"

#define MAX_GHOST_EVASION    50

enum apostle_type
{
    // Basic generation types
    APOSTLE_WARRIOR,
    APOSTLE_WIZARD,
    APOSTLE_PRIEST,

    // Sub-types (not directly chosen for generation)

    // End
    NUM_APOSTLE_TYPES,
};

const string apostle_type_names[] =
{
    "warrior",
    "wizard",
    "priest",
};
COMPILE_CHECK(ARRAYSZ(apostle_type_names) == NUM_APOSTLE_TYPES);

int apostle_type_by_name(const string name);

class ghost_demon
{
public:
    string name;

    species_type species;
    job_type job;
    god_type religion;
    skill_type best_skill;
    short best_skill_level;
    short xl;

    short max_hp, ev, ac, willpower, damage, speed, move_energy;
    bool see_invis, flies;
    brand_type brand;
    attack_type att_type;
    attack_flavour att_flav;
    resists_t resists;
    enchant_type cloud_ring_ench;
    int umbra_rad;
    string title;

    colour_t colour;

    monster_spells spells;

public:
    ghost_demon();
    bool has_spells() const;
    void reset();
    void barebones_init();
    void init_pandemonium_lord(bool friendly = false);
    void init_player_ghost();
    void init_ugly_thing(bool very_ugly, bool only_mutate = false,
                         colour_t force_colour = BLACK);
    void init_dancing_weapon(const item_def& weapon, int power);
    void init_spectral_weapon(const item_def& weapon);
    void init_orc_apostle(apostle_type type, int pow);

    void ugly_thing_to_very_ugly_thing();

    void init_inugami_from_player(int power);

    void init_platinum_paragon(int power);


public:
    static const vector<ghost_demon> find_ghosts(bool include_player=true);
    static bool ghost_eligible();


private:
    static void find_extra_ghosts(vector<ghost_demon> &ghosts);
    static void find_transiting_ghosts(vector<ghost_demon> &gs);
    static void announce_ghost(const ghost_demon &g);

private:
    void add_spells();
    spell_type translate_spell(spell_type playerspell) const;
    void ugly_thing_add_resistance(bool very_ugly,
                                   attack_flavour u_att_flav);
    void set_pan_lord_special_attack();
    void set_pan_lord_cloud_ring();
    void pick_apostle_spells(apostle_type type, int pow);
};

bool debug_check_ghosts(vector<ghost_demon> &ghosts, string &err);
bool debug_check_ghost(const ghost_demon &ghost, string &err);
int ghost_level_to_rank(const int xl);
int ghost_rank_to_level(const int rank);