phase 6: escalation effects + enhanced crisis system
- Add escalation effects module: creature speed/aggro/damage multipliers, reaction instability, environmental damage — all scale 0→1 - Add getCrisisPlayerDamage/getCrisisTint to crisis module - Integrate escalation effects into GameScene (env damage at high entropy) - Dynamic crisis overlay tint that intensifies with progress - Phase indicator shows entropy %, aggression multiplier, crisis status - 14 new tests for escalation + crisis damage/tint (349 total) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,9 +52,12 @@ import {
|
||||
createCrisisState,
|
||||
applyCrisisDamage,
|
||||
attemptNeutralize,
|
||||
getCrisisPlayerDamage,
|
||||
getCrisisTint,
|
||||
CHEMICAL_PLAGUE,
|
||||
type CrisisState,
|
||||
} from '../run/crisis';
|
||||
import { getEscalationEffects } from '../run/escalation';
|
||||
|
||||
export class GameScene extends Phaser.Scene {
|
||||
private gameWorld!: GameWorld;
|
||||
@@ -396,14 +399,26 @@ export class GameScene extends Phaser.Scene {
|
||||
// 9g. Crisis damage (if active)
|
||||
if (this.crisisState?.active) {
|
||||
applyCrisisDamage(this.crisisState, delta);
|
||||
// Crisis damages player slowly
|
||||
if (this.crisisState.progress > 0.3) {
|
||||
const crisisDmg = this.crisisState.progress * 0.5 * (delta / 1000);
|
||||
const crisisDmg = getCrisisPlayerDamage(this.crisisState, delta);
|
||||
if (crisisDmg > 0) {
|
||||
Health.current[this.playerEid] = Math.max(
|
||||
0,
|
||||
(Health.current[this.playerEid] ?? 0) - crisisDmg,
|
||||
);
|
||||
}
|
||||
// Update crisis visual tint
|
||||
const tint = getCrisisTint(this.crisisState);
|
||||
this.crisisOverlay.setFillStyle(tint.color, tint.alpha);
|
||||
}
|
||||
|
||||
// 9h. Environmental damage from high escalation
|
||||
const escalationFx = getEscalationEffects(this.runState.escalation);
|
||||
if (escalationFx.environmentalDamage > 0) {
|
||||
const envDmg = escalationFx.environmentalDamage * (delta / 1000);
|
||||
Health.current[this.playerEid] = Math.max(
|
||||
0,
|
||||
(Health.current[this.playerEid] ?? 0) - envDmg,
|
||||
);
|
||||
}
|
||||
|
||||
// 10. Health / death
|
||||
@@ -493,8 +508,14 @@ export class GameScene extends Phaser.Scene {
|
||||
// Update phase indicator
|
||||
const phaseName = RUN_PHASE_NAMES_RU[this.runState.phase];
|
||||
const escalationPct = Math.round(this.runState.escalation * 100);
|
||||
const crisisInfo = this.crisisState?.active ? ` | ЧУМА: ${Math.round(this.crisisState.progress * 100)}%` : '';
|
||||
this.phaseText.setText(`${phaseName} | Эскалация: ${escalationPct}%${crisisInfo}`);
|
||||
const crisisInfo = this.crisisState?.active
|
||||
? ` | ☠ ЧУМА: ${Math.round(this.crisisState.progress * 100)}%`
|
||||
: this.runState.crisisResolved ? ' | ✓ Чума нейтрализована' : '';
|
||||
const escFx = getEscalationEffects(this.runState.escalation);
|
||||
const speedInfo = escFx.creatureSpeedMultiplier > 1.05
|
||||
? ` | Агрессия: ×${escFx.creatureAttackMultiplier.toFixed(1)}`
|
||||
: '';
|
||||
this.phaseText.setText(`${phaseName} | Энтропия: ${escalationPct}%${speedInfo}${crisisInfo}`);
|
||||
|
||||
// Color phase text based on danger
|
||||
if (this.runState.phase >= RunPhase.Crisis) {
|
||||
|
||||
Reference in New Issue
Block a user