#ifndef COMMON_H #define COMMON_H #include "settings.h" #include typedef struct { int x, y; } Vec2; // 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; unsigned char visible[MAP_HEIGHT][MAP_WIDTH]; unsigned char remembered[MAP_HEIGHT][MAP_WIDTH]; } 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 { Vec2 position; 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 { Vec2 position; 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) // vision int vision_range; int alert; // 1 = aware of player, searching int last_known_x; // last position where enemy saw player int last_known_y; // status effects StatusEffect effects[MAX_EFFECTS]; int effect_count; } Enemy; // Floating damage text typedef enum { LABEL_NONE = 0, LABEL_DODGE, LABEL_BLOCK, LABEL_CRIT, LABEL_SLAIN, LABEL_PROC } FloatingLabel; typedef struct { int x, y; int value; int lifetime; // frames remaining int is_critical; FloatingLabel label; // label type instead of string StatusEffectType effect_type; // used to pick color for proc labels } FloatingText; // AudioAssets typedef struct { Sound attack1, attack2, attack3; Sound pickup; Sound staircase; Sound dodge1, dodge2, dodge3; Sound crit; } AudioAssets; // 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; AudioAssets sounds; // Statistics int total_kills; int items_collected; int damage_dealt; int damage_taken; int crits_landed; int times_hit; int potions_used; int floors_reached; int final_score; // Seed for this run unsigned int run_seed; } GameState; #endif // COMMON_H