phase 10: schools — Mechanic, Naturalist, Navigator with unlock system and bonuses
Add 3 new schools with real scientific principles (Lever & Moment, Photosynthesis, Angular Measurement). Data-driven unlock conditions check codex elements, creature discoveries, and completed runs. Each school provides passive gameplay bonuses (projectile damage, movement speed, creature aggro range, reaction efficiency) applied through system multiplier parameters. CradleScene shows all 4 schools with locked ones grayed out and showing unlock hints. 24 new tests (511 total). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -53,12 +53,14 @@ export interface ProjectileHit {
|
||||
* Check projectile-creature collisions.
|
||||
* Removes hitting projectiles and deals damage to creatures.
|
||||
*
|
||||
* @param damageMultiplier — optional multiplier on projectile damage (default 1.0, e.g. Mechanic bonus)
|
||||
* @returns Array of hits that occurred
|
||||
*/
|
||||
export function creatureProjectileSystem(
|
||||
world: World,
|
||||
projData: Map<number, ProjectileData>,
|
||||
speciesLookup: Map<number, SpeciesData>,
|
||||
damageMultiplier = 1.0,
|
||||
): ProjectileHit[] {
|
||||
const hits: ProjectileHit[] = [];
|
||||
const projectiles = query(world, [Position, Projectile]);
|
||||
@@ -76,10 +78,10 @@ export function creatureProjectileSystem(
|
||||
const dSq = dx * dx + dy * dy;
|
||||
|
||||
if (dSq <= HIT_RADIUS_SQ) {
|
||||
// Hit! Calculate damage (with armor reduction)
|
||||
// Hit! Calculate damage (with armor reduction and school bonus)
|
||||
const species = speciesLookup.get(Creature.speciesId[cEid]);
|
||||
const armor = species?.armor ?? 0;
|
||||
const damage = Math.round(PROJECTILE_BASE_DAMAGE * (1 - armor));
|
||||
const damage = Math.round(PROJECTILE_BASE_DAMAGE * (1 - armor) * damageMultiplier);
|
||||
|
||||
Health.current[cEid] -= damage;
|
||||
const killed = Health.current[cEid] <= 0;
|
||||
|
||||
Reference in New Issue
Block a user