1 #pragma once 2 #ifndef CATA_SRC_SKILL_BOOST_H 3 #define CATA_SRC_SKILL_BOOST_H 4 5 #include <iosfwd> 6 #include <vector> 7 8 #include "optional.h" 9 #include "string_id.h" 10 11 class JsonObject; 12 template<typename T> 13 class generic_factory; 14 15 class skill_boost 16 { 17 public: 18 skill_boost() = default; 19 20 std::string stat() const; 21 const std::vector<std::string> &skills() const; 22 float calc_bonus( int skill_total ) const; 23 24 static void load_boost( const JsonObject &jo, const std::string &src ); 25 static void reset(); 26 27 static const std::vector<skill_boost> &get_all(); 28 static cata::optional<skill_boost> get( const std::string &stat_str ); 29 30 private: 31 friend class generic_factory<skill_boost>; 32 string_id<skill_boost> id; 33 bool was_loaded = false; 34 std::vector<std::string> _skills; 35 int _offset = 0; 36 float _power = 0.0f; 37 38 void load( const JsonObject &jo, const std::string &src ); 39 }; 40 41 #endif // CATA_SRC_SKILL_BOOST_H 42