summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-pick.cc
blob: 698018ebd329462e6617abec55a53dc315c2b677 (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
/**
 * @file
 * @brief Functions for picking from lists of spells.
**/

#include "AppHdr.h"

#include "spl-pick.h"

spell_type spell_picker::pick_with_veto(const spell_entry *weights,
                                        int level, spell_type none,
                                        spell_pick_vetoer vetoer)
{
    veto_func = vetoer;
    return pick(weights, level, none);
}

// Veto specialisation for the spell_picker class; this simply calls the
// stored veto function. Can subclass further for more complex veto behaviour.
bool spell_picker::veto(spell_type mon)
{
    return veto_func && veto_func(mon);
}