@@ -264,12 +264,6 @@ def Reset(self):
264264 self .Photos = {}
265265
266266 self .Events = []
267- # Galleon water needs slightly more care to account for the initial state of Galleon water
268- # dk64randomizer.com handles this with Events in Galleon, but AP needs a solution that doesn't litter event locations in the world
269- if self .settings .galleon_water_internal == GalleonWaterSetting .lowered :
270- self .AddEvent (Events .WaterLowered )
271- if self .settings .galleon_water_internal == GalleonWaterSetting .raised :
272- self .AddEvent (Events .WaterRaised )
273267
274268 self .Hints = []
275269
@@ -664,11 +658,10 @@ def AddArchipelagoItem(self, ap_item):
664658 if corresponding_item_id >= Items .JapesDonkeyHint and corresponding_item_id <= Items .CastleChunkyHint :
665659 self .Hints .append (corresponding_item_id )
666660 if (corresponding_item_id >= Items .PhotoBat and corresponding_item_id <= Items .PhotoBug ) or (corresponding_item_id >= Items .PhotoBFI and corresponding_item_id <= Items .PhotoSeal ):
667- self .Photos [corresponding_item_id ] = 1
661+ self .Photos [corresponding_item_id ] + = 1
668662
669663 def RemoveArchipelagoItem (self , ap_item ):
670664 """Add an Archipelago item to the owned items list."""
671- ownedItems = self .latest_owned_items .copy () # Start with the current owned items list
672665 if ap_item .name .startswith ("Collectible CBs" ):
673666 # CBs are carefully named in the following format:
674667 # index 0: "Collectible CBs" - needed to identify this as a collectible item
@@ -696,17 +689,233 @@ def RemoveArchipelagoItem(self, ap_item):
696689 # index 1: the Events enum name as a string
697690 item_data = ap_item .name .split (", " )
698691 event = Events [item_data [1 ]]
699- self .Events = [evt for evt in self .Events if evt != event ]
692+ if event in [Events .ForestEntered , Events .CastleEntered ]:
693+ self .homing = False
694+ self .RemoveEvent (event )
700695 elif ap_item .name .startswith ("Boss Defeated" ):
701696 self .bosses_beaten -= 1
702697 elif ap_item .name .startswith ("Bonus Completed" ):
703698 self .bonuses_beaten -= 1
704699 else :
705700 corresponding_item_id = logic_item_name_to_id [ap_item .name ]
706- if corresponding_item_id in ownedItems :
707- ownedItems .remove (corresponding_item_id )
708-
709- self .Update (ownedItems )
701+ self .latest_owned_items .remove (corresponding_item_id )
702+ match corresponding_item_id :
703+ case Items .Donkey :
704+ self .donkey = False
705+ self .isdonkey = False
706+ self .blast = False
707+ self .strongKong = False
708+ self .grab = False
709+ self .coconut = False
710+ self .bongos = False
711+ self ._recalculateBlueprints ()
712+ case Items .Diddy :
713+ self .diddy = False
714+ self .isdiddy = False
715+ self .charge = False
716+ self .jetpack = False
717+ self .spring = False
718+ self .peanut = False
719+ self .guitar = False
720+ self ._recalculateBlueprints ()
721+ case Items .Lanky :
722+ self .lanky = False
723+ self .islanky = False
724+ self .handstand = False
725+ self .balloon = False
726+ self .sprint = False
727+ self .grape = False
728+ self .trombone = False
729+ self ._recalculateBlueprints ()
730+ case Items .Tiny :
731+ self .tiny = False
732+ self .istiny = False
733+ self .mini = False
734+ self .twirl = False
735+ self .monkeyport = False
736+ self .feather = False
737+ self .saxophone = False
738+ self ._recalculateBlueprints ()
739+ case Items .Chunky :
740+ self .chunky = False
741+ self .ischunky = False
742+ self .hunkyChunky = False
743+ self .punch = False
744+ self .gorillaGone = False
745+ self .pineapple = False
746+ self .triangle = False
747+ self ._recalculateBlueprints ()
748+ case Items .Climbing :
749+ self .climbing = False
750+ case Items .Vines :
751+ self .vines = False
752+ self .can_use_vines = False
753+ case Items .Swim :
754+ self .swim = False
755+ case Items .Oranges :
756+ self .oranges = False
757+ self .adv_orange_usage = False
758+ case Items .Barrels :
759+ self .barrels = False
760+ case Items .BaboonBlast :
761+ self .blast = False
762+ case Items .StrongKong :
763+ self .strongKong = False
764+ case Items .GorillaGrab :
765+ self .grab = False
766+ case Items .ChimpyCharge :
767+ self .charge = False
768+ case Items .RocketbarrelBoost :
769+ self .jetpack = False
770+ case Items .SimianSpring :
771+ self .spring = False
772+ case Items .Orangstand :
773+ self .handstand = False
774+ case Items .BaboonBalloon :
775+ self .balloon = False
776+ case Items .OrangstandSprint :
777+ self .sprint = False
778+ case Items .MiniMonkey :
779+ self .mini = False
780+ case Items .PonyTailTwirl :
781+ self .twirl = False
782+ case Items .Monkeyport :
783+ self .monkeyport = False
784+ case Items .HunkyChunky :
785+ self .hunkyChunky = False
786+ case Items .PrimatePunch :
787+ self .punch = False
788+ case Items .GorillaGone :
789+ self .gorillaGone = False
790+ case Items .Coconut :
791+ self .coconut = False
792+ case Items .Peanut :
793+ self .peanut = False
794+ case Items .Grape :
795+ self .grape = False
796+ case Items .Feather :
797+ self .feather = False
798+ case Items .Pineapple :
799+ self .pineapple = False
800+ case Items .Bongos :
801+ self .bongos = False
802+ if self .Melons == 2 and not (self .guitar or self .trombone or self .saxophone or self .triangle or self .InstUpgrades > 0 ):
803+ self .Melons = 1
804+ case Items .Guitar :
805+ self .guitar = False
806+ if self .Melons == 2 and not (self .bongos or self .trombone or self .saxophone or self .triangle or self .InstUpgrades > 0 ):
807+ self .Melons = 1
808+ case Items .Trombone :
809+ self .trombone = False
810+ if self .Melons == 2 and not (self .bongos or self .guitar or self .saxophone or self .triangle or self .InstUpgrades > 0 ):
811+ self .Melons = 1
812+ case Items .Saxophone :
813+ self .saxophone = False
814+ if self .Melons == 2 and not (self .bongos or self .guitar or self .trombone or self .triangle or self .InstUpgrades > 0 ):
815+ self .Melons = 1
816+ case Items .Triangle :
817+ self .triangle = False
818+ if self .Melons == 2 and not (self .bongos or self .guitar or self .trombone or self .saxophone or self .InstUpgrades > 0 ):
819+ self .Melons = 1
820+ case Items .Cranky :
821+ self .crankyAccess = False
822+ case Items .Funky :
823+ self .funkyAccess = False
824+ case Items .Candy :
825+ self .candyAccess = False
826+ case Items .Snide :
827+ self .snideAccess = False
828+ case Items .NintendoCoin :
829+ self .nintendoCoin = False
830+ case Items .RarewareCoin :
831+ self .rarewareCoin = False
832+ case Items .JungleJapesKey :
833+ self .JapesKey = False
834+ case Items .AngryAztecKey :
835+ self .AztecKey = False
836+ case Items .FranticFactoryKey :
837+ self .FactoryKey = False
838+ case Items .GloomyGalleonKey :
839+ self .GalleonKey = False
840+ case Items .FungiForestKey :
841+ self .ForestKey = False
842+ case Items .CrystalCavesKey :
843+ self .CavesKey = False
844+ case Items .CreepyCastleKey :
845+ self .CastleKey = False
846+ case Items .HideoutHelmKey :
847+ self .HelmKey = False
848+ case Items .HelmDonkey1 :
849+ self .HelmDonkey1 = False
850+ case Items .HelmDonkey2 :
851+ self .HelmDonkey2 = False
852+ case Items .HelmDiddy1 :
853+ self .HelmDiddy1 = False
854+ case Items .HelmDiddy2 :
855+ self .HelmDiddy2 = False
856+ case Items .HelmLanky1 :
857+ self .HelmLanky1 = False
858+ case Items .HelmLanky2 :
859+ self .HelmLanky2 = False
860+ case Items .HelmTiny1 :
861+ self .HelmTiny1 = False
862+ case Items .HelmTiny2 :
863+ self .HelmTiny2 = False
864+ case Items .HelmChunky1 :
865+ self .HelmChunky1 = False
866+ case Items .HelmChunky2 :
867+ self .HelmChunky2 = False
868+ case Items .ProgressiveSlam :
869+ self .Slam -= 1
870+ if self .Slam < 2 :
871+ self .superSlam = False
872+ if self .Slam < 3 :
873+ self .superDuperSlam = False
874+ case Items .ProgressiveAmmoBelt :
875+ self .AmmoBelts -= 1
876+ case Items .ProgressiveInstrumentUpgrade :
877+ self .InstUpgrades -= 1
878+ if self .InstUpgrades == 0 and not (self .bongos or self .guitar or self .trombone or self .saxophone or self .triangle ):
879+ self .Melons = 1
880+ elif self .InstUpgrades < 2 :
881+ self .Melons = 2
882+ case Items .GoldenBanana | Items .FillerBanana :
883+ self .GoldenBananas -= 1
884+ case Items .BananaFairy | Items .FillerFairy :
885+ self .BananaFairies -= 1
886+ case Items .BananaMedal | Items .FillerMedal :
887+ self .BananaMedals -= 1
888+ case Items .BattleCrown | Items .FillerCrown :
889+ self .BattleCrowns -= 1
890+ case Items .RainbowCoin | Items .FillerRainbowCoin :
891+ self .RainbowCoins -= 1
892+ for x in range (5 ):
893+ self .Coins [x ] -= 5
894+ case Items .CameraAndShockwave :
895+ self .camera = False
896+ self .shockwave = False
897+ case Items .Camera :
898+ self .camera = False
899+ case Items .Shockwave :
900+ self .shockwave = False
901+ case Items .SniperSight :
902+ self .scope = False
903+ case Items .HomingAmmo :
904+ self .homing = False
905+ case Items .Bean :
906+ self .Beans -= 1
907+ case Items .Pearl | Items .FillerPearl :
908+ self .Pearls -= 1
909+ case Items .BananaHoard :
910+ self .bananaHoard = False
911+ case _:
912+ if corresponding_item_id >= Items .DonkeyBlueprint and corresponding_item_id <= Items .ChunkyBlueprint :
913+ # For generic blueprints, just recalculate totals since Update() handles the counting
914+ self ._recalculateBlueprints ()
915+ if corresponding_item_id >= Items .JapesDonkeyHint and corresponding_item_id <= Items .CastleChunkyHint :
916+ self .Hints .remove (corresponding_item_id )
917+ if (corresponding_item_id >= Items .PhotoBat and corresponding_item_id <= Items .PhotoBug ) or (corresponding_item_id >= Items .PhotoBFI and corresponding_item_id <= Items .PhotoSeal ):
918+ self .Photos [corresponding_item_id ] -= 1
710919
711920 def Update (self , ownedItems ):
712921 """Update logic variables based on owned items."""
@@ -1099,6 +1308,11 @@ def AddEvent(self, event):
10991308 """Add an event to events list so it can be checked for logically."""
11001309 self .Events .append (event )
11011310
1311+ def RemoveEvent (self , event ):
1312+ """Remove an event from the events list."""
1313+ if event in self .Events :
1314+ self .Events .remove (event )
1315+
11021316 def GetKongs (self ):
11031317 """Return all owned kongs."""
11041318 ownedKongs = []
0 commit comments