-
Notifications
You must be signed in to change notification settings - Fork 1
/
object_dynamic.cpp
644 lines (585 loc) · 24.2 KB
/
object_dynamic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
// *************************************************************************
// This file is part of AcidMUD by Steaphan Greene
//
// Copyright 1999-2022 Steaphan Greene <[email protected]>
//
// AcidMUD is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// AcidMUD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with AcidMUD (see the file named "COPYING");
// If not, see <http://www.gnu.org/licenses/>.
//
// *************************************************************************
#include <unistd.h>
#include <string>
#include "color.hpp"
#include "commands.hpp"
#include "dice.hpp"
#include "log.hpp"
#include "mind.hpp"
#include "object.hpp"
#include "properties.hpp"
#include "utils.hpp"
void Object::DynamicInit9() {}
void Object::DynamicInit8() {}
void Object::DynamicInit7() {}
void Object::DynamicInit6() {}
void Object::DynamicInit5() {}
void Object::DynamicInit4() {}
void Object::DynamicInit3() {}
void Object::DynamicInit2() { // Cyberpunk City
}
void Object::DynamicInit1() { // Dwarven mine
const std::u8string names[] = {
u8"An Entrance to a Large Mining Tunnel",
u8"A Large Mining Tunnel",
u8"A Large Mining Tunnel with a Small Tunnel to One Side",
u8"A Large Mining Tunnel",
u8"A Large Open Chamber",
u8"A Small Mining Tunnel",
u8"A Bend in a Small Mining Tunnel",
u8"A Fork in a Small Mining Tunnel",
u8"A Small Alcove"};
const std::u8string descs[] = {
u8"This tunnel looks to have been carved centuries ago. It is so well crafted\n"
u8"that you think it will stand as-is for another millenia.\n",
u8"This tunnel looks to have been carved centuries ago. It is so well crafted\n"
u8"that you think it will stand as-is for another millenia.\n",
u8"This tunnel looks to have been carved centuries ago. It is so well crafted\n"
u8"that you think it will stand as-is for another millenia. Another less\n"
u8"well-supported tunnel leads off in another direction.\n",
u8"This tunnel looks to have been carved centuries ago. It is so well crafted\n"
u8"that you think it will stand as-is for another millenia.\n",
u8"This is a large natural-looking opening. Perhaps this is where some of the\n"
u8"miners removed a large vein of ore, or maybe this cavern was just here due\n"
u8"to natural forces before they even got here. It seems the dwarves have used\n"
u8"this tunnel for more than just mining work - a large cage here looks well\n"
u8"used.\n",
u8"This tunnel looks to have been carved quickly. It looks like it might\n"
u8"collapse at any moment.\n",
u8"This bend in the tunnel looks to have been carved quickly. It looks like it\n"
u8"might collapse at any moment.\n",
u8"This tunnel fork looks to have been carved quickly. It looks like it\n"
u8"might collapse at any moment.\n",
u8"The tunnel comes to an end in a rough opening here.\n"};
int mojo = Skill(prhash(u8"DynamicMojo"));
ClearSkill(prhash(u8"DynamicMojo"));
// Tree structure, start with one door - dir of travel is opposite it.
std::u8string dirb = u8"south";
std::u8string dir = u8"north";
std::u8string dir2 = u8"west";
std::u8string dir3 = u8"east";
if (PickObject(u8"north", LOC_INTERNAL) != nullptr) {
dirb = u8"north";
dir = u8"south";
dir2 = u8"east";
dir3 = u8"west";
} else if (PickObject(u8"east", LOC_INTERNAL) != nullptr) {
dirb = u8"east";
dir = u8"west";
dir2 = u8"south";
dir3 = u8"north";
} else if (PickObject(u8"west", LOC_INTERNAL) != nullptr) {
dirb = u8"west";
dir = u8"east";
dir2 = u8"north";
dir3 = u8"south";
}
// Up and Down shafts are handled specially.
switch (Skill(prhash(u8"DynamicPhase"))) {
case (0): { // Entrance
if (mojo == 0)
mojo = 100000;
SetSkill(prhash(u8"Accomplishment"), 1510000);
Object* next = new Object(parent);
next->SetShortDesc(names[1]);
next->SetDesc(descs[1]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), 1); // Major Shaft
next->SetSkill(prhash(u8"DynamicMojo"), mojo - 1000);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (1): { // Major Shaft
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (mojo <= 0)
break; // End of Tunnel
int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
int ntype = Dice::Sample(ntypes);
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), mojo - 1000);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (2): { // Major Shaft w/ Minor Offshoot
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (mojo <= 0)
break; // End of Tunnel
int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
int ntype = Dice::Sample(ntypes);
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), (mojo - 1000) * 9 / 10);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
if (Dice::Rand(0, 1))
std::swap(dir2, dir3); // Half left, half right
next = new Object(parent);
next->SetShortDesc(names[5]);
next->SetDesc(descs[5]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), 5); // Minor Shaft
next->SetSkill(prhash(u8"DynamicMojo"), (mojo - 1000) / 10);
door1 = new Object(this);
door2 = new Object(next);
door1->SetShortDesc(dir2);
door2->SetShortDesc(dir3);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir2));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir3));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (3): { // Major Shaft w/ Secret Minor Offshoot
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (mojo <= 0)
break; // End of Tunnel
int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4};
int ntype = Dice::Sample(ntypes);
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), (mojo - 1000) * 3 / 4);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
if (Dice::Rand(0, 1)) {
std::swap(dir2, dir3); // Half left, half right
}
next = new Object(parent);
next->SetShortDesc(names[5]);
next->SetDesc(descs[5]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), 5); // Minor Shaft
next->SetSkill(prhash(u8"DynamicMojo"), (mojo - 1000) / 4);
next->SetSkill(prhash(u8"Accomplishment"), 1510002);
door1 = new Object(this);
door2 = new Object(next);
door1->SetShortDesc(dir2);
door2->SetShortDesc(dir3);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir2));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir3));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
door1->SetSkill(prhash(u8"Hidden"), 4 + Dice::Rand(0, 12));
} break;
case (4): { // Major Chamber
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,guard,dungeon_cage_key")->SetSkill(prhash(u8"Accomplishment"), 1500002);
}
Object* cage = new Object(this);
cage->SetShortDesc(u8"an old strong cage");
cage->SetDesc(
u8"This is a very old, large, rugged cage - probably built by "
u8"dwarves.\n");
cage->SetSkill(prhash(u8"Transparent"), 900);
cage->SetSkill(prhash(u8"Container"), 100000);
cage->SetSkill(prhash(u8"Locked"), 1);
cage->SetSkill(prhash(u8"Lock"), 1510003);
cage->SetSkill(prhash(u8"Closeable"), 1);
cage->SetSkill(prhash(u8"Accomplishment"), 1510003);
if (Dice::Percent(20)) {
mojo -= 500;
cage->AddNPC(u8"elven,prisoner")->SetSkill(prhash(u8"Accomplishment"), 1500004);
}
if (Dice::Percent(20)) {
mojo -= 500;
cage->AddNPC(u8"elven,prisoner")->SetSkill(prhash(u8"Accomplishment"), 1500004);
}
if (mojo <= 0)
break; // End of Tunnel
int ntypes[] = {1, 1, 1, 1, 1, 1, 1, 2, 2, 3};
int ntype = Dice::Sample(ntypes);
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), mojo - 1000);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a solid passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (5): { // Minor Shaft
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,explorer")->SetSkill(prhash(u8"Accomplishment"), 1500003);
}
if (mojo <= 0)
break; // End of Tunnel
// int ntypes[] = { 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 9 };
int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
int ntype = Dice::Sample(ntypes);
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), mojo - 100);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (6): { // Minor Shaft (Bend)
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,explorer")->SetSkill(prhash(u8"Accomplishment"), 1500003);
}
// int ntypes[] = { 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 9 };
int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
int ntype = Dice::Sample(ntypes);
if (Dice::Rand(0, 1)) {
std::swap(dir2, dir3); // Half left, half right
}
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), mojo - 100);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir2);
door2->SetShortDesc(dir3);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir2));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir3));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (7): { // Minor Shaft Fork
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,explorer")->SetSkill(prhash(u8"Accomplishment"), 1500003);
}
// int ntypes[] = { 5, 5, 5, 5, 5, 6, 6, 7, 7, 8, 9 };
int ntypes[] = {5, 5, 5, 5, 5, 6, 6, 7, 7, 8};
int ntype = Dice::Sample(ntypes);
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), (mojo - 100) / 2);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir2);
door2->SetShortDesc(dir3);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir2));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir3));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
ntype = Dice::Sample(ntypes);
std::swap(dir2, dir3); // Same code, opposite dir.
next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), (mojo - 100) / 2);
door1 = new Object(this);
door2 = new Object(next);
door1->SetShortDesc(dir2);
door2->SetShortDesc(dir3);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir2));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir3));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
} break;
case (8): { // Minor Shaft Alcove
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(30)) {
mojo -= 500;
AddNPC(u8"dwarven,miner")->SetSkill(prhash(u8"Accomplishment"), 1500000);
}
if (Dice::Percent(10)) {
mojo -= 500;
AddNPC(u8"dwarven,engineer")->SetSkill(prhash(u8"Accomplishment"), 1500001);
}
if (Dice::Percent(20)) {
mojo -= 500;
AddNPC(u8"dwarven,explorer")->SetSkill(prhash(u8"Accomplishment"), 1500003);
}
if (mojo <= 0)
break; // End of Tunnel
if (mojo > 10000 && Dice::Percent(20)) {
mojo -= 5000;
auto roll = d10();
if (roll <= 3) {
std::swap(dir, dir2);
std::swap(dirb, dir3);
} else if (roll > 7) {
std::swap(dir, dir3);
std::swap(dirb, dir2);
}
} else { // No secret tunnels here!
break;
}
int ntype = 5;
Object* next = new Object(parent);
next->SetShortDesc(names[ntype]);
next->SetDesc(descs[ntype]);
next->SetSkill(prhash(u8"DynamicInit"), 1);
next->SetSkill(prhash(u8"DynamicPhase"), ntype);
next->SetSkill(prhash(u8"DynamicMojo"), mojo - 500);
next->SetSkill(prhash(u8"Accomplishment"), 1510001);
Object* door1 = new Object(this);
Object* door2 = new Object(next);
door1->SetShortDesc(dir);
door2->SetShortDesc(dirb);
door1->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dir));
door2->SetDesc(fmt::format(u8"You see a crumbling passage leading {}.\n", dirb));
door1->AddAct(act_t::SPECIAL_LINKED, door2);
door1->SetSkill(prhash(u8"Open"), 1000);
door1->SetSkill(prhash(u8"Enterable"), 1);
door2->AddAct(act_t::SPECIAL_LINKED, door1);
door2->SetSkill(prhash(u8"Open"), 1000);
door2->SetSkill(prhash(u8"Enterable"), 1);
door1->SetSkill(prhash(u8"Hidden"), 4 + Dice::Rand(0, 12));
} break;
default: {
loge(
u8"Unknown dynamic-phase-type ({}-{}) init requested!\n",
Skill(prhash(u8"DynamicInit")),
Skill(prhash(u8"DynamicPhase")));
} break;
}
ClearSkill(prhash(u8"DynamicPhase"));
}
void Object::DynamicInit() {
switch (Skill(prhash(u8"DynamicInit"))) {
case (2): { // Cyberpunk City
DynamicInit2();
} break;
case (1): { // Dwarven Mine
DynamicInit1();
} break;
default: {
loge(u8"Unknown dynamic-type ({}) init requested!", Skill(prhash(u8"DynamicInit")));
} break;
}
ClearSkill(prhash(u8"DynamicInit"));
}