From 7b5d1e3d46e94262a9c0fd3a01ab4685aea9d12d Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 1 May 2021 15:10:54 -0400 Subject: Added bash completion, amongst others --- src/creature.h | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/creature.h') diff --git a/src/creature.h b/src/creature.h index c3ce5ae..e89978e 100644 --- a/src/creature.h +++ b/src/creature.h @@ -8,6 +8,8 @@ namespace entry { class Feature; class Item; + class Weapon; + class Attack; } typedef nlohmann::json json; @@ -20,7 +22,7 @@ namespace creature { dmgType(const json& data) : type(data["type"]), qualifiers(data["qualifiers"]) {} std::string type; std::vector qualifiers; - operator string() const { + std::string getText() const { if(qualifiers.empty()) { return type; } @@ -121,15 +123,9 @@ namespace creature { }; - // Convenience function to get any instances of T (subclass of Item) in the inventory - template std::vector> getItems(const Creature& c) { - std::vector> Ts; - for(auto item : c.getInventory()) { - std::shared_ptr t = dynamic_pointer_cast(item); - if(t) { - Ts.push_back(t); - } - } - return Ts; - } + // Helper function to get all attacks (weapons and pseudo-weapons included) + std::vector> getAttacks(const Creature& c); + + // Helper function to get the best ability for this creature (chooses arbitrarily in case of ties) + rules::Ability getBestAbility(const std::vector& abilities, const Creature& c); } -- cgit v1.2.3