⚙️ ${game.i18n.localize("MGNE.Notification.RollUsageDiceReminder")}
- ${lines}
import { ASCII, SYSTEM, SYSTEM_ID, localizeSystemConfig } from "./module/config/system.mjs" import * as models from "./module/models/_module.mjs" import * as documents from "./module/documents/_module.mjs" import * as applications from "./module/applications/_module.mjs" import MGNERoll from "./module/documents/roll.mjs" Hooks.once("init", () => { console.info(ASCII) console.info(`${SYSTEM_ID} | Initializing system`) game.mgne = { SYSTEM, applications, documents, models, } CONFIG.Actor.documentClass = documents.MGNEActor CONFIG.Actor.dataModels = { character: models.MGNECharacter, creature: models.MGNECreature, companion: models.MGNECompanion, } CONFIG.Combat.documentClass = documents.MGNECombat CONFIG.Item.documentClass = documents.MGNEItem CONFIG.Item.dataModels = { weapon: models.MGNEWeapon, armor: models.MGNEArmor, shield: models.MGNEShield, equipment: models.MGNEEquipment, "resonance-core": models.MGNEResonanceCore, artifact: models.MGNEArtifact, feature: models.MGNEFeature, } foundry.applications.sheets.ActorSheetV2 && foundry.documents.collections.Actors.unregisterSheet( "core", foundry.applications.sheets.ActorSheetV2, { types: Object.keys(CONFIG.Actor.dataModels) } ) foundry.appv1?.sheets?.ActorSheet && foundry.documents.collections.Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet) foundry.documents.collections.Actors.registerSheet(SYSTEM_ID, applications.MGNECharacterSheet, { types: ["character"], makeDefault: true, label: SYSTEM.actorTypes.character.label }) foundry.documents.collections.Actors.registerSheet(SYSTEM_ID, applications.MGNECreatureSheet, { types: ["creature"], makeDefault: true, label: SYSTEM.actorTypes.creature.label }) foundry.documents.collections.Actors.registerSheet(SYSTEM_ID, applications.MGNECompanionSheet, { types: ["companion"], makeDefault: true, label: SYSTEM.actorTypes.companion.label }) foundry.applications.sheets.ItemSheetV2 && foundry.documents.collections.Items.unregisterSheet( "core", foundry.applications.sheets.ItemSheetV2, { types: Object.keys(CONFIG.Item.dataModels) } ) foundry.appv1?.sheets?.ItemSheet && foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEWeaponSheet, { types: ["weapon"], makeDefault: true, label: SYSTEM.itemTypes.weapon.label }) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEArmorSheet, { types: ["armor"], makeDefault: true, label: SYSTEM.itemTypes.armor.label }) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEShieldSheet, { types: ["shield"], makeDefault: true, label: SYSTEM.itemTypes.shield.label }) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEEquipmentSheet, { types: ["equipment"], makeDefault: true, label: SYSTEM.itemTypes.equipment.label }) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEResonanceCoreSheet, { types: ["resonance-core"], makeDefault: true, label: SYSTEM.itemTypes["resonance-core"].label }) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEArtifactSheet, { types: ["artifact"], makeDefault: true, label: SYSTEM.itemTypes.artifact.label }) foundry.documents.collections.Items.registerSheet(SYSTEM_ID, applications.MGNEFeatureSheet, { types: ["feature"], makeDefault: true, label: SYSTEM.itemTypes.feature.label }) Handlebars.registerHelper("isEqual", (left, right) => left === right) }) Hooks.once("setup", () => { localizeSystemConfig() }) Hooks.once("ready", () => { console.info(`${SYSTEM_ID} | Ready`) }) Hooks.on("deleteCombat", (combat) => { if (!game.user.isGM) return const pcActors = [...new Set( combat.combatants .filter(c => c.actor?.hasPlayerOwner) .map(c => c.actor) )] const cores = pcActors.flatMap(actor => actor.items.filter(item => item.type === "resonance-core" && !item.system.burnedOut && item.system.usageDie !== "depleted") ) if (!cores.length) return const lines = cores.map(c => `
⚙️ ${game.i18n.localize("MGNE.Notification.RollUsageDiceReminder")}
${game.i18n.format("MGNE.RollDialog.OmenReducePrompt", { name: targetActor.name, omens: targetOmens })}
${reduceMsg}