mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-05 20:34:15 +02:00
Merge d78927d0c2 into 3527fd7959
This commit is contained in:
commit
094aeb36a6
23 changed files with 365 additions and 69 deletions
23
lang/en.json
23
lang/en.json
|
|
@ -245,10 +245,6 @@
|
||||||
"unequip": "Unequip",
|
"unequip": "Unequip",
|
||||||
"useItem": "Use Item"
|
"useItem": "Use Item"
|
||||||
},
|
},
|
||||||
"defaultHopeDice": "Default Hope Dice",
|
|
||||||
"defaultFearDice": "Default Fear Dice",
|
|
||||||
"defaultAdvantageDice": "Default Advantage Dice",
|
|
||||||
"defaultDisadvantageDice": "Default Disadvantage Dice",
|
|
||||||
"disadvantageSources": {
|
"disadvantageSources": {
|
||||||
"label": "Disadvantage Sources",
|
"label": "Disadvantage Sources",
|
||||||
"hint": "Add single words or short text as reminders and hints of what a character has disadvantage on."
|
"hint": "Add single words or short text as reminders and hints of what a character has disadvantage on."
|
||||||
|
|
@ -314,6 +310,16 @@
|
||||||
},
|
},
|
||||||
"noPartner": "No Partner selected"
|
"noPartner": "No Partner selected"
|
||||||
},
|
},
|
||||||
|
"Creature": {
|
||||||
|
"rules": {
|
||||||
|
"roll": {
|
||||||
|
"hope": { "label": "Default Hope Dice Index", "hint": "Index for the default hope dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" },
|
||||||
|
"fear": { "label": "Default Fear Dice Index", "hint": "Index for the default fear dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" },
|
||||||
|
"advantage": { "label": "Default Advantage Dice Index", "hint": "Index for the default advantage dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" },
|
||||||
|
"disadvantage": { "label": "Default Disadvantage Dice Index", "hint": "Index for the default disadvantage dice. 0=d4, 1=d6, 2=d8, 3=d10, 4=d12, 5=d20" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Environment": {
|
"Environment": {
|
||||||
"FIELDS": {
|
"FIELDS": {
|
||||||
"description": {
|
"description": {
|
||||||
|
|
@ -699,6 +705,9 @@
|
||||||
"title": "{actor} Level Up",
|
"title": "{actor} Level Up",
|
||||||
"viewModeTitle": "{actor} Level Up (View Mode)"
|
"viewModeTitle": "{actor} Level Up (View Mode)"
|
||||||
},
|
},
|
||||||
|
"LevelupOptionsDialog": {
|
||||||
|
"title": "Levelup Options: {name}"
|
||||||
|
},
|
||||||
"MulticlassChoice": {
|
"MulticlassChoice": {
|
||||||
"title": "Multiclassing - {actor}",
|
"title": "Multiclassing - {actor}",
|
||||||
"explanation": "You are adding {class} as your multiclass",
|
"explanation": "You are adding {class} as your multiclass",
|
||||||
|
|
@ -1281,6 +1290,10 @@
|
||||||
"diceValue": "Dice Value",
|
"diceValue": "Dice Value",
|
||||||
"die": "Die"
|
"die": "Die"
|
||||||
},
|
},
|
||||||
|
"LevelupData": {
|
||||||
|
"checkboxSelections": "Checkboxes",
|
||||||
|
"minCost": "Minimum Boxes Picked"
|
||||||
|
},
|
||||||
"Range": {
|
"Range": {
|
||||||
"self": {
|
"self": {
|
||||||
"name": "Self",
|
"name": "Self",
|
||||||
|
|
@ -2494,6 +2507,7 @@
|
||||||
"step": "Step",
|
"step": "Step",
|
||||||
"stress": "Stress",
|
"stress": "Stress",
|
||||||
"subclasses": "Subclasses",
|
"subclasses": "Subclasses",
|
||||||
|
"subType": "Subtype",
|
||||||
"success": "Success",
|
"success": "Success",
|
||||||
"summon": {
|
"summon": {
|
||||||
"single": "Summon",
|
"single": "Summon",
|
||||||
|
|
@ -3292,6 +3306,7 @@
|
||||||
"rightClickExtend": "Right-Click to extend",
|
"rightClickExtend": "Right-Click to extend",
|
||||||
"companionPartnerLevelBlock": "The companion needs an assigned partner to level up.",
|
"companionPartnerLevelBlock": "The companion needs an assigned partner to level up.",
|
||||||
"configureAttribution": "Configure Attribution",
|
"configureAttribution": "Configure Attribution",
|
||||||
|
"configureLevelupOptions": "Configure Levelup Options",
|
||||||
"deleteItem": "Delete Item",
|
"deleteItem": "Delete Item",
|
||||||
"immune": "Immune",
|
"immune": "Immune",
|
||||||
"middleClick": "[Middle Click] Keep tooltip view",
|
"middleClick": "[Middle Click] Keep tooltip view",
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,4 @@ export { default as TagTeamDialog } from './tagTeamDialog.mjs';
|
||||||
export { default as GroupRollDialog } from './groupRollDialog.mjs';
|
export { default as GroupRollDialog } from './groupRollDialog.mjs';
|
||||||
export { default as RiskItAllDialog } from './riskItAllDialog.mjs';
|
export { default as RiskItAllDialog } from './riskItAllDialog.mjs';
|
||||||
export { default as CompendiumBrowserSettingsDialog } from './CompendiumBrowserSettings.mjs';
|
export { default as CompendiumBrowserSettingsDialog } from './CompendiumBrowserSettings.mjs';
|
||||||
|
export { default as LevelupOptionsDialog } from './levelupOptionsDialog.mjs';
|
||||||
|
|
|
||||||
110
module/applications/dialogs/levelupOptionsDialog.mjs
Normal file
110
module/applications/dialogs/levelupOptionsDialog.mjs
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
import { LevelOptionType } from '../../data/levelTier.mjs';
|
||||||
|
|
||||||
|
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||||
|
|
||||||
|
export default class LevelupOptionsDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
|
constructor(item) {
|
||||||
|
super({});
|
||||||
|
|
||||||
|
this.item = item;
|
||||||
|
this.selectedOption = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
get title() {
|
||||||
|
return game.i18n.format('DAGGERHEART.APPLICATIONS.LevelupOptionsDialog.title', { name: this.item.name });
|
||||||
|
}
|
||||||
|
|
||||||
|
static DEFAULT_OPTIONS = {
|
||||||
|
tag: 'form',
|
||||||
|
classes: ['daggerheart', 'dh-style', 'dialog', 'views', 'levelup-options-dialog'],
|
||||||
|
position: { width: 480, height: 'auto' },
|
||||||
|
window: { icon: 'fa-solid fa-angles-up fa-fw' },
|
||||||
|
actions: {
|
||||||
|
addTierOption: LevelupOptionsDialog.#addTierOption,
|
||||||
|
removeTierOption: LevelupOptionsDialog.#removeTierOption
|
||||||
|
},
|
||||||
|
form: { handler: this.updateData, submitOnChange: true, closeOnSubmit: false }
|
||||||
|
};
|
||||||
|
|
||||||
|
static PARTS = {
|
||||||
|
header: { template: 'systems/daggerheart/templates/dialogs/levelupOptionsDialog/header.hbs' },
|
||||||
|
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||||
|
tiers: { template: 'systems/daggerheart/templates/dialogs/levelupOptionsDialog/tiers.hbs' }
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
static TABS = {
|
||||||
|
primary: {
|
||||||
|
tabs: [
|
||||||
|
{ id: 'tier2', label: 'DAGGERHEART.GENERAL.Tiers.2', tier: 2 },
|
||||||
|
{ id: 'tier3', label: 'DAGGERHEART.GENERAL.Tiers.3', tier: 3 },
|
||||||
|
{ id: 'tier4', label: 'DAGGERHEART.GENERAL.Tiers.4', tier: 4 }
|
||||||
|
],
|
||||||
|
initial: 'tier2'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
for (const element of htmlElement.querySelectorAll('.option-type-select'))
|
||||||
|
element.addEventListener('change', this.updateSelectedOption.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
async _prepareContext(_options) {
|
||||||
|
const context = await super._prepareContext(_options);
|
||||||
|
context.fields = this.item.system.schema.fields.levelupOptionTiers.element.element.fields;
|
||||||
|
context.item = this.item;
|
||||||
|
context.levelupOptionTiers = Object.keys(this.item.system.levelupOptionTiers).reduce((acc, key) => {
|
||||||
|
const tier = this.item.system.levelupOptionTiers[key];
|
||||||
|
acc[key] = Object.keys(tier).reduce((acc, key) => {
|
||||||
|
const option = tier[key];
|
||||||
|
acc[key] = {
|
||||||
|
...option,
|
||||||
|
typeData: option.type ? LevelOptionType[option.type] : null
|
||||||
|
};
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
context.optionTypes = LevelOptionType;
|
||||||
|
context.selectedOption = this.selectedOption;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
|
static async updateData(_event, _element, formData) {
|
||||||
|
const data = foundry.utils.expandObject(formData.object);
|
||||||
|
await this.item.update(data);
|
||||||
|
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateSelectedOption(event) {
|
||||||
|
this.selectedOption = event.target.value;
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #addTierOption(_event, button) {
|
||||||
|
const { tier } = button.dataset;
|
||||||
|
await this.item.update({
|
||||||
|
[`system.levelupOptionTiers.${tier}.${foundry.utils.randomID()}`]: {
|
||||||
|
label: LevelOptionType[this.selectedOption].label,
|
||||||
|
type: this.selectedOption
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.selectedOption = null;
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
static async #removeTierOption(_event, button) {
|
||||||
|
const { tier, key } = button.dataset;
|
||||||
|
|
||||||
|
await this.item.update({ [`system.levelupOptionTiers.${tier}.${key}`]: _del });
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,9 +6,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
|
||||||
constructor(actor) {
|
constructor(actor) {
|
||||||
super(actor);
|
super(actor);
|
||||||
|
|
||||||
this.levelTiers = this.addBonusChoices(
|
this.levelTiers = this.addBonusChoices(actor.system.levelupTiers);
|
||||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers)
|
|
||||||
);
|
|
||||||
const playerLevelupData = actor.system.levelData;
|
const playerLevelupData = actor.system.levelData;
|
||||||
this.levelup = new DhLevelup(DhLevelup.initializeData(this.levelTiers, playerLevelupData));
|
this.levelup = new DhLevelup(DhLevelup.initializeData(this.levelTiers, playerLevelupData));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -527,7 +527,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
minCost: Number(button.dataset.cost),
|
minCost: Number(button.dataset.cost),
|
||||||
amount: button.dataset.amount ? Number(button.dataset.amount) : null,
|
amount: button.dataset.amount ? Number(button.dataset.amount) : null,
|
||||||
value: button.dataset.value,
|
value: button.dataset.value,
|
||||||
type: button.dataset.type
|
type: button.dataset.type,
|
||||||
|
subType: button.dataset.subType
|
||||||
};
|
};
|
||||||
|
|
||||||
if (button.dataset.type === 'domainCard') {
|
if (button.dataset.type === 'domainCard') {
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,8 @@ export default function DHApplicationMixin(Base) {
|
||||||
toggleExtended: DHSheetV2.#toggleExtended,
|
toggleExtended: DHSheetV2.#toggleExtended,
|
||||||
addNewItem: DHSheetV2.#onAddNewItem,
|
addNewItem: DHSheetV2.#onAddNewItem,
|
||||||
browseItem: DHSheetV2.#onBrowseItem,
|
browseItem: DHSheetV2.#onBrowseItem,
|
||||||
editAttribution: DHSheetV2.#editAttribution
|
editAttribution: DHSheetV2.#editAttribution,
|
||||||
|
configureLevelUpOptions: DHSheetV2.#configureLevelUpOptions
|
||||||
},
|
},
|
||||||
contextMenus: [
|
contextMenus: [
|
||||||
{
|
{
|
||||||
|
|
@ -119,6 +120,16 @@ export default function DHApplicationMixin(Base) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
window: {
|
||||||
|
controls: [
|
||||||
|
{
|
||||||
|
icon: 'fa-solid fa-angles-up fa-fw',
|
||||||
|
label: 'DAGGERHEART.UI.Tooltip.configureLevelupOptions',
|
||||||
|
action: 'configureLevelUpOptions',
|
||||||
|
visible: DHSheetV2.#hasLevelUpOptions
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
dragDrop: [{ dragSelector: '.inventory-item[data-type="effect"]', dropSelector: null }],
|
dragDrop: [{ dragSelector: '.inventory-item[data-type="effect"]', dropSelector: null }],
|
||||||
tagifyConfigs: []
|
tagifyConfigs: []
|
||||||
};
|
};
|
||||||
|
|
@ -142,6 +153,10 @@ export default function DHApplicationMixin(Base) {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static #hasLevelUpOptions() {
|
||||||
|
return this.document.system.metadata.hasLevelUpOptions;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the custom parts of the application frame
|
* Refresh the custom parts of the application frame
|
||||||
*/
|
*/
|
||||||
|
|
@ -711,6 +726,10 @@ export default function DHApplicationMixin(Base) {
|
||||||
new game.system.api.applications.dialogs.AttributionDialog(this.document).render({ force: true });
|
new game.system.api.applications.dialogs.AttributionDialog(this.document).render({ force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async #configureLevelUpOptions() {
|
||||||
|
new game.system.api.applications.dialogs.LevelupOptionsDialog(this.document).render({ force: true });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an embedded document.
|
* Create an embedded document.
|
||||||
* @type {ApplicationClickAction}
|
* @type {ApplicationClickAction}
|
||||||
|
|
|
||||||
|
|
@ -261,24 +261,6 @@ export default class DhCharacter extends DhCreature {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
dualityRoll: new fields.SchemaField({
|
|
||||||
defaultHopeDice: new fields.NumberField({
|
|
||||||
nullable: false,
|
|
||||||
required: true,
|
|
||||||
integer: true,
|
|
||||||
choices: CONFIG.DH.GENERAL.dieFaces,
|
|
||||||
initial: 12,
|
|
||||||
label: 'DAGGERHEART.ACTORS.Character.defaultHopeDice'
|
|
||||||
}),
|
|
||||||
defaultFearDice: new fields.NumberField({
|
|
||||||
nullable: false,
|
|
||||||
required: true,
|
|
||||||
integer: true,
|
|
||||||
choices: CONFIG.DH.GENERAL.dieFaces,
|
|
||||||
initial: 12,
|
|
||||||
label: 'DAGGERHEART.ACTORS.Character.defaultFearDice'
|
|
||||||
})
|
|
||||||
}),
|
|
||||||
burden: new fields.SchemaField({
|
burden: new fields.SchemaField({
|
||||||
ignore: new fields.BooleanField({ label: 'DAGGERHEART.ACTORS.Character.burden.ignore.label' })
|
ignore: new fields.BooleanField({ label: 'DAGGERHEART.ACTORS.Character.burden.ignore.label' })
|
||||||
}),
|
}),
|
||||||
|
|
@ -287,21 +269,47 @@ export default class DhCharacter extends DhCreature {
|
||||||
label: 'DAGGERHEART.ACTORS.Character.roll.guaranteedCritical.label',
|
label: 'DAGGERHEART.ACTORS.Character.roll.guaranteedCritical.label',
|
||||||
hint: 'DAGGERHEART.ACTORS.Character.roll.guaranteedCritical.hint'
|
hint: 'DAGGERHEART.ACTORS.Character.roll.guaranteedCritical.hint'
|
||||||
}),
|
}),
|
||||||
defaultAdvantageDice: new fields.NumberField({
|
hopeIndex: new fields.NumberField({
|
||||||
nullable: true,
|
|
||||||
required: true,
|
required: true,
|
||||||
integer: true,
|
integer: true,
|
||||||
choices: CONFIG.DH.GENERAL.dieFaces,
|
min: 0,
|
||||||
initial: null,
|
max: 5,
|
||||||
label: 'DAGGERHEART.ACTORS.Character.defaultAdvantageDice'
|
initial: 4,
|
||||||
|
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.hope.label',
|
||||||
|
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.hope.hint'
|
||||||
}),
|
}),
|
||||||
defaultDisadvantageDice: new fields.NumberField({
|
fearIndex: new fields.NumberField({
|
||||||
nullable: true,
|
|
||||||
required: true,
|
required: true,
|
||||||
integer: true,
|
integer: true,
|
||||||
choices: CONFIG.DH.GENERAL.dieFaces,
|
min: 0,
|
||||||
initial: null,
|
max: 5,
|
||||||
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
|
initial: 4,
|
||||||
|
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.fear.label',
|
||||||
|
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.fear.hint'
|
||||||
|
}),
|
||||||
|
advantageIndex: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
integer: true,
|
||||||
|
min: 0,
|
||||||
|
max: 5,
|
||||||
|
initial: 1,
|
||||||
|
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.label',
|
||||||
|
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.hint'
|
||||||
|
}),
|
||||||
|
disadvantageIndex: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
integer: true,
|
||||||
|
min: 0,
|
||||||
|
max: 5,
|
||||||
|
initial: 1,
|
||||||
|
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.label',
|
||||||
|
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.hint'
|
||||||
|
}),
|
||||||
|
comboDieIndex: new fields.NumberField({
|
||||||
|
integer: true,
|
||||||
|
min: 0,
|
||||||
|
max: 5,
|
||||||
|
initial: 0
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
@ -445,6 +453,19 @@ export default class DhCharacter extends DhCreature {
|
||||||
return attack;
|
return attack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get levelupTiers() {
|
||||||
|
const tierData = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers);
|
||||||
|
for (const tierKey of Object.keys(this.class?.value?.system.levelupOptionTiers ?? {})) {
|
||||||
|
const tier = this.class.value.system.levelupOptionTiers[tierKey];
|
||||||
|
for (const optionKey of Object.keys(tier)) {
|
||||||
|
const option = tier[optionKey];
|
||||||
|
tierData.tiers[tierKey].options[optionKey] = option;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return tierData;
|
||||||
|
}
|
||||||
|
|
||||||
/* All items are valid on characters */
|
/* All items are valid on characters */
|
||||||
isItemValid() {
|
isItemValid() {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -763,6 +784,9 @@ export default class DhCharacter extends DhCreature {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case 'dice':
|
||||||
|
this.rules.roll[selection.subType] += 1;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -821,6 +845,14 @@ export default class DhCharacter extends DhCreature {
|
||||||
isReversed: true
|
isReversed: true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Add convience <dice>Faces properties for all dice */
|
||||||
|
const { hopeIndex, fearIndex, advantageIndex, disadvantageIndex, comboDieIndex } = this.rules.roll;
|
||||||
|
const dice = { hopeIndex, fearIndex, advantageIndex, disadvantageIndex, comboDieIndex };
|
||||||
|
for (const dieKey of Object.keys(dice)) {
|
||||||
|
const diceBaseKey = dieKey.replace('Index', '');
|
||||||
|
this.rules.roll[`${diceBaseKey}Faces`] = CONFIG.DH.GENERAL.dieFaces[dice[dieKey]];
|
||||||
|
}
|
||||||
|
|
||||||
this.attack.damage.parts.hitPoints.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
this.attack.damage.parts.hitPoints.value.custom.formula = `@prof${this.basicAttackDamageDice}${this.rules.attack.damage.bonus ? ` + ${this.rules.attack.damage.bonus}` : ''}`;
|
||||||
|
|
||||||
// Clamp resources (must be done last to ensure all updates occur)
|
// Clamp resources (must be done last to ensure all updates occur)
|
||||||
|
|
|
||||||
|
|
@ -63,21 +63,23 @@ export default class DhCompanion extends DhCreature {
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
roll: new fields.SchemaField({
|
roll: new fields.SchemaField({
|
||||||
defaultAdvantageDice: new fields.NumberField({
|
advantage: new fields.NumberField({
|
||||||
nullable: true,
|
|
||||||
required: true,
|
required: true,
|
||||||
integer: true,
|
integer: true,
|
||||||
choices: CONFIG.DH.GENERAL.dieFaces,
|
min: 0,
|
||||||
initial: null,
|
max: 5,
|
||||||
label: 'DAGGERHEART.ACTORS.Character.defaultAdvantageDice'
|
initial: 1,
|
||||||
|
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.label',
|
||||||
|
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.advantage.hint'
|
||||||
}),
|
}),
|
||||||
defaultDisadvantageDice: new fields.NumberField({
|
disadvantage: new fields.NumberField({
|
||||||
nullable: true,
|
|
||||||
required: true,
|
required: true,
|
||||||
integer: true,
|
integer: true,
|
||||||
choices: CONFIG.DH.GENERAL.dieFaces,
|
min: 0,
|
||||||
initial: null,
|
max: 5,
|
||||||
label: 'DAGGERHEART.ACTORS.Character.defaultDisadvantageDice'
|
initial: 1,
|
||||||
|
label: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.label',
|
||||||
|
hint: 'DAGGERHEART.ACTORS.Creature.rules.roll.disadvantage.hint'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import ForeignDocumentUUIDField from '../fields/foreignDocumentUUIDField.mjs';
|
||||||
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
import ForeignDocumentUUIDArrayField from '../fields/foreignDocumentUUIDArrayField.mjs';
|
||||||
import ItemLinkFields from '../fields/itemLinkFields.mjs';
|
import ItemLinkFields from '../fields/itemLinkFields.mjs';
|
||||||
import { addLinkedItemsDiff, fromUuids, getFeaturesHTMLData, updateLinkedItemApps } from '../../helpers/utils.mjs';
|
import { addLinkedItemsDiff, fromUuids, getFeaturesHTMLData, updateLinkedItemApps } from '../../helpers/utils.mjs';
|
||||||
|
import { DhLevelOption } from '../levelTier.mjs';
|
||||||
|
|
||||||
export default class DHClass extends BaseDataItem {
|
export default class DHClass extends BaseDataItem {
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -10,7 +11,8 @@ export default class DHClass extends BaseDataItem {
|
||||||
return foundry.utils.mergeObject(super.metadata, {
|
return foundry.utils.mergeObject(super.metadata, {
|
||||||
label: 'TYPES.Item.class',
|
label: 'TYPES.Item.class',
|
||||||
type: 'class',
|
type: 'class',
|
||||||
hasDescription: true
|
hasDescription: true,
|
||||||
|
hasLevelUpOptions: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +52,13 @@ export default class DHClass extends BaseDataItem {
|
||||||
}),
|
}),
|
||||||
backgroundQuestions: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
|
backgroundQuestions: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
|
||||||
connections: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
|
connections: new fields.ArrayField(new fields.StringField(), { initial: ['', '', ''] }),
|
||||||
isMulticlass: new fields.BooleanField({ initial: false })
|
isMulticlass: new fields.BooleanField({ initial: false }),
|
||||||
|
levelupOptionTiers: new fields.TypedObjectField(
|
||||||
|
new fields.TypedObjectField(new fields.EmbeddedDataField(DhLevelOption)),
|
||||||
|
{
|
||||||
|
initial: { 2: {}, 3: {}, 4: {} }
|
||||||
|
}
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export default class DhLevelData extends foundry.abstract.DataModel {
|
||||||
level: new fields.NumberField({ required: true, integer: true }),
|
level: new fields.NumberField({ required: true, integer: true }),
|
||||||
optionKey: new fields.StringField({ required: true }),
|
optionKey: new fields.StringField({ required: true }),
|
||||||
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
||||||
|
subType: new fields.StringField({ nullable: true }),
|
||||||
checkboxNr: new fields.NumberField({ required: true, integer: true }),
|
checkboxNr: new fields.NumberField({ required: true, integer: true }),
|
||||||
value: new fields.NumberField({ integer: true }),
|
value: new fields.NumberField({ integer: true }),
|
||||||
minCost: new fields.NumberField({ integer: true }),
|
minCost: new fields.NumberField({ integer: true }),
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,44 @@ class DhLevelTier extends foundry.abstract.DataModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DhLevelOption extends foundry.abstract.DataModel {
|
export class DhLevelOption extends foundry.abstract.DataModel {
|
||||||
static defineSchema() {
|
static defineSchema() {
|
||||||
const fields = foundry.data.fields;
|
const fields = foundry.data.fields;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: new fields.StringField({ required: true }),
|
label: new fields.StringField({
|
||||||
checkboxSelections: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
required: true,
|
||||||
minCost: new fields.NumberField({ required: true, integer: true, initial: 1 }),
|
label: 'DAGGERHEART.GENERAL.label'
|
||||||
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
}),
|
||||||
value: new fields.NumberField({ integer: true }),
|
checkboxSelections: new fields.NumberField({
|
||||||
amount: new fields.NumberField({ integer: true })
|
required: true,
|
||||||
|
integer: true,
|
||||||
|
initial: 1,
|
||||||
|
label: 'DAGGERHEART.CONFIG.LevelupData.checkboxSelections'
|
||||||
|
}),
|
||||||
|
minCost: new fields.NumberField({
|
||||||
|
required: true,
|
||||||
|
integer: true,
|
||||||
|
initial: 1,
|
||||||
|
label: 'DAGGERHEART.CONFIG.LevelupData.minCost'
|
||||||
|
}),
|
||||||
|
type: new fields.StringField({
|
||||||
|
required: true,
|
||||||
|
choices: LevelOptionType,
|
||||||
|
label: 'DAGGERHEART.GENERAL.type'
|
||||||
|
}),
|
||||||
|
subType: new fields.StringField({
|
||||||
|
nullable: true,
|
||||||
|
label: 'DAGGERHEART.GENERAL.subType'
|
||||||
|
}),
|
||||||
|
value: new fields.NumberField({
|
||||||
|
integer: true,
|
||||||
|
label: 'DAGGERHEART.GENERAL.value'
|
||||||
|
}),
|
||||||
|
amount: new fields.NumberField({
|
||||||
|
integer: true,
|
||||||
|
label: 'DAGGERHEART.GENERAL.amount'
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,6 +189,16 @@ export const LevelOptionType = {
|
||||||
id: 'multiclass',
|
id: 'multiclass',
|
||||||
label: 'Multiclass'
|
label: 'Multiclass'
|
||||||
},
|
},
|
||||||
|
dice: {
|
||||||
|
id: 'dice',
|
||||||
|
label: 'Increase Dice Size',
|
||||||
|
subTypes: {
|
||||||
|
hopeIndex: { key: 'hopeIndex', label: 'DAGGERHEART.GENERAL.hope' },
|
||||||
|
fearIndex: { key: 'fearIndex', label: 'DAGGERHEART.GENERAL.fear' },
|
||||||
|
advantageIndex: { key: 'advantageIndex', label: 'DAGGERHEART.GENERAL.Advantage.full' },
|
||||||
|
comboDieIndex: { key: 'comboDieIndex', label: 'Combo Die' } // Translation pending actual useage
|
||||||
|
}
|
||||||
|
},
|
||||||
...CompanionLevelOptionType
|
...CompanionLevelOptionType
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
checkboxSelections: new fields.NumberField({ required: true, integer: true }),
|
checkboxSelections: new fields.NumberField({ required: true, integer: true }),
|
||||||
minCost: new fields.NumberField({ required: true, integer: true }),
|
minCost: new fields.NumberField({ required: true, integer: true }),
|
||||||
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
type: new fields.StringField({ required: true, choices: LevelOptionType }),
|
||||||
|
subType: new fields.StringField({ nullable: true }),
|
||||||
value: new fields.NumberField({ integer: true }),
|
value: new fields.NumberField({ integer: true }),
|
||||||
amount: new fields.NumberField({ integer: true })
|
amount: new fields.NumberField({ integer: true })
|
||||||
})
|
})
|
||||||
|
|
@ -242,7 +243,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
const checkboxes = [...Array(option.checkboxSelections).keys()].flatMap(index => {
|
const checkboxes = [...Array(option.checkboxSelections).keys()].flatMap(index => {
|
||||||
const checkboxNr = index + 1;
|
const checkboxNr = index + 1;
|
||||||
const checkboxData = selections[tierKey]?.[optionKey]?.[checkboxNr];
|
const checkboxData = selections[tierKey]?.[optionKey]?.[checkboxNr];
|
||||||
const checkbox = { ...option, checkboxNr, tier: tierKey };
|
const checkbox = { ...option, checkboxNr, tier: tierKey, option: optionKey };
|
||||||
|
|
||||||
if (checkboxData) {
|
if (checkboxData) {
|
||||||
checkbox.level = checkboxData.level;
|
checkbox.level = checkboxData.level;
|
||||||
|
|
@ -343,7 +344,8 @@ export class DhLevelupLevel extends foundry.abstract.DataModel {
|
||||||
value: new fields.StringField(),
|
value: new fields.StringField(),
|
||||||
data: new fields.ArrayField(new fields.StringField()),
|
data: new fields.ArrayField(new fields.StringField()),
|
||||||
secondaryData: new fields.TypedObjectField(new fields.StringField()),
|
secondaryData: new fields.TypedObjectField(new fields.StringField()),
|
||||||
type: new fields.StringField({ required: true })
|
type: new fields.StringField({ required: true }),
|
||||||
|
subType: new fields.StringField({ nullable: true })
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@ export default class DualityRoll extends D20Roll {
|
||||||
this.rallyChoices = this.setRallyChoices();
|
this.rallyChoices = this.setRallyChoices();
|
||||||
this.guaranteedCritical = options.guaranteedCritical;
|
this.guaranteedCritical = options.guaranteedCritical;
|
||||||
|
|
||||||
const advantageFaces = data.rules?.roll?.defaultAdvantageDice
|
const advantageFaces = data.rules?.roll?.advantageFaces ? Number.parseInt(data.rules.roll.advantageFaces) : 6;
|
||||||
? Number.parseInt(data.rules.roll.defaultAdvantageDice)
|
|
||||||
: 6;
|
|
||||||
this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces;
|
this.advantageFaces = Number.isNaN(advantageFaces) ? 6 : advantageFaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ export const preloadHandlebarsTemplates = async function () {
|
||||||
'systems/daggerheart/templates/ui/itemBrowser/itemContainer.hbs',
|
'systems/daggerheart/templates/ui/itemBrowser/itemContainer.hbs',
|
||||||
'systems/daggerheart/templates/scene/dh-config.hbs',
|
'systems/daggerheart/templates/scene/dh-config.hbs',
|
||||||
'systems/daggerheart/templates/settings/appearance-settings/diceSoNiceTab.hbs',
|
'systems/daggerheart/templates/settings/appearance-settings/diceSoNiceTab.hbs',
|
||||||
'systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs'
|
'systems/daggerheart/templates/sheets/activeEffect/typeChanges/armorChange.hbs',
|
||||||
|
'systems/daggerheart/templates/dialogs/levelupOptionsDialog/parts/tier.hbs'
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -364,8 +364,8 @@
|
||||||
},
|
},
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"key": "system.rules.dualityRoll.defaultHopeDice",
|
"key": "system.rules.roll.hopeIndex",
|
||||||
"value": "d8",
|
"value": 2,
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"type": "override"
|
"type": "override"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -327,8 +327,8 @@
|
||||||
},
|
},
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"key": "system.rules.dualityRoll.defaultFearDice",
|
"key": "system.rules.roll.fearIndex",
|
||||||
"value": "d20",
|
"value": 5,
|
||||||
"priority": null,
|
"priority": null,
|
||||||
"type": "override"
|
"type": "override"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -192,9 +192,9 @@
|
||||||
},
|
},
|
||||||
"changes": [
|
"changes": [
|
||||||
{
|
{
|
||||||
"key": "system.rules.dualityRoll.defaultHopeDice",
|
"key": "system.rules.roll.hopeIndex",
|
||||||
"mode": 5,
|
"mode": 5,
|
||||||
"value": "d10",
|
"value": 3,
|
||||||
"priority": null
|
"priority": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -40,3 +40,4 @@
|
||||||
@import './character-reset/sheet.less';
|
@import './character-reset/sheet.less';
|
||||||
|
|
||||||
@import './compendiumBrowserPackDialog/sheet.less';
|
@import './compendiumBrowserPackDialog/sheet.less';
|
||||||
|
@import './levelup-options-dialog/sheet.less';
|
||||||
32
styles/less/dialog/levelup-options-dialog/sheet.less
Normal file
32
styles/less/dialog/levelup-options-dialog/sheet.less
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
.daggerheart.dh-style.dialog.levelup-options-dialog {
|
||||||
|
.dialog-title {
|
||||||
|
font-size: var(--font-size-32);
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-tools {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tier-container {
|
||||||
|
padding: 0 4px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
|
.tier-title {
|
||||||
|
font-size: var(--font-size-18);
|
||||||
|
color: light-dark(@dark-blue, @golden);
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
templates/dialogs/levelupOptionsDialog/header.hbs
Normal file
3
templates/dialogs/levelupOptionsDialog/header.hbs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div>
|
||||||
|
<div class="dialog-title">{{localize "Tiers"}}</div>
|
||||||
|
</div>
|
||||||
29
templates/dialogs/levelupOptionsDialog/parts/tier.hbs
Normal file
29
templates/dialogs/levelupOptionsDialog/parts/tier.hbs
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<section class="tab scrollable {{tab.cssClass}} {{tab.id}}" data-group="{{tab.group}}" data-tab="{{tab.id}}">
|
||||||
|
<div class="tier-tools">
|
||||||
|
<select class="option-type-select">
|
||||||
|
{{selectOptions optionTypes selected=selectedOption blank=""}}
|
||||||
|
</select>
|
||||||
|
<button data-action="addTierOption" data-tier="{{tab.tier}}" {{#unless selectedOption}}disabled{{/unless}}>{{localize "Add Levelup Option"}}</button>
|
||||||
|
</div>
|
||||||
|
{{#with (lookup levelupOptionTiers tab.tier)}}
|
||||||
|
{{#unless (empty this)}}
|
||||||
|
{{#each this as |option key|}}
|
||||||
|
<fieldset>
|
||||||
|
<legend><a data-action="removeTierOption" data-tier="{{../../tab.tier}}" data-key="{{key}}"><i class="fa-solid fa-trash"></i></a></legend>
|
||||||
|
|
||||||
|
<div class="tier-container">
|
||||||
|
{{formGroup @root.fields.label value=option.label name=(concat "system.levelupOptionTiers." ../../tab.tier "." key ".label") localize=true }}
|
||||||
|
{{formGroup @root.fields.type value=option.type name=(concat "system.levelupOptionTiers." ../../tab.tier "." key ".type") localize=true }}
|
||||||
|
<div class="nest-inputs">
|
||||||
|
{{formGroup @root.fields.checkboxSelections value=option.checkboxSelections name=(concat "system.levelupOptionTiers." ../../tab.tier "." key ".checkboxSelections") localize=true }}
|
||||||
|
{{formGroup @root.fields.minCost value=option.minCost name=(concat "system.levelupOptionTiers." ../../tab.tier "." key ".minCost") localize=true }}
|
||||||
|
{{#if option.typeData}}
|
||||||
|
{{formGroup @root.fields.subType value=option.subType name=(concat "system.levelupOptionTiers." ../../tab.tier "." key ".subType") choices=option.typeData.subTypes localize=true }}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
{{/each}}
|
||||||
|
{{/unless}}
|
||||||
|
{{/with}}
|
||||||
|
</section>
|
||||||
5
templates/dialogs/levelupOptionsDialog/tiers.hbs
Normal file
5
templates/dialogs/levelupOptionsDialog/tiers.hbs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<div>
|
||||||
|
{{> "systems/daggerheart/templates/dialogs/levelupOptionsDialog/parts/tier.hbs" tab=tabs.tier2}}
|
||||||
|
{{> "systems/daggerheart/templates/dialogs/levelupOptionsDialog/parts/tier.hbs" tab=tabs.tier3}}
|
||||||
|
{{> "systems/daggerheart/templates/dialogs/levelupOptionsDialog/parts/tier.hbs" tab=tabs.tier4}}
|
||||||
|
<div>
|
||||||
|
|
@ -19,12 +19,13 @@
|
||||||
type="checkbox" class="selection-checkbox{{#if (gt this.cost 1)}} multi{{/if}}" {{checked this.selected}} {{#if this.disabled}}disabled{{/if}}
|
type="checkbox" class="selection-checkbox{{#if (gt this.cost 1)}} multi{{/if}}" {{checked this.selected}} {{#if this.disabled}}disabled{{/if}}
|
||||||
data-tier="{{this.tier}}"
|
data-tier="{{this.tier}}"
|
||||||
data-level="{{this.level}}"
|
data-level="{{this.level}}"
|
||||||
data-option="{{this.type}}"
|
data-option="{{this.option}}"
|
||||||
data-checkbox-nr="{{this.checkboxNr}}"
|
data-checkbox-nr="{{this.checkboxNr}}"
|
||||||
data-cost="{{this.minCost}}"
|
data-cost="{{this.minCost}}"
|
||||||
data-amount="{{this.amount}}"
|
data-amount="{{this.amount}}"
|
||||||
data-value="{{this.value}}"
|
data-value="{{this.value}}"
|
||||||
data-type="{{this.type}}"
|
data-type="{{this.type}}"
|
||||||
|
data-sub-type="{{this.subType}}"
|
||||||
/>
|
/>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue