FBC: NIGHT SHIFT - pacing pass and cyan crystal / buff decoupling

Pacing:
- Spin cooldown 0.55 -> 0.95 s (-3%/level instead of -8%); damage ramp +28%/level
- Weaken fire-rate offers (Rapid Cycling +8%, Board Favor +4%, Maintenance +5%)
- Stretch XP curve to 10+6*level and offer cadence to 3 s (5 s idle)
- Calm early director income and spawn interval; docs updated

Crystal/buff decoupling:
- Kills drop XP shards only; remove per-kill random buff world object
- PickupSystem owns shards alone; BuffSystem catches world objects with its
  own 2.8 m radius, independent of shard pickup magnet/upgrades
- Explicit guaranteed world-object spawns for rituals and side rooms;
  effect-less bait consumed without a buff
- ShardCollected only emitted for actual shard/XP rewards
- Update design docs, RPG_LITE and README
This commit is contained in:
dandovlatov 2026-11-24 21:55:59 +04:00
parent 849b34922d
commit 89d2bb8806
14 changed files with 204 additions and 85 deletions

View file

@ -19,7 +19,9 @@ autoshoot, 4 Objects of Power (levels + Altered Forms, enable/disable), level-up
that roll offers as real-time HUD entries per GAME_DESIGN.md §2.2 (no picking —
the run is never paused), 4 enemy archetypes, corruption clock,
death screen. OoP rituals, scene-wide buffs/debuffs and world objects are in and
wired into the HUD. The look is a brutalist 3D diorama with **sculpted low-poly
wired into the HUD. Cyan Resonance crystals are **progression-only (XP)** —
buffs and debuffs come from rituals and other world objects, never from a crystal.
The look is a brutalist 3D diorama with **sculpted low-poly
Blender actors** (no 2D standees or box kits). The player is a dedicated
reference-based, Blender-rigged FBC agent (yellow helmet, glowing respirator,
sage coveralls, radio, rifle with a red tip) with real Idle/Run/Dash/Fire/

View file

