-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathgm.js
More file actions
1941 lines (1928 loc) · 62.9 KB
/
gm.js
File metadata and controls
1941 lines (1928 loc) · 62.9 KB
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
var loggedActions = {};
var suggestedMessages = [];
var suggestedActions = [];
var dousedlist = [];
var beingTargetted = {};
var daynumber = 1;
var rainnumber = 0;
var attributes = {
BG:'Protect your target, killing their attacker and yourself.',
HEAL:'Heal your target.',
NOHEAL:'Cannot be healed after revealing.',
RB:'Roleblock your target.',
INVESTIGATE:'View the target\'s investigative results. Affected by Framer.',
JAIL:'Jail the target.',
EXECUTE:'Execute the jailed target.',
WATCH:'See all visitors to the target.',
MAFVISIT:'See who the Mafia visited.',
REVIVE:'Revive the target.',
CHECK:'View the target\'s alignment. Affected by Framer.',
DETECTIONIMMUNE:'Appears as Not Suspious to the Sheriff.',
TRANSPORT:'Swap all targets on your two targets.',
ALERT:'Kill anyone that targets you.',
MAFKILL:'Kill the target as member of the Mafia.',
VIGKILL:'Kill the target as Vigilante.',
SKKILL:'Kill the target as Serial Killer.',
IMMUNE:'Cannot die to KILL.',
BLACKMAIL:'Blackmail the target.',
CONSIG:'View the target\'s role.',
DISGUISE:'Disguise as the target, if they die.',
SWAPWILL:'Swap wills with the target, if they die.',
CLEAN:'Clean the target, if they die.',
REMEMBER:'Take the role of the target, if they are dead. Announce to the town.',
DOUSE:'Douse the target.',
IGNITE:'Ignite all doused targets.',
MULTI:'Target two players.',
FORCEDMULTI:'Has to target two players.',
SELF:'Can target themself.',
NOVISIT:'Can only target themself.',
VEST:'Make yourself night immune.',
NINJA:'Not spotted by WATCHES when visiting.',
RBIMMUNE:'Cannot be roleblocked.',
RBATTACK:'Attack the roleblocker.',
RBHOME:'Stays home when roleblocked.',
MAUL:'Attack target and all visitors.',
MUSTVISIT:'Must visit each night. If not visiting visits themselves instead.',
MUSTVISITEVEN:'Must visit each even night. If not visiting visits themselves instead.',
CHARGE:'Charge someone with electricity.',
CONTROLIMMUNE:'Cannot be controlled.',
FRAME:'Make the target appear as member of the Mafia.',
FULLMOONSHERIFFRESULT:'During a full moon the target shows as a Werewolf to the Sheriff.',
FORGE:'Change targets last will.',
HAUNT:'Kills one of their guilty voters.',
// TARGET:'Player that needs to be lynched for victory.',
CONTROL:'Make your first target visit your second target.',
PASSIVE:'Your night action takes effect without you needing to send in an action.',
/*Targetting attributes*/
DEADTARGET:'Able to target players that are dead.',
NOLIVINGTARGET:'Unable to target living players.',
RAINDANCE: 'Let it rain next night',
INTERVIEW: 'Interview two people each night and compare them'
};
var autoRoles =
{
'escort': {
attributes: {
RB:attributes.RB,
RBIMMUNE:attributes.RBIMMUNE},
grouping: 'D',
intgrouping: 'G',
consiggrouping:'Escort',
alignment:'town',
priority: 2
},
'transporter': {
attributes: {
MULTI:attributes.MULTI,
FORCEDMULTI:attributes.FORCEDMULTI,
TRANSPORT:attributes.TRANSPORT,
RBIMMUNE:attributes.RBIMMUNE,
CONTROLIMMUNE:attributes.CONTROLIMMUNE,
PRIO1:attributes.PRIO1,
SELF:attributes.SELF},
grouping: 'K',
intgrouping: 'C',
consiggrouping:'Transporter',
alignment:'town',
priority: 4
},
'veteran': {
attributes: {
RBIMMUNE:attributes.RBIMMUNE,
CONTROLIMMUNE:attributes.CONTROLIMMUNE,
SELF:attributes.SELF,
ALERT:attributes.ALERT,
NINJA:attributes.NINJA,
NOVISIT:attributes.NOVISIT
},
grouping: 'M',
intgrouping: 'E',
consiggrouping:'Veteran',
alignment:'town'
},
'vigilante': {
attributes: {
VIGKILL:attributes.VIGKILL},
grouping: 'I',
intgrouping: 'F',
consiggrouping:'Vigilante',
alignment:'town'
},
'sheriff': {
attributes: {
CHECK:attributes.CHECK},
grouping: 'C',
intgrouping: 'A',
consiggrouping:'Sheriff',
alignment:'town'
},
'investigator': {
attributes: {
INVESTIGATE:attributes.INVESTIGATE},
grouping: 'J',
intgrouping: 'C',
consiggrouping:'Investigator',
alignment:'town'
},
'lookout': {
attributes: {
WATCH:attributes.WATCH
},
grouping: 'H',
intgrouping: 'D',
consiggrouping:'Lookout',
alignment:'town'
},
'mayor': {
attributes: {
NOHEAL:attributes.NOHEAL},
grouping: 'J',
intgrouping: 'A',
consiggrouping:'Mayor',
alignment:'town'
},
'medium': {
attributes: {},
grouping: 'L',
intgrouping: 'B',
consiggrouping:'Medium',
alignment:'town'
},
'retributionist': {
attributes: {
REVIVE:attributes.REVIVE,
DEADTARGET:attributes.DEADTARGET,
NOLIVINGTARGET:attributes.NOLIVINGTARGET},
grouping: 'L',
intgrouping: 'H',
consiggrouping:'Retributionist',
alignment:'town'
},
'doctor': {
attributes: {
HEAL:attributes.HEAL,
SELF:attributes.SELF},
grouping: 'A',
intgrouping: 'A',
consiggrouping:'Doctor',
alignment:'town',
priority: 1
},
'bodyguard': {
attributes: {
VEST:attributes.VEST,
BG:attributes.BG,
SELF:attributes.SELF},
grouping: 'F',
intgrouping: 'B',
consiggrouping:'Bodyguard',
alignment:'town',
priority: 1
},
'jailor': {
attributes: {
JAIL:attributes.JAIL,
EXECUTE:attributes.EXECUTE},
grouping: 'C',
intgrouping: 'J',
consiggrouping:'Jailor',
alignment:'town'
},
'godfather': {
attributes: {
MAFKILL:attributes.MAFKILL,
IMMUNE:attributes.IMMUNE},
grouping: 'C',
intgrouping: 'B',
consiggrouping:'Godfather',
alignment:'gf'
},
'mafioso': {
attributes: {
MAFKILL:attributes.MAFKILL,
DEADTARGET:attributes.DEADTARGET},
grouping: 'I',
intgrouping: 'H',
consiggrouping:'Mafioso',
alignment:'mafia'
},
'consigliere': {
attributes: {
CONSIG:attributes.CONSIG},
grouping: 'J',
intgrouping: 'K',
consiggrouping:'Consigliere',
alignment:'mafia'
},
'consort': {
attributes: {
RB:attributes.RB,
RBIMMUNE:attributes.RBIMMUNE},
grouping: 'D',
intgrouping: 'I',
consiggrouping:'Consort',
alignment:'mafia',
priority:2
},
'disguiser': {
attributes: {
DISGUISE:attributes.DISGUISE,
SWAPWILL:attributes.SWAPWILL
},
grouping: 'L',
intgrouping: 'E',
consiggrouping:'Disguiser',
alignment:'mafia'
},
'framer': {
attributes: {
FRAME:attributes.FRAME},
grouping: 'N',
intgrouping: 'C',
consiggrouping:'Framer',
alignment:'mafia'
},
'janitor': {
attributes: {
CLEAN:attributes.CLEAN},
grouping: 'G',
intgrouping: 'J',
consiggrouping:'Janitor',
alignment:'mafia'
},
'forger': {
attributes: {
FORGE:attributes.FORGE},
grouping: 'F',
intgrouping: 'D',
consiggrouping:'Forger',
alignment:'mafia'
},
'serial killer': {
attributes: {
SKKILL:attributes.SKKILL,
RBATTACK:attributes.RBATTACK,
IMMUNE:attributes.IMMUNE},
grouping: 'A',
intgrouping: 'K',
consiggrouping:'Serial Killer',
alignment:'sk'
},
'arsonist': {
attributes: {
DOUSE:attributes.DOUSE,
IGNITE:attributes.IGNITE,
SELF: attributes.SELF,
MUSTVISIT: attributes.MUSTVISIT,
IMMUNE:attributes.IMMUNE},
grouping: 'N',
intgrouping: 'D',
consiggrouping:'Arsonist',
alignment:'arsonist'
},
'werewolf': {
attributes: {
MAUL:attributes.MAUL,
SELF:attributes.SELF,
IMMUNE:attributes.IMMUNE,
FULLMOONSHERIFFRESULT:attributes.FULLMOONSHERIFFRESULT,
MUSTVISITEVEN:attributes.MUSTVISITEVEN,
RBHOME:attributes.RBHOME},
grouping: 'M',
intgrouping: 'I',
consiggrouping:'Werewolf',
alignment:'ww'
},
'jester': {
attributes: {
HAUNT:attributes.HAUNT
},
grouping: 'L',
intgrouping: 'J',
consiggrouping:'Jester',
alignment:'neutral'
},
'executioner': {
attributes: {
IMMUNE:attributes.IMMUNE
// TARGET:attributes.TARGET
},
grouping: 'C',
intgrouping: 'A',
consiggrouping:'Executioner',
alignment:'neutral'
},
'witch': {
attributes: {
CONTROL:attributes.CONTROL,
CONTROLIMMUNE:attributes.CONTROLIMMUNE,
MULTI:attributes.MULTI,
FORCEDMULTI:attributes.MULTI
},
grouping: 'E',
intgrouping: 'I',
consiggrouping:'Witch',
alignment:'neutral',
priority:3
},
'survivor': {
attributes: {
VEST:attributes.VEST,
SELF:attributes.SELF,
NINJA:attributes.NINJA,
NOVISIT:attributes.NOVISIT
},
grouping: 'K',
intgrouping: 'B',
consiggrouping:'Survivor',
alignment:'neutral'
},
'amnesiac': {
attributes: {
REMEMBER:attributes.REMEMBER,
DEADTARGET:attributes.DEADTARGET,
NOLIVINGTARGET:attributes.NOLIVINGTARGET
},
grouping: 'A',
intgrouping: 'C',
consiggrouping:'Amnesiac',
alignment:'neutral'
},
//Custom Roles
'rain dancer': {
attributes: {
RAINDANCE:attributes.RAINDANCE,
SELF:attributes.SELF,
NINJA:attributes.NINJA,
NOVISIT:attributes.NOVISIT
},
grouping: 'M',
intgrouping: 'G',
consiggrouping:'Rain Dancer',
alignment:'town'
},
'nightmarer': {
attributes: {
MULTI:attributes.MULTI,
FORCEDMULTI:attributes.FORCEDMULTI
},
grouping: 'B',
intgrouping: 'G',
consiggrouping:'Nightmarer',
alignment:'mafia'
},
'watcher': {
attributes: {
WATCH:attributes.WATCH
},
grouping: 'H',
intgrouping: 'J',
consiggrouping:'Watcher',
alignment:'mafia'
},
'electrician': {
attributes: {
IMMUNE:attributes.IMMUNE
},
grouping: 'F',
intgrouping: 'F',
consiggrouping:'Electrician',
alignment:'elec'
},
'shadowalker': {
attributes: {
IMMUNE:attributes.IMMUNE
},
grouping: 'B',
intgrouping: 'G',
consiggrouping:'Shadowalker',
alignment:'sw'
},
'stalker': {
attributes: {
SELF:attributes.SELF
},
grouping: 'D',
intgrouping: 'F',
consiggrouping:'Stalker',
alignment:'neutral'
},
'drug dealer': {
attributes: {},
grouping: 'A',
intgrouping: 'I',
consiggrouping:'Drug Dealer',
alignment:'mafia'
},
'lost spirit': {
attributes: {},
grouping: 'B',
intgrouping: 'H',
consiggrouping:'Lost Spirit',
alignment:'neutral'
},
'scientist': {
attributes: {},
grouping: 'G',
intgrouping: 'B',
consiggrouping:'Scientist',
alignment:'town'
},
'tracker': {
attributes: {},
grouping: 'B',
intgrouping: 'C',
consiggrouping:'Tracker',
alignment:'town'
},
'ghost': {
attributes: {
RB:attributes.RB,
RBIMMUNE:attributes.RBIMMUNE
},
grouping: 'D',
intgrouping: 'H',
consiggrouping:'Ghost',
alignment:'town'
},
'paradoxist': {
attributes: {
RBIMMUNE:attributes.RBIMMUNE
},
grouping: 'H',
intgrouping: 'K',
consiggrouping:'Paradoxist',
alignment:'neutral'
},
'undertaker': {
attributes: {},
grouping: 'G',
intgrouping: 'E',
consiggrouping:'Undertaker',
alignment:'neutral'
},
'psychic': {
attributes: {
MULTI:attributes.MULTI,
FORCEDMULTI:attributes.MULTI,
SELF:attributes.SELF
},
grouping: 'H',
intgrouping: 'I',
consiggrouping:'Psychic',
alignment:'town'
},
'interviewer': {
attributes: {
INTERVIEW:attributes.INTERVIEW,
MULTI: attributes.MULTI,
FORCEDMULTI: attributes.MULTI
},
grouping: 'I',
intgrouping: 'D',
consiggrouping:'Interviewer',
alignment:'town'
},
'musician': {
attributes: {
SELF:attributes.SELF
},
grouping: 'M',
intgrouping: 'F',
consiggrouping:'Musician',
alignment:'mafia'
},
'milkman': {
attributes: {},
grouping: 'K',
intgrouping: 'E',
consiggrouping:'Milkman',
alignment:'town'
},
'slaughterer': {
attributes: {
IMMUNE:attributes.IMMUNE,
RBIMMUNE:attributes.RBIMMUNE
},
grouping: 'E',
intgrouping: 'H',
consiggrouping:'Slaughterer',
alignment:'slaug',
},
'warlock': {
attributes: {
MULTI: attributes.MULTI,
FORCEDMULTI: attributes.MULTI
},
grouping: 'I',
intgrouping: 'E',
consiggrouping:'Warlock',
alignment:'neutral'
},
'fisherman': {
attributes: {},
grouping: 'G',
intgrouping: 'K',
consiggrouping:'Fisherman',
alignment:'town'
},
'butcher': {
attributes: {
MULTI:attributes.MULTI,
IMMUNE:attributes.IMMUNE
},
grouping: 'K',
intgrouping: 'J',
consiggrouping:'Butcher',
alignment:'butcher'
},
'incarcerator': {
attributes: {
},
grouping: 'E',
intgrouping: 'F',
consiggrouping:'Incarcerator',
alignment:'town'
},
'firebrand': {
attributes: {
DOUSE:attributes.DOUSE,
IGNITE:attributes.IGNITE,
SELF:attributes.SELF
},
grouping: 'F',
intgrouping: 'D',
consiggrouping:'Firebrand',
alignment:'town'
},
'malpractitioner': {
attributes: {
},
grouping: 'E',
intgrouping: 'K',
consiggrouping:'Malpractitioner',
alignment:'mafia'
},
'gossiper': {
attributes: {
MULTI: attributes.MULTI,
FORCEDMULTI: attributes.MULTI
},
grouping: 'J',
intgrouping: 'G',
consiggrouping:'Gossiper',
alignment:'neutral'
},
};
var investGrouping = {
'A':'Your target reeks of chemicals and death.',
'B':'Your target shadows people inquisitively.',
'C':'Your target seeks justice in every conflict.',
'D':'Your target frequents the shady districts.',
'E':'Your target embraces their torturous tendencies.',
'F':'Your target washes their stained clothes often.',
'G':'Your target catches onto dirty mischief.',
'H':'Your target eyes in the shadows for visitations.',
'I':'Your target searches for untrustworthy civilians.',
'J':'Your target possesses sensitive information to reveal.',
'K':'Your target delivers service to those in need.',
'L':'Your target isolates themselves for sanity.',
'M':'Your target lures people out where vulnerable.',
'N':'Your target burns for mischief.',
};
var consigResults = {
'Bodyguard':'Your target owns body armor. They must be a Bodyguard.',
'Doctor':'Your target owns scrubs and medicine. They must be a Doctor.',
'Escort':'Your target owns many beautiful dresses. They must be an Escort.',
'Investigator':'Your target is starting to keep case files on the citizens of this town. They must be an Investigator.',
'Jailor':'Your target has a prison cell in their basement. They must be the Jailor.',
'Lookout':'Your target owns binoculars and stalks people with them at night. They must be a Lookout.',
'Mayor':'Your target has official papers listing them as the leader of this Town. They must be the Mayor.',
'Medium':'Your target owns a crystal ball and tarot cards. They must be a Medium.',
'Transporter':'Your target has an expensive, high-tech carriage. They must be a Transporter.',
'Retributionist':'Your target owns several magical tomes. They must be the Retributionist.',
'Sheriff':'Your target has hidden away a golden star badge. They must be a Sheriff.',
'Veteran':'Your target carries a shotgun with them everywhere they go. They must be a Veteran.',
'Vigilante':'Your target has hidden away a pistol in their bedroom. They must be a Vigilante.',
'Consigliere':'Your target compiles detailed records of other citizen\'s possessions. They must be a Consigliere.',
'Consort':'Your target owns very expensive jewelry. They must be a Consort.',
'Disguiser':'Your target owns an elaborate make-up kit. They must be a Disguiser.',
'Forger':'Your target owns many fancy inks. They must be a Forger.',
'Framer':'Your target leaves incriminating evidence lying around. They must be a Framer.',
'Godfather':'Your target is your boss. They must be the Godfather.',
'Mafioso':'Your target has hidden away several guns. They must be the Mafioso.',
'Janitor':'Your target owns many cleaning supplies. They must be a Janitor.',
'Amnesiac':'Your target has records of head trauma. They must be an Amnesiac.',
'Survivor':'Your target owns only a couple vests from their army days. They must be a Survivor.',
'Executioner':'Your target owns many pictures of [target], each one crossed out with a red \'X\'. They must be an Executioner.',
'Jester':'Your target\'s house is full of their deranged, crazy paintings. They must be a Jester.',
'Witch':'Your target weighs the same as a duck. They must be a Witch.',
'Arsonist':'Your target owns multiple cans of gasoline. They must be an Arsonist.',
'Serial Killer':'Your target has an extensive knife collection. They must be a Serial Killer.',
'Werewolf':'Your target has scratch marks and fur everywhere inside of their home. They must be a Werewolf.',
'Tracker':'Your target is always following you. They must be a Tracker.',
'Scientist':'Your target owns vials of blood. They must be a Scientist.',
'Watcher':'Your target owns binoculars and works with the Mafia, They must be a Watcher.',
'Electrician':'Your target owns protective vests against high voltage. They must be a Electrician.',
'Shadowalker':'Your target lurks in the shadows of others, They must be a Shadowalker.',
'Drug Dealer':'Your target drugs people in the night. They must be a Drug Dealer.',
'Nightmarer':'Your target messes with peoples dreams. They must be a Nightmarer.',
'Undertaker':'Your target buries the dead. They must be a Undertaker.',
'Lost Spirit':'Your target has long been forgotten. They must be a Lost Spirit.',
'Ghost':'Death did not stop your target from living. They must be a Ghost.',
'Rain Dancer':'Your target is dancing in the rain. They must be a Rain Dancer.',
'Paradoxist':'Your target is from another plane of reality. They must be a Paradoxist.',
'Stalker':'Your target sends cold shivers down your spine. They must be a Stalker.',
'Psychic':'Your target forms mental links. They must be a Psychic.',
'Interviewer':'Your target has lots of notes scrunched into his pocket. They must be an Interviewer.',
'Musician':'Your target plays music for the town. They must be a Musician.',
'Incarcerator':'Your target stows away a considerable amount of handcuffs. They must be an Incarcerator.',
'Butcher':'Your target is equipped with a meat cleaver dripping blood. They must be a Butcher.',
'Fisherman':'Your target carries a pail of bait for fishing in the local pond. They must be a Fisherman.',
'Warlock':'Your target has the ability to conjure up devastating curses. They must be a Warlock.',
'Slaughterer':'Your target is too op and should be nerfed. They must be a Slaughterer.',
'Milkman':'Your target carries chilly glasses of milk for the civilians. They must be a Milkman.',
'Firebrand':'Your target keeps spare matches in their pockets. They must be a Firebrand.',
'Malpractitioner':'Your target owns a bloody vice with a set of knives. They must be a Malpractitioner.',
'Gossiper':'Your target has a multiple of letters sprawled throughout their office. They must be a Gossiper.',
};
var sheriffResults = {
'town':'Your target is not suspicious.',
'mafia':'Your target is a member of the Mafia!',
'gf':'Your target is not suspicious.',
'ww': 'Your target is a Werewolf!',
'sw':'Your target is a Shadowalker.',
'sk':'Your target is a Serial Killer.',
'arsonist':'Your target is an Arsonist.',
'elec':'Your target is an Electrician.',
'neutral':'Your target is not suspicious.',
'butcher':'Your target is a Butcher.',
'slaug':'Your target is a Slaughterer.'
};
module.exports = {
log:function(name,targets){
loggedActions[name] = targets;
},
clear:function(){
loggedActions = {};
suggestedMessages = [];
suggestedActions = [];
beingTargetted = {};
},
getRoleGroup:function(role){
return getRoleGroup(role);
},
getInvestFlavor:function(group)
{
return investGrouping[group];
},
getAlignment:function(role){
if (autoRoles[role])
{
return autoRoles[role].alignment;
}
else
{
return undefined;
}
},
getSheriffResult:function(alignment)
{
return sheriffResults[alignment];
},
getInvestGroupings:function(group){
return getInvestGroupings(group);
},
validTarget:function(arr, role, players, playernames, playernums, self, phase){
var auto = autoRoles[role];
if (auto)
{
/*if (auto.attributes.RAINDANCE && rainnumber == 2)
{
return 'You can\'t dance right now because it\'s already raining!';
}*/
if (auto.attributes.EXECUTE && phase == 8)
{
return 'Please use /x to execute your prisoner!';
}
if (auto.attributes.VIGKILL && daynumber == 1)
{
return 'You cannot shoot Night 1!';
}
if (auto.attributes.MAUL && daynumber % 2 == 1)
{
return 'You can only attack on Full Moon!';
}
//Check number of targets
if (arr.length > 1)
{
if (auto.attributes.MULTI)
{
}
else
{
return 'You can only visit one person at night.';
}
}
else
{
if (auto.attributes.FORCEDMULTI) //Has to visit two people.
{
return 'You need to visit 2 people with this role. Use /target person1 person2.';
}
}
var selfVisiting = false;
for (i in arr)
{
if (!isNaN(arr[i]))
{
arr[i] = players[playernums[arr[i]]].name;
}
if (arr[i] == self.name)
{
selfVisiting = true;
}
}
if (selfVisiting)
{
if (auto.attributes.SELF)
{
}
else
{
return 'You tried to self target, but your role cannot self target.';
}
}
else
{
if (auto.attributes.NOVISIT)
{
return 'You tried to target another player, but your role can only self target.';
}
}
}
else
{
return 'notfound';
}
return 'ok';
},
setDay:function(num){
daynumber = num;
},
getDay:function(){
return daynumber;
},
getActions:function(name){
return loggedActions[name];
},
grammarList:function(list, sep){
if (sep === undefined)
{
sep = 'and';
}
//Format a list in a grammatically correct way.
var str = '';
if (list.length > 1)
{
str = list.slice(0,list.length-1).join(', ') + ' '+sep+' ' + list[list.length -1];
}
else if (list.length == 1)
{
str = list[0];
}
return str;
},
evaluate:function(players, playernames, mod, roles, lvl, fromphase){
var targets = {};
var displayTargets = {};
var playersByName = {}; //Quick target array to get back to the players array.
//Populate targets array.
for (i in players)
{
if (mod != players[i].s.id)
{
playersByName[players[i].name] = players[i];//Quicktarget
targets[players[i].name] = [players[i].role,undefined, true];
if (players[i].alive)
{
displayTargets[players[i].name] = [players[i].role,undefined, true, []];
if (loggedActions[players[i].name])
{
targets[players[i].name][1] = loggedActions[players[i].name].slice(); //Add the target.
displayTargets[players[i].name][1] = loggedActions[players[i].name].slice();
}
else
{
targets[players[i].name][1] = [];
}
}
//Populate the beingTargetted array for quick access.
if (targets[players[i].name][1] != []) //If a player is targetting someone
{
for (k in targets[players[i].name][1]) //For all targetted players, add them to the list.
{
var t = targets[players[i].name][1][k];
if (beingTargetted[t])
{
beingTargetted[t].push(players[i].name);
}
else
{
beingTargetted[t] = [players[i].name];
}
}
}
}
}
//Only do this bit if suggestions are enabled ie. auto is 2
if (lvl >= 2)
{
//Sort targets array by priority
var orderedTargets = Object.keys(targets);
orderedTargets = orderedTargets.sort(function(one, two){
var rolename1 = getRole(targets[one]);
var rolename2 = getRole(targets[two]);
var role1 = autoRoles[rolename1];
var role2 = autoRoles[rolename2];
var p1, p2;
if (role1 === undefined)
{
p1 = 0;
}
else
{
p1 = role1.priority;
}
if (role2 === undefined)
{
p2 = 0;
}
else
{
p2 = role2.priority;
}
if (p1 === undefined)
{
p1 = 0;
}
if (p2 === undefined)
{
p2 = 0;
}
return (p2 > p1);
});
/*if (rainnumber == 1 && fromphase == 4 || fromphase == 7)
{
addSuggestedMessage('It started to rain.','<All>');
rainnumber = 2;
}
else if (rainnumber == 2)
{
var drstring = "";
for (i in orderedTargets)
{
var num = orderedTargets[i];
var role = getRole(targets[num]);
var roleInfo = autoRoles[role];
var roleAttributes = roleInfo.attributes;
if (roleAttributes.NINJA || roleAttributes.NOLIVINGTARGET)
{
}
else
{
drstring += " "+num;
}
}
drstring = drstring.substr(1);
var drlist = drstring.split(" ");
addSuggestedMessage('Those people got drenched tonight: '+drlist,'<All>');
rainnumber = 0;
}*/
//Loop through roles in priority order.
for (i in orderedTargets)
{
var num = orderedTargets[i];
var role = getRole(targets[num]);
var roleInfo = autoRoles[role];
if (roleInfo) //If role is automated
{
if (targets[num][1])
{
if( Object.keys(targets[num][1]).length != 0 || roleInfo.attributes.MUSTVISIT || (roleInfo.attributes.MUSTVISITEVEN && daynumber % 2 == 0)) //If they sent in a night action or have to visit anyway
{
if (Object.keys(targets[num][1]).length == 0 && !roleInfo.attributes.DOUSE) //If they were forced they must now target themselves.
{
targets[num][1].push(num);
}
var roleAttributes = roleInfo.attributes;
var targettingLiving = false;
var targettingDead = false;
for (j in targets[num][1])
{
var p = playersByName[targets[num][1][j]];
if (p.alive)
{
targettingLiving = true;
}
else
{
targettingDead = true;
}
}
var allowedDead = roleAttributes.DEADTARGET;
var allowedLiving = !roleAttributes.NOLIVINGTARGET;
//TargettingLiving is true if at least one target is alive. TargettingDead is true if at least one is dead.
var valid = false;
if (targettingDead)
{
if (allowedDead)
{
valid = true;
}
else
{
valid = false;
displayTargets[num][2] = {auto:false,reason:'Targetting a dead player when not allowed.'}; //Set the role to not automated.
addSuggestedMessage('Your night action was disregarded because you targetted a dead player, when your role cannot target the dead.',num);
}
}
else
{
if (allowedLiving)
{
valid = true;
}
else
{
valid = false;
displayTargets[num][2] = {auto:false,reason:'Targetting a living player when not allowed.'}; //Set the role to not automated.
addSuggestedMessage('Your night action was disregarded because you targetted a living player, when your role cannot target the living.',num);
}
}
if (roleAttributes.NOVISIT && targets[num][1][0] != num)
{
valid = false;
addSuggestedMessage('Your night action was disregarded because you targetted another player, when your role can only self target.',num);
}
if (valid)
{
if (isLegalTarget(num,roleAttributes,targets))
{
if (roleAttributes.TRANSPORT) //Transport
{
//Ensure two targets were used.
var t = targets[num][1];
if (t.length == 2 )
{
var player = players[playernames[t[0]]];
var player2 = players[playernames[t[1]]];
if (!player.chats.jailed && !player2.chats.jailed ) //Check if either player was jailed
{
//Swap all targets on the two players.
for (j in targets)
{
for (k in targets[j][1])
{
if (targets[j][1][k] == t[0] && j != num)
{
var index = k;
//Remove the previous target.
var prevTarget = targets[j][1][0];
var pindex = beingTargetted[prevTarget].indexOf(j);