@ticktockbent/rogue-ts 0.1.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/LICENSE +21 -0
- package/README.md +175 -0
- package/dist/armor.d.ts +18 -0
- package/dist/armor.d.ts.map +1 -0
- package/dist/armor.js +84 -0
- package/dist/armor.js.map +1 -0
- package/dist/chase.d.ts +15 -0
- package/dist/chase.d.ts.map +1 -0
- package/dist/chase.js +152 -0
- package/dist/chase.js.map +1 -0
- package/dist/command.d.ts +12 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +761 -0
- package/dist/command.js.map +1 -0
- package/dist/curses.d.ts +102 -0
- package/dist/curses.d.ts.map +1 -0
- package/dist/curses.js +47 -0
- package/dist/curses.js.map +1 -0
- package/dist/daemon.d.ts +43 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +116 -0
- package/dist/daemon.js.map +1 -0
- package/dist/daemons.d.ts +47 -0
- package/dist/daemons.d.ts.map +1 -0
- package/dist/daemons.js +194 -0
- package/dist/daemons.js.map +1 -0
- package/dist/fight.d.ts +52 -0
- package/dist/fight.d.ts.map +1 -0
- package/dist/fight.js +508 -0
- package/dist/fight.js.map +1 -0
- package/dist/globals.d.ts +387 -0
- package/dist/globals.d.ts.map +1 -0
- package/dist/globals.js +935 -0
- package/dist/globals.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +30 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +159 -0
- package/dist/init.js.map +1 -0
- package/dist/io.d.ts +48 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +248 -0
- package/dist/io.js.map +1 -0
- package/dist/list.d.ts +37 -0
- package/dist/list.d.ts.map +1 -0
- package/dist/list.js +109 -0
- package/dist/list.js.map +1 -0
- package/dist/main.d.ts +23 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +207 -0
- package/dist/main.js.map +1 -0
- package/dist/misc.d.ts +53 -0
- package/dist/misc.d.ts.map +1 -0
- package/dist/misc.js +296 -0
- package/dist/misc.js.map +1 -0
- package/dist/monsters.d.ts +55 -0
- package/dist/monsters.d.ts.map +1 -0
- package/dist/monsters.js +211 -0
- package/dist/monsters.js.map +1 -0
- package/dist/move.d.ts +23 -0
- package/dist/move.d.ts.map +1 -0
- package/dist/move.js +270 -0
- package/dist/move.js.map +1 -0
- package/dist/new_level.d.ts +17 -0
- package/dist/new_level.d.ts.map +1 -0
- package/dist/new_level.js +173 -0
- package/dist/new_level.js.map +1 -0
- package/dist/pack.d.ts +47 -0
- package/dist/pack.d.ts.map +1 -0
- package/dist/pack.js +359 -0
- package/dist/pack.js.map +1 -0
- package/dist/passages.d.ts +23 -0
- package/dist/passages.d.ts.map +1 -0
- package/dist/passages.js +277 -0
- package/dist/passages.js.map +1 -0
- package/dist/potions.d.ts +13 -0
- package/dist/potions.d.ts.map +1 -0
- package/dist/potions.js +239 -0
- package/dist/potions.js.map +1 -0
- package/dist/rings.d.ts +13 -0
- package/dist/rings.d.ts.map +1 -0
- package/dist/rings.js +173 -0
- package/dist/rings.js.map +1 -0
- package/dist/rip.d.ts +22 -0
- package/dist/rip.d.ts.map +1 -0
- package/dist/rip.js +216 -0
- package/dist/rip.js.map +1 -0
- package/dist/rooms.d.ts +62 -0
- package/dist/rooms.d.ts.map +1 -0
- package/dist/rooms.js +432 -0
- package/dist/rooms.js.map +1 -0
- package/dist/save.d.ts +25 -0
- package/dist/save.d.ts.map +1 -0
- package/dist/save.js +565 -0
- package/dist/save.js.map +1 -0
- package/dist/scrolls.d.ts +13 -0
- package/dist/scrolls.d.ts.map +1 -0
- package/dist/scrolls.js +305 -0
- package/dist/scrolls.js.map +1 -0
- package/dist/sticks.d.ts +9 -0
- package/dist/sticks.d.ts.map +1 -0
- package/dist/sticks.js +379 -0
- package/dist/sticks.js.map +1 -0
- package/dist/things.d.ts +28 -0
- package/dist/things.d.ts.map +1 -0
- package/dist/things.js +307 -0
- package/dist/things.js.map +1 -0
- package/dist/types.d.ts +113 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +36 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +198 -0
- package/dist/util.js.map +1 -0
- package/dist/weapons.d.ts +22 -0
- package/dist/weapons.d.ts.map +1 -0
- package/dist/weapons.js +185 -0
- package/dist/weapons.js.map +1 -0
- package/package.json +31 -0
package/dist/globals.js
ADDED
|
@@ -0,0 +1,935 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global game state and data tables.
|
|
3
|
+
* Faithfully ported from extern.c and rogue.h.
|
|
4
|
+
*/
|
|
5
|
+
import { CTRL, rnd as utilRnd } from "./util.js";
|
|
6
|
+
// ─── String constants ────────────────────────────────
|
|
7
|
+
export const MAXSTR = 1024;
|
|
8
|
+
export const MAXLINES = 32;
|
|
9
|
+
export const MAXCOLS = 80;
|
|
10
|
+
// ─── Game constants from rogue.h ─────────────────────
|
|
11
|
+
export const MAXROOMS = 9;
|
|
12
|
+
export const MAXTHINGS = 9;
|
|
13
|
+
export const MAXOBJ = 9;
|
|
14
|
+
export const MAXPACK = 23;
|
|
15
|
+
export const MAXTRAPS = 10;
|
|
16
|
+
export const AMULETLEVEL = 26;
|
|
17
|
+
export const NUMTHINGS = 7;
|
|
18
|
+
export const MAXPASS = 13;
|
|
19
|
+
export const NUMLINES = 24;
|
|
20
|
+
export const NUMCOLS = 80;
|
|
21
|
+
export const STATLINE = NUMLINES - 1;
|
|
22
|
+
export const BORE_LEVEL = 50;
|
|
23
|
+
// Return values for get functions
|
|
24
|
+
export const NORM = 0;
|
|
25
|
+
export const QUIT = 1;
|
|
26
|
+
export const MINUS = 2;
|
|
27
|
+
// Inventory types
|
|
28
|
+
export const INV_OVER = 0;
|
|
29
|
+
export const INV_SLOW = 1;
|
|
30
|
+
export const INV_CLEAR = 2;
|
|
31
|
+
// ─── Display characters ─────────────────────────────
|
|
32
|
+
export const PASSAGE = "#";
|
|
33
|
+
export const DOOR = "+";
|
|
34
|
+
export const FLOOR = ".";
|
|
35
|
+
export const PLAYER = "@";
|
|
36
|
+
export const TRAP = "^";
|
|
37
|
+
export const STAIRS = "%";
|
|
38
|
+
export const GOLD = "*";
|
|
39
|
+
export const POTION = "!";
|
|
40
|
+
export const SCROLL = "?";
|
|
41
|
+
export const MAGIC = "$";
|
|
42
|
+
export const FOOD = ":";
|
|
43
|
+
export const WEAPON = ")";
|
|
44
|
+
export const ARMOR = "]";
|
|
45
|
+
export const AMULET = ",";
|
|
46
|
+
export const RING = "=";
|
|
47
|
+
export const STICK = "/";
|
|
48
|
+
export const CALLABLE = -1;
|
|
49
|
+
export const R_OR_S = -2;
|
|
50
|
+
// Item type numeric constants (for o_type)
|
|
51
|
+
export const POTION_TYPE = 0x21; // '!'
|
|
52
|
+
export const SCROLL_TYPE = 0x3f; // '?'
|
|
53
|
+
export const FOOD_TYPE = 0x3a; // ':'
|
|
54
|
+
export const WEAPON_TYPE = 0x29; // ')'
|
|
55
|
+
export const ARMOR_TYPE = 0x5d; // ']'
|
|
56
|
+
export const RING_TYPE = 0x3d; // '='
|
|
57
|
+
export const STICK_TYPE = 0x2f; // '/'
|
|
58
|
+
export const AMULET_TYPE = 0x2c; // ','
|
|
59
|
+
export const GOLD_TYPE = 0x2a; // '*'
|
|
60
|
+
// ─── Timing constants ────────────────────────────────
|
|
61
|
+
export const HEALTIME = 30;
|
|
62
|
+
export const HUHDURATION = 20;
|
|
63
|
+
export const SEEDURATION = 850;
|
|
64
|
+
export const HUNGERTIME = 1300;
|
|
65
|
+
export const MORETIME = 150;
|
|
66
|
+
export const STOMACHSIZE = 2000;
|
|
67
|
+
export const STARVETIME = 850;
|
|
68
|
+
export const ESCAPE = 27;
|
|
69
|
+
export const LEFT = 0;
|
|
70
|
+
export const RIGHT = 1;
|
|
71
|
+
export const BOLT_LENGTH = 6;
|
|
72
|
+
export const LAMPDIST = 3;
|
|
73
|
+
export const SLEEPTIME = 4;
|
|
74
|
+
export const BEARTIME = 3;
|
|
75
|
+
// ─── Save against things ─────────────────────────────
|
|
76
|
+
export const VS_POISON = 0;
|
|
77
|
+
export const VS_PARALYZATION = 0;
|
|
78
|
+
export const VS_DEATH = 0;
|
|
79
|
+
export const VS_BREATH = 2;
|
|
80
|
+
export const VS_MAGIC = 3;
|
|
81
|
+
// ─── Room flags ──────────────────────────────────────
|
|
82
|
+
export const ISDARK = 0o1;
|
|
83
|
+
export const ISGONE = 0o2;
|
|
84
|
+
export const ISMAZE = 0o4;
|
|
85
|
+
// ─── Object flags ────────────────────────────────────
|
|
86
|
+
export const ISCURSED = 0o1;
|
|
87
|
+
export const ISKNOW = 0o2;
|
|
88
|
+
export const ISMISL = 0o4;
|
|
89
|
+
export const ISMANY = 0o10;
|
|
90
|
+
// ISFOUND = 0o20 shared with creatures
|
|
91
|
+
export const ISPROT = 0o40;
|
|
92
|
+
// ─── Creature flags ──────────────────────────────────
|
|
93
|
+
export const CANHUH = 0o1;
|
|
94
|
+
export const CANSEE = 0o2;
|
|
95
|
+
export const ISBLIND = 0o4;
|
|
96
|
+
export const ISCANC = 0o10;
|
|
97
|
+
export const ISLEVIT = 0o10;
|
|
98
|
+
export const ISFOUND = 0o20;
|
|
99
|
+
export const ISGREED = 0o40;
|
|
100
|
+
export const ISHASTE = 0o100;
|
|
101
|
+
export const ISTARGET = 0o200;
|
|
102
|
+
export const ISHELD = 0o400;
|
|
103
|
+
export const ISHUH = 0o1000;
|
|
104
|
+
export const ISINVIS = 0o2000;
|
|
105
|
+
export const ISMEAN = 0o4000;
|
|
106
|
+
export const ISHALU = 0o4000;
|
|
107
|
+
export const ISREGEN = 0o10000;
|
|
108
|
+
export const ISRUN = 0o20000;
|
|
109
|
+
export const SEEMONST = 0o40000;
|
|
110
|
+
export const ISFLY = 0o40000;
|
|
111
|
+
export const ISSLOW = 0o100000;
|
|
112
|
+
// ─── Level map flags ─────────────────────────────────
|
|
113
|
+
export const F_PASS = 0x80;
|
|
114
|
+
export const F_SEEN = 0x40;
|
|
115
|
+
export const F_DROPPED = 0x20;
|
|
116
|
+
export const F_LOCKED = 0x20;
|
|
117
|
+
export const F_REAL = 0x10;
|
|
118
|
+
export const F_PNUM = 0x0f;
|
|
119
|
+
export const F_TMASK = 0x07;
|
|
120
|
+
// ─── Trap types ──────────────────────────────────────
|
|
121
|
+
export const T_DOOR = 0;
|
|
122
|
+
export const T_ARROW = 1;
|
|
123
|
+
export const T_SLEEP = 2;
|
|
124
|
+
export const T_BEAR = 3;
|
|
125
|
+
export const T_TELEP = 4;
|
|
126
|
+
export const T_DART = 5;
|
|
127
|
+
export const T_RUST = 6;
|
|
128
|
+
export const T_MYST = 7;
|
|
129
|
+
export const NTRAPS = 8;
|
|
130
|
+
// ─── Potion types ────────────────────────────────────
|
|
131
|
+
export const P_CONFUSE = 0;
|
|
132
|
+
export const P_LSD = 1;
|
|
133
|
+
export const P_POISON = 2;
|
|
134
|
+
export const P_STRENGTH = 3;
|
|
135
|
+
export const P_SEEINVIS = 4;
|
|
136
|
+
export const P_HEALING = 5;
|
|
137
|
+
export const P_MFIND = 6;
|
|
138
|
+
export const P_TFIND = 7;
|
|
139
|
+
export const P_RAISE = 8;
|
|
140
|
+
export const P_XHEAL = 9;
|
|
141
|
+
export const P_HASTE = 10;
|
|
142
|
+
export const P_RESTORE = 11;
|
|
143
|
+
export const P_BLIND = 12;
|
|
144
|
+
export const P_LEVIT = 13;
|
|
145
|
+
export const MAXPOTIONS = 14;
|
|
146
|
+
// ─── Scroll types ────────────────────────────────────
|
|
147
|
+
export const S_CONFUSE = 0;
|
|
148
|
+
export const S_MAP = 1;
|
|
149
|
+
export const S_HOLD = 2;
|
|
150
|
+
export const S_SLEEP = 3;
|
|
151
|
+
export const S_ARMOR = 4;
|
|
152
|
+
export const S_ID_POTION = 5;
|
|
153
|
+
export const S_ID_SCROLL = 6;
|
|
154
|
+
export const S_ID_WEAPON = 7;
|
|
155
|
+
export const S_ID_ARMOR = 8;
|
|
156
|
+
export const S_ID_R_OR_S = 9;
|
|
157
|
+
export const S_SCARE = 10;
|
|
158
|
+
export const S_FDET = 11;
|
|
159
|
+
export const S_TELEP = 12;
|
|
160
|
+
export const S_ENCH = 13;
|
|
161
|
+
export const S_CREATE = 14;
|
|
162
|
+
export const S_REMOVE = 15;
|
|
163
|
+
export const S_AGGR = 16;
|
|
164
|
+
export const S_PROTECT = 17;
|
|
165
|
+
export const MAXSCROLLS = 18;
|
|
166
|
+
// ─── Weapon types ────────────────────────────────────
|
|
167
|
+
export const MACE = 0;
|
|
168
|
+
export const SWORD = 1;
|
|
169
|
+
export const BOW = 2;
|
|
170
|
+
export const ARROW = 3;
|
|
171
|
+
export const DAGGER = 4;
|
|
172
|
+
export const TWOSWORD = 5;
|
|
173
|
+
export const DART = 6;
|
|
174
|
+
export const SHIRAKEN = 7;
|
|
175
|
+
export const SPEAR = 8;
|
|
176
|
+
export const FLAME = 9;
|
|
177
|
+
export const MAXWEAPONS = 9;
|
|
178
|
+
// ─── Armor types ─────────────────────────────────────
|
|
179
|
+
export const LEATHER = 0;
|
|
180
|
+
export const RING_MAIL = 1;
|
|
181
|
+
export const STUDDED_LEATHER = 2;
|
|
182
|
+
export const SCALE_MAIL = 3;
|
|
183
|
+
export const CHAIN_MAIL = 4;
|
|
184
|
+
export const SPLINT_MAIL = 5;
|
|
185
|
+
export const BANDED_MAIL = 6;
|
|
186
|
+
export const PLATE_MAIL = 7;
|
|
187
|
+
export const MAXARMORS = 8;
|
|
188
|
+
// ─── Ring types ──────────────────────────────────────
|
|
189
|
+
export const R_PROTECT = 0;
|
|
190
|
+
export const R_ADDSTR = 1;
|
|
191
|
+
export const R_SUSTSTR = 2;
|
|
192
|
+
export const R_SEARCH = 3;
|
|
193
|
+
export const R_SEEINVIS = 4;
|
|
194
|
+
export const R_NOP = 5;
|
|
195
|
+
export const R_AGGR = 6;
|
|
196
|
+
export const R_ADDHIT = 7;
|
|
197
|
+
export const R_ADDDAM = 8;
|
|
198
|
+
export const R_REGEN = 9;
|
|
199
|
+
export const R_DIGEST = 10;
|
|
200
|
+
export const R_TELEPORT = 11;
|
|
201
|
+
export const R_STEALTH = 12;
|
|
202
|
+
export const R_SUSTARM = 13;
|
|
203
|
+
export const MAXRINGS = 14;
|
|
204
|
+
// ─── Wand/Staff types ────────────────────────────────
|
|
205
|
+
export const WS_LIGHT = 0;
|
|
206
|
+
export const WS_INVIS = 1;
|
|
207
|
+
export const WS_ELECT = 2;
|
|
208
|
+
export const WS_FIRE = 3;
|
|
209
|
+
export const WS_COLD = 4;
|
|
210
|
+
export const WS_POLYMORPH = 5;
|
|
211
|
+
export const WS_MISSILE = 6;
|
|
212
|
+
export const WS_HASTE_M = 7;
|
|
213
|
+
export const WS_SLOW_M = 8;
|
|
214
|
+
export const WS_DRAIN = 9;
|
|
215
|
+
export const WS_NOP = 10;
|
|
216
|
+
export const WS_TELAWAY = 11;
|
|
217
|
+
export const WS_TELTO = 12;
|
|
218
|
+
export const WS_CANCEL = 13;
|
|
219
|
+
export const MAXSTICKS = 14;
|
|
220
|
+
// ─── Daemon system ───────────────────────────────────
|
|
221
|
+
export const BEFORE = 1;
|
|
222
|
+
export const AFTER = 2;
|
|
223
|
+
export const MAXDAEMONS = 20;
|
|
224
|
+
// ─── Data Tables ─────────────────────────────────────
|
|
225
|
+
/**
|
|
226
|
+
* Monster table: 26 entries, A-Z.
|
|
227
|
+
* Faithfully ported from extern.c monsters[26].
|
|
228
|
+
* Note: ___ was 1 (placeholder HP) and XX was 10 (placeholder str).
|
|
229
|
+
*/
|
|
230
|
+
export const monsters = [
|
|
231
|
+
// A - aquator
|
|
232
|
+
{ m_name: "aquator", m_carry: 0, m_flags: ISMEAN,
|
|
233
|
+
m_stats: { s_str: 10, s_exp: 20, s_lvl: 5, s_arm: 2, s_hpt: 1, s_dmg: "0x0/0x0", s_maxhp: 1 } },
|
|
234
|
+
// B - bat
|
|
235
|
+
{ m_name: "bat", m_carry: 0, m_flags: ISFLY,
|
|
236
|
+
m_stats: { s_str: 10, s_exp: 1, s_lvl: 1, s_arm: 3, s_hpt: 1, s_dmg: "1x2", s_maxhp: 1 } },
|
|
237
|
+
// C - centaur
|
|
238
|
+
{ m_name: "centaur", m_carry: 15, m_flags: 0,
|
|
239
|
+
m_stats: { s_str: 10, s_exp: 17, s_lvl: 4, s_arm: 4, s_hpt: 1, s_dmg: "1x2/1x5/1x5", s_maxhp: 1 } },
|
|
240
|
+
// D - dragon
|
|
241
|
+
{ m_name: "dragon", m_carry: 100, m_flags: ISMEAN,
|
|
242
|
+
m_stats: { s_str: 10, s_exp: 5000, s_lvl: 10, s_arm: -1, s_hpt: 1, s_dmg: "1x8/1x8/3x10", s_maxhp: 1 } },
|
|
243
|
+
// E - emu
|
|
244
|
+
{ m_name: "emu", m_carry: 0, m_flags: ISMEAN,
|
|
245
|
+
m_stats: { s_str: 10, s_exp: 2, s_lvl: 1, s_arm: 7, s_hpt: 1, s_dmg: "1x2", s_maxhp: 1 } },
|
|
246
|
+
// F - venus flytrap
|
|
247
|
+
{ m_name: "venus flytrap", m_carry: 0, m_flags: ISMEAN,
|
|
248
|
+
m_stats: { s_str: 10, s_exp: 80, s_lvl: 8, s_arm: 3, s_hpt: 1, s_dmg: "%%%x0", s_maxhp: 1 } },
|
|
249
|
+
// G - griffin
|
|
250
|
+
{ m_name: "griffin", m_carry: 20, m_flags: ISMEAN | ISFLY | ISREGEN,
|
|
251
|
+
m_stats: { s_str: 10, s_exp: 2000, s_lvl: 13, s_arm: 2, s_hpt: 1, s_dmg: "4x3/3x5", s_maxhp: 1 } },
|
|
252
|
+
// H - hobgoblin
|
|
253
|
+
{ m_name: "hobgoblin", m_carry: 0, m_flags: ISMEAN,
|
|
254
|
+
m_stats: { s_str: 10, s_exp: 3, s_lvl: 1, s_arm: 5, s_hpt: 1, s_dmg: "1x8", s_maxhp: 1 } },
|
|
255
|
+
// I - ice monster
|
|
256
|
+
{ m_name: "ice monster", m_carry: 0, m_flags: 0,
|
|
257
|
+
m_stats: { s_str: 10, s_exp: 5, s_lvl: 1, s_arm: 9, s_hpt: 1, s_dmg: "0x0", s_maxhp: 1 } },
|
|
258
|
+
// J - jabberwock
|
|
259
|
+
{ m_name: "jabberwock", m_carry: 70, m_flags: 0,
|
|
260
|
+
m_stats: { s_str: 10, s_exp: 3000, s_lvl: 15, s_arm: 6, s_hpt: 1, s_dmg: "2x12/2x4", s_maxhp: 1 } },
|
|
261
|
+
// K - kestrel
|
|
262
|
+
{ m_name: "kestrel", m_carry: 0, m_flags: ISMEAN | ISFLY,
|
|
263
|
+
m_stats: { s_str: 10, s_exp: 1, s_lvl: 1, s_arm: 7, s_hpt: 1, s_dmg: "1x4", s_maxhp: 1 } },
|
|
264
|
+
// L - leprechaun
|
|
265
|
+
{ m_name: "leprechaun", m_carry: 0, m_flags: 0,
|
|
266
|
+
m_stats: { s_str: 10, s_exp: 10, s_lvl: 3, s_arm: 8, s_hpt: 1, s_dmg: "1x1", s_maxhp: 1 } },
|
|
267
|
+
// M - medusa
|
|
268
|
+
{ m_name: "medusa", m_carry: 40, m_flags: ISMEAN,
|
|
269
|
+
m_stats: { s_str: 10, s_exp: 200, s_lvl: 8, s_arm: 2, s_hpt: 1, s_dmg: "3x4/3x4/2x5", s_maxhp: 1 } },
|
|
270
|
+
// N - nymph
|
|
271
|
+
{ m_name: "nymph", m_carry: 100, m_flags: 0,
|
|
272
|
+
m_stats: { s_str: 10, s_exp: 37, s_lvl: 3, s_arm: 9, s_hpt: 1, s_dmg: "0x0", s_maxhp: 1 } },
|
|
273
|
+
// O - orc
|
|
274
|
+
{ m_name: "orc", m_carry: 15, m_flags: ISGREED,
|
|
275
|
+
m_stats: { s_str: 10, s_exp: 5, s_lvl: 1, s_arm: 6, s_hpt: 1, s_dmg: "1x8", s_maxhp: 1 } },
|
|
276
|
+
// P - phantom
|
|
277
|
+
{ m_name: "phantom", m_carry: 0, m_flags: ISINVIS,
|
|
278
|
+
m_stats: { s_str: 10, s_exp: 120, s_lvl: 8, s_arm: 3, s_hpt: 1, s_dmg: "4x4", s_maxhp: 1 } },
|
|
279
|
+
// Q - quagga
|
|
280
|
+
{ m_name: "quagga", m_carry: 0, m_flags: ISMEAN,
|
|
281
|
+
m_stats: { s_str: 10, s_exp: 15, s_lvl: 3, s_arm: 3, s_hpt: 1, s_dmg: "1x5/1x5", s_maxhp: 1 } },
|
|
282
|
+
// R - rattlesnake
|
|
283
|
+
{ m_name: "rattlesnake", m_carry: 0, m_flags: ISMEAN,
|
|
284
|
+
m_stats: { s_str: 10, s_exp: 9, s_lvl: 2, s_arm: 3, s_hpt: 1, s_dmg: "1x6", s_maxhp: 1 } },
|
|
285
|
+
// S - snake
|
|
286
|
+
{ m_name: "snake", m_carry: 0, m_flags: ISMEAN,
|
|
287
|
+
m_stats: { s_str: 10, s_exp: 2, s_lvl: 1, s_arm: 5, s_hpt: 1, s_dmg: "1x3", s_maxhp: 1 } },
|
|
288
|
+
// T - troll
|
|
289
|
+
{ m_name: "troll", m_carry: 50, m_flags: ISREGEN | ISMEAN,
|
|
290
|
+
m_stats: { s_str: 10, s_exp: 120, s_lvl: 6, s_arm: 4, s_hpt: 1, s_dmg: "1x8/1x8/2x6", s_maxhp: 1 } },
|
|
291
|
+
// U - black unicorn
|
|
292
|
+
{ m_name: "black unicorn", m_carry: 0, m_flags: ISMEAN,
|
|
293
|
+
m_stats: { s_str: 10, s_exp: 190, s_lvl: 7, s_arm: -2, s_hpt: 1, s_dmg: "1x9/1x9/2x9", s_maxhp: 1 } },
|
|
294
|
+
// V - vampire
|
|
295
|
+
{ m_name: "vampire", m_carry: 20, m_flags: ISREGEN | ISMEAN,
|
|
296
|
+
m_stats: { s_str: 10, s_exp: 350, s_lvl: 8, s_arm: 1, s_hpt: 1, s_dmg: "1x10", s_maxhp: 1 } },
|
|
297
|
+
// W - wraith
|
|
298
|
+
{ m_name: "wraith", m_carry: 0, m_flags: 0,
|
|
299
|
+
m_stats: { s_str: 10, s_exp: 55, s_lvl: 5, s_arm: 4, s_hpt: 1, s_dmg: "1x6", s_maxhp: 1 } },
|
|
300
|
+
// X - xeroc
|
|
301
|
+
{ m_name: "xeroc", m_carry: 30, m_flags: 0,
|
|
302
|
+
m_stats: { s_str: 10, s_exp: 100, s_lvl: 7, s_arm: 7, s_hpt: 1, s_dmg: "4x4", s_maxhp: 1 } },
|
|
303
|
+
// Y - yeti
|
|
304
|
+
{ m_name: "yeti", m_carry: 30, m_flags: 0,
|
|
305
|
+
m_stats: { s_str: 10, s_exp: 50, s_lvl: 4, s_arm: 6, s_hpt: 1, s_dmg: "1x6/1x6", s_maxhp: 1 } },
|
|
306
|
+
// Z - zombie
|
|
307
|
+
{ m_name: "zombie", m_carry: 0, m_flags: ISMEAN,
|
|
308
|
+
m_stats: { s_str: 10, s_exp: 6, s_lvl: 2, s_arm: 8, s_hpt: 1, s_dmg: "1x8", s_maxhp: 1 } },
|
|
309
|
+
];
|
|
310
|
+
/**
|
|
311
|
+
* Experience level thresholds.
|
|
312
|
+
* Ported from extern.c e_levels[21].
|
|
313
|
+
*/
|
|
314
|
+
export const e_levels = [
|
|
315
|
+
10, 20, 40, 80, 160, 320, 640, 1300, 2600, 5200,
|
|
316
|
+
13000, 26000, 50000, 100000, 200000, 400000, 800000,
|
|
317
|
+
2000000, 4000000, 8000000, 0,
|
|
318
|
+
];
|
|
319
|
+
/**
|
|
320
|
+
* Item generation probabilities.
|
|
321
|
+
* Ported from extern.c things[NUMTHINGS].
|
|
322
|
+
*/
|
|
323
|
+
export const things = [
|
|
324
|
+
{ oi_name: null, oi_prob: 26, oi_worth: 0, oi_guess: null, oi_know: false }, // potion
|
|
325
|
+
{ oi_name: null, oi_prob: 36, oi_worth: 0, oi_guess: null, oi_know: false }, // scroll
|
|
326
|
+
{ oi_name: null, oi_prob: 16, oi_worth: 0, oi_guess: null, oi_know: false }, // food
|
|
327
|
+
{ oi_name: null, oi_prob: 7, oi_worth: 0, oi_guess: null, oi_know: false }, // weapon
|
|
328
|
+
{ oi_name: null, oi_prob: 7, oi_worth: 0, oi_guess: null, oi_know: false }, // armor
|
|
329
|
+
{ oi_name: null, oi_prob: 4, oi_worth: 0, oi_guess: null, oi_know: false }, // ring
|
|
330
|
+
{ oi_name: null, oi_prob: 4, oi_worth: 0, oi_guess: null, oi_know: false }, // stick
|
|
331
|
+
];
|
|
332
|
+
/**
|
|
333
|
+
* Armor info table.
|
|
334
|
+
* Ported from extern.c arm_info[MAXARMORS].
|
|
335
|
+
*/
|
|
336
|
+
export const arm_info = [
|
|
337
|
+
{ oi_name: "leather armor", oi_prob: 20, oi_worth: 20, oi_guess: null, oi_know: false },
|
|
338
|
+
{ oi_name: "ring mail", oi_prob: 15, oi_worth: 25, oi_guess: null, oi_know: false },
|
|
339
|
+
{ oi_name: "studded leather armor", oi_prob: 15, oi_worth: 20, oi_guess: null, oi_know: false },
|
|
340
|
+
{ oi_name: "scale mail", oi_prob: 13, oi_worth: 30, oi_guess: null, oi_know: false },
|
|
341
|
+
{ oi_name: "chain mail", oi_prob: 12, oi_worth: 75, oi_guess: null, oi_know: false },
|
|
342
|
+
{ oi_name: "splint mail", oi_prob: 10, oi_worth: 80, oi_guess: null, oi_know: false },
|
|
343
|
+
{ oi_name: "banded mail", oi_prob: 10, oi_worth: 90, oi_guess: null, oi_know: false },
|
|
344
|
+
{ oi_name: "plate mail", oi_prob: 5, oi_worth: 150, oi_guess: null, oi_know: false },
|
|
345
|
+
];
|
|
346
|
+
/**
|
|
347
|
+
* Potion info table.
|
|
348
|
+
* Ported from extern.c pot_info[MAXPOTIONS].
|
|
349
|
+
*/
|
|
350
|
+
export const pot_info = [
|
|
351
|
+
{ oi_name: "confusion", oi_prob: 7, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
352
|
+
{ oi_name: "hallucination", oi_prob: 8, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
353
|
+
{ oi_name: "poison", oi_prob: 8, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
354
|
+
{ oi_name: "gain strength", oi_prob: 13, oi_worth: 150, oi_guess: null, oi_know: false },
|
|
355
|
+
{ oi_name: "see invisible", oi_prob: 3, oi_worth: 100, oi_guess: null, oi_know: false },
|
|
356
|
+
{ oi_name: "healing", oi_prob: 13, oi_worth: 130, oi_guess: null, oi_know: false },
|
|
357
|
+
{ oi_name: "monster detection", oi_prob: 6, oi_worth: 130, oi_guess: null, oi_know: false },
|
|
358
|
+
{ oi_name: "magic detection", oi_prob: 6, oi_worth: 105, oi_guess: null, oi_know: false },
|
|
359
|
+
{ oi_name: "raise level", oi_prob: 2, oi_worth: 250, oi_guess: null, oi_know: false },
|
|
360
|
+
{ oi_name: "extra healing", oi_prob: 5, oi_worth: 200, oi_guess: null, oi_know: false },
|
|
361
|
+
{ oi_name: "haste self", oi_prob: 5, oi_worth: 190, oi_guess: null, oi_know: false },
|
|
362
|
+
{ oi_name: "restore strength", oi_prob: 13, oi_worth: 130, oi_guess: null, oi_know: false },
|
|
363
|
+
{ oi_name: "blindness", oi_prob: 5, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
364
|
+
{ oi_name: "levitation", oi_prob: 6, oi_worth: 75, oi_guess: null, oi_know: false },
|
|
365
|
+
];
|
|
366
|
+
/**
|
|
367
|
+
* Ring info table.
|
|
368
|
+
* Ported from extern.c ring_info[MAXRINGS].
|
|
369
|
+
*/
|
|
370
|
+
export const ring_info = [
|
|
371
|
+
{ oi_name: "protection", oi_prob: 9, oi_worth: 400, oi_guess: null, oi_know: false },
|
|
372
|
+
{ oi_name: "add strength", oi_prob: 9, oi_worth: 400, oi_guess: null, oi_know: false },
|
|
373
|
+
{ oi_name: "sustain strength", oi_prob: 5, oi_worth: 280, oi_guess: null, oi_know: false },
|
|
374
|
+
{ oi_name: "searching", oi_prob: 10, oi_worth: 420, oi_guess: null, oi_know: false },
|
|
375
|
+
{ oi_name: "see invisible", oi_prob: 10, oi_worth: 310, oi_guess: null, oi_know: false },
|
|
376
|
+
{ oi_name: "adornment", oi_prob: 1, oi_worth: 10, oi_guess: null, oi_know: false },
|
|
377
|
+
{ oi_name: "aggravate monster", oi_prob: 10, oi_worth: 10, oi_guess: null, oi_know: false },
|
|
378
|
+
{ oi_name: "dexterity", oi_prob: 8, oi_worth: 440, oi_guess: null, oi_know: false },
|
|
379
|
+
{ oi_name: "increase damage", oi_prob: 8, oi_worth: 400, oi_guess: null, oi_know: false },
|
|
380
|
+
{ oi_name: "regeneration", oi_prob: 4, oi_worth: 460, oi_guess: null, oi_know: false },
|
|
381
|
+
{ oi_name: "slow digestion", oi_prob: 9, oi_worth: 240, oi_guess: null, oi_know: false },
|
|
382
|
+
{ oi_name: "teleportation", oi_prob: 5, oi_worth: 30, oi_guess: null, oi_know: false },
|
|
383
|
+
{ oi_name: "stealth", oi_prob: 7, oi_worth: 470, oi_guess: null, oi_know: false },
|
|
384
|
+
{ oi_name: "maintain armor", oi_prob: 5, oi_worth: 380, oi_guess: null, oi_know: false },
|
|
385
|
+
];
|
|
386
|
+
/**
|
|
387
|
+
* Scroll info table.
|
|
388
|
+
* Ported from extern.c scr_info[MAXSCROLLS].
|
|
389
|
+
*/
|
|
390
|
+
export const scr_info = [
|
|
391
|
+
{ oi_name: "monster confusion", oi_prob: 7, oi_worth: 140, oi_guess: null, oi_know: false },
|
|
392
|
+
{ oi_name: "magic mapping", oi_prob: 4, oi_worth: 150, oi_guess: null, oi_know: false },
|
|
393
|
+
{ oi_name: "hold monster", oi_prob: 2, oi_worth: 180, oi_guess: null, oi_know: false },
|
|
394
|
+
{ oi_name: "sleep", oi_prob: 3, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
395
|
+
{ oi_name: "enchant armor", oi_prob: 7, oi_worth: 160, oi_guess: null, oi_know: false },
|
|
396
|
+
{ oi_name: "identify potion", oi_prob: 10, oi_worth: 80, oi_guess: null, oi_know: false },
|
|
397
|
+
{ oi_name: "identify scroll", oi_prob: 10, oi_worth: 80, oi_guess: null, oi_know: false },
|
|
398
|
+
{ oi_name: "identify weapon", oi_prob: 6, oi_worth: 80, oi_guess: null, oi_know: false },
|
|
399
|
+
{ oi_name: "identify armor", oi_prob: 7, oi_worth: 100, oi_guess: null, oi_know: false },
|
|
400
|
+
{ oi_name: "identify ring, wand or staff", oi_prob: 10, oi_worth: 115, oi_guess: null, oi_know: false },
|
|
401
|
+
{ oi_name: "scare monster", oi_prob: 3, oi_worth: 200, oi_guess: null, oi_know: false },
|
|
402
|
+
{ oi_name: "food detection", oi_prob: 2, oi_worth: 60, oi_guess: null, oi_know: false },
|
|
403
|
+
{ oi_name: "teleportation", oi_prob: 5, oi_worth: 165, oi_guess: null, oi_know: false },
|
|
404
|
+
{ oi_name: "enchant weapon", oi_prob: 8, oi_worth: 150, oi_guess: null, oi_know: false },
|
|
405
|
+
{ oi_name: "create monster", oi_prob: 4, oi_worth: 75, oi_guess: null, oi_know: false },
|
|
406
|
+
{ oi_name: "remove curse", oi_prob: 7, oi_worth: 105, oi_guess: null, oi_know: false },
|
|
407
|
+
{ oi_name: "aggravate monsters", oi_prob: 3, oi_worth: 20, oi_guess: null, oi_know: false },
|
|
408
|
+
{ oi_name: "protect armor", oi_prob: 2, oi_worth: 250, oi_guess: null, oi_know: false },
|
|
409
|
+
];
|
|
410
|
+
/**
|
|
411
|
+
* Weapon info table.
|
|
412
|
+
* Ported from extern.c weap_info[MAXWEAPONS + 1].
|
|
413
|
+
* Last entry is fake (dragon's breath).
|
|
414
|
+
*/
|
|
415
|
+
export const weap_info = [
|
|
416
|
+
{ oi_name: "mace", oi_prob: 11, oi_worth: 8, oi_guess: null, oi_know: false },
|
|
417
|
+
{ oi_name: "long sword", oi_prob: 11, oi_worth: 15, oi_guess: null, oi_know: false },
|
|
418
|
+
{ oi_name: "short bow", oi_prob: 12, oi_worth: 15, oi_guess: null, oi_know: false },
|
|
419
|
+
{ oi_name: "arrow", oi_prob: 12, oi_worth: 1, oi_guess: null, oi_know: false },
|
|
420
|
+
{ oi_name: "dagger", oi_prob: 8, oi_worth: 3, oi_guess: null, oi_know: false },
|
|
421
|
+
{ oi_name: "two handed sword", oi_prob: 10, oi_worth: 75, oi_guess: null, oi_know: false },
|
|
422
|
+
{ oi_name: "dart", oi_prob: 12, oi_worth: 2, oi_guess: null, oi_know: false },
|
|
423
|
+
{ oi_name: "shuriken", oi_prob: 12, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
424
|
+
{ oi_name: "spear", oi_prob: 12, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
425
|
+
{ oi_name: null, oi_prob: 0, oi_worth: 0, oi_guess: null, oi_know: false }, // dragon's breath
|
|
426
|
+
];
|
|
427
|
+
/**
|
|
428
|
+
* Wand/Staff info table.
|
|
429
|
+
* Ported from extern.c ws_info[MAXSTICKS].
|
|
430
|
+
*/
|
|
431
|
+
export const ws_info = [
|
|
432
|
+
{ oi_name: "light", oi_prob: 12, oi_worth: 250, oi_guess: null, oi_know: false },
|
|
433
|
+
{ oi_name: "invisibility", oi_prob: 6, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
434
|
+
{ oi_name: "lightning", oi_prob: 3, oi_worth: 330, oi_guess: null, oi_know: false },
|
|
435
|
+
{ oi_name: "fire", oi_prob: 3, oi_worth: 330, oi_guess: null, oi_know: false },
|
|
436
|
+
{ oi_name: "cold", oi_prob: 3, oi_worth: 330, oi_guess: null, oi_know: false },
|
|
437
|
+
{ oi_name: "polymorph", oi_prob: 15, oi_worth: 310, oi_guess: null, oi_know: false },
|
|
438
|
+
{ oi_name: "magic missile", oi_prob: 10, oi_worth: 170, oi_guess: null, oi_know: false },
|
|
439
|
+
{ oi_name: "haste monster", oi_prob: 10, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
440
|
+
{ oi_name: "slow monster", oi_prob: 11, oi_worth: 350, oi_guess: null, oi_know: false },
|
|
441
|
+
{ oi_name: "drain life", oi_prob: 9, oi_worth: 300, oi_guess: null, oi_know: false },
|
|
442
|
+
{ oi_name: "nothing", oi_prob: 1, oi_worth: 5, oi_guess: null, oi_know: false },
|
|
443
|
+
{ oi_name: "teleport away", oi_prob: 6, oi_worth: 340, oi_guess: null, oi_know: false },
|
|
444
|
+
{ oi_name: "teleport to", oi_prob: 6, oi_worth: 50, oi_guess: null, oi_know: false },
|
|
445
|
+
{ oi_name: "cancellation", oi_prob: 5, oi_worth: 280, oi_guess: null, oi_know: false },
|
|
446
|
+
];
|
|
447
|
+
/**
|
|
448
|
+
* Armor class for each armor type.
|
|
449
|
+
* Ported from extern.c a_class[MAXARMORS].
|
|
450
|
+
*/
|
|
451
|
+
export const a_class = [
|
|
452
|
+
8, // LEATHER
|
|
453
|
+
7, // RING_MAIL
|
|
454
|
+
7, // STUDDED_LEATHER
|
|
455
|
+
6, // SCALE_MAIL
|
|
456
|
+
5, // CHAIN_MAIL
|
|
457
|
+
4, // SPLINT_MAIL
|
|
458
|
+
4, // BANDED_MAIL
|
|
459
|
+
3, // PLATE_MAIL
|
|
460
|
+
];
|
|
461
|
+
/**
|
|
462
|
+
* Trap names.
|
|
463
|
+
* Ported from extern.c tr_name[].
|
|
464
|
+
*/
|
|
465
|
+
export const tr_name = [
|
|
466
|
+
"a trapdoor",
|
|
467
|
+
"an arrow trap",
|
|
468
|
+
"a sleeping gas trap",
|
|
469
|
+
"a beartrap",
|
|
470
|
+
"a teleport trap",
|
|
471
|
+
"a poison dart trap",
|
|
472
|
+
"a rust trap",
|
|
473
|
+
"a mysterious trap",
|
|
474
|
+
];
|
|
475
|
+
/**
|
|
476
|
+
* Inventory type names.
|
|
477
|
+
* Ported from extern.c inv_t_name[].
|
|
478
|
+
*/
|
|
479
|
+
export const inv_t_name = [
|
|
480
|
+
"Overwrite",
|
|
481
|
+
"Slow",
|
|
482
|
+
"Clear",
|
|
483
|
+
];
|
|
484
|
+
/**
|
|
485
|
+
* Help strings.
|
|
486
|
+
* Ported from extern.c helpstr[].
|
|
487
|
+
*/
|
|
488
|
+
export const helpstr = [
|
|
489
|
+
{ h_ch: "?".charCodeAt(0), h_desc: "\tprints help", h_print: true },
|
|
490
|
+
{ h_ch: "/".charCodeAt(0), h_desc: "\tidentify object", h_print: true },
|
|
491
|
+
{ h_ch: "h".charCodeAt(0), h_desc: "\tleft", h_print: true },
|
|
492
|
+
{ h_ch: "j".charCodeAt(0), h_desc: "\tdown", h_print: true },
|
|
493
|
+
{ h_ch: "k".charCodeAt(0), h_desc: "\tup", h_print: true },
|
|
494
|
+
{ h_ch: "l".charCodeAt(0), h_desc: "\tright", h_print: true },
|
|
495
|
+
{ h_ch: "y".charCodeAt(0), h_desc: "\tup & left", h_print: true },
|
|
496
|
+
{ h_ch: "u".charCodeAt(0), h_desc: "\tup & right", h_print: true },
|
|
497
|
+
{ h_ch: "b".charCodeAt(0), h_desc: "\tdown & left", h_print: true },
|
|
498
|
+
{ h_ch: "n".charCodeAt(0), h_desc: "\tdown & right", h_print: true },
|
|
499
|
+
{ h_ch: "H".charCodeAt(0), h_desc: "\trun left", h_print: false },
|
|
500
|
+
{ h_ch: "J".charCodeAt(0), h_desc: "\trun down", h_print: false },
|
|
501
|
+
{ h_ch: "K".charCodeAt(0), h_desc: "\trun up", h_print: false },
|
|
502
|
+
{ h_ch: "L".charCodeAt(0), h_desc: "\trun right", h_print: false },
|
|
503
|
+
{ h_ch: "Y".charCodeAt(0), h_desc: "\trun up & left", h_print: false },
|
|
504
|
+
{ h_ch: "U".charCodeAt(0), h_desc: "\trun up & right", h_print: false },
|
|
505
|
+
{ h_ch: "B".charCodeAt(0), h_desc: "\trun down & left", h_print: false },
|
|
506
|
+
{ h_ch: "N".charCodeAt(0), h_desc: "\trun down & right", h_print: false },
|
|
507
|
+
{ h_ch: CTRL("H"), h_desc: "\trun left until adjacent", h_print: false },
|
|
508
|
+
{ h_ch: CTRL("J"), h_desc: "\trun down until adjacent", h_print: false },
|
|
509
|
+
{ h_ch: CTRL("K"), h_desc: "\trun up until adjacent", h_print: false },
|
|
510
|
+
{ h_ch: CTRL("L"), h_desc: "\trun right until adjacent", h_print: false },
|
|
511
|
+
{ h_ch: CTRL("Y"), h_desc: "\trun up & left until adjacent", h_print: false },
|
|
512
|
+
{ h_ch: CTRL("U"), h_desc: "\trun up & right until adjacent", h_print: false },
|
|
513
|
+
{ h_ch: CTRL("B"), h_desc: "\trun down & left until adjacent", h_print: false },
|
|
514
|
+
{ h_ch: CTRL("N"), h_desc: "\trun down & right until adjacent", h_print: false },
|
|
515
|
+
{ h_ch: 0, h_desc: "\t<SHIFT><dir>: run that way", h_print: true },
|
|
516
|
+
{ h_ch: 0, h_desc: "\t<CTRL><dir>: run till adjacent", h_print: true },
|
|
517
|
+
{ h_ch: "f".charCodeAt(0), h_desc: "<dir>\tfight till death or near death", h_print: true },
|
|
518
|
+
{ h_ch: "t".charCodeAt(0), h_desc: "<dir>\tthrow something", h_print: true },
|
|
519
|
+
{ h_ch: "m".charCodeAt(0), h_desc: "<dir>\tmove onto without picking up", h_print: true },
|
|
520
|
+
{ h_ch: "z".charCodeAt(0), h_desc: "<dir>\tzap a wand in a direction", h_print: true },
|
|
521
|
+
{ h_ch: "^".charCodeAt(0), h_desc: "<dir>\tidentify trap type", h_print: true },
|
|
522
|
+
{ h_ch: "s".charCodeAt(0), h_desc: "\tsearch for trap/secret door", h_print: true },
|
|
523
|
+
{ h_ch: ">".charCodeAt(0), h_desc: "\tgo down a staircase", h_print: true },
|
|
524
|
+
{ h_ch: "<".charCodeAt(0), h_desc: "\tgo up a staircase", h_print: true },
|
|
525
|
+
{ h_ch: ".".charCodeAt(0), h_desc: "\trest for a turn", h_print: true },
|
|
526
|
+
{ h_ch: ",".charCodeAt(0), h_desc: "\tpick something up", h_print: true },
|
|
527
|
+
{ h_ch: "i".charCodeAt(0), h_desc: "\tinventory", h_print: true },
|
|
528
|
+
{ h_ch: "I".charCodeAt(0), h_desc: "\tinventory single item", h_print: true },
|
|
529
|
+
{ h_ch: "q".charCodeAt(0), h_desc: "\tquaff potion", h_print: true },
|
|
530
|
+
{ h_ch: "r".charCodeAt(0), h_desc: "\tread scroll", h_print: true },
|
|
531
|
+
{ h_ch: "e".charCodeAt(0), h_desc: "\teat food", h_print: true },
|
|
532
|
+
{ h_ch: "w".charCodeAt(0), h_desc: "\twield a weapon", h_print: true },
|
|
533
|
+
{ h_ch: "W".charCodeAt(0), h_desc: "\twear armor", h_print: true },
|
|
534
|
+
{ h_ch: "T".charCodeAt(0), h_desc: "\ttake armor off", h_print: true },
|
|
535
|
+
{ h_ch: "P".charCodeAt(0), h_desc: "\tput on ring", h_print: true },
|
|
536
|
+
{ h_ch: "R".charCodeAt(0), h_desc: "\tremove ring", h_print: true },
|
|
537
|
+
{ h_ch: "d".charCodeAt(0), h_desc: "\tdrop object", h_print: true },
|
|
538
|
+
{ h_ch: "c".charCodeAt(0), h_desc: "\tcall object", h_print: true },
|
|
539
|
+
{ h_ch: "a".charCodeAt(0), h_desc: "\trepeat last command", h_print: true },
|
|
540
|
+
{ h_ch: ")".charCodeAt(0), h_desc: "\tprint current weapon", h_print: true },
|
|
541
|
+
{ h_ch: "]".charCodeAt(0), h_desc: "\tprint current armor", h_print: true },
|
|
542
|
+
{ h_ch: "=".charCodeAt(0), h_desc: "\tprint current rings", h_print: true },
|
|
543
|
+
{ h_ch: "@".charCodeAt(0), h_desc: "\tprint current stats", h_print: true },
|
|
544
|
+
{ h_ch: "D".charCodeAt(0), h_desc: "\trecall what's been discovered", h_print: true },
|
|
545
|
+
{ h_ch: "o".charCodeAt(0), h_desc: "\texamine/set options", h_print: true },
|
|
546
|
+
{ h_ch: CTRL("R"), h_desc: "\tredraw screen", h_print: true },
|
|
547
|
+
{ h_ch: CTRL("P"), h_desc: "\trepeat last message", h_print: true },
|
|
548
|
+
{ h_ch: ESCAPE, h_desc: "\tcancel command", h_print: true },
|
|
549
|
+
{ h_ch: "S".charCodeAt(0), h_desc: "\tsave game", h_print: true },
|
|
550
|
+
{ h_ch: "Q".charCodeAt(0), h_desc: "\tquit", h_print: true },
|
|
551
|
+
{ h_ch: "!".charCodeAt(0), h_desc: "\tshell escape", h_print: true },
|
|
552
|
+
{ h_ch: "F".charCodeAt(0), h_desc: "<dir>\tfight till either of you dies", h_print: true },
|
|
553
|
+
{ h_ch: "v".charCodeAt(0), h_desc: "\tprint version number", h_print: true },
|
|
554
|
+
];
|
|
555
|
+
// ─── String pools from init.c ────────────────────────
|
|
556
|
+
export const rainbow = [
|
|
557
|
+
"amber", "aquamarine", "black", "blue", "brown", "clear", "crimson",
|
|
558
|
+
"cyan", "ecru", "gold", "green", "grey", "magenta", "orange", "pink",
|
|
559
|
+
"plaid", "purple", "red", "silver", "tan", "tangerine", "topaz",
|
|
560
|
+
"turquoise", "vermilion", "violet", "white", "yellow",
|
|
561
|
+
];
|
|
562
|
+
export const sylls = [
|
|
563
|
+
"a", "ab", "ag", "aks", "ala", "an", "app", "arg", "arze", "ash",
|
|
564
|
+
"bek", "bie", "bit", "bjor", "blu", "bot", "bu", "byt", "comp",
|
|
565
|
+
"con", "cos", "cre", "dalf", "dan", "den", "do", "e", "eep", "el",
|
|
566
|
+
"eng", "er", "ere", "erk", "esh", "evs", "fa", "fid", "fri", "fu",
|
|
567
|
+
"gan", "gar", "glen", "gop", "gre", "ha", "hyd", "i", "ing", "ip",
|
|
568
|
+
"ish", "it", "ite", "iv", "jo", "kho", "kli", "klis", "la", "lech",
|
|
569
|
+
"mar", "me", "mi", "mic", "mik", "mon", "mung", "mur", "nej",
|
|
570
|
+
"nelg", "nep", "ner", "nes", "nes", "nih", "nin", "o", "od", "ood",
|
|
571
|
+
"org", "orn", "ox", "oxy", "pay", "ple", "plu", "po", "pot",
|
|
572
|
+
"prok", "re", "rea", "rhov", "ri", "ro", "rog", "rok", "rol", "sa",
|
|
573
|
+
"san", "sat", "sef", "seh", "shu", "ski", "sna", "sne", "snik",
|
|
574
|
+
"sno", "so", "sol", "sri", "sta", "sun", "ta", "tab", "tem",
|
|
575
|
+
"ther", "ti", "tox", "trol", "tue", "turs", "u", "ulk", "um", "un",
|
|
576
|
+
"uni", "ur", "val", "viv", "vly", "vom", "wah", "wed", "werg",
|
|
577
|
+
"wex", "whon", "wun", "xo", "y", "yot", "yu", "zant", "zeb", "zim",
|
|
578
|
+
"zok", "zon", "zum",
|
|
579
|
+
];
|
|
580
|
+
export const stones = [
|
|
581
|
+
{ st_name: "agate", st_value: 25 },
|
|
582
|
+
{ st_name: "alexandrite", st_value: 40 },
|
|
583
|
+
{ st_name: "amethyst", st_value: 50 },
|
|
584
|
+
{ st_name: "carnelian", st_value: 40 },
|
|
585
|
+
{ st_name: "diamond", st_value: 300 },
|
|
586
|
+
{ st_name: "emerald", st_value: 300 },
|
|
587
|
+
{ st_name: "germanium", st_value: 225 },
|
|
588
|
+
{ st_name: "granite", st_value: 5 },
|
|
589
|
+
{ st_name: "garnet", st_value: 50 },
|
|
590
|
+
{ st_name: "jade", st_value: 150 },
|
|
591
|
+
{ st_name: "kryptonite", st_value: 300 },
|
|
592
|
+
{ st_name: "lapis lazuli", st_value: 50 },
|
|
593
|
+
{ st_name: "moonstone", st_value: 50 },
|
|
594
|
+
{ st_name: "obsidian", st_value: 15 },
|
|
595
|
+
{ st_name: "onyx", st_value: 60 },
|
|
596
|
+
{ st_name: "opal", st_value: 200 },
|
|
597
|
+
{ st_name: "pearl", st_value: 220 },
|
|
598
|
+
{ st_name: "peridot", st_value: 63 },
|
|
599
|
+
{ st_name: "ruby", st_value: 350 },
|
|
600
|
+
{ st_name: "sapphire", st_value: 285 },
|
|
601
|
+
{ st_name: "stibotantalite", st_value: 200 },
|
|
602
|
+
{ st_name: "tiger eye", st_value: 50 },
|
|
603
|
+
{ st_name: "topaz", st_value: 60 },
|
|
604
|
+
{ st_name: "turquoise", st_value: 70 },
|
|
605
|
+
{ st_name: "taaffeite", st_value: 300 },
|
|
606
|
+
{ st_name: "zircon", st_value: 80 },
|
|
607
|
+
];
|
|
608
|
+
export const wood = [
|
|
609
|
+
"avocado wood", "balsa", "bamboo", "banyan", "birch", "cedar", "cherry",
|
|
610
|
+
"cinnibar", "cypress", "dogwood", "driftwood", "ebony", "elm", "eucalyptus",
|
|
611
|
+
"fall", "hemlock", "holly", "ironwood", "kukui wood", "mahogany", "manzanita",
|
|
612
|
+
"maple", "oaken", "persimmon wood", "pecan", "pine", "poplar", "redwood",
|
|
613
|
+
"rosewood", "spruce", "teak", "walnut", "zebrawood",
|
|
614
|
+
];
|
|
615
|
+
export const metal = [
|
|
616
|
+
"aluminum", "beryllium", "bone", "brass", "bronze", "copper", "electrum",
|
|
617
|
+
"gold", "iron", "lead", "magnesium", "mercury", "nickel", "pewter",
|
|
618
|
+
"platinum", "steel", "silver", "silicon", "tin", "titanium", "tungsten",
|
|
619
|
+
"zinc",
|
|
620
|
+
];
|
|
621
|
+
// ─── Mutable Game State ──────────────────────────────
|
|
622
|
+
// Initial stats: { str=16, exp=0, lvl=1, arm=10, hpt=12, dmg="1x4", maxhp=12 }
|
|
623
|
+
const INIT_STATS = {
|
|
624
|
+
s_str: 16, s_exp: 0, s_lvl: 1, s_arm: 10, s_hpt: 12, s_dmg: "1x4", s_maxhp: 12,
|
|
625
|
+
};
|
|
626
|
+
function createDefaultPlayer() {
|
|
627
|
+
return {
|
|
628
|
+
_kind: "monster",
|
|
629
|
+
l_next: null,
|
|
630
|
+
l_prev: null,
|
|
631
|
+
t_pos: { x: 0, y: 0 },
|
|
632
|
+
t_turn: false,
|
|
633
|
+
t_type: "@",
|
|
634
|
+
t_disguise: "@",
|
|
635
|
+
t_oldch: " ",
|
|
636
|
+
t_dest: null,
|
|
637
|
+
t_flags: 0,
|
|
638
|
+
t_stats: { ...INIT_STATS },
|
|
639
|
+
t_room: null,
|
|
640
|
+
t_pack: null,
|
|
641
|
+
t_reserved: 0,
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function createDefaultRoom() {
|
|
645
|
+
return {
|
|
646
|
+
r_pos: { x: 0, y: 0 },
|
|
647
|
+
r_max: { x: 0, y: 0 },
|
|
648
|
+
r_gold: { x: 0, y: 0 },
|
|
649
|
+
r_goldval: 0,
|
|
650
|
+
r_flags: 0,
|
|
651
|
+
r_nexits: 0,
|
|
652
|
+
r_exit: [],
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
function createPassage() {
|
|
656
|
+
return {
|
|
657
|
+
r_pos: { x: 0, y: 0 },
|
|
658
|
+
r_max: { x: 0, y: 0 },
|
|
659
|
+
r_gold: { x: 0, y: 0 },
|
|
660
|
+
r_goldval: 0,
|
|
661
|
+
r_flags: ISGONE | ISDARK,
|
|
662
|
+
r_nexits: 0,
|
|
663
|
+
r_exit: [],
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
function createPlace() {
|
|
667
|
+
return { p_ch: " ", p_flags: 0, p_monst: null };
|
|
668
|
+
}
|
|
669
|
+
export const state = {
|
|
670
|
+
// Boolean flags
|
|
671
|
+
after: false,
|
|
672
|
+
again: false,
|
|
673
|
+
noscore: 0,
|
|
674
|
+
seenstairs: false,
|
|
675
|
+
amulet: false,
|
|
676
|
+
door_stop: false,
|
|
677
|
+
fight_flush: false,
|
|
678
|
+
firstmove: false,
|
|
679
|
+
has_hit: false,
|
|
680
|
+
inv_describe: true,
|
|
681
|
+
jump: false,
|
|
682
|
+
kamikaze: false,
|
|
683
|
+
lower_msg: false,
|
|
684
|
+
move_no_pickup: false,
|
|
685
|
+
move_on: false,
|
|
686
|
+
msg_esc: false,
|
|
687
|
+
passgo: false,
|
|
688
|
+
playing: true,
|
|
689
|
+
q_comm: false,
|
|
690
|
+
running: false,
|
|
691
|
+
save_msg: true,
|
|
692
|
+
see_floor: true,
|
|
693
|
+
stat_msg: false,
|
|
694
|
+
terse: false,
|
|
695
|
+
to_death: false,
|
|
696
|
+
tombstone: true,
|
|
697
|
+
wizard: false,
|
|
698
|
+
// Pack tracking
|
|
699
|
+
pack_used: new Array(26).fill(false),
|
|
700
|
+
// Character data
|
|
701
|
+
dir_ch: "",
|
|
702
|
+
file_name: "",
|
|
703
|
+
huh: "",
|
|
704
|
+
p_colors: new Array(MAXPOTIONS).fill(""),
|
|
705
|
+
prbuf: "",
|
|
706
|
+
r_stones: new Array(MAXRINGS).fill(""),
|
|
707
|
+
runch: "",
|
|
708
|
+
s_names: new Array(MAXSCROLLS).fill(""),
|
|
709
|
+
take: "",
|
|
710
|
+
whoami: "Rodney",
|
|
711
|
+
ws_made: new Array(MAXSTICKS).fill(""),
|
|
712
|
+
ws_type: new Array(MAXSTICKS).fill(""),
|
|
713
|
+
fruit: "slime-mold",
|
|
714
|
+
home: "",
|
|
715
|
+
l_last_comm: "",
|
|
716
|
+
l_last_dir: "",
|
|
717
|
+
last_comm: "",
|
|
718
|
+
last_dir: "",
|
|
719
|
+
// Numeric state
|
|
720
|
+
n_objs: 0,
|
|
721
|
+
ntraps: 0,
|
|
722
|
+
hungry_state: 0,
|
|
723
|
+
inpack: 0,
|
|
724
|
+
inv_type: 0,
|
|
725
|
+
level: 1,
|
|
726
|
+
max_hit: 0,
|
|
727
|
+
max_level: 0,
|
|
728
|
+
mpos: 0,
|
|
729
|
+
no_food: 0,
|
|
730
|
+
count: 0,
|
|
731
|
+
food_left: 0,
|
|
732
|
+
lastscore: -1,
|
|
733
|
+
no_command: 0,
|
|
734
|
+
no_move: 0,
|
|
735
|
+
purse: 0,
|
|
736
|
+
quiet: 0,
|
|
737
|
+
vf_hit: 0,
|
|
738
|
+
dnum: 0,
|
|
739
|
+
seed: 0,
|
|
740
|
+
total: 0,
|
|
741
|
+
between: 0,
|
|
742
|
+
group: 0,
|
|
743
|
+
// Coordinate state
|
|
744
|
+
delta: { x: 0, y: 0 },
|
|
745
|
+
oldpos: { x: 0, y: 0 },
|
|
746
|
+
stairs: { x: 0, y: 0 },
|
|
747
|
+
nh: { x: 0, y: 0 },
|
|
748
|
+
// Level map: MAXLINES * MAXCOLS = 32 * 80 = 2560
|
|
749
|
+
places: Array.from({ length: MAXLINES * MAXCOLS }, createPlace),
|
|
750
|
+
// Thing pointers
|
|
751
|
+
cur_armor: null,
|
|
752
|
+
cur_ring: [null, null],
|
|
753
|
+
cur_weapon: null,
|
|
754
|
+
l_last_pick: null,
|
|
755
|
+
last_pick: null,
|
|
756
|
+
lvl_obj: null,
|
|
757
|
+
mlist: null,
|
|
758
|
+
player: createDefaultPlayer(),
|
|
759
|
+
// Max stats
|
|
760
|
+
max_stats: { ...INIT_STATS },
|
|
761
|
+
// Room state
|
|
762
|
+
oldrp: null,
|
|
763
|
+
rooms: Array.from({ length: MAXROOMS }, createDefaultRoom),
|
|
764
|
+
passages: Array.from({ length: MAXPASS }, createPassage),
|
|
765
|
+
// Window handles
|
|
766
|
+
stdscr: null,
|
|
767
|
+
hw: null,
|
|
768
|
+
// Daemon list
|
|
769
|
+
d_list: Array.from({ length: MAXDAEMONS }, () => ({
|
|
770
|
+
d_type: 0,
|
|
771
|
+
d_func: null,
|
|
772
|
+
d_arg: 0,
|
|
773
|
+
d_time: 0,
|
|
774
|
+
})),
|
|
775
|
+
// Game result (set on death/quit/victory)
|
|
776
|
+
_result: null,
|
|
777
|
+
// Internal game loop flags
|
|
778
|
+
_newLevel: false,
|
|
779
|
+
_saveData: null,
|
|
780
|
+
};
|
|
781
|
+
// ─── Place accessor functions (matching C macros) ────
|
|
782
|
+
export function INDEX(y, x) {
|
|
783
|
+
return state.places[(x << 5) + y];
|
|
784
|
+
}
|
|
785
|
+
export function chat(y, x) {
|
|
786
|
+
return state.places[(x << 5) + y].p_ch;
|
|
787
|
+
}
|
|
788
|
+
export function setCh(y, x, ch) {
|
|
789
|
+
state.places[(x << 5) + y].p_ch = ch;
|
|
790
|
+
}
|
|
791
|
+
export function flat(y, x) {
|
|
792
|
+
return state.places[(x << 5) + y].p_flags;
|
|
793
|
+
}
|
|
794
|
+
export function setFlat(y, x, flags) {
|
|
795
|
+
state.places[(x << 5) + y].p_flags = flags;
|
|
796
|
+
}
|
|
797
|
+
export function moat(y, x) {
|
|
798
|
+
return state.places[(x << 5) + y].p_monst;
|
|
799
|
+
}
|
|
800
|
+
export function setMoat(y, x, monst) {
|
|
801
|
+
state.places[(x << 5) + y].p_monst = monst;
|
|
802
|
+
}
|
|
803
|
+
// ─── Macro functions ─────────────────────────────────
|
|
804
|
+
export function winat(y, x) {
|
|
805
|
+
const monster = moat(y, x);
|
|
806
|
+
if (monster !== null && monster._kind === "monster") {
|
|
807
|
+
return monster.t_disguise;
|
|
808
|
+
}
|
|
809
|
+
return chat(y, x);
|
|
810
|
+
}
|
|
811
|
+
export function GOLDCALC() {
|
|
812
|
+
return utilRnd(50 + 10 * state.level) + 2;
|
|
813
|
+
}
|
|
814
|
+
export function ISRING(hand, ringType) {
|
|
815
|
+
const ring = state.cur_ring[hand];
|
|
816
|
+
return ring !== null && ring._kind === "object" && ring.o_which === ringType;
|
|
817
|
+
}
|
|
818
|
+
export function ISWEARING(ringType) {
|
|
819
|
+
return ISRING(LEFT, ringType) || ISRING(RIGHT, ringType);
|
|
820
|
+
}
|
|
821
|
+
export function ISMULT(type) {
|
|
822
|
+
return type === POTION.charCodeAt(0) || type === SCROLL.charCodeAt(0) || type === FOOD.charCodeAt(0);
|
|
823
|
+
}
|
|
824
|
+
// ─── Player accessor macros ──────────────────────────
|
|
825
|
+
export function hero() {
|
|
826
|
+
return state.player.t_pos;
|
|
827
|
+
}
|
|
828
|
+
export function pstats() {
|
|
829
|
+
return state.player.t_stats;
|
|
830
|
+
}
|
|
831
|
+
export function pack() {
|
|
832
|
+
return state.player.t_pack;
|
|
833
|
+
}
|
|
834
|
+
export function proom() {
|
|
835
|
+
return state.player.t_room;
|
|
836
|
+
}
|
|
837
|
+
// ─── Reset state for new game ────────────────────────
|
|
838
|
+
export function resetState() {
|
|
839
|
+
state.after = false;
|
|
840
|
+
state.again = false;
|
|
841
|
+
state.noscore = 0;
|
|
842
|
+
state.seenstairs = false;
|
|
843
|
+
state.amulet = false;
|
|
844
|
+
state.door_stop = false;
|
|
845
|
+
state.fight_flush = false;
|
|
846
|
+
state.firstmove = false;
|
|
847
|
+
state.has_hit = false;
|
|
848
|
+
state.inv_describe = true;
|
|
849
|
+
state.jump = false;
|
|
850
|
+
state.kamikaze = false;
|
|
851
|
+
state.lower_msg = false;
|
|
852
|
+
state.move_on = false;
|
|
853
|
+
state.msg_esc = false;
|
|
854
|
+
state.passgo = false;
|
|
855
|
+
state.playing = true;
|
|
856
|
+
state.q_comm = false;
|
|
857
|
+
state.running = false;
|
|
858
|
+
state.save_msg = true;
|
|
859
|
+
state.see_floor = true;
|
|
860
|
+
state.stat_msg = false;
|
|
861
|
+
state.terse = false;
|
|
862
|
+
state.to_death = false;
|
|
863
|
+
state.tombstone = true;
|
|
864
|
+
state.wizard = false;
|
|
865
|
+
state.pack_used.fill(false);
|
|
866
|
+
state.p_colors.fill("");
|
|
867
|
+
state.r_stones.fill("");
|
|
868
|
+
state.s_names.fill("");
|
|
869
|
+
state.ws_made.fill("");
|
|
870
|
+
state.ws_type.fill("");
|
|
871
|
+
state.dir_ch = "";
|
|
872
|
+
state.file_name = "";
|
|
873
|
+
state.huh = "";
|
|
874
|
+
state.runch = "";
|
|
875
|
+
state.take = "";
|
|
876
|
+
state.whoami = "Rodney";
|
|
877
|
+
state.fruit = "slime-mold";
|
|
878
|
+
state.home = "";
|
|
879
|
+
state.l_last_comm = "";
|
|
880
|
+
state.l_last_dir = "";
|
|
881
|
+
state.last_comm = "";
|
|
882
|
+
state.last_dir = "";
|
|
883
|
+
state.n_objs = 0;
|
|
884
|
+
state.ntraps = 0;
|
|
885
|
+
state.hungry_state = 0;
|
|
886
|
+
state.inpack = 0;
|
|
887
|
+
state.inv_type = 0;
|
|
888
|
+
state.level = 1;
|
|
889
|
+
state.max_hit = 0;
|
|
890
|
+
state.max_level = 0;
|
|
891
|
+
state.mpos = 0;
|
|
892
|
+
state.no_food = 0;
|
|
893
|
+
state.count = 0;
|
|
894
|
+
state.food_left = 0;
|
|
895
|
+
state.lastscore = -1;
|
|
896
|
+
state.no_command = 0;
|
|
897
|
+
state.no_move = 0;
|
|
898
|
+
state.purse = 0;
|
|
899
|
+
state.quiet = 0;
|
|
900
|
+
state.vf_hit = 0;
|
|
901
|
+
state.total = 0;
|
|
902
|
+
state.between = 0;
|
|
903
|
+
state.group = 0;
|
|
904
|
+
state.delta = { x: 0, y: 0 };
|
|
905
|
+
state.oldpos = { x: 0, y: 0 };
|
|
906
|
+
state.stairs = { x: 0, y: 0 };
|
|
907
|
+
state.nh = { x: 0, y: 0 };
|
|
908
|
+
for (const place of state.places) {
|
|
909
|
+
place.p_ch = " ";
|
|
910
|
+
place.p_flags = 0;
|
|
911
|
+
place.p_monst = null;
|
|
912
|
+
}
|
|
913
|
+
state.cur_armor = null;
|
|
914
|
+
state.cur_ring = [null, null];
|
|
915
|
+
state.cur_weapon = null;
|
|
916
|
+
state.l_last_pick = null;
|
|
917
|
+
state.last_pick = null;
|
|
918
|
+
state.lvl_obj = null;
|
|
919
|
+
state.mlist = null;
|
|
920
|
+
state.player = createDefaultPlayer();
|
|
921
|
+
state.max_stats = { ...INIT_STATS };
|
|
922
|
+
state.oldrp = null;
|
|
923
|
+
state.rooms = Array.from({ length: MAXROOMS }, createDefaultRoom);
|
|
924
|
+
state.passages = Array.from({ length: MAXPASS }, createPassage);
|
|
925
|
+
state.d_list = Array.from({ length: MAXDAEMONS }, () => ({
|
|
926
|
+
d_type: 0,
|
|
927
|
+
d_func: null,
|
|
928
|
+
d_arg: 0,
|
|
929
|
+
d_time: 0,
|
|
930
|
+
}));
|
|
931
|
+
state._result = null;
|
|
932
|
+
state._newLevel = false;
|
|
933
|
+
state._saveData = null;
|
|
934
|
+
}
|
|
935
|
+
//# sourceMappingURL=globals.js.map
|