264 - Action Feature Swap (#265)

* Removed action fields on Adversary/Environment in favor of using Feature Items

* Added drag/drop for features onto adversary/environment settings

* Added Drag of features from Adversary/Environment settings to anywhere in Foundry

* Updated all item types except Class/Subclass

* Added for Class/Subclass

* Items now copy over their features to Character

* Corrected back to actions for right items

* Fixed adversary/environment features display

* PR Fixes
This commit is contained in:
WBHarry 2025-07-05 22:35:05 +02:00 committed by GitHub
parent eac58c1386
commit e9ad9c539a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 1146 additions and 1114 deletions

View file

@ -1,34 +0,0 @@
<section
class='tab {{tabs.actions.cssClass}} {{tabs.actions.id}}'
data-tab='{{tabs.actions.id}}'
data-group='{{tabs.actions.group}}'
>
<button class="add-action-btn" data-action="addAction">
New Action
</button>
<fieldset>
<legend>{{localize tabs.actions.label}}</legend>
<ul class="action-list">
{{#each document.system.actions as |action index|}}
<li class="action-item">
<img src="{{action.img}}" alt="">
<div class="label">
<span>{{action.name}}</span>
<div class="tags">
<div class="tag">
{{localize (concat 'DAGGERHEART.Actions.Types.' action.type '.name')}}
</div>
<div class="tag">
{{localize (concat 'DAGGERHEART.ActionType.' action.actionType)}}
</div>
</div>
</div>
<div class="controls">
<a data-action="editAction" data-index="{{index}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.edit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
<a data-action="removeAction" data-index="{{index}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.delete'}}"><i class="fa-solid fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</fieldset>
</section>

View file

@ -0,0 +1,26 @@
<section
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
data-tab='{{tabs.features.id}}'
data-group='{{tabs.features.group}}'
>
<button class="add-feature-btn" data-action="addFeature">
{{localize "DOCUMENT.New" type=(localize "TYPES.Item.feature")}}
</button>
<fieldset>
<legend>{{localize tabs.features.label}}</legend>
<ul class="feature-list">
{{#each document.system.features as |feature|}}
<li class="feature-item" id="{{feature.id}}">
<img src="{{feature.img}}" alt="">
<div class="label">
<span>{{feature.name}}</span>
</div>
<div class="controls">
<a data-action="editFeature" id="{{feature.id}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.edit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
<a data-action="removeFeature" id="{{feature.id}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.delete'}}"><i class="fa-solid fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</fieldset>
</section>

View file

@ -1,34 +0,0 @@
<section
class='tab {{tabs.actions.cssClass}} {{tabs.actions.id}}'
data-tab='{{tabs.actions.id}}'
data-group='{{tabs.actions.group}}'
>
<button class="add-action-btn" data-action="addAction">
New Action
</button>
<fieldset>
<legend>{{localize tabs.actions.label}}</legend>
<ul class="action-list">
{{#each document.system.actions as |action index|}}
<li class="action-item">
<img src="{{action.img}}" alt="">
<div class="label">
<span>{{action.name}}</span>
<div class="tags">
<div class="tag">
{{localize (concat 'DAGGERHEART.Actions.Types.' action.type '.name')}}
</div>
<div class="tag">
{{localize (concat 'DAGGERHEART.ActionType.' action.actionType)}}
</div>
</div>
</div>
<div class="controls">
<a data-action="editAction" data-index="{{index}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.edit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
<a data-action="removeAction" data-index="{{index}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.delete'}}"><i class="fa-solid fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</fieldset>
</section>

View file

@ -0,0 +1,26 @@
<section
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
data-tab='{{tabs.features.id}}'
data-group='{{tabs.features.group}}'
>
<button class="add-feature-btn" data-action="addFeature">
{{localize "DOCUMENT.New" type=(localize "TYPES.Item.feature")}}
</button>
<fieldset>
<legend>{{localize tabs.features.label}}</legend>
<ul class="feature-list">
{{#each document.system.features as |feature|}}
<li class="feature-item" id="{{feature.id}}">
<img src="{{feature.img}}" alt="">
<div class="label">
<span>{{feature.name}}</span>
</div>
<div class="controls">
<a data-action="editFeature" id="{{feature.id}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.edit'}}"><i class="fa-solid fa-pen-to-square"></i></a>
<a data-action="removeFeature" id="{{feature.id}}" data-tooltip="{{localize 'DAGGERHEART.Tooltip.delete'}}"><i class="fa-solid fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</fieldset>
</section>

View file

@ -1,11 +0,0 @@
<section
class='tab {{tabs.actions.cssClass}} {{tabs.actions.id}}'
data-tab='{{tabs.actions.id}}'
data-group='{{tabs.actions.group}}'
>
<div class="action-section">
{{#if document.system.actions}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize tabs.actions.label) type='action'}}
{{/if}}
</div>
</section>

View file

@ -4,5 +4,5 @@
data-group='{{tabs.effects.group}}'
>
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.activeEffects') type='effect'}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.inativeEffects') type='effect'}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.inactiveEffects') type='effect'}}
</section>

View file

@ -0,0 +1,9 @@
<section
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
data-tab='{{tabs.features.id}}'
data-group='{{tabs.features.group}}'
>
<div class="feature-section">
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize tabs.features.label) type='feature' values=document.system.features hideControls=true}}
</div>
</section>

View file

@ -4,5 +4,5 @@
data-group='{{tabs.effects.group}}'
>
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.activeEffects') type='effect'}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.inativeEffects') type='effect'}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.inactiveEffects') type='effect'}}
</section>

View file

@ -4,7 +4,12 @@
data-group='{{tabs.features.group}}'
>
<div class="features-sections">
{{#if document.system.class.value}}
{{#each document.system.sheetLists}}
{{#if this.values}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=this.title values=this.values}}
{{/if}}
{{/each}}
{{!-- {{#if document.system.class.value}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(concat (localize 'TYPES.Item.class') ' - ' document.system.class.value.name) type='class'}}
{{/if}}
{{#if document.system.class.subclass}}
@ -21,6 +26,6 @@
{{/if}}
{{#if document.system.ancestry}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(concat (localize 'TYPES.Item.ancestry') ' - ' document.system.ancestry.name) type='ancestry'}}
{{/if}}
{{/if}} --}}
</div>
</section>

View file

@ -4,5 +4,5 @@
data-group='{{tabs.effects.group}}'
>
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.activeEffects') type='effect'}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.inativeEffects') type='effect'}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize 'DAGGERHEART.Sheets.Global.inactiveEffects') type='effect'}}
</section>

View file

@ -1,9 +0,0 @@
<section
class='tab {{tabs.actions.cssClass}} {{tabs.actions.id}}'
data-tab='{{tabs.actions.id}}'
data-group='{{tabs.actions.group}}'
>
<div class="action-section">
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize tabs.actions.label) type='action'}}
</div>
</section>

View file

@ -0,0 +1,9 @@
<section
class='tab {{tabs.features.cssClass}} {{tabs.features.id}}'
data-tab='{{tabs.features.id}}'
data-group='{{tabs.features.group}}'
>
<div class="feature-section">
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-fieldset-items.hbs' title=(localize tabs.features.label) type='feature' values=document.system.features hideControls=true }}
</div>
</section>

View file

@ -2,51 +2,29 @@
<legend>{{title}}</legend>
<ul class="items-list">
{{#unless (eq cardView 'card') }}
{{#each document.items as |item|}}
{{#if (eq item.type ../type)}}
{{#unless (or (eq ../type 'ancestry') (eq item.type 'class') (eq item.type 'subclass') (and (eq ../type 'domainCard') (or (and item.system.inVault (not ../isVault)) (and (not item.system.inVault) ../isVault))))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=../type}}
{{/unless}}
{{#if (or (eq type 'domainCard') (eq type 'armor') (eq type 'consumable') (eq type 'miscellaneous') (eq type 'weapon'))}}
{{#each document.items as |item|}}
{{#if (eq item.type ../type)}}
{{#unless (and (eq ../type 'domainCard') (or (and item.system.inVault (not ../isVault)) (and (not item.system.inVault) ../isVault)))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=item type=../type}}
{{/unless}}
{{/if}}
{{/each}}
{{else}}
{{#if (eq type 'effect')}}
{{#each document.effects as |effect|}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=effect type=../type}}
{{/each}}
{{else}}
{{#each values}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=this type=../type hideControls=../hideControls }}
{{/each}}
{{#each adversaries as |adversary|}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=adversary type='adversary' hideControls=true isActor=true categoryAdversary=@../key}}
{{/each}}
{{/if}}
{{/each}}
{{#each document.system.ancestry.system.actions as |action|}}
{{#if (or (eq ../type 'ancestry'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=action type=../type}}
{{/if}}
{{/each}}
{{#each document.system.class.value.system.classFeatures as |classFeature|}}
{{#if (or (eq ../type 'class'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=classFeature type=../type}}
{{/if}}
{{/each}}
{{#each document.system.class.value.system.classFeatures as |classFeature|}}
{{#if (or (eq ../type 'class'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=classFeature type=../type}}
{{/if}}
{{/each}}
{{#each document.appliedEffects as |effect|}}
{{#if (or (eq ../type 'effect'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=effect type=../type}}
{{/if}}
{{/each}}
{{#each document.system.actions as |action|}}
{{#if (or (eq ../type 'action'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=action type=../type}}
{{/if}}
{{/each}}
{{#each document.system.features as |feature|}}
{{#if (or (eq ../type 'features'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=feature}}
{{/if}}
{{/each}}
{{#each document.system.companionFeatures as |feature|}}
{{#if (or (eq ../type 'companionFeatures'))}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=feature companion=true}}
{{/if}}
{{/each}}
{{#each adversaries as |adversary|}}
{{> 'systems/daggerheart/templates/sheets/global/partials/inventory-item.hbs' item=adversary type='adversary' hideControls=true isActor=true categoryAdversary=@../key}}
{{/each}}
{{/if}}
{{/unless}}
</ul>

View file

@ -1,4 +1,4 @@
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" data-companion="{{companion}}">
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}">
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
<div class="item-label">
{{#if isCompanion}}

View file

@ -4,17 +4,17 @@
data-group='{{tabs.features.group}}'
>
<fieldset class="one-column drop-section">
<legend>{{localize "DAGGERHEART.Sheets.Global.Features"}}</legend>
<legend>{{localize "DAGGERHEART.Sheets.Global.Features"}} <a><i data-action="addFeature" class="fa-solid fa-plus icon-button"></i></a></legend>
<div class="features-list">
{{#each document.system.features as |feature index|}}
{{#each document.system.features as |feature|}}
<div class="feature-item"
data-action="editFeature"
data-index="{{index}}"
id="{{feature.id}}"
>
<img class="image" src="{{feature.img}}" />
<span>{{feature.name}}</span>
<div class="controls">
<a data-action="removeFeature" data-index="{{index}}"><i class="fa-solid fa-trash"></i></a>
<a data-action="removeFeature" id="{{feature.id}}"><i class="fa-solid fa-trash"></i></a>
</div>
</div>
{{/each}}

View file

@ -7,7 +7,7 @@
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Class.HopeFeatures"}} <a><i class="fa-solid fa-plus icon-button" data-type="hope" data-action="addFeature"></i></a></legend>
<div class="feature-list">
{{#each source.system.hopeFeatures as |feature index|}}
{{#each source.system.hopeFeatures as |feature|}}
{{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='hope' feature=feature}}
{{/each}}
</div>
@ -16,7 +16,7 @@
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Class.ClassFeatures"}} <a><i class="fa-solid fa-plus icon-button" data-type="class" data-action="addFeature"></i></a></legend>
<div class="feature-list">
{{#each source.system.classFeatures as |feature index|}}
{{#each source.system.classFeatures as |feature|}}
{{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='class' feature=feature}}
{{/each}}
</div>

View file

@ -3,18 +3,42 @@
data-tab='{{tabs.features.id}}'
data-group='{{tabs.features.group}}'
>
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Subclass.Tabs.Foundation"}}</legend>
{{> 'systems/daggerheart/templates/sheets/items/subclass/parts/subclass-features.hbs' level='foundationFeature' feature=source.system.foundationFeature}}
<fieldset class="drop-section" data-type="foundationFeature">
<legend>
{{localize "DAGGERHEART.Sheets.Subclass.Tabs.Foundation"}}
<a {{#if source.system.foundationFeature}}disabled{{/if}}><i data-action="addFeature" data-type="foundationFeature" class="fa-solid fa-plus icon-button {{#if source.system.foundationFeature}}disabled{{/if}}"></i></a>
</legend>
<div class="feature-list">
{{#if source.system.foundationFeature}}
{{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='foundationFeature' feature=source.system.foundationFeature}}
{{/if}}
</div>
</fieldset>
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Subclass.Tabs.Specialization"}}</legend>
{{> 'systems/daggerheart/templates/sheets/items/subclass/parts/subclass-features.hbs' level='specializationFeature' feature=source.system.specializationFeature}}
<fieldset class="drop-section" data-type="specializationFeature">
<legend>
{{localize "DAGGERHEART.Sheets.Subclass.Tabs.Specialization"}}
<a {{#if source.system.specializationFeature}}disabled{{/if}}><i data-action="addFeature" data-type="specializationFeature" class="fa-solid fa-plus icon-button {{#if source.system.specializationFeature}}disabled{{/if}}"></i></a>
</legend>
<div class="feature-list">
{{#if source.system.specializationFeature}}
{{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='specializationFeature' feature=source.system.specializationFeature}}
{{/if}}
</div>
</fieldset>
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Subclass.Tabs.Mastery"}}</legend>
{{> 'systems/daggerheart/templates/sheets/items/subclass/parts/subclass-features.hbs' level='masteryFeature' feature=source.system.masteryFeature}}
<fieldset class="drop-section" data-type="masteryFeature">
<legend>
{{localize "DAGGERHEART.Sheets.Subclass.Tabs.Mastery"}}
<a {{#if source.system.masteryFeature}}disabled{{/if}}><i data-action="addFeature" data-type="masteryFeature" class="fa-solid fa-plus icon-button {{#if source.system.masteryFeature}}disabled{{/if}}"></i></a>
</legend>
<div class="feature-list">
{{#if source.system.masteryFeature}}
{{> 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs' type='masteryFeature' feature=source.system.masteryFeature}}
{{/if}}
</div>
</fieldset>
</section>

View file

@ -1,30 +0,0 @@
<li class='feature-item'>
<div class='feature-line'>
<img class='image' src='{{feature.img}}' />
<h4>{{feature.name}}</h4>
{{#unless hideContrals}}
<div class='controls'>
<a
class='effect-control'
data-action='editFeature'
data-type="{{type}}"
data-level="{{level}}"
data-feature='{{id}}'
data-tooltip='{{localize "DAGGERHEART.Tooltip.openItemWorld"}}'
>
<i class="fa-solid fa-globe"></i>
</a>
<a
class='effect-control'
data-action='deleteFeature'
data-type="{{type}}"
data-level="{{level}}"
data-feature='{{id}}'
data-tooltip='{{localize "DAGGERHEART.Tooltip.delete"}}'
>
<i class='fas fa-trash'></i>
</a>
</div>
{{/unless}}
</div>
</li>

View file

@ -1,22 +0,0 @@
<div class="two-columns even">
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Subclass.SubclassFeature.Actions"}} <a><i class="fa-solid fa-plus icon-button" data-level="{{level}}" data-type="action" data-action="addFeature"></i></a></legend>
<div class="feature-list">
{{#each feature.actions}}
{{> 'systems/daggerheart/templates/sheets/items/subclass/parts/subclass-feature.hbs' level=../level type="action" id=this._id feature=this}}
{{/each}}
</div>
</fieldset>
<fieldset>
<legend>{{localize "DAGGERHEART.Sheets.Subclass.SubclassFeature.Effects"}} <a><i class="fa-solid fa-plus icon-button" data-level="{{level}}" data-type="effect" data-action="addFeature"></i></a></legend>
<div class="feature-list">
{{#each feature.effects}}
{{> 'systems/daggerheart/templates/sheets/items/subclass/parts/subclass-feature.hbs' level=../level type="effect" id=this.id feature=this}}
{{/each}}
</div>
</fieldset>
</div>