mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 14:36:13 +01:00
Removed hardcoded tierlimit on beastform
This commit is contained in:
parent
2fd5bc7eb0
commit
72dfc54705
8 changed files with 49 additions and 11 deletions
|
|
@ -303,6 +303,7 @@ const preloadHandlebarsTemplates = async function () {
|
|||
'systems/daggerheart/templates/views/actionTypes/cost.hbs',
|
||||
'systems/daggerheart/templates/views/actionTypes/range-target.hbs',
|
||||
'systems/daggerheart/templates/views/actionTypes/effect.hbs',
|
||||
'systems/daggerheart/templates/views/actionTypes/beastform.hbs',
|
||||
'systems/daggerheart/templates/settings/components/settings-item-line.hbs',
|
||||
'systems/daggerheart/templates/chat/parts/damage-chat.hbs',
|
||||
'systems/daggerheart/templates/chat/parts/target-chat.hbs'
|
||||
|
|
|
|||
|
|
@ -1662,6 +1662,13 @@
|
|||
"ResultBased": {
|
||||
"label": "Formula based on Hope/Fear result."
|
||||
}
|
||||
},
|
||||
"Config": {
|
||||
"Beastform": {
|
||||
"label": "Beastform",
|
||||
"exact": "Exact",
|
||||
"exactPlaceholder": "Character tier is used"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RollTypes": {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import { abilities } from '../../../config/actorConfig.mjs';
|
|||
import DhCharacterlevelUp from '../../levelup/characterLevelup.mjs';
|
||||
import DhCharacterCreation from '../../characterCreation.mjs';
|
||||
import FilterMenu from '../../ux/filter-menu.mjs';
|
||||
import { DhBeastformAction } from '../../../data/action/action.mjs';
|
||||
import DHActionConfig from '../../config/Action.mjs';
|
||||
|
||||
const { ActorSheetV2 } = foundry.applications.sheets;
|
||||
const { TextEditor } = foundry.applications.ux;
|
||||
|
|
@ -751,7 +753,11 @@ export default class CharacterSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
const item = this.getItem(event);
|
||||
if (!item) return;
|
||||
|
||||
item.sheet.render(true);
|
||||
if (item.sheet) {
|
||||
item.sheet.render(true);
|
||||
} else {
|
||||
await new DHActionConfig(item).render(true);
|
||||
}
|
||||
}
|
||||
|
||||
editItem(event) {
|
||||
|
|
|
|||
|
|
@ -107,6 +107,11 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
}),
|
||||
value: new fields.EmbeddedDataField(DHActionDiceData),
|
||||
valueAlt: new fields.EmbeddedDataField(DHActionDiceData)
|
||||
}),
|
||||
beastform: new fields.SchemaField({
|
||||
tierAccess: new fields.SchemaField({
|
||||
exact: new fields.NumberField({ integer: true, nullable: true, initial: null })
|
||||
})
|
||||
})
|
||||
},
|
||||
extraSchemas = {};
|
||||
|
|
@ -271,6 +276,8 @@ export class DHBaseAction extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
if (this instanceof DhBeastformAction) {
|
||||
config.beastform = this.prepareBeastformConfig();
|
||||
|
||||
const abort = await this.handleActiveTransformations();
|
||||
if (abort) return;
|
||||
|
||||
|
|
@ -770,13 +777,18 @@ export class DHMacroAction extends DHBaseAction {
|
|||
}
|
||||
|
||||
export class DhBeastformAction extends DHBaseAction {
|
||||
static defineSchema() {
|
||||
static extraSchemas = ['beastform'];
|
||||
|
||||
prepareBeastformConfig(config) {
|
||||
const settingsTier = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.LevelTiers).tiers;
|
||||
const actorLevel = this.actor.system.levelData.level.current;
|
||||
const actorTier =
|
||||
Object.values(settingsTier).find(
|
||||
tier => actorLevel >= tier.levels.start && actorLevel <= tier.levels.end
|
||||
) ?? 1;
|
||||
|
||||
return {
|
||||
...super.defineSchema(),
|
||||
tierAccess: new fields.SchemaField({
|
||||
exact: new fields.NumberField({ integer: true, nullable: true, initial: null }),
|
||||
characterBased: new fields.BooleanField({ initial: true })
|
||||
})
|
||||
tierLimit: this.beastform.tierAccess.exact ?? actorTier
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,10 +44,9 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
|
|||
const context = await super._prepareContext(_options);
|
||||
context.configData = this.configData;
|
||||
|
||||
const tierLimit = 2;
|
||||
context.beastformTiers = game.items.reduce((acc, x) => {
|
||||
const tier = tiers[x.system.tier];
|
||||
if (x.type !== 'beastform' || tier.value > tierLimit) return acc;
|
||||
if (x.type !== 'beastform' || tier.value > context.configData.beastform.tierLimit) return acc;
|
||||
|
||||
if (!acc[tier.value]) acc[tier.value] = { label: game.i18n.localize(tier.label), values: {} };
|
||||
acc[tier.value].values[x.uuid] = { selected: this.selected == x.uuid, value: x };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-companion="{{companion}}" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}}>
|
||||
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" data-companion="{{companion}}" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}}>
|
||||
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem"/>
|
||||
<div class="item-label">
|
||||
{{#if isCompanion}}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@
|
|||
{{#if fields.healing}}{{> 'systems/daggerheart/templates/views/actionTypes/healing.hbs' fields=fields.healing.fields source=source.healing}}{{/if}}
|
||||
{{#if fields.resource}}{{> 'systems/daggerheart/templates/views/actionTypes/resource.hbs' fields=fields.resource.fields source=source.resource}}{{/if}}
|
||||
{{#if fields.documentUUID}}{{> 'systems/daggerheart/templates/views/actionTypes/uuid.hbs' fields=fields.documentUUID source=source.documentUUID}}{{/if}}
|
||||
{{#if fields.effects}}{{> 'systems/daggerheart/templates/views/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
||||
{{#if fields.effects}}{{> 'systems/daggerheart/templates/views/actionTypes/effect.hbs' fields=fields.effects.element.fields source=source.effects}}{{/if}}
|
||||
{{#if fields.beastform}}{{> 'systems/daggerheart/templates/views/actionTypes/beastform.hbs' fields=fields.effects.element.fields source=source.beastform}}{{/if}}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
12
templates/views/actionTypes/beastform.hbs
Normal file
12
templates/views/actionTypes/beastform.hbs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<fieldset class="action-category">
|
||||
<legend class="action-category-label">
|
||||
<div>{{localize "DAGGERHEART.Actions.Config.Beastform.label"}}</div>
|
||||
</legend>
|
||||
|
||||
<div class="action-category-data open">
|
||||
{{formGroup
|
||||
@root.fields.beastform.fields.tierAccess.fields.exact value=@root.source.beastform.tierAccess.exact name="beastform.tierAccess.exact"
|
||||
placeholder=(localize "DAGGERHEART.Actions.Config.Beastform.exactPlaceholder") label="DAGGERHEART.Actions.Config.Beastform.exact" localize=true
|
||||
}}
|
||||
</div>
|
||||
</fieldset>
|
||||
Loading…
Add table
Add a link
Reference in a new issue