dev: migrate combat system & basic build execution to Zig #4

Merged
NotAShelf merged 9 commits from notashelf/push-nrzuupynktom into main 2026-04-05 21:14:12 +00:00
Owner

I've moved the combat code from a simple C function into a proper Zig library in libs/combat. Unlike the old implementation, this is significantly more robust and introduces
new concepts such as damage types , dodge, block, and status effects. Some of those concepts are borrowed from Warframe :)

Previously the combat system it just rolled hit chance, applied variance, and checked for a crit. Everything now works the way you'd expect from a roguelike. Attacks now go
through dodge -> resistance -> block before actually damaging the target. Consequently, each weapon carries a damage class that determines which status effect it procs on
hit. The five damage classes (Slash, Impact, Pierce, Fire, Poison) each map to a different effect: Bleed, Stun, Weaken, Burn, and Poison respectively. Effects tick at the start of
each turn. Poison and burn deal damage over time, bleed stacks, stun skips the turn, and weaken reduces attack. Dodge and block, however, are independent rolls. Dodge is a
flat chance on the attacker's side; block rolls at 30% when the defender has block > 0 and reduces damage by the block amount before it's applied.

Weapon templates (in common.h) now carry dmg_class, crit_chance, crit_multiplier, and status_chance, so different weapons feel different to wield. Unarmed combat
uses the defaults defined in settings.h. I'd like to introduce classes and improve this system in the near future.

I've moved the combat code from a simple C function into a *proper Zig library* in `libs/combat`. Unlike the old implementation, this is significantly more robust and introduces new concepts such as damage types , dodge, block, and status effects. Some of those concepts are borrowed from Warframe :) Previously the combat system it just rolled hit chance, applied variance, and checked for a crit. Everything now works the way you'd expect from a roguelike. Attacks now go through dodge -> resistance -> block before actually damaging the target. Consequently, each weapon carries a damage class that determines which status effect it procs on hit. The five damage classes (Slash, Impact, Pierce, Fire, Poison) each map to a different effect: Bleed, Stun, Weaken, Burn, and Poison respectively. Effects tick at the start of each turn. Poison and burn deal damage over time, bleed stacks, stun skips the turn, and weaken reduces attack. Dodge and block, however, are independent rolls. Dodge is a flat chance on the attacker's side; block rolls at 30% when the defender has block > 0 and reduces damage by the block amount before it's applied. Weapon templates (in `common.h`) now `carry dmg_class`, `crit_chance`, `crit_multiplier`, and `status_chance`, so different weapons feel different to wield. Unarmed combat uses the defaults defined in `settings.h`. I'd like to introduce classes and improve this system in the near future.
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I7585121a5ec8e797adc43ba8e30d4ac86a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ic8055a1cf6bdad1aca13673ea171b4b46a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iaac0cda778dd541eb34980f3e902ca726a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I983d5980f8d14ccebc6b681100af8a146a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ie2f5af13ad3c0392a5e873b15170b0226a6a6964
The core game is, and will remain, C

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I568a9d71f55774e195eaa3a75eff80136a6a6964
fields

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Iad085ea5d8007257d77d606ab69e57a26a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I860551db6ca06a34785e9129b64d8fc56a6a6964
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I9e1720b112a0a5ceab64da56735f4fb36a6a6964
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
NotAShelf/rogged!4
No description provided.