Ajout des impacts
This commit is contained in:
parent
8800c32e8c
commit
b3cbe7b31a
@ -45,7 +45,7 @@ export class EcrymeActorSheet extends ActorSheet {
|
||||
weapons: this.actor.getWeapons(),
|
||||
impactsMalus: this.actor.getImpactsMalus(),
|
||||
archetype: duplicate(this.actor.getArchetype()),
|
||||
equipements: this.actor.getEquipements(),
|
||||
equipements: this.actor.getEquipments(),
|
||||
subActors: duplicate(this.actor.getSubActors()),
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),
|
||||
@ -84,7 +84,7 @@ export class EcrymeActorSheet extends ActorSheet {
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
EcrymeUtility.confirmDelete(this, li)
|
||||
EcrymeUtility.confirmDelete(this, li).catch("Error : No deletion confirmed")
|
||||
})
|
||||
html.find('.item-add').click(ev => {
|
||||
let dataType = $(ev.currentTarget).data("type")
|
||||
|
@ -35,37 +35,16 @@ export class EcrymeActor extends Actor {
|
||||
return actor;
|
||||
}
|
||||
|
||||
if (data.type == 'character') {
|
||||
}
|
||||
if (data.type == 'npc') {
|
||||
}
|
||||
|
||||
return super.create(data, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareBaseData() {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async prepareData() {
|
||||
|
||||
super.prepareData()
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeHitPoints() {
|
||||
if (this.type == "character") {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareDerivedData() {
|
||||
|
||||
if (this.type == 'character' || game.user.isGM) {
|
||||
}
|
||||
|
||||
super.prepareDerivedData();
|
||||
}
|
||||
|
||||
@ -83,7 +62,7 @@ export class EcrymeActor extends Actor {
|
||||
}
|
||||
getArchetype() {
|
||||
let comp = duplicate(this.items.find(item => item.type == 'archetype') || { name: "Pas d'archetype" })
|
||||
if (comp && comp.system) {
|
||||
if (comp?.system) {
|
||||
comp.tarot = EcrymeUtility.getTarot(comp.system.lametutelaire)
|
||||
}
|
||||
|
||||
@ -152,7 +131,7 @@ export class EcrymeActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
async equipItem(itemId) {
|
||||
let item = this.items.find(item => item.id == itemId)
|
||||
if (item && item.system) {
|
||||
if (item?.system) {
|
||||
if (item.type == "armor") {
|
||||
let armor = this.items.find(item => item.id != itemId && item.type == "armor" && item.system.equipped)
|
||||
if (armor) {
|
||||
@ -173,7 +152,7 @@ export class EcrymeActor extends Actor {
|
||||
}
|
||||
|
||||
/* ------------------------------------------- */
|
||||
getEquipements() {
|
||||
getEquipments() {
|
||||
return this.items.filter(item => item.type == 'equipement')
|
||||
}
|
||||
|
||||
@ -266,8 +245,8 @@ export class EcrymeActor extends Actor {
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore(combatId, combatantId) {
|
||||
let init = Math.floor((this.system.attributs.physique.value + this.system.attributs.habilite.value) / 2)
|
||||
let subvalue = new Roll("1d20").roll({ async: false })
|
||||
return init + (subvalue.total / 100)
|
||||
let subValue = new Roll("1d20").roll({ async: false })
|
||||
return init + (subValue.total / 100)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -315,7 +294,7 @@ export class EcrymeActor extends Actor {
|
||||
if (objetQ) {
|
||||
let newQ = objetQ.system.quantity + incDec
|
||||
if (newQ >= 0) {
|
||||
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]) // pdates one EmbeddedEntity
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]) // pdates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -364,7 +343,7 @@ export class EcrymeActor extends Actor {
|
||||
let rollData = this.getCommonSkill(categKey, skillKey)
|
||||
rollData.mode = "skill"
|
||||
rollData.title = game.i18n.localize(rollData.skill.name)
|
||||
this.startRoll(rollData)
|
||||
this.startRoll(rollData).catch("Error on startRoll")
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -393,7 +372,7 @@ export class EcrymeActor extends Actor {
|
||||
rollData.weapon = weapon
|
||||
rollData.img = weapon.img
|
||||
rollData.title = weapon.name
|
||||
this.startRoll(rollData)
|
||||
this.startRoll(rollData).catch("Error on startRoll")
|
||||
} else {
|
||||
ui.notifications.warn("Impossible de trouver l'arme concernée ")
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ export class EcrymeUtility {
|
||||
return arr[idx];
|
||||
})
|
||||
Handlebars.registerHelper('for', function (from, to, incr, block) {
|
||||
var accum = '';
|
||||
for (var i = from; i <= to; i += incr)
|
||||
let accum = '';
|
||||
for (let i = from; i <= to; i += incr)
|
||||
accum += block.fn(i);
|
||||
return accum;
|
||||
})
|
||||
@ -123,7 +123,7 @@ export class EcrymeUtility {
|
||||
callback: li => {
|
||||
let message = game.messages.get(li.attr("data-message-id"))
|
||||
let rollData = message.getFlag("world", "rolldata")
|
||||
EcrymeUtility.transcendFromSpec(rollData, i)
|
||||
EcrymeUtility.transcendFromSpec(rollData, i).catch("Error on Transcend")
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -139,7 +139,7 @@ export class EcrymeUtility {
|
||||
let actor = this.getActorFromRollData(rollData)
|
||||
actor.incDecDestin(-1)
|
||||
rollData.isReroll = true
|
||||
this.rollEcryme(rollData)
|
||||
this.rollEcryme(rollData).catch("Error on rollEcryme")
|
||||
})
|
||||
html.on("click", '.draw-tarot-card', event => {
|
||||
let messageId = EcrymeUtility.findChatMessageId(event.currentTarget)
|
||||
@ -383,7 +383,6 @@ export class EcrymeUtility {
|
||||
|
||||
this.computeResults(rollData)
|
||||
|
||||
console.log("rollData", rollData)
|
||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-ecryme/templates/chat/chat-generic-result.hbs`, rollData)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user