166 - Damage Reduction (#180)

* Temp

* Fixed Stress Reductions

* Changed from index based to object
This commit is contained in:
WBHarry 2025-06-24 23:36:02 +02:00 committed by GitHub
parent e1dd59454c
commit 5dafdaafcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 1688 additions and 1013 deletions

View file

@ -66,7 +66,10 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
getAction(actor, itemId, actionId) {
const item = actor.items.get(itemId),
action = actor.system.attack?._id === actionId ? actor.system.attack : item?.system?.actions?.find(a => a._id === actionId);
action =
actor.system.attack?._id === actionId
? actor.system.attack
: item?.system?.actions?.find(a => a._id === actionId);
return action;
}
@ -74,9 +77,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
event.stopPropagation();
const actor = this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true;
if(message.system.source.item && message.system.source.action) {
if (message.system.source.item && message.system.source.action) {
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
if(!action || !action?.rollDamage) return;
if (!action || !action?.rollDamage) return;
await action.rollDamage(event, message);
}
};
@ -85,9 +88,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
event.stopPropagation();
const actor = this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true;
if(message.system.source.item && message.system.source.action) {
if (message.system.source.item && message.system.source.action) {
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
if(!action || !action?.rollHealing) return;
if (!action || !action?.rollHealing) return;
await action.rollHealing(event, message);
}
};
@ -96,12 +99,12 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
event.stopPropagation();
const actor = this.getActor(message.system.source.actor);
if (!actor || !game.user.isGM) return true;
if(message.system.source.item && message.system.source.action) {
if (message.system.source.item && message.system.source.action) {
const action = this.getAction(actor, message.system.source.item, message.system.source.action);
if(!action || !action?.applyEffects) return;
if (!action || !action?.applyEffects) return;
await action.applyEffects(event, message);
}
}
};
hoverTarget = event => {
event.stopPropagation();
@ -148,7 +151,7 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
ui.notifications.info(game.i18n.localize('DAGGERHEART.Notification.Info.NoTargetsSelected'));
for (var target of targets) {
await target.actor.modifyResource([{value: healing, type: event.currentTarget.dataset.type}]);
await target.actor.modifyResource([{ value: healing, type: event.currentTarget.dataset.type }]);
}
};