Add vehicle type

This commit is contained in:
LeRatierBretonnien 2025-01-08 17:26:57 +01:00
parent fa7d3ecfca
commit ce1844a070
29 changed files with 859 additions and 43 deletions

View File

@ -178,6 +178,10 @@ i.fvtt-cthulhu-eternal {
font-family: var(--font-secondary); font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1); font-size: calc(var(--font-size-standard) * 1);
} }
.fvtt-cthulhu-eternal .vehicle-sheet-common label {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
}
.fvtt-cthulhu-eternal .item-sheet-common .form-fields { .fvtt-cthulhu-eternal .item-sheet-common .form-fields {
padding-top: 4px; padding-top: 4px;
} }
@ -776,6 +780,253 @@ i.fvtt-cthulhu-eternal {
.fvtt-cthulhu-eternal .tab.protagonist-equipment prose-mirror.active { .fvtt-cthulhu-eternal .tab.protagonist-equipment prose-mirror.active {
min-height: 150px; min-height: 150px;
} }
.fvtt-cthulhu-eternal .vehicle-content {
font-family: var(--font-primary);
font-size: calc(var(--font-size-standard) * 1);
color: var(--color-dark-1);
background-image: var(--background-image-base);
background-repeat: no-repeat;
background-size: 100% 100%;
overflow: scroll;
}
.fvtt-cthulhu-eternal .vehicle-content input:disabled,
.fvtt-cthulhu-eternal .vehicle-content select:disabled {
background-color: rgba(0, 0, 0, 0.2);
border-color: transparent;
color: var(--color-dark-3);
}
.fvtt-cthulhu-eternal .vehicle-content input,
.fvtt-cthulhu-eternal .vehicle-content select {
background-color: rgba(0, 0, 0, 0.1);
border-color: var(--color-dark-6);
color: var(--color-dark-2);
}
.fvtt-cthulhu-eternal .vehicle-content input[name="name"] {
height: 40px;
margin-right: 10px;
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
font-weight: bold;
border: none;
}
.fvtt-cthulhu-eternal .vehicle-content fieldset {
margin-bottom: 4px;
border-radius: 4px;
}
.fvtt-cthulhu-eternal .vehicle-content .form-fields input,
.fvtt-cthulhu-eternal .vehicle-content .form-fields select {
text-align: center;
font-size: calc(var(--font-size-standard) * 1);
}
.fvtt-cthulhu-eternal .vehicle-content .form-fields select {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
}
.fvtt-cthulhu-eternal .vehicle-content legend {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1.2);
font-weight: bold;
letter-spacing: 1px;
}
.fvtt-cthulhu-eternal .vehicle-content label {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1);
}
.fvtt-cthulhu-eternal .sheet-tabs {
background-color: var(--color-light-1);
}
.fvtt-cthulhu-eternal .vehicle-main {
background-color: var(--color-light-1);
display: flex;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc {
display: flex;
gap: 4px;
flex: 1;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-left {
min-width: 180px;
display: flex;
flex-direction: column;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-left .vehicle-left-image {
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 8px;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-left .vehicle-left-image .vehicle-img {
height: 140px;
width: auto;
border: none;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right {
display: flex;
flex-direction: column;
gap: 5px;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-name {
display: flex;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-name input {
font-family: var(--font-title);
font-size: calc(var(--font-size-standard) * 1.4);
width: 400px;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos {
display: flex;
flex-direction: column;
gap: 4px;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos label {
min-width: 120px;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos .vehicle-hp {
display: flex;
gap: 2px;
align-items: center;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos .vehicle-hp .vehicle-hp-value .form-fields input {
flex: none;
width: 50px;
margin-left: 4px;
font-size: calc(var(--font-size-standard) * 1.4);
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos .vehicle-hp .vehicle-hp-max {
clear: both;
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin: 3px 0;
align-items: center;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos .vehicle-hp .vehicle-hp-max input {
width: 50px;
text-align: center;
font-size: calc(var(--font-size-standard) * 1.4);
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc .vehicle-right .vehicle-infos .vehicle-hp .hp-separator {
font-size: calc(var(--font-size-standard) * 1.2);
display: flex;
align-items: center;
justify-content: center;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc-play {
min-width: 500px;
}
.fvtt-cthulhu-eternal .vehicle-main .vehicle-pc-edit {
min-width: 650px;
}
.fvtt-cthulhu-eternal .vehicle-biography {
background-color: var(--color-light-1);
}
.fvtt-cthulhu-eternal .vehicle-biography prose-mirror.inactive {
min-height: 40px;
}
.fvtt-cthulhu-eternal .vehicle-biography prose-mirror.active {
min-height: 150px;
}
.fvtt-cthulhu-eternal .vehicle-biography .field-label {
margin-left: 8px;
}
.fvtt-cthulhu-eternal .vehicle-biography .biodata {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.fvtt-cthulhu-eternal .vehicle-biography .biodata label {
min-width: 3rem;
}
.fvtt-cthulhu-eternal .vehicle-biography .biodata .feature {
display: flex;
align-items: center;
gap: 4px;
min-width: 18rem;
max-width: 18rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment {
background-color: var(--color-light-1);
display: grid;
grid-template-columns: 1fr;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment legend a {
font-size: calc(var(--font-size-standard) * 1.4);
padding-left: 5px;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 4px;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon {
display: flex;
align-items: center;
gap: 4px;
min-width: 13rem;
max-width: 13srem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon .rollable:hover,
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon .rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
cursor: pointer;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon .controls {
min-width: 2rem;
max-width: 2rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon .damage {
min-width: 5rem;
max-width: 5rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon .name {
min-width: 8rem;
max-width: 8rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .weapons .weapon .item-img {
width: 32px;
height: 32px;
margin: 4px 0 0 0;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 4px;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear {
display: flex;
align-items: center;
gap: 4px;
min-width: 13rem;
max-width: 13srem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear .rollable:hover,
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear .rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
cursor: pointer;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear .controls {
min-width: 2rem;
max-width: 2rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear .damage {
min-width: 5rem;
max-width: 5rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear .name {
min-width: 8rem;
max-width: 8rem;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment .gears .gear .item-img {
width: 32px;
height: 32px;
margin: 4px 0 0 0;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment prose-mirror.inactive {
min-height: 40px;
}
.fvtt-cthulhu-eternal .tab.vehicle-equipment prose-mirror.active {
min-height: 150px;
}
.fvtt-cthulhu-eternal .skill-content { .fvtt-cthulhu-eternal .skill-content {
font-family: var(--font-primary); font-family: var(--font-primary);
font-size: calc(var(--font-size-standard) * 1); font-size: calc(var(--font-size-standard) * 1);

View File

@ -34,7 +34,8 @@ Hooks.once("init", function () {
CONFIG.Actor.documentClass = documents.CthulhuEternalActor CONFIG.Actor.documentClass = documents.CthulhuEternalActor
CONFIG.Actor.dataModels = { CONFIG.Actor.dataModels = {
protagonist: models.CthulhuEternalProtagonist protagonist: models.CthulhuEternalProtagonist,
vehicle: models.CthulhuEternalVehicle
} }
CONFIG.Item.documentClass = documents.CthulhuEternalItem CONFIG.Item.documentClass = documents.CthulhuEternalItem
@ -54,6 +55,7 @@ Hooks.once("init", function () {
// Register sheet application classes // Register sheet application classes
Actors.unregisterSheet("core", ActorSheet) Actors.unregisterSheet("core", ActorSheet)
Actors.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalProtagonistSheet, { types: ["protagonist"], makeDefault: true }) Actors.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalProtagonistSheet, { types: ["protagonist"], makeDefault: true })
Actors.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalVehicleSheet, { types: ["vehicle"], makeDefault: true })
Items.unregisterSheet("core", ItemSheet) Items.unregisterSheet("core", ItemSheet)
Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalSkillSheet, { types: ["skill"], makeDefault: true }) Items.registerSheet("fvtt-cthulhu-eternal", applications.CthulhuEternalSkillSheet, { types: ["skill"], makeDefault: true })

View File

@ -1,12 +1,17 @@
const gulp = require('gulp'); const gulp = require('gulp');
const less = require('gulp-less'); const less = require('gulp-less');
function onError(err) {
util.log(util.colors.red.bold('[ERROR LESS]:'),util.colors.bgRed(err.message));
this.emit('end');
};
/* ----------------------------------------- */ /* ----------------------------------------- */
/* Compile LESS /* Compile LESS
/* ----------------------------------------- */ /* ----------------------------------------- */
function compileLESS() { function compileLESS() {
return gulp.src("styles/fvtt-cthulhu-eternal.less") return gulp.src("styles/fvtt-cthulhu-eternal.less")
.pipe(less()) .pipe(less()).on('error',console.log.bind(console))
.pipe(gulp.dest("./css")) .pipe(gulp.dest("./css"))
} }
const css = gulp.series(compileLESS); const css = gulp.series(compileLESS);

View File

@ -1,7 +1,8 @@
{ {
"TYPES": { "TYPES": {
"Actor": { "Actor": {
"protagonist": "Protagonist" "protagonist": "Protagonist",
"vehicle": "Vehicle"
}, },
"Item": { "Item": {
"skill": "Skill", "skill": "Skill",
@ -149,6 +150,9 @@
"resourceLevel": { "resourceLevel": {
"label": "Resource level" "label": "Resource level"
}, },
"state": {
"label": "State"
},
"settings": { "settings": {
"label": "Settings era" "label": "Settings era"
} }
@ -177,6 +181,9 @@
"riflecarabine": "Rifle/Carabine" "riflecarabine": "Rifle/Carabine"
}, },
"FIELDS": { "FIELDS": {
"state": {
"label": "State"
},
"settings": { "settings": {
"label": "Settings era" "label": "Settings era"
}, },
@ -232,6 +239,34 @@
} }
} }
}, },
"Vehicle": {
"FIELDS": {
"description": {
"label": "Description"
},
"notes": {
"label": "Notes"
},
"surfaceSpeed": {
"label": "Surface Speed"
},
"airSpeed": {
"label": "Air Speed"
},
"armor": {
"label": "Armor"
},
"settings": {
"label": "Settings era"
},
"crew": {
"label": "Crew"
},
"state": {
"label": "State"
}
}
},
"MentalDisorder": { "MentalDisorder": {
"FIELDS": { "FIELDS": {
"description": { "description": {
@ -288,6 +323,15 @@
"veryHarsh": "Very Harsh" "veryHarsh": "Very Harsh"
}, },
"Label": { "Label": {
"Vehicle": "Vehicle",
"Speed": "Speed",
"Slow": "Slow",
"Fast": "Fast",
"Average": "Average",
"None": "None",
"pristine": "Pristine",
"worn": "Worn",
"junk": "Junk",
"resources": "Resources", "resources": "Resources",
"resourceChecks": "Resource Checks", "resourceChecks": "Resource Checks",
"sanBPShort": "BP", "sanBPShort": "BP",

View File

@ -9,3 +9,4 @@ export { default as CthulhuEternalMentalDisorderSheet } from "./sheets/mentaldis
export { default as CthulhuEternalGearSheet } from "./sheets/gear-sheet.mjs" export { default as CthulhuEternalGearSheet } from "./sheets/gear-sheet.mjs"
export { default as CthulhuEternalMotivationSheet } from "./sheets/motivation-sheet.mjs" export { default as CthulhuEternalMotivationSheet } from "./sheets/motivation-sheet.mjs"
export { default as CthulhuEternalArchetypeSheet } from "./sheets/archetype-sheet.mjs" export { default as CthulhuEternalArchetypeSheet } from "./sheets/archetype-sheet.mjs"
export { default as CthulhuEternalVehicleSheet } from "./sheets/vehicle-sheet.mjs"

View File

@ -85,23 +85,9 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
cha: game.i18n.localize("CTHULHUETERNAL.Characteristic.Cha") cha: game.i18n.localize("CTHULHUETERNAL.Characteristic.Cha")
} }
context.tooltipsRessources = {
}
context.rollType = {
str: "characteristic",
dex: "characteristic",
con: "characteristic",
int: "characteristic",
pow: "characteristic",
cha: "characteristic"
}
return context return context
} }
_generateTooltip(type, target) {
}
/** @override */ /** @override */
async _preparePartContext(partId, context) { async _preparePartContext(partId, context) {
const doc = this.document const doc = this.document

View File

@ -0,0 +1,117 @@
import CthulhuEternalActorSheet from "./base-actor-sheet.mjs"
export default class CthulhuEternalVehicleSheet extends CthulhuEternalActorSheet {
/** @override */
static DEFAULT_OPTIONS = {
classes: ["vehicle"],
position: {
width: 680,
height: 540,
},
window: {
contentClasses: ["vehicle-content"],
},
actions: {
createGear: CthulhuEternalVehicleSheet.#onCreateGear,
createWeapon: CthulhuEternalVehicleSheet.#onCreateWeapon,
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-cthulhu-eternal/templates/vehicle-main.hbs",
},
tabs: {
template: "templates/generic/tab-navigation.hbs",
},
equipment: {
template: "systems/fvtt-cthulhu-eternal/templates/vehicle-equipment.hbs",
},
description: {
template: "systems/fvtt-cthulhu-eternal/templates/vehicle-description.hbs",
},
}
/** @override */
tabGroups = {
sheet: "equipment",
}
/**
* Prepare an array of form header tabs.
* @returns {Record<string, Partial<ApplicationTab>>}
*/
#getTabs() {
const tabs = {
equipment: { id: "equipment", group: "sheet", icon: "fa-solid fa-shapes", label: "CTHULHUETERNAL.Label.equipment" },
description: { id: "description", group: "sheet", icon: "fa-solid fa-book", label: "CTHULHUETERNAL.Label.description" },
}
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id
v.cssClass = v.active ? "active" : ""
}
return tabs
}
/** @override */
async _prepareContext() {
const context = await super._prepareContext()
context.tabs = this.#getTabs()
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
context.enrichedNotes = await TextEditor.enrichHTML(this.document.system.notes, { async: true })
return context
}
_generateTooltip(type, target) {
}
/** @override */
async _preparePartContext(partId, context) {
const doc = this.document
switch (partId) {
case "main":
break
case "equipment":
context.tab = context.tabs.equipment
context.weapons = doc.itemTypes.weapon
context.gears = doc.itemTypes.gear
break
case "description":
context.tab = context.tabs.description
context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true })
context.enrichedNotes = await TextEditor.enrichHTML(doc.system.notes, { async: true })
break
}
return context
}
/**
* Creates a new attack item directly from the sheet and embeds it into the document.
* @param {Event} event The initiating click event.
* @param {HTMLElement} target The current target of the event listener.
*/
static #onCreateGear(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newGear"), type: "gear" }])
}
static #onCreateWeapon(event, target) {
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newWeapon"), type: "weapon" }])
}
async _onDrop(event) {
if (!this.isEditable || !this.isEditMode) return
const data = TextEditor.getDragEventData(event)
// Handle different data types
switch (data.type) {
case "Item":
const item = await fromUuid(data.uuid)
return super._onDropItem(item)
}
}
}

View File

@ -113,6 +113,19 @@ export const RESOURCE_BREAKDOWN = [
{ value: 20, hand: 6, stowed: 6, storage: 8, checks: 3} { value: 20, hand: 6, stowed: 6, storage: 8, checks: 3}
] ]
export const VEHICLE_SPEED = {
"none": "CTHULHUETERNAL.Label.None",
"slow": "CTHULHUETERNAL.Label.Slow",
"average": "CTHULHUETERNAL.Label.Average",
"fast": "CTHULHUETERNAL.Label.Fast"
}
export const EQUIPMENT_STATES = {
"pristine": "CTHULHUETERNAL.Label.Pristine",
"worn": "CTHULHUETERNAL.Label.Worn",
"junk": "CTHULHUETERNAL.Label.Junk"
}
export const MENTAL_ILLNESS_CURE_SKILL = { export const MENTAL_ILLNESS_CURE_SKILL = {
jazz: "CTHULHUETERNAL.Skill.Psychoanalyze", jazz: "CTHULHUETERNAL.Skill.Psychoanalyze",
modern: "CTHULHUETERNAL.Skill.Psychoanalyze", modern: "CTHULHUETERNAL.Skill.Psychoanalyze",
@ -213,6 +226,8 @@ export const SYSTEM = {
MENTAL_ILLNESS_CURE_SKILL, MENTAL_ILLNESS_CURE_SKILL,
ERA_CSS, ERA_CSS,
INSANITY, INSANITY,
EQUIPMENT_STATES,
RESOURCE_BREAKDOWN, RESOURCE_BREAKDOWN,
VEHICLE_SPEED,
ASCII ASCII
} }

View File

@ -9,3 +9,5 @@ export { default as CthulhuEternalBond } from "./bond.mjs"
export { default as CthulhuEternalGear } from "./gear.mjs" export { default as CthulhuEternalGear } from "./gear.mjs"
export { default as CthulhuEternalMotivation } from "./motivation.mjs" export { default as CthulhuEternalMotivation } from "./motivation.mjs"
export { default as CthulhuEternalArchetype } from "./archetype.mjs" export { default as CthulhuEternalArchetype } from "./archetype.mjs"
export { default as CthulhuEternalVehicle } from "./vehicle.mjs"

View File

@ -9,6 +9,7 @@ export default class CthulhuEternalGHear extends foundry.abstract.TypeDataModel
schema.description = new fields.HTMLField({ required: true, textSearch: true }) schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.settings = new fields.StringField({ required: true, initial: "modern", choices: SYSTEM.AVAILABLE_SETTINGS }) schema.settings = new fields.StringField({ required: true, initial: "modern", choices: SYSTEM.AVAILABLE_SETTINGS })
schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 }) schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.state = new fields.StringField({ required: true, initial: "pristine", choices: SYSTEM.EQUIPMENT_STATES })
return schema return schema
} }

View File

@ -33,8 +33,8 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
}) })
schema.hp = new fields.SchemaField({ schema.hp = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }), value: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }), max: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 }),
stunned: new fields.BooleanField({ required: true, initial: false }) stunned: new fields.BooleanField({ required: true, initial: false })
}) })
@ -146,8 +146,12 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
updates[`system.hp.value`] = this.hp.max updates[`system.hp.value`] = this.hp.max
} }
if ( this.resources.permanentRating <= 20) { if (this.resources.permanentRating < 0) {
let breakdown = SYSTEM.RESOURCE_BREAKDOWN[this.resources.permanentRating] updates[`system.resources.permanentRating`] = 0
}
let resourceIndex = Math.max(Math.min(this.resources.permanentRating, 20), 0)
let breakdown = SYSTEM.RESOURCE_BREAKDOWN[this.resources.resourceIndex]
if (this.resources.hand !== breakdown.hand) { if (this.resources.hand !== breakdown.hand) {
updates[`system.resources.hand`] = breakdown.hand updates[`system.resources.hand`] = breakdown.hand
} }
@ -155,12 +159,11 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
updates[`system.resources.stowed`] = breakdown.stowed updates[`system.resources.stowed`] = breakdown.stowed
} }
if (this.resources.storage !== breakdown.storage) { if (this.resources.storage !== breakdown.storage) {
updates[`system.resources.storage`] = breakdown.storage updates[`system.resources.storage`] = breakdown.storage + (this.resources.permanentRating - resourceIndex)
} }
if (this.resources.nbValidChecks !== breakdown.checks) { if (this.resources.nbValidChecks !== breakdown.checks) {
updates[`system.resources.nbValidChecks`] = breakdown.checks updates[`system.resources.nbValidChecks`] = breakdown.checks
} }
}
if (Object.keys(updates).length > 0) { if (Object.keys(updates).length > 0) {
this.parent.update(updates) this.parent.update(updates)

34
module/models/vehicle.mjs Normal file
View File

@ -0,0 +1,34 @@
import { SYSTEM } from "../config/system.mjs"
import CthulhuEternalRoll from "../documents/roll.mjs"
export default class CthulhuEternalVehicle extends foundry.abstract.TypeDataModel {
static defineSchema() {
const fields = foundry.data.fields
const requiredInteger = { required: true, nullable: false, integer: true }
const schema = {}
schema.settings = new fields.StringField({ required: true, initial: "modern", choices: SYSTEM.AVAILABLE_SETTINGS })
schema.hp = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 })
})
schema.armor = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.surfaceSpeed = new fields.StringField({ required: true, initial: "slow", choices: SYSTEM.VEHICLE_SPEED })
schema.airSpeed = new fields.StringField({ required: true, initial: "none", choices: SYSTEM.VEHICLE_SPEED })
schema.state = new fields.StringField({ required: true, initial: "pristine", choices: SYSTEM.EQUIPMENT_STATES })
schema.crew = new fields.ArrayField(new fields.StringField(), { required: false, initial: [], min:0 })
schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.notes = new fields.HTMLField({ required: true, textSearch: true })
return schema
}
/** @override */
static LOCALIZATION_PREFIXES = ["CTHULHUETERNAL.Vehicle"]
}

View File

@ -17,6 +17,7 @@ export default class LethalFantasySkill extends foundry.abstract.TypeDataModel {
schema.killRadius = new fields.NumberField({ required: true, initial: 0, min: 0 }) schema.killRadius = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.armorPiercing = new fields.NumberField({ required: true, initial: 0, min: 0 }) schema.armorPiercing = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.weaponSubtype = new fields.StringField({ required: true, initial: "basicfirearm", choices: SYSTEM.WEAPON_SUBTYPE }) schema.weaponSubtype = new fields.StringField({ required: true, initial: "basicfirearm", choices: SYSTEM.WEAPON_SUBTYPE })
schema.state = new fields.StringField({ required: true, initial: "pristine", choices: SYSTEM.EQUIPMENT_STATES })
schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 }) schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 })

BIN
packs/skills/CURRENT (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/LOG (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/LOG.old (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/MANIFEST-000028 (Stored with Git LFS)

Binary file not shown.

BIN
packs/skills/MANIFEST-000036 (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -4,6 +4,7 @@
.fvtt-cthulhu-eternal { .fvtt-cthulhu-eternal {
@import "mixins.less"; @import "mixins.less";
@import "protagonist.less"; @import "protagonist.less";
@import "vehicle.less";
@import "skill.less"; @import "skill.less";
@import "injury.less"; @import "injury.less";
@import "weapon.less"; @import "weapon.less";

View File

@ -61,6 +61,13 @@
} }
} }
.vehicle-sheet-common {
label {
font-family: var(--font-secondary);
font-size: calc(var(--font-size-standard) * 1.0);
}
}
.item-sheet-common { .item-sheet-common {
.form-fields { .form-fields {
padding-top: 4px; padding-top: 4px;

223
styles/vehicle.less Normal file
View File

@ -0,0 +1,223 @@
.vehicle-content {
.sheet-common();
.vehicle-sheet-common();
overflow: scroll;
}
.sheet-tabs {
background-color: var(--color-light-1);
}
.vehicle-main {
background-color: var(--color-light-1);
display: flex;
.vehicle-pc {
display: flex;
gap: 4px;
flex: 1;
.vehicle-left {
min-width: 180px;
display: flex;
flex-direction: column;
.vehicle-left-image {
display: flex;
justify-content: center;
align-items: center;
padding-bottom: 8px;
.vehicle-img {
height: 140px;
width: auto;
border: none;
}
}
}
.vehicle-right {
display: flex;
flex-direction: column;
gap: 5px;
.vehicle-name {
display: flex;
input {
font-family: var(--font-title);
font-size: calc(var(--font-size-standard) * 1.4);
width: 400px;
}
}
.vehicle-infos {
display: flex;
flex-direction: column;
gap: 4px;
label {
min-width: 120px;
}
.vehicle-hp {
display: flex;
gap: 2px;
align-items: center;
.vehicle-hp-value {
.form-fields input {
flex: none;
width: 50px;
margin-left: 4px;
font-size: calc(var(--font-size-standard) * 1.4);
}
}
.vehicle-hp-max {
clear: both;
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin: 3px 0;
align-items: center;
input {
width: 50px;
text-align: center;
font-size: calc(var(--font-size-standard) * 1.4);
}
}
.hp-separator {
font-size: calc(var(--font-size-standard) * 1.2);
display: flex;
align-items: center;
justify-content: center;
}
}
}
}
}
.vehicle-pc-play {
min-width: 500px;
}
.vehicle-pc-edit {
min-width: 650px;
}
}
.vehicle-biography {
background-color: var(--color-light-1);
prose-mirror.inactive {
min-height: 40px;
}
prose-mirror.active {
min-height: 150px;
}
.field-label {
margin-left: 8px;
}
.biodata {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 8px;
label {
min-width: 3.0rem;
}
.feature {
display: flex;
align-items: center;
gap: 4px;
min-width: 18rem;
max-width: 18rem;
}
}
}
.tab.vehicle-equipment {
background-color: var(--color-light-1);
display: grid;
grid-template-columns: 1fr;
legend {
a {
font-size: calc(var(--font-size-standard) * 1.4);
padding-left: 5px;
}
}
.weapons {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 4px;
.weapon {
display: flex;
align-items: center;
gap: 4px;
min-width: 13rem;
max-width: 13srem;
.rollable:hover,
.rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
cursor: pointer;
}
.controls {
min-width: 2rem;
max-width: 2rem;
}
.damage {
min-width: 5rem;
max-width: 5rem;
}
.name {
min-width: 8rem;
max-width: 8rem;
}
.item-img {
width: 32px;
height: 32px;
margin: 4px 0 0 0;
}
}
}
.gears {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 4px;
.gear {
display: flex;
align-items: center;
gap: 4px;
min-width: 13rem;
max-width: 13srem;
.rollable:hover,
.rollable:focus {
text-shadow: 0 0 8px var(--color-shadow-primary);
cursor: pointer;
}
.controls {
min-width: 2rem;
max-width: 2rem;
}
.damage {
min-width: 5rem;
max-width: 5rem;
}
.name {
min-width: 8rem;
max-width: 8rem;
}
.item-img {
width: 32px;
height: 32px;
margin: 4px 0 0 0;
}
}
}
prose-mirror.inactive {
min-height: 40px;
}
prose-mirror.active {
min-height: 150px;
}
}

View File

@ -34,7 +34,8 @@
], ],
"documentTypes": { "documentTypes": {
"Actor": { "Actor": {
"protagonist": { "htmlFields": ["description", "notes"] } "protagonist": { "htmlFields": ["description", "notes"] },
"vehicle": { "htmlFields": ["description", "notes"] }
}, },
"Item": { "Item": {
"skill": { "htmlFields": ["description"] }, "skill": { "htmlFields": ["description"] },

View File

@ -7,6 +7,7 @@
<fieldset> <fieldset>
{{formField systemFields.settings value=system.settings localize=true}} {{formField systemFields.settings value=system.settings localize=true}}
{{formField systemFields.resourceLevel value=system.resourceLevel}} {{formField systemFields.resourceLevel value=system.resourceLevel}}
{{formField systemFields.state value=system.state}}
</fieldset> </fieldset>
<fieldset> <fieldset>

View File

@ -14,6 +14,7 @@
data-name="checks" {{#if check}} checked {{/if}} {{#if (gte @index @root.system.resources.nbValidChecks)}} disabled {{/if}}> data-name="checks" {{#if check}} checked {{/if}} {{#if (gte @index @root.system.resources.nbValidChecks)}} disabled {{/if}}>
{{/each}} {{/each}}
</div> </div>
<button class="resource-roll">Resource roll</button>
</div> </div>
</fieldset> </fieldset>

View File

@ -0,0 +1,12 @@
<section class="tab vehicle-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.description"}}</legend>
{{formInput systemFields.description enriched=enrichedDescription value=system.description name="system.description" toggled=true}}
</fieldset>
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.notes"}}</legend>
{{formInput systemFields.notes enriched=enrichedNotes value=system.notes name="system.notes" toggled=true}}
</fieldset>
</section>

View File

@ -0,0 +1,54 @@
<section class="tab vehicle-{{tab.id}} {{tab.cssClass}}" data-tab="{{tab.id}}" data-group="{{tab.group}}">
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.weapons"}}{{#if isEditMode}}
<a class="action" data-tooltip="{{localize " CTHULHUETERNAL.Tooltip.addWeapon"}}" data-tooltip-direction="UP"><i
class="fas fa-plus" data-action="createWeapon"></i></a>{{/if}}
</legend>
<div class="weapons">
{{#each weapons as |item|}}
{{!log 'weapon' this}}
<div class="weapon item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-drag="true">
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
<div class="name rollable" data-roll-type="weapon" data-tooltip="{{{item.system.description}}}">
{{item.name}}
</div>
<a class="damage rollable" data-item-id="{{item.id}}" data-action="roll" data-roll-type="damage"
data-roll-value="{{item.system.damage}}">{{localize "CTHULHUETERNAL.Label.damageShort"}} :
{{item.system.damage}}</a>
<div class="controls">
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
</div>
</div>
{{/each}}
</div>
</fieldset>
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.gears"}}{{#if isEditMode}}
<a class="action" data-tooltip="{{localize " CTHULHUETERNAL.Tooltip.addGear"}}" data-tooltip-direction="UP"><i
class="fas fa-plus" data-action="createGear"></i></a>{{/if}}
</legend>
<div class="gears">
{{#each gears as |item|}}
{{!log 'armor' this}}
<div class="gear" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}">
<img class="item-img" src="{{item.img}}" data-tooltip="{{item.name}}" />
<div class="name" data-tooltip="{{{item.system.description}}}">
{{item.name}}
</div>
<div class="controls">
<a data-tooltip="{{localize 'CTHULHUETERNAL.Edit'}}" data-action="edit" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-edit"></i></a>
<a data-tooltip="{{localize 'CTHULHUETERNAL.Delete'}}" data-action="delete" data-item-id="{{item.id}}"
data-item-uuid="{{item.uuid}}"><i class="fas fa-trash"></i></a>
</div>
</div>
{{/each}}
</div>
</fieldset>
</section>

View File

@ -0,0 +1,52 @@
<section class="vehicle-main vehicle-main-{{ifThen isPlayMode 'play' 'edit'}}">
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.vehicle"}}</legend>
<div class="vehicle-pc vehicle-pc-{{ifThen isPlayMode 'play' 'edit'}}">
<div class="vehicle-left">
<div class="vehicle-left-image">
<img class="vehicle-img" src="{{actor.img}}" data-edit="img" data-action="editImage"
data-tooltip="{{actor.name}}" />
</div>
<fieldset>
<legend>{{localize "CTHULHUETERNAL.Label.HP"}}</legend>
<div class="flexrow">
{{formField systemFields.hp.fields.value value=system.hp.value}}
/
{{formField systemFields.hp.fields.max value=system.hp.max rootId=partId disabled=true}}
</div>
</fieldset>
</div>
<div class="vehicle-right">
<div class="vehicle-name">
{{formInput fields.name value=source.name rootId=partId disabled=isPlayMode}}
<a class="control" data-action="toggleSheet" data-tooltip="CTHULHUETERNAL.ToggleSheet"
data-tooltip-direction="UP">
<i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
</a>
</div>
<fieldset class="speed">
<legend>{{localize "CTHULHUETERNAL.Label.Speed"}}</legend>
<div class="flexrow">
{{formField systemFields.surfaceSpeed value=system.surfaceSpeed localize=true}}
{{formField systemFields.airSpeed value=system.airSpeed localize=true}}
</div>
</fieldset>
<fieldset class="armr ">
<legend>{{localize "CTHULHUETERNAL.Label.armor"}}</legend>
<div class="flexrow">
{{formField systemFields.armor value=system.armor localize=true}}
</div>
</fieldset>
</div>
</div>
</fieldset>
</section>

View File

@ -11,6 +11,8 @@
{{formField systemFields.weaponSubtype value=system.weaponSubtype localize=true}} {{formField systemFields.weaponSubtype value=system.weaponSubtype localize=true}}
{{/if}} {{/if}}
{{formField systemFields.state value=system.state}}
{{formField systemFields.damage value=system.damage}} {{formField systemFields.damage value=system.damage}}
{{formField systemFields.baseRange value=system.baseRange}} {{formField systemFields.baseRange value=system.baseRange}}
{{formField systemFields.rangeUnit value=system.rangeUnit localize=true}} {{formField systemFields.rangeUnit value=system.rangeUnit localize=true}}