dao::abilities::Use

struct

Whether a creature can use an ability now, and if not, why not.

if (const auto use = dao::abilities::CanUse(jory, ability); use && !*use)
    spdlog::info("not now: {}", dao::Utf8(use->Reason())); // "Insufficient stamina"

Declared in dao/Abilities.h.

Functions

operator bool()

operator bool() const

Returns usable.

Reason()

std::wstring Reason() const

Returns the reason in the player’s language, for example “Insufficient stamina”, or an empty string if no reason was given.

Fields

Field Type  
reason std::int32_t = -1 why not, as a talk table string id; -1 if usable or no reason given
usable bool = false