forked from foundryvtt/dnd5e
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[foundryvtt#4790] Death save bonus and config
- Loading branch information
Showing
9 changed files
with
118 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import BaseConfigSheet from "../api/base-config-sheet.mjs"; | ||
|
||
/** | ||
* Configuration application for an actor's concentration checks. | ||
*/ | ||
export default class DeathConfig extends BaseConfigSheet { | ||
/** @override */ | ||
static DEFAULT_OPTIONS = { | ||
ability: null, | ||
position: { | ||
width: 500 | ||
} | ||
}; | ||
|
||
/* -------------------------------------------- */ | ||
|
||
/** @override */ | ||
static PARTS = { | ||
config: { | ||
template: "systems/dnd5e/templates/actors/config/death-config.hbs" | ||
} | ||
}; | ||
|
||
/* -------------------------------------------- */ | ||
/* Properties */ | ||
/* -------------------------------------------- */ | ||
|
||
/** @override */ | ||
get title() { | ||
return game.i18n.format("DND5E.ABILITY.Configure.Title", { ability: game.i18n.localize("DND5E.DeathSavingThrow") }); | ||
} | ||
|
||
/* -------------------------------------------- */ | ||
/* Rendering */ | ||
/* -------------------------------------------- */ | ||
|
||
/** @inheritDoc */ | ||
async _preparePartContext(partId, context, options) { | ||
context = await super._preparePartContext(partId, context, options); | ||
const source = this.document.system._source; | ||
|
||
context.data = source.attributes?.death ?? {}; | ||
context.fields = this.document.system.schema.getField("attributes.death").fields; | ||
context.advantageModeOptions = [ | ||
{ value: -1, label: game.i18n.localize("DND5E.Disadvantage") }, | ||
{ value: 0, label: game.i18n.localize("DND5E.Normal") }, | ||
{ value: 1, label: game.i18n.localize("DND5E.Advantage") } | ||
]; | ||
|
||
if ( this.document.system.bonuses?.abilities ) context.global = { | ||
data: source.bonuses?.abilities ?? {}, | ||
fields: this.document.system.schema.getField("bonuses.abilities").fields | ||
}; | ||
|
||
return context; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<section class="flexcol"> | ||
{{!-- Death --}} | ||
<fieldset class="card"> | ||
<legend>{{ localize "DND5E.DeathSave" }}</legend> | ||
{{ formField fields.bonuses.fields.save value=data.bonuses.save localize=true rootId=partId }} | ||
</fieldset> | ||
|
||
{{!-- Rolls --}} | ||
<fieldset class="card"> | ||
<legend>{{ localize "DND5E.ROLL.Section" label=(localize "DND5E.DeathSave") }}</legend> | ||
{{ formField fields.roll.fields.mode value=data.roll.mode options=advantageModeOptions localize=true | ||
rootId=partId }} | ||
<div class="form-group split-group"> | ||
<label>{{ localize "DND5E.ROLL.Range.Label" }}</label> | ||
<div class="form-fields"> | ||
{{ formField fields.roll.fields.min value=data.roll.min placeholder="1" type="number" localize=true | ||
label=(localize "DND5E.Minimum") hint=false classes="label-top" rootId=partId }} | ||
{{ formField fields.roll.fields.max value=data.roll.max placeholder="20" type="number" localize=true | ||
label=(localize "DND5E.Maximum") hint=false classes="label-top" rootId=partId }} | ||
</div> | ||
</div> | ||
</fieldset> | ||
|
||
{{!-- Global Bonus --}} | ||
{{#if global}} | ||
<fieldset class="card"> | ||
<legend>{{ localize "DND5E.ABILITY.SECTIONS.Global.Label" }}</legend> | ||
<div class="form-group"> | ||
<p class="hint">{{ localize "DND5E.ABILITY.SECTIONS.Global.Hint" }}</p> | ||
</div> | ||
{{ formField global.fields.save value=global.data.save localize=true rootId=partId }} | ||
</fieldset> | ||
{{/if}} | ||
</section> |