# Aeshnidae.ResonanceAuras

What Resonance buys. A second aura track beside the luminance auras, paid in
Resonance from the account bank instead of luminance. Each rank adds a small, fixed
amount to a number ACE already uses in a formula - never a new mechanic - so the
retail augmentation gems and luminance auras that touch the same numbers still
work and stack with ours. Small power and convenience, not a second mastery.

```
/aura                          every aura, your rank, the next rank's price
/aura <name>                   what it does, per rank, and what you have
/aura buy <name> [n]           buy n ranks, default 1
/aura-grant <player> <aura> <n>   admin: ranks without paying (negative takes them away)
/aura-reload                   admin: re-read Settings.json
```

Names match any unambiguous prefix or word: `/aura buy frugal 2`, `/aura stones`.
(`/a` is Allegiance chat in the client and never reaches the server, so the command
is the full word.)

## The auras

Per rank, as ACE computes it. "Retail" is how the same number was sold on retail;
those still work and add to ours.

| Key | Name | Each rank | Max | Retail | Where ACE reads it |
| --- | --- | --- | --- | --- | --- |
| `spellduration` | Lasting Enchantments | beneficial spell duration +20% | 3 | Archmage's Endurance gem (5) | `EnchantmentManager.cs:185,222`, `AddEnchantmentResult.cs:98` |
| `itemmana` | Frugal Mana | item mana burn 5 rating slower (5 ranks is about -20%) | 5 | luminance aura (5) | `Player_Tick.cs:638` |
| `imbue` | Charmed Hands | imbue success +5% on the base 33% | 3 | Charmed Smith gem (1) | `RecipeManager.cs:241` |
| `manastone` | Generous Stones | mana from stones +5 rating | 5 | luminance aura (5) | `ManaStone.cs:144,211` |
| `salvage` | Keen Salvager | salvage units and value +25% | 4 | Ciandra's Fortune gem (4) | `Player_Crafting.cs:220,318` |
| `carry` | Strong Back | carrying capacity +20% of base | 5 | Might of the Seventh Mule gem (5) | `Player_Inventory.cs:50`, `EncumbranceSystem.cs:5` |
| `regen` | Deep Rest | vitals regenerate +100% faster while lying down | 2 | Blade Turner gem (2) | `Creature_Vitals.cs:130` |
| `components` | Thrifty Caster | each burning spell component has a 10% chance to survive | 5 | nothing | `Spell.TryBurnComponents` |
| `ammo` | Steady Quiver | each arrow, bolt or dart has a 10% chance not to be spent | 5 | nothing | `Player.UpdateAmmoAfterLaunch` |

Not in the table, on purpose: bonus XP per rank (it would mirror into Radiance and
stack on the quest bonus), fewer items dropped on death and spells surviving death
(retail's gems already cover both and a corpse with nothing on it is a different
game), and anything that raises damage, skills or crit - mastery is the power sink.

## Prices

Rank *n* of any aura costs `RankPriceBase` x *n* Resonance - 100, 200, 300, 400, 500
by default, with a per-aura override in `Settings.Auras`. Linear on purpose: an aura
is small and steady, not a mastery-style wall. At 10 Resonance a quest:

| | Resonance | quests |
| --- | --- | --- |
| first rank of anything | 100 | 10 |
| one aura to 3 ranks | 600 | 60 |
| one aura to 5 ranks | 1,500 | 150 |
| everything in the table | 10,000 | 1,000 |

## How it works

**Storage.** `aeshnidae_resonance_auras` (character, aura key, ranks) in the shard
database, created on first run. Per character, paid from the account - the same shape
as skill mastery. Kept out of the character's own properties so that enlightenment,
which zeroes the luminance auras through ACE's `Enlightenment.cs`, cannot touch them:
the ranks survive enlightenment by construction, not by special case. No refunds.

**The property-backed seven** are Harmony postfixes on the typed `Player` getter that
ACE's formula reads (`Player.AugmentationIncreasedSpellDuration` and so on): `__result
+= ranks`. The stored property is never written. That matters three ways:

- The augmentation gem device and the luminance vendor emotes check their maximums
  through `GetProperty`, raw, so our ranks never block a retail purchase.
- `Aeshnidae.Enlightenment` checks its aura prerequisites through `GetProperty` too,
  so Resonance can never satisfy an enlightenment requirement.
- The client's augmentation panel shows only what the character stores, so it will not
  show ours; `/aura` and the Codex do. The one exception is carrying capacity, which
  the client works out for itself from its copy of the augmentation count - so that
  count is re-sent with our ranks in, at login and on purchase, through the message
  ACE uses when a gem is used.

**Strong Back and the burden cap.** `EncumbranceSystem.EncumbranceCapacity` (movement,
jumping, the burden penalty) caps the augmentation bonus at five gems' worth, while
`Player.GetEncumbranceCapacity` (can I pick this up) does not. A postfix lifts the cap
by our maximum so the two agree; only a count above five can reach it, and only this
aura makes one.

**Thrifty Caster** is a postfix on `Spell.TryBurnComponents`: ACE has already rolled
which components burn; each gets a second roll to survive. Runs before the player's
`TryBurnComponents` takes them from the pack and names them in chat, so the message
matches what happened.

**Steady Quiver** is a prefix on `Player.UpdateAmmoAfterLaunch`: on a save it does the
part of the original that is not the spending (hide the held ammo; the reload animation
parents it back), and skips the rest. The last one in a stack is never saved -
`LaunchProjectile` has already told the player they are out of ammunition.

**Paying.** A guarded `UPDATE` on `aeshnidae_bank`, the same statement Bank and
SkillMastery use, so two writers cannot overdraw a balance. This mod cannot see Bank's
unflushed earnings buffer (up to ten seconds), and the refusal message says so.
Buying plays the augmentation burst and chime.

**Auditing.** `/aura-grant` is an admin-level command, which is what puts it in
`Aeshnidae.AdminAudit`'s trail; `/aura buy` spends the player's own Resonance and is
not audited, as `/raise` is not.

## Settings

Written with defaults on first run. Every knob is documented in `Settings.cs`; the
ones to know:

- `RankPriceBase` (100) - what rank 1 costs; rank n costs n times it.
- `ComponentSaveChancePerRank` (0.10), `AmmoSaveChancePerRank` (0.10).
- `Auras` - one row per aura: `Name` and `MaxRanks` are yours to change (0 takes an
  aura off sale without losing anyone's ranks; a lowered maximum takes effect at
  once); `Key` is not, and `RankPriceBase` overrides the global price for that aura.

| File | |
| --- | --- |
| `Auras.cs` | The nine auras as code knows them; the per-character cache; Buy and Grant. |
| `Patches.cs` | Where the ranks take effect. |
| `AuraDb.cs` | The table; Resonance balance and the guarded debit. |
| `Commands.cs` | `/aura`, `/aura-grant`, `/aura-reload`. |
| `CodexPage.cs` | The auras' page in the Aeshnidae Codex. |
| `Settings.cs` | Prices, chances, the aura table. |
