Nombreuses corrections sur les maladies et symptomes
All checks were successful
Validation JSON / validate (push) Successful in 24s
All checks were successful
Validation JSON / validate (push) Successful in 24s
This commit is contained in:
@@ -145,6 +145,39 @@ export class WH4FRPatchConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
static patch_symptom_severity() {
|
||||
// The core module's symptomEffects scripts check for English severity terms
|
||||
// ("Moderate", "Severe") in this.effect.name. French disease compendiums use
|
||||
// translated severity ("Modéré(e)", "Grave"), so the checks would fail.
|
||||
// We patch the relevant scriptData to also check for French severity terms.
|
||||
const effects = game.wfrp4e.config.symptomEffects;
|
||||
if (!effects) return;
|
||||
|
||||
// Patch blight: checks Moderate → easy, Severe → average, else → veasy
|
||||
for (const key of ["blight", "gangrene"]) {
|
||||
const effect = effects[key];
|
||||
if (!effect?.system?.scriptData) continue;
|
||||
for (const sd of effect.system.scriptData) {
|
||||
if (sd.script && sd.script.includes('.includes("Moderate")')) {
|
||||
sd.script = sd.script
|
||||
.replace('includes("Moderate")', 'includes("Moderate") || this.effect.name.includes("Modéré")')
|
||||
.replace('includes("Severe")', 'includes("Severe") || this.effect.name.includes("Grave")');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Patch convulsions: checks Moderate → -20, else → -10
|
||||
if (effects.convulsions?.system?.scriptData) {
|
||||
for (const sd of effects.convulsions.system.scriptData) {
|
||||
if (sd.script && sd.script.includes('.includes("Moderate")')) {
|
||||
sd.script = sd.script
|
||||
.replace('includes("Moderate")', 'includes("Moderate") || this.effect.name.includes("Modéré")');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************************/
|
||||
static fixSpeciesTable() {
|
||||
|
||||
@@ -240,276 +273,10 @@ export class WH4FRPatchConfig {
|
||||
this.patch_career();
|
||||
|
||||
|
||||
game.wfrp4e.config.symptomEffects = {
|
||||
"blight": {
|
||||
label: "Toxine",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "invoke",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
let difficulty = ""
|
||||
if (this.effect.label.includes("Modéré"))
|
||||
difficulty = "easy"
|
||||
else if (this.effect.label.includes("Sévère"))
|
||||
difficulty = "average"
|
||||
else
|
||||
difficulty = "veasy"
|
||||
|
||||
if (args.actor.isOwner)
|
||||
{
|
||||
args.actor.setupSkill("Résistance", {absolute: {difficulty}}).then(setupData => {
|
||||
args.actor.basicTest(setupData).then(test =>
|
||||
{
|
||||
if (test.result.outcome == "failure")
|
||||
args.actor.addCondition("dead")
|
||||
})
|
||||
})
|
||||
}`
|
||||
}
|
||||
}
|
||||
},
|
||||
"buboes": {
|
||||
label: "Bubons",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "prefillDialog",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
let applicableCharacteristics = ["ws", "bs", "s", "fel", "ag", "t", "dex"]
|
||||
if (args.type == "weapon")
|
||||
args.prefillModifiers.modifier -= 10
|
||||
else if (args.type == "characteristic")
|
||||
{
|
||||
if (applicableCharacteristics.includes(args.item))
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}
|
||||
else if (args.type == "skill")
|
||||
{
|
||||
if (applicableCharacteristics.includes(args.item.characteristic.value))
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}
|
||||
`}
|
||||
}
|
||||
},
|
||||
"convulsions": {
|
||||
label: "Convulsions",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "prefillDialog",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
let modifier = 0
|
||||
if (this.effect.label.includes("Modéré"))
|
||||
modifier = -20
|
||||
else
|
||||
modifier = -10
|
||||
|
||||
let applicableCharacteristics = ["ws", "bs", "s", "ag", "t", "dex"]
|
||||
if (args.type == "weapon")
|
||||
args.prefillModifiers.modifier += modifier
|
||||
else if (args.type == "characteristic")
|
||||
{
|
||||
if (applicableCharacteristics.includes(args.item))
|
||||
args.prefillModifiers.modifier += modifier
|
||||
}
|
||||
else if (args.type == "skill")
|
||||
{
|
||||
if (applicableCharacteristics.includes(args.item.characteristic.value))
|
||||
args.prefillModifiers.modifier += modifier
|
||||
}
|
||||
}`
|
||||
}
|
||||
}
|
||||
},
|
||||
"fever": {
|
||||
label: "Fièvre",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "prefillDialog",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
|
||||
let applicableCharacteristics = ["ws", "bs", "s", "fel", "ag", "t", "dex"]
|
||||
|
||||
if (args.type == "weapon")
|
||||
args.prefillModifiers.modifier -= 10
|
||||
else if (args.type == "characteristic")
|
||||
{
|
||||
if (applicableCharacteristics.includes(args.item))
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}
|
||||
else if (args.type == "skill")
|
||||
{
|
||||
if (applicableCharacteristics.includes(args.item.characteristic.value))
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}`,
|
||||
"otherEffects": ["blight", "wounded"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"flux": {
|
||||
label: "Intoxication Alimentaire",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"symptom": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"lingering": {
|
||||
label: "Persistant",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"symptom": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"coughsAndSneezes": {
|
||||
label: "Toux et éternuements",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"symptom": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"gangrene": {
|
||||
label: "Gangrène",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "prefillDialog",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
if (args.type == "characteristic" && args.item == "fel")
|
||||
{
|
||||
if (args.item == "fel")
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}
|
||||
else if (args.type == "skill")
|
||||
{
|
||||
if (args.item.characteristic.value == "fel")
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}
|
||||
}`
|
||||
}
|
||||
}
|
||||
},
|
||||
"malaise": {
|
||||
label: "Malaise",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "prepareData",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
if (game.user.isUniqueGM)
|
||||
{
|
||||
let fatigued = args.actor.hasCondition("fatigued")
|
||||
if (!fatigued)
|
||||
{
|
||||
args.actor.addCondition("fatigued")
|
||||
ui.notifications.notify("Etat Extenué ajouté à " + args.actor.name + ", qui ne peut pas être enlevé tant que le symptôme Malaise est présent.")
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
},
|
||||
"nausea": {
|
||||
label: "Nausée",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "rollTest",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
if (this.actor.isOwner && args.test.result.outcome == "failure")
|
||||
{
|
||||
let applicableCharacteristics = ["ws", "bs", "s", "fel", "ag", "t", "dex"]
|
||||
if (applicableCharacteristics.includes(args.test.result.characteristic))
|
||||
this.actor.addCondition("stunned")
|
||||
else if (args.test.result.skill && applicableCharacteristics.includes(args.test.result.skill.system.characteristic.value))
|
||||
this.actor.addCondition("stunned")
|
||||
else if (args.test.result.weapon)
|
||||
this.actor.addCondition("stunned")
|
||||
|
||||
}
|
||||
`
|
||||
}
|
||||
}
|
||||
},
|
||||
"pox": {
|
||||
label: "Démangeaisons",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "prefillDialog",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
|
||||
if (args.type == "characteristic" && args.item == "fel")
|
||||
args.prefillModifiers.modifier -= 10
|
||||
else if (args.type == "skill")
|
||||
{
|
||||
if (args.item.characteristic.value == "fel")
|
||||
args.prefillModifiers.modifier -= 10
|
||||
}
|
||||
}`
|
||||
}
|
||||
}
|
||||
},
|
||||
"wounded": {
|
||||
label: "Blessé",
|
||||
icon: "modules/wfrp4e-core/icons/diseases/disease.png",
|
||||
transfer: true,
|
||||
flags: {
|
||||
wfrp4e: {
|
||||
"effectApplication": "actor",
|
||||
"effectTrigger": "invoke",
|
||||
"symptom": true,
|
||||
"script": `
|
||||
if (args.actor.isOwner)
|
||||
{
|
||||
args.actor.setupSkill("Résistance", {absolute: {difficulty : "average"}}).then(setupData => {
|
||||
args.actor.basicTest(setupData).then(test =>
|
||||
{
|
||||
if (test.result.outcome == "failure")
|
||||
fromUuid("Compendium.wfrp4e-core.diseases.kKccDTGzWzSXCBOb").then(disease => {
|
||||
args.actor.createEmbeddedDocuments("Item", [disease.toObject()])
|
||||
})
|
||||
})
|
||||
})
|
||||
}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Patch symptom severity scripts to support French severity terms
|
||||
// The core module scripts check for "Moderate"/"Severe" in effect.name,
|
||||
// but French disease compendiums use "Modéré(e)"/"Grave" instead.
|
||||
this.patch_symptom_severity();
|
||||
|
||||
game.wfrp4e.config.effectApplication = {
|
||||
"actor": "Acteur",
|
||||
|
||||
Reference in New Issue
Block a user