Adding first apworld

This commit is contained in:
Mysaa Java
2026-09-26 02:15:02 +02:00
parent 90f3f7afb0
commit 89cac6a0c6
9 changed files with 493 additions and 1 deletions
+67
View File
@@ -0,0 +1,67 @@
from __future__ import annotations
from typing import TYPE_CHECKING
from BaseClasses import ItemClassification, Location
from . import items
if TYPE_CHECKING:
from .world import NodecamesWorld
GREEN_COUNT_PER_WORLD = [6, 9, 9, 12, 16, 16, 20, 25, 25, 30, 36, 36]
def worldName(index):
return f"{(index//3)+1}-{(index%3)+1}"
LOCATION_NAME_TO_ID = {}
LOCATION_NAME_FROM_WORLD = {}
id = 0
for w in range(len(GREEN_COUNT_PER_WORLD)):
LOCATION_NAME_FROM_WORLD[w] = []
for i in range(1, GREEN_COUNT_PER_WORLD[w]):
name = f"World {worldName(w)} word {i}"
id += 1
LOCATION_NAME_FROM_WORLD[w].append(name)
LOCATION_NAME_TO_ID[name] = id
name = f"Complete {worldName(w)}"
id += 1
LOCATION_NAME_FROM_WORLD[w].append(name)
LOCATION_NAME_TO_ID[name] = id
class NodecamesLocation(Location):
game = "Nodecames"
def create_all_locations(world: NodecamesWorld) -> None:
create_world_locations(world)
create_events(world)
def create_world_locations(world: NodecamesWorld) -> None:
overworld = world.get_region("Overworld")
for w in LOCATION_NAME_FROM_WORLD:
for l in range(len(LOCATION_NAME_FROM_WORLD[w])-1):
name = LOCATION_NAME_FROM_WORLD[w][l]
loc = NodecamesLocation(
world.player,
name,
LOCATION_NAME_TO_ID[name],
overworld,
)
overworld.locations.append(loc)
def all_completion_items(world: NodecamesWorld) -> list[str]:
return [LOCATION_NAME_FROM_WORLD[w][-1]+" item" for w in LOCATION_NAME_FROM_WORLD]
def create_events(world: NodecamesWorld) -> None:
overworld = world.get_region("Overworld")
for w in LOCATION_NAME_FROM_WORLD:
overworld.add_event(
LOCATION_NAME_FROM_WORLD[w][-1],
LOCATION_NAME_FROM_WORLD[w][-1]+" item",
location_type = NodecamesLocation,
item_type = items.NodecamesItem)