コード例 #1
0
 def UpdateCompassPointer(self, location: Location) -> None:
     assert location.IsLevelRoom()
     (level_num, room_num) = (location.GetLevelNum(), location.GetRoomNum())
     #room = self.GetRoom(location.GetLevelNum(), room_num)
     assert room_num in range(0, 0x100)
     self.level_metadata[level_num * self.LEVEL_METADATA_OFFSET +
                         self.TRIFORCE_LOCATION_OFFSET] = room_num
コード例 #2
0
    def AddItem(self, item: Item, item_location: Location) -> None:
        if item in [
                Item.OVERWORLD_NO_ITEM, Item.MAP, Item.COMPASS,
                Item.MAGICAL_SHIELD, Item.BOMBS, Item.FIVE_RUPEES, Item.RUPEE,
                Item.SINGLE_HEART
        ]:
            return
        assert item in range(0, 0x21) or item in [0x40, 0x41
                                                  ]  # Includes red potion 0x20
        if item_location.GetUniqueIdentifier() in self.item_locations:
            return
        self.item_locations.add(item_location.GetUniqueIdentifier())

        self.SetStillMakingProgressBit()

        if item == Item.TRIFORCE_OF_POWER:
            log.warning("Found Triforce of Power in L%d Room %x",
                        item_location.GetLevelNum(),
                        item_location.GetRoomNum())
        elif item == Item.HEART_CONTAINER:
            self.num_heart_containers += 1
            assert self.num_heart_containers <= 16
            return
        elif item == Item.TRIFORCE:
            self.num_triforce_pieces += 1
            log.warning("Found %s.  Now have %d tringles", item,
                        self.num_triforce_pieces)
            assert self.num_triforce_pieces <= 8
            return
        elif item == Item.KEY:
            self.num_keys += 1
            return

        log.warning("Found %s", item)

        if item == Item.WOOD_SWORD and Item.WOOD_SWORD in self.items:
            self.items.add(Item.WHITE_SWORD)
        elif item == Item.WOOD_SWORD and Item.WHITE_SWORD in self.items:
            self.items.add(Item.MAGICAL_SWORD)
        elif item == Item.BLUE_RING and Item.BLUE_RING in self.items:
            self.items.add(Item.RED_RING)
        elif item == Item.BLUE_CANDLE and Item.BLUE_CANDLE in self.items:
            self.items.add(Item.RED_CANDLE)
        elif item == Item.WOOD_ARROWS and Item.WOOD_ARROWS in self.items:
            self.items.add(Item.SILVER_ARROWS)
        else:
            self.items.add(item)
コード例 #3
0
 def SetRoomItem(self, item: Item, location: Location) -> None:
     assert location.IsLevelRoom()
     if location.GetLevelNum() in [7, 8, 9]:
         self.level_7_to_9_rooms[location.GetRoomNum()].SetItem(item)
     else:
         self.level_1_to_6_rooms[location.GetRoomNum()].SetItem(item)
コード例 #4
0
 def GetRoomItem(self, location: Location) -> Item:
     assert location.IsLevelRoom()
     if location.GetLevelNum() in [7, 8, 9]:
         return self.level_7_to_9_rooms[location.GetRoomNum()].GetItem()
     return self.level_1_to_6_rooms[location.GetRoomNum()].GetItem()