From 4f13fa26dd06a9372723f9459cdb06274c2b3fd6 Mon Sep 17 00:00:00 2001 From: juanferrer Date: Tue, 17 Feb 2026 09:52:55 +0000 Subject: [PATCH] Add option to automatically roll corruption when discovering a new dark magic tradition --- src/lang/en.json | 20 +++++++++++--------- src/lang/es.json | 4 +++- src/module/actor/sheets/character-sheet.js | 10 ++++++++++ src/module/settings.js | 8 ++++++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 54032ff3..d28d5128 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -183,7 +183,7 @@ "DL.BecomeStunned": "You become stunned for {round} round.", "DL.ButtonEdit": "Edit", "DL.ButtonView": "View", - "DL.CanSeeSoureOfAffliction" : "Can see the source of the affliction", + "DL.CanSeeSoureOfAffliction": "Can see the source of the affliction", "DL.ChallengeRequestRollText": "Request Challenge Roll", "DL.ChallengeRoll": "Challenge Roll", "DL.ChallengeRollBonus": "Challenge Roll Bonus", @@ -315,10 +315,10 @@ "DL.DialogDeleteTraditionText": "The Tradition and all spells attached will be permanently deleted.", "DL.DialogDeleteTraitText": "The Trait will be permanently deleted.", "DL.DialogDeleteCreatureRoleText": "The Creature Role will be permanently deleted.", - "DL.DialogDoYouSeeThisCreatureFirstTime":"Do you you see this creature first time?", - "DL.DialogDoYouSeeTheseCreaturesFirstTime":"Do you you see these creatures first time?", - "DL.DialogDoYouStartYourTurnWithLOSCreature":"Do you start your turn with line of sight to the following creature?", - "DL.DialogDoYouStartYourTurnWithLOSCreatures":"Do you start your turn with line of sight to the following creatures?", + "DL.DialogDoYouSeeThisCreatureFirstTime": "Do you you see this creature first time?", + "DL.DialogDoYouSeeTheseCreaturesFirstTime": "Do you you see these creatures first time?", + "DL.DialogDoYouStartYourTurnWithLOSCreature": "Do you start your turn with line of sight to the following creature?", + "DL.DialogDoYouStartYourTurnWithLOSCreatures": "Do you start your turn with line of sight to the following creatures?", "DL.DialogInvalidRollFormula": "Invalid Roll Formula: {rollFormula}!", "DL.DialogFortuneAwarded": "Awarded a Fortune point.", "DL.DialogFortuneExpended": "Expended a Fortune point.", @@ -369,7 +369,7 @@ "DL.DialogWarningActorsNotSelected": "Actor(s) not selected", "DL.DialogWarningActorsNotTargeted": "Actor(s) not targeted", "DL.DialogWarningAfflictionFromEffect": "Affliction is applied from effect. Remove the effect to remove the affliction.", - "DL.DialogWarningAlreadyMadeWILLImmune": "You've already made a Will challenge roll against {creature} and you are immune to its {trait} trait.", + "DL.DialogWarningAlreadyMadeWILLImmune": "You've already made a Will challenge roll against {creature} and you are immune to its {trait} trait.", "DL.DialogWarningAlreadyMadeWILLFrightened": "You've already made a Will challenge roll against {creature} and you are already frightened.", "DL.DialogWarningBlindedChallengeFailer": "You're blinded and perception challenge rolls result in failure.", "DL.DialogWarningCreatureArmor": "You can't add armor to a creature. Change the Defense value manually.", @@ -379,7 +379,7 @@ "DL.DialogWarningStunnedFailer": "You're stunned and cannot use actions or move, and all your challenge rolls result in failure.", "DL.DialogWarningSurprisedFailer": "You're surprised and cannot use actions or move, and all your challenge rolls result in failure.", "DL.DialogWarningTargetNotHorrifying": "{target} not horrifying.", - "DL.DialogWarningTargetNeitherFnorH":"{target} is neither frightening nor horrifying.", + "DL.DialogWarningTargetNeitherFnorH": "{target} is neither frightening nor horrifying.", "DL.DialogWarningTargetNotSelected": "Target not selected", "DL.DialogWarningTargetNotTargeted": "Target not chosen", "DL.DialogWarningUnconsciousFailer": "You're unconscious and cannot use actions or move, and all your challenge rolls result in failure.", @@ -412,8 +412,8 @@ "DL.FrighteningHorrifyingEditor": "Frightening / Horrifying Trait Editor", "DL.FrightenedYou": "{creature} frightened you.", "DL.FrightenedBy": "Frightened by {creature}", - "DL.GainedInsanity" : "You gain {insanity} Insanity.", - "DL.GainedInsanityAndGoMad" : "You gain {insanity} Insanity and go mad.", + "DL.GainedInsanity": "You gain {insanity} Insanity.", + "DL.GainedInsanityAndGoMad": "You gain {insanity} Insanity and go mad.", "DL.GMTools": "GM Tools", "DL.GMnote": "GM Notes", "DL.GMnoteEdit": "Edit GM Note", @@ -626,6 +626,8 @@ "DL.SettingConfirmCreatureRoleRemovalHint": "Show a confirmation dialog when attempting to remove a creature role from a character of level 1 or higher.", "DL.SettingConvertIntoBadge": "Convert icons into badges.", "DL.SettingConvertIntoBadgeHint": "Surround ancestry and path icons with a badge background.", + "DL.SettingDarkMagicCorruptionRollOnLearn": "Roll corruption on new dark magic tradition", + "DL.SettingDarkMagicCorruptionRollOnLearnHint": "Automatically make a corruption roll when discovering a dark magic trdition.", "DL.SettingDSN": "Dice So Nice! Configuration", "DL.SettingDSN3d": "Use Roman numerals on d3", "DL.SettingDSN3dHint": "When using Demonlord dice-set on d3, Arabic numerals are replaced with Roman numerals. (Require refresh).", diff --git a/src/lang/es.json b/src/lang/es.json index 95e1c508..098957f0 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -583,7 +583,9 @@ "DL.SettingConfirmCreatureRoleRemoval": "Confirmar eliminación de rol de criatura", "DL.SettingConfirmCreatureRoleRemovalHint": "Muestra un diálogo de confirmación al intentar borrar un rol de criatura de una criatura.", "DL.SettingConvertIntoBadge": "Convertir en insignia.", - "DL.SettingConvertIntoBadgeHint": "Rodear los icono de linaje y senda con un fondo de insignia.", + "DL.SettingConvertIntoBadgeHint": "Rodear los iconos de linaje y senda con un fondo de insignia.", + "DL.SettingDarkMagicCorruptionRollOnLearn": "Tirar corrupción con nueva tradición de magia oscura", + "DL.SettingDarkMagicCorruptionRollOnLearnHint": "Hacer un desafío de corrupción automáticamente al descubrir una nueva tradición de magia oscura.", "DL.SettingDSN": "Configuración de Dice So Nice!", "DL.SettingDSN3d": "Usar números romanos en el d3", "DL.SettingDSN3dHint": "Cuando se use el set de dados de Demonlord on d3, los números arabicos son reemplazados por números romanos. (Requiere actualizar la página).", diff --git a/src/module/actor/sheets/character-sheet.js b/src/module/actor/sheets/character-sheet.js index 1634d3b1..f9e53704 100644 --- a/src/module/actor/sheets/character-sheet.js +++ b/src/module/actor/sheets/character-sheet.js @@ -190,6 +190,16 @@ export default class DLCharacterSheet extends DLBaseActorSheet { } } }) + } else if (item.type === 'spell') { + if (item.system.isDarkMagic) { + if (game.settings.get('demonlord', 'darkMagicCorruptionRollOnLearn')) { + // If the spell is dark magic from a new tradition, trigger a corruption roll + const knownDarkMagicTraditions = Object.keys(Object.groupBy(game.actors.getName("Test").spells.filter(s => s.system.isDarkMagic), s => s.system.tradition)) + if (!knownDarkMagicTraditions.includes(item.system.tradition)) { + await this.actor.rollCorruption() + } + } + } } } diff --git a/src/module/settings.js b/src/module/settings.js index 41811f05..2eeed329 100644 --- a/src/module/settings.js +++ b/src/module/settings.js @@ -963,4 +963,12 @@ export const registerSettings = function () { type: Boolean, config: true }) + game.settings.register('demonlord', 'darkMagicCorruptionRollOnLearn', { + name: game.i18n.localize('DL.SettingDarkMagicCorruptionRollOnLearn'), + hint: game.i18n.localize('DL.SettingDarkMagicCorruptionRollOnLearnHint'), + default: false, + scope: 'world', + type: Boolean, + config: true + }) }