mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 04:01:06 +01:00
Merged with main
This commit is contained in:
commit
ed5c8bc826
36 changed files with 1117 additions and 835 deletions
|
|
@ -8,7 +8,7 @@ export { default as DhpAncestry } from './sheets/ancestry.mjs';
|
|||
export { default as DhpCommunity } from './sheets/community.mjs';
|
||||
export { default as DhpMiscellaneous } from './sheets/items/miscellaneous.mjs';
|
||||
export { default as DhpConsumable } from './sheets/items/consumable.mjs';
|
||||
export { default as DhpWeapon } from './sheets/weapon.mjs';
|
||||
export { default as DhpArmor } from './sheets/armor.mjs';
|
||||
export { default as DhpWeapon } from './sheets/items/weapon.mjs';
|
||||
export { default as DhpArmor } from './sheets/items/armor.mjs';
|
||||
export { default as DhpChatMessage } from './chatMessage.mjs';
|
||||
export { default as DhpEnvironment } from './sheets/environment.mjs';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { DualityRollColor } from '../config/settingsConfig.mjs';
|
||||
import DhpDualityRoll from '../data/dualityRoll.mjs';
|
||||
import { DualityRollColor } from '../data/settings/Appearance.mjs';
|
||||
|
||||
export default class DhpChatMesssage extends ChatMessage {
|
||||
async renderHTML() {
|
||||
|
|
@ -16,7 +16,7 @@ export default class DhpChatMesssage extends ChatMessage {
|
|||
const html = await super.renderHTML();
|
||||
if (
|
||||
this.type === 'dualityRoll' &&
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor) ===
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
||||
DualityRollColor.colorful.value
|
||||
) {
|
||||
html.classList.add('duality');
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ export default class DaggerheartActionConfig extends DaggerheartSheet(Applicatio
|
|||
}
|
||||
|
||||
static async updateForm(event, _, formData) {
|
||||
const data = foundry.utils.expandObject(foundry.utils.mergeObject(this.action.toObject(), formData.object));
|
||||
const data = foundry.utils.expandObject(
|
||||
foundry.utils.mergeObject(this.action.toObject(), foundry.utils.expandObject(formData.object))
|
||||
);
|
||||
const newActions = this.action.parent.actions.map(x => x.toObject());
|
||||
if (!newActions.findSplice(x => x.id === data.id, data)) {
|
||||
newActions.push(data);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import { DualityRollColor } from '../config/settingsConfig.mjs';
|
||||
import { defaultLevelTiers, DhLevelTiers } from '../data/levelTier.mjs';
|
||||
import DhAppearance from '../data/settings/Appearance.mjs';
|
||||
import DHAppearanceSettings from './settings/appearanceSettings.mjs';
|
||||
|
||||
class DhpAutomationSettings extends FormApplication {
|
||||
constructor(object = {}, options = {}) {
|
||||
|
|
@ -161,7 +163,7 @@ class DhpRangeSettings extends FormApplication {
|
|||
}
|
||||
}
|
||||
|
||||
export const registerDHPSettings = () => {
|
||||
export const registerDHSettings = () => {
|
||||
// const debouncedReload = foundry.utils.debounce(() => window.location.reload(), 100);
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.General.AbilityArray, {
|
||||
|
|
@ -216,14 +218,11 @@ export const registerDHPSettings = () => {
|
|||
}
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Name'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.DualityRollColor.Hint'),
|
||||
scope: 'world',
|
||||
config: true,
|
||||
type: Number,
|
||||
choices: Object.values(DualityRollColor),
|
||||
default: DualityRollColor.colorful.value
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, {
|
||||
scope: 'client',
|
||||
config: false,
|
||||
type: DhAppearance,
|
||||
default: DhAppearance.defaultSchema
|
||||
});
|
||||
|
||||
game.settings.register(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor, {
|
||||
|
|
@ -267,53 +266,13 @@ export const registerDHPSettings = () => {
|
|||
type: DhpRangeSettings,
|
||||
restricted: true
|
||||
});
|
||||
|
||||
game.settings.registerMenu(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, {
|
||||
name: game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.title'),
|
||||
label: game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.label'),
|
||||
hint: game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.hint'),
|
||||
icon: 'fa-solid fa-palette',
|
||||
type: DHAppearanceSettings,
|
||||
restricted: false
|
||||
});
|
||||
};
|
||||
|
||||
// const {HandlebarsApplicationMixin, ApplicationV2} = foundry.applications.api;
|
||||
|
||||
// export default class DhpSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
// constructor(actor, shortrest){
|
||||
// super({});
|
||||
|
||||
// this.actor = actor;
|
||||
// this.selectedActivity = null;
|
||||
// this.shortrest = shortrest;
|
||||
|
||||
// this.customActivity = SYSTEM.GENERAL.downtime.custom;
|
||||
// }
|
||||
|
||||
// get title(){
|
||||
// return game.i18n.localize("DAGGERHEART.Application.Settings.Title");
|
||||
// }
|
||||
|
||||
// static DEFAULT_OPTIONS = {
|
||||
// tag: 'form',
|
||||
// classes: ["daggerheart", "application", "settings"],
|
||||
// position: { width: 800, height: 'auto' },
|
||||
// actions: {
|
||||
// selectActivity: this.selectActivity,
|
||||
// },
|
||||
// form: { handler: this.updateData }
|
||||
// };
|
||||
|
||||
// static PARTS = {
|
||||
// application: {
|
||||
// id: "settings",
|
||||
// template: "systems/daggerheart/templates/application/settings.hbs"
|
||||
// }
|
||||
// }
|
||||
|
||||
// async _prepareContext(_options) {
|
||||
// const context = await super._prepareContext(_options);
|
||||
|
||||
// return context;
|
||||
// }
|
||||
|
||||
// static async updateData(event, element, formData){
|
||||
// this.render();
|
||||
// }
|
||||
|
||||
// static close(){
|
||||
// super.close();
|
||||
// }
|
||||
// }
|
||||
|
|
|
|||
59
module/applications/settings/appearanceSettings.mjs
Normal file
59
module/applications/settings/appearanceSettings.mjs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import DhAppearance from '../../data/settings/Appearance.mjs';
|
||||
|
||||
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
|
||||
|
||||
export default class DHAppearanceSettings extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor() {
|
||||
super({});
|
||||
|
||||
this.settings = new DhAppearance(
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).toObject()
|
||||
);
|
||||
}
|
||||
|
||||
get title() {
|
||||
return game.i18n.localize('DAGGERHEART.Settings.Menu.Appearance.name');
|
||||
}
|
||||
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
id: 'daggerheart-appearance-settings',
|
||||
classes: ['daggerheart', 'setting', 'dh-style'],
|
||||
position: { width: '600', height: 'auto' },
|
||||
actions: {
|
||||
reset: this.reset,
|
||||
save: this.save
|
||||
},
|
||||
form: { handler: this.updateData, submitOnChange: true }
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: 'systems/daggerheart/templates/settings/appearance-settings.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.settingFields = this.settings;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static async updateData(event, element, formData) {
|
||||
const updatedSettings = foundry.utils.expandObject(formData.object);
|
||||
|
||||
await this.settings.updateSource(updatedSettings);
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async reset() {
|
||||
this.settings = new DhAppearance();
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async save() {
|
||||
await game.settings.set(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance, this.settings.toObject());
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
// import DhpApplicationMixin from '../daggerheart-sheet.mjs';
|
||||
|
||||
// export default class ArmorSheet extends DhpApplicationMixin(ItemSheet) {
|
||||
// static documentType = "armor";
|
||||
|
||||
// /** @override */
|
||||
// static get defaultOptions() {
|
||||
// return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
// classes: ["daggerheart", "sheet", "armor"],
|
||||
// width: 400,
|
||||
// height: 'auto',
|
||||
// });
|
||||
// }
|
||||
|
||||
// /** @override */
|
||||
// getData() {
|
||||
// const context = super.getData();
|
||||
// context.config = CONFIG.daggerheart;
|
||||
|
||||
// return context;
|
||||
// }
|
||||
|
||||
// async _handleAction(action, event, button) {
|
||||
// switch(action){
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
import DaggerheartSheet from './daggerheart-sheet.mjs';
|
||||
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
export default class ArmorSheet extends DaggerheartSheet(ItemSheetV2) {
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'sheet', 'armor'],
|
||||
position: { width: 400 },
|
||||
form: {
|
||||
handler: this.updateForm,
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
},
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }]
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
form: {
|
||||
id: 'feature',
|
||||
template: 'systems/daggerheart/templates/sheets/armor.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.document = this.document;
|
||||
context.config = CONFIG.daggerheart;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static async updateForm(event, _, formData) {
|
||||
await this.document.update(formData.object);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
59
module/applications/sheets/items/armor.mjs
Normal file
59
module/applications/sheets/items/armor.mjs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import DaggerheartSheet from '../daggerheart-sheet.mjs';
|
||||
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
export default class ArmorSheet extends DaggerheartSheet(ItemSheetV2) {
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'sheet', 'dh-style', 'armor'],
|
||||
position: { width: 600 },
|
||||
form: {
|
||||
handler: this.updateForm,
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
},
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }]
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
header: { template: 'systems/daggerheart/templates/sheets/items/armor/header.hbs' },
|
||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||
settings: {
|
||||
template: 'systems/daggerheart/templates/sheets/items/armor/settings.hbs',
|
||||
scrollable: ['.settings']
|
||||
}
|
||||
};
|
||||
|
||||
static TABS = {
|
||||
description: {
|
||||
active: true,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'description',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.Sheets.Feature.Tabs.Description'
|
||||
},
|
||||
settings: {
|
||||
active: false,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'settings',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.document = this.document;
|
||||
context.config = CONFIG.daggerheart;
|
||||
context.tabs = super._getTabs(this.constructor.TABS);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static async updateForm(event, _, formData) {
|
||||
await this.document.update(formData.object);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
58
module/applications/sheets/items/weapon.mjs
Normal file
58
module/applications/sheets/items/weapon.mjs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import DaggerheartSheet from '../daggerheart-sheet.mjs';
|
||||
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
export default class WeaponSheet extends DaggerheartSheet(ItemSheetV2) {
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'sheet', 'dh-style', 'weapon'],
|
||||
position: { width: 600 },
|
||||
form: {
|
||||
handler: this.updateForm,
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
}
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
header: { template: 'systems/daggerheart/templates/sheets/items/weapon/header.hbs' },
|
||||
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
|
||||
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
|
||||
settings: {
|
||||
template: 'systems/daggerheart/templates/sheets/items/weapon/settings.hbs',
|
||||
scrollable: ['.settings']
|
||||
}
|
||||
};
|
||||
|
||||
static TABS = {
|
||||
description: {
|
||||
active: true,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'description',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.Sheets.Feature.Tabs.Description'
|
||||
},
|
||||
settings: {
|
||||
active: false,
|
||||
cssClass: '',
|
||||
group: 'primary',
|
||||
id: 'settings',
|
||||
icon: null,
|
||||
label: 'DAGGERHEART.Sheets.Feature.Tabs.Settings'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.document = this.document;
|
||||
context.config = CONFIG.daggerheart;
|
||||
context.tabs = super._getTabs(this.constructor.TABS);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static async updateForm(event, _, formData) {
|
||||
await this.document.update(formData.object);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
|
@ -489,7 +489,7 @@ export default class PCSheet extends DaggerheartSheet(ActorSheetV2) {
|
|||
|
||||
static async rollAttribute(event, button) {
|
||||
const { roll, hope, fear, advantage, disadvantage, modifiers } = await this.document.dualityRoll(
|
||||
{ title: 'Attribute Bonus', value: button.dataset.value },
|
||||
{ title: game.i18n.localize(abilities[button.dataset.attribute].label), value: button.dataset.value },
|
||||
event.shiftKey
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
// import DhpApplicationMixin from '../daggerheart-sheet.mjs';
|
||||
|
||||
// export default class WeaponSheet extends DhpApplicationMixin(ItemSheet) {
|
||||
// static documentType = "weapon";
|
||||
|
||||
// /** @override */
|
||||
// static get defaultOptions() {
|
||||
// return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
// classes: ["daggerheart", "sheet", "weapon"],
|
||||
// width: 400,
|
||||
// height: 'auto',
|
||||
// });
|
||||
// }
|
||||
|
||||
// /** @override */
|
||||
// getData() {
|
||||
// const context = super.getData();
|
||||
// context.config = CONFIG.daggerheart;
|
||||
|
||||
// return context;
|
||||
// }
|
||||
|
||||
// async _handleAction(action, event, button) {
|
||||
// switch(action){
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
import DaggerheartSheet from './daggerheart-sheet.mjs';
|
||||
|
||||
const { ItemSheetV2 } = foundry.applications.sheets;
|
||||
export default class WeaponSheet extends DaggerheartSheet(ItemSheetV2) {
|
||||
static DEFAULT_OPTIONS = {
|
||||
tag: 'form',
|
||||
classes: ['daggerheart', 'sheet', 'weapon'],
|
||||
position: { width: 400 },
|
||||
form: {
|
||||
handler: this.updateForm,
|
||||
submitOnChange: true,
|
||||
closeOnSubmit: false
|
||||
}
|
||||
};
|
||||
|
||||
static PARTS = {
|
||||
form: {
|
||||
id: 'feature',
|
||||
template: 'systems/daggerheart/templates/sheets/weapon.hbs'
|
||||
}
|
||||
};
|
||||
|
||||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.document = this.document;
|
||||
context.config = CONFIG.daggerheart;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
static async updateForm(event, _, formData) {
|
||||
await this.document.update(formData.object);
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,77 +1,77 @@
|
|||
export const abilities = {
|
||||
agility: {
|
||||
label: 'DAGGERHEART.Abilities.Agility.Name',
|
||||
label: 'DAGGERHEART.Abilities.agility.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.Agility.Verb.Sprint',
|
||||
'DAGGERHEART.Abilities.Agility.Verb.Leap',
|
||||
'DAGGERHEART.Abilities.Agility.Verb.Maneuver'
|
||||
'DAGGERHEART.Abilities.agility.verb.sprint',
|
||||
'DAGGERHEART.Abilities.agility.verb.leap',
|
||||
'DAGGERHEART.Abilities.agility.verb.maneuver'
|
||||
]
|
||||
},
|
||||
strength: {
|
||||
label: 'DAGGERHEART.Abilities.Strength.Name',
|
||||
label: 'DAGGERHEART.Abilities.strength.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.Strength.Verb.Lift',
|
||||
'DAGGERHEART.Abilities.Strength.Verb.Smash',
|
||||
'DAGGERHEART.Abilities.Strength.Verb.Grapple'
|
||||
'DAGGERHEART.Abilities.strength.verb.lift',
|
||||
'DAGGERHEART.Abilities.strength.verb.smash',
|
||||
'DAGGERHEART.Abilities.strength.verb.grapple'
|
||||
]
|
||||
},
|
||||
finesse: {
|
||||
label: 'DAGGERHEART.Abilities.Finesse.Name',
|
||||
label: 'DAGGERHEART.Abilities.finesse.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.Finesse.Verb.Control',
|
||||
'DAGGERHEART.Abilities.Finesse.Verb.Hide',
|
||||
'DAGGERHEART.Abilities.Finesse.Verb.Tinker'
|
||||
'DAGGERHEART.Abilities.finesse.verb.control',
|
||||
'DAGGERHEART.Abilities.finesse.verb.hide',
|
||||
'DAGGERHEART.Abilities.finesse.verb.tinker'
|
||||
]
|
||||
},
|
||||
instinct: {
|
||||
label: 'DAGGERHEART.Abilities.Instinct.Name',
|
||||
label: 'DAGGERHEART.Abilities.instinct.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.Instinct.Verb.Perceive',
|
||||
'DAGGERHEART.Abilities.Instinct.Verb.Sense',
|
||||
'DAGGERHEART.Abilities.Instinct.Verb.Navigate'
|
||||
'DAGGERHEART.Abilities.instinct.verb.perceive',
|
||||
'DAGGERHEART.Abilities.instinct.verb.sense',
|
||||
'DAGGERHEART.Abilities.instinct.verb.navigate'
|
||||
]
|
||||
},
|
||||
presence: {
|
||||
label: 'DAGGERHEART.Abilities.Presence.Name',
|
||||
label: 'DAGGERHEART.Abilities.presence.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.Presence.Verb.Charm',
|
||||
'DAGGERHEART.Abilities.Presence.Verb.Perform',
|
||||
'DAGGERHEART.Abilities.Presence.Verb.Deceive'
|
||||
'DAGGERHEART.Abilities.presence.verb.charm',
|
||||
'DAGGERHEART.Abilities.presence.verb.perform',
|
||||
'DAGGERHEART.Abilities.presence.verb.deceive'
|
||||
]
|
||||
},
|
||||
knowledge: {
|
||||
label: 'DAGGERHEART.Abilities.Knowledge.Name',
|
||||
label: 'DAGGERHEART.Abilities.knowledge.name',
|
||||
verbs: [
|
||||
'DAGGERHEART.Abilities.Knowledge.Verb.Recall',
|
||||
'DAGGERHEART.Abilities.Knowledge.Verb.Analyze',
|
||||
'DAGGERHEART.Abilities.Knowledge.Verb.Comprehend'
|
||||
'DAGGERHEART.Abilities.knowledge.verb.recall',
|
||||
'DAGGERHEART.Abilities.knowledge.verb.analyze',
|
||||
'DAGGERHEART.Abilities.knowledge.verb.comprehend'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
export const featureProperties = {
|
||||
agility: {
|
||||
name: 'DAGGERHEART.Abilities.Agility.Name',
|
||||
name: 'DAGGERHEART.Abilities.agility.name',
|
||||
path: actor => actor.system.traits.agility.data.value
|
||||
},
|
||||
strength: {
|
||||
name: 'DAGGERHEART.Abilities.Strength.Name',
|
||||
name: 'DAGGERHEART.Abilities.strength.name',
|
||||
path: actor => actor.system.traits.strength.data.value
|
||||
},
|
||||
finesse: {
|
||||
name: 'DAGGERHEART.Abilities.Finesse.Name',
|
||||
name: 'DAGGERHEART.Abilities.finesse.name',
|
||||
path: actor => actor.system.traits.finesse.data.value
|
||||
},
|
||||
instinct: {
|
||||
name: 'DAGGERHEART.Abilities.Instinct.Name',
|
||||
name: 'DAGGERHEART.Abilities.instinct.name',
|
||||
path: actor => actor.system.traits.instinct.data.value
|
||||
},
|
||||
presence: {
|
||||
name: 'DAGGERHEART.Abilities.Presence.Name',
|
||||
name: 'DAGGERHEART.Abilities.presence.name',
|
||||
path: actor => actor.system.traits.presence.data.value
|
||||
},
|
||||
knowledge: {
|
||||
name: 'DAGGERHEART.Abilities.Knowledge.Name',
|
||||
name: 'DAGGERHEART.Abilities.knowledge.name',
|
||||
path: actor => actor.system.traits.knowledge.data.value
|
||||
},
|
||||
spellcastingTrait: {
|
||||
|
|
|
|||
|
|
@ -1,27 +1,27 @@
|
|||
export const range = {
|
||||
melee: {
|
||||
label: 'DAGGERHEART.Range.Melee.Name',
|
||||
description: 'DAGGERHEART.Range.Melee.Description',
|
||||
label: 'DAGGERHEART.Range.melee.name',
|
||||
description: 'DAGGERHEART.Range.melee.description',
|
||||
distance: 1
|
||||
},
|
||||
veryClose: {
|
||||
label: 'DAGGERHEART.Range.VeryClose.Name',
|
||||
description: 'DAGGERHEART.Range.VeryClose.Description',
|
||||
label: 'DAGGERHEART.Range.veryClose.name',
|
||||
description: 'DAGGERHEART.Range.veryClose.description',
|
||||
distance: 3
|
||||
},
|
||||
close: {
|
||||
label: 'DAGGERHEART.Range.Close.Name',
|
||||
description: 'DAGGERHEART.Range.Close.Description',
|
||||
label: 'DAGGERHEART.Range.close.name',
|
||||
description: 'DAGGERHEART.Range.close.description',
|
||||
distance: 10
|
||||
},
|
||||
far: {
|
||||
label: 'DAGGERHEART.Range.Far.Name',
|
||||
description: 'DAGGERHEART.Range.Far.Description',
|
||||
label: 'DAGGERHEART.Range.far.name',
|
||||
description: 'DAGGERHEART.Range.far.description',
|
||||
distance: 20
|
||||
},
|
||||
veryFar: {
|
||||
label: 'DAGGERHEART.Range.VeryFar.Name',
|
||||
description: 'DAGGERHEART.Range.VeryFar.Description',
|
||||
label: 'DAGGERHEART.Range.veryFar.name',
|
||||
description: 'DAGGERHEART.Range.veryFar.description',
|
||||
distance: 30
|
||||
}
|
||||
};
|
||||
|
|
@ -29,24 +29,24 @@ export const range = {
|
|||
export const burden = {
|
||||
oneHanded: {
|
||||
value: 'oneHanded',
|
||||
label: 'DAGGERHEART.Burden.OneHanded'
|
||||
label: 'DAGGERHEART.Burden.oneHanded'
|
||||
},
|
||||
twoHanded: {
|
||||
value: 'twoHanded',
|
||||
label: 'DAGGERHEART.Burden.TwoHanded'
|
||||
label: 'DAGGERHEART.Burden.twoHanded'
|
||||
}
|
||||
};
|
||||
|
||||
export const damageTypes = {
|
||||
physical: {
|
||||
id: 'physical',
|
||||
label: 'DAGGERHEART.DamageType.Physical.Name',
|
||||
abbreviation: 'DAGGERHEART.DamageType.Physical.Abbreviation'
|
||||
label: 'DAGGERHEART.DamageType.physical.name',
|
||||
abbreviation: 'DAGGERHEART.DamageType.physical.abbreviation'
|
||||
},
|
||||
magical: {
|
||||
id: 'magical',
|
||||
label: 'DAGGERHEART.DamageType.Magical.Name',
|
||||
abbreviation: 'DAGGERHEART.DamageType.Magical.Abbreviation'
|
||||
label: 'DAGGERHEART.DamageType.magical.name',
|
||||
abbreviation: 'DAGGERHEART.DamageType.magical.abbreviation'
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -247,6 +247,45 @@ export const diceTypes = {
|
|||
d20: 'd20'
|
||||
};
|
||||
|
||||
export const getDiceSoNicePresets = () => {
|
||||
const { diceSoNice } = game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance);
|
||||
|
||||
return {
|
||||
hope: {
|
||||
...diceSoNice.hope,
|
||||
colorset: 'inspired',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
fear: {
|
||||
...diceSoNice.fear,
|
||||
colorset: 'bloodmoon',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
advantage: {
|
||||
...diceSoNice.advantage,
|
||||
colorset: 'bloodmoon',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
},
|
||||
disadvantage: {
|
||||
...diceSoNice.disadvantage,
|
||||
colorset: 'bloodmoon',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const refreshTypes = {
|
||||
session: {
|
||||
id: 'session',
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ export const gameSettings = {
|
|||
RangeMeasurement: 'RangeMeasurement'
|
||||
},
|
||||
DualityRollColor: 'DualityRollColor',
|
||||
LevelTiers: 'LevelTiers'
|
||||
LevelTiers: 'LevelTiers',
|
||||
appearance: 'Appearance'
|
||||
};
|
||||
|
||||
export const DualityRollColor = {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ export default class DhpArmor extends foundry.abstract.TypeDataModel {
|
|||
const fields = foundry.data.fields;
|
||||
return {
|
||||
equipped: new fields.BooleanField({ initial: false }),
|
||||
baseScore: new fields.NumberField({ initial: 1, integer: true }),
|
||||
baseScore: new fields.NumberField({ integer: true, initial: 0 }),
|
||||
feature: new fields.StringField({
|
||||
choices: SYSTEM.ITEM.armorFeatures,
|
||||
integer: false,
|
||||
|
|
@ -14,10 +14,10 @@ export default class DhpArmor extends foundry.abstract.TypeDataModel {
|
|||
value: new fields.NumberField({ initial: 0, integer: true })
|
||||
}),
|
||||
baseThresholds: new fields.SchemaField({
|
||||
major: new fields.NumberField({ initial: 0, integer: true }),
|
||||
severe: new fields.NumberField({ initial: 0, integer: true })
|
||||
major: new fields.NumberField({ integer: true, initial: 0 }),
|
||||
severe: new fields.NumberField({ integer: true, initial: 0 })
|
||||
}),
|
||||
quantity: new fields.NumberField({ initial: 1, integer: true }),
|
||||
quantity: new fields.NumberField({ integer: true, initial: 1 }),
|
||||
description: new fields.HTMLField({})
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { DualityRollColor } from '../config/settingsConfig.mjs';
|
||||
import { DualityRollColor } from './settings/Appearance.mjs';
|
||||
|
||||
const fields = foundry.data.fields;
|
||||
const diceField = () =>
|
||||
|
|
@ -81,7 +81,7 @@ export default class DhpDualityRoll extends foundry.abstract.TypeDataModel {
|
|||
const total = this.modifiers.reduce((acc, x) => acc + x.value, 0);
|
||||
return {
|
||||
value: total,
|
||||
label: total > 0 ? `+${total}` : total < 0 ? `-${total}` : ''
|
||||
label: total > 0 ? `+${total}` : total < 0 ? `${total}` : ''
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ export default class DhpDualityRoll extends foundry.abstract.TypeDataModel {
|
|||
|
||||
get colorful() {
|
||||
return (
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.DualityRollColor) ===
|
||||
game.settings.get(SYSTEM.id, SYSTEM.SETTINGS.gameSettings.appearance).dualityColorScheme ===
|
||||
DualityRollColor.colorful.value
|
||||
);
|
||||
}
|
||||
|
|
|
|||
51
module/data/settings/Appearance.mjs
Normal file
51
module/data/settings/Appearance.mjs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
export default class DhAppearance extends foundry.abstract.DataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
return {
|
||||
dualityColorScheme: new fields.StringField({
|
||||
required: true,
|
||||
choices: DualityRollColor,
|
||||
initial: DualityRollColor.normal.value
|
||||
}),
|
||||
diceSoNice: new fields.SchemaField({
|
||||
hope: new fields.SchemaField({
|
||||
foreground: new fields.ColorField({ required: true, initial: '#ffffff' }),
|
||||
background: new fields.ColorField({ required: true, initial: '#ffe760' }),
|
||||
outline: new fields.ColorField({ required: true, initial: '#000000' }),
|
||||
edge: new fields.ColorField({ required: true, initial: '#ffffff' })
|
||||
}),
|
||||
fear: new fields.SchemaField({
|
||||
foreground: new fields.ColorField({ required: true, initial: '#000000' }),
|
||||
background: new fields.ColorField({ required: true, initial: '#0032b1' }),
|
||||
outline: new fields.ColorField({ required: true, initial: '#ffffff' }),
|
||||
edge: new fields.ColorField({ required: true, initial: '#000000' })
|
||||
}),
|
||||
advantage: new fields.SchemaField({
|
||||
foreground: new fields.ColorField({ required: true, initial: '#ffffff' }),
|
||||
background: new fields.ColorField({ required: true, initial: '#008000' }),
|
||||
outline: new fields.ColorField({ required: true, initial: '#000000' }),
|
||||
edge: new fields.ColorField({ required: true, initial: '#ffffff' })
|
||||
}),
|
||||
disadvantage: new fields.SchemaField({
|
||||
foreground: new fields.ColorField({ required: true, initial: '#000000' }),
|
||||
background: new fields.ColorField({ required: true, initial: '#b30000' }),
|
||||
outline: new fields.ColorField({ required: true, initial: '#ffffff' }),
|
||||
edge: new fields.ColorField({ required: true, initial: '#000000' })
|
||||
})
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
static defaultSchema = {};
|
||||
}
|
||||
|
||||
export const DualityRollColor = {
|
||||
colorful: {
|
||||
value: 'colorful',
|
||||
label: 'DAGGERHEART.Settings.DualityRollColor.Options.Colorful'
|
||||
},
|
||||
normal: {
|
||||
value: 'normal',
|
||||
label: 'DAGGERHEART.Settings.DualityRollColor.Options.Normal'
|
||||
}
|
||||
};
|
||||
|
|
@ -5,13 +5,17 @@ export default class DhpWeapon extends foundry.abstract.TypeDataModel {
|
|||
equipped: new fields.BooleanField({ initial: false }),
|
||||
inventoryWeapon: new fields.NumberField({ initial: null, nullable: true, integer: true }),
|
||||
secondary: new fields.BooleanField({ initial: false }),
|
||||
trait: new fields.StringField({ choices: SYSTEM.ACTOR.abilities, integer: false }),
|
||||
range: new fields.StringField({ choices: SYSTEM.GENERAL.range, integer: false }),
|
||||
trait: new fields.StringField({ choices: SYSTEM.ACTOR.abilities, integer: false, initial: 'agility' }),
|
||||
range: new fields.StringField({ choices: SYSTEM.GENERAL.range, integer: false, initial: 'melee' }),
|
||||
damage: new fields.SchemaField({
|
||||
value: new fields.StringField({}),
|
||||
type: new fields.StringField({ choices: SYSTEM.GENERAL.damageTypes, integer: false })
|
||||
value: new fields.StringField({ initial: 'd6' }),
|
||||
type: new fields.StringField({
|
||||
choices: SYSTEM.GENERAL.damageTypes,
|
||||
integer: false,
|
||||
initial: 'physical'
|
||||
})
|
||||
}),
|
||||
burden: new fields.StringField({ choices: SYSTEM.GENERAL.burden, integer: false }),
|
||||
burden: new fields.StringField({ choices: SYSTEM.GENERAL.burden, integer: false, initial: 'oneHanded' }),
|
||||
feature: new fields.StringField({ choices: SYSTEM.ITEM.weaponFeatures, integer: false, blank: true }),
|
||||
quantity: new fields.NumberField({ initial: 1, integer: true }),
|
||||
description: new fields.HTMLField({})
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import DamageSelectionDialog from '../applications/damageSelectionDialog.mjs';
|
|||
import NpcRollSelectionDialog from '../applications/npcRollSelectionDialog.mjs';
|
||||
import RollSelectionDialog from '../applications/rollSelectionDialog.mjs';
|
||||
import { GMUpdateEvent, socketEvent } from '../helpers/socket.mjs';
|
||||
import { setDiceSoNiceForDualityRoll } from '../helpers/utils.mjs';
|
||||
|
||||
export default class DhpActor extends Actor {
|
||||
_preCreate(data, changes, user) {
|
||||
|
|
@ -116,16 +117,19 @@ export default class DhpActor extends Actor {
|
|||
disadvantageDice = null,
|
||||
bonusDamageString = '';
|
||||
|
||||
const modifiers = [
|
||||
{
|
||||
value: modifier.value ? Number.parseInt(modifier.value) : 0,
|
||||
label:
|
||||
modifier.value >= 0
|
||||
? `${modifier.title} +${modifier.value}`
|
||||
: `${modifier.title} -${modifier.value}`,
|
||||
title: modifier.title
|
||||
}
|
||||
];
|
||||
const modifiers =
|
||||
modifier.value !== null
|
||||
? [
|
||||
{
|
||||
value: modifier.value ? Number.parseInt(modifier.value) : 0,
|
||||
label:
|
||||
modifier.value >= 0
|
||||
? `${modifier.title} +${modifier.value}`
|
||||
: `${modifier.title} ${modifier.value}`,
|
||||
title: modifier.title
|
||||
}
|
||||
]
|
||||
: [];
|
||||
if (!shiftKey) {
|
||||
const dialogClosed = new Promise((resolve, _) => {
|
||||
new RollSelectionDialog(
|
||||
|
|
@ -161,53 +165,7 @@ export default class DhpActor extends Actor {
|
|||
`1${hopeDice} + 1${fearDice}${advantageDice ? ` + 1${advantageDice}` : disadvantageDice ? ` - 1${disadvantageDice}` : ''} ${modifiers.map(x => `+ ${x.value}`).join(' ')}`
|
||||
);
|
||||
let rollResult = await roll.evaluate();
|
||||
rollResult.dice[0].options.appearance = {
|
||||
colorset: 'inspired',
|
||||
foreground: '#FFFFFF',
|
||||
background: '#008080',
|
||||
outline: '#000000',
|
||||
edge: '#806400',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
if (advantageDice || disadvantageDice) {
|
||||
rollResult.dice[1].options.appearance = {
|
||||
colorset: 'inspired',
|
||||
foreground: disadvantageDice ? '#b30000' : '#FFFFFF',
|
||||
background: '#008080',
|
||||
outline: disadvantageDice ? '#000000' : '#000000',
|
||||
edge: '#806400',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
rollResult.dice[2].options.appearance = {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#000000',
|
||||
background: '#430070',
|
||||
outline: '#b30000',
|
||||
edge: '#000000',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
} else {
|
||||
rollResult.dice[1].options.appearance = {
|
||||
colorset: 'bloodmoon',
|
||||
foreground: '#000000',
|
||||
background: '#430070',
|
||||
outline: '#b30000',
|
||||
edge: '#000000',
|
||||
texture: 'bloodmoon',
|
||||
material: 'metal',
|
||||
font: 'Arial Black',
|
||||
system: 'standard'
|
||||
};
|
||||
}
|
||||
setDiceSoNiceForDualityRoll(rollResult, advantageDice, disadvantageDice);
|
||||
|
||||
const hope = rollResult.dice[0].results[0].result;
|
||||
const fear = rollResult.dice[1].results[0].result;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import { diceSoNicePresets, getDiceSoNicePresets } from '../config/generalConfig.mjs';
|
||||
|
||||
export const loadCompendiumOptions = async compendiums => {
|
||||
const compendiumValues = [];
|
||||
|
||||
|
|
@ -118,3 +120,14 @@ export const getCommandTarget = () => {
|
|||
|
||||
return target;
|
||||
};
|
||||
|
||||
export const setDiceSoNiceForDualityRoll = (rollResult, advantage, disadvantage) => {
|
||||
const diceSoNicePresets = getDiceSoNicePresets();
|
||||
rollResult.dice[0].options.appearance = diceSoNicePresets.hope;
|
||||
rollResult.dice[1].options.appearance = diceSoNicePresets.fear;
|
||||
if (advantage) {
|
||||
rollResult.dice[2].options.appearance = diceSoNicePresets.advantage;
|
||||
} else if (disadvantage) {
|
||||
rollResult.dice[2].options.appearance = diceSoNicePresets.disadvantage;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue