Make all traps attackable and give them configurable HP - #32
Open
Upabjojr wants to merge 1 commit into
Open
Conversation
Traps had the full attack machinery wired (per-tile HP, takeDamage, target discovery) but TrapSpike and TrapBoulder overrode isAttackable to false, so only cannons and doors could ever be fought. Remove those overrides: every trap can now be attacked once the attacking seat has seen it trigger (the vision gate in Trap::isAttackable is kept, so hidden traps stay safe). Tile HP was a flat Building::DEFAULT_TILE_HP = 10 for everything. Add Trap::getTileHP() overridden per trap type from traps.cfg (BoulderHP, CannonHP, SpikeHP, WoodenDoorHP), read through a new getTrapConfigDoubleOrDefault so older config files without the new entries keep the old value of 10 instead of breaking. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
|
For destructible traps I am by whole heart .... For the destructible rooms I feel the opposite: they should only be reclaimable between players. That needs to be discussed, but no one says anything at our discord channel. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposal 1 of a set of PRs following the mechanics discussion in #23 (#23 (comment)) — this one covers the part Tom was certain about: "anyway Traps should be destructible".
It turns out the attack machinery for traps already exists end to end (per-tile HP,
Building::takeDamage, target discovery inGameMap::getVisibleForce, fight actions) — butTrapSpikeandTrapBoulderoverrideisAttackable()tofalse, so only cannons and wooden doors could actually be fought. This PR:Trap::isAttackableis deliberately kept: a trap that a player has never seen trigger stays invisible and unattackable for them, so hidden traps remain a real threat.Building::DEFAULT_TILE_HP = 10.0for every building in the game. Traps now readBoulderHP,CannonHP,SpikeHP,WoodenDoorHPfromtraps.cfgvia a newgetTrapConfigDoubleOrDefault(), which falls back to the old value of 10 when the entry is missing — older/custom config files keep working unchanged.The shipped values (Spike 10, Boulder 15, Cannon 20, WoodenDoor 25) are conservative first guesses to make sturdiness roughly track cost — obviously up for balance discussion, that's why they're config entries.
Not touched here: traps were already claimable tile-by-tile by enemy workers (
Trap::claimForSeatdestroys the danced tile), and that stays as it is.Validated: builds and the full test suite passes (including
ab-TestTraps) viactest.🤖 Generated with Claude Code