Fix rolls

This commit is contained in:
2023-07-21 18:57:41 +02:00
parent debd401d58
commit 0551d7812f
9 changed files with 139 additions and 40 deletions

View File

@ -46,6 +46,8 @@ export class EcrymeActorSheet extends ActorSheet {
impactsMalus: this.actor.getImpactsMalus(),
archetype: duplicate(this.actor.getArchetype()),
equipements: this.actor.getEquipments(),
hasCephaly: EcrymeUtility.hasCephaly(),
cephalySkills: this.actor.getCephalySkills(),
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 }),
@ -121,7 +123,11 @@ export class EcrymeActorSheet extends ActorSheet {
let categKey = $(event.currentTarget).data("category-key")
let skillKey = $(event.currentTarget).data("skill-key")
this.actor.rollSkillConfront(categKey, skillKey)
});
});
html.find('.roll-cephaly').click((event) => {
let skillKey = $(event.currentTarget).data("skill-key")
this.actor.rollCephalySkillConfront(skillKey)
});
html.find('.roll-weapon-confront').click((event) => {
const li = $(event.currentTarget).parents(".item")
let weaponId = li.data("item-id");

View File

@ -109,6 +109,11 @@ export class EcrymeActor extends Actor {
return skills
}
/* -------------------------------------------- */
getCephalySkills() {
let skills = duplicate(this.system.cephaly.skilllist)
return skills
}
/* -------------------------------------------- */
getImpacts() {
let comp = duplicate(this.items.filter(item => item.type == 'impact') || [])
return comp;
@ -323,7 +328,7 @@ export class EcrymeActor extends Actor {
/* -------------------------------------------- */
getCommonRollData() {
this.system.internals.confrontbonus = 5 // TO BE REMOVED!!!!
//this.system.internals.confrontbonus = 5 // TO BE REMOVED!!!!
let rollData = EcrymeUtility.getBasicRollData()
rollData.alias = this.name
rollData.actorImg = this.img
@ -371,6 +376,24 @@ export class EcrymeActor extends Actor {
rollData.executionTotal = rollData.skill.value
rollData.preservationTotal = rollData.skill.value
rollData.applyTranscendence = "execution"
rollData.traitsBonus = duplicate(rollData.traits)
rollData.traitsMalus = duplicate(rollData.traits)
let confrontStartDialog = await EcrymeConfrontStartDialog.create(this, rollData)
confrontStartDialog.render(true)
}
/* -------------------------------------------- */
async rollCephalySkillConfront(skillKey) {
let rollData = this.getCommonRollData()
rollData.mode = "cephaly"
rollData.skill = duplicate(this.system.cephaly.skilllist[skillKey])
rollData.img = rollData.skill.img
rollData.skill.categKey = "cephaly"
rollData.skill.skillKey = skillKey
//rollData.impactMalus = this.getImpactMalus(categKey)
rollData.title = game.i18n.localize("ECRY.ui.cephaly") + " : " + game.i18n.localize(rollData.skill.name)
rollData.executionTotal = rollData.skill.value
rollData.preservationTotal = rollData.skill.value
rollData.applyTranscendence = "execution"
let confrontStartDialog = await EcrymeConfrontStartDialog.create(this, rollData)
confrontStartDialog.render(true)
}