From 2ae4a052fd1c15c3c6ba0f1dd324d896371aaffc Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 19 Jun 2026 02:40:22 -0400 Subject: feat: rough technology skill added --- AGENTS.md | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md index 8d58f22..44b0556 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -55,13 +55,21 @@ internal/ | `action_room.go` | RunEnterSteps (on_enter scripts), BroadcastRespawns | | `action_state.go` | ActionType consts, ActionState struct, Description() for look display | | `action_default_target.go` | Smart auto-selection for gather/attack | -| `tick.go` | DisconnectTick, RegenTick, WanderTick, SharedDepletionTick, MoveTick, VisualTick | +| `tick.go` | DisconnectTick, RegenTick, WanderTick, SharedDepletionTick, MoveTick, VisualTick, TechTick | | `map.go` | BFS graph builder, tiny map, full map, display utilities (strip, trim) | | `types.go` | EquipSlots, itemMatch, xpGain, deathDrop | | `utils.go` | Helper functions (plural, parseQty, parseChoiceIndex, formatPickupList, etc.) | | `help.go` | Help topic YAML loading and display | | `color.go` | colorMode(), colorize(), colorTag() helpers | | `table.go` | Unicode/ASCII table rendering for score/option/help/crafting menus | +| `tech.go` | TechDef struct, 25 hardcoded tech definitions, techLevelBonus, applyTechProtection, totalTechBonus | +| `cmd_tech.go` | doTech, toggleTech, doTechList, doTechQuick — technology command handlers | +| `cmd_stats.go` | doStats — equipment bonus totals, attack roll, max hit display | +| `cmd_clean.go` | doClean — background herb cleaning (Pharmacy) | +| `cmd_mix.go` | doMix — potion mixing via production system (Pharmacy) | +| `action_clean.go` | advanceClean — background clean action lifecycle | +| `equip_stats.go` | playerEquipBonuses — sums all equipped items into one ItemStats | +| `aggro.go` | checkAggro — aggressive mob attack on room enter | ## Key Conventions @@ -154,6 +162,8 @@ Item and object YAML `color` fields also support gradient syntax: `color: "g:196 | `color off` | Disable color for a specific target | | `colortable` | Display xterm-256 color reference chart | | `style ` | Set combat style: accurate, aggressive, defensive, balanced (prefix match) | +| `stats` | Show total equipment bonuses, attack type, attack roll, max hit | +| `tech [name]` / `t` | Toggle tech on/off, `tech list` shows all, `tech quick ` sets quick tech | ### Free (stackable, execute before active) | Command | Description | @@ -353,17 +363,30 @@ See `internal/game/action_burn.go`. ## Combat System +**Attack types.** Weapons have an `attack_type` field (stab/slash/crush/ranged/science). The attack type determines which of the player's 5 attack bonuses is used for accuracy and which of the mob's 5 defense bonuses is used. Equipment stats use per-type fields: `stab_attack`, `slash_attack`, `crush_attack`, `science_attack`, `ranged_attack` (and matching defense fields). + +**OSRS accuracy formula.** `HitChance(attackRoll, defenseRoll)` uses a continuous probability curve: if `a > d`, chance = `1 - (d+2)/(2*(a+1))`; otherwise `a/(2*(d+1))`. Equal rolls ≈ 50% hit chance. + +**Ranged combat.** When `weapon_type` is "ranged", uses Ranged level for attack rolls, `ranged_attack` for accuracy, `ranged_strength` from ammo for max hit. Consumes 1 ammo per attack. If ammo runs out, combat ends. XP: 75% Ranged, 25% Hitpoints (all styles). + +**Aggressive mobs.** Mobs with `aggressive: true` auto-attack players entering their room (1-tick delay). Only aggros if `playerLevel <= mobLevel * 2` (OSRS rule). Checked on room enter and login via `checkAggro()`. + +**Equipment requirements.** Items can have `requirements: { attack: 20, defense: 10 }`. Checked in `doWear` and `doWearAll` before equipping. Displayed when examining items. + +**Technology in combat.** Active tech boosts (Clarity, Amplifier, etc.) add percentage-based level bonuses to attack/strength/defense/ranged. Protection techs (Kinetic Barrier, Projectile Screen, Neural Firewall) reduce incoming damage by 40%. Dead Man's Switch deals 25% max HP damage to the mob on player death. + **Fleeing combat:** Players can move in any direction to attempt to flee. Movement takes the normal tick delay (default 4, reduced by equipment). During the countdown, the mob continues attacking. If the mob lands a hit, the escape fails ("Can't escape!") and combat resumes. If no hit lands, the player escapes. With Cape of Agility, fleeing is instant. The `run_countdown` option shows tick-by-tick countdown messages. -**Death mechanic:** Player drops credits to ground. If player has >3 items (inventory + equipment), the 3 most valuable are kept and rest are dropped. Player teleports to room 1 at full HP. +**Death mechanic:** Player drops credits to ground. If player has >3 items (inventory + equipment), the 3 most valuable are kept and rest are dropped. Player teleports to room 1 at full HP. All active techs deactivated on death. **XP formula:** `baseXP = dmg * 4`, distributed by attack style: - Accurate: 75% Attack, 25% Hitpoints - Aggressive: 75% Strength, 25% Hitpoints - Defensive: 75% Defense, 25% Hitpoints - Balanced: 25% each Attack/Strength/Defense/Hitpoints +- Ranged (all styles): 75% Ranged, 25% Hitpoints -**Mob combat level:** `0.25 * (attack + strength + defense + maxHP)` +**Mob combat level:** `base = (def + hp) / 4`, `offensive = max(melee=(atk+str)/4, ranged=rng*3/8, science=sci*3/8)`, `level = floor(base + offensive)`. **Player combat level:** Ranged-or-melee dominant calculation. Includes Technology (0.25) and Science (0.125). @@ -402,6 +425,8 @@ Account-wide options set via `option `. Options are stored in the Prompt is NOT an option — it is a per-character setting via the `prompt` command. Default: `"> "`. `prompt none` sets it to blank. Stored in character YAML as `prompt:`. +Prompt variables: `%h` (HP), `%H` (max HP), `%b` (battery), `%B` (max battery), `%c` (credits), `%i` (free slots), `%s` (style short), `%S` (style long), `%m` (mob HP), `%M` (mob max HP), `%X_` (XP), `%x_` (XP to next). + New accounts are asked "Should I disable color? [y/N]" after password creation. Pressing enter defaults to No (xterm256 enabled). Choosing Y sets color to "none". ## ItemDef Fields @@ -418,8 +443,10 @@ From `internal/object/item.go`: | `stackable` | Can stack in inventory | | `equip_slot` | head/neck/torso/legs/hands/feet/back/ammo/main_hand/off_hand/ring | | `weapon_type` | "melee" / "ranged" / "science" | -| `stats` | attack/strength/defense/science/technology bonuses | +| `attack_type` | "stab" / "slash" / "crush" / "ranged" / "science" | +| `stats` | Per-type attack/defense bonuses, strength, ranged strength, science damage, technology bonus | | `speed` | Attack speed | +| `requirements` | Skill level requirements to equip (e.g., `{attack: 20, defense: 10}`) | | `tool_type` | Tool type string for gather requirements | | `tool_speed` | Speed bonus for gathering | | `burn_ticks` | Burn duration for firemaking | @@ -534,7 +561,7 @@ The unified production cycle handles: "How many?" prompt, start message, timed l | Production | Cooking, Smithing, Crafting, Fletching, Pharmacy, Construction, Firemaking | | Utility | Agility | -Implemented: Mining, Fishing, Woodcutting, Firemaking, Cooking, Smithing (smelting + smithing), Fletching, Pharmacy (herb cleaning + potion mixing). The rest are stubs (skill defined, XP tracked, but no behaviors/objects/items yet). +Implemented: Mining, Fishing, Woodcutting, Firemaking, Cooking, Smithing (smelting + smithing), Fletching, Pharmacy (herb cleaning + potion mixing), Technology (25 techs, battery drain, 1-tick flicking, combat integration). The rest are stubs (skill defined, XP tracked, but no behaviors/objects/items yet). ## Places to Be Careful @@ -553,3 +580,5 @@ Implemented: Mining, Fishing, Woodcutting, Firemaking, Cooking, Smithing (smelti - Movement takes multiple ticks (default 4, reduced by Graceful set and Cape of Agility). Cape of Agility makes movement instant (1 tick). Graceful pieces each reduce by 0.25 ticks; full set bonus adds 0.5 for 2 ticks total. Cape overrides Graceful. - During combat, movement is a flee attempt. Mob hits during the countdown abort the flee ("Can't escape!"). - Level-up messages output `*** You are now level N ! ***` across all skills that gain XP. + +Skills provide specialized instructions and workflows for specific tasks. -- cgit v1.2.3