-
Notifications
You must be signed in to change notification settings - Fork 366
/
Rules.py
2206 lines (2120 loc) · 126 KB
/
Rules.py
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
import collections
import logging
def set_rules(world):
global_rules(world)
if world.bridge == 'medallions':
# require all medallions to form the bridge
set_rule(
world.get_entrance('Rainbow Bridge'),
lambda state: state.has('Forest Medallion') and
state.has('Fire Medallion') and
state.has('Water Medallion') and
state.has('Shadow Medallion') and
state.has('Spirit Medallion') and
state.has('Light Medallion'))
elif world.bridge == 'vanilla':
# require only what vanilla did to form the bridge
set_rule(
world.get_entrance('Rainbow Bridge'),
lambda state: state.has('Light Arrows') and
state.has('Shadow Medallion') and
state.has('Spirit Medallion'))
elif world.bridge == 'dungeons':
# require all medallions and stones to form the bridge
set_rule(
world.get_entrance('Rainbow Bridge'),
lambda state: state.has('Forest Medallion') and
state.has('Fire Medallion') and
state.has('Water Medallion') and
state.has('Shadow Medallion') and
state.has('Spirit Medallion') and
state.has('Light Medallion') and
state.has('Kokiri Emerald') and
state.has('Goron Ruby') and
state.has('Zora Sapphire'))
def set_rule(spot, rule):
spot.access_rule = rule
def set_always_allow(spot, rule):
spot.always_allow = rule
def add_rule(spot, rule, combine='and'):
old_rule = spot.access_rule
if combine == 'or':
spot.access_rule = lambda state: rule(state) or old_rule(state)
else:
spot.access_rule = lambda state: rule(state) and old_rule(state)
def add_item_rule(spot, rule, combine='and'):
old_rule = spot.item_rule
if combine == 'or':
spot.item_rule = lambda item: rule(item) or old_rule(item)
else:
spot.item_rule = lambda item: rule(item) and old_rule(item)
def forbid_item(location, item):
old_rule = location.item_rule
location.item_rule = lambda i: i.name != item and old_rule(i)
def item_in_locations(state, item, locations):
for location in locations:
if item_name(state, location) == item:
return True
return False
def item_name(state, location):
location = state.world.get_location(location)
if location.item is None:
return None
return location.item.name
def global_rules(world):
expected_skulltulas = world.logic_skulltulas
# ganon can only carry triforce
world.get_location('Ganon').item_rule = lambda item: item.name == 'Triforce'
# these are default save&quit points and always accessible
world.get_region('Links House').can_reach = lambda state: True
# dungeon requirements (including gold skulltulas)
if world.dungeon_mq['DT']:
dung_rules_dtmq(world)
else:
dung_rules_dt0(world)
if world.dungeon_mq['DC']:
dung_rules_dcmq(world)
else:
dung_rules_dc0(world)
if world.dungeon_mq['JB']:
dung_rules_jbmq(world)
else:
dung_rules_jb0(world)
if world.dungeon_mq['FoT']:
dung_rules_fotmq(world)
else:
dung_rules_fot0(world)
if world.dungeon_mq['FiT']:
dung_rules_fitmq(world)
else:
dung_rules_fit0(world)
if world.dungeon_mq['WT']:
dung_rules_wtmq(world)
else:
dung_rules_wt0(world)
if world.dungeon_mq['SpT']:
dung_rules_sptmq(world)
else:
dung_rules_spt0(world)
if world.dungeon_mq['ShT']:
dung_rules_shtmq(world)
else:
dung_rules_sht0(world)
if world.dungeon_mq['BW']:
dung_rules_bwmq(world)
else:
dung_rules_bw0(world)
if world.dungeon_mq['IC']:
dung_rules_icmq(world)
else:
dung_rules_ic0(world)
if world.dungeon_mq['GTG']:
dung_rules_gtgmq(world)
else:
dung_rules_gtg0(world)
if world.dungeon_mq['GC']:
dung_rules_gcmq(world)
else:
dung_rules_gc0(world)
# overworld requirements
set_rule(
world.get_location('Deku Baba Sticks'),
lambda state: (state.has('Kokiri Sword') and state.has('Buy Deku Shield')) or
(world.open_forest and (state.is_adult() or state.has('Kokiri Sword') or state.has('Boomerang'))))
set_rule(
world.get_location('Deku Baba Nuts'),
lambda state: (state.has('Kokiri Sword') and state.has('Buy Deku Shield')) or
(world.open_forest and
(state.is_adult() or
state.has_slingshot() or
state.has_sticks() or
state.has_explosives() or
state.has('Kokiri Sword') or
state.can_use('Dins Fire'))))
set_rule(
world.get_entrance('Deku Tree'),
lambda state: (state.has('Kokiri Sword') and state.has('Buy Deku Shield')) or world.open_forest)
set_rule(world.get_entrance('Lost Woods Bridge'), lambda state: state.can_leave_forest())
set_rule(world.get_location('Skull Kid'), lambda state: state.can_play('Sarias Song'))
set_rule(
world.get_location('Ocarina Memory Game'),
lambda state: (not world.logic_no_memory_game) and state.has_ocarina())
set_rule(world.get_location('Target in Woods'), lambda state: state.has_slingshot())
set_rule(
world.get_location('Deku Theater Skull Mask'),
lambda state: (not world.logic_no_trade_skull_mask) and state.has('Zeldas Letter'))
set_rule(
world.get_location('Deku Theater Mask of Truth'),
lambda state: (not world.logic_no_trade_mask_of_truth) and
(state.has('Zeldas Letter') and
state.can_play('Sarias Song') and
state.has('Kokiri Emerald') and
state.has('Goron Ruby') and
state.has('Zora Sapphire') and
state.guarantee_hint())) #Must befriend Skull Kid to sell Skull Mask, all stones to spawn running man.
set_rule(world.get_location('Anju as Adult'), lambda state: state.is_adult())
set_rule(world.get_location('Man on Roof'), lambda state: world.logic_man_on_roof or state.can_use('Hookshot'))
set_rule(
world.get_location('10 Gold Skulltula Reward'),
lambda state: (expected_skulltulas >= 10) and state.has('Gold Skulltula Token', 10))
set_rule(
world.get_location('20 Gold Skulltula Reward'),
lambda state: (expected_skulltulas >= 20) and state.has('Gold Skulltula Token', 20))
set_rule(
world.get_location('30 Gold Skulltula Reward'),
lambda state: (expected_skulltulas >= 30) and state.has('Gold Skulltula Token', 30) and state.guarantee_hint())
set_rule(
world.get_location('40 Gold Skulltula Reward'),
lambda state: (expected_skulltulas >= 40) and state.has('Gold Skulltula Token', 40) and state.guarantee_hint())
set_rule(
world.get_location('50 Gold Skulltula Reward'),
lambda state: (expected_skulltulas >= 50) and state.has('Gold Skulltula Token', 50) and state.guarantee_hint())
set_rule(world.get_location('Heart Piece Grave Chest'), lambda state: state.can_play('Suns Song'))
set_rule(world.get_entrance('Composer Grave'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(
world.get_location('Song from Composer Grave'),
lambda state: state.is_adult() or
(state.has_slingshot() or
state.has('Boomerang') or
state.has_sticks() or
state.has_explosives() or
state.has('Kokiri Sword')))
set_rule(world.get_location('Composer Grave Chest'), lambda state: state.has_fire_source())
set_rule(
world.get_entrance('Bottom of the Well'),
lambda state: state.can_play('Song of Storms') and
(world.dungeon_mq['BW'] or
state.can_child_attack() or
state.has_nuts()))
set_rule(
world.get_entrance('Death Mountain Entrance'),
lambda state: state.has('Zeldas Letter') or state.is_adult() or world.open_kakariko)
set_rule(
world.get_entrance('Dodongos Cavern Rocks'),
lambda state: state.has_explosives() or state.has('Progressive Strength Upgrade') or state.is_adult())
set_rule(
world.get_location('DM Trail Freestanding PoH'),
lambda state: world.open_kakariko or
(world.difficulty != 'ohko') or
state.has('Zeldas Letter') or
state.can_blast_or_smash() or
state.can_use('Dins Fire') or
state.can_use('Nayrus Love') or
state.has_bow() or
state.has('Progressive Strength Upgrade') or
state.has_bottle() or
state.has('Hover Boots'))
set_rule(
world.get_location('Death Mountain Bombable Chest'),
lambda state: state.can_blast_or_smash() or (world.logic_tricks and state.has('Progressive Strength Upgrade')))
set_rule(
world.get_location('Biggoron'),
lambda state: (not world.logic_no_trade_biggoron) and
state.is_adult() and
state.can_finish_adult_trades() and
state.guarantee_hint())
set_rule(
world.get_location('Goron City Leftmost Maze Chest'),
lambda state: state.can_use('Hammer') or state.can_use('Silver Gauntlets'))
set_rule(
world.get_location('Goron City Left Maze Chest'),
lambda state: state.can_blast_or_smash() or
state.can_use('Silver Gauntlets'))
set_rule(
world.get_location('Goron City Right Maze Chest'),
lambda state: state.can_blast_or_smash() or state.can_use('Silver Gauntlets'))
set_rule(
world.get_location('Rolling Goron as Child'),
lambda state: state.has('Bomb Bag') and state.has_explosives())
set_rule(
world.get_location('Goron City Pot Freestanding PoH'),
lambda state: (state.has_bombs() or state.has('Progressive Strength Upgrade')) and
((state.can_play('Zeldas Lullaby') and state.has_sticks()) or state.can_use('Dins Fire')))
set_rule(world.get_entrance('Darunias Chamber'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(world.get_location('Darunias Joy'), lambda state: state.can_play('Sarias Song'))
set_rule(
world.get_location('Goron City Stick Pot'),
lambda state: world.open_kakariko or
state.has('Zeldas Letter') or
state.has_explosives() or
state.can_use('Dins Fire'))
set_rule(
world.get_entrance('Goron City from Woods'),
lambda state: (state.can_blast_or_smash() or
state.can_use('Dins Fire') or
((state.has_bow() or state.has('Progressive Strength Upgrade')) and state.is_adult())) and
state.can_leave_forest())
set_rule(world.get_location('Song from Saria'), lambda state: state.has('Zeldas Letter'))
set_rule(world.get_entrance('Mountain Summit Fairy'), lambda state: state.can_blast_or_smash())
set_rule(world.get_location('Crater Fairy Reward'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(world.get_location('Mountain Summit Fairy Reward'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(world.get_entrance('Mountain Crater Entrance'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Hyrule Castle Fairy'), lambda state: state.has_explosives())
set_rule(world.get_location('Hyrule Castle Fairy Reward'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(world.get_entrance('Hyrule Castle Garden'), lambda state: state.has('Weird Egg') or (not world.shuffle_weird_egg))
set_rule(world.get_entrance('Ganons Castle Grounds'), lambda state: state.is_adult())
set_rule(world.get_entrance('Ganons Castle Fairy'), lambda state: state.can_use('Golden Gauntlets'))
set_rule(world.get_location('Ganons Castle Fairy Reward'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(world.get_location('Bombchu Bowling Bomb Bag'), lambda state: state.has_bombchus())
set_rule(world.get_location('Bombchu Bowling Piece of Heart'), lambda state: state.has_bombchus())
set_rule(world.get_location('Adult Shooting Gallery'), lambda state: state.has('Bow') and state.is_adult())
set_rule(
world.get_location('10 Big Poes'),
lambda state: (not world.logic_no_big_poes) and
state.is_adult() and
((state.can_use('Bow') and
state.has('Epona') and
state.has_bottle() and
state.guarantee_hint()) or
state.has('Bottle with Big Poe', world.big_poe_count)))
set_rule(world.get_location('Treasure Chest Game'), lambda state: state.can_use('Lens of Truth'))
set_rule(world.get_entrance('Lost Woods Dive Warp'), lambda state: state.can_dive() and state.can_leave_forest())
set_rule(world.get_entrance('Zora River Dive Warp'), lambda state: state.can_dive())
set_rule(world.get_entrance('Lake Hylia Dive Warp'), lambda state: state.can_dive())
set_rule(world.get_entrance('Zoras Domain Dive Warp'), lambda state: state.can_dive())
set_rule(
world.get_entrance('Zora River Waterfall'),
lambda state: state.can_play('Zeldas Lullaby') or world.logic_zora_with_cucco)
set_rule(world.get_entrance('Zora River Rocks'), lambda state: state.has_explosives())
set_rule(
world.get_location('Zora River Lower Freestanding PoH'),
lambda state: state.has_explosives() or state.can_dive() or state.can_use('Hover Boots'))
set_rule(
world.get_location('Zora River Upper Freestanding PoH'),
lambda state: state.has_explosives() or state.can_dive() or state.can_use('Hover Boots'))
set_rule(
world.get_location('Frog Ocarina Game'),
lambda state: state.can_play('Zeldas Lullaby') and
state.can_play('Sarias Song') and
state.can_play('Suns Song') and
state.can_play('Eponas Song') and
state.can_play('Song of Time') and
state.can_play('Song of Storms'))
set_rule(world.get_location('Frogs in the Rain'), lambda state: state.can_play('Song of Storms'))
set_rule(world.get_location('Underwater Bottle'), lambda state: state.can_dive())
set_rule(world.get_location('King Zora Moves'), lambda state: state.has('Bottle with Letter'))
set_rule(world.get_entrance('Behind King Zora'), lambda state: state.has('Bottle with Letter'))
set_rule(world.get_entrance('Zora River Adult'), lambda state: state.is_adult())
set_rule(
world.get_entrance('Zoras Domain Adult Access'),
lambda state: state.can_play('Zeldas Lullaby') or (state.has('Hover Boots') and world.logic_zora_with_hovers))
set_rule(world.get_entrance('Zoras Fountain Adult Access'), lambda state: state.can_reach('Zoras Fountain'))
set_rule(world.get_location('Zoras Domain Torch Run'), lambda state: state.has_sticks())
set_rule(world.get_entrance('Jabu Jabus Belly'), lambda state: state.has_bottle())
set_rule(world.get_entrance('Zoras Fountain Fairy'), lambda state: state.has_explosives())
set_rule(world.get_location('Zoras Fountain Fairy Reward'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(
world.get_location('Ocarina of Time'),
lambda state: state.has('Kokiri Emerald') and
state.has('Goron Ruby') and
state.has('Zora Sapphire') and
state.guarantee_hint())
set_rule(
world.get_location('Song from Ocarina of Time'),
lambda state: state.has('Kokiri Emerald') and
state.has('Goron Ruby') and
state.has('Zora Sapphire') and
state.guarantee_hint())
set_rule(
world.get_entrance('Door of Time'),
lambda state: state.can_play('Song of Time') or world.open_door_of_time)
set_rule(world.get_location('Talons Chickens'), lambda state: state.has('Zeldas Letter'))
set_rule(world.get_location('Song from Malon'), lambda state: state.has('Zeldas Letter') and state.has_ocarina())
set_rule(world.get_location('Epona'), lambda state: state.can_play('Eponas Song') and state.is_adult())
set_rule(
world.get_entrance('Adult Forest Warp Pad'),
lambda state: state.can_play('Minuet of Forest') and state.is_adult())
set_rule(world.get_entrance('Child Forest Warp Pad'), lambda state: state.can_play('Minuet of Forest'))
set_rule(
world.get_entrance('Meadow Gate'),
lambda state: state.has_slingshot() or
state.has_sticks() or
state.has_explosives() or
state.has('Kokiri Sword') or
state.can_use('Dins Fire'))
set_rule(
world.get_entrance('Adult Meadow Access'),
lambda state: state.can_play('Sarias Song') and state.is_adult())
set_rule(world.get_entrance('Forest Temple Entrance'), lambda state: state.can_use('Hookshot'))
set_rule(world.get_entrance('Dampes Grave'), lambda state: state.is_adult())
set_rule(world.get_location('Dampe Race Freestanding PoH'), lambda state: not world.logic_no_second_dampe_race)
set_rule(
world.get_location('Graveyard Freestanding PoH'),
lambda state: state.can_use('Magic Bean') or state.can_use('Longshot'))
set_rule(world.get_location('Song at Windmill'), lambda state: state.is_adult() and state.has_ocarina())
set_rule(
world.get_location('Windmill Freestanding PoH'),
lambda state: (state.is_adult() and (world.logic_windmill_poh or state.can_play('Song of Time'))) or
state.has('Boomerang'))
set_rule(
world.get_entrance('Temple Warp Pad'),
lambda state: state.can_play('Prelude of Light') and state.can_leave_forest())
set_rule(world.get_location('Sheik at Temple'), lambda state: state.has('Forest Medallion') and state.is_adult())
set_rule(world.get_location('Diving in the Lab'), lambda state: state.has('Progressive Scale', 2))
set_rule(
world.get_location('Child Fishing'),
lambda state: (not world.logic_no_child_fishing) and state.has('Kokiri Sword'))
set_rule(
world.get_location('Adult Fishing'),
lambda state: (not world.logic_no_adult_fishing) and
(state.can_use('Scarecrow') or
state.can_use('Magic Bean') or
state.can_reach(world.get_location('Morpha'))))
set_rule(
world.get_location('Lake Hylia Freestanding PoH'),
lambda state: state.can_use('Scarecrow') or state.can_use('Magic Bean'))
set_rule(
world.get_location('Lake Hylia Sun'),
lambda state: (state.can_use('Distant Scarecrow') or state.can_reach(world.get_location('Morpha'))) and
state.can_use('Bow'))
set_rule(world.get_entrance('Crater Hover Boots'), lambda state: state.can_use('Hover Boots'))
set_rule(world.get_entrance('Crater Ascent'), lambda state: state.is_adult())
set_rule(world.get_entrance('Crater Scarecrow'), lambda state: state.can_use('Distant Scarecrow'))
set_rule(world.get_entrance('Crater Bridge'), lambda state: state.can_use('Hover Boots') or state.can_use('Hookshot'))
set_rule(
world.get_entrance('Crater Bridge Reverse'),
lambda state: state.can_use('Hover Boots') or state.can_use('Hookshot') or state.can_use('Magic Bean'))
set_rule(
world.get_entrance('Crater Warp Pad'),
lambda state: state.can_play('Bolero of Fire') and state.can_leave_forest())
set_rule(world.get_entrance('Crater Fairy'), lambda state: state.can_use('Hammer'))
set_rule(
world.get_location('DM Crater Volcano Freestanding PoH'),
lambda state: (state.can_use('Magic Bean') and state.can_play('Bolero of Fire')) or
(world.logic_crater_bean_poh_with_hovers and state.can_use('Hover Boots')))
set_rule(
world.get_entrance('Fire Temple Entrance'),
lambda state: state.is_adult() and (world.logic_fewer_tunic_requirements or state.has_GoronTunic()))
set_rule(world.get_location('Sheik in Crater'), lambda state: state.is_adult())
set_rule(
world.get_location('Link the Goron'),
lambda state: state.is_adult() and
(state.has('Progressive Strength Upgrade') or state.has_explosives() or state.has_bow()))
set_rule(
world.get_entrance('Crater Access'),
lambda state: state.is_adult() and
(state.has('Progressive Strength Upgrade') or state.has_explosives() or state.has_bow()))
set_rule(
world.get_entrance('Goron Shop'),
lambda state: state.has_explosives() or
state.has('Progressive Strength Upgrade') or
state.can_use('Bow') or
state.can_use('Dins Fire') or
((state.has('Zeldas Letter') or world.open_kakariko or state.can_use('Hammer')) and
(state.can_play('Zeldas Lullaby') and state.has_sticks())))
set_rule(
world.get_entrance('Lake Warp Pad'),
lambda state: state.can_play('Serenade of Water') and state.can_leave_forest())
set_rule(world.get_location('King Zora Thawed'), lambda state: state.has_blue_fire())
set_rule(world.get_entrance('Zora Shop Adult Access'), lambda state: state.has_blue_fire())
set_rule(
world.get_location('Zoras Fountain Bottom Freestanding PoH'),
lambda state: state.has('Iron Boots') and (world.logic_fewer_tunic_requirements or state.has_ZoraTunic()))
set_rule(
world.get_entrance('Water Temple Entrance'),
lambda state: (state.has('Iron Boots') or (world.logic_morpha_with_scale and state.has('Progressive Scale', 2))) and
state.can_use('Hookshot') and (world.logic_fewer_tunic_requirements or state.has_ZoraTunic()))
set_rule(
world.get_location('Sheik in Kakariko'),
lambda state: state.is_adult() and
state.has('Forest Medallion') and
state.has('Fire Medallion') and
state.has('Water Medallion'))
set_rule(world.get_entrance('Kakariko Potion Shop Front'), lambda state: state.is_adult())
set_rule(world.get_entrance('Kakariko Potion Shop Back'), lambda state: state.is_adult())
set_rule(world.get_entrance('Kakariko Bazaar'), lambda state: state.is_adult())
set_rule(
world.get_entrance('Graveyard Warp Pad'),
lambda state: state.can_play('Nocturne of Shadow') and state.can_leave_forest())
set_rule(
world.get_entrance('Shadow Temple Entrance'),
lambda state: state.can_use('Dins Fire') and
state.can_see_with_lens() and
(state.can_use('Hover Boots') or state.can_use('Hookshot')))
set_rule(
world.get_entrance('Bridge Crossing'),
lambda state: state.has('Epona') or
state.can_use('Longshot') or
((world.gerudo_fortress == 'open') and state.is_adult()))
set_rule(world.get_location('Gerudo Valley Hammer Rocks Chest'), lambda state: state.can_use('Hammer'))
set_rule(
world.get_location('Gerudo Fortress North F2 Carpenter'),
lambda state: state.can_use('Bow') or
state.can_use('Hookshot') or
state.can_use('Hover Boots') or
world.logic_tricks)
set_rule(world.get_location('Gerudo Fortress Carpenter Rescue'), lambda state: state.can_finish_GerudoFortress())
set_rule(world.get_location('Gerudo Fortress Membership Card'), lambda state: state.can_finish_GerudoFortress())
set_rule(
world.get_entrance('Gerudo Training Grounds Entrance'),
lambda state: state.has('Carpenter Rescue') and state.has('Gerudo Membership Card') and state.is_adult())
set_rule(
world.get_entrance('Haunted Wasteland Entrance'),
lambda state: state.has('Carpenter Rescue') and (state.can_use('Hover Boots') or state.can_use('Longshot')))
set_rule(
world.get_entrance('Haunted Wasteland Crossing'),
lambda state: (world.logic_lens == 'chest') or state.can_use('Lens of Truth'))
set_rule(
world.get_entrance('Colossus Warp Pad'),
lambda state: state.can_play('Requiem of Spirit') and state.can_leave_forest())
set_rule(world.get_entrance('Colossus Fairy'), lambda state: state.has_explosives())
set_rule(
world.get_location('Colossus Freestanding PoH'),
lambda state: state.can_play('Requiem of Spirit') and state.can_use('Magic Bean'))
set_rule(world.get_location('Desert Colossus Fairy Reward'), lambda state: state.can_play('Zeldas Lullaby'))
set_rule(
world.get_location('Gerudo Fortress Rooftop Chest'),
lambda state: state.can_use('Hover Boots') or state.can_use('Scarecrow') or state.can_use('Longshot'))
set_rule(
world.get_location('Horseback Archery 1000 Points'),
lambda state: state.has('Carpenter Rescue') and state.has('Epona') and state.has('Bow') and state.is_adult())
set_rule(
world.get_location('Horseback Archery 1500 Points'),
lambda state: (not world.logic_no_1500_archery) and
state.has('Carpenter Rescue') and
state.has('Epona') and
state.has('Bow') and state.is_adult())
set_rule(world.get_location('Haunted Wasteland Structure Chest'), lambda state: state.has_fire_source())
set_rule(
world.get_location('Zelda'),
lambda state: state.has('Shadow Medallion') and state.has('Spirit Medallion') and state.is_adult())
set_rule(
world.get_location('Ganon'),
lambda state: (state.has('Boss Key (Ganons Castle)') or world.unlocked_ganondorf) and
state.can_use('Light Arrows'))
set_rule(world.get_entrance('Kokiri Forest Storms Grotto'), lambda state: state.can_play('Song of Storms'))
set_rule(world.get_entrance('Lost Woods Generic Grotto'), lambda state: state.can_blast_or_smash())
set_rule(
world.get_entrance('Lost Woods Sales Grotto'),
lambda state: state.has_explosives() or
(state.can_use('Hammer') and
(state.can_play('Minuet of Forest') or state.can_play('Sarias Song'))))
set_rule(
world.get_entrance('Front of Meadow Grotto'),
lambda state: state.has_explosives() or
(state.can_use('Hammer') and
(state.can_play('Minuet of Forest') or state.can_play('Sarias Song'))))
set_rule(world.get_entrance('Remote Southern Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Field Near Lake Inside Fence Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Field Valley Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Field West Castle Town Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Field Far West Castle Town Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Field Kakariko Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Field North Lon Lon Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Castle Storms Grotto'), lambda state: state.can_play('Song of Storms'))
set_rule(
world.get_entrance('Kakariko Bombable Grotto'),
lambda state: state.can_blast_or_smash() and
(state.is_adult() or
(state.has_sticks() or state.has('Kokiri Sword') or state.can_use('Dins Fire'))))
set_rule(world.get_entrance('Mountain Bombable Grotto'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Mountain Storms Grotto'), lambda state: state.can_play('Song of Storms'))
set_rule(world.get_entrance('Top of Crater Grotto'), lambda state: state.can_blast_or_smash())
set_rule(
world.get_entrance('Zora River Plateau Open Grotto'),
lambda state: state.has_explosives() or state.can_dive() or state.is_adult())
set_rule(world.get_entrance('Zora River Plateau Bombable Grotto'), lambda state: state.can_blast_or_smash())
set_rule(
world.get_location('Tektite Grotto Freestanding PoH'),
lambda state: state.has('Progressive Scale', 2) or state.can_use('Iron Boots'))
set_rule(
world.get_location('GS Kokiri Know It All House'),
lambda state: state.nighttime() and
(state.can_leave_forest() or state.can_play('Suns Song')) and
state.can_child_attack())
set_rule(
world.get_location('GS Kokiri Bean Patch'),
lambda state: state.has_bottle() and
state.can_child_attack() and
(state.can_leave_forest() or
state.has('Kokiri Sword') or
state.has_sticks() or
state.has('Boomerang') or
state.has_explosives() or
state.has('Buy Bottle Bug')))
set_rule(
world.get_location('GS Kokiri House of Twins'),
lambda state: (state.can_use('Hookshot') or (world.logic_tricks and state.can_use('Hover Boots'))) and
state.nighttime())
set_rule(
world.get_location('GS Lost Woods Bean Patch Near Bridge'),
lambda state: state.has_bottle() and
state.can_child_attack() and
(state.can_leave_forest() or
state.has('Kokiri Sword') or
state.has_sticks() or
state.has('Boomerang') or
state.has_explosives() or
state.has('Buy Bottle Bug')))
set_rule(
world.get_location('GS Lost Woods Bean Patch Near Stage'),
lambda state: state.has_bottle() and
(state.can_child_attack() or (world.shuffle_scrubs == 'off' and state.has('Buy Deku Shield'))) and
(state.can_leave_forest() or
state.has('Kokiri Sword') or
state.has_sticks() or
state.has('Boomerang') or
state.has_explosives() or
state.has('Buy Bottle Bug')))
set_rule(
world.get_location('GS Lost Woods Above Stage'),
lambda state: state.can_use('Magic Bean') and state.nighttime())
set_rule(
world.get_location('GS Sacred Forest Meadow'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(
world.get_location('GS Hyrule Field near Kakariko'),
lambda state: (state.has('Boomerang') and state.has_explosives()) or state.can_use('Hookshot'))
set_rule(
world.get_location('GS Hyrule Field Near Gerudo Valley'),
lambda state: (state.has('Hammer') and state.has_fire_source() and state.can_use('Hookshot')) or
(state.has('Boomerang') and state.has_explosives() and state.can_use('Dins Fire')))
set_rule(world.get_location('GS Hyrule Castle Tree'), lambda state: state.can_child_attack())
set_rule(
world.get_location('GS Hyrule Castle Grotto'),
lambda state: state.has('Boomerang') and state.has_explosives())
set_rule(world.get_location('GS Lon Lon Ranch Rain Shed'), lambda state: state.nighttime())
set_rule(
world.get_location('GS Lon Lon Ranch House Window'),
lambda state: state.has('Boomerang') and state.nighttime())
set_rule(
world.get_location('GS Lon Lon Ranch Back Wall'),
lambda state: state.has('Boomerang') and state.nighttime())
set_rule(world.get_location('GS Kakariko House Under Construction'), lambda state: state.nighttime())
set_rule(world.get_location('GS Kakariko Skulltula House'), lambda state: state.nighttime())
set_rule(world.get_location('GS Kakariko Guard\'s House'), lambda state: state.nighttime())
set_rule(world.get_location('GS Kakariko Tree'), lambda state: state.nighttime())
set_rule(
world.get_location('GS Kakariko Watchtower'),
lambda state: (state.has_slingshot() or state.has_bombchus()) and state.nighttime())
set_rule(
world.get_location('GS Kakariko Above Impa\'s House'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(world.get_location('GS Graveyard Wall'), lambda state: state.has('Boomerang') and state.nighttime())
set_rule(
world.get_location('GS Graveyard Bean Patch'),
lambda state: state.has_bottle() and state.can_child_attack())
set_rule(
world.get_location('GS Mountain Trail Bean Patch'),
lambda state: state.has_bottle() and (state.has_explosives() or state.has('Progressive Strength Upgrade')))
set_rule(world.get_location('GS Mountain Trail Bomb Alcove'), lambda state: state.can_blast_or_smash())
set_rule(
world.get_location('GS Mountain Trail Path to Crater'),
lambda state: state.can_use('Hammer') and state.nighttime())
set_rule(
world.get_location('GS Mountain Trail Above Dodongo\'s Cavern'),
lambda state: state.can_use('Hammer') and state.nighttime())
set_rule(world.get_location('GS Goron City Boulder Maze'), lambda state: state.has_explosives())
set_rule(
world.get_location('GS Death Mountain Crater Crate'),
lambda state: state.can_blast_or_smash() and state.can_child_attack())
set_rule(world.get_location('GS Goron City Center Platform'), lambda state: state.is_adult())
set_rule(
world.get_location('GS Mountain Crater Bean Patch'),
lambda state: state.can_play('Bolero of Fire') and state.has_bottle() and state.can_child_attack())
set_rule(world.get_location('GS Zora River Ladder'), lambda state: state.nighttime() and state.can_child_attack())
set_rule(
world.get_location('GS Zora River Near Raised Grottos'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(
world.get_location('GS Zora River Above Bridge'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(
world.get_location('GS Zora\'s Domain Frozen Waterfall'),
lambda state: state.nighttime() and
(state.has('Progressive Hookshot') or state.has_bow() or state.has('Magic Meter')))
set_rule(
world.get_location('GS Zora\'s Fountain Above the Log'),
lambda state: state.has('Boomerang') and state.nighttime())
set_rule(
world.get_location('GS Zora\'s Fountain Hidden Cave'),
lambda state: state.has('Progressive Strength Upgrade', 2) and
state.can_blast_or_smash() and
state.has('Progressive Hookshot') and
state.nighttime())
set_rule(
world.get_location('GS Lake Hylia Bean Patch'),
lambda state: state.has_bottle() and state.can_child_attack())
set_rule(world.get_location('GS Lake Hylia Lab Wall'), lambda state: state.has('Boomerang') and state.nighttime())
set_rule(
world.get_location('GS Lake Hylia Small Island'),
lambda state: state.nighttime() and state.can_child_attack())
set_rule(world.get_location('GS Lake Hylia Giant Tree'), lambda state: state.can_use('Longshot'))
set_rule(
world.get_location('GS Lab Underwater Crate'),
lambda state: state.has('Iron Boots') and state.can_use('Hookshot'))
set_rule(
world.get_location('GS Gerudo Valley Small Bridge'),
lambda state: state.has('Boomerang') and state.nighttime())
set_rule(
world.get_location('GS Gerudo Valley Bean Patch'),
lambda state: state.has_bottle() and state.can_child_attack())
set_rule(
world.get_location('GS Gerudo Valley Behind Tent'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(
world.get_location('GS Gerudo Valley Pillar'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(
world.get_location('GS Gerudo Fortress Archery Range'),
lambda state: state.can_use('Hookshot') and state.has('Carpenter Rescue') and state.nighttime())
set_rule(
world.get_location('GS Gerudo Fortress Top Floor'),
lambda state: state.nighttime() and
(state.can_use('Bow') or
state.can_use('Hookshot') or
state.can_use('Hover Boots') or
world.logic_tricks))
set_rule(world.get_location('GS Wasteland Ruins'), lambda state: state.can_use('Hookshot'))
set_rule(
world.get_location('GS Desert Colossus Bean Patch'),
lambda state: state.has_bottle() and state.can_play('Requiem of Spirit') and state.can_child_attack())
set_rule(
world.get_location('GS Desert Colossus Tree'),
lambda state: state.can_use('Hookshot') and state.nighttime())
set_rule(
world.get_location('GS Desert Colossus Hill'),
lambda state: ((state.can_use('Magic Bean') and state.can_play('Requiem of Spirit')) or
state.can_use('Longshot')) and
state.nighttime())
set_rule(world.get_location('GS Zora River Tree'), lambda state: state.can_child_attack())
set_rule(world.get_location('HF Grotto Deku Scrub Piece of Heart'), lambda state: state.can_stun_deku())
set_rule(
world.get_entrance('Zora River Storms Grotto'),
lambda state: state.can_play('Song of Storms') and state.can_stun_deku())
set_rule(
world.get_entrance('Meadow Storms Grotto Child Access'),
lambda state: state.can_play('Song of Storms') and
(state.can_child_attack() or state.has_nuts() or state.has('Buy Deku Shield')))
set_rule(world.get_entrance('Meadow Storms Grotto Adult Access'), lambda state: state.can_play('Song of Storms'))
set_rule(world.get_entrance('Lake Hylia Grotto'), lambda state: state.can_stun_deku())
set_rule(world.get_location('LW Deku Scrub Deku Nuts'), lambda state: state.can_stun_deku())
set_rule(world.get_location('LW Deku Scrub Deku Sticks'), lambda state: state.can_stun_deku())
set_rule(world.get_location('LW Deku Scrub Deku Stick Upgrade'), lambda state: state.can_stun_deku())
set_rule(world.get_entrance('Desert Colossus Grotto'), lambda state: state.can_use('Silver Gauntlets'))
set_rule(
world.get_location('DMC Deku Scrub Bombs'),
lambda state: state.can_blast_or_smash() and
(state.can_child_attack() or state.has_nuts() or state.has('Buy Deku Shield')))
set_rule(world.get_entrance('DMC Hammer Grotto'), lambda state: state.can_use('Hammer'))
set_rule(
world.get_entrance('Goron City Grotto'),
lambda state: state.is_adult() and
((state.can_play('Song of Time') and
(world.difficulty != 'ohko' or state.has_GoronTunic() or state.can_use('Longshot') or state.can_use('Nayrus Love'))) or
(world.difficulty != 'ohko' and state.has_GoronTunic() and state.can_use('Hookshot')) or
(state.can_use('Nayrus Love') and state.can_use('Hookshot'))))
set_rule(
world.get_entrance('Lon Lon Grotto'),
lambda state: state.can_child_attack() or state.has_nuts() or state.has('Buy Deku Shield'))
set_rule(world.get_entrance('Gerudo Valley Storms Grotto'), lambda state: state.can_play('Song of Storms'))
for location in world.get_locations():
if location.type != 'Chest':
forbid_item(location, 'Ice Trap')
add_item_rule(location, lambda i: not (i.type == 'Song' and not i.world.shuffle_song_items and i.world.id != location.world.id))
add_item_rule(location, lambda i: not (i.type == 'Shop' and i.world.id != location.world.id))
if location.type == 'Shop':
if location.parent_region.name in ['Castle Town Bombchu Shop', 'Castle Town Potion Shop', 'Castle Town Bazaar']:
if not world.check_beatable_only:
forbid_item(location, 'Buy Goron Tunic')
forbid_item(location, 'Buy Zora Tunic')
if location.name in world.shop_prices:
location.price = world.shop_prices[location.name]
if location.price > 200:
set_rule(location, lambda state: state.has('Progressive Wallet', 2))
elif location.price > 99:
set_rule(location, lambda state: state.has('Progressive Wallet'))
# This function should be ran once after the shop items are placed in the world.
# It should be ran before other items are placed in the world so that logic has
# the correct checks for them. This is save to do since every shop is still
# accessible when all items are obtained and every shop item is not.
# This function should also be called when a world is copied if the original world
# had called this function because the world.copy does not copy the rules
def set_shop_rules(world):
for location in world.get_filled_locations():
if location.item.type == 'Shop':
# Add wallet requirements
if location.item.name in ['Buy Arrows (50)', 'Buy Fish', 'Buy Goron Tunic', 'Buy Bombchu (20)', 'Buy Bombs (30)']:
add_rule(location, lambda state: state.has('Progressive Wallet'))
elif location.item.name in ['Buy Zora Tunic', 'Buy Blue Fire']:
add_rule(location, lambda state: state.has('Progressive Wallet', 2))
# Add adult only checks
if location.item.name in ['Buy Goron Tunic', 'Buy Zora Tunic']:
if location.parent_region.name == 'Goron Shop':
add_rule(
location,
lambda state: state.is_adult() and
(state.has_explosives() or
state.has('Progressive Strength Upgrade') or
state.has_bow()))
elif location.parent_region.name == 'Zora Shop':
add_rule(location, lambda state: state.can_reach('Zora Shop Adult Access', 'Entrance'))
elif location.parent_region.name in ['Castle Town Bombchu Shop', 'Castle Town Potion Shop', 'Castle Town Bazaar']:
set_rule(location, lambda state: False)
else:
add_rule(location, lambda state: state.is_adult())
# Add item prerequisit checks
if location.item.name in ['Buy Blue Fire',
'Buy Blue Potion',
'Buy Bottle Bug',
'Buy Fish',
'Buy Green Potion',
'Buy Poe',
'Buy Red Potion [30]',
'Buy Red Potion [40]',
'Buy Red Potion [50]',
'Buy Fairy\'s Spirit']:
add_rule(location, lambda state: state.has_bottle())
if location.item.name in ['Buy Bombchu (10)', 'Buy Bombchu (20)', 'Buy Bombchu (5)']:
add_rule(location, lambda state: state.has_bombchus_item())
# Deku Tree Vanilla
def dung_rules_dt0(world):
set_rule(
world.get_entrance('Deku Tree Basement Path'),
lambda state: state.has_slingshot() and (state.has_sticks() or state.can_use('Dins Fire')))
set_rule(world.get_entrance('Deku Tree Slingshot Passage'), lambda state: state.has('Buy Deku Shield'))
# Boss
set_rule(
world.get_location('Queen Gohma Heart'),
lambda state: state.has('Buy Deku Shield') and (state.has('Kokiri Sword') or state.has_sticks()))
set_rule(
world.get_location('Queen Gohma'),
lambda state: state.has('Buy Deku Shield') and (state.has('Kokiri Sword') or state.has_sticks()))
# GS
set_rule(world.get_location('GS Deku Tree Basement Back Room'), lambda state: state.has('Boomerang') and (state.has_explosives()))
set_rule(world.get_location('GS Deku Tree Basement Gate'), lambda state: state.can_child_attack())
set_rule(
world.get_location('GS Deku Tree Basement Vines'),
lambda state: state.has_slingshot() or
state.has('Boomerang') or
state.has_explosives() or
state.can_use('Dins Fire') or
(world.logic_tricks and (state.has_sticks() or state.has('Kokiri Sword'))))
set_rule(world.get_location('GS Deku Tree Compass Room'), lambda state: state.can_child_attack())
# Deku Tree MQ
def dung_rules_dtmq(world):
set_rule(
world.get_entrance('Deku Tree Compass Passage'),
lambda state: state.has_slingshot() and (state.has_sticks() or state.can_use('Dins Fire')))
set_rule(
world.get_entrance('Deku Tree Basement Path'),
lambda state: state.has_slingshot() and (state.has_sticks() or state.can_use('Dins Fire')))
set_rule(world.get_location('Deku Tree MQ Slingshot Chest'), lambda state: state.can_child_attack())
set_rule(
world.get_location('Deku Tree MQ Slingshot Room Back Chest'),
lambda state: state.has_sticks() or state.can_use('Dins Fire'))
set_rule(
world.get_location('Deku Tree MQ Basement Chest'),
lambda state: state.has_sticks() or state.can_use('Dins Fire'))
set_rule(world.get_location('Deku Tree MQ After Spinning Log Chest'), lambda state: state.can_play('Song of Time'))
# Boss
set_rule(
world.get_location('Queen Gohma Heart'),
lambda state: state.has('Buy Deku Shield') and (state.has('Kokiri Sword') or state.has_sticks()))
set_rule(
world.get_location('Queen Gohma'),
lambda state: state.has('Buy Deku Shield') and (state.has('Kokiri Sword') or state.has_sticks()))
# GS
set_rule(world.get_location('GS Deku Tree MQ Lobby'), lambda state: state.can_child_attack())
set_rule(
world.get_location('GS Deku Tree MQ Compass Room'),
lambda state: state.has('Boomerang') and
((state.has_bombs() and state.can_play('Song of Time')) or state.has_bombchus()))
set_rule(
world.get_location('GS Deku Tree MQ Basement Ceiling'),
lambda state: state.has('Boomerang') and state.can_play('Song of Time'))
set_rule(world.get_location('GS Deku Tree MQ Basement Back Room'), lambda state: state.has('Boomerang'))
# Dodongo's Cavern Vanilla
def dung_rules_dc0(world):
set_rule(
world.get_entrance('Dodongos Cavern Lobby'),
lambda state: state.can_blast_or_smash() or state.has('Progressive Strength Upgrade'))
set_rule(
world.get_entrance('Dodongos Cavern Left Door'),
lambda state: (state.is_adult() or
((state.has_sticks() or state.can_use('Dins Fire')) and
(state.has_slingshot() or state.has_sticks() or state.has_explosives() or state.has('Kokiri Sword')))) and
(state.has_explosives() or
state.has('Progressive Strength Upgrade') or
state.can_use('Dins Fire') or
(world.logic_tricks and state.can_use('Bow'))))
set_rule(
world.get_location('Dodongos Cavern Compass Chest'),
lambda state: state.is_adult() or
state.has_sticks() or
(state.can_use('Dins Fire') and (state.has_slingshot() or state.has_explosives() or state.has('Kokiri Sword'))))
set_rule(
world.get_location('DC Deku Scrub Deku Sticks'),
lambda state: state.is_adult() or
state.has_slingshot() or
state.has_sticks() or
state.has_explosives() or
state.has('Kokiri Sword'))
set_rule(
world.get_entrance('Dodongos Cavern Slingshot Target'),
lambda state: (state.has_slingshot() and (state.has_explosives() or state.has('Progressive Strength Upgrade'))) or
((state.has_bow() or state.has('Hover Boots') or state.has('Progressive Hookshot', 2) or world.logic_dc_jump) and
state.is_adult()))
set_rule(world.get_location('DC Deku Scrub Deku Nuts'), lambda state: state.can_blast_or_smash())
set_rule(world.get_location('DC Deku Scrub Deku Seeds'), lambda state: state.can_blast_or_smash())
set_rule(world.get_location('Dodongos Cavern End of Bridge Chest'), lambda state: state.can_blast_or_smash())
set_rule(world.get_entrance('Dodongos Cavern Bomb Drop'), lambda state: state.has_explosives())
# Boss
set_rule(
world.get_location('King Dodongo'),
lambda state: (state.has_bombs() or state.has('Progressive Strength Upgrade')) and
(state.is_adult() or state.has_sticks() or state.has('Kokiri Sword')))
set_rule(
world.get_location('King Dodongo Heart'),
lambda state: (state.has_bombs() or state.has('Progressive Strength Upgrade')) and
(state.is_adult() or state.has_sticks() or state.has('Kokiri Sword')))
# GS
set_rule(
world.get_location('GS Dodongo\'s Cavern East Side Room'),
lambda state: state.has_explosives() or
state.is_adult() or
state.has_slingshot() or
state.has('Boomerang') or
state.has_sticks() or
state.has('Kokiri Sword'))
set_rule(
world.get_location('GS Dodongo\'s Cavern Alcove Above Stairs'),
lambda state: state.can_use('Hookshot') or
(state.has('Boomerang') and (state.has_explosives() or state.has('Progressive Strength Upgrade'))))
set_rule(
world.get_location('GS Dodongo\'s Cavern Scarecrow'),
lambda state: state.can_use('Scarecrow') or state.can_use('Longshot'))
# Dodongo's Cavern MQ
def dung_rules_dcmq(world):
set_rule(
world.get_entrance('Dodongos Cavern Lobby'),
lambda state: state.can_blast_or_smash() or state.has('Progressive Strength Upgrade'))
set_rule(world.get_entrance('Dodongos Cavern Bomb Drop'), lambda state: state.has_explosives())
set_rule(
world.get_location('Dodongos Cavern MQ Compass Chest'),
lambda state: state.is_adult() or state.can_child_attack() or state.has_nuts())
set_rule(
world.get_location('Dodongos Cavern MQ Torch Puzzle Room Chest'),
lambda state: state.can_blast_or_smash() or
state.has_sticks() or
state.can_use('Dins Fire') or
(state.is_adult() and (world.logic_dc_jump or state.has('Hover Boots') or state.has('Progressive Hookshot'))))
set_rule(
world.get_location('Dodongos Cavern MQ Larva Room Chest'),
lambda state: (state.has_sticks() and (state.has_explosives() or state.has('Progressive Strength Upgrade'))) or
state.has_fire_source())
set_rule(
world.get_location('Dodongos Cavern MQ Bomb Bag Chest'),
lambda state: state.is_adult() or
(state.has_slingshot() and
(state.has_explosives() or
((state.has_sticks() or state.can_use('Dins Fire')) and
(world.difficulty != 'ohko' or state.has_bottle() or state.can_use('Nayrus Love'))))))
set_rule(world.get_location('DC MQ Deku Scrub Deku Sticks'), lambda state: state.can_stun_deku())
set_rule(world.get_location('DC MQ Deku Scrub Deku Seeds'), lambda state: state.can_stun_deku())
set_rule(world.get_location('DC MQ Deku Scrub Deku Shield'), lambda state: state.can_stun_deku())
set_rule(
world.get_location('DC MQ Deku Scrub Red Potion'),
lambda state: state.is_adult() or
state.has_explosives() or
((state.has_sticks() or state.can_use('Dins Fire')) and
(world.difficulty != 'ohko' or state.has_bottle() or state.can_use('Nayrus Love'))))
# Boss
set_rule(
world.get_location('King Dodongo'),
lambda state: (state.has_bombs() or state.has('Progressive Strength Upgrade')) and
(state.is_adult() or state.has_sticks() or state.has('Kokiri Sword')))
set_rule(
world.get_location('King Dodongo Heart'),
lambda state: (state.has_bombs() or state.has('Progressive Strength Upgrade')) and
(state.is_adult() or state.has_sticks() or state.has('Kokiri Sword')))
# GS
set_rule(
world.get_location('GS Dodongo\'s Cavern MQ Song of Time Block Room'),
lambda state: state.can_play('Song of Time') and (state.can_child_attack() or state.is_adult()))
set_rule(
world.get_location('GS Dodongo\'s Cavern MQ Larva Room'),
lambda state: (state.has_sticks() and (state.has_explosives or state.has('Progressive Strength Upgrade'))) or
state.has_fire_source())
set_rule(world.get_location('GS Dodongo\'s Cavern MQ Lizalfos Room'), lambda state: state.can_blast_or_smash())
set_rule(
world.get_location('GS Dodongo\'s Cavern MQ Scrub Room'),
lambda state: (state.has('Boomerang') and
(state.has_slingshot() or (state.is_adult() and state.has_explosives())) and
(state.has_explosives() or
(state.has('Progressive Strength Upgrade') and
(state.can_use('Hammer') or
((state.has_sticks() or state.can_use('Dins Fire') or (state.is_adult() and (world.logic_dc_jump or state.has('Hover Boots')))) and
(world.difficulty != 'ohko' or state.has_bottle() or state.can_use('Nayrus Love'))))))) or
(state.can_use('Hookshot') and (state.has_explosives() or state.has('Progressive Strength Upgrade') or state.has_bow() or state.can_use('Dins Fire'))))
# Jabu Jabu's Belly Vanilla
def dung_rules_jb0(world):
set_rule(
world.get_entrance('Jabu Jabus Belly Ceiling Switch'),
lambda state: state.has_slingshot() or state.has_explosives() or state.has('Boomerang'))
set_rule(world.get_entrance('Jabu Jabus Belly Tentacles'), lambda state: state.has('Boomerang'))
set_rule(
world.get_entrance('Jabu Jabus Belly Octopus'),
lambda state: state.has_sticks() or state.has('Kokiri Sword'))