mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
Merge branch 'main' into release
This commit is contained in:
commit
4d062a6892
11 changed files with 98 additions and 29 deletions
|
|
@ -1801,7 +1801,9 @@
|
||||||
"label": "Long Rest: Bonus Long Rest Moves",
|
"label": "Long Rest: Bonus Long Rest Moves",
|
||||||
"hint": "The number of extra Long Rest Moves the character can take during a Long Rest."
|
"hint": "The number of extra Long Rest Moves the character can take during a Long Rest."
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"target": "Target",
|
||||||
|
"targetSelf": "Self"
|
||||||
},
|
},
|
||||||
"maxLoadout": {
|
"maxLoadout": {
|
||||||
"label": "Max Loadout Cards Bonus"
|
"label": "Max Loadout Cards Bonus"
|
||||||
|
|
|
||||||
|
|
@ -181,12 +181,17 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
.filter(x => category.moves[x].selected)
|
.filter(x => category.moves[x].selected)
|
||||||
.flatMap(key => {
|
.flatMap(key => {
|
||||||
const move = category.moves[key];
|
const move = category.moves[key];
|
||||||
|
const needsTarget = move.actions.filter(x => x.target?.type && x.target.type !== 'self').length > 0;
|
||||||
return [...Array(move.selected).keys()].map(_ => ({
|
return [...Array(move.selected).keys()].map(_ => ({
|
||||||
...move,
|
...move,
|
||||||
movePath: `${categoryKey}.moves.${key}`
|
movePath: `${categoryKey}.moves.${key}`,
|
||||||
|
needsTarget: needsTarget
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const characters = game.actors.filter(x => x.type === 'character')
|
||||||
|
.filter(x => x.testUserPermission(game.user, 'LIMITED'))
|
||||||
|
.filter(x => x.uuid !== this.actor.uuid);
|
||||||
|
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
const msg = {
|
const msg = {
|
||||||
|
|
@ -206,7 +211,9 @@ export default class DhpDowntime extends HandlebarsApplicationMixin(ApplicationV
|
||||||
`DAGGERHEART.APPLICATIONS.Downtime.${this.shortrest ? 'shortRest' : 'longRest'}.title`
|
`DAGGERHEART.APPLICATIONS.Downtime.${this.shortrest ? 'shortRest' : 'longRest'}.title`
|
||||||
),
|
),
|
||||||
actor: { name: this.actor.name, img: this.actor.img },
|
actor: { name: this.actor.name, img: this.actor.img },
|
||||||
moves: moves
|
moves: moves,
|
||||||
|
characters: characters,
|
||||||
|
selfId: this.actor.uuid
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
flags: {
|
flags: {
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
|
|
||||||
async actionUseButton(event, message) {
|
async actionUseButton(event, message) {
|
||||||
const { moveIndex, actionIndex, movePath } = event.currentTarget.dataset;
|
const { moveIndex, actionIndex, movePath } = event.currentTarget.dataset;
|
||||||
const parent = await foundry.utils.fromUuid(message.system.actor);
|
const targetUuid = event.currentTarget.closest('.action-use-button-parent').querySelector('select')?.value;
|
||||||
|
const parent = await foundry.utils.fromUuid(targetUuid || message.system.actor)
|
||||||
|
|
||||||
const actionType = message.system.moves[moveIndex].actions[actionIndex];
|
const actionType = message.system.moves[moveIndex].actions[actionIndex];
|
||||||
const cls = game.system.api.models.actions.actionsTypes[actionType.type];
|
const cls = game.system.api.models.actions.actionsTypes[actionType.type];
|
||||||
const action = new cls(
|
const action = new cls(
|
||||||
|
|
@ -146,7 +148,8 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
type: CONFIG.DH.ITEM.originItemType.restMove,
|
type: CONFIG.DH.ITEM.originItemType.restMove,
|
||||||
itemPath: movePath,
|
itemPath: movePath,
|
||||||
actionIndex: actionIndex
|
actionIndex: actionIndex
|
||||||
}
|
},
|
||||||
|
targetUuid: targetUuid
|
||||||
},
|
},
|
||||||
{ parent: parent.system }
|
{ parent: parent.system }
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ export const defaultRestOptions = {
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
chatDisplay: false,
|
chatDisplay: false,
|
||||||
target: {
|
target: {
|
||||||
type: 'self'
|
type: 'friendly'
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
|
|
@ -298,7 +298,7 @@ export const defaultRestOptions = {
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
chatDisplay: false,
|
chatDisplay: false,
|
||||||
target: {
|
target: {
|
||||||
type: 'self'
|
type: 'friendly'
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
|
|
@ -341,7 +341,7 @@ export const defaultRestOptions = {
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
chatDisplay: false,
|
chatDisplay: false,
|
||||||
target: {
|
target: {
|
||||||
type: 'self'
|
type: 'friendly'
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
|
|
@ -407,7 +407,7 @@ export const defaultRestOptions = {
|
||||||
actionType: 'action',
|
actionType: 'action',
|
||||||
chatDisplay: false,
|
chatDisplay: false,
|
||||||
target: {
|
target: {
|
||||||
type: 'self'
|
type: 'friendly'
|
||||||
},
|
},
|
||||||
damage: {
|
damage: {
|
||||||
parts: [
|
parts: [
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
initial: 'action',
|
initial: 'action',
|
||||||
nullable: false,
|
nullable: false,
|
||||||
required: true
|
required: true
|
||||||
})
|
}),
|
||||||
|
targetUuid: new fields.StringField({ initial: undefined })
|
||||||
};
|
};
|
||||||
|
|
||||||
this.extraSchemas.forEach(s => {
|
this.extraSchemas.forEach(s => {
|
||||||
|
|
@ -241,7 +242,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
selectedRollMode: game.settings.get('core', 'rollMode'),
|
selectedRollMode: game.settings.get('core', 'rollMode'),
|
||||||
data: this.getRollData(),
|
data: this.getRollData(),
|
||||||
evaluate: this.hasRoll,
|
evaluate: this.hasRoll,
|
||||||
resourceUpdates: new ResourceUpdateMap(this.actor)
|
resourceUpdates: new ResourceUpdateMap(this.actor),
|
||||||
|
targetUuid: this.targetUuid
|
||||||
};
|
};
|
||||||
|
|
||||||
DHBaseAction.applyKeybindings(config);
|
DHBaseAction.applyKeybindings(config);
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,20 @@ export default class BeastformEffect extends BaseEffect {
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateToken = token => {
|
const updateToken = token => {
|
||||||
const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
|
let x = null,
|
||||||
token.object.scene.grid,
|
y = null;
|
||||||
{ x: token.x, y: token.y, elevation: token.elevation },
|
if (token.object?.scene?.grid) {
|
||||||
baseUpdate.width,
|
const positionData = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
|
||||||
baseUpdate.height
|
token.object.scene.grid,
|
||||||
);
|
{ x: token.x, y: token.y, elevation: token.elevation },
|
||||||
|
baseUpdate.width,
|
||||||
|
baseUpdate.height
|
||||||
|
);
|
||||||
|
|
||||||
|
x = positionData.x;
|
||||||
|
y = positionData.y;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...baseUpdate,
|
...baseUpdate,
|
||||||
x,
|
x,
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,12 @@ export default class TargetField extends fields.SchemaField {
|
||||||
config.hasTarget = true;
|
config.hasTarget = true;
|
||||||
let targets;
|
let targets;
|
||||||
// If the Action is configured as self-targeted, set targets as the owner. Probably better way than to fallback to getDependentTokens
|
// If the Action is configured as self-targeted, set targets as the owner. Probably better way than to fallback to getDependentTokens
|
||||||
if (this.target?.type === CONFIG.DH.GENERAL.targetTypes.self.id)
|
if (this.target?.type === CONFIG.DH.GENERAL.targetTypes.self.id) {
|
||||||
targets = [this.actor.token ?? this.actor.prototypeToken];
|
targets = [this.actor.token ?? this.actor.prototypeToken];
|
||||||
else {
|
} else if (config.targetUuid) {
|
||||||
|
const actor = fromUuidSync(config.targetUuid);
|
||||||
|
targets = [actor.token ?? actor.prototypeToken];
|
||||||
|
} else {
|
||||||
targets = Array.from(game.user.targets);
|
targets = Array.from(game.user.targets);
|
||||||
if (this.target.type !== CONFIG.DH.GENERAL.targetTypes.any.id) {
|
if (this.target.type !== CONFIG.DH.GENERAL.targetTypes.any.id) {
|
||||||
targets = targets.filter(target => TargetField.isTargetFriendly(this.actor, target, this.target.type));
|
targets = targets.filter(target => TargetField.isTargetFriendly(this.actor, target, this.target.type));
|
||||||
|
|
|
||||||
|
|
@ -218,12 +218,20 @@ export default class DHBeastform extends BaseDataItem {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const tokenUpdate = token => {
|
const tokenUpdate = token => {
|
||||||
const { x, y } = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
|
let x = null,
|
||||||
token.object.scene.grid,
|
y = null;
|
||||||
{ x: token.x, y: token.y, elevation: token.elevation },
|
if (token.object?.scene?.grid) {
|
||||||
width ?? token.width,
|
const positionData = game.system.api.documents.DhToken.getSnappedPositionInSquareGrid(
|
||||||
height ?? token.height
|
token.object.scene.grid,
|
||||||
);
|
{ x: token.x, y: token.y, elevation: token.elevation },
|
||||||
|
width ?? token.width,
|
||||||
|
height ?? token.height
|
||||||
|
);
|
||||||
|
|
||||||
|
x = positionData.x;
|
||||||
|
y = positionData.y;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...prototypeTokenUpdate,
|
...prototypeTokenUpdate,
|
||||||
x,
|
x,
|
||||||
|
|
|
||||||
|
|
@ -99,12 +99,35 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action-use-button-parent {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.action-use-target {
|
||||||
|
display:flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 4px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 4px 8px 10px 40px;
|
||||||
|
font-size: var(--font-size-12);
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.action-use-button {
|
.action-use-button {
|
||||||
width: -webkit-fill-available;
|
width: -webkit-fill-available;
|
||||||
margin: 0 8px;
|
margin: 0 8px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "daggerheart",
|
"id": "daggerheart",
|
||||||
"title": "Daggerheart",
|
"title": "Daggerheart",
|
||||||
"description": "An unofficial implementation of the Daggerheart system",
|
"description": "An unofficial implementation of the Daggerheart system",
|
||||||
"version": "1.4.3",
|
"version": "1.4.4",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "13.346",
|
"minimum": "13.346",
|
||||||
"verified": "13.351",
|
"verified": "13.351",
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,22 @@
|
||||||
</div>
|
</div>
|
||||||
</details>
|
</details>
|
||||||
{{#each move.actions as | action index |}}
|
{{#each move.actions as | action index |}}
|
||||||
<button class="action-use-button" data-move-index="{{@../key}}" data-action-index="{{index}}" data-move-path="{{../movePath}}" >
|
<div class="action-use-button-parent">
|
||||||
<span>{{localize action.name}}</span>
|
<button class="action-use-button" data-move-index="{{@../key}}" data-action-index="{{index}}" data-move-path="{{../movePath}}" >
|
||||||
</button>
|
<span>{{localize action.name}}</span>
|
||||||
|
</button>
|
||||||
|
{{#if move.needsTarget}}
|
||||||
|
<div class="action-use-target">
|
||||||
|
<label>{{localize "DAGGERHEART.GENERAL.Bonuses.rest.target"}}:</label>
|
||||||
|
<select>
|
||||||
|
<option value="{{../../selfId}}">{{localize "DAGGERHEART.GENERAL.Bonuses.rest.targetSelf"}}</option>
|
||||||
|
{{#each ../../characters as | character |}}
|
||||||
|
<option value="{{character.uuid}}">{{character.name}}</option>
|
||||||
|
{{/each}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue