Update confrontation

This commit is contained in:
2023-06-28 11:12:51 +02:00
parent 88385d2307
commit a3df0499a7
17 changed files with 424 additions and 66 deletions

View File

@ -122,6 +122,11 @@ export class EcrymeActorSheet extends ActorSheet {
let skillKey = $(event.currentTarget).data("skill-key")
this.actor.rollSkillConfront(categKey, skillKey)
});
html.find('.roll-weapon-confront').click((event) => {
const li = $(event.currentTarget).parents(".item")
let weaponId = li.data("item-id");
this.actor.rollWeaponConfront(weaponId)
});
html.find('.impact-modify').click((event) => {
let impactType = $(event.currentTarget).data("impact-type")

View File

@ -298,6 +298,12 @@ export class EcrymeActor extends Actor {
}
}
}
/* -------------------------------------------- */
modifyConfrontBonus( modifier ) {
let newBonus = this.system.internals.confrontbonus + bonus
this.update({'system.internals.confrontbonus': newBonus})
}
/* -------------------------------------------- */
spentSkillTranscendence(skill, value) {
@ -306,8 +312,18 @@ export class EcrymeActor extends Actor {
this.update({ [`system.skills.${skill.categKey}.skilllist.${skill.skillKey}.value`]: newValue })
}
/* -------------------------------------------- */
getBonusList() {
let bonusList = []
for(let i=0; i<this.system.internals.confrontbonus; i++) {
bonusList.push( { value: 1, type: "bonus", location: "mainpool"})
}
return bonusList
}
/* -------------------------------------------- */
getCommonRollData() {
this.system.internals.confrontbonus = 5 // TO BE REMOVED!!!!
let rollData = EcrymeUtility.getBasicRollData()
rollData.alias = this.name
rollData.actorImg = this.img
@ -315,8 +331,9 @@ export class EcrymeActor extends Actor {
rollData.img = this.img
rollData.isReroll = false
rollData.traits = duplicate(this.getRollTraits())
rollData.spleen = this.getSpleen()
rollData.ideal = this.getIdeal()
rollData.spleen = duplicate(this.getSpleen() || {})
rollData.ideal = duplicate(this.getIdeal() || {})
rollData.confrontBonus = this.getBonusList()
return rollData
}
@ -358,6 +375,25 @@ export class EcrymeActor extends Actor {
confrontStartDialog.render(true)
}
/* -------------------------------------------- */
async rollWeaponConfront(weaponId) {
let weapon = this.items.get(weaponId)
let rollData
if (weapon && weapon.system.weapontype == "melee") {
rollData = this.getCommonSkill("physical", "fencing")
} else {
rollData = this.getCommonSkill("physical", "shooting")
}
rollData.mode = "weapon"
rollData.weapon = duplicate(weapon)
rollData.title = game.i18n.localize("ECRY.ui.confrontation") + " : " + 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)
}
/* -------------------------------------------- */
rollWeapon(weaponId) {
let weapon = this.items.get(weaponId)