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:
@@ -5,8 +5,8 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet {
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["vehicle"],
|
||||
position: {
|
||||
width: 680,
|
||||
height: 540,
|
||||
width: 720,
|
||||
height: 640,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["vehicle-content"],
|
||||
@@ -17,6 +17,7 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet {
|
||||
removeCrew: FTLNomadVehicleSheet.#onRemoveCrew,
|
||||
viewCrew: FTLNomadVehicleSheet.#onViewCrew,
|
||||
pilotCrew: FTLNomadVehicleSheet.#onPilotCrew,
|
||||
rollNpcCrew: FTLNomadVehicleSheet.#onRollNpcCrew,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -81,20 +82,25 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet {
|
||||
// Get vehicle agility bonus
|
||||
const vehicleAgility = this.document.system.agility || 0
|
||||
|
||||
// Get the vehicles skill from the actor
|
||||
const vehiclesSkill = actor.system.skills?.vehicles
|
||||
if (!vehiclesSkill) {
|
||||
ui.notifications.warn(game.i18n.localize("FTLNOMAD.Warning.noVehiclesSkill"))
|
||||
// Get all skills from the actor
|
||||
const actorSkills = actor.system.skills
|
||||
if (!actorSkills) {
|
||||
ui.notifications.warn(game.i18n.localize("FTLNOMAD.Warning.noSkills"))
|
||||
return
|
||||
}
|
||||
|
||||
// Default to vehicles skill
|
||||
const defaultSkill = actorSkills.vehicles || Object.values(actorSkills)[0]
|
||||
|
||||
// Import the Roll class
|
||||
const FTLNomadRoll = (await import("../../documents/roll.mjs")).default
|
||||
|
||||
// Call the roll prompt with the vehicle agility as a vehicle bonus
|
||||
// Call the roll prompt with all skills available and vehicle agility as a vehicle bonus
|
||||
let roll = await FTLNomadRoll.prompt({
|
||||
rollType: "skill",
|
||||
rollItem: vehiclesSkill,
|
||||
rollItem: defaultSkill,
|
||||
availableSkills: actorSkills,
|
||||
selectedSkillId: "vehicles",
|
||||
actorId: actor.id,
|
||||
actorName: actor.name,
|
||||
actorImage: actor.img,
|
||||
@@ -108,6 +114,48 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet {
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
}
|
||||
|
||||
/**
|
||||
* Roll a check for NPC crew with vehicle agility bonus
|
||||
* @param {Event} event The initiating click event
|
||||
* @param {HTMLElement} target The current target of the event listener
|
||||
*/
|
||||
static async #onRollNpcCrew(event, target) {
|
||||
const npcCrewLevel = this.document.system.npcCrew || 0
|
||||
|
||||
if (npcCrewLevel < 0) {
|
||||
ui.notifications.warn(game.i18n.localize("FTLNOMAD.Warning.noNpcCrew"))
|
||||
return
|
||||
}
|
||||
|
||||
// Get vehicle agility bonus
|
||||
const vehicleAgility = this.document.system.agility || 0
|
||||
|
||||
// Create a fake skill object for the NPC crew
|
||||
const npcSkill = {
|
||||
value: npcCrewLevel,
|
||||
label: "FTLNOMAD.Label.npcCrewSkill"
|
||||
}
|
||||
|
||||
// Import the Roll class
|
||||
const FTLNomadRoll = (await import("../../documents/roll.mjs")).default
|
||||
|
||||
// Call the roll prompt with NPC crew level as skill
|
||||
let roll = await FTLNomadRoll.prompt({
|
||||
rollType: "skill",
|
||||
rollItem: npcSkill,
|
||||
actorId: this.document.id,
|
||||
actorName: `${this.document.name} (NPC Crew)`,
|
||||
actorImage: this.document.img,
|
||||
talents: [],
|
||||
isEncumbered: false,
|
||||
hasTarget: false,
|
||||
vehicleBonus: vehicleAgility
|
||||
})
|
||||
if (!roll) return null
|
||||
|
||||
await roll.toMessage({}, { rollMode: roll.options.rollMode })
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
|
||||
Reference in New Issue
Block a user