feat: reroll initiative in participant editor with persisted init mod
Add a dice button beside the Initiative field in the participant edit modal that rolls d20 + Init Mod; Cancel/Save guard accidental changes. Persist initMod on participant creation (quick-add monster, roster character/NPC, Add All) and expose it as an editable field in the modal. Roster NPCs added via the character dropdown now enter as npc type, and the duplicate guard keys on originalCharacterId regardless of type.
This commit is contained in:
1 parent
05e8c262b7
commit
8ecd31d570
3 files changed
+134
-7
No files matched your search
@@ -353,6 +353,7 @@ function makeParticipant(opts) {
|
||||
type: opts.type,
|
||||
originalCharacterId: opts.originalCharacterId || null,
|
||||
initiative: opts.initiative,
|
||||
initMod: opts.initMod !== undefined ? opts.initMod : null,
|
||||
maxHp: opts.maxHp,
|
||||
currentHp: opts.currentHp,
|
||||
conditions: opts.conditions || [],
|
||||
@@ -378,6 +379,7 @@ function buildCharacterParticipant(character) {
|
||||
type: character.isNpc ? 'npc' : 'character',
|
||||
originalCharacterId: character.id,
|
||||
initiative: finalInitiative,
|
||||
initMod: modifier,
|
||||
maxHp,
|
||||
currentHp,
|
||||
ac: character.defaultAc !== undefined ? character.defaultAc : null,
|
||||
@@ -407,6 +409,7 @@ function buildMonsterParticipant({ name, maxHp, initMod, asNpc, hpFormula, ac })
|
||||
name,
|
||||
type: asNpc ? 'npc' : 'monster',
|
||||
initiative: finalInitiative,
|
||||
initMod: modifier,
|
||||
maxHp: hp,
|
||||
currentHp: hp,
|
||||
hpFormula: hpFormula || null,
|
||||
|
||||
Reference in new issue
Block a user