Add rituals and tomes
This commit is contained in:
@ -9,4 +9,6 @@ export { default as CthulhuEternalMentalDisorderSheet } from "./sheets/mentaldis
|
||||
export { default as CthulhuEternalGearSheet } from "./sheets/gear-sheet.mjs"
|
||||
export { default as CthulhuEternalMotivationSheet } from "./sheets/motivation-sheet.mjs"
|
||||
export { default as CthulhuEternalArchetypeSheet } from "./sheets/archetype-sheet.mjs"
|
||||
export { default as CthulhuEternalRitualSheet } from "./sheets/ritual-sheet.mjs"
|
||||
export { default as CthulhuEternalVehicleSheet } from "./sheets/vehicle-sheet.mjs"
|
||||
export { default as CthulhuEternalTomeSheet } from "./sheets/tome-sheet.mjs"
|
||||
|
@ -96,7 +96,6 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
|
||||
drop: this._canDragDrop.bind(this),
|
||||
}
|
||||
d.callbacks = {
|
||||
dragstart: this._onDragStart.bind(this),
|
||||
dragover: this._onDragOver.bind(this),
|
||||
drop: this._onDrop.bind(this),
|
||||
}
|
||||
@ -133,70 +132,6 @@ export default class CthulhuEternalActorSheet extends HandlebarsApplicationMixin
|
||||
return true //this.isEditable && this.document.isOwner
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback actions which occur at the beginning of a drag start workflow.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
_onDragStart(event) {
|
||||
if ("link" in event.target.dataset) return
|
||||
|
||||
const el = event.currentTarget.closest('[data-drag="true"]')
|
||||
const dragType = el.dataset.dragType
|
||||
|
||||
let dragData = {}
|
||||
|
||||
let target
|
||||
switch (dragType) {
|
||||
case "save":
|
||||
target = event.currentTarget.querySelector("input")
|
||||
dragData = {
|
||||
actorId: this.document.id,
|
||||
type: "roll",
|
||||
rollType: target.dataset.rollType,
|
||||
rollTarget: target.dataset.rollTarget,
|
||||
value: target.value,
|
||||
}
|
||||
break
|
||||
case "resource":
|
||||
target = event.currentTarget.querySelector("select")
|
||||
dragData = {
|
||||
actorId: this.document.id,
|
||||
type: "roll",
|
||||
rollType: target.dataset.rollType,
|
||||
rollTarget: target.dataset.rollTarget,
|
||||
value: target.value,
|
||||
}
|
||||
break
|
||||
case "damage":
|
||||
dragData = {
|
||||
actorId: this.document.id,
|
||||
type: "rollDamage",
|
||||
rollType: el.dataset.dragType,
|
||||
rollTarget: el.dataset.itemId,
|
||||
}
|
||||
break
|
||||
case "attack":
|
||||
dragData = {
|
||||
actorId: this.document.id,
|
||||
type: "rollAttack",
|
||||
rollValue: el.dataset.rollValue,
|
||||
rollTarget: el.dataset.rollTarget,
|
||||
}
|
||||
break
|
||||
default:
|
||||
// Handle other cases or do nothing
|
||||
break
|
||||
}
|
||||
|
||||
// Extract the data you need
|
||||
|
||||
if (!dragData) return
|
||||
|
||||
// Set data transfer
|
||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback actions which occur when a dragged element is over a drop target.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
|
@ -20,7 +20,9 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
|
||||
createInjury: CthulhuEternalProtagonistSheet.#onCreateInjury,
|
||||
createMentalDisorder: CthulhuEternalProtagonistSheet.#onCreateMentalDisorder,
|
||||
createMotivation: CthulhuEternalProtagonistSheet.#onCreateMotivation,
|
||||
createSkill: CthulhuEternalProtagonistSheet.#onCreateSkill
|
||||
createSkill: CthulhuEternalProtagonistSheet.#onCreateSkill,
|
||||
createRitual: CthulhuEternalProtagonistSheet.#onCreateRitual,
|
||||
createTome: CthulhuEternalProtagonistSheet.#onCreateTome,
|
||||
},
|
||||
}
|
||||
|
||||
@ -108,6 +110,10 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
|
||||
context.armors.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.gears = doc.itemTypes.gear
|
||||
context.gears.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.rituals = doc.itemTypes.ritual
|
||||
context.rituals.sort((a, b) => a.name.localeCompare(b.name))
|
||||
context.tomes = doc.itemTypes.tome
|
||||
context.tomes.sort((a, b) => a.name.localeCompare(b.name))
|
||||
break
|
||||
case "status":
|
||||
context.tab = context.tabs.status
|
||||
@ -170,6 +176,14 @@ export default class CthulhuEternalProtagonistSheet extends CthulhuEternalActorS
|
||||
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newSkill"), type: "skill" }])
|
||||
}
|
||||
|
||||
static #onCreateRitual(event, target) {
|
||||
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newRitual"), type: "ritual" }])
|
||||
}
|
||||
|
||||
static #onCreateTome(event, target) {
|
||||
this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("CTHULHUETERNAL.Label.newTome"), type: "tome" }])
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the roll action triggered by user interaction.
|
||||
*
|
||||
|
28
module/applications/sheets/ritual-sheet.mjs
Normal file
28
module/applications/sheets/ritual-sheet.mjs
Normal file
@ -0,0 +1,28 @@
|
||||
import CthulhuEternalItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class CthulhuEternalRitualSheet extends CthulhuEternalItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["ritual"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["ritual-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-cthulhu-eternal/templates/ritual.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
|
||||
return context
|
||||
}
|
||||
}
|
28
module/applications/sheets/tome-sheet.mjs
Normal file
28
module/applications/sheets/tome-sheet.mjs
Normal file
@ -0,0 +1,28 @@
|
||||
import CthulhuEternalItemSheet from "./base-item-sheet.mjs"
|
||||
|
||||
export default class CthulhuEternalTomeSheet extends CthulhuEternalItemSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["tome"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["tome-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/fvtt-cthulhu-eternal/templates/tome.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
|
||||
return context
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ export const INSANITY = {
|
||||
}
|
||||
|
||||
export const ERA_CSS = {
|
||||
jazz: { primaryFont: "RozhaOne", secondaryFont: "RozhaOne", titleFont: "Broadway", baseFontSize: "1.0rem", titleFontSize: "1.2rem", imgFilter: "brightness(0) saturate(100%) invert(52%) sepia(9%) saturate(2368%) hue-rotate(360deg) brightness(86%) contrast(84%)" },
|
||||
jazz: { primaryFont: "RozhaOne", secondaryFont: "RozhaOne", titleFont: "Broadway", baseFontSize: "0.95rem", titleFontSize: "1.2rem", imgFilter: "brightness(0) saturate(100%) invert(52%) sepia(9%) saturate(2368%) hue-rotate(360deg) brightness(86%) contrast(84%)" },
|
||||
modern: { primaryFont: "Georama", secondaryFont: "Georama", titleFont: "Georama", baseFontSize: "1.0rem", titleFontSize: "1.2rem",imgFilter: "brightness(0) saturate(100%) invert(92%) sepia(11%) saturate(1214%) hue-rotate(51deg) brightness(93%) contrast(86%)" },
|
||||
future: { primaryFont: "Georama", secondaryFont: "Georama", titleFont: "Seabreed", baseFontSize: "1.0rem", titleFontSize: "2.0rem",imgFilter: "invert(90%) sepia(6%) saturate(1818%) hue-rotate(152deg) brightness(91%) contrast(91%)" },
|
||||
victorian: { primaryFont: "Volkhov", secondaryFont: "Volkhov", titleFont: "Excelsior", baseFontSize: "1.0rem", titleFontSize: "1.2rem",imgFilter: "brightness(0) saturate(100%) invert(100%) sepia(59%) saturate(1894%) hue-rotate(337deg) brightness(88%) contrast(98%)" },
|
||||
@ -238,6 +238,12 @@ export const MULTIPLIER_CHOICES = {
|
||||
"5": "5"
|
||||
}
|
||||
|
||||
export const RITUAL_TYPES = {
|
||||
"simple": "CTHULHUETERNAL.Ritual.Simple",
|
||||
"complex": "CTHULHUETERNAL.Ritual.Complex",
|
||||
"elaborate": "CTHULHUETERNAL.Ritual.Elaborate"
|
||||
}
|
||||
|
||||
/**
|
||||
* Include all constant definitions within the SYSTEM global export
|
||||
* @type {Object}
|
||||
@ -261,5 +267,6 @@ export const SYSTEM = {
|
||||
MODIFIER_CHOICES,
|
||||
MULTIPLIER_CHOICES,
|
||||
ASCII,
|
||||
DAMAGE_BONUS
|
||||
DAMAGE_BONUS,
|
||||
RITUAL_TYPES
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ export const defaultItemImg = {
|
||||
arcane: "systems/fvtt-cthulhu-eternal/assets/icons/icon_arcane.svg",
|
||||
injury: "systems/fvtt-cthulhu-eternal/assets/icons/icon_injury.svg",
|
||||
motivation: "systems/fvtt-cthulhu-eternal/assets/icons/icon_motivation.svg",
|
||||
ritual: "systems/fvtt-cthulhu-eternal/assets/icons/icon_ritual.svg",
|
||||
tome: "systems/fvtt-cthulhu-eternal/assets/icons/icon_tome.svg",
|
||||
}
|
||||
|
||||
export default class CthulhuEternalItem extends Item {
|
||||
|
@ -9,5 +9,7 @@ export { default as CthulhuEternalBond } from "./bond.mjs"
|
||||
export { default as CthulhuEternalGear } from "./gear.mjs"
|
||||
export { default as CthulhuEternalMotivation } from "./motivation.mjs"
|
||||
export { default as CthulhuEternalArchetype } from "./archetype.mjs"
|
||||
export { default as CthulhuEternalRitual } from "./ritual.mjs"
|
||||
export { default as CthulhuEternalVehicle } from "./vehicle.mjs"
|
||||
export { default as CthulhuEternalTome } from "./tome.mjs"
|
||||
|
||||
|
24
module/models/ritual.mjs
Normal file
24
module/models/ritual.mjs
Normal file
@ -0,0 +1,24 @@
|
||||
import { SYSTEM } from "../config/system.mjs"
|
||||
|
||||
export default class CthulhuEternalRitual extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields
|
||||
const requiredInteger = { required: true, nullable: false, integer: true }
|
||||
const schema = {}
|
||||
|
||||
schema.ritualType = new fields.StringField({ required: true, initial: "simple", choices: SYSTEM.RITUAL_TYPES })
|
||||
schema.studyTime = new fields.StringField({ required: true, initial: "X days", textSearch: true })
|
||||
schema.studySAN = new fields.StringField({ required: true, initial: "1d4", textSearch: true })
|
||||
schema.activationTime = new fields.StringField({ required: true, initial: "X turns", textSearch: true })
|
||||
schema.activationWP = new fields.StringField({ required: true, initial: "1d4", textSearch: true })
|
||||
schema.activationSAN = new fields.StringField({ required: true, initial: "1d6", textSearch: true })
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
return schema
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["CTHULHUETERNAL.Ritual"]
|
||||
|
||||
}
|
64
module/models/tome.mjs
Normal file
64
module/models/tome.mjs
Normal file
@ -0,0 +1,64 @@
|
||||
import { SYSTEM } from "../config/system.mjs";
|
||||
|
||||
export default class CthulhuEternalTome extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const schema = {};
|
||||
|
||||
let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern"
|
||||
schema.minimumEra = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS })
|
||||
|
||||
schema.creationDate = new fields.StringField({
|
||||
required: true,
|
||||
initial: "",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
// Language field
|
||||
schema.language = new fields.StringField({
|
||||
required: true,
|
||||
initial: "Latin",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
// studyTime field
|
||||
schema.studyTime = new fields.StringField({
|
||||
required: true,
|
||||
initial: "X days",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
// SAN loss field
|
||||
schema.sanLoss = new fields.StringField({
|
||||
required: true,
|
||||
initial: "1d4",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
// Unnatural skill field
|
||||
schema.unnaturalSkill = new fields.StringField({
|
||||
required: true,
|
||||
initial: "1d4",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
schema.rituals = new fields.StringField({
|
||||
required: true,
|
||||
initial: "",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
schema.otherBenefits = new fields.StringField({
|
||||
required: true,
|
||||
initial: "",
|
||||
textSearch: true
|
||||
});
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, textSearch: true })
|
||||
|
||||
return schema;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["CTHULHUETERNAL.Tome"];
|
||||
}
|
Reference in New Issue
Block a user