feat: mock: neighbours and barbarians spread over the six map tiers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
42fbb4fd56
commit
228fb1d290
|
|
@ -1,6 +1,6 @@
|
||||||
// The mock's made-up neighbours: other players' villages round 0|0, so the map shows every
|
// The mock's made-up neighbours: other players' villages round 0|0, so the map shows every
|
||||||
// kind of village (tribe mates, allies, a NAP, enemies, strangers) in every size from a few
|
// kind of village (tribe mates, allies, a NAP, enemies, strangers) in every size from a
|
||||||
// huts to a walled town. Each player holds a patch of land, like real players' villages
|
// hamlet to a walled town. Each player holds a patch of land, like real players' villages
|
||||||
// bunch up. Placeholders only: the backend places real players.
|
// bunch up. Placeholders only: the backend places real players.
|
||||||
|
|
||||||
import type { MapRelationKind } from '~/types/map'
|
import type { MapRelationKind } from '~/types/map'
|
||||||
|
|
@ -27,13 +27,14 @@ const PLAYERS: Neighbour[] = [
|
||||||
]
|
]
|
||||||
const NAMES = ['Birkenhof', 'Dornach', 'Erlbach', 'Fichtau', 'Grauweiler', 'Haselgrund', 'Kalteneck', 'Lindwurm', 'Mühlstein', 'Nebelried', 'Ottersbach', 'Rotenfels']
|
const NAMES = ['Birkenhof', 'Dornach', 'Erlbach', 'Fichtau', 'Grauweiler', 'Haselgrund', 'Kalteneck', 'Lindwurm', 'Mühlstein', 'Nebelried', 'Ottersbach', 'Rotenfels']
|
||||||
|
|
||||||
/** Points from the lowest to the top of each of the map's five size tiers, and how common each is. */
|
/** Points from the lowest to the top of each of the map's six size tiers, and how common each is. */
|
||||||
const TIERS: [number, number, number][] = [
|
const TIERS: [number, number, number][] = [
|
||||||
[0.3, 40, 149],
|
[0.28, 40, 299],
|
||||||
[0.55, 150, 499],
|
[0.5, 300, 999],
|
||||||
[0.75, 500, 1499],
|
[0.7, 1000, 2999],
|
||||||
[0.9, 1500, 4999],
|
[0.84, 3000, 5999],
|
||||||
[1, 5000, 12000],
|
[0.93, 6000, 9999],
|
||||||
|
[1, 10000, 14000],
|
||||||
]
|
]
|
||||||
|
|
||||||
const MAP_SIZE = 1000
|
const MAP_SIZE = 1000
|
||||||
|
|
|
||||||
|
|
@ -770,7 +770,7 @@ function barbarianAt(x: number, y: number) {
|
||||||
const r = (Math.imul(x * 73856093 ^ y * 19349663, 1274126177) >>> 0) / 4294967296
|
const r = (Math.imul(x * 73856093 ^ y * 19349663, 1274126177) >>> 0) / 4294967296
|
||||||
const near = Math.abs(x) <= 30 && Math.abs(y) <= 30 && !traderAt(x, y) && !neighbourAt(x, y)
|
const near = Math.abs(x) <= 30 && Math.abs(y) <= 30 && !traderAt(x, y) && !neighbourAt(x, y)
|
||||||
const size = (Math.imul(x * 19349663 ^ y * 83492791, 1274126177) >>> 0) / 4294967296
|
const size = (Math.imul(x * 19349663 ^ y * 83492791, 1274126177) >>> 0) / 4294967296
|
||||||
return near && r < 0.08 ? { id: -((y - MAP_MIN) * MAP_SIZE + (x - MAP_MIN) + 1), name: BARBARIAN_NAME, points: 20 + Math.floor(size * size * 3000) } : null
|
return near && r < 0.08 ? { id: -((y - MAP_MIN) * MAP_SIZE + (x - MAP_MIN) + 1), name: BARBARIAN_NAME, points: 20 + Math.floor(size * size * 4000) } : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The season's crown forts, barbarian in the mock, on the backend's ring round 0|0. */
|
/** The season's crown forts, barbarian in the mock, on the backend's ring round 0|0. */
|
||||||
|
|
@ -1284,7 +1284,7 @@ function createVillage(state: MockState, user: AuthUser, worldId: number, now: n
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The player's second village a few fields from the first, its buildings grown to a town's (map size tier 3). */
|
/** The player's second village a few fields from the first, its buildings grown for a while (map size tier 2). */
|
||||||
function grownVillage(state: MockState, user: AuthUser, first: MockVillage, now: number): MockVillage {
|
function grownVillage(state: MockState, user: AuthUser, first: MockVillage, now: number): MockVillage {
|
||||||
const taken = new Set(state.villages.filter((v) => v.world_id === first.world_id).map((v) => `${v.x}|${v.y}`))
|
const taken = new Set(state.villages.filter((v) => v.world_id === first.world_id).map((v) => `${v.x}|${v.y}`))
|
||||||
const free = ([dx, dy]: [number, number]) => {
|
const free = ([dx, dy]: [number, number]) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue