#ifndef COMMON_H #define COMMON_H #include "settings.h" // Tile types typedef enum { TILE_WALL, TILE_FLOOR, TILE_STAIRS } TileType; // Status effect types typedef enum { EFFECT_NONE, EFFECT_POISON, EFFECT_STUN, EFFECT_BLEED, EFFECT_WEAKEN, EFFECT_BURN } StatusEffectType; // Damage classes typedef enum { DMG_SLASH, DMG_IMPACT, DMG_PIERCE, DMG_FIRE, DMG_POISON } DamageClass; // Status effect instance typedef struct { StatusEffectType type; int duration; // turns remaining int intensity; // damage per tick or stat reduction amount } StatusEffect; // Room typedef struct { int x, y, w, h; } Room; // Map typedef struct { TileType tiles[MAP_HEIGHT][MAP_WIDTH]; Room rooms[MAX_ROOMS]; int room_count; } Map; // Dungeon typedef struct { int current_floor; Room rooms[MAX_ROOMS]; int room_count; } Dungeon; // Item types typedef enum { ITEM_POTION, ITEM_WEAPON, ITEM_ARMOR } ItemType; // Item typedef struct { int x, y; ItemType type; int power; int floor; int picked_up; DamageClass dmg_class; int crit_chance; int crit_multiplier; int status_chance; } Item; // Player typedef struct { int x, y; int hp, max_hp; int attack; int defense; int floor; int step_count; int speed; // actions per 100 ticks (100 = 1 action per turn) int cooldown; // countdown to next action (0 = can act) int dodge; // dodge chance percentage int block; // flat damage reduction on successful block roll Item equipped_weapon; int has_weapon; Item equipped_armor; int has_armor; Item inventory[MAX_INVENTORY]; int inventory_count; // status effects StatusEffect effects[MAX_EFFECTS]; int effect_count; } Player; // Enemy types typedef enum { ENEMY_GOBLIN, ENEMY_SKELETON, ENEMY_ORC } EnemyType; // Enemy typedef struct { int x, y; int hp; int max_hp; int attack; int alive; EnemyType type; int speed; // actions per 100 ticks int cooldown; // countdown to next action int dodge; // dodge chance percentage int block; // flat damage reduction int resistance[NUM_DMG_CLASSES]; DamageClass dmg_class; int status_chance; int crit_chance; // crit chance percentage (0-100) int crit_mult; // crit damage multiplier percentage (e.g. 150 = 1.5x) // status effects StatusEffect effects[MAX_EFFECTS]; int effect_count; } Enemy; // Floating damage text typedef struct { int x, y; int value; int lifetime; // frames remaining int is_critical; char label[8]; // non-empty -> show label instead of numeric value StatusEffectType effect_type; // used to pick color for proc labels } FloatingText; // GameState - encapsulates all game state for testability and save/load typedef struct { Player player; Map map; Dungeon dungeon; Enemy enemies[MAX_ENEMIES]; int enemy_count; Item items[MAX_ITEMS]; int item_count; int game_over; int game_won; const char *last_message; int message_timer; int turn_count; int awaiting_descend; // 0 = normal, 1 = waiting for Y/N int show_inventory; // 0 = hidden, 1 = show overlay int inv_selected; // currently selected inventory index // action log char action_log[5][128]; int log_count; int log_head; // visual effects FloatingText floating_texts[8]; int floating_count; int screen_shake; // frames of screen shake remaining int shake_x; int shake_y; } GameState; #endif // COMMON_H