mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03: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": {
|
||||
"title": "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": {
|
||||
"FIELDS": {
|
||||
|
|
@ -2115,6 +2116,10 @@
|
|||
"resourceScrollTexts": {
|
||||
"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."
|
||||
},
|
||||
"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 ?? {},
|
||||
subclass: this.character.system.class?.subclass ?? {},
|
||||
experiences: {
|
||||
[foundry.utils.randomID()]: { name: '', value: 2 },
|
||||
[foundry.utils.randomID()]: { name: '', value: 2 }
|
||||
[foundry.utils.randomID()]: { name: '', value: 2, core: true },
|
||||
[foundry.utils.randomID()]: { name: '', value: 2, core: true }
|
||||
},
|
||||
domainCards: {
|
||||
[foundry.utils.randomID()]: {},
|
||||
|
|
@ -588,12 +588,21 @@ export default class DhCharacterCreation extends HandlebarsApplicationMixin(Appl
|
|||
this.setup.class.system.inventory.take.filter(x => x)
|
||||
);
|
||||
|
||||
await this.character.update({
|
||||
system: {
|
||||
traits: this.setup.traits,
|
||||
experiences: this.setup.experiences
|
||||
}
|
||||
});
|
||||
await this.character.update(
|
||||
{
|
||||
system: {
|
||||
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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
|
|||
const experience = Object.keys(this.actor.system.experiences).find(
|
||||
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 });
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -178,6 +178,13 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
async _preparePartContext(partId, context, options) {
|
||||
context = await super._preparePartContext(partId, context, options);
|
||||
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':
|
||||
await this._prepareLoadoutContext(context, options);
|
||||
break;
|
||||
|
|
@ -188,6 +195,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
await this._prepareBiographyContext(context, options);
|
||||
break;
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,6 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
|||
|
||||
const newValue = (action.uses.value ?? 0) + (increase ? 1 : -1);
|
||||
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({
|
||||
name: new fields.StringField(),
|
||||
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({
|
||||
|
|
@ -573,7 +574,10 @@ export default class DhCharacter extends BaseDataActor {
|
|||
case 'experience':
|
||||
selection.data.forEach(id => {
|
||||
const experience = this.experiences[id];
|
||||
if (experience) experience.value += selection.value;
|
||||
if (experience) {
|
||||
experience.value += selection.value;
|
||||
experience.leveledUp = true;
|
||||
}
|
||||
});
|
||||
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() {
|
||||
if (this.companion) {
|
||||
this.companion.updateLevel(1);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ export default class DhAutomation extends foundry.abstract.DataModel {
|
|||
required: true,
|
||||
initial: true,
|
||||
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({
|
||||
[`system.experiences.${experienceKey}`]: {
|
||||
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({
|
||||
[`system.experiences.${experienceKey}`]: {
|
||||
name: '',
|
||||
value: experience.modifier
|
||||
value: experience.modifier,
|
||||
core: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -559,8 +561,8 @@ export default class DhpActor extends Actor {
|
|||
|
||||
updates.forEach(
|
||||
u =>
|
||||
(u.value =
|
||||
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
|
||||
(u.value =
|
||||
u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false ? u.value * -1 : u.value)
|
||||
);
|
||||
|
||||
await this.modifyResource(updates);
|
||||
|
|
@ -606,9 +608,9 @@ export default class DhpActor extends Actor {
|
|||
|
||||
updates.forEach(
|
||||
u =>
|
||||
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
|
||||
? u.value * -1
|
||||
: u.value)
|
||||
(u.value = !(u.key === 'fear' || this.system?.resources?.[u.key]?.isReversed === false)
|
||||
? u.value * -1
|
||||
: u.value)
|
||||
);
|
||||
|
||||
await this.modifyResource(updates);
|
||||
|
|
|
|||
|
|
@ -143,7 +143,8 @@
|
|||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.levelup-trait-increases {
|
||||
.levelup-trait-increases,
|
||||
.levelup-experience-increases {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -495,7 +495,6 @@
|
|||
border-radius: 6px;
|
||||
|
||||
button {
|
||||
padding: 6px 6px 6px 10px;
|
||||
border-radius: 3px 0px 0px 3px;
|
||||
color: light-dark(@dark-blue, @dark-blue);
|
||||
white-space: nowrap;
|
||||
|
|
@ -506,7 +505,7 @@
|
|||
color: light-dark(@dark-blue, @golden);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
&:not(:first-child) {
|
||||
padding: 6px;
|
||||
background: light-dark(@dark-blue-10, @golden-secondary);
|
||||
border-radius: 0px 3px 3px 0px;
|
||||
|
|
|
|||
|
|
@ -26,12 +26,19 @@
|
|||
align-items: center;
|
||||
gap: 5px;
|
||||
|
||||
&.no-controls {
|
||||
grid-template-columns: 3fr 1fr;
|
||||
}
|
||||
span {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
a {
|
||||
text-align: center;
|
||||
a {
|
||||
text-align: center;
|
||||
|
||||
&.disabled {
|
||||
i {
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
"version": "0.0.1",
|
||||
"compatibility": {
|
||||
"minimum": "13",
|
||||
"verified": "13.346",
|
||||
"verified": "13.347",
|
||||
"maximum": "13"
|
||||
},
|
||||
"authors": [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
{{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.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.resourceScrollTexts value=settingFields._source.resourceScrollTexts localize=true}}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,15 @@
|
|||
<ul class="experience-list">
|
||||
{{#each document._source.system.experiences as |experience key|}}
|
||||
<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="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>
|
||||
<textarea name="system.experiences.{{key}}.description">{{experience.description}}</textarea>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
4<header class="character-header-sheet">
|
||||
<header class="character-header-sheet">
|
||||
<line-div></line-div>
|
||||
<div class="name-row">
|
||||
<h1 class='actor-name'>
|
||||
|
|
@ -126,7 +126,9 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
|
||||
{{#> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs'}}
|
||||
<button type="button" data-action="openSettings" data-tooltip-text="{{localize "DAGGERHEART.UI.Tooltip.openSheetSettings"}}"><i class="fa-solid fa-wrench"></i></button>
|
||||
{{#> 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' showSettings=showSettings }}
|
||||
{{#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'}}
|
||||
</header>
|
||||
Loading…
Add table
Add a link
Reference in a new issue