Skip to content

Commit 9753988

Browse files
authored
Merge pull request #2958 from GreenestBeen/dev
2 parents e6aae9c + 28df492 commit 9753988

File tree

11 files changed

+412
-124
lines changed

11 files changed

+412
-124
lines changed

__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2165,6 +2165,17 @@ def collect(self, state: CollectionState, item: Item) -> bool:
21652165
state.dk64_logic_holder[self.player].UpdateFromArchipelagoItems(state)
21662166
return change
21672167

2168+
def remove(self, state: CollectionState, item: Item) -> bool:
2169+
"""Remove the item."""
2170+
change = super().remove(state, item)
2171+
if change:
2172+
if self.player in state.dk64_logic_holder.keys():
2173+
state.dk64_logic_holder[self.player].RemoveArchipelagoItem(item)
2174+
elif hasattr(self, "spoiler"):
2175+
state.dk64_logic_holder[self.player] = LogicVarHolder(self.spoiler, self.player) # If the CollectionState dodged the creation of a logic_holder object, fix it here
2176+
state.dk64_logic_holder[self.player].UpdateFromArchipelagoItems(state)
2177+
return change
2178+
21682179
def _update_entrance_connections(self, state: CollectionState) -> None:
21692180
"""Update the entrance_connections dictionary with all reachable connected entrances."""
21702181
self.entrance_connections.clear()

archipelago.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"minimum_ap_version": "0.6.4",
3-
"world_version": "1.4.19",
2+
"minimum_ap_version": "0.6.5",
3+
"world_version": "1.4.20",
44
"authors": ["2dos", "AlmostSeagull", "Ballaam", "Green Bean", "Killklli", "Lrauq", "PoryGone", "Umed"],
55
"version": 7,
66
"compatible_version": 7,

archipelago/FillSettings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ def apply_logic_and_barriers_settings(settings_dict: dict, options) -> None:
556556
for barrier in options.remove_barriers_selected:
557557
if barrier in barrier_mapping:
558558
settings_dict["remove_barriers_selected"].append(barrier_mapping[barrier])
559+
settings_dict["remove_barriers_selected"].append(RemovedBarriersSelected.helm_star_gates)
560+
settings_dict["remove_barriers_selected"].append(RemovedBarriersSelected.helm_punch_gates)
559561

560562

561563
def apply_glitches_and_tricks_settings(settings_dict: dict, options) -> None:
@@ -771,6 +773,7 @@ def apply_minigame_settings(settings_dict: dict, options, multiworld) -> None:
771773
2: HelmDoorItem.medium_random,
772774
3: HelmDoorItem.req_gb,
773775
4: HelmDoorItem.req_bp,
776+
5: HelmDoorItem.req_companycoins,
774777
6: HelmDoorItem.req_key,
775778
7: HelmDoorItem.req_medal,
776779
8: HelmDoorItem.req_crown,

archipelago/Items.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from types import SimpleNamespace
99
from typing import TYPE_CHECKING
1010

11-
from archipelago.Options import Goal, ShopPrices
11+
from archipelago.Options import Goal, ShopPrices, HelmDoor1Item, HelmDoor2Item
1212
from randomizer.Enums.Levels import Levels
1313
from randomizer.Lists import Item as DK64RItem
1414
from randomizer.Enums.Items import Items as DK64RItems
@@ -90,15 +90,14 @@ def random_starting_moves(world: "DK64World") -> typing.List[str]:
9090
if world.options.climbing_shuffle:
9191
all_eligible_starting_moves.extend(DK64RItemPoolUtility.ClimbingAbilities())
9292
world.random.shuffle(all_eligible_starting_moves)
93-
for i in range(world.options.starting_move_count):
93+
while len(starting_moves) < world.options.starting_move_count:
9494
if len(all_eligible_starting_moves) == 0:
9595
break
9696
move_id = all_eligible_starting_moves.pop()
9797
move = DK64RItem.ItemList[move_id]
9898
# We don't want to pick anything we're already starting with. As an aside, the starting inventory move name may or may not have spaces in it.
9999
if move.name in world.options.start_inventory:
100100
# If we were to choose a move we're forcibly starting with, pick another
101-
i -= 1
102101
continue
103102
starting_moves.append(move.name)
104103

@@ -117,6 +116,12 @@ def setup_items(world: "DK64World") -> typing.List[DK64Item]:
117116
if world.options.coin_door_item.value >= 2: # Any requirement (random or specific)
118117
helm_door_required_types.add(world.spoiler.settings.coin_door_item)
119118

119+
# Handle vanilla helm door requirements
120+
if world.options.crown_door_item.value == HelmDoor1Item.option_vanilla:
121+
helm_door_required_types.add(BarrierItems.Crown)
122+
if world.options.coin_door_item.value == HelmDoor2Item.option_vanilla:
123+
helm_door_required_types.add(BarrierItems.CompanyCoin)
124+
120125
for item_id, dk64r_item in DK64RItem.ItemList.items():
121126
name = use_original_name_or_trap_name(dk64r_item)
122127
# Edit the progression on an item-by-item basis.

archipelago/Logic.py

Lines changed: 227 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)