Added consideration for an active combatant

This commit is contained in:
WBHarry 2026-03-07 19:09:21 +01:00
parent 56ba01043d
commit ae8db11155
2 changed files with 11 additions and 1 deletions

View file

@ -81,7 +81,8 @@
"noTransformActor": "There is no assigned actor to transform into",
"transformActorMissing": "The assigned actor to transform into does not exist. It was probably deleted or moved in/out of a compendium",
"canvasError": "There is no active scene.",
"prototypeError": "You can only use a transform action from a Token"
"prototypeError": "You can only use a transform action from a Token",
"actorLinkError": "You cannot transform a token with Actor Link set to true"
}
},
"Config": {

View file

@ -37,6 +37,11 @@ export default class DHSummonField extends fields.SchemaField {
return false;
}
if (this.actor.prototypeToken.actorLink) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.ACTIONS.TYPES.transform.actorLinkError'));
return false;
}
if (!this.actor.token) {
ui.notifications.warn(game.i18n.localize('DAGGERHEART.ACTIONS.TYPES.transform.prototypeError'));
return false;
@ -51,6 +56,10 @@ export default class DHSummonField extends fields.SchemaField {
{ diff: false, recursive: false, noHook: true }
);
if (this.actor.token.combatant) {
this.actor.token.combatant.update({ actorId: actor.id, img: actor.prototypeToken.texture.src });
}
const marks = { hitPoints: 0, stress: 0 };
if (!this.transform.resourceRefresh.hitPoints) {
marks.hitPoints = Math.min(