Support des runes

This commit is contained in:
2022-06-26 18:52:31 +02:00
parent 3f91a161ab
commit 8d43ae6b6e
11 changed files with 174 additions and 14 deletions

View File

@ -191,8 +191,8 @@ export class MournbladeActor extends Actor {
this.update({ 'data.sante.base': newSante })
}
let newAme = (this.data.data.attributs.cla.value + this.data.data.attributs.tre.value) * this.data.data.biodata.amemultiplier + 5
if (this.data.data.ame.base != newAme) {
this.update({ 'data.ame.base': newAme })
if (this.data.data.ame.fullmax != newAme) {
this.update({ 'data.ame.fullmax': newAme })
}
}
@ -266,6 +266,16 @@ export class MournbladeActor extends Actor {
canEclatDoubleD20() {
return (this.getAlignement() == "loyal" && this.data.data.eclat.value > 0)
}
/* -------------------------------------------- */
subPointsAme(runeMode, value) {
let ame = duplicate(this.data.data.ame)
if(runeMode == "prononcer") {
ame.value -= value
} else {
ame.currentmax -= value
}
this.update( {'data.ame': ame})
}
/* -------------------------------------------- */
compareName(a, b) {
@ -345,7 +355,7 @@ export class MournbladeActor extends Actor {
}
/* -------------------------------------------- */
getCommonRollData(attrKey = undefined, compId = undefined) {
getCommonRollData(attrKey = undefined, compId = undefined, compName = undefined) {
let rollData = MournbladeUtility.getBasicRollData()
rollData.alias = this.name
rollData.actorImg = this.img
@ -364,7 +374,11 @@ export class MournbladeActor extends Actor {
}
if (compId) {
rollData.competence = duplicate(this.data.items.get(compId) || {})
rollData.actionImg = rollData.competence.img
rollData.actionImg = rollData.competence?.img
}
if (compName) {
rollData.competence = duplicate(this.data.items.find( item => item.name.toLowerCase() == compName.toLowerCase()) || {})
rollData.actionImg = rollData.competence?.img
}
return rollData
}
@ -385,6 +399,18 @@ export class MournbladeActor extends Actor {
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollRune(runeId) {
let rollData = this.getCommonRollData("cla", undefined, "Savoir : Runes")
rollData.rune = duplicate(this.data.items.get(runeId) || {})
rollData.difficulte = rollData.rune?.data?.seuil || 0
rollData.runemode = "prononcer"
rollData.runeame = 1
console.log("runeData", rollData)
let rollDialog = await MournbladeRollDialog.create(this, rollData)
rollDialog.render(true)
}
/* -------------------------------------------- */
async rollArmeOffensif(armeId) {
let arme = this.data.items.get(armeId)