@ -34,9 +34,10 @@ AWE: NIGHT SHIFT, CONTROL: BREACH PROTOCOL).
1. **Move (WASD or stick), auto-fight.** Dash = *Evade*. Owned Objects of Power
fire on their own cooldowns/targeting rules; each can be enabled or
disabled in real time. **Magnets:** kills drop Resonance Shards that pull
toward the player (inside `pickup_radius`); with **world objects**
(§4.6), the magnet catch applies the object's effect automatically. **No
disabled in real time. **Magnets:** kills drop cyan Resonance Shards that pull
toward the player (inside the shard `pickup_radius`) and grant **XP only**.
Buffs/debuffs live on **world objects** (§4.6), caught with their own field
radius and never attached to a crystal. **No
pause:** enemy spawn, floor scaling, ritual triggers and skill acquisition
advance while the player thinks (the only transitions are quest markers and
ritual encounters).
@ -71,8 +72,9 @@ AWE: NIGHT SHIFT, CONTROL: BREACH PROTOCOL).
starts; HUD: `RITUAL IN PROGRESS — LIGHT SWITCH — CATCHING (0/3)`.
- **Bait:** on start the ritual drops 3 **bait world objects** in a ring of
radius 2.5 m around the switch ("the House drops objects near its broken
switches as bait"). They are consumable world objects — catching one
applies its §4.6 effect — and they are the ritual's counters.
switches as bait"). They have no buff effect — they are the ritual's
counters, caught by the world-object field radius (2.8 m), separately from
the shard magnet.
- **Catch:** the player uses the magnet (Evade/pickup) to catch the bait —
"catch a few objects near the switch". A catch counts when its bait
leaves the world-object pool (picked up).
@ -160,6 +162,11 @@ RoR2 makes difficulty theatrical; so do we.
### Current tuning (M6 progression pass — the 20-minute hardcore curve)
The 2026-11-24 pacing pass keeps this difficulty clock intact but slows the
*player* ramp considerably so the Service Weapon delivers ~60 shots/min at
level 1 and never exceeds ~90 shots/min fully upgraded — see §11 and
`docs/GAME_DESIGN_PASS.md`.
c(t) = 0.05 + 0.0016 * t + 0.10 * floors_cleared; tier = c / 0.25.
One tier per ~2.6 min, TOTAL RESONANCE at ~20 min of untouched play. Floors
still jump the clock (RoR2 stage difficulty) — clearing one shaves about a
@ -193,7 +200,7 @@ re-enabled.
| OoP | Behavior | Altered Form (evolution) |
|---|---|---|
| Service Weapon: Spin | Rapid auto-projectiles at nearest | +Pierce passive -> *Spin: Corridor* (piercing ricochets) |
| Service Weapon: Spin | Measured auto-projectiles at nearest, slow to ramp (§11) | +Pierce passive -> *Spin: Corridor* (piercing ricochets) |
| Service Weapon: Shatter | Shotgun cone | +Black Rock -> *Shatter: Quarry* (knockback wall) |
| Service Weapon: Charge | Slow homing nuke on densest cluster | +Board Favor -> *Charge: Directive* (marks target, bonus dmg) |
| Rubber Duck | Persistent homing familiar | +Levitate -> *Duck Ascendant* |
@ -241,17 +248,21 @@ not just player stat edits. Design:
- Elite tiers / T1 elasticity (§3, §6): resonant, phasing, shielded, mending,
volatile specials map to the catalog.
- Time events: tier-up pulses, shop offers.
- **World objects** (§4.6) — magnet catch applies the effect immediately; the
player has no way to tell beforehand.
- **World objects** (§4.6) — caught inside their own field radius, the effect
applies immediately; the player has no way to tell beforehand. Crystals are
progression-only and never appear in this list.
## 4.6. World Objects of Power — random SCP-like items (catch = apply)
The House scatters **world objects of power** — small SCP-like artifacts on the
floor (a glow + a flavor name). They are not manual OoPs — no ritual, no
evolution, no level. The mechanic: **magnet pickup = application**
(`PickupSystem`, §2.1). When the magnet reaches one, it is consumed and the
object applies its effect — to the player, or to the nearest enemy if one is
nearby (`BuffSystem::apply(subject, effect, duration)`).
evolution, no level. The mechanic: **caught = application**
(`BuffSystem::update_world_objects`, §2.1). Objects use their own 2.8 m field
radius, independent of the XP shard magnet and its upgrades. When the player
enters that field, the object is consumed and applies its effect — to the
player, or to the nearest enemy if one is nearby
(`BuffSystem::apply(subject, effect, duration)`). Cyan Resonance crystals are
not world objects: they carry XP only and can never apply a buff/debuff.
- **Enemy channel** (implemented): objects caught near enemies apply to them —
`ENEMY_SLOW` (−40% speed, 20 s), `ENEMY_BURN` (enemy burns 0.4 DPS, 25 s),
@ -272,12 +283,13 @@ nearby (`BuffSystem::apply(subject, effect, duration)`).
- `Dot` — enemy burns 0.4 DPS (25 s)
- `Vulnerable` — enemies +30% taken damage (25 s)
- `Immune` — resonance immune (10 s)
- **Spawn rules:**
- Enemy deaths drop world objects around the corpse (the player can't
always outrun freshly killed ones).
- The director scatters some on the ring (15–21 m, RoR2 analog).
- Cap: ~15 active world objects; rate scales with c (x1 + 1.5c) so the floor
"fills with junk" mid-run.
- **Spawn rules (2026-11-24 decoupling):**
- **Kills drop XP crystals only** — no buff/debuff object on the corpse.
- Objects come from **rituals** (lightswitch bait, TV reward) and **other
objects/rooms** (e.g. the Security Booth cache); explicit spawns always
pay out. The unimplemented director ring scatter is dropped from scope.
- Cap: 15 active world objects; each has a fixed effect and duration from
the catalog above.
- **Balance notes:** player HP is 100 — confusion/slow/vulnerable accepted
tension; watch confusion chains on early run; cap object-stacked effects
(e.g., max 3 `Vulnerable` from objects).
@ -345,11 +357,32 @@ threshold (§2.2) and apply automatically when the player is idle — there is
no picking on a pause screen, since the run never pauses; the buffs are
scene effects, not a picked component list.
THREAT ASSESSMENT (+20% damage), RAPID CYCLING (+15% fire rate), FIELD CONDITIONING
THREAT ASSESSMENT (+20% damage), RAPID CYCLING (+8% fire rate), FIELD CONDITIONING
(+12% move speed), HARDENED VEST (+25 max HP, heal 25), RESONANCE ATTUNEMENT
(+40% pickup radius), PIERCING ROUNDS (+1 pierce).
(+40% pickup radius), PIERCING ROUNDS (+1 pierce), BOARD FAVOR (+8% damage,
+4% fire rate). The Maintenance passive adds another +5% fire rate per stack.
## 10. Run end & modes
Reach the Executive floor = run won (canon ending: Jesse arrives). Death = run over.
**Endless Shift** after the finale. Score = "Containment Rating".
## 11. Pacing pass (2026-11-24) — slower player ramp
The run used to reach 200+ Service Weapon shots/minute inside the first minute.
Everything on the *player* side now ramps more slowly; the corruption clock and
the 20-minute run length are deliberately unchanged.
| Knob | Before | Now |
|---|---|---|
| Spin base cooldown | 0.55 s (~109/min) | 0.95 s (~63/min) |
| Cooldown per OoP level | −8% (−24% at L4) | −3% (−9% at L4) |
| Damage per OoP level | +35% (+105% at L4) | +28% (+84% at L4) |
| Rapid Cycling / Board Favor / Maintenance | +15% / +8% / +10% | +8% / +4% / +5% |
| XP to next level | 6 + 4·(level−1) | 10 + 6·(level−1) |
| Offer interval / idle fast-track | 2 s / 3 s | 3 s / 5 s |
| Director base income / spawn interval | 4 / 1.5 s | 3 / 2.0 s |
Worst-case Spin cadence: `0.95 × 0.91 / (1.08 × 1.04 × 1.05³) ≈ 0.67 s`,
i.e. **~90 shots/min**, down from ~237/min. The slower director income keeps
the opening kill race fair against the longer time between shots.

View file

@ -49,3 +49,55 @@ The "What lacks" list above is a historical snapshot. Current state:
See `docs/LEVEL_DESIGN_REVIEW.md` for the full audit and `docs/MAP_FLOW.md`
for the current floor-flow status.
## Pacing pass (2026-11-24)
**Problem:** the Service Weapon started at ~109 shots/min and, with the old −8%
cooldown-per-level ramp plus stackable fire-rate offers, could reach ~237/min
inside the first minute. Other OoPs piled on top of that.
**Change (all progression slowed, corruption clock unchanged):**
- `weapons.cpp` — Spin base cooldown 0.55 → 0.95 s; cooldown scaling −8% → −3%
per level; damage scaling +35% → +28% per level.
- `game.cpp` / `game.hpp` — Rapid Cycling +15% → +8%, Board Favor +8% → +4%,
Maintenance passive +10% → +5%; XP curve 6+4·L → 10+6·L; offers apply every
3 s (5 s idle fast-track) instead of 2 s (3 s).
- `director.hpp` — base income 4 → 3 and spawn interval 1.5 → 2.0 s so the
quieter opening still has a fair kill race.
Spin now runs at ~63 shots/min at level 1 and ~90/min at full level/buff stack.
Full table and rationale in `docs/GAME_DESIGN.md` §11.
**Not touched (separate work):** the Projector ritual weapon still has no firing
case in `WeaponSystem::update()`; it is acquired but never shoots.
## Crystal/buff decoupling (2026-11-24)
**Problem:** every kill spawned a random buff/debuff `WorldObject` at the exact
same spot as the XP crystal, and `PickupSystem::update` collected both with one
magnet loop. The spawn probability (`0.8 + 1.5c`) saturated after ~1 minute, so
essentially every cyan crystal also handed out a random status effect. The
`ResonanceAttunement` pickup-radius Directive enlarged both catch fields.
**Fix:**
- `game.cpp` — `death_pass()` now drops an XP shard only; the per-kill
`spawn_world_object()` call is gone. `ShardCollected` is only emitted for
actual shard/XP rewards, not every side-room reward.
- `pickups.{hpp,cpp}` — `PickupSystem` owns shards alone; no `BuffSystem` or
`EnemySystem` parameters. Crystals can only produce XP.
- `buffs.{hpp,cpp}` — new `BuffSystem::update_world_objects()` catches ritual
bait / object-cache effects with a dedicated 2.8 m field radius, independent
of the shard magnet. Enemy-channel effects still pick the nearest enemy
within 2.2 m; effect-less bait is consumed without creating a buff.
`spawn_world_object()` is now an explicit, guaranteed spawn used only by
rituals and side rooms (the old corruption-scaled random rate is gone).
- `player.hpp` / docs — `ResonanceAttunement` is documented as shard-only;
`GAME_DESIGN.md` §2/§4.5/§4.6, `RPG_LITE.md` and the README now state that
buffs/debuffs belong to other OoPs and objects, never to crystals.
**Verification (headless 60 s sim):** 24 kills → 0 world objects and 0 buffs;
a shard at 2.5 m stays uncollected with a 1.0 m shard magnet while a world
object at 2.5 m is caught; the lightswitch ritual still spawns 3 baits,
completes and applies FLUORESCENT LIGHT.

View file

@ -15,7 +15,8 @@
- PlayerStats are base values; BuffSystem applies transient buffs/debuffs.
- Directives/passives are permanent build components.
- Weapons are components in WeaponSystem.
- World objects apply temporary components on magnet catch.
- World objects apply temporary components when caught in their own field;
cyan crystals are progression-only (XP) and never carry buffs/debuffs.
- Rituals are quest components that can grant rewards.
## Mini quests

View file

@ -1,7 +1,15 @@
#include "game/buffs.hpp"
#include "game/enemies.hpp"
#include "game/player.hpp"
namespace {
// World objects use their own catch field; shard pickup radius (and its
// Directive upgrades) must not make buff/debuff objects easier to collect.
constexpr float kObjectCatchRadius = 2.8f; // > the 2.5 m lightswitch bait ring
constexpr float kEnemyBuffRange = 2.2f; // nearest enemy takes an enemy-channel effect
struct WorldObjSpec {
BuffEffect effect;
float duration;
@ -39,6 +47,35 @@ void BuffSystem::update(float dt) {
}
}
void BuffSystem::update_world_objects(const Player& player, const EnemySystem& enemies) {
for (int i = 0; i < world_object_count();) {
WorldObject& obj = world_object(i);
if (distance(obj.pos, player.pos) >= kObjectCatchRadius) {
++i;
continue;
}
// An enemy-channel effect goes to the closest nearby enemy; otherwise
// the object resolves on the player. Bait has no effect (ritual counter).
if (!obj.effect.empty()) {
const Enemy* near = nullptr;
int near_idx = -1;
float near_d = 0.0f;
for (std::size_t j = 0; j < enemies.enemies.size(); ++j) {
const float d = distance(obj.pos, enemies.enemies[j].pos);
if (near == nullptr || d < near_d) {
near = &enemies.enemies[j];
near_idx = static_cast<int>(j);
near_d = d;
}
}
apply(near != nullptr && near_d < kEnemyBuffRange ? near_idx : -1,
obj.effect, obj.duration, obj.name);
}
remove_world_object(i);
}
}
void BuffSystem::apply(int subject, const BuffEffect& effect, float duration,
const char* name) {
if (static_cast<int>(buffs_.size()) >= kBuffCap) return;
@ -54,10 +91,10 @@ void BuffSystem::expire_subject(int subject) {
buffs_.remove_if([subject](const Buff& b) { return b.subject == subject; });
}
void BuffSystem::spawn_world_object(Vec2 pos, Rng& rng, float corruption_c, int kind) {
void BuffSystem::spawn_world_object(Vec2 pos, Rng& rng, int kind) {
if (static_cast<int>(world_objects_.size()) >= kWorldCap) return;
// Rate scales with corruption: the House fills with junk mid-run.
if (!(rng.next_float() < 0.8f + 1.5f * corruption_c)) return;
// Explicit object spawns are guaranteed: a ritual/side-room reward must
// always pay out, and no object is attached to a crystal drop.
const int n = static_cast<int>(sizeof(kWorldCatalog) / sizeof(kWorldCatalog[0]));
const int idx = (kind >= 0 && kind < n) ? kind : rng.range_int(0, n - 1);
const WorldObjSpec& spec = kWorldCatalog[idx];

View file

@ -6,8 +6,12 @@
// §4.5–4.6: Buffs & Debuffs — component-style, ECS-lite: Buffs are components
// attached to subjects (player = −1, or enemy pool id) and re-applied each
// tick; world objects of power are consumed on magnet catch (PickupSystem)
// and call apply() directly.
// tick. World objects of power are caught by their own field radius and call
// apply() directly. Cyan Resonance crystals are NOT part of this system: they
// only ever grant XP (see pickups.hpp).
struct Player;
struct EnemySystem;
struct BuffEffect {
float speed_mult = 1.0f; // Slow: subject speed (player or enemy)
@ -17,6 +21,12 @@ struct BuffEffect {
float confused = 0.0f; // Confuse: player confusion (enemies drag the player)
float taken = 0.0f; // Taken: pulls player toward enemies (immune while near)
float immune = 0.0f; // Enemy immune to player-channel effects (resonance)
bool empty() const {
return speed_mult == 1.0f && dot_dps == 0.0f && burn_dps == 0.0f
&& damage_taken_mult == 1.0f && confused == 0.0f
&& taken == 0.0f && immune == 0.0f;
}
};
struct Buff {
@ -52,9 +62,13 @@ struct WorldObject {
class BuffSystem {
public:
void update(float dt);
// World objects (ritual bait, object caches) are caught within their own
// radius — independent of the XP shard magnet and its upgrades.
void update_world_objects(const Player& player, const EnemySystem& enemies);
void apply(int subject, const BuffEffect& effect, float duration, const char* name = "");
void expire_subject(int subject);
void spawn_world_object(Vec2 pos, Rng& rng, float corruption_c, int kind = -1);
// Explicit object spawns only (rituals/side rooms) — kills drop XP shards.
void spawn_world_object(Vec2 pos, Rng& rng, int kind = -1);
// Lightswitch bait (§2.3): a world object the ritual counts as caught when
// it leaves the pool — guaranteed spawn, not the random scatter rate.
bool spawn_bait(Vec2 pos, const char* name);

View file

@ -21,10 +21,10 @@ struct SpawnCard {
};
struct DirectorConfig {
float base_income = 4.0f;
float base_income = 3.0f;
float income_per_corruption = 14.0f;
float income_per_corruption_sq = 50.0f; // late-run quantity explosion
float spawn_interval_base = 1.5f; // seconds between spawn attempts at c=0
float spawn_interval_base = 2.0f; // seconds between spawn attempts at c=0
float spawn_interval_decay = 5.0f; // interval = base / (1 + decay * c)
float spawn_interval_min = 0.10f;
float too_cheap_fraction = 0.25f; // cost must clear this share of the bank

View file

@ -75,12 +75,12 @@ void apply_offer(Game& g, const Offer& o) {
g.player.directives[o.id] = 1;
switch (static_cast<Directive>(o.id)) {
case Directive::LaunchTraining: g.player.stats.damage_mult *= 1.20f; break;
case Directive::MaintenanceTraining: g.player.stats.fire_rate_mult *= 1.15f; break;
case Directive::MaintenanceTraining: g.player.stats.fire_rate_mult *= 1.08f; break;
case Directive::LevitateDrill: g.player.stats.move_speed *= 1.12f; break;
case Directive::BlackRockPlating: g.player.stats.max_hp += 25.0f; g.player.hp += 25.0f; break;
case Directive::ResonanceAttunement: g.player.stats.pickup_radius *= 1.40f; break;
case Directive::PiercingRounds: g.player.stats.pierce += 1; break;
case Directive::BoardFavor: g.player.stats.damage_mult *= 1.08f; g.player.stats.fire_rate_mult *= 1.08f; break;
case Directive::BoardFavor: g.player.stats.damage_mult *= 1.08f; g.player.stats.fire_rate_mult *= 1.04f; break;
default: break;
}
break;
@ -94,7 +94,7 @@ void apply_offer(Game& g, const Offer& o) {
case Passive::Evade: g.player.stats.dash_cooldown_mult *= 0.85f; break;
case Passive::Shield: g.player.stats.max_hp += 20.0f; g.player.hp += 20.0f; g.player.stats.regen += 1.0f; break;
case Passive::Polaris: g.player.stats.regen += 2.0f; break;
case Passive::Maintenance: g.player.stats.fire_rate_mult *= 1.10f; break;
case Passive::Maintenance: g.player.stats.fire_rate_mult *= 1.05f; break;
default: break;
}
break;
@ -139,7 +139,7 @@ void Game::reset() {
kills = 0;
level = 1;
xp = 0.0f;
xp_to_next = 6.0f;
xp_to_next = 10.0f;
last_tier_ = 0;
}
@ -160,6 +160,7 @@ void Game::update(const InputState& in, float dt) {
side_banner = std::max(0.0f, side_banner - dt);
corruption.update(dt);
buff_system.update(dt);
buff_system.update_world_objects(player, enemy_system);
player.mods = buff_system.player_mods();
player.mods.damage_taken_mult *= 1.0f / (1.0f + player.stats.armor * 0.05f);
if (corruption.tier() != last_tier_) {
@ -188,10 +189,10 @@ void Game::update(const InputState& in, float dt) {
else idle_time = 0.0f;
if (!pending_offers.empty()) {
offer_timer -= dt;
if (offer_timer <= 0.0f || idle_time >= 3.0f) {
if (offer_timer <= 0.0f || idle_time >= 5.0f) {
apply_offer(*this, pending_offers.front());
pending_offers.erase(pending_offers.begin());
offer_timer = 2.0f;
offer_timer = 3.0f;
idle_time = 0.0f;
}
}
@ -199,7 +200,7 @@ void Game::update(const InputState& in, float dt) {
death_pass();
float xp_gained = 0.0f;
pickup_system.update(dt, player, events, xp_gained, buff_system, enemy_system);
pickup_system.update(dt, player, events, xp_gained);
xp += xp_gained;
floor_pass();
side_room_pass();
@ -207,10 +208,10 @@ void Game::update(const InputState& in, float dt) {
while (xp >= xp_to_next) {
xp -= xp_to_next;
level += 1;
xp_to_next = 6.0f + 4.0f * static_cast<float>(level - 1);
xp_to_next = 10.0f + 6.0f * static_cast<float>(level - 1);
auto offers = roll_offers(*this);
for (const Offer& o : offers) pending_offers.push_back(o);
offer_timer = 2.0f;
offer_timer = 3.0f;
}
player.hp = std::min(player.stats.max_hp, player.hp + player.stats.regen * dt);
@ -273,12 +274,15 @@ void Game::side_room_pass() {
if (idx < 0 || idx >= Floor::kSideRoomCount || side_reward_claimed_[idx]) return;
side_reward_claimed_[idx] = true;
side_banner = 3.0f;
bool shards_granted = false; // ShardCollected is a crystal event, not a generic reward ping
switch (idx) {
case 0: // Records Archive — lore and a filed XP stipend
xp += 8.0f;
shards_granted = true;
side_banner_text = "RECORDS ARCHIVE — recovered intel (+XP)";
break;
case 1: // Locker Room — shard greed
shards_granted = true;
for (int i = 0; i < 8; ++i) {
const float a = rng.range(0.0f, 6.2831853f);
pickup_system.spawn(player.pos + Vec2{std::cos(a) * 2.0f,
@ -294,13 +298,13 @@ void Game::side_room_pass() {
case 3: // Security Booth — contained world objects
for (int i = 0; i < 2; ++i) {
buff_system.spawn_world_object(player.pos + Vec2{static_cast<float>(i) * 1.5f, 0.0f},
rng, corruption.value());
rng);
}
side_banner_text = "SECURITY BOOTH — world-object cache";
break;
default: break;
}
events.push(EventType::ShardCollected, player.pos, 1.0f);
if (shards_granted) events.push(EventType::ShardCollected, player.pos, 1.0f);
}
void Game::death_pass() {
@ -308,8 +312,9 @@ void Game::death_pass() {
Enemy& e = enemy_system.enemies[i];
if (e.hp <= 0.0f) {
kills += 1;
// Crystal = XP only. Buffs/debuffs come from rituals and other
// world objects, never from a kill drop.
pickup_system.spawn(e.pos, enemy_def(e.type).xp, rng);
buff_system.spawn_world_object(e.pos, rng, corruption.value());
events.push(EventType::EnemyKilled, e.pos, static_cast<float>(e.type));
buff_system.expire_subject(static_cast<int>(i));
enemy_system.enemies.remove_at(i);

View file

@ -71,7 +71,7 @@ public:
int kills = 0;
int level = 1;
float xp = 0.0f;
float xp_to_next = 6.0f;
float xp_to_next = 10.0f;
std::vector<Offer> pending_offers;
float offer_timer = 0.0f;

View file

@ -13,7 +13,8 @@ void PickupSystem::spawn(Vec2 pos, float value, Rng& rng) {
}
void PickupSystem::update(float dt, const Player& player, EventQueue& events,
float& xp_gained, BuffSystem& buff_system, EnemySystem& enemies) {
float& xp_gained) {
// Progression only: crystals give XP and never touch BuffSystem.
for (std::size_t i = 0; i < shards.size();) {
XpShard& s = shards[i];
const float d = distance(s.pos, player.pos);
@ -28,31 +29,4 @@ void PickupSystem::update(float dt, const Player& player, EventQueue& events,
++i;
}
}
// World objects of power: magnet catch applies the effect immediately —
// the player, or the nearest enemy if one is nearby (§4.6).
for (int i = 0; i < buff_system.world_object_count();) {
WorldObject& obj = buff_system.world_object(i);
if (distance(obj.pos, player.pos) < player.stats.pickup_radius) {
const Enemy* near = nullptr;
int near_idx = -1;
float near_d = 0.0f;
for (std::size_t j = 0; j < enemies.enemies.size(); ++j) {
const float d = distance(obj.pos, enemies.enemies[j].pos);
if (near == nullptr || d < near_d) {
near = &enemies.enemies[j];
near_idx = static_cast<int>(j);
near_d = d;
}
}
if (near != nullptr && near_d < 2.2f) {
buff_system.apply(near_idx, obj.effect, obj.duration, obj.name);
} else {
buff_system.apply(-1, obj.effect, obj.duration, obj.name);
}
buff_system.remove_world_object(i);
} else {
++i;
}
}
}

View file

@ -4,10 +4,11 @@
#include "core/math.hpp"
#include "core/pool.hpp"
#include "core/rng.hpp"
#include "game/buffs.hpp"
#include "game/enemies.hpp"
#include "game/player.hpp"
// Cyan Resonance crystals are progression-only: they carry XP and nothing
// else. Buffs/debuffs live in BuffSystem world objects and have their own
// catch rule (see buffs.hpp) — a shard can never apply one.
struct XpShard {
Vec2 pos{};
float value = 1.0f;
@ -18,9 +19,7 @@ struct PickupSystem {
void clear() { shards.clear(); }
void spawn(Vec2 pos, float value, Rng& rng);
// Magnet pull toward the player inside pickup_radius; collects on contact.
// World objects of power: magnet catch applies their effect on contact —
// the player, or the nearest enemy if one is nearby (§4.6).
void update(float dt, const Player& player, EventQueue& events, float& xp_gained,
BuffSystem& buff_system, EnemySystem& enemies);
// Magnet pull toward the player inside the shard pickup radius; collect
// on contact and pass the XP value back to the caller.
void update(float dt, const Player& player, EventQueue& events, float& xp_gained);
};

View file

@ -13,7 +13,7 @@ enum class Directive {
MaintenanceTraining, // +15% fire rate
LevitateDrill, // +12% move speed
BlackRockPlating, // +25 max HP
ResonanceAttunement, // +40% pickup radius
ResonanceAttunement, // +40% shard pickup radius (crystals only, not world objects)
PiercingRounds, // +1 pierce
BoardFavor, // +8% damage and fire rate
Count,

View file

@ -123,7 +123,7 @@ void RitualSystem::update(float dt, const Player& player, BuffSystem& buff_syste
if (state_ == State::InProgress && type_ == RitualType::Lightswitch) {
// A catch counts when the ritual's bait leaves the world-object pool
// (the magnet pick-up removes it, PickupSystem catches it).
// (BuffSystem's own catch field removes it — shards never touch it).
int pool_bait = 0;
for (int j = 0; j < buff_system.world_object_count(); ++j) {
if (std::strcmp(buff_system.world_object(j).name, kBaitName) == 0) ++pool_bait;

View file

@ -15,8 +15,8 @@ constexpr float kMuzzleSide = -0.32f; // the rifle sits on the agent's left
const WeaponDef kDefs[kWeaponTypeCount] = {
{WeaponType::Spin, "SPIN",
"Service Weapon: rapid resonant rounds at the nearest target",
14.0f, 0.55f, 42.0f, 1, 0.0f, 0.0f, 0.0f, 1.6f, 0.35f,
"Service Weapon: measured resonant rounds at the nearest target",
14.0f, 0.95f, 42.0f, 1, 0.0f, 0.0f, 0.0f, 1.6f, 0.35f,
Directive::PiercingRounds, "SPIN - CORRIDOR"},
{WeaponType::Shatter, "SHATTER",
"shotgun cone that shreds whatever is closest",
@ -36,9 +36,11 @@ const WeaponDef kDefs[kWeaponTypeCount] = {
Directive::ResonanceAttunement, "PROJECTOR - BRIEFING REEL"},
};
// Level scaling: level 4 ~= +105% damage, -24% cooldown.
float level_damage(int level) { return 1.0f + 0.35f * static_cast<float>(level - 1); }
float level_cooldown(int level) { return 1.0f - 0.08f * static_cast<float>(level - 1); }
// Level scaling: level 4 ~= +84% damage, -9% cooldown. The gentle cooldown
// ramp keeps OoP levels from turning into a projectile hose (see the pacing
// pass in docs/GAME_DESIGN_PASS.md).
float level_damage(int level) { return 1.0f + 0.28f * static_cast<float>(level - 1); }
float level_cooldown(int level) { return 1.0f - 0.03f * static_cast<float>(level - 1); }
const Enemy* nearest_enemy(const EnemySystem& enemies, Vec2 from, float max_range) {
const Enemy* target = nullptr;