Add new init system
This commit is contained in:
@@ -23,9 +23,9 @@ export class PegasusUtility {
|
||||
Hooks.on('renderChatLog', (log, html, data) => PegasusUtility.chatListeners(html))
|
||||
Hooks.on('targetToken', (user, token, flag) => PegasusUtility.targetToken(user, token, flag))
|
||||
Hooks.on('renderSidebarTab', (app, html, data) => PegasusUtility.addDiceRollButton(app, html, data))
|
||||
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
||||
/* Deprecated, no more used in rules Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
||||
PegasusUtility.pushInitiativeOptions(html, options);
|
||||
});
|
||||
});*/
|
||||
Hooks.on("dropCanvasData", (canvas, data) => {
|
||||
PegasusUtility.dropItemOnToken(canvas, data)
|
||||
});
|
||||
@@ -87,7 +87,12 @@ export class PegasusUtility {
|
||||
Handlebars.registerHelper('isGM', function () {
|
||||
return game.user.isGM
|
||||
})
|
||||
|
||||
Handlebars.registerHelper('getTIC', function (num, id) {
|
||||
return game.combat.getTIC(num, id)
|
||||
})
|
||||
Handlebars.registerHelper('isCharacter', function (id) {
|
||||
return game.combat.isCharacter(id)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -847,13 +852,14 @@ export class PegasusUtility {
|
||||
for (let res of rollData.hindranceRoll.terms[0].results) {
|
||||
if (res.result == 6) {
|
||||
rollData.hindranceFailure = true
|
||||
rollData.img = `systems/fvtt-pegasus-rpg/images/dice/hindrance-dice.png`
|
||||
}
|
||||
}
|
||||
}
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
|
||||
// Final score and keep data
|
||||
rollData.finalScore = myRoll.total
|
||||
rollData.finalScore = (rollData.hindranceFailure) ? 0 : myRoll.total
|
||||
|
||||
if (rollData.damages) {
|
||||
let dmgFormula = this.getFoundryDiceFromLevel(rollData.damages.value)
|
||||
@@ -869,7 +875,8 @@ export class PegasusUtility {
|
||||
// Init stuf
|
||||
if (rollData.isInit) {
|
||||
let combat = game.combats.get(rollData.combatId)
|
||||
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }])
|
||||
await combat.setTic(rollData.combatantId, rollData)
|
||||
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }])
|
||||
}
|
||||
|
||||
// Stun specific -> Suffer a stun level when dmg-res for character
|
||||
|
||||
Reference in New Issue
Block a user