mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-23 16:03:39 +02:00
.
This commit is contained in:
parent
c6bf482b07
commit
8b7a455410
11 changed files with 162 additions and 61 deletions
|
|
@ -102,7 +102,19 @@ Hooks.once('init', () => {
|
||||||
initial: 0,
|
initial: 0,
|
||||||
max: 4,
|
max: 4,
|
||||||
reverse: false,
|
reverse: false,
|
||||||
label: 'Corruption'
|
label: 'Corruption',
|
||||||
|
images: {
|
||||||
|
full: {
|
||||||
|
value: 'icons/magic/fire/barrier-wall-explosion-orange.webp',
|
||||||
|
isPath: true,
|
||||||
|
isNotTransparent: true
|
||||||
|
},
|
||||||
|
empty: {
|
||||||
|
value: 'icons/magic/fire/barrier-wall-flame-ring-blue.webp',
|
||||||
|
isPath: true,
|
||||||
|
isNotTransparent: true
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CONFIG.DH.ACTOR.characterResources.hunger = {
|
CONFIG.DH.ACTOR.characterResources.hunger = {
|
||||||
|
|
@ -110,7 +122,15 @@ Hooks.once('init', () => {
|
||||||
initial: 0,
|
initial: 0,
|
||||||
max: 6,
|
max: 6,
|
||||||
reverse: false,
|
reverse: false,
|
||||||
label: 'Hunger'
|
label: 'Hunger',
|
||||||
|
images: {
|
||||||
|
full: {
|
||||||
|
value: 'fa-solid fa-burger'
|
||||||
|
},
|
||||||
|
empty: {
|
||||||
|
value: 'fa-regular fa-burger'
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
CONFIG.DH.ACTOR.characterResources.glitched = {
|
CONFIG.DH.ACTOR.characterResources.glitched = {
|
||||||
|
|
@ -118,7 +138,15 @@ Hooks.once('init', () => {
|
||||||
initial: 0,
|
initial: 0,
|
||||||
max: 6,
|
max: 6,
|
||||||
reverse: false,
|
reverse: false,
|
||||||
label: 'Glitched'
|
label: 'Glitched',
|
||||||
|
images: {
|
||||||
|
full: {
|
||||||
|
value: 'fa-solid fa-robot'
|
||||||
|
},
|
||||||
|
empty: {
|
||||||
|
value: 'fa-regular fa-robot'
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
game.system.registeredTriggers = new game.system.api.data.RegisteredTriggers();
|
game.system.registeredTriggers = new game.system.api.data.RegisteredTriggers();
|
||||||
|
|
|
||||||
|
|
@ -958,7 +958,9 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
id: resource.id,
|
id: resource.id,
|
||||||
label: game.i18n.localize(resource.label),
|
label: game.i18n.localize(resource.label),
|
||||||
value: resourceData.value,
|
value: resourceData.value,
|
||||||
max: resourceData.max
|
max: resourceData.max,
|
||||||
|
fullIcon: resource.images?.full ?? { value: 'fa-solid fa-circle' },
|
||||||
|
emptyIcon: resource.images?.empty ?? { value: 'fa-regular fa-circle' }
|
||||||
};
|
};
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|
@ -999,11 +1001,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
const section = target.closest('.resource-section');
|
const section = target.closest('.resource-section');
|
||||||
for (const element of section.querySelectorAll('.resource-value')) {
|
for (const element of section.querySelectorAll('.resource-value')) {
|
||||||
if (Number.parseInt(element.dataset.value) <= value) {
|
if (Number.parseInt(element.dataset.value) <= value) {
|
||||||
element.querySelector('.fa-diamond').classList.remove('hidden');
|
element.querySelector('.full').classList.remove('hidden');
|
||||||
element.querySelector('.fa-circle').classList.add('hidden');
|
element.querySelector('.empty').classList.add('hidden');
|
||||||
} else {
|
} else {
|
||||||
element.querySelector('.fa-diamond').classList.add('hidden');
|
element.querySelector('.full').classList.add('hidden');
|
||||||
element.querySelector('.fa-circle').classList.remove('hidden');
|
element.querySelector('.empty').classList.remove('hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,20 @@ export const abilities = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const baseResources = {
|
/**
|
||||||
|
* Full custom typing:
|
||||||
|
* id
|
||||||
|
* initial
|
||||||
|
* max
|
||||||
|
* reverse
|
||||||
|
* label
|
||||||
|
* images {
|
||||||
|
* full { value, isPath, isNotTransparent }
|
||||||
|
* empty { value, isPath isNotTransparent }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const characterBaseResources = {
|
||||||
hitPoints: {
|
hitPoints: {
|
||||||
id: 'hitPoints',
|
id: 'hitPoints',
|
||||||
initial: 0,
|
initial: 0,
|
||||||
|
|
@ -80,20 +93,63 @@ const baseResources = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const characterBaseResources = {
|
|
||||||
...baseResources
|
|
||||||
};
|
|
||||||
|
|
||||||
export const characterResources = {
|
export const characterResources = {
|
||||||
...characterBaseResources
|
...characterBaseResources
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const adversaryBaseResources = {
|
||||||
|
hitPoints: {
|
||||||
|
id: 'hitPoints',
|
||||||
|
initial: 0,
|
||||||
|
max: 0,
|
||||||
|
reverse: true,
|
||||||
|
label: 'DAGGERHEART.GENERAL.HitPoints.plural',
|
||||||
|
maxLabel: 'DAGGERHEART.ACTORS.Character.maxHPBonus'
|
||||||
|
},
|
||||||
|
stress: {
|
||||||
|
id: 'stress',
|
||||||
|
initial: 0,
|
||||||
|
max: 0,
|
||||||
|
reverse: true,
|
||||||
|
label: 'DAGGERHEART.GENERAL.stress'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const adversaryResources = {
|
||||||
|
...adversaryBaseResources
|
||||||
|
};
|
||||||
|
|
||||||
|
export const companionBaseResources = {
|
||||||
|
stress: {
|
||||||
|
id: 'stress',
|
||||||
|
initial: 0,
|
||||||
|
max: 0,
|
||||||
|
reverse: true,
|
||||||
|
label: 'DAGGERHEART.GENERAL.stress'
|
||||||
|
},
|
||||||
|
hope: {
|
||||||
|
id: 'hope',
|
||||||
|
initial: 0,
|
||||||
|
min: 0,
|
||||||
|
reverse: false,
|
||||||
|
label: 'DAGGERHEART.GENERAL.hope'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const companionResources = {
|
||||||
|
...companionBaseResources
|
||||||
|
};
|
||||||
|
|
||||||
export const getScrollingTextResources = actorType => ({
|
export const getScrollingTextResources = actorType => ({
|
||||||
armor: {
|
armor: {
|
||||||
label: 'DAGGERHEART.GENERAL.armor',
|
label: 'DAGGERHEART.GENERAL.armor',
|
||||||
reverse: true
|
reverse: true
|
||||||
},
|
},
|
||||||
...(actorType === 'character' ? characterResources : {})
|
...(actorType === 'character'
|
||||||
|
? characterResources
|
||||||
|
: actorType === 'adversary'
|
||||||
|
? adversaryResources
|
||||||
|
: companionResources)
|
||||||
});
|
});
|
||||||
|
|
||||||
export const featureProperties = {
|
export const featureProperties = {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import DHAdversarySettings from '../../applications/sheets-configs/adversary-set
|
||||||
import { ActionField } from '../fields/actionField.mjs';
|
import { ActionField } from '../fields/actionField.mjs';
|
||||||
import { commonActorRules } from './base.mjs';
|
import { commonActorRules } from './base.mjs';
|
||||||
import DhCreature from './creature.mjs';
|
import DhCreature from './creature.mjs';
|
||||||
import { resourceField, bonusField } from '../fields/actorField.mjs';
|
import { bonusField } from '../fields/actorField.mjs';
|
||||||
import { calculateExpectedValue, parseTermsFromSimpleFormula } from '../../helpers/utils.mjs';
|
import { calculateExpectedValue, parseTermsFromSimpleFormula } from '../../helpers/utils.mjs';
|
||||||
import { adversaryExpectedDamage, adversaryScalingData } from '../../config/actorConfig.mjs';
|
import { adversaryExpectedDamage, adversaryScalingData } from '../../config/actorConfig.mjs';
|
||||||
|
|
||||||
|
|
@ -65,10 +65,6 @@ export default class DhpAdversary extends DhCreature {
|
||||||
label: 'DAGGERHEART.GENERAL.DamageThresholds.severeThreshold'
|
label: 'DAGGERHEART.GENERAL.DamageThresholds.severeThreshold'
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
resources: new fields.SchemaField({
|
|
||||||
hitPoints: resourceField(0, 0, 'DAGGERHEART.GENERAL.HitPoints.plural', true),
|
|
||||||
stress: resourceField(0, 0, 'DAGGERHEART.GENERAL.stress', true)
|
|
||||||
}),
|
|
||||||
rules: new fields.SchemaField({
|
rules: new fields.SchemaField({
|
||||||
...commonActorRules()
|
...commonActorRules()
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||||
import DhLevelData from '../levelData.mjs';
|
import DhLevelData from '../levelData.mjs';
|
||||||
import { commonActorRules } from './base.mjs';
|
import { commonActorRules } from './base.mjs';
|
||||||
import DhCreature from './creature.mjs';
|
import DhCreature from './creature.mjs';
|
||||||
import { attributeField, resourceField, stressDamageReductionRule, bonusField } from '../fields/actorField.mjs';
|
import { attributeField, stressDamageReductionRule, bonusField } from '../fields/actorField.mjs';
|
||||||
import { ActionField } from '../fields/actionField.mjs';
|
import { ActionField } from '../fields/actionField.mjs';
|
||||||
import DHCharacterSettings from '../../applications/sheets-configs/character-settings.mjs';
|
import DHCharacterSettings from '../../applications/sheets-configs/character-settings.mjs';
|
||||||
|
|
||||||
|
|
@ -27,34 +27,6 @@ export default class DhCharacter extends DhCreature {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
resources: new fields.SchemaField({
|
|
||||||
...Object.values(CONFIG.DH.ACTOR.characterResources).reduce((acc, resource) => {
|
|
||||||
if (resource.max !== undefined) {
|
|
||||||
acc[resource.id] = resourceField(
|
|
||||||
resource.max,
|
|
||||||
resource.initial,
|
|
||||||
resource.label,
|
|
||||||
resource.reverse,
|
|
||||||
resource.maxLabel
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
acc[resource.id] = new fields.SchemaField(
|
|
||||||
{
|
|
||||||
value: new fields.NumberField({
|
|
||||||
initial: resource.initial,
|
|
||||||
min: resource.min,
|
|
||||||
integer: true,
|
|
||||||
label: resource.label
|
|
||||||
}),
|
|
||||||
isReversed: new fields.BooleanField({ initial: resource.reverse })
|
|
||||||
},
|
|
||||||
{ label: resource.label }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return acc;
|
|
||||||
}, {})
|
|
||||||
}),
|
|
||||||
traits: new fields.SchemaField({
|
traits: new fields.SchemaField({
|
||||||
agility: attributeField('DAGGERHEART.CONFIG.Traits.agility.name'),
|
agility: attributeField('DAGGERHEART.CONFIG.Traits.agility.name'),
|
||||||
strength: attributeField('DAGGERHEART.CONFIG.Traits.strength.name'),
|
strength: attributeField('DAGGERHEART.CONFIG.Traits.strength.name'),
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||||
import { ActionField } from '../fields/actionField.mjs';
|
import { ActionField } from '../fields/actionField.mjs';
|
||||||
import { adjustDice, adjustRange } from '../../helpers/utils.mjs';
|
import { adjustDice, adjustRange } from '../../helpers/utils.mjs';
|
||||||
import DHCompanionSettings from '../../applications/sheets-configs/companion-settings.mjs';
|
import DHCompanionSettings from '../../applications/sheets-configs/companion-settings.mjs';
|
||||||
import { resourceField, bonusField } from '../fields/actorField.mjs';
|
import { bonusField } from '../fields/actorField.mjs';
|
||||||
|
|
||||||
export default class DhCompanion extends DhCreature {
|
export default class DhCompanion extends DhCreature {
|
||||||
static LOCALIZATION_PREFIXES = ['DAGGERHEART.ACTORS.Companion'];
|
static LOCALIZATION_PREFIXES = ['DAGGERHEART.ACTORS.Companion'];
|
||||||
|
|
@ -26,10 +26,6 @@ export default class DhCompanion extends DhCreature {
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
partner: new ForeignDocumentUUIDField({ type: 'Actor' }),
|
partner: new ForeignDocumentUUIDField({ type: 'Actor' }),
|
||||||
resources: new fields.SchemaField({
|
|
||||||
stress: resourceField(3, 0, 'DAGGERHEART.GENERAL.stress', true),
|
|
||||||
hope: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.hope' })
|
|
||||||
}),
|
|
||||||
evasion: new fields.NumberField({
|
evasion: new fields.NumberField({
|
||||||
required: true,
|
required: true,
|
||||||
min: 1,
|
min: 1,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { resourceField } from '../fields/actorField.mjs';
|
||||||
import BaseDataActor from './base.mjs';
|
import BaseDataActor from './base.mjs';
|
||||||
|
|
||||||
export default class DhCreature extends BaseDataActor {
|
export default class DhCreature extends BaseDataActor {
|
||||||
|
|
@ -7,6 +8,34 @@ export default class DhCreature extends BaseDataActor {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...super.defineSchema(),
|
...super.defineSchema(),
|
||||||
|
resources: new fields.SchemaField({
|
||||||
|
...Object.values(CONFIG.DH.ACTOR[`${this.metadata.type}Resources`]).reduce((acc, resource) => {
|
||||||
|
if (resource.max !== undefined) {
|
||||||
|
acc[resource.id] = resourceField(
|
||||||
|
resource.max,
|
||||||
|
resource.initial,
|
||||||
|
resource.label,
|
||||||
|
resource.reverse,
|
||||||
|
resource.maxLabel
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
acc[resource.id] = new fields.SchemaField(
|
||||||
|
{
|
||||||
|
value: new fields.NumberField({
|
||||||
|
initial: resource.initial,
|
||||||
|
min: resource.min,
|
||||||
|
integer: true,
|
||||||
|
label: resource.label
|
||||||
|
}),
|
||||||
|
isReversed: new fields.BooleanField({ initial: resource.reverse })
|
||||||
|
},
|
||||||
|
{ label: resource.label }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
}),
|
||||||
advantageSources: new fields.ArrayField(new fields.StringField(), {
|
advantageSources: new fields.ArrayField(new fields.StringField(), {
|
||||||
label: 'DAGGERHEART.ACTORS.Character.advantageSources.label',
|
label: 'DAGGERHEART.ACTORS.Character.advantageSources.label',
|
||||||
hint: 'DAGGERHEART.ACTORS.Character.advantageSources.hint'
|
hint: 'DAGGERHEART.ACTORS.Character.advantageSources.hint'
|
||||||
|
|
|
||||||
|
|
@ -138,10 +138,6 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
|
|
||||||
.resource-manager {
|
|
||||||
color: light-dark(@dark-blue, @golden);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.downtime-section {
|
.downtime-section {
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,24 @@
|
||||||
.hidden {
|
.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.filter {
|
||||||
|
filter: @golden-filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.non-transparent {
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid @golden;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
</span>
|
</span>
|
||||||
{{/times}}
|
{{/times}}
|
||||||
</div>
|
</div>
|
||||||
<a class="resource-manager" data-action="toggleResourceManagement"><i class="fa-solid fa-gear"></i></a>
|
<button type="button" class="resource-manager" data-action="toggleResourceManagement"><i class="fa-solid fa-bars"></i></button>
|
||||||
</div>
|
</div>
|
||||||
{{#if document.system.class.value}}
|
{{#if document.system.class.value}}
|
||||||
<div class="domains-section">
|
<div class="domains-section">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
<div class="daggerheart resource-management-container">
|
<div class="daggerheart resource-management-container">
|
||||||
{{#each resources as |resource|}}
|
{{#each resources as |resource|}}
|
||||||
<div class="resource-section">
|
<div class="resource-section {{resource.resourceClass}}">
|
||||||
<h4>{{resource.label}}</h4>
|
<h4>{{resource.label}}</h4>
|
||||||
{{#times resource.max}}
|
{{#times resource.max}}
|
||||||
<span class='resource-value' data-action='toggleResource' data-value="{{add this 1}}" data-resource="{{resource.id}}">
|
<span class='resource-value' data-action='toggleResource' data-value="{{add this 1}}" data-resource="{{resource.id}}">
|
||||||
<i class='fa-solid fa-diamond {{#unless (gte ../value (add this 1))}}hidden{{/unless}}'></i>
|
{{#unless resource.fullIcon.isPath}}
|
||||||
<i class='fa-regular fa-circle {{#if (gte ../value (add this 1))}}hidden{{/if}}'></i>
|
<i class='{{resource.fullIcon.value}} full {{#unless (gte ../value (add this 1))}}hidden{{/unless}}'></i>
|
||||||
|
{{else}}
|
||||||
|
<img src="{{resource.fullIcon.value}}" class="full {{#unless resource.fullIcon.isNotTransparent}}filter{{else}}non-transparent{{/unless}} {{#unless (gte ../value (add this 1))}}hidden{{/unless}}" />
|
||||||
|
{{/unless}}
|
||||||
|
{{#unless resource.emptyIcon.isPath}}
|
||||||
|
<i class='{{resource.emptyIcon.value}} empty {{#if (gte ../value (add this 1))}}hidden{{/if}}'></i>
|
||||||
|
{{else}}
|
||||||
|
<img src="{{resource.emptyIcon.value}}" class="empty {{#unless resource.fullIcon.isNotTransparent}}filter{{else}}non-transparent{{/unless}} {{#if (gte ../value (add this 1))}}hidden{{/if}}" />
|
||||||
|
{{/unless}}
|
||||||
</span>
|
</span>
|
||||||
{{/times}}
|
{{/times}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue