forked from NotAShelf/rogged
combat: add hit chance & damage variance to make combat more engaging
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ia1e0a503dba03e5df7b863b97db962e36a6a6964
This commit is contained in:
parent
fdc0657237
commit
9cbbb9636f
5 changed files with 140 additions and 28 deletions
21
src/common.h
21
src/common.h
|
|
@ -53,6 +53,9 @@ typedef struct {
|
|||
int has_armor;
|
||||
Item inventory[MAX_INVENTORY];
|
||||
int inventory_count;
|
||||
// damage variance range (0.8 to 1.2 = 80 to 120)
|
||||
int dmg_variance_min; // minimum damage multiplier (80 = 0.8x)
|
||||
int dmg_variance_max; // maximum damage multiplier (120 = 1.2x)
|
||||
} Player;
|
||||
|
||||
// Enemy types
|
||||
|
|
@ -70,6 +73,14 @@ typedef struct {
|
|||
int cooldown; // countdown to next action
|
||||
} Enemy;
|
||||
|
||||
// Floating damage text
|
||||
typedef struct {
|
||||
int x, y;
|
||||
int value;
|
||||
int lifetime; // frames remaining
|
||||
int is_critical;
|
||||
} FloatingText;
|
||||
|
||||
// GameState - encapsulates all game state for testability and save/load
|
||||
typedef struct {
|
||||
Player player;
|
||||
|
|
@ -87,6 +98,16 @@ typedef struct {
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue