From 444b08c72f03cad1529177e06e3d66bc008f44ed Mon Sep 17 00:00:00 2001 From: CaNaRdEoS Date: Mon, 14 Jul 2025 14:38:08 +0200 Subject: [PATCH] update enum, add ennemy_stats --- game/define.h | 95 +++++++++++++++++++--------- game/interface/combat_interface.cpp | 8 +-- game/interface/interfaces.cpp | 2 +- game/interface/ui_elements.cpp | 71 ++++++++++++++++----- game/interface/ui_elements.h | 15 +++-- game/logic/combat.cpp | 5 +- game/logic/ennemy.cpp | 2 +- game/logic/player.cpp | 1 - game/logic/spells.cpp | 15 ++--- game/logic/spells.h | 2 +- game/logic/structs.h | 27 -------- game/main | Bin 217832 -> 0 bytes game/main.cpp | 12 ++-- game/release | Bin 196632 -> 238440 bytes 14 files changed, 155 insertions(+), 100 deletions(-) delete mode 100644 game/logic/structs.h delete mode 100755 game/main diff --git a/game/define.h b/game/define.h index 28a6d5d..d384ba4 100644 --- a/game/define.h +++ b/game/define.h @@ -1,42 +1,77 @@ -//Jobs -constexpr const int MAGE = 0; -constexpr const int ALCHIMIST = 1; -constexpr const int WARRIOR = 2; -constexpr const int ENGINEER = 3; -constexpr const int ARCHER = 4; -constexpr const int TAMER = 5; +enum Jobs { + MAGE = 0, + ALCHIMIST = 1, + WARRIOR = 2, + ENGINEER = 3, + ARCHER = 4, + TAMER = 5 +}; -//Elements -constexpr const int FIRE = 0; -constexpr const int AIR = 1; -constexpr const int WATER = 2; -constexpr const int EARTH = 3; -constexpr const int EATHER = 4; +enum Elements { + FIRE = 0, + AIR = 1, + WATER = 2, + EARTH = 3, + EATHER = 4 +}; -//Stats -constexpr const int HEALTH = 0; -constexpr const int SHIELD = 1; -constexpr const int SPEED = 2; -constexpr const int MANA = 3; -constexpr const int ENERGY = 4; -constexpr const int TAME = 5; -constexpr const int XP = 6; +enum Stats { + HEALTH, + SHIELD, + SPEED, + MANA, + ENERGY, + TAME, + XP +}; -// Combinaisons +enum Button_types { + BUTTON_BASIC, + BUTTON_INACTIVE, + BUTTON_DANGER +}; + +enum Button_sizes { + BUTTON_SMALL, + BUTTON_MEDIUM, + BUTTON_BIG +}; + +//Combinaisons constexpr const int UP = 0; constexpr const int RIGHT = 1; constexpr const int DOWN = 2; constexpr const int LEFT = 3; constexpr const int END_SPELL = 9; -//Buttons style -constexpr int BUTTON_BASIC = 0; -constexpr int BUTTON_INACTIVE = 1; -constexpr int BUTTON_DANGER = 2; -//Buttons size -constexpr const int BUTTON_SMALL = 0; -constexpr const int BUTTON_MEDIUM = 1; -constexpr const int BUTTON_BIG = 2; +struct Spell { + std::string name; + int damage; + int cost_health, cost_mana; + float precision; + bool zone; + std::vector elements; + std::vector combinaison; +}; + +struct Ennemy { + std::string name; + int xp; + int health, shield, speed, tame; + int max_health, max_shield, max_speed, max_tame; + float escape, menace; //Menace comlpexifies the escape, the higher the value is, the less menace it is + std::vector spells; +}; + +struct Player { + std::string name; + Jobs job; + int xp; + int health, shield, speed, mana, energy; + int max_health, max_shield, max_speed, max_mana, max_energy; + float escape, menace; + std::vector spell_book; +}; \ No newline at end of file diff --git a/game/interface/combat_interface.cpp b/game/interface/combat_interface.cpp index 4345a73..d547d3d 100644 --- a/game/interface/combat_interface.cpp +++ b/game/interface/combat_interface.cpp @@ -3,19 +3,19 @@ #include #include #include "../define.h" -#include "../logic/structs.h" #include "../logic/player.h" #include "ui_elements.h" #include "combat_interface.h" void display_combat_interface(Player& player_arg, std::vector& ennemies_arg, const std::vector& screen_arg) { + + Ennemy ennemy = ennemies_arg[0]; std::vector position = {0.5f, 0.5f}; - Bar player_health = create_bar(HEALTH, player_arg.max_health, player_arg.health, position, screen_arg); - inc_health(player_arg, -5);* + Ennemy_stats first_ennemy_stats = create_ennemy_stats(ennemy, position, screen_arg); //Dessin BeginDrawing(); ClearBackground(BLACK); - draw_bar(player_health); + draw_ennemy_stats(first_ennemy_stats); EndDrawing(); } \ No newline at end of file diff --git a/game/interface/interfaces.cpp b/game/interface/interfaces.cpp index 47b2d9f..cbff7ba 100644 --- a/game/interface/interfaces.cpp +++ b/game/interface/interfaces.cpp @@ -1,6 +1,6 @@ #include #include -#include "../logic/structs.h" +#include "../define.h" #include "../logic/player.h" #include "../logic/ennemy.h" #include "interfaces.h" diff --git a/game/interface/ui_elements.cpp b/game/interface/ui_elements.cpp index ec4100f..07aac63 100644 --- a/game/interface/ui_elements.cpp +++ b/game/interface/ui_elements.cpp @@ -2,11 +2,10 @@ #include #include #include -#include "../logic/structs.h" #include "../define.h" #include "ui_elements.h" -Button create_button(int type_arg, int size_arg, const std::vector& position_arg, std::string text_arg, const std::vector& screen_arg) { +Button create_button(Button_types type_arg, Button_sizes size_arg, const std::vector& position_arg, std::string text_arg, const std::vector& screen_arg) { std::vector size = button_size(size_arg, screen_arg); float position_x = screen_arg[0] * position_arg[0] - size[0] / 2; float position_y = screen_arg[1] * position_arg[1] - size[1] / 2; @@ -52,11 +51,11 @@ Button create_button(int type_arg, int size_arg, const std::vector& posit void draw_buttons(const std::vector