raiders
The ronin fleet and how it fights, for *Ninja Pirates of the Baltic*. Part of SLICE A (the raid); `game.raid` is the only thing that requires it.
raiders
The ronin fleet and how it fights, for Ninja Pirates of the Baltic. Part of
SLICE A (the raid); game.raid is the only thing that requires it.
local Raiders = require("game.raid.raiders")
local fleet = Raiders.create(NPB, hooks, tune)
It asks NPB.fleet() for its hulls and never builds one. The records live on
NPB.state.raiders.
The behaviour
A raider runs one of four modes:
| mode | |
|---|---|
approach | steer straight at the player until inside engageRange |
circle | hold a tangent at standoff, and fire whenever the player is abeam |
shadow | the fight is full — hold the wider shadowStandoff ring and wait for a slot |
break | sheer off for breakTime after volleysBeforeBreak volleys, then come round again |
Only maxEngaged raiders are in circle at a time, and only a raider in
circle fires. Without that cap the whole fleet converges at once: measured
against a boat that never shot back, five simultaneous attackers emptied a full
hull in six seconds — before the player had closed on any of them.
Guns bear on the beam, so a raider holds fire while the player is off its bow or its stern. That is what makes the circle read as a manoeuvre rather than a loiter.
aggression (1.0 at the start of a run, climbing with every rift stone the
player takes) shortens the gun cooldown, shortens the time spent sheering off,
and adds a little speed.
Sinking
damage(rec, amount) takes hull off and returns true on the blow that sinks.
A raider whose hull reaches zero any other way also goes down — the update
checks the invariant directly, because otherwise a record emptied outside
damage() sails on forever at a negative number, alive to every count and
immune to being sunk.
Going down takes sinkTime: the hull drops and rolls, then despawns and the
sunk hook fires, which is where the rift stone is dropped.
Rules it follows
Every raider keeps its own logical x / z; the entity carries that plus the
wave's displacement and is never read back. Every write is guarded by
entity.exists, because a scene reload destroys everything.
Scoped to this part · feeds back into the world's score.