mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-24 16:33:38 +02:00
Compare commits
4 commits
56dc9afe8f
...
36ffe8a23a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36ffe8a23a | ||
|
|
96eba49dc1 | ||
|
|
f92f9f7132 | ||
|
|
0747994686 |
7 changed files with 67 additions and 84 deletions
|
|
@ -16,9 +16,11 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
...member.toObject(),
|
...member.toObject(),
|
||||||
uuid: member.uuid,
|
uuid: member.uuid,
|
||||||
id: member.id,
|
id: member.id,
|
||||||
selected: false
|
selected: false,
|
||||||
|
owned: member.testUserPermission(game.user, CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
|
||||||
}));
|
}));
|
||||||
this.intiator = null;
|
|
||||||
|
this.initiator = null;
|
||||||
this.openForAllPlayers = true;
|
this.openForAllPlayers = true;
|
||||||
|
|
||||||
this.tabGroups.application = Object.keys(party.system.tagTeam.members).length
|
this.tabGroups.application = Object.keys(party.system.tagTeam.members).length
|
||||||
|
|
@ -80,6 +82,18 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
|
|
||||||
for (const element of htmlElement.querySelectorAll('.roll-type-select'))
|
for (const element of htmlElement.querySelectorAll('.roll-type-select'))
|
||||||
element.addEventListener('change', this.updateRollType.bind(this));
|
element.addEventListener('change', this.updateRollType.bind(this));
|
||||||
|
|
||||||
|
htmlElement
|
||||||
|
.querySelector('.initiator-member-field')
|
||||||
|
?.addEventListener('input', this.updateInitiatorMemberField.bind(this));
|
||||||
|
|
||||||
|
htmlElement
|
||||||
|
.querySelector('.initiator-cost-field')
|
||||||
|
?.addEventListener('input', this.updateInitiatorCostField.bind(this));
|
||||||
|
|
||||||
|
htmlElement
|
||||||
|
.querySelector('.openforall-field')
|
||||||
|
?.addEventListener('change', this.updateOpenForAllField.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
_configureRenderParts(options) {
|
_configureRenderParts(options) {
|
||||||
|
|
@ -135,9 +149,12 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
const selectedMembers = partContext.memberSelection.filter(x => x.selected);
|
const selectedMembers = partContext.memberSelection.filter(x => x.selected);
|
||||||
|
|
||||||
partContext.allSelected = selectedMembers.length === 2;
|
partContext.allSelected = selectedMembers.length === 2;
|
||||||
partContext.canStartTagTeam = partContext.allSelected && this.initiator;
|
partContext.canStartTagTeam =
|
||||||
|
partContext.allSelected && this.initiator?.memberId && typeof this.initiator?.cost === 'number';
|
||||||
partContext.initiator = this.initiator;
|
partContext.initiator = this.initiator;
|
||||||
partContext.initiatorOptions = selectedMembers.map(x => ({ value: x.id, label: x.name }));
|
partContext.initiatorOptions = selectedMembers
|
||||||
|
.filter(actor => actor.owned)
|
||||||
|
.map(x => ({ value: x.id, label: x.name }));
|
||||||
partContext.initiatorDisabled = !selectedMembers.length;
|
partContext.initiatorDisabled = !selectedMembers.length;
|
||||||
partContext.openForAllPlayers = this.openForAllPlayers;
|
partContext.openForAllPlayers = this.openForAllPlayers;
|
||||||
|
|
||||||
|
|
@ -230,14 +247,15 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
}
|
}
|
||||||
|
|
||||||
static async updateData(event, _, formData) {
|
static async updateData(event, _, formData) {
|
||||||
const { initiator, openForAllPlayers, ...partyData } = foundry.utils.expandObject(formData.object);
|
const partyData = foundry.utils.expandObject(formData.object);
|
||||||
this.initiator = initiator;
|
|
||||||
this.openForAllPlayers = openForAllPlayers !== undefined ? openForAllPlayers : this.openForAllPlayers;
|
|
||||||
|
|
||||||
this.updatePartyData(partyData, this.getUpdatingParts(event.target));
|
this.updatePartyData(partyData, this.getUpdatingParts(event.target));
|
||||||
}
|
}
|
||||||
|
|
||||||
async updatePartyData(update, updatingParts, options = { render: true }) {
|
async updatePartyData(update, updatingParts, options = { render: true }) {
|
||||||
|
if (!game.users.activeGM)
|
||||||
|
return ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.gmRequired'));
|
||||||
|
|
||||||
const gmUpdate = async update => {
|
const gmUpdate = async update => {
|
||||||
await this.party.update(update);
|
await this.party.update(update);
|
||||||
this.render({ parts: updatingParts });
|
this.render({ parts: updatingParts });
|
||||||
|
|
@ -374,6 +392,23 @@ export default class TagTeamDialog extends HandlebarsApplicationMixin(Applicatio
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateInitiatorMemberField(event) {
|
||||||
|
if (!this.initiator) this.initiator = {};
|
||||||
|
this.initiator.memberId = event.target.value;
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateInitiatorCostField(event) {
|
||||||
|
if (!this.initiator) this.initiator = {};
|
||||||
|
this.initiator.cost = event.target.value ? Number.parseInt(event.target.value) : null;
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOpenForAllField(event) {
|
||||||
|
this.openForAllPlayers = event.target.checked;
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
static async #removeRoll(_, button) {
|
static async #removeRoll(_, button) {
|
||||||
this.updatePartyData(
|
this.updatePartyData(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ export default class DhTokenManager {
|
||||||
: this.#actor;
|
: this.#actor;
|
||||||
const tokenData = await actor.getTokenDocument();
|
const tokenData = await actor.getTokenDocument();
|
||||||
const result = await canvas.scene.createEmbeddedDocuments('Token', [
|
const result = await canvas.scene.createEmbeddedDocuments('Token', [
|
||||||
{ ...tokenData, x: this.#activePreview.document.x, y: this.#activePreview.document.y }
|
{ ...tokenData.toObject(), x: this.#activePreview.document.x, y: this.#activePreview.document.y }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.#activePreview = undefined;
|
this.#activePreview = undefined;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,9 @@
|
||||||
"flatMultiplier": 1
|
"flatMultiplier": 1
|
||||||
},
|
},
|
||||||
"applyTo": "hitPoints",
|
"applyTo": "hitPoints",
|
||||||
"type": [],
|
"type": [
|
||||||
|
"magical"
|
||||||
|
],
|
||||||
"base": false,
|
"base": false,
|
||||||
"valueAlt": {
|
"valueAlt": {
|
||||||
"multiplier": "prof",
|
"multiplier": "prof",
|
||||||
|
|
@ -87,57 +89,6 @@
|
||||||
"name": "Cast",
|
"name": "Cast",
|
||||||
"img": "icons/skills/melee/spear-tips-three-green.webp",
|
"img": "icons/skills/melee/spear-tips-three-green.webp",
|
||||||
"range": "veryClose"
|
"range": "veryClose"
|
||||||
},
|
|
||||||
"CUKoYyDxQhNc0pLs": {
|
|
||||||
"type": "damage",
|
|
||||||
"_id": "CUKoYyDxQhNc0pLs",
|
|
||||||
"systemPath": "actions",
|
|
||||||
"description": "<p>If a target you hit is <em>Vulnerable</em>, they take an extra <strong>1d8</strong> damage.</p>",
|
|
||||||
"chatDisplay": true,
|
|
||||||
"actionType": "action",
|
|
||||||
"cost": [],
|
|
||||||
"uses": {
|
|
||||||
"value": null,
|
|
||||||
"max": "",
|
|
||||||
"recovery": null
|
|
||||||
},
|
|
||||||
"damage": {
|
|
||||||
"parts": {
|
|
||||||
"hitPoints": {
|
|
||||||
"value": {
|
|
||||||
"custom": {
|
|
||||||
"enabled": false
|
|
||||||
},
|
|
||||||
"multiplier": "flat",
|
|
||||||
"flatMultiplier": 1,
|
|
||||||
"dice": "d8",
|
|
||||||
"bonus": null
|
|
||||||
},
|
|
||||||
"applyTo": "hitPoints",
|
|
||||||
"type": [],
|
|
||||||
"base": false,
|
|
||||||
"resultBased": false,
|
|
||||||
"valueAlt": {
|
|
||||||
"multiplier": "prof",
|
|
||||||
"flatMultiplier": 1,
|
|
||||||
"dice": "d6",
|
|
||||||
"bonus": null,
|
|
||||||
"custom": {
|
|
||||||
"enabled": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"includeBase": false
|
|
||||||
},
|
|
||||||
"target": {
|
|
||||||
"type": "any",
|
|
||||||
"amount": null
|
|
||||||
},
|
|
||||||
"effects": [],
|
|
||||||
"name": "Damage Against Vulnerable",
|
|
||||||
"img": "icons/skills/melee/spear-tips-three-purple.webp",
|
|
||||||
"range": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"attribution": {
|
"attribution": {
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,14 @@
|
||||||
"_id": "ijWppQzSOqVCb3rE",
|
"_id": "ijWppQzSOqVCb3rE",
|
||||||
"img": "icons/weapons/axes/axe-battle-jagged.webp",
|
"img": "icons/weapons/axes/axe-battle-jagged.webp",
|
||||||
"system": {
|
"system": {
|
||||||
"description": "",
|
"description": "<strong>Protective:</strong> +1 to Armor Score",
|
||||||
"actions": {},
|
"actions": {},
|
||||||
"attached": [],
|
"attached": [],
|
||||||
"tier": 3,
|
"tier": 3,
|
||||||
"equipped": false,
|
"equipped": false,
|
||||||
"secondary": false,
|
"secondary": false,
|
||||||
"burden": "twoHanded",
|
"burden": "twoHanded",
|
||||||
"weaponFeatures": [
|
"weaponFeatures": [],
|
||||||
{
|
|
||||||
"value": "protective",
|
|
||||||
"effectIds": [
|
|
||||||
"qTxADRsQnKiYfOiQ"
|
|
||||||
],
|
|
||||||
"actionIds": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"attack": {
|
"attack": {
|
||||||
"name": "Attack",
|
"name": "Attack",
|
||||||
"img": "icons/skills/melee/blood-slash-foam-red.webp",
|
"img": "icons/skills/melee/blood-slash-foam-red.webp",
|
||||||
|
|
@ -111,8 +103,8 @@
|
||||||
"effects": [
|
"effects": [
|
||||||
{
|
{
|
||||||
"name": "Protective",
|
"name": "Protective",
|
||||||
"description": "Add your character's Tier to your Armor Score",
|
"description": "+1 to Armor Score",
|
||||||
"img": "icons/skills/melee/shield-block-gray-orange.webp",
|
"img": "icons/magic/defensive/shield-barrier-deflect-teal.webp",
|
||||||
"_id": "vnR4Zhnb0rOqwrFw",
|
"_id": "vnR4Zhnb0rOqwrFw",
|
||||||
"type": "base",
|
"type": "base",
|
||||||
"system": {
|
"system": {
|
||||||
|
|
@ -122,7 +114,7 @@
|
||||||
"phase": "initial",
|
"phase": "initial",
|
||||||
"priority": 20,
|
"priority": 20,
|
||||||
"value": {
|
"value": {
|
||||||
"max": "ITEM.@system.tier"
|
"max": "1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,24 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.FIELDS.initiator.memberId.label"}}</label>
|
<label>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.FIELDS.initiator.memberId.label"}}</label>
|
||||||
<div class="form-fields">
|
<div class="form-fields">
|
||||||
<select name="initiator.memberId" {{#if initiatorDisabled}}disabled{{/if}}>
|
<select class="initiator-member-field" {{#if initiatorDisabled}}disabled{{/if}}>
|
||||||
{{selectOptions initiatorOptions selected=initiator.memberId blank="" }}
|
{{selectOptions initiatorOptions selected=initiator.memberId blank="" }}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{formGroup tagTeamFields.initiator.fields.cost name="initiator.cost" value=initiator.cost disabled=initiatorDisabled localize=true }}
|
<div class="form-group">
|
||||||
|
<label>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.FIELDS.initiator.cost.label"}}</label>
|
||||||
|
<div class="form-fields">
|
||||||
|
<input type="text" data-dtype="Number" value="{{initiator.cost}}" class="initiator-cost-field" {{#if initiatorDisabled}}disabled{{/if}} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<button type="button" data-action="startTagTeamRoll" {{#unless canStartTagTeam}}disabled{{/unless}}>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.startTagTeamRoll"}} <i class="fa-solid fa-arrow-right-long"></i></button>
|
<button type="button" data-action="startTagTeamRoll" {{#unless canStartTagTeam}}disabled{{/unless}}>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.startTagTeamRoll"}} <i class="fa-solid fa-arrow-right-long"></i></button>
|
||||||
<div class="finish-tools {{#unless canStartTagTeam}}inactive{{/unless}}">
|
<div class="finish-tools {{#unless canStartTagTeam}}inactive{{/unless}}">
|
||||||
<span>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.openDialogForAll"}}</span>
|
<span>{{localize "DAGGERHEART.APPLICATIONS.TagTeamSelect.openDialogForAll"}}</span>
|
||||||
<input type="checkbox" name="openForAllPlayers" {{#unless canStartTagTeam}}disabled{{/unless}} {{checked openForAllPlayers}} />
|
<input type="checkbox" class="openforall-field" {{#unless canStartTagTeam}}disabled{{/unless}} {{checked openForAllPlayers}} />
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</section>
|
</section>
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<div class="item-description-outer-container">
|
{{#if features.length}}
|
||||||
{{#if features.length}}
|
<div class="item-description-outer-container">
|
||||||
<div class="item-description-container">
|
<div class="item-description-container">
|
||||||
{{#each features as | feature |}}
|
{{#each features as | feature |}}
|
||||||
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
</div>
|
||||||
</div>
|
{{/if}}
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<div class="item-description-outer-container">
|
{{#if features.length}}
|
||||||
{{#if features.length}}
|
<div class="item-description-outer-container">
|
||||||
<div class="item-description-container">
|
<div class="item-description-container">
|
||||||
{{#each features as | feature |}}
|
{{#each features as | feature |}}
|
||||||
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
</div>
|
||||||
</div>
|
{{/if}}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue