From bb16c32bde58cba70e4877aa2d3ebd04332eb575 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Tue, 4 Jan 2022 13:35:02 +0100 Subject: linux compile and imgs --- game/gst.h | 248 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 124 insertions(+), 124 deletions(-) (limited to 'game/gst.h') diff --git a/game/gst.h b/game/gst.h index 376026e..8ade237 100644 --- a/game/gst.h +++ b/game/gst.h @@ -1,125 +1,125 @@ -#ifndef GST_H -#define GST_H - -#include -#include -#include -#include -#include - -#include // just for picking market trains - -#include "ground.h" -#include "entity.h" -#include "tile.h" -#include "player.h" -#include "tech.h" - -class Ability { - public: - Ability(std::string name) : name(name) {} - std::string name; -}; - -class Bonus { - public: - Bonus(float amt, int id, bool atk) : amt(amt), id(id), atk(atk) {} - float amt; int id; bool atk; - enum Id { ground, type, ability, tech, veteran, on_bld, adjacency }; - std::string id_string () { - switch (id) { - case ground: return "Ground"; - case type: return "Class"; - case ability: return "Ability"; - case tech: return "Tech"; - case veteran: return "Veteran"; - case on_bld: return "On Building"; - case adjacency: return "Adjacency"; - } - } -}; - -class BattleResult { - public: - BattleResult(float atk_hp, float def_hp) - : atk_hp(atk_hp), def_hp(def_hp) {} - float atk_hp, def_hp; -}; - -class Inv { - public: - Inv () {} - - std::vector techs; - std::vector abilities; - std::vector infos; - std::vector tiles; - Ground ground; - - Tech* get_tech (int id); - EntityInfo* get_info (std::string name); - EntityInfo* get_info (int id); - bool info_has_ability (EntityInfo* info, std::string name); - - std::default_random_engine engine = std::default_random_engine{}; -}; - -class Gst { - public: - Gst(Inv *inv) : inv(inv) { } - - // copy constructor - Gst (const Gst& rhs) { - inv = rhs.inv; entities = rhs.entities; players = rhs.players; - turn = rhs.turn; day = rhs.day; - } - Gst& operator=(const Gst& rhs) { - inv = rhs.inv; entities = rhs.entities; players = rhs.players; - turn = rhs.turn; day = rhs.day; - }; - - Inv *inv; - - std::vector entities; - std::vector players; - int turn { 0 }; - int day { 0 }; - - Player& get_player (int id); - - Entity& get_at (int x, int y); - std::vector get_cost (EntityInfo *info, Player &player); - float get_trade_rate (Player &player); - - int get_vet_level (Entity &ent); - float get_type_bonus (Entity &atk, Entity &def); - std::vector get_bonuses (Entity &atk, Entity &def); - float get_damage (Entity &atk, Entity &def); - float get_damage (Entity &atk, Entity &def, float atk_hp); - bool get_first_strike (Entity &atk, Entity &def); - BattleResult battle_res (Entity &atk, Entity &def); - void clear_dead(); - int get_range(Entity &ent); - - void battle (Entity &atk, Entity &def); - - void heal (Entity &atk, Entity &def); - void convert (Entity &atk, Entity &def); - - int get_nearest_enemy (Entity &ent, int &mindist); - - std::vector get_possible_trains (Entity &ent); - std::vector get_possible_builds (Entity &ent); - - bool check_req_build (Entity &ent, EntityInfo *info); - bool check_req_tech (Tech *tech, Player &player); - bool check_req_level (Player &player); - bool check_obstructed (Entity &ent); - - void end_day (); - void level_upgrade (Player &player); - - void update_tech_lookup (Player &player); -}; - +#ifndef GST_H +#define GST_H + +#include +#include +#include +#include +#include + +#include // just for picking market trains + +#include "ground.h" +#include "entity.h" +#include "tile.h" +#include "player.h" +#include "tech.h" + +class Ability { + public: + Ability(std::string name) : name(name) {} + std::string name; +}; + +class Bonus { + public: + Bonus(float amt, int id, bool atk) : amt(amt), id(id), atk(atk) {} + float amt; int id; bool atk; + enum Id { ground, type, ability, tech, veteran, on_bld, adjacency }; + std::string id_string () { + switch (id) { + case ground: return "Ground"; + case type: return "Class"; + case ability: return "Ability"; + case tech: return "Tech"; + case veteran: return "Veteran"; + case on_bld: return "On Building"; + case adjacency: return "Adjacency"; + } + } +}; + +class BattleResult { + public: + BattleResult(float atk_hp, float def_hp) + : atk_hp(atk_hp), def_hp(def_hp) {} + float atk_hp, def_hp; +}; + +class Inv { + public: + Inv () {} + + std::vector techs; + std::vector abilities; + std::vector infos; + std::vector tiles; + Ground ground; + + Tech* get_tech (int id); + EntityInfo* get_info (std::string name); + EntityInfo* get_info (int id); + bool info_has_ability (EntityInfo* info, std::string name); + + std::default_random_engine engine = std::default_random_engine{}; +}; + +class Gst { + public: + Gst(Inv *inv) : inv(inv) { } + + // copy constructor + Gst (const Gst& rhs) { + inv = rhs.inv; entities = rhs.entities; players = rhs.players; + turn = rhs.turn; day = rhs.day; + } + Gst& operator=(const Gst& rhs) { + inv = rhs.inv; entities = rhs.entities; players = rhs.players; + turn = rhs.turn; day = rhs.day; + }; + + Inv *inv; + + std::vector entities; + std::vector players; + int turn { 0 }; + int day { 0 }; + + Player& get_player (int id); + + Entity& get_at (int x, int y); + std::vector get_cost (EntityInfo *info, Player &player); + float get_trade_rate (Player &player); + + int get_vet_level (Entity &ent); + float get_type_bonus (Entity &atk, Entity &def); + std::vector get_bonuses (Entity &atk, Entity &def); + float get_damage (Entity &atk, Entity &def); + float get_damage (Entity &atk, Entity &def, float atk_hp); + bool get_first_strike (Entity &atk, Entity &def); + BattleResult battle_res (Entity &atk, Entity &def); + void clear_dead(); + int get_range(Entity &ent); + + void battle (Entity &atk, Entity &def); + + void heal (Entity &atk, Entity &def); + void convert (Entity &atk, Entity &def); + + int get_nearest_enemy (Entity &ent, int &mindist); + + std::vector get_possible_trains (Entity &ent); + std::vector get_possible_builds (Entity &ent); + + bool check_req_build (Entity &ent, EntityInfo *info); + bool check_req_tech (Tech *tech, Player &player); + bool check_req_level (Player &player); + bool check_obstructed (Entity &ent); + + void end_day (); + void level_upgrade (Player &player); + + void update_tech_lookup (Player &player); +}; + #endif \ No newline at end of file -- cgit v1.2.3-54-g00ecf