예제 #1
0
    def item_allowed(self, item):
        """

        Args:
            item(randomizer.data.items.Item|type): Item to check.

        Returns:
            bool: True if the given item is allowed to be placed in this spot, False otherwise.

        """
        # If this is a missable location, it cannot contain a key item.
        if self.missable and not utils.isclass_or_instance(
                item, items.ChestReward) and item.is_key:
            return False

        # Normal locations can be anything except an invincibility star.
        return not utils.isclass_or_instance(item, items.InvincibilityStar)
예제 #2
0
    def item_allowed(self, item):
        """

        Args:
            item(randomizer.data.items.Item|type): Item to check.

        Returns:
            bool: True if the given item is allowed to be placed in this spot, False otherwise.

        """
        return super().item_allowed(item) and not isclass_or_instance(item, items.ChestReward)
예제 #3
0
    def get_patch(self):
        patch = super().get_patch()

        # If we're giving frog coins at this spot, write the number of frog coins to a special address.
        if isclass_or_instance(self.item, items.FrogCoin):
            patch.add_data(0x1e6650, self.num_frog_coins)
        # Otherwise extra bytes are needed to enable this spot to use the regular item granting subroutine.
        else:
            patch.add_data(0x1e6631, bytes([0x40, 0x66]))

        return patch
예제 #4
0
 def item(self, value):
     """
     Args:
         value(randomizer.data.items.Item|type): Item to place in this location, if allowed.
     """
     if not utils.isclass_or_instance(value, items.Item):
         raise ValueError(
             "Location {} - Trying to assign value {} that isn't an item class"
             .format(self, value))
     if not self.item_allowed(value):
         raise ValueError("Location {} - Item {} not allowed".format(
             self, value))
     self._item = value
예제 #5
0
 def item_allowed(self, item):
     # NPC rewards cannot contain "You Missed!" or chest-only rewards.
     # FIXME: Non-KI NPC rewards don't work with progressive cards for now.  Remove this when fixed.
     return super().item_allowed(item) and not isclass_or_instance(item, (items.AltoCard, items.ChestReward))