@rpgm-tools/neo-angband-core 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/entity-views.d.ts +62 -0
- package/dist/agent/entity-views.d.ts.map +1 -0
- package/dist/agent/entity-views.js +195 -0
- package/dist/agent/entity-views.js.map +1 -0
- package/dist/agent/index.d.ts +5 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -0
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/loadout.d.ts +97 -0
- package/dist/agent/loadout.d.ts.map +1 -0
- package/dist/agent/loadout.js +312 -0
- package/dist/agent/loadout.js.map +1 -0
- package/dist/agent/perceive.d.ts.map +1 -1
- package/dist/agent/perceive.js +16 -162
- package/dist/agent/perceive.js.map +1 -1
- package/dist/agent/types.d.ts +167 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js +10 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/game/context.d.ts +15 -0
- package/dist/game/context.d.ts.map +1 -1
- package/dist/game/context.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mod/registry-host.d.ts +97 -0
- package/dist/mod/registry-host.d.ts.map +1 -1
- package/dist/mod/registry-host.js +7 -0
- package/dist/mod/registry-host.js.map +1 -1
- package/dist/mod/save-blocks.d.ts +1 -1
- package/dist/player/calcs.d.ts +9 -0
- package/dist/player/calcs.d.ts.map +1 -1
- package/dist/player/calcs.js +13 -1
- package/dist/player/calcs.js.map +1 -1
- package/dist/player/loadout.d.ts +178 -0
- package/dist/player/loadout.d.ts.map +1 -0
- package/dist/player/loadout.js +172 -0
- package/dist/player/loadout.js.map +1 -0
- package/dist/player/spell.d.ts +21 -1
- package/dist/player/spell.d.ts.map +1 -1
- package/dist/player/spell.js +53 -14
- package/dist/player/spell.js.map +1 -1
- package/dist/session/game.d.ts +39 -0
- package/dist/session/game.d.ts.map +1 -1
- package/dist/session/game.js +201 -31
- package/dist/session/game.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/agent/entity-views.ts +227 -0
- package/src/agent/index.ts +9 -0
- package/src/agent/loadout.ts +400 -0
- package/src/agent/perceive.ts +22 -168
- package/src/agent/types.ts +166 -2
- package/src/game/context.ts +18 -0
- package/src/index.ts +1 -0
- package/src/mod/registry-host.ts +108 -0
- package/src/player/calcs.ts +22 -1
- package/src/player/loadout.ts +331 -0
- package/src/player/spell.ts +67 -16
- package/src/session/game.ts +287 -35
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ import { Rng, ENGINE_VERSION, PARITY_BASELINE } from "@rpgm-tools/neo-angband-co
|
|
|
32
32
|
const rng = new Rng(1234);
|
|
33
33
|
console.log(rng.damroll(3, 6), rng.damroll(3, 6), rng.damroll(3, 6)); // 9 13 8
|
|
34
34
|
|
|
35
|
-
console.log(ENGINE_VERSION, PARITY_BASELINE); // 0.
|
|
35
|
+
console.log(ENGINE_VERSION, PARITY_BASELINE); // 0.26.0 4.2.6
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
Two entry points:
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two plain-data view builders the perceive facade and the loadout
|
|
3
|
+
* simulation SHARE: one object as an `ItemView`, and the player as a
|
|
4
|
+
* `PlayerView`.
|
|
5
|
+
*
|
|
6
|
+
* They live in their own module rather than in perceive.ts for one reason.
|
|
7
|
+
* `agent/loadout.ts` describes a loadout the player is not wearing, and it has
|
|
8
|
+
* to describe it in the same shape and through the same builders as the live
|
|
9
|
+
* view - an `ItemView` carrying `value` in one and not the other would change
|
|
10
|
+
* what an agent decides about the same object depending on which view handed it
|
|
11
|
+
* over. Having both importers reach the same function is what makes that
|
|
12
|
+
* structural instead of a convention, and it keeps the import graph one-way
|
|
13
|
+
* (perceive and loadout both depend on this; neither depends on the other).
|
|
14
|
+
*/
|
|
15
|
+
import type { FlagSet } from "../bitflag.js";
|
|
16
|
+
import type { GameState } from "../game/context.js";
|
|
17
|
+
import type { GameObject } from "../obj/object.js";
|
|
18
|
+
import type { PlayerState } from "../player/calcs.js";
|
|
19
|
+
import type { PlayerCombatState } from "../combat/melee.js";
|
|
20
|
+
import type { AgentViewDeps, ItemView, PlayerView } from "./types.js";
|
|
21
|
+
/** OF_* codes for the set flags in an object-flag FlagSet (OF is 1-indexed). */
|
|
22
|
+
export declare function ofCodes(flags: FlagSet): string[];
|
|
23
|
+
/**
|
|
24
|
+
* One object as an ItemView. `handle` is 0 for anything not in the gear.
|
|
25
|
+
*
|
|
26
|
+
* `count` overrides obj->number for both the reported stack size and the value
|
|
27
|
+
* quantity. It exists for the hypothetical loadouts in agent/loadout.ts, where
|
|
28
|
+
* "three of the five potions I am carrying" and "one of the twelve on that
|
|
29
|
+
* shelf" are real cases and the object itself must not be touched to express
|
|
30
|
+
* them. Absent, the object's own number is used, which is every live read.
|
|
31
|
+
*/
|
|
32
|
+
export declare function itemView(handle: number, obj: GameObject, state: GameState, deps: AgentViewDeps, count?: number): ItemView;
|
|
33
|
+
/**
|
|
34
|
+
* The derived facts playerViewFor reads off the live actor, supplied explicitly
|
|
35
|
+
* so a HYPOTHETICAL loadout can be described in exactly the same shape (see
|
|
36
|
+
* agent/loadout.ts). Absent, the live values are used, which is the ordinary
|
|
37
|
+
* perceive path.
|
|
38
|
+
*
|
|
39
|
+
* Only the fields a loadout can move are here. Level, experience, gold, grid,
|
|
40
|
+
* timed status and the rest are properties of the character rather than of what
|
|
41
|
+
* it is wearing, so a simulated view reports the live ones.
|
|
42
|
+
*/
|
|
43
|
+
export interface PlayerViewDerived {
|
|
44
|
+
playerState: PlayerState;
|
|
45
|
+
combat: PlayerCombatState;
|
|
46
|
+
speed: number;
|
|
47
|
+
light: number;
|
|
48
|
+
maxHp: number;
|
|
49
|
+
maxSp: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a PlayerView from the live game, or - with `over` - from a derive for a
|
|
53
|
+
* loadout the player is not wearing.
|
|
54
|
+
*
|
|
55
|
+
* NOTE on `skills`: this is p->skills, the birth-time level-based skill array
|
|
56
|
+
* (calcSkills), NOT state->skills. It is not a function of the worn loadout, so
|
|
57
|
+
* a simulated view carries the live one, exactly as the live view does. The full
|
|
58
|
+
* derived skills, equipment contributions included, are on
|
|
59
|
+
* DerivedStatsView.skills (player/loadout.ts).
|
|
60
|
+
*/
|
|
61
|
+
export declare function playerViewFor(state: GameState, deps: AgentViewDeps, over?: PlayerViewDerived): PlayerView;
|
|
62
|
+
//# sourceMappingURL=entity-views.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-views.d.ts","sourceRoot":"","sources":["../../src/agent/entity-views.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEtE,gFAAgF;AAChF,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAOhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,aAAa,EACnB,KAAK,CAAC,EAAE,MAAM,GACb,QAAQ,CAyFV;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,aAAa,EACnB,IAAI,CAAC,EAAE,iBAAiB,GACvB,UAAU,CAoDZ"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two plain-data view builders the perceive facade and the loadout
|
|
3
|
+
* simulation SHARE: one object as an `ItemView`, and the player as a
|
|
4
|
+
* `PlayerView`.
|
|
5
|
+
*
|
|
6
|
+
* They live in their own module rather than in perceive.ts for one reason.
|
|
7
|
+
* `agent/loadout.ts` describes a loadout the player is not wearing, and it has
|
|
8
|
+
* to describe it in the same shape and through the same builders as the live
|
|
9
|
+
* view - an `ItemView` carrying `value` in one and not the other would change
|
|
10
|
+
* what an agent decides about the same object depending on which view handed it
|
|
11
|
+
* over. Having both importers reach the same function is what makes that
|
|
12
|
+
* structural instead of a convention, and it keeps the import graph one-way
|
|
13
|
+
* (perceive and loadout both depend on this; neither depends on the other).
|
|
14
|
+
*/
|
|
15
|
+
import { ELEMENT_ENTRIES, OBJECT_FLAG_ENTRIES, TMD } from "../generated/index.js";
|
|
16
|
+
import { OBJ_MOD_NAMES } from "../obj/bind.js";
|
|
17
|
+
import { objectValue } from "../obj/value.js";
|
|
18
|
+
/** OF_* codes for the set flags in an object-flag FlagSet (OF is 1-indexed). */
|
|
19
|
+
export function ofCodes(flags) {
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const f of flags) {
|
|
22
|
+
const entry = OBJECT_FLAG_ENTRIES[f - 1];
|
|
23
|
+
if (entry)
|
|
24
|
+
out.push(entry.name);
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One object as an ItemView. `handle` is 0 for anything not in the gear.
|
|
30
|
+
*
|
|
31
|
+
* `count` overrides obj->number for both the reported stack size and the value
|
|
32
|
+
* quantity. It exists for the hypothetical loadouts in agent/loadout.ts, where
|
|
33
|
+
* "three of the five potions I am carrying" and "one of the twelve on that
|
|
34
|
+
* shelf" are real cases and the object itself must not be touched to express
|
|
35
|
+
* them. Absent, the object's own number is used, which is every live read.
|
|
36
|
+
*/
|
|
37
|
+
export function itemView(handle, obj, state, deps, count) {
|
|
38
|
+
const number = count ?? obj.number;
|
|
39
|
+
const modifiers = [];
|
|
40
|
+
for (let i = 0; i < obj.modifiers.length; i++) {
|
|
41
|
+
const value = obj.modifiers[i] ?? 0;
|
|
42
|
+
if (value === 0)
|
|
43
|
+
continue;
|
|
44
|
+
const code = OBJ_MOD_NAMES[i];
|
|
45
|
+
if (code)
|
|
46
|
+
modifiers.push({ code, value });
|
|
47
|
+
}
|
|
48
|
+
const brands = [];
|
|
49
|
+
if (obj.brands) {
|
|
50
|
+
for (let i = 0; i < obj.brands.length; i++) {
|
|
51
|
+
if (!obj.brands[i])
|
|
52
|
+
continue;
|
|
53
|
+
const code = state.brands[i]?.code;
|
|
54
|
+
if (code)
|
|
55
|
+
brands.push(code);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const slays = [];
|
|
59
|
+
if (obj.slays) {
|
|
60
|
+
for (let i = 0; i < obj.slays.length; i++) {
|
|
61
|
+
if (!obj.slays[i])
|
|
62
|
+
continue;
|
|
63
|
+
const code = state.slays[i]?.code;
|
|
64
|
+
if (code)
|
|
65
|
+
slays.push(code);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const resists = [];
|
|
69
|
+
for (let i = 0; i < obj.elInfo.length; i++) {
|
|
70
|
+
const level = obj.elInfo[i]?.resLevel ?? 0;
|
|
71
|
+
if (level === 0)
|
|
72
|
+
continue;
|
|
73
|
+
const name = ELEMENT_ENTRIES[i]?.name;
|
|
74
|
+
if (name)
|
|
75
|
+
resists.push({ element: name, level });
|
|
76
|
+
}
|
|
77
|
+
const curses = [];
|
|
78
|
+
if (obj.curses) {
|
|
79
|
+
for (let i = 0; i < obj.curses.length; i++) {
|
|
80
|
+
const power = obj.curses[i]?.power ?? 0;
|
|
81
|
+
if (power <= 0)
|
|
82
|
+
continue;
|
|
83
|
+
/* Curse names resolve from the always-present RuneEnv curse table (real
|
|
84
|
+
* in production, inert [null] in the worldless harness), then the
|
|
85
|
+
* optional registry dep, then the numeric index as a last resort. */
|
|
86
|
+
curses.push(state.runeEnv.curses[i]?.name ??
|
|
87
|
+
deps.reg?.curses[i]?.name ??
|
|
88
|
+
String(i));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const view = {
|
|
92
|
+
handle,
|
|
93
|
+
label: obj.kind.name,
|
|
94
|
+
tval: obj.tval,
|
|
95
|
+
sval: obj.sval,
|
|
96
|
+
pval: obj.pval,
|
|
97
|
+
number,
|
|
98
|
+
weight: obj.weight,
|
|
99
|
+
ac: obj.ac,
|
|
100
|
+
toA: obj.toA,
|
|
101
|
+
toH: obj.toH,
|
|
102
|
+
toD: obj.toD,
|
|
103
|
+
dd: obj.dd,
|
|
104
|
+
ds: obj.ds,
|
|
105
|
+
ego: obj.ego !== null,
|
|
106
|
+
artifact: obj.artifact !== null,
|
|
107
|
+
flags: ofCodes(obj.flags),
|
|
108
|
+
modifiers,
|
|
109
|
+
brands,
|
|
110
|
+
slays,
|
|
111
|
+
resists,
|
|
112
|
+
curses,
|
|
113
|
+
egoName: obj.ego?.name ?? null,
|
|
114
|
+
artifactName: obj.artifact?.name ?? null,
|
|
115
|
+
activation: obj.activation !== null,
|
|
116
|
+
timeout: obj.timeout,
|
|
117
|
+
inscription: obj.note ?? null,
|
|
118
|
+
};
|
|
119
|
+
if (deps.resolver) {
|
|
120
|
+
const kindId = deps.resolver.kindIdOrNull(obj.kind.kidx);
|
|
121
|
+
if (kindId !== null)
|
|
122
|
+
view.kindId = kindId;
|
|
123
|
+
}
|
|
124
|
+
if (deps.reg) {
|
|
125
|
+
const aware = deps.aware ?? (() => true);
|
|
126
|
+
view.value = objectValue(deps.reg, obj, number, aware(obj.kind));
|
|
127
|
+
}
|
|
128
|
+
return view;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Build a PlayerView from the live game, or - with `over` - from a derive for a
|
|
132
|
+
* loadout the player is not wearing.
|
|
133
|
+
*
|
|
134
|
+
* NOTE on `skills`: this is p->skills, the birth-time level-based skill array
|
|
135
|
+
* (calcSkills), NOT state->skills. It is not a function of the worn loadout, so
|
|
136
|
+
* a simulated view carries the live one, exactly as the live view does. The full
|
|
137
|
+
* derived skills, equipment contributions included, are on
|
|
138
|
+
* DerivedStatsView.skills (player/loadout.ts).
|
|
139
|
+
*/
|
|
140
|
+
export function playerViewFor(state, deps, over) {
|
|
141
|
+
const p = state.actor.player;
|
|
142
|
+
const combat = over ? over.combat : state.actor.combat;
|
|
143
|
+
const playerState = over ? over.playerState : state.playerState;
|
|
144
|
+
const view = {
|
|
145
|
+
race: p.race.name,
|
|
146
|
+
cls: p.cls.name,
|
|
147
|
+
level: p.lev,
|
|
148
|
+
maxLevel: p.maxLev,
|
|
149
|
+
exp: p.exp,
|
|
150
|
+
maxExp: p.maxExp,
|
|
151
|
+
gold: p.au,
|
|
152
|
+
depth: state.chunk.depth,
|
|
153
|
+
maxDepth: p.maxDepth,
|
|
154
|
+
hp: p.chp,
|
|
155
|
+
maxHp: over ? over.maxHp : p.mhp,
|
|
156
|
+
sp: p.csp,
|
|
157
|
+
maxSp: over ? over.maxSp : p.msp,
|
|
158
|
+
speed: over ? over.speed : state.actor.speed,
|
|
159
|
+
/* Displayed AC is state->ac + state->to_a. */
|
|
160
|
+
ac: combat.ac + combat.toA,
|
|
161
|
+
toHit: combat.toH,
|
|
162
|
+
toDam: combat.toD,
|
|
163
|
+
stats: [...p.statCur],
|
|
164
|
+
light: over ? over.light : state.actor.light,
|
|
165
|
+
grid: { x: state.actor.grid.x, y: state.actor.grid.y },
|
|
166
|
+
status: {
|
|
167
|
+
blind: p.timed[TMD.BLIND] ?? 0,
|
|
168
|
+
confused: p.timed[TMD.CONFUSED] ?? 0,
|
|
169
|
+
afraid: p.timed[TMD.AFRAID] ?? 0,
|
|
170
|
+
poisoned: p.timed[TMD.POISONED] ?? 0,
|
|
171
|
+
cut: p.timed[TMD.CUT] ?? 0,
|
|
172
|
+
stun: p.timed[TMD.STUN] ?? 0,
|
|
173
|
+
paralyzed: p.timed[TMD.PARALYZED] ?? 0,
|
|
174
|
+
food: p.timed[TMD.FOOD] ?? 0,
|
|
175
|
+
},
|
|
176
|
+
dead: state.isDead,
|
|
177
|
+
winner: p.totalWinner,
|
|
178
|
+
skills: [...p.skills],
|
|
179
|
+
shape: p.shape?.name ?? null,
|
|
180
|
+
objectFlags: playerState ? ofCodes(playerState.flags) : [],
|
|
181
|
+
seeInfra: playerState?.seeInfra ?? p.race.infravision,
|
|
182
|
+
blows: combat.numBlows,
|
|
183
|
+
shots: combat.numShots,
|
|
184
|
+
};
|
|
185
|
+
if (deps.resolver) {
|
|
186
|
+
const raceId = deps.resolver.playerRaceIdOrNull(p.race.ridx);
|
|
187
|
+
if (raceId !== null)
|
|
188
|
+
view.playerRaceId = raceId;
|
|
189
|
+
const classId = deps.resolver.playerClassIdOrNull(p.cls.cidx);
|
|
190
|
+
if (classId !== null)
|
|
191
|
+
view.playerClassId = classId;
|
|
192
|
+
}
|
|
193
|
+
return view;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=entity-views.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-views.js","sourceRoot":"","sources":["../../src/agent/entity-views.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAA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CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9D,IAAI,OAAO,KAAK,IAAI;YAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -8,8 +8,12 @@
|
|
|
8
8
|
* from here (see types.ts freeze note).
|
|
9
9
|
*/
|
|
10
10
|
export { AGENT_API_VERSION, AGENT_STATE_DOMAINS } from "./types.js";
|
|
11
|
-
export type { AgentCapabilities, AgentCommand, AgentActions, AgentGlyphSource, AgentController, AgentSession, AgentView, AgentViewDeps, CellView, ControllerOptions, ItemView, MonsterView, PlayerStatusView, PlayerView, SpellbookView, SpellView, StoreItemView, StoreView, TargetView, } from "./types.js";
|
|
11
|
+
export type { AgentCapabilities, AgentCommand, AgentActions, AgentGlyphSource, AgentController, AgentSession, AgentView, AgentViewDeps, CellView, ControllerOptions, ItemView, LoadoutChange, LoadoutItemRef, LoadoutPlacement, LoadoutSimulation, LoadoutView, MonsterView, PlayerStatusView, PlayerView, SpellbookView, SpellView, StoreItemView, StoreView, TargetView, } from "./types.js";
|
|
12
12
|
export { createAgentView } from "./perceive.js";
|
|
13
|
+
export { itemView, playerViewFor } from "./entity-views.js";
|
|
14
|
+
export type { PlayerViewDerived } from "./entity-views.js";
|
|
15
|
+
export { simulateLoadout } from "./loadout.js";
|
|
16
|
+
export type { LoadoutDerive, LoadoutSimOptions } from "./loadout.js";
|
|
13
17
|
export { createAgentActions } from "./act.js";
|
|
14
18
|
export { AgentCapabilityError, installController } from "./controller.js";
|
|
15
19
|
export { subscribeEvents } from "./events.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY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,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/agent/index.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { AGENT_API_VERSION, AGENT_STATE_DOMAINS } from "./types.js";
|
|
11
11
|
export { createAgentView } from "./perceive.js";
|
|
12
|
+
export { itemView, playerViewFor } from "./entity-views.js";
|
|
13
|
+
export { simulateLoadout } from "./loadout.js";
|
|
12
14
|
export { createAgentActions } from "./act.js";
|
|
13
15
|
export { AgentCapabilityError, installController } from "./controller.js";
|
|
14
16
|
export { subscribeEvents } from "./events.js";
|
package/dist/agent/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA2BpE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the character would BE, wearing something else.
|
|
3
|
+
*
|
|
4
|
+
* ------------------------------------------------------------------
|
|
5
|
+
* WHY THIS EXISTS
|
|
6
|
+
* ------------------------------------------------------------------
|
|
7
|
+
*
|
|
8
|
+
* `calc_bonuses` (player/calcs.ts) answers "what is this character, in this
|
|
9
|
+
* gear". Two consumers need the same answer for gear the character is not in:
|
|
10
|
+
*
|
|
11
|
+
* 1. An autoplayer deciding whether to wear, buy or sell a thing. Upstream's
|
|
12
|
+
* borg does exactly this by WIELDING the candidate, recomputing, and
|
|
13
|
+
* reverting (borg-power.c / borg_notice).
|
|
14
|
+
* 2. A player asking what an item would do for them, which wants the whole
|
|
15
|
+
* difference and not a score - which resist went, what happened to mana,
|
|
16
|
+
* whether the weapon is now too heavy to swing properly.
|
|
17
|
+
*
|
|
18
|
+
* The trap either one falls into alone is summing the item's own bonuses. That
|
|
19
|
+
* is a second implementation of calc_bonuses, it cannot see the interactions
|
|
20
|
+
* (the STR ring that changes the blow count, the cuirass that costs a caster
|
|
21
|
+
* mana, the weight that costs speed), and it drifts from the real derive with
|
|
22
|
+
* nothing to notice. So this module runs the REAL derive, `update: false`, over
|
|
23
|
+
* a hypothetical equipment array, and nothing in the live game is written.
|
|
24
|
+
*
|
|
25
|
+
* ------------------------------------------------------------------
|
|
26
|
+
* WHERE THE DERIVE COMES FROM, AND WHY IT IS NOT BUILT HERE
|
|
27
|
+
* ------------------------------------------------------------------
|
|
28
|
+
*
|
|
29
|
+
* `state.derivedFor` is installed by the session (session/game.ts wireGame),
|
|
30
|
+
* which is the only place that holds the whole calc_bonuses options bag: the
|
|
31
|
+
* bound timed-effect table and the curse registry travel with it. A derive
|
|
32
|
+
* assembled here would have to guess at both, and a hypothetical loadout
|
|
33
|
+
* measured with a thinner bag than the live one is worse than no answer - it
|
|
34
|
+
* looks like an answer. So an absent `derivedFor` produces null.
|
|
35
|
+
*
|
|
36
|
+
* ------------------------------------------------------------------
|
|
37
|
+
* WHAT IS AND IS NOT MODELLED
|
|
38
|
+
* ------------------------------------------------------------------
|
|
39
|
+
*
|
|
40
|
+
* Modelled: the worn set, per body slot, through the engine's own wield_slot; the
|
|
41
|
+
* carried weight, because the STR encumbrance penalty reads it and buying heavy
|
|
42
|
+
* armour is exactly where that bites; max hitpoints (a CON change moves them) and
|
|
43
|
+
* max mana with the armour encumbrance (a caster's real cost of plate).
|
|
44
|
+
*
|
|
45
|
+
* NOT modelled: anything that happens as a CONSEQUENCE of the change rather than
|
|
46
|
+
* being the change - the gold a purchase costs, an inscription, learning a rune
|
|
47
|
+
* by wearing the thing. Those are outcomes of the action, not of the loadout, and
|
|
48
|
+
* a comparison that folded them in would be answering a different question.
|
|
49
|
+
*/
|
|
50
|
+
import type { PlayerState } from "../player/calcs.js";
|
|
51
|
+
import type { GameObject } from "../obj/object.js";
|
|
52
|
+
import type { GameState } from "../game/context.js";
|
|
53
|
+
import type { AgentViewDeps, LoadoutChange, LoadoutSimulation } from "./types.js";
|
|
54
|
+
/** calc_bonuses for a loadout, as GameState.derivedFor supplies it. */
|
|
55
|
+
export type LoadoutDerive = (equipment: readonly (GameObject | null)[], totalWeight?: number) => PlayerState;
|
|
56
|
+
/** What simulateLoadout may be told rather than reading off the state. */
|
|
57
|
+
export interface LoadoutSimOptions {
|
|
58
|
+
/**
|
|
59
|
+
* The same AgentViewDeps the live view was built with, so the ItemViews in the
|
|
60
|
+
* result carry the same `value` / `kindId` fields the live ones do. Omitted
|
|
61
|
+
* fields degrade exactly as they do in perceive.
|
|
62
|
+
*/
|
|
63
|
+
viewDeps?: AgentViewDeps;
|
|
64
|
+
/**
|
|
65
|
+
* The derive to use. Defaults to `state.derivedFor`, which the session
|
|
66
|
+
* installs; supply it directly only in a test that has no session.
|
|
67
|
+
*/
|
|
68
|
+
derive?: LoadoutDerive;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Derive the character both as it stands and with `change` applied, and diff the
|
|
72
|
+
* two. Returns null when the state has no `derivedFor` installed (a worldless
|
|
73
|
+
* harness), because an approximate answer here is indistinguishable from a real
|
|
74
|
+
* one at every call site.
|
|
75
|
+
*
|
|
76
|
+
* PURE: nothing on the GameState, the player, the gear or any object is written.
|
|
77
|
+
* The derive runs with `update: false`, which is what keeps calc_bonuses' own
|
|
78
|
+
* faithful side effects (zeroing TMD_FASTCAST on a stun grade) out of it.
|
|
79
|
+
*
|
|
80
|
+
* COMPARE AN `after` AGAINST THIS `before`, NEVER AGAINST THE LIVE CHARACTER'S
|
|
81
|
+
* OWN NUMBERS. Both sides here come out of the same `update: false` derive, and
|
|
82
|
+
* upstream's calc_bonuses does not answer identically in both modes: its
|
|
83
|
+
* town-daylight shortcut in calc_light is gated on `update`
|
|
84
|
+
* (player-calcs.c:1607), so in a daytime town a shadow derive reports the light
|
|
85
|
+
* radius of the equipment and the live derive reports zero. That is upstream's
|
|
86
|
+
* asymmetry and the port keeps it.
|
|
87
|
+
*
|
|
88
|
+
* MEASURED, 2026-08-21, which is why this paragraph exists: an autoplayer scored
|
|
89
|
+
* a candidate loadout through this function and compared the result against the
|
|
90
|
+
* score it had computed from the LIVE view. In a daytime town the two derives
|
|
91
|
+
* differed by 14000 points of the Borg's own power metric, so every wearable item
|
|
92
|
+
* looked like an upgrade and it spent 3964 of 4000 decisions swapping one wooden
|
|
93
|
+
* torch for an identical one. `delta` - or the difference between an `after` and
|
|
94
|
+
* this `before` - is the quantity a decision wants; an absolute `after` is not.
|
|
95
|
+
*/
|
|
96
|
+
export declare function simulateLoadout(state: GameState, change: LoadoutChange, opts?: LoadoutSimOptions): LoadoutSimulation | null;
|
|
97
|
+
//# sourceMappingURL=loadout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadout.d.ts","sourceRoot":"","sources":["../../src/agent/loadout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EAGb,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAEpB,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,CAC1B,SAAS,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,EACzC,WAAW,CAAC,EAAE,MAAM,KACjB,WAAW,CAAC;AAEjB,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAqQD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,aAAa,EACrB,IAAI,GAAE,iBAAsB,GAC3B,iBAAiB,GAAG,IAAI,CAkB1B"}
|