mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-07 22:46:12 +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
|
|
@ -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 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue