forked from omsi6/omsi6.github.io
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathactionList.js
6263 lines (6091 loc) · 163 KB
/
actionList.js
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
"use strict";
function withoutSpaces(name) {
return name.replace(/ /gu, "");
}
function translateClassNames(name) {
// construct a new action object with appropriate prototype
const nameWithoutSpaces = withoutSpaces(name);
if (nameWithoutSpaces in Action) {
return Object.create(Action[nameWithoutSpaces]);
}
console.log(`error trying to create ${name}`);
return false;
}
const limitedActions = [
"Smash Pots",
"Pick Locks",
"Short Quest",
"Long Quest",
"Gather Herbs",
"Wild Mana",
"Hunt",
"Gamble",
"Gather Team",
"Mana Geyser",
"Mine Soulstones",
"Take Artifacts",
"Accept Donations",
"Mana Well",
"Destroy Pylons"
];
const trainingActions = [
"Train Speed",
"Train Strength",
"Train Dexterity",
"Sit By Waterfall",
"Read Books",
"Bird Watching",
"Oracle",
"Charm School"
];
function hasLimit(name) {
return limitedActions.includes(name);
}
function getTravelNum(name) {
if (name === "Face Judgement" && resources.reputation <= 50) return 2;
if (name === "Face Judgement" && resources.reputation >= 50) return 1;
if (name === "Start Journey" || name === "Continue On" || name === "Start Trek" || name === "Fall From Grace" || name === "Journey Forth" || name === "Escape" || name === "Leave City" || name === "Guru") return 1;
if (name === "Hitch Ride") return 2;
if (name === "Underworld") return 5;
if (name === "Open Portal") return -5;
return 0;
}
function isTraining(name) {
return trainingActions.includes(name);
}
function getXMLName(name) {
return name.toLowerCase().replace(/ /gu, "_");
}
const townNames = ["Beginnersville", "Forest Path", "Merchanton", "Mt. Olympus", "Valhalla", "Startington", "Jungle Path", "Commerceville", "Valley of Olympus"];
// there are 4 types of actions
// 1: normal actions. normal actions have no additional UI (haggle, train strength)
// 2: progress actions. progress actions have a progress bar and use 100, 200, 300, etc. leveling system (wander, meet people)
// 3: limited actions. limited actions have town info for their limit, and a set of town vars for their "data"
// 4: multipart actions. multipart actions have multiple distinct parts to get through before repeating. they also get a bonus depending on how often you complete them
// type names are "normal", "progress", "limited", and "multipart".
// define one of these in the action, and they will create any additional UI elements that are needed
// exp mults are default 100%, 150% for skill training actions, 200% for actions that cost a resource, 300% for actions that cost 2 resources, and 500% for actions that cost soulstones
// todo: ^^ currently some actions are too high, but I am saving these balance changes for the z5/z6 update
// actions are all sorted below by town in order
function Action(name, extras) {
this.name = name;
// many actions have to override this (in extras) for save compatibility, because the
// varName is often used in parts of the game state
this.varName = withoutSpaces(name);
Object.assign(this, extras);
}
/* eslint-disable no-invalid-this */
// not all actions have tooltip2 or labelDone, but among actions that do, the XML format is
// always the same; these are loaded lazily once (and then they become own properties of the
// specific Action object)
defineLazyGetter(Action.prototype, "tooltip", function() {
if (this.name.startsWith("Assassin")) return _txt(`actions>assassin>tooltip`);
if (this.name.startsWith("Survey")) return _txt(`actions>survey>tooltip`);
return _txt(`actions>${getXMLName(this.name)}>tooltip`);
});
defineLazyGetter(Action.prototype, "tooltip2", function() {
if (this.name.startsWith("Assassin")) return _txt(`actions>assassin>tooltip2`);
if (this.name.startsWith("Survey")) return _txt(`actions>survey>tooltip2`);
return _txt(`actions>${getXMLName(this.name)}>tooltip2`);
});
defineLazyGetter(Action.prototype, "label", function() {
if (this.name.startsWith("Assassin")) return _txt(`actions>assassin>label`);
if (this.name.startsWith("Survey")) return _txt(`actions>survey>label`);
return _txt(`actions>${getXMLName(this.name)}>label`);
});
defineLazyGetter(Action.prototype, "labelDone", function() {
if (this.name.startsWith("Assassin")) return _txt(`actions>assassin>label_done`);
if (this.name.startsWith("Survey")) return _txt(`actions>survey>label_done`);
return _txt(`actions>${getXMLName(this.name)}>label_done`);
});
// all actions to date with info text have the same info text, so presently this is
// centralized here (function will not be called by the game code if info text is not
// applicable)
Action.prototype.infoText = function() {
return `${_txt(`actions>${getXMLName(this.name)}>info_text1`)}
<i class='fa fa-arrow-left'></i>
${_txt(`actions>${getXMLName(this.name)}>info_text2`)}
<i class='fa fa-arrow-left'></i>
${_txt(`actions>${getXMLName(this.name)}>info_text3`)}
<br><span class='bold'>${`${_txt("actions>tooltip>total_found")}: `}</span><div id='total${this.varName}'></div>
<br><span class='bold'>${`${_txt("actions>tooltip>total_checked")}: `}</span><div id='checked${this.varName}'></div>`;
};
// same as Action, but contains shared code to load segment names for multipart actions.
// (constructor takes number of segments as a second argument)
function MultipartAction(name, extras) {
Action.call(this, name, extras);
this.segments = (extras.varName === "Fight") ? 3 : extras.loopStats.length;
}
MultipartAction.prototype = Object.create(Action.prototype);
MultipartAction.prototype.constructor = MultipartAction;
// lazily calculate segment names when explicitly requested (to give chance for localization
// code to be loaded first)
defineLazyGetter(MultipartAction.prototype, "segmentNames", function() {
if (this.name.startsWith("Assassin")) return ["Scout Target", "Devise Plan", "Kill Target", "Destroy Evidence", "Flee Scene"];
return Array.from(
_txtsObj(`actions>${getXMLName(this.name)}>segment_names>name`)
).map(elt => elt.textContent);
});
MultipartAction.prototype.getSegmentName = function(segment) {
return this.segmentNames[segment % this.segmentNames.length];
};
/* eslint-enable no-invalid-this */
// same as MultipartAction, but includes shared code to generate dungeon completion tooltip
// as well as specifying 7 segments (constructor takes dungeon ID number as a second
// argument)
function DungeonAction(name, dungeonNum, extras) {
MultipartAction.call(this, name, extras);
this.dungeonNum = dungeonNum;
}
DungeonAction.prototype = Object.create(MultipartAction.prototype);
DungeonAction.prototype.constructor = DungeonAction;
DungeonAction.prototype.completedTooltip = function() {
let ssDivContainer = "";
if (this.dungeonNum < 3) {
for (let i = 0; i < dungeons[this.dungeonNum].length; i++) {
ssDivContainer += `Floor ${i + 1} |
<div class='bold'>${_txt(`actions>${getXMLName(this.name)}>chance_label`)} </div> <div id='soulstoneChance${this.dungeonNum}_${i}'></div>% -
<div class='bold'>${_txt(`actions>${getXMLName(this.name)}>last_stat_label`)} </div> <div id='soulstonePrevious${this.dungeonNum}_${i}'>NA</div> -
<div class='bold'>${_txt(`actions>${getXMLName(this.name)}>label_done`)}</div> <div id='soulstoneCompleted${this.dungeonNum}_${i}'></div><br>`;
}
}
return _txt(`actions>${getXMLName(this.name)}>completed_tooltip`) + ssDivContainer;
};
DungeonAction.prototype.getPartName = function() {
const floor = Math.floor((towns[this.townNum][`${this.varName}LoopCounter`] + 0.0001) / this.segments + 1);
return `${_txt(`actions>${getXMLName(this.name)}>label_part`)} ${floor <= dungeons[this.dungeonNum].length ? numberToWords(floor) : _txt(`actions>${getXMLName(this.name)}>label_complete`)}`;
};
function TrialAction(name, trialNum, extras) {
MultipartAction.call(this, name, extras);
this.trialNum = trialNum;
}
TrialAction.prototype = Object.create(MultipartAction.prototype);
TrialAction.prototype.constructor = TrialAction;
TrialAction.prototype.completedTooltip = function() {
return this.name + ` Highest Floor: <div id='trial${this.trialNum}HighestFloor'>0</div><br>
Current Floor: <div id='trial${this.trialNum}CurFloor'>0</div> - Completed <div id='trial${this.trialNum}CurFloorCompleted'>x</div> times<br>
Last Floor: <div id='trial${this.trialNum}LastFloor'>N/A</div> - Completed <div id='trial${this.trialNum}LastFloorCompleted'>N/A</div> times<br>`;
}
TrialAction.prototype.getPartName = function() {
const floor = Math.floor((towns[this.townNum][`${this.varName}LoopCounter`] + 0.0001) / this.segments + 1);
return `${_txt(`actions>${getXMLName(this.name)}>label_part`)} ${floor <= trials[this.trialNum].length ? numberToWords(floor) : _txt(`actions>${getXMLName(this.name)}>label_complete`)}`;
};
TrialAction.prototype.currentFloor = function() {
return Math.floor(towns[this.townNum][`${this.varName}LoopCounter`] / this.segments + 0.0000001);
}
TrialAction.prototype.loopCost = function(segment) {
return precision3(Math.pow(this.baseScaling, Math.floor((towns[this.townNum][`${this.varName}LoopCounter`] + segment) / this.segments + 0.0000001)) * this.exponentScaling * getSkillBonus("Assassin"));
}
TrialAction.prototype.tickProgress = function(offset) {
return this.baseProgress() *
(1 + getLevel(this.loopStats[(towns[this.townNum][`${this.varName}LoopCounter`] + offset) % this.loopStats.length]) / 100) *
Math.sqrt(1 + trials[this.trialNum][this.currentFloor()].completed / 200);
}
TrialAction.prototype.loopsFinished = function() {
const finishedFloor = this.currentFloor() - 1;
//console.log("Finished floor: " + finishedFloor + " Current Floor: " + this.currentFloor());
trials[this.trialNum][finishedFloor].completed++;
if (finishedFloor > trials[this.trialNum].highestFloor || trials[this.trialNum].highestFloor === undefined) trials[this.trialNum].highestFloor = finishedFloor;
view.requestUpdate("updateTrialInfo", {trialNum: this.trialNum, curFloor: this.currentFloor()});
this.floorReward();
}
function AssassinAction(name, extras) {
extras.type = "multipart";
extras.expMult = 1;
extras.stats = {Per: 0.2, Int: 0.1, Dex: 0.3, Luck: 0.2, Spd: 0.2};
extras.loopStats = ["Per", "Int", "Dex", "Luck", "Spd"];
MultipartAction.call(this, name, extras);
}
AssassinAction.prototype = Object.create(MultipartAction.prototype);
AssassinAction.prototype.constructor = AssassinAction;
AssassinAction.prototype.manaCost = function() {return 50000;}
AssassinAction.prototype.allowed = function() {return 1;}
AssassinAction.prototype.canStart = function() {return towns[this.townNum][`${this.varName}LoopCounter`] === 0;}
AssassinAction.prototype.loopCost = function(segment) {return 50000000;}
AssassinAction.prototype.tickProgress = function(offset) {
let baseSkill = Math.sqrt(getSkillLevel("Practical")) + getSkillLevel("Thievery") + getSkillLevel("Assassin");
let loopStat = (1 + getLevel(this.loopStats[(towns[this.townNum][`${this.varName}LoopCounter`] + offset) % this.loopStats.length]) / 1000);
let completions = Math.sqrt(1 + towns[this.townNum]["total"+this.varName] / 100);
let reputationPenalty = resources.reputation != 0 ? Math.abs(resources.reputation) : 1;
let killStreak = resources.heart > 0 ? resources.heart : 1;
return baseSkill * loopStat * completions / reputationPenalty / killStreak;
}
AssassinAction.prototype.getPartName = function() {
return "Assassination";
}
AssassinAction.prototype.loopsFinished = function() {
addResource("heart", 1);
hearts.push(this.varName);
}
AssassinAction.prototype.finish = function() {
let rep = Math.min((this.townNum + 1) * -250 + getSkillLevel("Assassin"), 0);
addResource("reputation", rep);
}
AssassinAction.prototype.visible = function() {return getSkillLevel("Assassin") > 0;}
AssassinAction.prototype.unlocked = function() {return getSkillLevel("Assassin") > 0;}
//====================================================================================================
//Survery Actions (All Zones)
//====================================================================================================
function SurveyAction(townNum) {
var obj = {
type: "progress",
expMult: 1,
stats: {
Per: 0.4,
Spd: 0.3,
Con: 0.2,
Luck: 0.2
},
canStart() {
return resources.map > 0 && towns[this.townNum].getLevel("Survey") < 100;
},
manaCost() {
return 10000 * (this.townNum + 1);
},
visible() {
return getExploreProgress() > 0;
},
unlocked() {
return getExploreProgress() > 0;
},
finish() {
addResource("map", -1);
addResource("completedMap", 1);
towns[this.townNum].finishProgress(this.varName, getExploreSkill());
view.requestUpdate("updateActionTooltips", null);
}
}
obj.townNum = townNum;
return obj;
}
Action.SurveyZ0 = new Action("SurveyZ0", SurveyAction(0));
Action.SurveyZ1 = new Action("SurveyZ1", SurveyAction(1));
Action.SurveyZ2 = new Action("SurveyZ2", SurveyAction(2));
Action.SurveyZ3 = new Action("SurveyZ3", SurveyAction(3));
Action.SurveyZ4 = new Action("SurveyZ4", SurveyAction(4));
Action.SurveyZ5 = new Action("SurveyZ5", SurveyAction(5));
Action.SurveyZ6 = new Action("SurveyZ6", SurveyAction(6));
Action.SurveyZ7 = new Action("SurveyZ7", SurveyAction(7));
Action.SurveyZ8 = new Action("SurveyZ8", SurveyAction(8));
function RuinsAction(townNum) {
var obj = {
type: "progress",
expMult: 1,
townNum: 1,
stats: {
Per: 0.4,
Spd: 0.3,
Con: 0.2,
Luck: 0.2
},
manaCost() {
return 100000;
},
affectedBy: ["SurveyZ1"],
visible() {
return towns[this.townNum].getLevel("Survey") >= 100;
},
unlocked() {
return towns[this.townNum].getLevel("Survey") >= 100;
},
finish() {
towns[this.townNum].finishProgress(this.varName, 1);
adjustRocks(this.townNum);
}
}
obj.townNum = townNum;
return obj;
}
Action.RuinsZ1 = new Action("RuinsZ1", RuinsAction(1));
Action.RuinsZ3 = new Action("RuinsZ3", RuinsAction(3));
Action.RuinsZ5 = new Action("RuinsZ5", RuinsAction(5));
Action.RuinsZ6 = new Action("RuinsZ6", RuinsAction(6));
function adjustRocks(townNum) {
let town = towns[townNum];
let baseStones = town.getLevel("RuinsZ" + townNum) * 2500;
let usedStones = stonesUsed[townNum];
town[`totalStonesZ${townNum}`] = baseStones;
town[`goodStonesZ${townNum}`] = Math.floor(town[`checkedStonesZ${townNum}`] / 1000) - usedStones;
town[`goodTempStonesZ${townNum}`] = Math.floor(town[`checkedStonesZ${townNum}`] / 1000) - usedStones;
if (usedStones === 250) town.checkedStones = 250000;
}
function adjustAllRocks() {
adjustRocks(1);
adjustRocks(3);
adjustRocks(5);
adjustRocks(6);
}
function HaulAction(townNum) {
var obj = {
type: "limited",
expMult: 1,
townNum: 1,
varName: "StonesZ" + townNum,
stats: {
Str: 0.4,
Con: 0.6,
},
affectedBy: ["SurveyZ1"],
canStart() {
return !resources.stone && stonesUsed[this.townNum] < 250;
},
manaCost() {
return 50000;
},
visible() {
return towns[this.townNum].getLevel("RuinsZ" + townNum ) > 0;
},
unlocked() {
return towns[this.townNum].getLevel("RuinsZ" + townNum) > 0;
},
finish() {
stoneLoc = this.townNum;
towns[this.townNum].finishRegular(this.varName, 1000, () => {
addResource("stone", true);
});
}
}
obj.townNum = townNum;
return obj;
}
Action.HaulZ1 = new Action("HaulZ1", HaulAction(1));
Action.HaulZ3 = new Action("HaulZ3", HaulAction(3));
Action.HaulZ5 = new Action("HaulZ5", HaulAction(5));
Action.HaulZ6 = new Action("HaulZ6", HaulAction(6));
//====================================================================================================
//Assassination Actions
//====================================================================================================
Action.AssassinZ0 = new AssassinAction("AssassinZ0", {
townNum: 0,
});
Action.AssassinZ1 = new AssassinAction("AssassinZ1", {
townNum: 1,
});
Action.AssassinZ2 = new AssassinAction("AssassinZ2", {
townNum: 2,
});
Action.AssassinZ3 = new AssassinAction("AssassinZ3", {
townNum: 3,
});
Action.AssassinZ4 = new AssassinAction("AssassinZ4", {
townNum: 4,
});
Action.AssassinZ5 = new AssassinAction("AssassinZ5", {
townNum: 5,
});
Action.AssassinZ6 = new AssassinAction("AssassinZ6", {
townNum: 6,
});
Action.AssassinZ7 = new AssassinAction("AssassinZ7", {
townNum: 7,
});
//====================================================================================================
//Zone 1 - Beginnersville
//====================================================================================================
Action.Map = new Action("Map", {
type: "normal",
expMult: 1,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return getExploreProgress() > 1;
}
return false;
},
stats: {
Cha: 0.8,
Luck: 0.1,
Soul: 0.1
},
manaCost() {
return 200;
},
canStart() {
return resources.gold >= 15;
},
visible() {
return getExploreProgress() > 0;
},
unlocked() {
return getExploreProgress() > 0;
},
goldCost() {
return 15;
},
finish() {
addResource("gold", -this.goldCost());
addResource("map", 1);
},
});
Action.Wander = new Action("Wander", {
type: "progress",
expMult: 1,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0].getLevel(this.varName) >= 20;
case 2:
return towns[0].getLevel(this.varName) >= 40;
case 3:
return towns[0].getLevel(this.varName) >= 60;
case 4:
return towns[0].getLevel(this.varName) >= 80;
case 5:
return towns[0].getLevel(this.varName) >= 100;
}
return false;
},
stats: {
Per: 0.2,
Con: 0.2,
Cha: 0.2,
Spd: 0.3,
Luck: 0.1
},
affectedBy: ["Buy Glasses"],
manaCost() {
return 250;
},
visible() {
return true;
},
unlocked() {
return true;
},
finish() {
towns[0].finishProgress(this.varName, 200 * (resources.glasses ? 4 : 1));
}
});
function adjustPots() {
let town = towns[0];
let basePots = town.getLevel("Wander") * 5;
town.totalPots = Math.floor(basePots + basePots * getSurveyBonus(town));
}
function adjustLocks() {
let town = towns[0];
let baseLocks = town.getLevel("Wander");
town.totalLocks = Math.floor(baseLocks * getSkillMod("Spatiomancy", 100, 300, .5) + baseLocks * getSurveyBonus(town));
}
Action.SmashPots = new Action("Smash Pots", {
type: "limited",
expMult: 1,
townNum: 0,
varName: "Pots",
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0][`good${this.varName}`] >= 50;
case 2:
return towns[0][`good${this.varName}`] >= 75;
}
return false;
},
stats: {
Str: 0.2,
Per: 0.2,
Spd: 0.6
},
manaCost() {
return Math.ceil(50 * getSkillBonus("Practical"));
},
visible() {
return true;
},
unlocked() {
return true;
},
// note this name is misleading: it is used for mana and gold gain.
goldCost() {
return Math.floor(100 * getSkillBonus("Dark"));
},
finish() {
towns[0].finishRegular(this.varName, 10, () => {
const manaGain = this.goldCost();
addMana(manaGain);
return manaGain;
});
}
});
Action.PickLocks = new Action("Pick Locks", {
type: "limited",
varName: "Locks",
expMult: 1,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0][`checked${this.varName}`] >= 1;
case 2:
return towns[0][`checked${this.varName}`] >= 50;
case 3:
return towns[0][`good${this.varName}`] >= 10;
case 4:
return towns[0][`good${this.varName}`] >= 25;
}
return false;
},
stats: {
Dex: 0.5,
Per: 0.3,
Spd: 0.1,
Luck: 0.1
},
manaCost() {
return 400;
},
visible() {
return towns[0].getLevel("Wander") >= 3;
},
unlocked() {
return towns[0].getLevel("Wander") >= 20;
},
goldCost() {
let base = 10;
return Math.floor(base * getSkillMod("Practical",0,200,1) + base * getSkillBonus("Thievery") - base);
},
finish() {
towns[0].finishRegular(this.varName, 10, () => {
const goldGain = this.goldCost();
addResource("gold", goldGain);
return goldGain;
});
}
});
Action.BuyGlasses = new Action("Buy Glasses", {
type: "normal",
expMult: 1,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return storyReqs.glassesBought;
}
return false;
},
stats: {
Cha: 0.7,
Spd: 0.3
},
allowed() {
return 1;
},
canStart() {
return resources.gold >= 10;
},
cost() {
addResource("gold", -10);
},
manaCost() {
return 50;
},
visible() {
return towns[0].getLevel("Wander") >= 3 && getExploreProgress() < 100;
},
unlocked() {
return towns[0].getLevel("Wander") >= 20;
},
finish() {
addResource("glasses", true);
},
story(completed) {
unlockStory("glassesBought");
}
});
Action.FoundGlasses = new Action("Found Glasses", {
type: "normal",
expMult: 0,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return getExploreProgress() >=100;
}
return false;
},
stats: {
},
affectedBy: ["SurveyZ1"],
allowed() {
return 1;
},
canStart() {
return false;
},
manaCost() {
return 0;
},
visible() {
return getExploreProgress() >= 100;
},
unlocked() {
return false;
},
finish() {
}
});
Action.BuyManaZ1 = new Action("Buy Mana Z1", {
type: "normal",
expMult: 1,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0].getLevel("Met") > 0;
}
return false;
},
stats: {
Cha: 0.7,
Int: 0.2,
Luck: 0.1
},
manaCost() {
return 100;
},
visible() {
return towns[0].getLevel("Wander") >= 3;
},
unlocked() {
return towns[0].getLevel("Wander") >= 20;
},
goldCost() {
return Math.floor(50 * getSkillBonus("Mercantilism"));
},
finish() {
addMana(resources.gold * this.goldCost());
resetResource("gold");
},
});
Action.MeetPeople = new Action("Meet People", {
type: "progress",
expMult: 1,
townNum: 0,
varName: "Met",
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0].getLevel(this.varName) >= 1;
case 2:
return towns[0].getLevel(this.varName) >= 20;
case 3:
return towns[0].getLevel(this.varName) >= 40;
case 4:
return towns[0].getLevel(this.varName) >= 60;
case 5:
return towns[0].getLevel(this.varName) >= 80;
case 6:
return towns[0].getLevel(this.varName) >= 100;
}
return false;
},
stats: {
Int: 0.1,
Cha: 0.8,
Soul: 0.1
},
manaCost() {
return 800;
},
visible() {
return towns[0].getLevel("Wander") >= 10;
},
unlocked() {
return towns[0].getLevel("Wander") >= 22;
},
finish() {
towns[0].finishProgress(this.varName, 200);
},
});
function adjustSQuests() {
let town = towns[0];
let baseSQuests = town.getLevel("Met");
town.totalSQuests = Math.floor(baseSQuests * getSkillMod("Spatiomancy", 200, 400, .5) + baseSQuests * getSurveyBonus(town));
}
Action.TrainStrength = new Action("Train Strength", {
type: "normal",
expMult: 4,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return storyReqs.strengthTrained;
case 2:
return getTalent("Str") >= 100;
case 3:
return getTalent("Str") >= 1000;
case 4:
return getTalent("Str") >= 10000;
case 5:
return getTalent("Str") >= 100000;
}
return false;
},
stats: {
Str: 0.8,
Con: 0.2
},
allowed() {
return trainingLimits;
},
manaCost() {
return 2000;
},
visible() {
return towns[0].getLevel("Met") >= 1;
},
unlocked() {
return towns[0].getLevel("Met") >= 5;
},
finish() {
},
story(completed) {
unlockStory("strengthTrained");
}
});
Action.ShortQuest = new Action("Short Quest", {
type: "limited",
expMult: 1,
townNum: 0,
varName: "SQuests",
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0][`checked${this.varName}`] >= 1;
case 2:
// 20 small quests in a loop
return storyReqs.maxSQuestsInALoop;
case 3:
return towns[0][`checked${this.varName}`] >= 250;
}
return false;
},
stats: {
Str: 0.2,
Dex: 0.1,
Cha: 0.3,
Spd: 0.2,
Luck: 0.1,
Soul: 0.1
},
manaCost() {
return 600;
},
visible() {
return towns[0].getLevel("Met") >= 1;
},
unlocked() {
return towns[0].getLevel("Met") >= 5;
},
goldCost() {
let base = 20;
return Math.floor(base * getSkillMod("Practical",100,300,1));
},
finish() {
towns[0].finishRegular(this.varName, 5, () => {
const goldGain = this.goldCost();
addResource("gold", goldGain);
return goldGain;
});
},
story(completed) {
if (towns[0][`good${this.varName}`] >= 20 && towns[0][`goodTemp${this.varName}`] <= towns[0][`good${this.varName}`] - 20) unlockStory("maxSQuestsInALoop");
}
});
Action.Investigate = new Action("Investigate", {
type: "progress",
expMult: 1,
townNum: 0,
varName: "Secrets",
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0].getLevel(this.varName) >= 20;
case 2:
return towns[0].getLevel(this.varName) >= 40;
case 3:
return towns[0].getLevel(this.varName) >= 60;
case 4:
return towns[0].getLevel(this.varName) >= 80;
case 5:
return towns[0].getLevel(this.varName) >= 100;
}
return false;
},
stats: {
Per: 0.3,
Cha: 0.4,
Spd: 0.2,
Luck: 0.1
},
manaCost() {
return 1000;
},
visible() {
return towns[0].getLevel("Met") >= 5;
},
unlocked() {
return towns[0].getLevel("Met") >= 25;
},
finish() {
towns[0].finishProgress(this.varName, 500);
},
});
function adjustLQuests() {
let town = towns[0];
let baseLQuests = town.getLevel("Secrets") / 2;
town.totalLQuests = Math.floor(baseLQuests * getSkillMod("Spatiomancy", 300, 500, .5) + baseLQuests * getSurveyBonus(town));
}
Action.LongQuest = new Action("Long Quest", {
type: "limited",
expMult: 1,
townNum: 0,
varName: "LQuests",
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return towns[0][`checked${this.varName}`] >= 1;
case 2:
// 10 long quests in a loop
return storyReqs.maxLQuestsInALoop;
case 3:
return towns[0][`checked${this.varName}`] >= 125;
}
return false;
},
stats: {
Str: 0.2,
Int: 0.2,
Con: 0.4,
Spd: 0.2
},
manaCost() {
return 1500;
},
visible() {
return towns[0].getLevel("Secrets") >= 1;
},
unlocked() {
return towns[0].getLevel("Secrets") >= 10;
},
goldCost() {
let base = 30;
return Math.floor(base * getSkillMod("Practical",200,400,1));
},
finish() {
towns[0].finishRegular(this.varName, 5, () => {
addResource("reputation", 1);
const goldGain = this.goldCost();
addResource("gold", goldGain);
return goldGain;
});
},
story(completed) {
if (towns[0][`good${this.varName}`] >= 10 && towns[0][`goodTemp${this.varName}`] <= towns[0][`good${this.varName}`] - 10) unlockStory("maxLQuestsInALoop");
}
});
Action.ThrowParty = new Action("Throw Party", {
type: "normal",
expMult: 2,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return storyReqs.partyThrown;
case 2:
return storyReqs.partyThrown2;
}
return false;
},
stats: {
Cha: 0.8,
Soul: 0.2
},
manaCost() {
return 1600;
},
canStart() {
return resources.reputation >= 2;
},
cost() {
addResource("reputation", -2);
},
visible() {
return towns[this.townNum].getLevel("Secrets") >= 20;
},
unlocked() {
return towns[this.townNum].getLevel("Secrets") >= 30;
},
finish() {
towns[0].finishProgress("Met", 3200);
},
story(completed) {
unlockStory("partyThrown");
if (completed >= 10) unlockStory("partyThrown2");
}
});
Action.WarriorLessons = new Action("Warrior Lessons", {
type: "normal",
expMult: 1.5,
townNum: 0,
storyReqs(storyNum) {
switch (storyNum) {
case 1:
return getSkillLevel("Combat") >= 1;
case 2:
return getSkillLevel("Combat") >= 100;
case 3:
return getSkillLevel("Combat") >= 200;
case 4:
return getSkillLevel("Combat") >= 250;
case 5:
return getSkillLevel("Combat") >= 1000;
}
return false;
},
stats: {
Str: 0.5,
Dex: 0.3,
Con: 0.2
},
skills: {
Combat: 100
},
manaCost() {
return 1000;
},
canStart() {