mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-10 19:17:09 +01:00
cleanup
This commit is contained in:
parent
608920c193
commit
450fe60db6
1 changed files with 1 additions and 44 deletions
|
|
@ -10,14 +10,10 @@ const fields = foundry.data.fields;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ToDo
|
ToDo
|
||||||
- Add setting and/or checkbox for cost and damage like
|
|
||||||
- Target Check / Target Picker
|
- Target Check / Target Picker
|
||||||
- Range Check
|
- Range Check
|
||||||
- Area of effect and measurement placement
|
- Area of effect and measurement placement
|
||||||
- Summon Action create method
|
- Summon Action create method
|
||||||
|
|
||||||
Other
|
|
||||||
- Auto use action <= Into Roll
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default class DHBaseAction extends foundry.abstract.DataModel {
|
export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
|
|
@ -127,8 +123,6 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
return extraSchemas;
|
return extraSchemas;
|
||||||
}
|
}
|
||||||
|
|
||||||
prepareData() {}
|
|
||||||
|
|
||||||
get index() {
|
get index() {
|
||||||
return foundry.utils.getProperty(this.parent, this.systemPath).indexOf(this);
|
return foundry.utils.getProperty(this.parent, this.systemPath).indexOf(this);
|
||||||
}
|
}
|
||||||
|
|
@ -200,28 +194,23 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
const isFastForward = event.shiftKey || (!this.hasRoll && !this.hasSave);
|
const isFastForward = event.shiftKey || (!this.hasRoll && !this.hasSave);
|
||||||
// Prepare base Config
|
// Prepare base Config
|
||||||
const initConfig = this.initActionConfig(event);
|
const initConfig = this.initActionConfig(event);
|
||||||
// let config = this.initActionConfig(event);
|
|
||||||
|
|
||||||
// Prepare Targets
|
// Prepare Targets
|
||||||
const targetConfig = this.prepareTarget();
|
const targetConfig = this.prepareTarget();
|
||||||
if (isFastForward && !targetConfig) return ui.notifications.warn('Too many targets selected for that actions.');
|
if (isFastForward && !targetConfig) return ui.notifications.warn('Too many targets selected for that actions.');
|
||||||
// config = this.prepareTarget(config);
|
|
||||||
|
|
||||||
// Prepare Range
|
// Prepare Range
|
||||||
const rangeConfig = this.prepareRange();
|
const rangeConfig = this.prepareRange();
|
||||||
// config = this.prepareRange(config);
|
|
||||||
|
|
||||||
// Prepare Costs
|
// Prepare Costs
|
||||||
const costsConfig = this.prepareCost();
|
const costsConfig = this.prepareCost();
|
||||||
if (isFastForward && !this.hasCost(costsConfig))
|
if (isFastForward && !this.hasCost(costsConfig))
|
||||||
return ui.notifications.warn("You don't have the resources to use that action.");
|
return ui.notifications.warn("You don't have the resources to use that action.");
|
||||||
// config = this.prepareUseCost(config)
|
|
||||||
|
|
||||||
// Prepare Uses
|
// Prepare Uses
|
||||||
const usesConfig = this.prepareUse();
|
const usesConfig = this.prepareUse();
|
||||||
if (isFastForward && !this.hasUses(usesConfig))
|
if (isFastForward && !this.hasUses(usesConfig))
|
||||||
return ui.notifications.warn("That action doesn't have remaining uses.");
|
return ui.notifications.warn("That action doesn't have remaining uses.");
|
||||||
// config = this.prepareUseCost(config)
|
|
||||||
|
|
||||||
// Prepare Roll Data
|
// Prepare Roll Data
|
||||||
const actorData = this.getRollData();
|
const actorData = this.getRollData();
|
||||||
|
|
@ -250,37 +239,6 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
if (!config) return;
|
if (!config) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasSave) {
|
|
||||||
/* config.targets.forEach((t) => {
|
|
||||||
if(t.hit) {
|
|
||||||
const target = game.canvas.tokens.get(t.id),
|
|
||||||
actor = target?.actor;
|
|
||||||
if(!actor) return;
|
|
||||||
actor.saveRoll({
|
|
||||||
event,
|
|
||||||
title: 'Roll Save',
|
|
||||||
roll: {
|
|
||||||
trait: this.save.trait,
|
|
||||||
difficulty: this.save.difficulty
|
|
||||||
},
|
|
||||||
dialog: {
|
|
||||||
configure: false
|
|
||||||
},
|
|
||||||
data: actor.getRollData()
|
|
||||||
}).then(async (result) => {
|
|
||||||
t.saved = result;
|
|
||||||
setTimeout(async () => {
|
|
||||||
const message = ui.chat.collection.get(config.message.id),
|
|
||||||
msgTargets = message.system.targets,
|
|
||||||
msgTarget = msgTargets.find(mt => mt.id === t.id);
|
|
||||||
msgTarget.saved = result;
|
|
||||||
await message.update({'system.targets': msgTargets});
|
|
||||||
},100)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}) */
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.doFollowUp()) {
|
if (this.doFollowUp()) {
|
||||||
if (this.rollDamage) await this.rollDamage(event, config);
|
if (this.rollDamage) await this.rollDamage(event, config);
|
||||||
if (this.rollHealing) await this.rollHealing(event, config);
|
if (this.rollHealing) await this.rollHealing(event, config);
|
||||||
|
|
@ -333,7 +291,6 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
if (this.target?.type === CONFIG.DH.ACTIONS.targetTypes.self.id)
|
if (this.target?.type === CONFIG.DH.ACTIONS.targetTypes.self.id)
|
||||||
targets = this.constructor.formatTarget(this.actor.token ?? this.actor.prototypeToken);
|
targets = this.constructor.formatTarget(this.actor.token ?? this.actor.prototypeToken);
|
||||||
targets = Array.from(game.user.targets);
|
targets = Array.from(game.user.targets);
|
||||||
// foundry.CONST.TOKEN_DISPOSITIONS.FRIENDLY
|
|
||||||
if (this.target?.type && this.target.type !== CONFIG.DH.ACTIONS.targetTypes.any.id) {
|
if (this.target?.type && this.target.type !== CONFIG.DH.ACTIONS.targetTypes.any.id) {
|
||||||
targets = targets.filter(t => this.isTargetFriendly(t));
|
targets = targets.filter(t => this.isTargetFriendly(t));
|
||||||
if (this.target.amount && targets.length > this.target.amount) targets = [];
|
if (this.target.amount && targets.length > this.target.amount) targets = [];
|
||||||
|
|
@ -540,6 +497,7 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/* SAVE */
|
||||||
|
|
||||||
async updateChatMessage(message, targetId, changes, chain = true) {
|
async updateChatMessage(message, targetId, changes, chain = true) {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
|
@ -558,7 +516,6 @@ export default class DHBaseAction extends foundry.abstract.DataModel {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* SAVE */
|
|
||||||
|
|
||||||
async toChat(origin) {
|
async toChat(origin) {
|
||||||
const cls = getDocumentClass('ChatMessage');
|
const cls = getDocumentClass('ChatMessage');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue