Crew member enhancements
All checks were successful
Release Creation / build (release) Successful in 59s
All checks were successful
Release Creation / build (release) Successful in 59s
This commit is contained in:
@@ -67,7 +67,7 @@ export default class FTLNomadRoll extends Roll {
|
||||
} else {
|
||||
let mod = options.rollItem?.value || 0
|
||||
fullFormula = `${options.formula} + ${options.skillModifier}D + ${mod} + ${options.rangeModifier}D + ${options.numericModifier}D + ${options.numericModifierSelect}`
|
||||
if (options.vehicleBonus) {
|
||||
if (options.vehicleBonus && options.useVehicleBonus) {
|
||||
fullFormula += ` + ${options.vehicleBonus}`
|
||||
}
|
||||
}
|
||||
@@ -140,16 +140,28 @@ export default class FTLNomadRoll extends Roll {
|
||||
options.rangeModifier = rangeModifier
|
||||
options.damageModifier = damageModifier
|
||||
options.vehicleBonus = options.vehicleBonus || 0
|
||||
options.useVehicleBonus = true // Par défaut, le bonus est activé
|
||||
let fullFormula = `${formula} + ${options.rollItem.value}`
|
||||
if (options.isEncumbered) {
|
||||
fullFormula += ` - 1D`
|
||||
}
|
||||
if (options.vehicleBonus) {
|
||||
if (options.vehicleBonus && options.useVehicleBonus) {
|
||||
fullFormula += ` + ${options.vehicleBonus}`
|
||||
}
|
||||
options.fullFormula = fullFormula
|
||||
options.formula = formula
|
||||
|
||||
// Prepare available skills if provided (for vehicle/starship piloting)
|
||||
let availableSkills = null
|
||||
if (options.availableSkills) {
|
||||
availableSkills = Object.entries(options.availableSkills).map(([id, skill]) => ({
|
||||
id: id,
|
||||
label: skill.label,
|
||||
value: skill.value,
|
||||
selected: id === options.selectedSkillId
|
||||
}))
|
||||
}
|
||||
|
||||
let dialogContext = {
|
||||
actorId: options.actorId,
|
||||
actorName: options.actorName,
|
||||
@@ -172,6 +184,7 @@ export default class FTLNomadRoll extends Roll {
|
||||
modifier,
|
||||
numericModifierSelect,
|
||||
vehicleBonus: options.vehicleBonus,
|
||||
availableSkills: availableSkills,
|
||||
}
|
||||
const content = await foundry.applications.handlebars.renderTemplate("systems/fvtt-ftl-nomad/templates/roll-dialog.hbs", dialogContext)
|
||||
|
||||
@@ -198,6 +211,14 @@ export default class FTLNomadRoll extends Roll {
|
||||
rejectClose: false, // Click on Close button will not launch an error
|
||||
render: (event, dialog) => {
|
||||
FTLNomadRoll.updateFullFormula(options)
|
||||
$(".roll-skill-selector").change(event => {
|
||||
const skillId = event.target.value
|
||||
if (options.availableSkills && options.availableSkills[skillId]) {
|
||||
options.rollItem = foundry.utils.duplicate(options.availableSkills[skillId])
|
||||
options.selectedSkillId = skillId
|
||||
FTLNomadRoll.updateFullFormula(options)
|
||||
}
|
||||
})
|
||||
$(".roll-skill-modifier").change(event => {
|
||||
options.skillModifier = Number(event.target.value)
|
||||
FTLNomadRoll.updateFullFormula(options)
|
||||
@@ -224,6 +245,10 @@ export default class FTLNomadRoll extends Roll {
|
||||
}
|
||||
FTLNomadRoll.updateFullFormula(options)
|
||||
})
|
||||
$(".use-vehicle-bonus").change(event => {
|
||||
options.useVehicleBonus = event.target.checked
|
||||
FTLNomadRoll.updateFullFormula(options)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -237,14 +262,22 @@ export default class FTLNomadRoll extends Roll {
|
||||
|
||||
if (Hooks.call("fvtt-ftl-nomad.preRoll", options, rollData) === false) return
|
||||
|
||||
// Update rollItem if a skill was selected from the dropdown
|
||||
if (rollData.selectedSkill && options.availableSkills) {
|
||||
options.rollItem = foundry.utils.duplicate(options.availableSkills[rollData.selectedSkill])
|
||||
}
|
||||
|
||||
options.numericModifier = Number(rollData.numericModifier) || 0
|
||||
options.skillModifier = Number(rollData.skillModifier) || 0
|
||||
options.rangeModifier = Number(rollData.rangeModifier) || 0
|
||||
options.numericModifierSelect = Number(rollData.numericModifierSelect) || 0
|
||||
options.useVehicleBonus = rollData.useVehicleBonus !== "off" && rollData.useVehicleBonus !== false
|
||||
options.finalModifier = options.numericModifier + options.skillModifier + options.rangeModifier
|
||||
let mod = options.rollItem?.value || 0
|
||||
mod += options.numericModifierSelect
|
||||
mod += options.vehicleBonus || 0
|
||||
if (options.useVehicleBonus) {
|
||||
mod += options.vehicleBonus || 0
|
||||
}
|
||||
|
||||
// Build the dice formula
|
||||
let diceFormula = "2d6"
|
||||
|
||||
Reference in New Issue
Block a user