mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Merge branch 'main' of https://github.com/Foundryborne/daggerheart
This commit is contained in:
commit
8dd01e434a
2 changed files with 22 additions and 5 deletions
|
|
@ -82,7 +82,6 @@ export class ActionsField extends MappingField {
|
|||
*/
|
||||
export class ActionField extends foundry.data.fields.ObjectField {
|
||||
getModel(value) {
|
||||
if (value && !value.type) value.type = 'attack';
|
||||
return game.system.api.models.actions.actionsTypes[value.type] ?? null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,14 @@ export default class DhpActor extends Actor {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @inheritDoc */
|
||||
static migrateData(source) {
|
||||
if(source.system?.attack && !source.system.attack.type) source.system.attack.type = "attack";
|
||||
return super.migrateData(source);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**@inheritdoc */
|
||||
static getDefaultArtwork(actorData) {
|
||||
const { type } = actorData;
|
||||
|
|
@ -563,10 +571,20 @@ export default class DhpActor extends Actor {
|
|||
if (armorSlotResult) {
|
||||
const { modifiedDamage, armorSpent, stressSpent } = armorSlotResult;
|
||||
updates.find(u => u.key === 'hitPoints').value = modifiedDamage;
|
||||
updates.push(
|
||||
...(armorSpent ? [{ value: armorSpent, key: 'armor' }] : []),
|
||||
...(stressSpent ? [{ value: stressSpent, key: 'stress' }] : [])
|
||||
);
|
||||
if(armorSpent) {
|
||||
const armorUpdate = updates.find(u => u.key === 'armor');
|
||||
if(armorUpdate)
|
||||
armorUpdate.value += armorSpent;
|
||||
else
|
||||
updates.push({ value: armorSpent, key: 'armor' });
|
||||
}
|
||||
if(stressSpent) {
|
||||
const stressUpdate = updates.find(u => u.key === 'stress');
|
||||
if(stressUpdate)
|
||||
stressUpdate.value += stressSpent;
|
||||
else
|
||||
updates.push({ value: stressSpent, key: 'stress' });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue