-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraw-svo.valid.main.lua
4693 lines (3922 loc) · 146 KB
/
raw-svo.valid.main.lua
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
-- Svof (c) 2011-2015 by Vadim Peretokin
-- Svof is licensed under a
-- Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
-- You should have received a copy of the license along with this
-- work. If not, see <http://creativecommons.org/licenses/by-nc-sa/4.0/>.
#local function encode (what)
# return "dict." .. what .. ".herb"
#end
#local function encodesm (what)
# return "dict." .. what .. ".smoke"
#end
#local function encodes (what)
# return "dict." .. what .. ".salve"
#end
#local function encodef (what)
# return "dict." .. what .. ".focus"
#end
#local function encodep (what)
# return "dict." .. what .. ".purgative"
#end
#local function encodew (what)
# return "dict." .. what .. ".waitingfor"
#end
function valid.caught_illusion()
sys.flawedillusion = true
me.haveillusion = true
end
function not_illusion(reason)
sys.not_illusion = reason or true
end
function ignore_illusion(reason, moveback)
-- don't spam with multiple (i)'s
if sys.flawedillusion then return end
sys.flawedillusion = true
me.haveillusion = reason or true
local currentline = getLineNumber()
if reason == "not first" then
local previousline = getLines(currentline-1, currentline)[1]
moveCursor(#getCurrentLine(), currentline)
insertText(" ") moveCursor(#getCurrentLine(), currentline) insertLink("(i)", '', string.format("Ignored this illusion because '%s' can't come together with '%s' at once.", line, previousline))
else
if moveback then moveCursor(0, currentline-1) end
moveCursor(#getCurrentLine(), currentline)
insertText(" ") moveCursor(#getCurrentLine(), currentline) insertLink("(i)", '', reason or '')
end
moveCursorEnd("main")
debugf("ignore_illusion()")
end
function show_info(shortmsg, message, moveback)
if moveback then moveCursor(0, getLineNumber()-1) end
moveCursor(#getCurrentLine(), getLineNumber())
insertText(" ") moveCursor(#getCurrentLine(), getLineNumber())
deselect()
fg("green")
insertLink("("..shortmsg..")", '', message or '') -- can't format, https://bugs.launchpad.net/mudlet/+bug/1027732
resetFormat()
end
-- +2 if we do stuff on the prompt
function vm.last_line_was_prompt(onprompt)
return (paragraph_length == 1) and true or false
end
function valid.symp_asleep()
if conf.aillusion and paragraph_length ~= 1 and not conf.batch then
ignore_illusion("not first")
return
end
if not affs.sleep and not actions.sleep_aff then
checkaction(dict.sleep.aff, true)
lifevision.add(actions["sleep_aff"].p, "symptom", nil, 1)
end
-- reset non-wait things we were doing, because they got cancelled by the sleep
if affs.asleep or actions.asleep_aff then
for k,v in actions:iter() do
if v.p.balance ~= "waitingfor" and v.p.balance ~= "aff" then
killaction(dict[v.p.action_name][v.p.balance])
end
end
end
end
function valid.cured_lovers()
checkaction(dict.lovers.physical)
if actions.lovers_physical then
lifevision.add(actions.lovers_physical.p, nil, multimatches[2][2])
end
end
function valid.cured_lovers_nobody()
checkaction(dict.lovers.physical)
if actions.lovers_physical then
lifevision.add(actions.lovers_physical.p, "nobody")
end
end
function valid.bloodsworn_gone()
#if skills.devotion then
checkaction(dict.bloodsworntoggle.misc)
if actions.bloodsworntoggle_misc then
lifevision.add(actions.bloodsworntoggle_misc.p)
end
#end
end
function defs.sileris_start()
checkaction(dict.sileris.misc)
if actions.sileris_misc then
lifevision.add(actions.sileris_misc.p)
end
end
function defs.sileris_finished()
checkaction(dict.waitingforsileris.waitingfor)
if actions.waitingforsileris_waitingfor then
lifevision.add(actions.waitingforsileris_waitingfor.p)
end
end
function defs.sileris_slickness()
checkaction(dict.sileris.misc)
if actions.sileris_misc then
if dict.sileris.applying == "quicksilver" and not line:find("quicksilver", 1, true) then
ignore_illusion("Ignored this illusion because we're applying quicksilver, not sileris right now (or we were forced).")
elseif dict.sileris.applying == "sileris" and not line:find("berry", 1, true) then
ignore_illusion("Ignored this illusion because we're applying sileris, not quicksilver right now (or we were forced).")
else
lifevision.add(actions.sileris_misc.p, "slick", nil, 1)
end
end
end
function valid.sileris_flayed()
if not conf.aillusion then
defs.lost_sileris()
elseif paragraph_length == 1 then
checkaction(dict.sileris.gone, true)
lifevision.add(actions.sileris_gone.p, nil, getLastLineNumber("main"), 1)
else
ignore_illusion("not first")
end
end
function valid.insomnia_relaxed()
if not conf.aillusion then
defs.lost_insomnia()
else
checkaction(dict.insomnia.gone, true)
lifevision.add(actions.insomnia_gone.p, "relaxed", getLastLineNumber("main"))
end
end
function valid.insomnia_healed()
if not conf.aillusion then
defs.lost_insomnia()
elseif affs.blackout or paragraph_length > 1 then
defs.lost_insomnia()
else
ignore_illusion("The heal line doesn't seem to be on it's own as it should be.")
end
end
function defs.got_block(dir)
checkaction(dict.block.physical)
if actions.block_physical then
lifevision.add(actions.block_physical.p, nil, dir)
end
end
function valid.smoke_stillgot_inquisition()
checkaction(dict.hellsight.smoke)
if actions.hellsight_smoke then
lifevision.add(actions.hellsight_smoke.p, "inquisition")
end
end
function valid.smoke_stillhave_madness()
checkaction(dict.madness.smoke)
if actions.madness_smoke then
lifevision.add(actions.madness_smoke.p, "hecate")
end
end
function valid.smoke_have_rebounding()
checkaction(dict.rebounding.smoke)
if actions.rebounding_smoke then
smoke_cure = true
lifevision.add(actions.rebounding_smoke.p, "alreadygot")
end
end
#if skills.chivalry or skills.shindo or skills.kaido or skills.metamorphosis then
function defs.got_fitness()
checkaction(dict.fitness.physical)
if actions.fitness_physical then
lifevision.add(actions.fitness_physical.p)
end
end
function valid.fitness_cured_asthma()
checkaction(dict.fitness.physical)
if actions.fitness_physical then
lifevision.add(actions.fitness_physical.p, "curedasthma")
end
end
function valid.fitness_weakness()
checkaction(dict.fitness.physical)
if actions.fitness_physical then
lifevision.add(actions.fitness_physical.p, "weakness")
end
end
function valid.fitness_allgood()
checkaction(dict.fitness.physical)
if actions.fitness_physical then
lifevision.add(actions.fitness_physical.p, "allgood")
end
end
function valid.usedfitnessbalance()
checkaction(dict.stolebalance.happened, true)
lifevision.add(actions.stolebalance_happened.p, nil, "fitness")
end
function valid.gotfitnessbalance()
checkaction(dict.gotbalance.happened, true)
dict.gotbalance.happened.tempmap[#dict.gotbalance.happened.tempmap+1] = "fitness" -- hack to allow multiple balances at once
lifevision.add(actions.gotbalance_happened.p)
end
#else
function defs.got_fitness() end
function valid.fitness_cured_asthma() end
function valid.fitness_weariness() end
function valid.fitness_allgood() end
#end
#if skills.chivalry then
function valid.gotragebalance()
checkaction(dict.gotbalance.happened, true)
dict.gotbalance.happened.tempmap[#dict.gotbalance.happened.tempmap+1] = "rage" -- hack to allow multiple balances at once
lifevision.add(actions.gotbalance_happened.p)
end
#end
function valid.dragonform_riding()
if actions.riding_physical then
lifevision.add(actions.riding_physical.p, "dragonform")
end
end
function defs.started_dragonform()
if actions.dragonform_physical then
lifevision.add(actions.dragonform_physical.p)
end
end
-- set the Elder dragon colour - but only when we are mid-dragonforming, so as not to get tricked by illusions
function valid.dragonformingcolour(colour)
if not conf.aillusion or actions.waitingfordragonform_waitingfor then
colour = colour:lower()
local t = {
["red"] = 'dragonfire',
["black"] = 'acid',
["silver"] = 'lightning',
-- it is 'golden' and not 'gold' for this message
["golden"] = 'psi',
["blue"] = 'ice',
["green"] = 'venom'
}
conf.dragonbreath = t[colour]
raiseEvent("svo config changed", "dragonbreath")
end
end
function defs.got_dragonform()
checkaction(dict.waitingfordragonform.waitingfor)
if actions.waitingfordragonform_waitingfor then
lifevision.add(actions.waitingfordragonform_waitingfor.p)
end
end
function defs.cancelled_dragonform()
if actions.waitingfordragonform_waitingfor then
lifevision.add(actions.waitingfordragonform_waitingfor.p, "cancelled")
end
end
#if skills.groves then
function valid.started_rejuvenate()
if actions.rejuvenate_physical then
lifevision.add(actions.rejuvenate_physical.p)
end
end
function valid.completed_rejuvenate()
checkaction(dict.waitingforrejuvenate.waitingfor)
if actions.waitingforrejuvenate_waitingfor then
lifevision.add(actions.waitingforrejuvenate_waitingfor.p)
end
end
function valid.cancelled_rejuvenate()
if actions.waitingforrejuvenate_waitingfor then
lifevision.add(actions.waitingforrejuvenate_waitingfor.p, "cancelled")
end
end
#end
#if skills.spirituality then
function defs.started_mace()
if actions.mace_physical then
lifevision.add(actions.mace_physical.p)
end
end
function defs.have_mace()
if actions.mace_physical then
lifevision.add(actions.mace_physical.p, "alreadyhave")
end
end
function defs.got_mace()
checkaction(dict.waitingformace.waitingfor)
if actions.waitingformace_waitingfor then
lifevision.add(actions.waitingformace_waitingfor.p)
end
end
function defs.cancelled_mace()
if actions.waitingformace_waitingfor then
lifevision.add(actions.waitingformace_waitingfor.p, "cancelled")
end
end
function valid.sacrificed_angel()
if not conf.aillusion or actions.sacrifice_physical then
selectCurrentLine()
setBgColor(0,0,0)
setFgColor(0,170,255)
resetFormat()
reset.affs()
reset.general()
else
ignore_illusion("Didn't send the 'angel sacrifice' command recently.")
end
end
#end
#if skills.shindo then
function valid.shin_phoenix()
if not conf.aillusion or actions.phoenix_physical then
selectCurrentLine()
setBgColor(0,0,0)
setFgColor(0,170,255)
resetFormat()
reset.affs()
else
ignore_illusion("Didn't send the 'shin phoenix' command recently.")
end
end
#end
#if skills.propagation then
function defs.notonland_viridian()
if actions.viridian_physical then
lifevision.add(actions.viridian_physical.p, "notonland")
end
end
function defs.viridian_inside()
if actions.viridian_physical then
lifevision.add(actions.viridian_physical.p, "indoors")
end
end
function defs.viridian_cancelled()
if actions.waitingforviridian_waitingfor then
lifevision.add(actions.waitingforviridian_waitingfor.p, "cancelled")
end
end
function defs.got_viridian()
if actions.waitingforviridian_waitingfor then
lifevision.add(actions.waitingforviridian_waitingfor.p)
end
end
function defs.started_viridian()
if actions.viridian_physical then
lifevision.add(actions.viridian_physical.p)
end
end
function defs.alreadyhave_viridian()
if actions.viridian_physical then
lifevision.add(actions.viridian_physical.p, "alreadyhave")
end
end
#end
function valid.alreadyhave_dragonbreath()
if actions.dragonbreath_physical then
lifevision.add(actions.dragonbreath_physical.p, "alreadygot")
end
end
function defs.alreadyhave_dragonform()
if actions.dragonform_physical then
lifevision.add(actions.dragonform_physical.p, "alreadyhave")
end
end
function defs.started_dragonbreath()
if actions.dragonbreath_physical then
lifevision.add(actions.dragonbreath_physical.p)
end
end
function defs.got_dragonbreath()
checkaction(dict.waitingfordragonbreath.waitingfor)
if actions.waitingfordragonbreath_waitingfor then
lifevision.add(actions.waitingfordragonbreath_waitingfor.p)
end
end
-- hallucinations symptoms
function valid.swandive()
local have_pflag = pflags.p
sk.onprompt_beforeaction_add("swandive", function ()
if not have_pflag and pflags.p then
valid.simpleprone()
valid.simplehallucinations()
end
end)
end
-- detect conf/dizzy, or amnesia/amnesia at worst
function sk.check_evileye()
if find_until_last_paragraph("Your curseward has been breached!", "exact") then
sk.tempevileye.count = sk.tempevileye.count - 1
end
-- fails when they give the same aff twice
--[[local affcount = 0
for action in lifevision.l:iter() do
if string.ends(action, "_aff") or string.find(action, "check") then affcount = affcount + 1 end
end
local diff = sk.tempevileye.count - affcount]]
local diff = sk.tempevileye.hiddencount
if diff == 1 then
valid.simpleunknownmental()
echof("assuming focusable aff.")
elseif diff == 2 then
valid.simpleconfusion()
valid.simpleunknownmental()
echof("assuming confusion and focusable aff.")
end
-- diff of 0 is OK
sk.tempevileye = nil
signals.before_prompt_processing:disconnect(sk.check_evileye)
end
function valid.hidden_evileye()
if line:find("stares at you, giving you the evil eye", 1, true) or isPrompt() then
sk.tempevileye.hiddencount = (sk.tempevileye.hiddencount or 0) + 1
end
end
function valid.evileye()
-- check next line to see if it's
if sk.tempevileye then sk.tempevileye.count = sk.tempevileye.count + 1 return end -- don't set it if the first line already did
sk.tempevileye = {startline = getLastLineNumber("main"), count = 1}
signals.before_prompt_processing:connect(sk.check_evileye)
end
function sk.check_trip()
if not find_until_last_paragraph("You parry the attack with a deft manoeuvre.", "exact") and not find_until_last_paragraph("You step into the attack,", "substring") then
valid.simpleprone()
end
signals.before_prompt_processing:disconnect(sk.check_trip)
end
function valid.trip_prone()
signals.before_prompt_processing:connect(sk.check_trip)
end
function valid.spiders_all_overme()
valid.simplefear()
valid.simplehallucinations()
end
function valid.symp_impale()
if affs.blackout then
valid.proper_impale()
elseif not conf.aillusion then
valid.simpleimpale()
else
sk.impale_symptom()
end
end
function valid.symp_stupidity()
sk.stupidity_symptom()
end
function valid.symp_transfixed()
sk.transfixed_symptom()
end
function valid.symp_paralysis()
if actions.fillskullcap_physical then
killaction(dict.fillskullcap.physical)
if not affs.paralysis then
valid.simpleparalysis()
decho(getDefaultColor().." (paralysis confirmed)")
end
return
elseif actions.fillelm_physical then
killaction(dict.fillelm.physical)
if not affs.paralysis then
valid.simpleparalysis()
decho(getDefaultColor().." (paralysis confirmed)")
end
return
elseif actions.fillvalerian_physical then
killaction(dict.fillvalerian.physical)
if not affs.paralysis then
valid.simpleparalysis()
decho(getDefaultColor().." (paralysis confirmed)")
end
return
end
if actions.checkparalysis_misc then
lifevision.add(actions.checkparalysis_misc.p, "paralysed")
decho(getDefaultColor().." (paralysis confirmed)")
elseif not conf.aillusion then
valid.simpleparalysis()
elseif not affs.paralysis then
checkaction(dict.checkparalysis.aff, true)
lifevision.add(actions.checkparalysis_aff.p)
end
if actions.prone_misc then
killaction(dict.prone.misc)
if not affs.paralysis then
valid.simpleparalysis()
decho(getDefaultColor().." (paralysis confirmed)")
end
end
-- in slowcuring only (for AI safety for now), count all balanceful actions for paralysis
if sys.sync and usingbal"physical" then
valid.simpleparalysis()
end
end
function valid.symp_stun()
if not conf.aillusion then
valid.simplestun()
elseif actions.checkstun_misc then
lifevision.add(actions.checkstun_misc.p)
else
sk.stun_symptom()
end
-- reset non-wait things we were doing, because they got cancelled by the stun
if affs.stun or actions.stun_aff then
for k,v in actions:iter() do
if v.p.balance ~= "waitingfor" and v.p.balance ~= "aff" then
killaction(dict[v.p.action_name][v.p.balance])
end
end
end
end
function valid.symp_illness_constitution()
sk.illness_constitution_symptom()
end
function valid.saidnothing()
if actions.checkslows_misc then
deleteLineP()
lifevision.add(actions.checkslows_misc.p, "onclear")
elseif affs.aeon or affs.retardation or affs.stun then
deleteLineP()
end
end
valid.silence_vibe = valid.saidnothing
function valid.jump()
if actions.checkparalysis_misc then
lifevision.add(actions.checkparalysis_misc.p, "onclear")
deleteLineP()
end
end
function valid.nobalance()
if actions.checkparalysis_misc then
lifevision.add(actions.checkparalysis_misc.p, "paralysed")
deleteLineP()
end
if actions.checkasthma_misc then
lifevision.add(actions.checkasthma_misc.p, "weakbreath", nil, 1)
end
-- cancel standing if we can't due to no balance
if actions.prone_misc then
killaction(dict.prone.misc)
if bals.balance then
bals.balance = false -- unset balance, in case of blackout, where we don't see prompt
raiseEvent("svo lost balance", "balance")
end
end
-- this might not be necessary for this case of getting hit off balance
-- elseif actions.breath_physical and not affs.asthma and affsp.asthma then
-- checkaction(dict.checkasthma.misc, true)
-- lifevision.add(actions.checkasthma_misc.p, "weakbreath", nil, 1)
-- end
end
function valid.nothingtowield()
if actions.checkparalysis_misc then
deleteLineP()
lifevision.add(actions.checkparalysis_misc.p, "onclear")
end
end
function valid.nosymptom()
if actions.checkwrithes_misc then
tempLineTrigger(0,3,[[deleteLine()]])
lifevision.add(actions.checkwrithes_misc.p, "onclear")
end
end
function valid.nothingtoeat()
if actions.checkanorexia_misc then
deleteLineP()
lifevision.add(actions.checkanorexia_misc.p, "onclear")
elseif actions.checkstun_misc then
deleteLineP()
lifevision.add(actions.checkstun_misc.p, "onclear")
elseif affs.anorexia or affs.stun then
deleteLineP()
end
end
function valid.lungsokay()
if actions.checkasthma_misc then
deleteLineP()
lifevision.add(actions.checkasthma_misc.p, "onclear")
end
end
-- given a sluggish symptom, either confirms sluggish if we're checking for it already
-- or goes out and tests it
function valid.webeslow()
sk.sawsluggish = getLastLineNumber("main") -- for retardation going away auto-detection
if sk.sluggishtimer then killTimer(sk.sluggishtimer); sk.sluggishtimer = nil end
-- if triggered by curing, don't consider it retardation
if sk.sawcuring() then return end
-- if we suspect aeon, and aren't checking it yet, add the action in
if affsp.aeon and not actions.checkslows_misc then
checkaction(dict.checkslows.misc, true)
end
-- confirm that we're sluggish if we were checking for slows
if actions.checkslows_misc then
lifevision.add(actions.checkslows_misc.p, "sluggish")
return
end
-- if we have aeon or retardation already, do nothing then
if affs.aeon or affs.retardation then return end
if affs.blackout and not affs.retardation then
valid.simpleaeon()
elseif not affs.retardation then
-- confirm aeon out of the blue, treat it as retardation over aeon
checkaction(dict.checkslows.aff, true)
lifevision.add(actions.checkslows_aff.p, nil, "retardation")
-- sk.retardation_symptom()
end
end
function valid.webbily()
if actions.checkwrithes_misc then
lifevision.add(actions.checkwrithes_misc.p, "webbily")
end
end
function valid.symp_webbed()
if not conf.aillusion then
valid.simplewebbed()
else
sk.webbed_symptom()
end
end
function valid.symp_impaled()
if not conf.aillusion then
valid.simpleimpale()
else
sk.impaled_symptom()
end
end
function valid.transfixily()
if actions.checkwrithes_misc then
lifevision.add(actions.checkwrithes_misc.p, "transfixily")
end
-- special workaround for waking up not showing up in blackout: clear sleep if we saw this msg
-- it's an issue otherwise to miss the sleep msg from a totem while in blackout and think you're still asleep
if affs.asleep then removeaff("asleep") end
end
function valid.symp_roped()
if not conf.aillusion then
valid.simpleroped()
else
sk.roped_symptom()
end
end
function valid.symp_transfixed()
if not conf.aillusion then
valid.simpletransfixed()
else
sk.transfixed_symptom()
end
end
function valid.weakbreath()
if actions.checkasthma_misc then
lifevision.add(actions.checkasthma_misc.p, "weakbreath", nil, 1)
elseif actions.breath_physical and not affs.asthma then
checkaction(dict.checkasthma.misc, true)
lifevision.add(actions.checkasthma_misc.p, "weakbreath", nil, 1)
elseif conf.aillusion and (not actions.breath_physical and not affs.asthma) then
ignore_illusion("Ignored this illusion because we aren't trying to hold breath right now (or we were forced).")
else
checkaction(dict.checkasthma.aff, true)
lifevision.add(actions.checkasthma_aff.p)
end
end
function valid.impaly()
if actions.checkwrithes_misc then
lifevision.add(actions.checkwrithes_misc.p, "impaly")
end
end
function valid.chimera_stun()
if conf.aillusion and (not defc.deaf or not affs.deafaff or not actions.deafaff_aff) then return end
valid.simplestun(2)
end
function valid.restore()
checkaction(dict.restore.physical)
if actions.restore_physical then
-- prevent against a well-timed restore use, which when empty, forces us to clear all afflictions
if conf.aillusion then
local time, lat = getStopWatchTime(actions.restore_physical.p.actionwatch), getping()
if time < (lat/2) then
ignore_illusion("This looks fake - finished way too quickly, in "..time.."s, while our ping is "..lat)
return
end
end
valid.passive_cure()
lifevision.add(actions.restore_physical.p, nil, getLineNumber())
selectCurrentLine()
setBgColor(0,0,0)
setFgColor(0,170,255)
resetFormat()
end
end
function valid.dragonheal()
checkaction(dict.dragonheal.physical)
if actions.dragonheal_physical then
valid.passive_cure()
lifevision.add(actions.dragonheal_physical.p, nil, getLineNumber())
selectCurrentLine()
setBgColor(0,0,0)
setFgColor(0,170,255)
resetFormat()
end
end
function valid.nodragonheal()
checkaction(dict.dragonheal.physical)
if actions.dragonheal_physical then
lifevision.add(actions.dragonheal_physical.p, "nobalance")
end
end
function valid.knighthood_disembowel()
local result = checkany(dict.curingimpale.waitingfor)
-- we won't get curing* if we didn't even start to writhe, so fake it for these purposes
if not result and affs.impale then
checkaction(dict.curingimpale.waitingfor, true)
result = { name = "curingimpale_waitingfor" }
end
if result and actions[result.name] then
lifevision.add(actions[result.name].p, "withdrew")
end
end
valid.impale_withdrew = valid.knighthood_disembowel
function valid.fell_sleep()
checkaction(dict.sleep.aff, true)
checkaction(dict.prone.aff, true)
lifevision.add(actions.sleep_aff.p)
lifevision.add(actions.prone_aff.p)
end
function valid.proper_sleep()
if defc.insomnia then
defs.lost_insomnia()
else
checkaction(dict.sleep.aff, true)
checkaction(dict.prone.aff, true)
lifevision.add(actions.sleep_aff.p)
lifevision.add(actions.prone_aff.p)
end
end
function valid.disruptingshiver()
if conf.aillusion and bals.equilibrium then
sk.onprompt_beforeaction_add("disruptingshiver", function ()
if not bals.equilibrium then
checkaction(dict.shivering.aff, true)
checkaction(dict.disrupt.aff, true)
lifevision.add(actions.shivering_aff.p)
lifevision.add(actions.disrupt_aff.p)
defs.lost_caloric()
end
end)
else
checkaction(dict.shivering.aff, true)
checkaction(dict.disrupt.aff, true)
lifevision.add(actions.shivering_aff.p)
lifevision.add(actions.disrupt_aff.p)
defs.lost_caloric()
end
end
function svo.valid.check_dragonform()
-- show xp? ignore!
if lastpromptnumber+1 == getLastLineNumber("main") or not find_until_last_paragraph(me.name, "substring") then return end
if defc.dragonform and not find_until_last_paragraph("Dragon)", "substring") then
echo"\n" echof("Apparently we aren't in Dragon.")
svo.defs.lost_dragonform()
svo.defs.lost_dragonarmour()
svo.defs.lost_dragonbreath()
elseif not defc.dragonform and find_until_last_paragraph("Dragon)", "substring") then
echo"\n" echof("Apparently we're in Dragon.")
svo.defs.got_dragonform()
end
end
svo.defs.got_dragonform = dict.waitingfordragonform.waitingfor.oncompleted
function valid.proper_impale()
if not conf.aillusion then
valid.simpleimpale()
else
checkaction(dict.checkwrithes.aff, true)
lifevision.add(actions.checkwrithes_aff.p, "impale", stats.currenthealth)
end
end
function valid.swachbuckling_pesante()
if (not find_until_last_paragraph("The attack rebounds back onto", "substring")) and (find_until_last_paragraph("jabs", "substring")) and (find_until_last_paragraph("you", "substring")) then
if (not conf.aillusion) or (defc.deaf or affs.deafaff) then
valid.simplestun(.5)
end
end
end
--[[
Martellato can get tricked by the following, avoid it:
Lightning-quick, Bob jabs you with a Soulpiercer.
A prickly, stinging sensation spreads through your body.
The songblessing upon the rapier sings out with a piercing high note.
Mary viciously jabs an elegant Mhaldorian rapier into Bob.
The songblessing upon the rapier swells with a rich, vibrant hum.
]]
function valid.swachbuckling_martellato()
if not find_until_last_paragraph("The attack rebounds back onto", "substring") and
find_until_last_paragraph("jabs", "substring") and
find_until_last_paragraph("you", "substring") and
not find_until_last_paragraph("^%w+ viciously jabs", "pattern") then
valid.simpleprone()
end
end
local last_jabber = ""
function valid.swashbuckling_jab(name)
if sk.swashbuckling_jab then killTimer(sk.swashbuckling_jab) end
sk.swashbuckling_jab = tempTimer(.5, function() sk.swashbuckling_jab = nil end)
last_jabber = name
end
function valid.voicecraft_tremolo(name, side)
local known_class = (ndb and ndb.getclass(name))
if not conf.aillusion or ((affs["crippled"..side.."leg"] or sk["delayvenom_"..side.."leg"] or sk["delayacciaccatura_"..side.."leg"]) and ((sk.swashbuckling_jab and last_jabber == name) or known_class == "bard")) then
-- when we've accepted that the Tremolo is legitimate, record the side - to be checked later in the mangle trigger for verification
sk.tremoloside = sk.tremoloside or {}
sk.tremoloside[side] = true
prompttrigger("clear tremolo", function()
-- the prompttrigger happens after the mangle should have been processed:
-- so if we still have tremoloside setup, it means no mangle happened as the
-- mangle would have cleared it. Hence, make the venom timer go off at the
-- earlist possible time.
if sk.tremoloside and sk.tremoloside[side] and sk["delayvenom_"..side.."leg"] then
killTimer(sk["delayvenom_"..side.."leg"])
sk["delayvenom_"..side.."leg"] = nil
-- we can't use valid here, but we can use addaff
addaff(dict["crippled"..side.."leg"])
signals.after_lifevision_processing:unblock(cnrl.checkwarning)
signals.canoutr:emit()
end
sk.tremoloside = nil
end)
end
end
function valid.voicecraft_vibrato(name, side)
if not conf.aillusion or ((affs["crippled"..side.."arm"] or sk["delayvenom_"..side.."arm"] or sk["delayacciaccatura_"..side.."arm"]) and ((sk.swashbuckling_jab and last_jabber == name) or known_class == "bard")) then
valid["simplemangled"..side.."arm"]()
end
end
-- for a Bard tremolo/vibrato hit, avoid curing the crippled limb right away
-- because that will use up our salve balance and delay the mangled break, which
-- follows soon after. Hence this, upon detecting a jab form a Bard with
-- epteth/epseth, delays adding the crippled affliction until after the tremolo
-- or vibrato
function valid.swashbuckling_poison()
if not conf.aillusion or (paragraph_length == 2 and not conf.batch) then
for _, limb in ipairs{"rightleg", "rightarm", "leftarm", "leftleg"} do
if actions["crippled"..limb.."_aff"] then
killaction(dict["crippled"..limb].aff)
sk["delayvenom_"..limb] = tempTimer(.25, function()
if not affs["mangled"..limb] then
addaff(dict["crippled"..limb])
signals.after_lifevision_processing:unblock(cnrl.checkwarning)
signals.canoutr:emit()
make_gnomes_work()
end
sk["delayvenom_"..limb] = nil