forked from NotAShelf/rogged
combat: rewrite in Zig; add basic damage types and weapon archetypes
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic8055a1cf6bdad1aca13673ea171b4b46a6a6964
This commit is contained in:
parent
7af642612b
commit
22ab6fc6eb
15 changed files with 802 additions and 158 deletions
33
src/common.h
33
src/common.h
|
|
@ -6,6 +6,19 @@
|
|||
// 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;
|
||||
|
|
@ -35,6 +48,10 @@ typedef struct {
|
|||
int power;
|
||||
int floor;
|
||||
int picked_up;
|
||||
DamageClass dmg_class;
|
||||
int crit_chance;
|
||||
int crit_multiplier;
|
||||
int status_chance;
|
||||
} Item;
|
||||
|
||||
// Player
|
||||
|
|
@ -47,15 +64,17 @@ typedef struct {
|
|||
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;
|
||||
// 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)
|
||||
// status effects
|
||||
StatusEffect effects[MAX_EFFECTS];
|
||||
int effect_count;
|
||||
} Player;
|
||||
|
||||
// Enemy types
|
||||
|
|
@ -71,6 +90,14 @@ typedef struct {
|
|||
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;
|
||||
// status effects
|
||||
StatusEffect effects[MAX_EFFECTS];
|
||||
int effect_count;
|
||||
} Enemy;
|
||||
|
||||
// Floating damage text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue