mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-03-24 12:33:22 -07:00
* APQuest * Add confetti cannon * ID change on enemy drop * nevermind * Write the apworld * Actually implement hard mode * split everything into multiple files * Push out webworld into a file * Comment * Enemy health graphics * more ruff rules * graphics :) * heal player when receiving health upgrade * the dumbest client of all time * Fix typo * You can kinda play it now! Now we just need to render the game... :))) * fix kvui imports again * It's playable. Kind of * oops * Sounds and stuff * exceptions for audio * player sprite stuff * Not attack without sword * Make sure it plays correctly * Collect behavior * ruff * don't need to clear checked_locations, but do need to still clear finished_game * Connect calls disconnect, so this is not necessary * more seemless reconnection * Ok now I think it's correct * Bgm * Bgm * minor adjustment * More refactoring of graphics and sound * add graphics * Item column * Fix enemies not regaining their health * oops * oops * oops * 6 health final boss on hard mode * boss_6.png * Display APQuest items correctly * auto switch tabs * some mypy stuff * Intro song * Confetti Cannon * a bit more confetti work * launcher component * Graphics change * graphics and cleanup * fix apworld * comment out horse and cat for now * add docs * copypasta * ruff made my comment look unhinged * Move that comment * Fix typing and don't import kvui in nogui * lmao that already exists I don't need to do it myself * Must've just copied this from somewhere * order change * Add unit tests * Notes about the client * oops * another intro song case * Write WebWorld and setup guides * Yes description provided * thing * how to play * Music and Volume * Add cat and horse player sprites * updates * Add hammer and breakable wall * TODO * replace wav with ogg * Codeowners and readme * finish unit tests * lint * Todid * Update worlds/apquest/client/ap_quest_client.py Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com> * Update worlds/apquest/client/custom_views.py Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com> * Filler pattern * __future__ annotations * twebhost * Allow wasd and arrow keys * correct wording * oops * just say the website * append instead of += * qwint is onto my favoritism * kitty alias * Add a comment about preplaced items for assertAccessDependency * Use classvar_matrix instead of MultiworldTestBase * actually remove multiworld stuff from those tests * missed one more * Refactor a bit more * Fix getting of the user path * Actually explain components * Meh * Be a bit clearer about what's what * oops * More comments in the regions.py file * Nevermind * clarify regions further * I use too many brackets * Ok I'm done fr * simplify wording * missing . * Add precollected example * add note about precollected advancements * missing s * APQuest sound rework * Volume slider * I forgot I made this * a * fix volume of jingles * Add math trap to game (only works in play_in_console mode so far) * Math trap in apworld and client side * Fix background during math trap * fix leading 0 * Sound and further ui improvements for Math Trap * fix music bug * rename apquest subfolder to game * Move comment to where it belongs * Clear up language around components (hopefully) * Clear up what CommonClient is * Reword some more * Mention Archipelago (the program) explicitly * Update worlds/apquest/docs/en_APQuest.md Co-authored-by: Ixrec <ericrhitchcock@gmail.com> * Explain a bit more why you would use classvar matrix * reword the assert raises stuff * the volume slider thing is no longer true * german game page * Be more clear about why we're overriding Item and Location * default item classification * logically considered -> relevant to logic () * Update worlds/apquest/items.py Co-authored-by: Ixrec <ericrhitchcock@gmail.com> * a word on the ambiguity of the word 'filler' * more rewording * amount -> number * stress the necessity of appending to the multiworld itempool * Update worlds/apquest/locations.py Co-authored-by: Ixrec <ericrhitchcock@gmail.com> * get_location_names_with_ids * slight rewording of the new helper method * add some words about creating known location+item pairs * Add some more words to worlds/apqeust/options.py * more words in options.py * 120 chars (thanks Ixrec >:((( LOL) * Less confusing wording about rules, hopefully? * victory -> completion * remove the immediate creation of the hammer rule on the option region entrance * access rule performance * Make all imports module-level in world.py * formatting * get rid of noqa RUF012 (and also disable the rule in my local ruff.toml * move comment for docstring closer to docstring in another place * advancement???? * Missing function type annotations * pass mypy again (I don't love this one but all the alternatives are equally bad) * subclass instead of override * I forgor to remove these * Get rid of classvar_matrix and instead talk about some other stuff * protect people a bit from the assertAccessDependency nonsense * reword a bit more * word * More accessdependency text * More accessdependency text * More accessdependency text * More accessdependency text * oops * this is supposed to be absolute * Add some links to docs * that's called game now * Add an archipelago.json and explain what it means * new line who dis * reorganize a bit * ignore instead of skip * Update archipelago.json * She new on my line till I * Update archipelago.json * add controls tab * new ruff rule? idk * WHOOPS * Pack graphics into fewer files * annoying ruff format thing * Cleanup + mypy * relative import * Update worlds/apquest/client/custom_views.py Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> * Update generate_math_problem.py * Update worlds/apquest/game/player.py Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com> --------- Co-authored-by: Duck <31627079+duckboycool@users.noreply.github.com> Co-authored-by: Ixrec <ericrhitchcock@gmail.com> Co-authored-by: Fabian Dill <Berserker66@users.noreply.github.com>
80 lines
4.1 KiB
Python
80 lines
4.1 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from BaseClasses import Entrance, Region
|
|
|
|
if TYPE_CHECKING:
|
|
from .world import APQuestWorld
|
|
|
|
# A region is a container for locations ("checks"), which connects to other regions via "Entrance" objects.
|
|
# Many games will model their Regions after physical in-game places, but you can also have more abstract regions.
|
|
# For a location to be in logic, its containing region must be reachable.
|
|
# The Entrances connecting regions can have rules - more on that in rules.py.
|
|
# This makes regions especially useful for traversal logic ("Can the player reach this part of the map?")
|
|
|
|
# Every location must be inside a region, and you must have at least one region.
|
|
# This is why we create regions first, and then later we create the locations (in locations.py).
|
|
|
|
|
|
def create_and_connect_regions(world: APQuestWorld) -> None:
|
|
create_all_regions(world)
|
|
connect_regions(world)
|
|
|
|
|
|
def create_all_regions(world: APQuestWorld) -> None:
|
|
# Creating a region is as simple as calling the constructor of the Region class.
|
|
overworld = Region("Overworld", world.player, world.multiworld)
|
|
top_left_room = Region("Top Left Room", world.player, world.multiworld)
|
|
bottom_right_room = Region("Bottom Right Room", world.player, world.multiworld)
|
|
right_room = Region("Right Room", world.player, world.multiworld)
|
|
final_boss_room = Region("Final Boss Room", world.player, world.multiworld)
|
|
|
|
# Let's put all these regions in a list.
|
|
regions = [overworld, top_left_room, bottom_right_room, right_room, final_boss_room]
|
|
|
|
# Some regions may only exist if the player enables certain options.
|
|
# In our case, the Hammer locks the top middle chest in its own room if the hammer option is enabled.
|
|
if world.options.hammer:
|
|
top_middle_room = Region("Top Middle Room", world.player, world.multiworld)
|
|
regions.append(top_middle_room)
|
|
|
|
# We now need to add these regions to multiworld.regions so that AP knows about their existence.
|
|
world.multiworld.regions += regions
|
|
|
|
|
|
def connect_regions(world: APQuestWorld) -> None:
|
|
# We have regions now, but still need to connect them to each other.
|
|
# But wait, we no longer have access to the region variables we created in create_all_regions()!
|
|
# Luckily, once you've submitted your regions to multiworld.regions,
|
|
# you can get them at any time using world.get_region(...).
|
|
overworld = world.get_region("Overworld")
|
|
top_left_room = world.get_region("Top Left Room")
|
|
bottom_right_room = world.get_region("Bottom Right Room")
|
|
right_room = world.get_region("Right Room")
|
|
final_boss_room = world.get_region("Final Boss Room")
|
|
|
|
# Okay, now we can get connecting. For this, we need to create Entrances.
|
|
# Entrances are inherently one-way, but crucially, AP assumes you can always return to the origin region.
|
|
# One way to create an Entrance is by calling the Entrance constructor.
|
|
overworld_to_bottom_right_room = Entrance(world.player, "Overworld to Bottom Right Room", parent=overworld)
|
|
overworld.exits.append(overworld_to_bottom_right_room)
|
|
|
|
# You can then connect the Entrance to the target region.
|
|
overworld_to_bottom_right_room.connect(bottom_right_room)
|
|
|
|
# An even easier way is to use the region.connect helper.
|
|
overworld.connect(right_room, "Overworld to Right Room")
|
|
right_room.connect(final_boss_room, "Right Room to Final Boss Room")
|
|
|
|
# The region.connect helper even allows adding a rule immediately.
|
|
# We'll talk more about rule creation in the set_all_rules() function in rules.py.
|
|
overworld.connect(top_left_room, "Overworld to Top Left Room", lambda state: state.has("Key", world.player))
|
|
|
|
# Some Entrances may only exist if the player enables certain options.
|
|
# In our case, the Hammer locks the top middle chest in its own room if the hammer option is enabled.
|
|
# In this case, we previously created an extra "Top Middle Room" region that we now need to connect to Overworld.
|
|
if world.options.hammer:
|
|
top_middle_room = world.get_region("Top Middle Room")
|
|
overworld.connect(top_middle_room, "Overworld to Top Middle Room")
|