export const DEFAULT_AUGMENTS = [ { id: "bonded", name: "Bonded", effect: "Primary module for Ikonis hardware synchronization.", cost: "Cost: None" }, { id: "force", name: "Force", effect: "+1 Damage on Melee attacks.", cost: "Cost: 2 Iron" }, { id: "fire", name: "Fire", effect: "Deals Fire damage instead of Physical.", cost: "Cost: 1 Blaze Glass" }, { id: "shield", name: "Shield", effect: "+1 Armor while equipped.", cost: "Cost: 2 Steel" }, { id: "range", name: "Range", effect: "Increases Range by 1 step.", cost: "Cost: 1 Lens" } ]; // Global caches for resolved features to keep getters fast const _featureCache = new Map(); /** * Injects Ikonis defaults directly into the system configuration. */ export function registerIkonisFeatures() { if (!CONFIG.DH?.ITEM?.weaponFeatures) return; for (const aug of DEFAULT_AUGMENTS) { const nativeId = `ikonis-${aug.id}`; CONFIG.DH.ITEM.weaponFeatures[nativeId] = { name: `Ikonis: ${aug.name}`, img: "systems/daggerheart/assets/icons/documents/items/chip.svg", description: `
${aug.effect}
${aug.cost}
`, actions: {}, effects: [] }; } console.log("DH-Ikonis | Features registered in CONFIG."); } /** * Seeds the Daggerheart Homebrew settings with Ikonis defaults if they don't exist. */ export async function seedIkonisHomebrew() { if (!game.user.isGM) return; const homebrewKey = game.settings.settings.has('daggerheart.Homebrew') ? 'Homebrew' : 'homebrew'; const homebrew = foundry.utils.deepClone(game.settings.get('daggerheart', homebrewKey) || {}); if (!homebrew.itemFeatures) homebrew.itemFeatures = { weaponFeatures: {}, armorFeatures: {} }; if (!homebrew.itemFeatures.weaponFeatures) homebrew.itemFeatures.weaponFeatures = {}; let updates = false; for (const aug of DEFAULT_AUGMENTS) { const nativeId = `ikonis-${aug.id}`; if (!homebrew.itemFeatures.weaponFeatures[nativeId]) { homebrew.itemFeatures.weaponFeatures[nativeId] = { name: `Ikonis: ${aug.name}`, img: "systems/daggerheart/assets/icons/documents/items/chip.svg", description: `${aug.effect}
${aug.cost}
`, actions: {}, effects: [] }; updates = true; } } if (updates) { await game.settings.set('daggerheart', homebrewKey, homebrew); console.log("DH-Ikonis | Default blueprints seeded into Homebrew settings."); } } /** * Scans the Daggerheart system config for any weapon features starting with "Ikonis:". * These are treated as available augments for our slot system. */ export function getAugments() { // We get the resolved features from CONFIG.DH.ITEM which includes system + homebrew const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures() || {}; const augments = []; for (const [id, feature] of Object.entries(allFeatures)) { const name = feature.label || feature.name || ""; if (name.startsWith("Ikonis:")) { let desc = feature.description || ""; // Replace common line-breaking tags with actual newlines before stripping desc = desc.replace(/<\/p>|