File: potion.h

package info (click to toggle)
crawl 2%3A0.23.0-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 55,948 kB
  • sloc: cpp: 303,973; ansic: 28,797; python: 4,074; perl: 3,247; makefile: 1,632; java: 792; sh: 327; objc: 250; xml: 32; cs: 15; sed: 9; lisp: 3
file content (49 lines) | stat: -rw-r--r-- 1,535 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
/**
 * @file
 * @brief Potion and potion-like effects.
**/

#pragma once

#include "potion-type.h"

class PotionEffect
{
private:
    PotionEffect() = delete;
    DISALLOW_COPY_AND_ASSIGN(PotionEffect);
protected:
    PotionEffect(potion_type);
    bool check_known_quaff() const;
public:
    virtual bool can_quaff(string *reason = nullptr) const;

    /**
     * Elsewhere in the code there are things that can have the effect
     * effect of a potion without actually being potions, there
     * are even some legacy 'potions' around in this code that
     * nowadays only provide the potion-like effect.
     *
     * Doesn't currently handle conducts, but possibly it should.
     *
     * @param was_known     Whether the player should be held responsible.
     * @param pow           The 'power' of the effect. Mostly disused.
     * @param is_potion     Whether to apply the effects of MUT_NO_POTION_HEAL.
     * @return              Whether or not the potion had an effect.
     */
    virtual bool effect(bool was_known = true, int pow = 40,
                        bool is_potion = true) const = 0;

    // Quaff also handles god-conduct and potion-specific
    // uncancellability
    // Returns whether or not the potion was actually quaffed
    virtual bool quaff(bool was_known) const;

    const string potion_name;
    const potion_type kind;
};

const PotionEffect* get_potion_effect(potion_type pot);

bool quaff_potion(item_def &potion);
void potionlike_effect(potion_type effect, int pow, bool was_known = true);