V1.29.0: free roam by invitation, no slot no spell, weapons change at the right moment
- Free roam no longer adds the whole party: the DM adds who is there - A spell with no slot of its level or higher left cannot be declared; it takes the lowest slot left at or above its level. Cantrips take none - In a battle in progress a player changes the weapon in hand only as the battle begins or on their own turn after their attack has landed - Spells are listed cantrips first, then by level, with the level shown Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -906,24 +906,10 @@ router.post('/:id/encounters', requireCampaignMember(), requireDM(), async (req,
|
||||
return created;
|
||||
});
|
||||
|
||||
// Free roam is for the whole party: its places are set, and everyone
|
||||
// alive and finished is in it from the start (so their players see it).
|
||||
if (encounter.mode === 'FREE_ROAM') {
|
||||
if (places.length > 0) await prisma.encounterLocation.createMany({ data: places.map((locationId) => ({ encounterId: encounter.id, locationId })) });
|
||||
const party = await prisma.character.findMany({ where: { campaignId: req.campaign.id, buildStage: 'COMPLETE' }, include: SHEET_INCLUDE, orderBy: { createdAt: 'asc' } });
|
||||
const present = party.filter((character) => lifeState(character) !== 'DEAD');
|
||||
if (present.length > 0) {
|
||||
await prisma.encounterParticipant.createMany({
|
||||
data: present.map((character) => ({
|
||||
encounterId: encounter.id,
|
||||
characterId: character.id,
|
||||
displayName: character.name,
|
||||
currentHp: character.currentHp,
|
||||
maxHp: sheetOf(character).hp.max,
|
||||
isMonster: false,
|
||||
})),
|
||||
});
|
||||
}
|
||||
// A free-roam scene's places. Who is in it is the DM's to add, as with
|
||||
// any encounter: the party may be split, some of them somewhere else.
|
||||
if (encounter.mode === 'FREE_ROAM' && places.length > 0) {
|
||||
await prisma.encounterLocation.createMany({ data: places.map((locationId) => ({ encounterId: encounter.id, locationId })) });
|
||||
}
|
||||
res.status(201).json({ encounter });
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user