diff --git a/src/game/combat.ts b/src/game/combat.ts index 7ee4a60..02aa5ce 100644 --- a/src/game/combat.ts +++ b/src/game/combat.ts @@ -27,6 +27,7 @@ import { partitionMapIntoRooms, spawnMonsterPacksByRooms, spawnPacksInRoom, + PACK_RADIUS_PX, } from './monster-rooms.ts' import type { MapRoom } from './monster-rooms.ts' @@ -453,14 +454,7 @@ export interface MonsterPack { readonly superUniqueId?: string } -/** - * How far a pack's members sit from their camp centre, in pixels. - * - * Two cells across. A pack has to read as one thing from the player's distance - * — close enough that pulling one pulls the rest, far enough that the sprites - * do not overlap. A cell is 80 wide, and a monster body is about 20. - */ -const PACK_RADIUS_PX = 96 + function isInsideSafeZone(x: number, y: number, safeZones: readonly SafeZone[] | undefined): boolean { if (safeZones === undefined || safeZones.length === 0) return false diff --git a/src/game/wilderness-acts.ts b/src/game/wilderness-acts.ts index 3a31bef..0ef17e5 100644 --- a/src/game/wilderness-acts.ts +++ b/src/game/wilderness-acts.ts @@ -22,6 +22,7 @@ import type { PlacedPresetRect, } from './wilderness.ts' import { stampDs1, TILES_PER_BLOCK, emptyFloor, emptyWall } from './wilderness.ts' +import { SUB_TILES_PER_TILE } from './map.ts' /* ------------------------------------------------------------------------- * * Statistics interfaces @@ -344,8 +345,8 @@ export function initAct2OutdoorLevel( canvas.objects.push({ type: 2, id: 66 + i, - x: (tc.x + 3) * 5, - y: (tc.y + 3) * 5, + x: (tc.x + 3) * SUB_TILES_PER_TILE, + y: (tc.y + 3) * SUB_TILES_PER_TILE, flags: 0, }) tombEntrances += 1 @@ -369,8 +370,8 @@ export function initAct2OutdoorLevel( canvas.objects.push({ type: 2, id: 74, - x: (warpX + 4) * 5, - y: (warpY + 4) * 5, + x: (warpX + 4) * SUB_TILES_PER_TILE, + y: (warpY + 4) * SUB_TILES_PER_TILE, flags: 0, }) } diff --git a/src/game/wilderness.ts b/src/game/wilderness.ts index 0381a72..b0e662d 100644 --- a/src/game/wilderness.ts +++ b/src/game/wilderness.ts @@ -2560,22 +2560,38 @@ function applySubstitutions( * landmarks: the fallen bivouac camp, the pond, the cow corral, and swamp/stone * fills. */ +export const BLOOD_MOOR_RIVER_PRESETS: readonly string[] = [ + 'Act 1 - DOE Entrance', + 'Act 1 - River Upper', + 'Act 1 - River Lower', + 'Act 1 - Bridge', + 'Act 1 - Fence Fill 1', + 'Act 1 - Fence Fill 3', + 'Act 1 - Ruin', + 'Act 1 - Cottages 1', + 'Act 1 - Corral Fill', + 'Act 1 - Fence Fill 4', + 'Act 1 - Fence Fill 5', + 'Act 1 - Stone Fill 1', + 'Act 1 - Stone Fill 2', +] + +export const BLOOD_MOOR_POND_PRESETS: readonly string[] = [ + 'Act 1 - DOE Entrance', + 'Act 1 - Pond', + 'Act 1 - Fence Fill 1', + 'Act 1 - Fence Fill 3', + 'Act 1 - Ruin', + 'Act 1 - Cottages 1', + 'Act 1 - Corral Fill', + 'Act 1 - Fence Fill 4', + 'Act 1 - Fence Fill 5', + 'Act 1 - Stone Fill 1', + 'Act 1 - Stone Fill 2', +] + export const SPECIAL_PRESETS_BY_LEVEL: Readonly> = { - 2: [ - 'Act 1 - DOE Entrance', - 'Act 1 - River Upper', - 'Act 1 - River Lower', - 'Act 1 - Bridge', - 'Act 1 - Fence Fill 1', - 'Act 1 - Fence Fill 3', - 'Act 1 - Ruin', - 'Act 1 - Cottages 1', - 'Act 1 - Corral Fill', - 'Act 1 - Fence Fill 4', - 'Act 1 - Fence Fill 5', - 'Act 1 - Stone Fill 1', - 'Act 1 - Stone Fill 2', - ], + 2: BLOOD_MOOR_RIVER_PRESETS, 3: [ 'Act 1 - Cave Entrance', 'Act 1 - Fallen Camp Bishibosh', @@ -5375,35 +5391,7 @@ export function generateWilderness(request: WildernessRequest): WildernessResult if (request.levelId === 2) { // Blood Moor has a chance (50%) of spawning river water + bridge, or pond const hasRiver = rng.int(0, 1) === 0 - specialPresetNames = hasRiver - ? [ - 'Act 1 - DOE Entrance', - 'Act 1 - River Upper', - 'Act 1 - River Lower', - 'Act 1 - Bridge', - 'Act 1 - Fence Fill 1', - 'Act 1 - Fence Fill 3', - 'Act 1 - Ruin', - 'Act 1 - Cottages 1', - 'Act 1 - Corral Fill', - 'Act 1 - Fence Fill 4', - 'Act 1 - Fence Fill 5', - 'Act 1 - Stone Fill 1', - 'Act 1 - Stone Fill 2', - ] - : [ - 'Act 1 - DOE Entrance', - 'Act 1 - Pond', - 'Act 1 - Fence Fill 1', - 'Act 1 - Fence Fill 3', - 'Act 1 - Ruin', - 'Act 1 - Cottages 1', - 'Act 1 - Corral Fill', - 'Act 1 - Fence Fill 4', - 'Act 1 - Fence Fill 5', - 'Act 1 - Stone Fill 1', - 'Act 1 - Stone Fill 2', - ] + specialPresetNames = hasRiver ? BLOOD_MOOR_RIVER_PRESETS : BLOOD_MOOR_POND_PRESETS } else { specialPresetNames = SPECIAL_PRESETS_BY_LEVEL[request.levelId] ?? [] }