forked from NotAShelf/rogged
various: add speed/cooldown & initiative system
- Goblins act every ~2 turns, skeletons ~1.5, orcs ~1.2 - Enemies accumulate cooldown based on speed, act when <= 0 - Player always acts every turn (speed = 100)" Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Id822579a0326887d91a80bd4ab27a72d6a6a6964
This commit is contained in:
parent
8f6650919d
commit
db21bdacdd
4 changed files with 185 additions and 41 deletions
11
src/common.h
11
src/common.h
|
|
@ -45,6 +45,12 @@ typedef struct {
|
|||
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)
|
||||
Item equipped_weapon;
|
||||
int has_weapon;
|
||||
Item equipped_armor;
|
||||
int has_armor;
|
||||
Item inventory[MAX_INVENTORY];
|
||||
int inventory_count;
|
||||
} Player;
|
||||
|
|
@ -60,6 +66,8 @@ typedef struct {
|
|||
int attack;
|
||||
int alive;
|
||||
EnemyType type;
|
||||
int speed; // actions per 100 ticks
|
||||
int cooldown; // countdown to next action
|
||||
} Enemy;
|
||||
|
||||
// GameState - encapsulates all game state for testability and save/load
|
||||
|
|
@ -76,6 +84,9 @@ typedef struct {
|
|||
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
|
||||
} GameState;
|
||||
|
||||
#endif // COMMON_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue