mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Cleaned up rollSelectionDialog.mjs
This commit is contained in:
parent
5a501d6769
commit
76674f0bf5
1 changed files with 1 additions and 132 deletions
|
|
@ -62,7 +62,7 @@ export default class RollSelectionDialog extends HandlebarsApplicationMixin(Appl
|
||||||
};
|
};
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
return `Roll Options`;
|
return game.i18n.localize('DAGGERHEART.Application.RollSelection.Title');
|
||||||
}
|
}
|
||||||
|
|
||||||
async _prepareContext(_options) {
|
async _prepareContext(_options) {
|
||||||
|
|
@ -157,134 +157,3 @@ export default class RollSelectionDialog extends HandlebarsApplicationMixin(Appl
|
||||||
this.close();
|
this.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// V1.3
|
|
||||||
// const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
|
||||||
|
|
||||||
// export default class RollSelectionDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
|
||||||
// constructor(experiences, bonusDamage, hopeResource, resolve, isNpc){
|
|
||||||
// super({}, {});
|
|
||||||
|
|
||||||
// this.experiences = experiences;
|
|
||||||
// this.resolve = resolve;
|
|
||||||
// this.isNpc;
|
|
||||||
// this.selectedExperiences = [];
|
|
||||||
// this.data = {
|
|
||||||
// diceOptions: [{ name: 'd12', value: 'd12' }, { name: 'd20', value: 'd20' }],
|
|
||||||
// hope: ['d12'],
|
|
||||||
// fear: ['d12'],
|
|
||||||
// advantage: null,
|
|
||||||
// disadvantage: null,
|
|
||||||
// bonusDamage: bonusDamage.reduce((acc, x) => {
|
|
||||||
// if(x.appliesOn === SYSTEM.EFFECTS.applyLocations.attackRoll.id){
|
|
||||||
// acc.push(({
|
|
||||||
// ...x,
|
|
||||||
// hopeUses: 0
|
|
||||||
// }));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return acc;
|
|
||||||
// }, []),
|
|
||||||
// hopeResource: hopeResource,
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static DEFAULT_OPTIONS = {
|
|
||||||
// tag: 'form',
|
|
||||||
// classes: ["daggerheart", "views", "roll-selection"],
|
|
||||||
// position: {
|
|
||||||
// width: 400,
|
|
||||||
// height: "auto"
|
|
||||||
// },
|
|
||||||
// actions: {
|
|
||||||
// selectExperience: this.selectExperience,
|
|
||||||
// decreaseHopeUse: this.decreaseHopeUse,
|
|
||||||
// increaseHopeUse: this.increaseHopeUse,
|
|
||||||
// finish: this.finish,
|
|
||||||
// },
|
|
||||||
// form: {
|
|
||||||
// handler: this.updateSelection,
|
|
||||||
// submitOnChange: true,
|
|
||||||
// closeOnSubmit: false,
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /** @override */
|
|
||||||
// static PARTS = {
|
|
||||||
// damageSelection: {
|
|
||||||
// id: "damageSelection",
|
|
||||||
// template: "systems/daggerheart/templates/views/rollSelection.hbs"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// get title() {
|
|
||||||
// return `Roll Options`;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async _prepareContext(_options) {
|
|
||||||
// const context = await super._prepareContext(_options);
|
|
||||||
// context.isNpc = this.isNpc;
|
|
||||||
// context.diceOptions = this.data.diceOptions;
|
|
||||||
// context.hope = this.data.hope;
|
|
||||||
// context.fear = this.data.fear;
|
|
||||||
// context.advantage = this.data.advantage;
|
|
||||||
// context.disadvantage = this.data.disadvantage;
|
|
||||||
// context.experiences = this.experiences.map(x => ({ ...x, selected: this.selectedExperiences.find(selected => selected.id === x.id) }));
|
|
||||||
// context.bonusDamage = this.data.bonusDamage;
|
|
||||||
// context.hopeResource = this.data.hopeResource+1;
|
|
||||||
// context.hopeUsed = this.getHopeUsed();
|
|
||||||
|
|
||||||
// return context;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static updateSelection(event, _, formData){
|
|
||||||
// const { bonusDamage, ...rest } = foundry.utils.expandObject(formData.object);
|
|
||||||
|
|
||||||
// for(var index in bonusDamage){
|
|
||||||
// this.data.bonusDamage[index].initiallySelected = bonusDamage[index].initiallySelected;
|
|
||||||
// if(bonusDamage[index].hopeUses){
|
|
||||||
// const value = Number.parseInt(bonusDamage[index].hopeUses);
|
|
||||||
// if(!Number.isNaN(value)) this.data.bonusDamage[index].hopeUses = value;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.data = foundry.utils.mergeObject(this.data, rest);
|
|
||||||
// this.render(true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static selectExperience(_, button){
|
|
||||||
// if(this.selectedExperiences.find(x => x.id === button.dataset.key)){
|
|
||||||
// this.selectedExperiences = this.selectedExperiences.filter(x => x.id !== button.dataset.key);
|
|
||||||
// } else {
|
|
||||||
// this.selectedExperiences = [...this.selectedExperiences, this.experiences.find(x => x.id === button.dataset.key)];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.render();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// getHopeUsed(){
|
|
||||||
// return this.data.bonusDamage.reduce((acc, x) => acc+x.hopeUses, 0);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static decreaseHopeUse(_, button){
|
|
||||||
// const index = Number.parseInt(button.dataset.index);
|
|
||||||
// if(this.data.bonusDamage[index].hopeUses - 1 >= 0) {
|
|
||||||
// this.data.bonusDamage[index].hopeUses -= 1;
|
|
||||||
// this.render(true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static increaseHopeUse(_, button){
|
|
||||||
// const index = Number.parseInt(button.dataset.index);
|
|
||||||
// if(this.data.bonusDamage[index].hopeUses <= this.data.hopeResource+1) {
|
|
||||||
// this.data.bonusDamage[index].hopeUses += 1;
|
|
||||||
// this.render(true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// static finish(){
|
|
||||||
// const { diceOptions, ...rest } = this.data;
|
|
||||||
// this.resolve({ ...rest, experiences: this.selectedExperiences, hopeUsed: this.getHopeUsed(), bonusDamage: this.data.bonusDamage.reduce((acc, x) => acc.concat(` + ${1+x.hopeUses}${x.value}`), "") });
|
|
||||||
// this.close();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue