/
databank-objects.php
2034 lines (1913 loc) · 107 KB
/
databank-objects.php
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
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
extract(array_flip(H3Effect::context));
extract(array_flip(H3Effect::operation));
extract(array_flip(AClass::terrain), EXTR_PREFIX_ALL, 't');
extract($constants['resources']);
extract($constants['shroud'], EXTR_PREFIX_ALL, 'shr');
extract(json_decode(file_get_contents("$outPath/creaturesID.json"), true));
$h3Classes = []; // SoD class => array of AClass->$id
//$c_IDNAME = array of AClass->$id
//$c_IDNAME_SUBCLASS = array of AClass->$id
foreach ($objects as $id => $obj) {
$h3Classes[$obj->class][] = $id;
${"c_$obj->idName"}[] = $id;
${"c_{$obj->idName}_$obj->subclass"}[] = $id;
}
$adve = array_column(csvFile($options, 'ADVEVENT.TXT', 0, false), 0);
$genr = array_column(csvFile($options, 'GENRLTXT.TXT', 0, false), 0);
$seer = csvFile($options, 'SEERHUT.TXT', 0);
$garr = idListFile($options, 'GARRISON.TXT', 'AClass::makeIdentifier');
$mine = idListFile($options, 'MINENAME.TXT', 'AClass::makeIdentifier');
$minc = array_column(csvFile($options, 'MINEEVNT.TXT', 0), 0);
$spells = json_decode(file_get_contents("$outPath/spellsID.json"), true);
$skills = json_decode(file_get_contents("$outPath/skillsID.json"), true);
$skillStore = ObjectStore::fromFile("$outPath/skills.json");
$special = $common = $minor = $major = $relic = [];
$store = ObjectStore::fromFile("$outPath/artifacts.json");
for ($id = 0; $id < $store->x(); $id++) {
${Artifact::rarity[$store->atCoords($id, 0, 0, 'rarity')] ?? 'special'}[] = $id;
}
$level1 = $level2 = $level3 = $level4 = $level5 = [];
$store = ObjectStore::fromFile("$outPath/spells.json");
for ($id = 0; $id < $store->x(); $id++) {
if (!$store->atCoords($id, 0, 0, 'byCreature')) {
${'level'.$store->atCoords($id, 0, 0, 'level')}[] = $id;
}
}
$o_false = [$const, false];
// Generates $modifier value for quest_chances.
// $s = 'label[/chance] [label...]'.
// $chances('W/2 O', 'res') //=> [$const, ['resW' => 2, 'resO' => 1]]
$chances = function ($s, $prefix = '') use ($const) {
$res = [];
foreach (is_array($s) ? $s : explode(' ', $s) as $s) {
$res[$prefix.strtok($s, '/')] = strtok('') ?: 1;
}
return [$const, $res];
};
// function ([placeholder,] [replacer,] array of variants, ...template values)
//
// All arguments but the first are collected into a single array.
// Returns an array sized its length * count of variants, where key equals key
// in variants and value is a copy of the collected array, with two type of
// replacements done on its array members (recursively):
//
// 1. If a key has '$', it's replaced with the variant value (key is renamed).
// 2. If a value is $e, it's replaced with the current variant value.
// 3. If a value is exactly placeholder (non-array), do as with $e above.
// 4. If a value is other and is scalar, it's replaced with replacer's result.
//
// For example, $e(['a' => 1, 'b' => 2], ['message-$' => $e]) returns
// [ 'a' => [['message-1' => 1]], 'b' => [['message-2' => 2]] ].
//
// function (array to flatten)
//
// Removes one layer of nesting from the array by treating each member like so:
//
// 1. If the member's key is an integer, its contents is merged (+=) into
// the result.
// 2. If it's a string, the contents is inserted under that key verbatim
// (without unwrapping).
//
// For example, $e([123 => ['a' => 'A', 5 => 'B'], 'c' => 'C']) returns
// ['a' => 'A', 5 => 'B', 'c' => 'C'].
//
// Both call forms should be used in conjunction: the first creates nested
// arrays while the latter unwraps them to form the final value. For example:
//
// $final = $e([
// $e([11 => 1, 22 => 2], ['creature_morale', 'ifDay' => $e]),
// 'label' => [['hero_spellPower', -1]],
// ]);
//
// // Same as:
// $final = [
// 11 => [['creature_morale', 'ifDay' => 1]],
// 22 => [['creature_morale', 'ifDay' => 2]],
// 'label' => [['hero_spellPower', -1]],
// ];
$mergeKeys = array_merge($c_pandoraBox, $c_redwoodObservatory, $c_pillarOfFire, $c_resource_0, $c_resource_1, $c_resource_2, $c_resource_3, $c_resource_4, $c_resource_5, $c_resource_6);
$e = function ($value, ...$array) use (&$e, $mergeKeys) {
if ($array) {
$placeholder = $e;
$replacer = null;
for ($i = 0; $i <= 1; ) {
if ($i <= 0 and !is_array($value) and !$value instanceof Closure) {
$placeholder = $value;
$i = 1;
} elseif ($i <= 1 and $value instanceof Closure) {
$replacer = $value;
$i = 2;
} else {
break;
}
$value = array_shift($array);
}
$replace = function ($value, $array)
use (&$replace, $e, $placeholder, $replacer) {
$res = [];
foreach ($array as $k => $v) {
if ($v and (is_array($v) or is_object($v)) and $v !== $e) {
$v = $replace($value, $v);
} elseif ($v === $e or $v === $placeholder) {
$v = $value;
} elseif ($replacer and is_scalar($v)) {
$v = $replacer($value, $v);
}
$res[str_replace('$', $value, $k)] = $v;
}
return $res;
};
return array_map(function ($value) use ($array, $replace) {
return $replace($value, $array);
}, $value);
} else {
$res = [];
foreach ($value as $k => $v) {
if (is_int($k)) {
// The check for duplicate key helps locating misplaced definitions, given the $value is defined over thousands of lines. However, some rare keys intend to be merged, on whitelist basis.
foreach ($v as $kk => $vv) {
if (in_array($kk, $mergeKeys)) {
$res[$kk] = array_merge($res[$kk] ?? [], $vv);
unset($v[$kk]);
}
}
$old = array_keys($res);
$res += $v;
if (count($old) + count($v) !== count($res)) {
throw new \Exception('Duplicate key(s): '.join(', ', array_intersect(array_keys($v), $old)));
}
} else {
if (array_key_exists($k, $res)) {
throw new \Exception("Duplicate key: $k");
}
$res[$k] = $v;
}
}
return $res;
}
};
// $e0()/$e00() unwrap 1/2 levels of external arrays.
//
// $e(['a' => 1, 'b' => 2], ['x']); //=> ['a' => [['x']], 'b' => [['x']]]
// $e0(['a' => 1, 'b' => 2], ['x']); //=> [['x'], ['x']]
// $e00(['a' => 1, 'b' => 2], ['x']); //=> ['x', 'x']
$e0 = function () use ($e) {
return array_merge(...array_values($e(...func_get_args())));
};
$e00 = function () use ($e0) {
return array_merge(...array_values($e0(...func_get_args())));
};
return [
// Determined empirically from the editor's help and in-game trial.
//
// Description snippets below come from the editor's help (H3MAPED.HLP), decoded into RTF using helpdc21.zip.
//
// Members are of two types: class description and labeled Effect, depending on whether the key is an integer (AClass->$id) or not (Effect->$label).
//
// Class description's value is an array of arrays (static Effects). If the 'ifBonusObjectClass' key is not present ("null" counts as present), it is set to the described AClass->$id. GenericEncounter specifies expansion rules for Effects "inside" bonus_effects.
//
// Labeled Effect is also an array of arrays. Index 2 stands for 'ifObject'. If the 'ifBonusObject' key is not present ("null" counts as present), it is set to true. GenericEncounter specifies expansion rules for all arrays (Effects).
//
// Top-level Effects of both have defaults for 'priority', and the first also has default for 'source' (labeled Effects do not because it's usually set to $encounter by GenericEncounter's shortcut of false). Nested in bonus_effects do not have these defaults. Nested should be also anchored using 'ifObject' => true, or using 'ifPlayer', 'ifBonusObject' or other.
//
// Most of object encounter's parameters are defined here but not all. Some
// objects have support code in these files:
// * H3.Rules.js (deviations from common GenericEncounter algorithm)
// * H3.DOM.UI.js (displaying UI for quest_choices, etc.)
// * h3m2herowo.php (map-specific features)
//
// Audio data is coming from Sounds.txt. XXX=C `{Audio`}-s need to be checked with the actual game sounds.
//
// According to action mask in OBJECTS.TXT, there are 116 unique actionable
// classes. Columns: SoD class, HeroWO $idName, OBJNAMES.TXT entry.
//
// 2 altarOfSacrifice Altar of Sacrifice
// 4 arena Arena
// 5 artifact Artifact
// 6 pandoraBox Pandora's Box
// 7 blackMarket Black Market
// 8 boat Boat
// 9 borderGuard Border Guard
// 10 keymasterTent Keymaster's Tent
// 11 buoy Buoy
// 12 campfire Campfire
// 13 cartographer Cartographer
// 14 swanPond Swan Pond
// 15 coverOfDarkness Cover of Darkness
// 16 creatureBank Creature Bank
// 17 creatureGenerator1 Creature Generator 1
// 20 creatureGenerator4 Creature Generator 4
// 22 corpse Corpse
// 23 marlettoTower Marletto Tower
// 24 derelictShip Derelict Ship
// 25 dragonUtopia Dragon Utopia
// 26 event Event
// 27 eyeOfMagi Eye of the Magi
// 28 faerieRing Faerie Ring
// 29 flotsam Flotsam
// 30 fountainOfFortune Fountain of Fortune
// 31 fountainOfYouth Fountain of Youth
// 32 gardenOfRevelation Garden of Revelation
// 33 garrison Garrison
// 34 hero Hero
// 35 hillFort Hill Fort
// 36 grail Grail
// 37 hutOfMagi Hut of the Magi
// 38 idolOfFortune Idol of Fortune
// 39 leanTo Lean To
// 41 libraryOfEnlightenment Library of Enlightenment
// 42 lighthouse Lighthouse
// 43 monolithOneWayEntrance Monolith One Way Entrance
// 44 monolithOneWayExit Monolith One Way Exit
// 45 monolithTwoWay Monolith Two Way
// 47 schoolOfMagic School of Magic
// 48 magicSpring Magic Spring
// 49 magicWell Magic Well
// 51 mercenaryCamp Mercenary Camp
// 52 mermaids Mermaids
// 53 mine Mine
// 54 monster Monster
// 55 mysticalGarden Mystical Garden
// 56 oasis Oasis
// 57 obelisk Obelisk
// 58 redwoodObservatory Redwood Observatory
// 59 oceanBottle Ocean Bottle
// 60 pillarOfFire Pillar of Fire
// 61 starAxis Star Axis
// 62 prison Prison
// 63 pyramid Pyramid
// 64 rallyFlag Rally Flag
// 65 randomArtifact Random Artifact
// 66 randomTreasureArtifact Random Treasure Artifact
// 67 randomMinorArtifact Random Minor Artifact
// 68 randomMajorArtifact Random Major Artifact
// 69 randomRelic Random Relic
// 70 randomHero Random Hero
// 71 randomMonster Random Monster
// 72 randomMonster1 Random Monster 1
// 73 randomMonster2 Random Monster 2
// 74 randomMonster3 Random Monster 3
// 75 randomMonster4 Random Monster 4
// 76 randomResource Random Resource
// 77 randomTown Random Town
// 78 refugeeCamp Refugee Camp
// 79 resource Resource
// 80 sanctuary Sanctuary
// 81 scholar Scholar
// 82 seaChest Sea Chest
// 83 seerHut Seer's Hut
// 84 crypt Crypt
// 85 shipwreck Shipwreck
// 86 shipwreckSurvivor Shipwreck Survivor
// 87 shipyard Shipyard
// 88 shrineOfMagicIncantation Shrine of Magic Incantation
// 89 shrineOfMagicGesture Shrine of Magic Gesture
// 90 shrineOfMagicThought Shrine of Magic Thought
// 91 sign Sign
// 92 sirens Sirens
// 93 spellScroll Spell Scroll
// 94 stables Stables
// 95 tavern Tavern
// 96 temple Temple
// 97 denOfThieves Den of Thieves
// 98 town Town
// 99 tradingPost Trading Post
// 100 learningStone Learning Stone
// 101 treasureChest Treasure Chest
// 102 treeOfKnowledge Tree of Knowledge
// 103 subterraneanGate Subterranean Gate
// 104 university University
// 105 wagon Wagon
// 106 warMachineFactory War Machine Factory
// 107 schoolOfWar School of War
// 108 warriorTomb Warrior's Tomb
// 109 waterWheel Water Wheel
// 110 wateringHole Watering Hole
// 111 whirlpool Whirlpool
// 112 windmill Windmill
// 113 witchHut Witch Hut
// 162 randomMonster5 Random Monster 5
// 163 randomMonster6 Random Monster 6
// 164 randomMonster7 Random Monster 7
// 212 borderGate Border Gate
// 213 freelancerGuild Freelancer's Guild
// 214 heroPlaceholder Hero Placeholder
// 215 questGuard Quest Guard
// 216 randomDwelling Random Dwelling
// 217 randomDwellingByLevel
// 218 randomDwellingByTown
// 219 garrison Garrison
// 220 mine Mine
// 221 tradingPost Trading Post
//
// Classes with effects that don't have actionability in OBJECTS.TXT:
// 3 anchorPoint Anchor Point (?)
// 18 creatureGenerator2 Creature Generator 2
// 19 creatureGenerator3 Creature Generator 3
// 21 cursedGround Cursed Ground
// 46 magicPlains Magic Plains
// 50 marketOfTime Market of Time (?)
// 222 cloverField Clover Field
// 223 cursedGround Cursed Ground
// 224 evilFog Evil Fog
// 225 favorableWinds Favorable Winds (?)
// 226 fieryFields Fiery Fields
// 227 holyGround Holy Ground
// 228 lucidPools Lucid Pools
// 229 magicClouds Magic Clouds
// 230 magicPlains Magic Plains
// 231 rocklands Rocklands
'encounterEffectsOfObject' => $e([
//array_fill_keys($c_altarofSacrifice, [XXX=I]),
// Castle, Rampart, and Tower heroes may sacrifice artifacts for experience.
//
// Inferno, Necropolis, and Dungeon heroes may sacrifice creatures for experience.
//
// Stronghold and Fortress heroes may sacrifice artifacts or creatures for experience.
array_fill_keys($c_arena, [
['quest_choices', [$append, 'attack2', 'defense2']],
['quest_message', [$const, [$adve[1].'`{Audio NOMAD`}']]],
]),
// Player's choice to add +2 to the visiting hero's Attack or Defense.
'attack2' => [['hero_attack', +2, true, 'ifBonusObject' => null]],
'defense2' => [['hero_defense', +2, true, 'ifBonusObject' => null]],
// pandoraBox and event are defined by map convertor.
array_fill_keys($c_pandoraBox, [
['quest_remove', true],
]),
// Anything or everything may be put into Pandora’s Box.
//
// Events are user created experiences.
// Events placed on the map can only be triggered by heroes.
$e($e0(
function ($v, $s) use ($adve, $c_event) {
if ($s === $adve[15] and in_array($v, $c_event)) {
$s = null; // show no message for Event if there are no standard effects
}
return $s;
},
array_merge($c_pandoraBox, $c_event),
[
'$' => [
// XXX=IC SoD filters learned secondary skills in the message by ignoring ones the hero already has (or all, if he has 8 skills already)
//
// XXX=IC SoD may show multiple messages if it deems the content to be displayed is too large; each message uses its own text detection (i.e. if first bonus shown on that message is 'creatures' that it'd use that text, no matter what was the first bonus of the first message)
['bonus_message', [$custom, 'rules', 3,
sprintf(toMarkup($adve[175], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[177], ''), '`{HeroName`}'),
// SoD seems to have a bug: it shows the "gains" message even if negative.
sprintf(toMarkup($adve[176], ''), '`{HeroName`}'),
// SoD shows 1 icon -1/+1 even if modifier is -2/+2/-3/+2. We show multiple, in classic mode. Same for luck (shows 0/+1 icons).
sprintf(toMarkup($adve[179], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[178], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[181], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[180], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[183], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[182], ''), '`{HeroName`}'),
// XXX=C need to check for spell book and wisdom (quest_fulfilled)?
sprintf(toMarkup($adve[184], ''), '`{HeroName`}'),
sprintf(toMarkup($adve[188], ''), '`{HeroName`}'),
// ADVEVENT.TXT[185]
//
// XXX=IC Slightly different message from SoD (SoD shows "A" instead of count "1"); also it has a bug: it only checks first creature's stack size; if it's 1 then this message is used even if there are other creatures granted (or the same creature but in another stack)
"`{Bonuses`} joins `{HeroName`}'s army.\n\n`{BonusesImages`}",
// XXX=IC Slightly different message from SoD (SoD shows no count)
sprintf(toMarkup($adve[186], ''), '`{Bonuses`}', '`{HeroName`}'),
sprintf(toMarkup($adve[175], ''), '`{HeroName`}'),
$adve[15]]],
],
]
)),
// Encounter sound: MYSTERY.
//array_fill_keys($c_blackMarket, [XXX=I]),
// Artifacts may be purchased at the Black Market.
// No Effects needed.
//array_fill_keys($c_boat, []),
array_fill_keys($c_borderGuard, [
['quest_fulfilled', $o_false],
['quest_choices', [$append, 'remove', 'cancel']],
['quest_message', [$const, [$borderGuard = $adve[18].'`{Audio CAVEHEAD`}']]],
]),
// Usually placed at choke points, a hero must visit a Keymaster’s tent of the associated color for the password.
'remove' => [['quest_remove', true]],
array_fill_keys($c_borderGate, [
['quest_fulfilled', $o_false],
['quest_message', [$const, [$borderGuard]]],
]),
// Usually placed at choke points, a hero must visit the keymaster of the associated color in order to get the password. Each player must visit the keymaster, as the Border Gate will not disappear after the first player visits it.
array_fill_keys($c_keymasterTent_0, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_0[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[0], 'ifPlayer' => true],
],
]),
$qmsg = ['quest_message', [$const, [$adve[20].'`{Audio CAVEHEAD`}']]],
$bmsg = ['bonus_message', [$const, [$adve[19].'`{Audio CAVEHEAD`}']]],
]),
// For a hero to pass a Border Guard, the hero must visit the Keymaster’s tent of the associated color.
array_fill_keys($c_keymasterTent_1, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_1[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[1], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[1], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_keymasterTent_2, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_2[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[2], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[2], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_keymasterTent_3, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_3[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[3], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[3], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_keymasterTent_4, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_4[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[4], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[4], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_keymasterTent_5, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_5[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[5], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[5], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_keymasterTent_6, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_6[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[6], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[6], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_keymasterTent_7, [
bonus_effects([
[
$append,
['quest_fulfilled', $o_false, 'ifBonusObjectClass' => $c_keymasterTent_7[0], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGuard[7], 'ifPlayer' => true],
['quest_fulfilled', true, 'ifBonusObjectClass' => $c_borderGate[7], 'ifPlayer' => true],
],
]),
$qmsg,
$bmsg,
]),
array_fill_keys($c_buoy, [
bonus_effects([[$append, ['creature_morale', +1, true, 'maxCombats' => 1]]]),
['quest_message', [$const, [toMarkup($adve[22], '`{Audio MORALE`}')]]],
['bonus_message', [$const, [toMarkup($adve[21], '`{MoraleImage +1`}`{Audio MORALE`}')]]],
]),
// Visiting a Buoy gives a hero +1 morale until the next battle.
array_fill_keys($c_campfire, [
['quest_chances', $chances('GW GM GO GS GC GJ', 'camp')],
['bonus_resource', [$random, 400, 600], 'ifResource' => $gold, 'ifTargetPlayer' => -1],
['quest_remove', true],
['bonus_message', [$const, [toMarkup($adve[23], '`{BonusesImages`}`{Audio EXPERNCE`}')]]],
]),
// +400-600 gold.
// +4-6 random resource other than gold.
'campGW' => [
['bonus_resource', [$random, 4, 6], 'ifResource' => $wood, 'ifTargetPlayer' => -1],
],
'campGM' => [
['bonus_resource', [$random, 4, 6], 'ifResource' => $mercury, 'ifTargetPlayer' => -1],
],
'campGO' => [
['bonus_resource', [$random, 4, 6], 'ifResource' => $ore, 'ifTargetPlayer' => -1],
],
'campGS' => [
['bonus_resource', [$random, 4, 6], 'ifResource' => $sulfur, 'ifTargetPlayer' => -1],
],
'campGC' => [
['bonus_resource', [$random, 4, 6], 'ifResource' => $crystal, 'ifTargetPlayer' => -1],
],
'campGJ' => [
['bonus_resource', [$random, 4, 6], 'ifResource' => $gems, 'ifTargetPlayer' => -1],
],
array_fill_keys($c_cartographer_0, [
['quest_fulfilled', [$check, 'resources_gold', 1000]],
['quest_choices', [$append, 'cartW', 'cancel']],
['bonus_resource', -1000, 'ifResource' => $gold, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_water, 'ifTargetPlayer' => -1],
$msg = ['quest_message', [$custom, 'rules', 2,
// XXX=I: dlc: the replaced substring is not found in localized TXTs
str_replace('1000 gold', '`{Checks`}`{Audio LIGHTHOUSE`}', $adve[28]),
$adve[24].'`{Audio LIGHTHOUSE`}',
]],
]),
// There are three different cartographers: land, ocean, or underworld.
//
// A Hero pays 1000 gold to remove the shroud from the land, ocean, or underworld.
'cartW' => $e0(
PHP_INT_MAX,
$c_cartographer_0,
bonus_effects([[$append, ['quest_fulfilled', [$check, false], 'ifPlayer' => true, 'ifBonusObjectClass' => PHP_INT_MAX]]])
),
array_fill_keys($c_cartographer_1, [
['quest_fulfilled', [$check, 'resources_gold', 1000]],
['quest_choices', [$append, 'cartT', 'cancel']],
['bonus_resource', -1000, 'ifResource' => $gold, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_dirt, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_desert, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_grass, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_snow, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_swamp, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_rough, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_lava, 'ifTargetPlayer' => -1],
$msg,
]),
'cartT' => $e0(
PHP_INT_MAX,
$c_cartographer_1,
bonus_effects([[$append, ['quest_fulfilled', [$check, false], 'ifPlayer' => true, 'ifBonusObjectClass' => PHP_INT_MAX]]])
),
array_fill_keys($c_cartographer_2, [
['quest_fulfilled', [$check, 'resources_gold', 1000]],
['quest_choices', [$append, 'cartU', 'cancel']],
['bonus_resource', -1000, 'ifResource' => $gold, 'ifTargetPlayer' => -1],
['bonus_shroudTerrain', [$append, ['AtCoords', null, null, null, null, $shr_cartographer, true]], 'ifTerrain' => $t_subterranean, 'ifTargetPlayer' => -1],
$msg,
]),
'cartU' => $e0(
PHP_INT_MAX,
$c_cartographer_2,
bonus_effects([[$append, ['quest_fulfilled', [$check, false], 'ifPlayer' => true, 'ifBonusObjectClass' => PHP_INT_MAX]]])
),
// XXX+B HeroAP remains full at the end of the move because its update is called twice: first in response to GenericEncounter setting AP to 0, then during running transaction of do=heroMove that triggered the encounter
array_fill_keys($c_swanPond, [
bonus_effects([[$append, ['creature_luck', +2, true, 'maxCombats' => 1]]]),
['bonus_actionPoints', 0.0, 'ifTargetObject' => -1],
['quest_message', [$const, [toMarkup($adve[30], '`{Audio LUCK`}')]]],
['bonus_message', [$const, [toMarkup($adve[29], '`{LuckImage +2`}`{Audio LUCK`}')]]],
]),
// +2 Luck until the next battle.
// Lose all current movement.
array_fill_keys($c_coverOfDarkness, [
[
'bonus_shroud',
[
$append,
['WithinCircle', null, null, 20, null, null, $shr_cartographer, false],
['WithinCircle', null, null, 20, null, null, $shr_observatory, false],
['WithinCircle', null, null, 20, null, null, $shr_eyeOfMagi, false],
],
'ifTargetPlayer' => -1,
'isTargetEnemy' => true,
],
['bonus_message', [$const, [toMarkup($adve[31], '`{Audio LIGHTHOUSE`}')]]],
]),
// Regenerates the shroud for enemy heroes, for a 20-tile radius.
//
// mightandmagic.fandom.com states that: "Visiting the Cover of Darkness will cover the nearest city with a permanent shroud for all players." - but this claim is not supported by in-game tests.
array_fill_keys($c_corpse, [
['quest_chances', $chances('nothing/799 artT/67 artM/67 artJ/67')],
['quest_fulfilled', $o_false, 'ifGrantedMin' => 1],
['quest_message', [$const, [$msg = toMarkup($adve[38], '`{Audio MYSTERY`}')]]],
['bonus_message', [$custom, 'rules', 1,
toMarkup($adve[37])."`{Bonuses`}.\n\n`{BonusesImages`}`{Audio MYSTERY`}",
$msg]],
]),
// 80% chance of finding nothing.
// 20% chance of finding random Treasure, Minor, or Major artifact.
'nothing' => [],
array_fill_keys($c_marlettoTower, [
bonus_effects([[$append, ['hero_defense', +1, true]]]),
['quest_message', [$const, [toMarkup($adve[40], '`{Audio NOMAD`}')]]],
['bonus_message', [$const, [toMarkup($adve[39], '`<`{StatImage defense`} +1 Defense Skill`>`{Audio NOMAD`}')]]],
]),
// +1 Defense
// Defined by write_banks().
array_fill_keys($c_derelictShip, [
bonus_effects([[$append, ['creature_morale', -1, true, 'maxCombats' => 1]], 'ifGrantedMin' => 1]),
// No audio in this message.
['quest_message', [$const, [$adve[42]."\n\n`{MoraleImage -1`}"]]],
]),
// 30% 20 Water Elementals for 3kgold.
// 30% 30 Water Elementals for 3kgold and 1 Treasure Artifact.
// 30% 40 Water Elementals for 4kgold and 1 Treasure Artifact.
// 10% 60 Water Elementals for 6kgold and 1 Minor Artifact.
//
// (The above help from the editor doesn't mention that hero gets -1 morale if the ship was visited before.)
// Defined by write_banks().
array_fill_keys($c_dragonUtopia, [
['quest_message', [$const, [$genr[425].'`{Audio DRAGON`}']]],
]),
// 30% Fight 8 Green Dragons, 5 Red Dragons, 2 Gold Dragons, and 1 Black Dragons for 20kgold and 1 Treasure Artifact, 1 Minor Artifact, 1 Major Artifact, and 1 Relic Artifact.
//
// 30% Fight 8 Green Dragons, 6 Red Dragons, 3 Gold Dragons, and 2 Black Dragons for 30kgold and 1 Minor Artifact, 1 Major Artifact, and 2 Relic Artifacts.
//
// 30% Fight 8 Green Dragons, 6 Red Dragons, 4 Gold Dragons, and 3 Black Dragons for 40kgold and 1 Major Artifact, and 3 Relic Artifacts.
//
// 10% Fight 8 Green Dragons, 7 Red Dragons, 6 Gold Dragons, and 5 Black Dragons for 50kgold and 4 Relic Artifacts.
// Defined by map convertor.
array_fill_keys($c_eyeOfMagi, [
['bonus_message', [$const, [$adve[48].'`{Audio LIGHTHOUSE`}']]],
]),
// Not interactive, Eyes of the Magi illuminate shrouded areas when a hero visits a Hut of the Magi.
array_fill_keys($c_faerieRing, [
bonus_effects([[$append, ['creature_luck', +1, true, 'maxCombats' => 1]]]),
['quest_message', [$const, [toMarkup($adve[50], '`{Audio LUCK`}')]]],
['bonus_message', [$const, [toMarkup($adve[49], '`{LuckImage +1`}`{Audio LUCK`}')]]],
]),
// +1 Luck until the next battle.
array_fill_keys($c_flotsam, [
['quest_chances', $chances('nothing wood5 wgold200 wgold500')],
['quest_remove', true],
['bonus_message', [$custom, 'rules', 2,
toMarkup($adve[52], '`{BonusesImages`}`{Audio GENIE`}'),
toMarkup($adve[53], '`{BonusesImages`}`{Audio GENIE`}'),
toMarkup($adve[51], '`{Audio GENIE`}')]],
]),
// 25% chance of getting nothing.
// 25% chance of getting 05 Wood.
// 25% chance of getting 05 Wood and 200 Gold.
// 25% chance of getting 10 Wood and 500 Gold.
'wood5' => [
['bonus_resource', 5, 'ifResource' => $wood, 'ifTargetPlayer' => -1],
],
'wgold200' => [
['bonus_resource', 5, 'ifResource' => $wood, 'ifTargetPlayer' => -1],
['bonus_resource', 200, 'ifResource' => $gold, 'ifTargetPlayer' => -1],
],
'wgold500' => [
['bonus_resource', 10, 'ifResource' => $wood, 'ifTargetPlayer' => -1],
['bonus_resource', 500, 'ifResource' => $gold, 'ifTargetPlayer' => -1],
],
array_fill_keys($c_fountainOfFortune, [
// One way to generate random luck would be by using quest_chances + quest_reset (with bonus_effects and bonus_message in every label's Effects). Another, less straightforward but less verbose is using $randomArray to replace bonus_effects, with a single bonus_message that reads the actual value (addressed by encounterLabel).
bonus_effects([
[$randomArray, 0,
// Doesn't give 0 luck, from my tests.
[['creature_luck', -1, true, 'maxCombats' => 1, 'encounterLabel' => 'm']],
[['creature_luck', +1, true, 'maxCombats' => 1, 'encounterLabel' => 'm']],
[['creature_luck', +2, true, 'maxCombats' => 1, 'encounterLabel' => 'm']],
[['creature_luck', +3, true, 'maxCombats' => 1, 'encounterLabel' => 'm']],
],
]),
['quest_message', [$const, [toMarkup($adve[56], '`{Audio LUCK`}')]]],
// XXX=IC Slightly different from SoD: it shows one neutral luck (0) icon for -1 luck or one +1 for others. We in classic mode show 2/3 +1 icons for +2/+3 luck.
['bonus_message', [$const, [toMarkup($adve[55], '`{LuckImage m`}`{Audio LUCK`}')]]],
]),
// -1 to +3 Luck until the next battle.
array_fill_keys($c_fountainOfYouth, [
bonus_effects([[$append, ['creature_morale', +1, true, 'maxCombats' => 1]]]),
['bonus_actionPoints', +4, 'ifTargetObject' => -1],
['quest_message', [$const, [toMarkup($adve[58], '`{Audio MORALE`}')]]],
['bonus_message', [$const, [toMarkup($adve[57], '`{MoraleImage +1`}`{Audio MORALE`}')]]],
]),
// +1 Morale until next battle.
// +4 Adventure movement until the end of the day.
// No Effects needed. Has entry in spotEffectsOfObject.
// Class 33 subclass 0, class 219 subclass 0.
//array_fill_keys($c_garrison_0, []),
// Location for storing troops at a choke point.
array_fill_keys($c_gardenOfRevelation, [
bonus_effects([[$append, ['hero_knowledge', +1, true]]]),
['quest_message', [$const, [toMarkup($adve[60], '`{Audio GETPROTECTION`}')]]],
['bonus_message', [$const, [toMarkup($adve[59], '`<`{StatImage knowledge`} +1 Knowledge`>`{Audio GETPROTECTION`}')]]],
]),
// +1 Knowledge
// Encounter sound: MILITARY.
//array_fill_keys($c_hillFort, [XXX=I]),
// Upgrade base grade creatures.
//array_fill_keys($c_grail, [XXX=I:grl:),
// Customizable.
// Buried artifact found via the Puzzle Map.
// Placing this object determines the location of grail.
// Otherwise, a random location is chosen when an obelisk is placed.
// Defined by map convertor.
array_fill_keys($c_hutOfMagi, [
['bonus_message', [$const, [$adve[61].'`{Audio LIGHTHOUSE`}']]],
// XXX=I: eyom: SoD also shows every Eye, pausing for several seconds before going to next; we should do the same, plus allow breaking out of this by clicking anywhere (in non-classic mode)
]),
// Visiting a Hut of the Magi illuminates locations around an Eye of the Magi.
array_fill_keys($c_idolOfFortune, [
bonus_effects([[$append, ['creature_luck', +1, true, 'maxCombats' => 1]], 'ifDateDay' => 1]),
bonus_effects([[$append, ['creature_luck', +1, true, 'maxCombats' => 1]], 'ifDateDay' => 3]),
bonus_effects([[$append, ['creature_luck', +1, true, 'maxCombats' => 1]], 'ifDateDay' => 5]),
bonus_effects([[$append, ['creature_morale', +1, true, 'maxCombats' => 1]], 'ifDateDay' => 2]),
bonus_effects([[$append, ['creature_morale', +1, true, 'maxCombats' => 1]], 'ifDateDay' => 4]),
bonus_effects([[$append, ['creature_morale', +1, true, 'maxCombats' => 1]], 'ifDateDay' => 6]),
bonus_effects([
[
$append,
['creature_luck', +1, true, 'maxCombats' => 1],
['creature_morale', +1, true, 'maxCombats' => 1],
],
'ifDateDay' => 7,
]),
['quest_message', [$const, [toMarkup($adve[63], '`{Audio LUCK`}')]]],
['bonus_message', [$const, [$luck = toMarkup($adve[62], '`{LuckImage +1`}`{Audio LUCK`}')]], 'ifDateDay' => 1],
['bonus_message', [$const, [$luck]], 'ifDateDay' => 3],
['bonus_message', [$const, [$luck]], 'ifDateDay' => 5],
['bonus_message', [$const, [$morale = toMarkup($adve[62], '`{MoraleImage +1`}`{Audio LUCK`}')]], 'ifDateDay' => 2],
['bonus_message', [$const, [$morale]], 'ifDateDay' => 4],
['bonus_message', [$const, [$morale]], 'ifDateDay' => 6],
['bonus_message', [$const, [toMarkup($adve[62], '`{LuckImage +1`} `{MoraleImage +1`}`{Audio LUCK`}')]], 'ifDateDay' => 7],
]),
// +1 Luck until the next battle, on odd days of the week not Day7.
// +1 Morale until next battle, on even days of the week.
// +1 Luck and Morale until next battle, on Day7.
array_fill_keys($c_leanTo, [
['quest_chances', $chances('W M O C S J', 'lean')],
['quest_fulfilled', $o_false, 'ifGrantedMin' => 1],
['quest_message', [$const, [toMarkup($adve[65], '`{Audio GENIE`}')]]],
['bonus_message', [$const, [toMarkup($adve[64], '`{BonusesImages`}`{Audio GENIE`}')]]],
]),
// +1-4 of any resource other than gold.
'leanW' => [['bonus_resource', [$random, 1, 4], 'ifResource' => $wood, 'ifTargetPlayer' => -1]],
'leanM' => [['bonus_resource', [$random, 1, 4], 'ifResource' => $mercury, 'ifTargetPlayer' => -1]],
'leanO' => [['bonus_resource', [$random, 1, 4], 'ifResource' => $ore, 'ifTargetPlayer' => -1]],
'leanC' => [['bonus_resource', [$random, 1, 4], 'ifResource' => $crystal, 'ifTargetPlayer' => -1]],
'leanS' => [['bonus_resource', [$random, 1, 4], 'ifResource' => $sulfur, 'ifTargetPlayer' => -1]],
'leanJ' => [['bonus_resource', [$random, 1, 4], 'ifResource' => $gems, 'ifTargetPlayer' => -1]],
array_fill_keys($c_libraryOfEnlightenment, [
// Determined empirically that level 10+ starts working.
['quest_fulfilled', [$check, 'level', 10]],
bonus_effects([[$append,
['hero_attack', +2, true],
['hero_defense', +2, true],
['hero_spellPower', +2, true],
['hero_knowledge', +2, true],
]]),
['quest_message', [$custom, 'rules', 3,
toMarkup($adve[68], '`{Audio GAZEBO`}'),
toMarkup($adve[67], '`{Audio GAZEBO`}')]],
['bonus_message', [$const, [toMarkup($adve[66], '`{Audio GAZEBO`}')]]],
]),
// Possibly gives visiting hero +2 Attack, +2 Defense, +2 Power, +2 Knowledge.
array_fill_keys($c_lighthouse, [
['quest_fulfilled', [$check, 'quest', 'O']],
bonus_effects([[$append,
['hero_actionPoints', +200, 'ifPlayer' => true, 'ifVehicle' => array_search('ship', AObject::vehicle), 'whileOwned' => true, 'whileOwnedPlayer' => true],
]]),
['bonus_message', [$const, [toMarkup($adve[69], '`{Audio LIGHTHOUSE`}')]]],
]),
// +5 Sea mobility for your ships for each lighthouse you own.
// No Effects needed.
//array_fill_keys($c_monolithOneWayEntrance, []),
// Teleports hero one-way to a specific map location.
array_fill_keys($c_monolithOneWayExit, [
// No audio in this message.
['bonus_message', [$const, [$adve[70]]]],
]),
// Exit point for a hero teleporting through a one-way entrance.
// No Effects needed.
//array_fill_keys($c_monolithTwoWay, []),
// Teleports a hero to another two-way monolith, with the ability to return to the gate of origin.
array_fill_keys($c_schoolOfMagic, [
['quest_fulfilled', [$check, 'resources_gold', 1000]],
['quest_choices', [$append, 'spellPower', 'knowledge', 'cancel']],
['bonus_resource', -1000, 'ifResource' => $gold, 'ifTargetPlayer' => -1],
['quest_message', [$custom, 'rules', 3,
// XXX=I:dlc:
str_replace('1000 gold', '`{Checks`}', toMarkup($adve[73], '`{Audio FAERIE`}')),
toMarkup($adve[72], '`{Audio FAERIE`}')]],
]),
// Pay 1000 gold to increase the Power or Knowledge of your hero by +1.
array_fill_keys($c_magicSpring, [
['quest_fulfilled', [$check, 'spellPointsMax', 0, 2]],
['bonus_spellPoints', [$custom, 'rules'], 'ifTargetObject' => -1],
['bonus_spellPoints', 2.0, 'ifTargetObject' => -1],
// Magic Spring stops working for everybody if someone visits it, for the week. It's possible to visit two different Magic Springs and both will work.
bonus_effects([[$append, ['quest_fulfilled', [$check, false], 'ifBonusObject' => true, 'maxDays' => -1]]]),
['quest_message', [$custom, 'rules', 2,
toMarkup($adve[76], '`{Audio FAERIE`}'),
toMarkup($adve[75], '`{Audio FAERIE`}')]],
['bonus_message', [$const, [toMarkup($adve[74], '`{Audio FAERIE`}')]]],
]),
// Replenishes spell points, then doubles the amount.
array_fill_keys($c_magicWell, array_merge(
[
['quest_fulfilled', [$check, 'spellPointsMax', 0, 1]],
['bonus_spellPoints', [$custom, 'rules'], 'ifTargetObject' => -1],
['quest_message', [$custom, 'rules', 2,
toMarkup($adve[78], '`{Audio FAERIE`}')]],
['bonus_message', [$const, [toMarkup($adve[77], '`{Audio FAERIE`}')]]],
],
$e0(
PHP_INT_MAX,
$c_magicWell,
// Magic Well stops working only for the particular hero, for the day. However, all Magic Wells stop working for that day, not only the visited one.
bonus_effects([[$append, ['quest_fulfilled', [$check, false], true, 'ifBonusObjectClass' => PHP_INT_MAX, 'maxDays' => 1]]])
)
)),
// Replenishes spell points.
//array_fill_keys($c_marketOfTime, [XXX=I]),
array_fill_keys($c_mercenaryCamp, [
bonus_effects([[$append, ['hero_attack', +1, true]]]),
['quest_message', [$const, [toMarkup($adve[81], '`{Audio NOMAD`}')]]],
['bonus_message', [$const, [toMarkup($adve[80], '`<`{StatImage attack`} +1 Attack Skill`>`{Audio NOMAD`}')]]],
]),
// Hero receives +1 Attack.
array_fill_keys($c_mermaids, [
bonus_effects([[$append, ['creature_luck', +1, true, 'maxCombats' => 1]]]),
['quest_message', [$const, [toMarkup($adve[82], '`{Audio LUCK`}')]]],
['bonus_message', [$const, [toMarkup($adve[83], '`{LuckImage +1`}`{Audio LUCK`}')]]],
]),
// +1 Luck until next battle.
array_fill_keys($c_mysticalGarden, [
['quest_chances', $chances('gold500 gems5')],
['quest_reset', [$const, ['R']]],
bonus_effects([[$const, [['quest_fulfilled', $o_false, 'maxDays' => -1, 'ifBonusObject' => true]]]]),
['quest_message', [$const, [toMarkup($adve[93], '`{Audio EXPERNCE`}')]]],
['bonus_message', [$const, [toMarkup($adve[92], '`{BonusesImages`}`{Audio EXPERNCE`}')]]],
]),
// 50% chance to get +500 Gold.
// 50% chance to get 05 Gems.
// Replenishes on Day 1 of each week.
'gold500' => [['bonus_resource', 500, 'ifResource' => $gold, 'ifTargetPlayer' => -1]],
'gems5' => [['bonus_resource', 5, 'ifResource' => $gems, 'ifTargetPlayer' => -1]],
array_fill_keys($c_oasis, [
bonus_effects([[$append, ['creature_morale', +1, true, 'maxCombats' => 1]]]),
['bonus_actionPoints', +8, 'ifTargetObject' => -1],
['quest_message', [$const, [toMarkup($adve[94], '`{Audio MORALE`}')]]],
['bonus_message', [$const, [toMarkup($adve[95], '`{MoraleImage +1`}`{Audio MORALE`}')]]],
]),
// +1 Morale until the next battle.
// +8 Movement until the end of the day.
// Encounter sound: MYSTERY.
//array_fill_keys($c_obelisk, [XXX=I]),
// Reveals portion of the Puzzle Map.
array_fill_keys(array_merge($c_redwoodObservatory, $c_pillarOfFire), [
['bonus_shroud', [$append, ['WithinCircle', null, null, 20, null, null, $shr_observatory, true]], 'ifTargetPlayer' => -1],
]),
array_fill_keys($c_redwoodObservatory, [
['bonus_message', [$const, [toMarkup($adve[98], '`{Audio LIGHTHOUSE`}')]]],
]),
// Shroud is removed from all tiles within 20 tiles of the Observatory.
array_fill_keys($c_pillarOfFire, [
['bonus_message', [$const, [toMarkup($adve[99], '`{Audio LIGHTHOUSE`}')]]],
]),
// Shroud is removed from all tiles within 20 tiles.
array_fill_keys($c_oceanBottle, [
['quest_remove', true],
['bonus_message', [$randomSign]],
]),
// Acts like a Sign, but on the water.
array_fill_keys($c_starAxis, [
bonus_effects([[$append, ['hero_spellPower', +1, true]]]),
['quest_message', [$const, [toMarkup($adve[101], '`{Audio GAZEBO`}')]]],
['bonus_message', [$const, [toMarkup($adve[100], '`<`{StatImage spellPower`} +1 Spell Power`>`{Audio GAZEBO`}')]]],
]),
// Hero receives +1 Power.
array_fill_keys($c_prison, [
['quest_remove', true],
['bonus_message', [$const, [$adve[102].'`{Audio ROGUE`}']]],
]),
// Free a specific hero. Joins you for free.
array_fill_keys($c_pyramid, [
['quest_chances', $chances($level5, 's_')],
['quest_garrison', [$const, [$goldGolem => 40, $diamondGolem => 20]]],
bonus_effects([[$append, ['creature_luck', -2, true, 'maxCombats' => 1]], 'ifGrantedMin' => 1]),
['quest_fulfilled', [$check, false], 'ifGrantedMin' => 1],
['quest_fulfilled', [$check, 'artifact', nameToID("$outPath/artifacts", 'spellBook')]],
['quest_fulfilled', [$check, 'skill', nameToID("$outPath/skills", 'wisdom'), array_search('expert', Skill::mastery)]],
// No audio in quest/bonus messages.
['quest_message', [$custom, 'rules', 1,
"$adve[106]'`{Databank spells`, name`, m`}'.$adve[109]",
"$adve[106]'`{Databank spells`, name`, m`}'.$adve[108]",
"$adve[107]\n\n`{LuckImage -2`}"]],
// XXX=IC Slightly different message from SoD
['bonus_message', [$const,
["$adve[106]'`{Databank spells`, name`, m`}'.\n\n`{SpellImage m`}"]]],
]),
// Defeat 40 Gold Golems and 20 Diamond Golems for a random 5th level spell.
// If hero doesn't have the wisdom to learn the spell, the spell is lost.
// Visiting the Pyramid after defeating the guardians results in -2 Luck until next battle.
array_fill_keys($c_rallyFlag, [
bonus_effects([[$append,
['creature_luck', +1, true, 'maxCombats' => 1],
['creature_morale', +1, true, 'maxCombats' => 1],
]]),
['bonus_actionPoints', +4, 'ifTargetObject' => -1],
['quest_message', [$const, [toMarkup($adve[110], '`{Audio MORALE`}')]]],
['bonus_message', [$const, [toMarkup($adve[111], '`{MoraleImage +1`} `{LuckImage +1`}`{Audio MORALE`}')]]],
]),
// +1 Luck.
// +1 Morale until the next battle.
// +4 adventure movement until the end of the day.
array_fill_keys(array_merge($c_spellScroll, $c_artifact, $c_randomArtifact, $c_randomMajorArtifact, $c_randomMinorArtifact, $c_randomTreasureArtifact, $c_randomRelic), [
['quest_remove', true],