mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 05:31:07 +01:00
. (#702)
This commit is contained in:
parent
5045801475
commit
22283cb506
15 changed files with 98 additions and 34 deletions
|
|
@ -188,7 +188,8 @@
|
||||||
"manualMulticlassSubclass": {
|
"manualMulticlassSubclass": {
|
||||||
"title": "Multiclass Subclass",
|
"title": "Multiclass Subclass",
|
||||||
"text": "Do you want to add this subclass as your multiclass subclass?"
|
"text": "Do you want to add this subclass as your multiclass subclass?"
|
||||||
}
|
},
|
||||||
|
"cannotRemoveCoreExperience": "You are using Levelup Auto. You cannot remove an experience given to you by the rule progression."
|
||||||
},
|
},
|
||||||
"Companion": {
|
"Companion": {
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
|
|
@ -2115,6 +2116,10 @@
|
||||||
"resourceScrollTexts": {
|
"resourceScrollTexts": {
|
||||||
"label": "Show Resource Change Scrolltexts",
|
"label": "Show Resource Change Scrolltexts",
|
||||||
"hint": "When a character is damaged, uses armor etc, a scrolling text will briefly appear by the token to signify this."
|
"hint": "When a character is damaged, uses armor etc, a scrolling text will briefly appear by the token to signify this."
|
||||||
|
},
|
||||||
|
"playerCanEditSheet": {
|
||||||
|
"label": "Players Can Manually Edit Character Settings",
|
||||||
|
"hint": "Players are allowed to access the manual Character Settings and change their statistics beyond the rules."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
class: this.character.system.class?.value ?? {},
|
class: this.character.system.class?.value ?? {},
|
||||||
subclass: this.character.system.class?.subclass ?? {},
|
subclass: this.character.system.class?.subclass ?? {},
|
||||||
experiences: {
|
experiences: {
|
||||||
[foundry.utils.randomID()]: { name: '', value: 2 },
|
[foundry.utils.randomID()]: { name: '', value: 2, core: true },
|
||||||
[foundry.utils.randomID()]: { name: '', value: 2 }
|
[foundry.utils.randomID()]: { name: '', value: 2, core: true }
|
||||||
},
|
},
|
||||||
domainCards: {
|
domainCards: {
|
||||||
[foundry.utils.randomID()]: {},
|
[foundry.utils.randomID()]: {},
|
||||||
|
|
@ -588,12 +588,21 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
||||||
this.setup.class.system.inventory.take.filter(x => x)
|
this.setup.class.system.inventory.take.filter(x => x)
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.character.update({
|
await this.character.update(
|
||||||
system: {
|
{
|
||||||
traits: this.setup.traits,
|
system: {
|
||||||
experiences: this.setup.experiences
|
traits: this.setup.traits,
|
||||||
}
|
experiences: {
|
||||||
});
|
...this.setup.experiences,
|
||||||
|
...Object.keys(this.character.system.experiences).reduce((acc, key) => {
|
||||||
|
acc[`-=${key}`] = null;
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ overwrite: true }
|
||||||
|
);
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
|
||||||
const experience = Object.keys(this.actor.system.experiences).find(
|
const experience = Object.keys(this.actor.system.experiences).find(
|
||||||
x => x === data
|
x => x === data
|
||||||
);
|
);
|
||||||
return this.actor.system.experiences[experience]?.description ?? '';
|
return this.actor.system.experiences[experience]?.name ?? '';
|
||||||
});
|
});
|
||||||
advancement[choiceKey].push({ data: data, value: checkbox.value });
|
advancement[choiceKey].push({ data: data, value: checkbox.value });
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -178,6 +178,13 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
async _preparePartContext(partId, context, options) {
|
async _preparePartContext(partId, context, options) {
|
||||||
context = await super._preparePartContext(partId, context, options);
|
context = await super._preparePartContext(partId, context, options);
|
||||||
switch (partId) {
|
switch (partId) {
|
||||||
|
case 'header':
|
||||||
|
const { playerCanEditSheet, levelupAuto } = game.settings.get(
|
||||||
|
CONFIG.DH.id,
|
||||||
|
CONFIG.DH.SETTINGS.gameSettings.Automation
|
||||||
|
);
|
||||||
|
context.showSettings = game.user.isGM || !levelupAuto || (levelupAuto && playerCanEditSheet);
|
||||||
|
break;
|
||||||
case 'loadout':
|
case 'loadout':
|
||||||
await this._prepareLoadoutContext(context, options);
|
await this._prepareLoadoutContext(context, options);
|
||||||
break;
|
break;
|
||||||
|
|
@ -188,6 +195,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
await this._prepareBiographyContext(context, options);
|
await this._prepareBiographyContext(context, options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,6 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
|
|
||||||
const newValue = (action.uses.value ?? 0) + (increase ? 1 : -1);
|
const newValue = (action.uses.value ?? 0) + (increase ? 1 : -1);
|
||||||
await action.update({ 'uses.value': Math.min(Math.max(newValue, 0), action.uses.max ?? 0) });
|
await action.update({ 'uses.value': Math.min(Math.max(newValue, 0), action.uses.max ?? 0) });
|
||||||
this.render();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
new fields.SchemaField({
|
new fields.SchemaField({
|
||||||
name: new fields.StringField(),
|
name: new fields.StringField(),
|
||||||
value: new fields.NumberField({ integer: true, initial: 0 }),
|
value: new fields.NumberField({ integer: true, initial: 0 }),
|
||||||
description: new fields.StringField()
|
description: new fields.StringField(),
|
||||||
|
core: new fields.BooleanField({ initial: false })
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
gold: new fields.SchemaField({
|
gold: new fields.SchemaField({
|
||||||
|
|
@ -573,7 +574,10 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
case 'experience':
|
case 'experience':
|
||||||
selection.data.forEach(id => {
|
selection.data.forEach(id => {
|
||||||
const experience = this.experiences[id];
|
const experience = this.experiences[id];
|
||||||
if (experience) experience.value += selection.value;
|
if (experience) {
|
||||||
|
experience.value += selection.value;
|
||||||
|
experience.leveledUp = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -620,6 +624,23 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async _preUpdate(changes, options, userId) {
|
||||||
|
const allowed = await super._preUpdate(changes, options, userId);
|
||||||
|
if (allowed === false) return;
|
||||||
|
|
||||||
|
/* The first two experiences are always marked as core */
|
||||||
|
if (changes.system?.experiences && Object.keys(this.experiences).length < 2) {
|
||||||
|
const experiences = new Set(Object.keys(this.experiences));
|
||||||
|
const changeExperiences = new Set(Object.keys(changes.system.experiences));
|
||||||
|
const newExperiences = Array.from(changeExperiences.difference(experiences));
|
||||||
|
|
||||||
|
for (var i = 0; i < Math.min(newExperiences.length, 2 - experiences.size); i++) {
|
||||||
|
const experience = newExperiences[i];
|
||||||
|
changes.system.experiences[experience].core = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async _preDelete() {
|
async _preDelete() {
|
||||||
if (this.companion) {
|
if (this.companion) {
|
||||||
this.companion.updateLevel(1);
|
this.companion.updateLevel(1);
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,11 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
||||||
required: true,
|
required: true,
|
||||||
initial: true,
|
initial: true,
|
||||||
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.resourceScrollTexts.label'
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.resourceScrollTexts.label'
|
||||||
|
}),
|
||||||
|
playerCanEditSheet: new fields.BooleanField({
|
||||||
|
required: true,
|
||||||
|
initial: false,
|
||||||
|
label: 'DAGGERHEART.SETTINGS.Automation.FIELDS.playerCanEditSheet.label'
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,8 @@ export default class DhpActor extends Actor {
|
||||||
await this.update({
|
await this.update({
|
||||||
[`system.experiences.${experienceKey}`]: {
|
[`system.experiences.${experienceKey}`]: {
|
||||||
name: experience.name,
|
name: experience.name,
|
||||||
value: experience.modifier
|
value: experience.modifier,
|
||||||
|
core: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -210,7 +211,8 @@ export default class DhpActor extends Actor {
|
||||||
await this.system.companion.update({
|
await this.system.companion.update({
|
||||||
[`system.experiences.${experienceKey}`]: {
|
[`system.experiences.${experienceKey}`]: {
|
||||||
name: '',
|
name: '',
|
||||||
value: experience.modifier
|
value: experience.modifier,
|
||||||
|
core: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -559,8 +561,8 @@ export default class DhpActor extends Actor {
|
||||||
|
|
||||||
updates.forEach(
|
updates.forEach(
|
||||||
u =>
|
u =>
|
||||||
(u.value =
|
(u.value =
|
||||||
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
|
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.modifyResource(updates);
|
await this.modifyResource(updates);
|
||||||
|
|
@ -606,9 +608,9 @@ export default class DhpActor extends Actor {
|
||||||
|
|
||||||
updates.forEach(
|
updates.forEach(
|
||||||
u =>
|
u =>
|
||||||
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
|
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
|
||||||
? u.value * -1
|
? u.value * -1
|
||||||
: u.value)
|
: u.value)
|
||||||
);
|
);
|
||||||
|
|
||||||
await this.modifyResource(updates);
|
await this.modifyResource(updates);
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,8 @@
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.levelup-trait-increases {
|
.levelup-trait-increases,
|
||||||
|
.levelup-experience-increases {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -495,7 +495,6 @@
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
padding: 6px 6px 6px 10px;
|
|
||||||
border-radius: 3px 0px 0px 3px;
|
border-radius: 3px 0px 0px 3px;
|
||||||
color: light-dark(@dark-blue, @dark-blue);
|
color: light-dark(@dark-blue, @dark-blue);
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|
@ -506,7 +505,7 @@
|
||||||
color: light-dark(@dark-blue, @golden);
|
color: light-dark(@dark-blue, @golden);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:last-child {
|
&:not(:first-child) {
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
background: light-dark(@dark-blue-10, @golden-secondary);
|
background: light-dark(@dark-blue-10, @golden-secondary);
|
||||||
border-radius: 0px 3px 3px 0px;
|
border-radius: 0px 3px 3px 0px;
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,19 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
|
|
||||||
&.no-controls {
|
span {
|
||||||
grid-template-columns: 3fr 1fr;
|
display: flex;
|
||||||
}
|
justify-content: center;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
i {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13",
|
"minimum": "13",
|
||||||
"verified": "13.346",
|
"verified": "13.347",
|
||||||
"maximum": "13"
|
"maximum": "13"
|
||||||
},
|
},
|
||||||
"authors": [
|
"authors": [
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
{{formGroup settingFields.schema.fields.hordeDamage value=settingFields._source.hordeDamage localize=true}}
|
{{formGroup settingFields.schema.fields.hordeDamage value=settingFields._source.hordeDamage localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.effects.fields.rangeDependent value=settingFields._source.effects.rangeDependent localize=true}}
|
{{formGroup settingFields.schema.fields.effects.fields.rangeDependent value=settingFields._source.effects.rangeDependent localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.levelupAuto value=settingFields._source.levelupAuto localize=true}}
|
{{formGroup settingFields.schema.fields.levelupAuto value=settingFields._source.levelupAuto localize=true}}
|
||||||
|
{{formGroup settingFields.schema.fields.playerCanEditSheet value=settingFields._source.playerCanEditSheet localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.damageReductionRulesDefault value=settingFields._source.damageReductionRulesDefault localize=true}}
|
{{formGroup settingFields.schema.fields.damageReductionRulesDefault value=settingFields._source.damageReductionRulesDefault localize=true}}
|
||||||
{{formGroup settingFields.schema.fields.resourceScrollTexts value=settingFields._source.resourceScrollTexts localize=true}}
|
{{formGroup settingFields.schema.fields.resourceScrollTexts value=settingFields._source.resourceScrollTexts localize=true}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,15 @@
|
||||||
<ul class="experience-list">
|
<ul class="experience-list">
|
||||||
{{#each document._source.system.experiences as |experience key|}}
|
{{#each document._source.system.experiences as |experience key|}}
|
||||||
<li class="experience-item">
|
<li class="experience-item">
|
||||||
<div class="experience-inner-item {{#if @root.levelupAuto}}no-controls{{/if}}">
|
<div class="experience-inner-item">
|
||||||
<input class="name" type="text" name="system.experiences.{{key}}.name" value="{{experience.name}}" />
|
<input class="name" type="text" name="system.experiences.{{key}}.name" value="{{experience.name}}" />
|
||||||
<input class="modifier" type="text" name="system.experiences.{{key}}.value" value="{{experience.value}}" data-dtype="Number" />
|
<input class="modifier" type="text" name="system.experiences.{{key}}.value" value="{{experience.value}}" data-dtype="Number" />
|
||||||
{{#unless @root.levelupAuto}}<a data-action="removeExperience" data-experience="{{key}}" data-tooltip="{{localize 'CONTROLS.CommonDelete'}}"><i class="fa-solid fa-trash"></i></a>{{/unless}}
|
|
||||||
|
<span data-tooltip="{{#if experience.core}}{{localize 'DAGGERHEART.ACTORS.Character.cannotRemoveCoreExperience'}}{{else}}{{localize 'CONTROLS.CommonDelete'}}{{/if}}">
|
||||||
|
<a data-action="removeExperience" data-experience="{{key}}" class="{{#if experience.core}}disabled{{/if}}">
|
||||||
|
<i class="fa-solid fa-trash"></i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<textarea name="system.experiences.{{key}}.description">{{experience.description}}</textarea>
|
<textarea name="system.experiences.{{key}}.description">{{experience.description}}</textarea>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
4<header class="character-header-sheet">
|
<header class="character-header-sheet">
|
||||||
<line-div></line-div>
|
<line-div></line-div>
|
||||||
<div class="name-row">
|
<div class="name-row">
|
||||||
<h1 class='actor-name'>
|
<h1 class='actor-name'>
|
||||||
|
|
@ -126,7 +126,9 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}}
|
{{#> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' showSettings=showSettings }}
|
||||||
<button type="button" data-action="openSettings" data-tooltip-text="{{localize "DAGGERHEART.UI.Tooltip.openSheetSettings"}}"><i class="fa-solid fa-wrench"></i></button>
|
{{#if ../showSettings}}
|
||||||
|
<button type="button" data-action="openSettings" data-tooltip-text="{{localize "DAGGERHEART.UI.Tooltip.openSheetSettings"}}"><i class="fa-solid fa-wrench"></i></button>
|
||||||
|
{{/if}}
|
||||||
{{/'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}}
|
{{/'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}}
|
||||||
</header>
|
</header>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue