about summary refs log tree commit diff stats
path: root/data/maps/the_bearer/rooms
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-09-28 11:03:19 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-09-28 11:03:19 -0400
commit7cfe6f05d2564294a959690b586077686797d7c7 (patch)
tree39e96ee79005c20e65912fe9f86f71a65ff31777 /data/maps/the_bearer/rooms
parent53e0509fcb20cc824e3fe5b3d3a826f09fc9c166 (diff)
downloadlingo2-archipelago-7cfe6f05d2564294a959690b586077686797d7c7.tar.gz
lingo2-archipelago-7cfe6f05d2564294a959690b586077686797d7c7.tar.bz2
lingo2-archipelago-7cfe6f05d2564294a959690b586077686797d7c7.zip
Added icon for launcher
Diffstat (limited to 'data/maps/the_bearer/rooms')
0 files changed, 0 insertions, 0 deletions
word.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
from collections.abc import Callable
from typing import TYPE_CHECKING

from BaseClasses import CollectionState, Region
from .player_logic import AccessRequirements

if TYPE_CHECKING:
    from . import Lingo2World


def lingo2_can_satisfy_requirements(state: CollectionState, reqs: AccessRequirements, regions: list[Region],
                                    world: "Lingo2World") -> bool:
    if not all(state.has(item, world.player) for item in reqs.items):
        return False

    if not all(state.has(item, world.player, amount) for item, amount in reqs.progressives.items()):
        return False

    if not all(state.can_reach_region(region_name, world.player) for region_name in reqs.rooms):
        return False

    if not all(state.can_reach(region) for region in regions):
        return False

    for letter_key, letter_level in reqs.letters.items():
        if not state.has(letter_key, world.player, letter_level):
            return False

    if reqs.cyans:
        if not any(state.has(letter, world.player, amount)
                   for letter, amount in world.player_logic.double_letter_amount.items()):
            return False

    if len(reqs.or_logic) > 0:
        if not all(any(lingo2_can_satisfy_requirements(state, sub_reqs, [], world) for sub_reqs in subjunction)
                   for subjunction in reqs.or_logic):
            return False

    if reqs.complete_at is not None:
        completed = 0
        checked = 0
        for possibility in reqs.possibilities:
            checked += 1
            if lingo2_can_satisfy_requirements(state, possibility, [], world):
                completed += 1
                if completed >= reqs.complete_at:
                    break
            elif len(reqs.possibilities) - checked + completed < reqs.complete_at:
                # There aren't enough remaining possibilities for the check to pass.
                return False
        if completed < reqs.complete_at:
            return False

    return True

def make_location_lambda(reqs: AccessRequirements, world: "Lingo2World",
                         regions: dict[str, Region] | None) -> Callable[[CollectionState], bool]:
    # Replace required rooms with regions for the top level requirement, which saves looking up the regions during rule
    # checking.
    if regions is not None:
        required_regions = [regions[room_name] for room_name in reqs.rooms]
    else:
        required_regions = [world.multiworld.get_region(room_name, world.player) for room_name in reqs.rooms]
    new_reqs = reqs.copy()
    new_reqs.rooms.clear()
    return lambda state: lingo2_can_satisfy_requirements(state, new_reqs, required_regions, world)