File: randbook.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 (66 lines) | stat: -rw-r--r-- 2,651 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
/**
 * @file
 * @brief Functions for generating random spellbooks.
**/

#pragma once

#include <functional>
#include <vector>

#include "spl-util.h"

using std::vector;

typedef function<bool(spschool discipline_1,
                      spschool discipline_2,
                      int agent,
                      const vector<spell_type> &prev,
                      spell_type spell)> themed_spell_filter;

/// How many spells should be in a random theme book?
int theme_book_size();

spschool random_book_theme();
spschool matching_book_theme(const vector<spell_type> &forced_spells);
function<spschool()> forced_book_theme(spschool theme);

bool basic_themed_spell_filter(spschool discipline_1,
                               spschool discipline_2,
                               int agent,
                               const vector<spell_type> &prev,
                               spell_type spell);
themed_spell_filter capped_spell_filter(int max_levels,
                                        themed_spell_filter subfilter
                                            = basic_themed_spell_filter);
themed_spell_filter forced_spell_filter(const vector<spell_type> &forced_spells,
                                        themed_spell_filter subfilter
                                            = basic_themed_spell_filter);

void theme_book_spells(spschool discipline_1,
                       spschool discipline_2,
                       themed_spell_filter filter,
                       int agent,
                       int num_spells,
                       vector<spell_type> &spells);

void build_themed_book(item_def &book,
                       themed_spell_filter filter = basic_themed_spell_filter,
                       function<spschool()> get_discipline
                            = random_book_theme,
                       int num_spells = -1,
                       string owner = "", string subject = "");

void fixup_randbook_disciplines(spschool &discipline_1,
                                spschool &discipline_2,
                                const vector<spell_type> &spells);
void init_book_theme_randart(item_def &book, vector<spell_type> spells);
void name_book_theme_randart(item_def &book, spschool discipline_1,
                             spschool discipline_2,
                             string owner = "", string subject = "");

bool make_book_level_randart(item_def &book, int level = -1, bool sif = false);
void acquire_themed_randbook(item_def &book, int agent);

/* Public for testing purposes only: do not use elsewhere */
void _set_book_spell_list(item_def &book, vector<spell_type> spells);