dev: migrate combat system & basic build execution to Zig #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "notashelf/push-nrzuupynktom"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 introducesnew 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) nowcarry dmg_class,crit_chance,crit_multiplier, andstatus_chance, so different weapons feel different to wield. Unarmed combatuses the defaults defined in
settings.h. I'd like to introduce classes and improve this system in the near future.player_moveand decomposehandle_inputee116ef33f