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);
|