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