- Free roam: a third kind of encounter. The DM ticks the nearby locations, the whole party is in it from the start, and each player sends their own character to a place - A place shows who is found there and what is for sale; a character shops (a place's own shop, or an NPC's wares and exchange) only where they stand - Locations can have a shop of their own; an NPC can be "found at" a location - Completed encounters are hidden from the campaign's list until "Show completed" is ticked; moving an encounter works on the list as shown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.6 KiB
SQL
40 lines
1.6 KiB
SQL
-- Free roam: a kind of encounter where the party wanders between places the
|
|
-- DM has laid out. A location can have NPCs found there and things for sale.
|
|
|
|
-- AlterEnum
|
|
ALTER TYPE "EncounterMode" ADD VALUE 'FREE_ROAM';
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "npcs" ADD COLUMN "locationId" TEXT;
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "sale_offers" ADD COLUMN "locationId" TEXT;
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "encounter_locations" (
|
|
"id" TEXT NOT NULL,
|
|
"encounterId" TEXT NOT NULL,
|
|
"locationId" TEXT NOT NULL,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
CONSTRAINT "encounter_locations_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "encounter_locations_encounterId_locationId_key" ON "encounter_locations"("encounterId", "locationId");
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "sale_offers_locationId_idx" ON "sale_offers"("locationId");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "npcs" ADD CONSTRAINT "npcs_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "locations"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "encounter_locations" ADD CONSTRAINT "encounter_locations_encounterId_fkey" FOREIGN KEY ("encounterId") REFERENCES "encounters"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "encounter_locations" ADD CONSTRAINT "encounter_locations_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "locations"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "sale_offers" ADD CONSTRAINT "sale_offers_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "locations"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|