Add new status

This commit is contained in:
2021-08-14 22:49:25 +02:00
parent eff36f957a
commit a705deaf54
3 changed files with 593 additions and 4 deletions

View File

@ -161,7 +161,93 @@ export class WH4FRPatchConfig {
}
}
game.wfrp4e.config.statusEffects = [
game.wfrp4e.config.conditionScripts = {
"ablaze" : async function (actor) {
let effect = actor.hasCondition("ablaze")
let value = effect.conditionValue;
let leastProtectedLoc;
let leastProtectedValue = 999;
for (let loc in actor.status.armour)
{
if (actor.status.armour[loc].value != undefined && actor.status.armour[loc].value < leastProtectedValue)
{
leastProtectedLoc = loc;
leastProtectedValue = actor.status.armour[loc].value;
}
}
let rollString = `1d10 + ${value - 1}`
let roll = new Roll(`${rollString} - ${leastProtectedValue || 0}`).roll();
let msg = `<h2>En Flammes</h2><b>Formule</b>: ${rollString}<br><b>Lancer</b>: ${roll.terms.map(i => i.total).splice(0, 3).join(" ")}` // Don't show AP in the roll formula
actor.runEffects("preApplyCondition", {effect, data : {msg, roll, rollString}})
value = effect.conditionValue;
let damageMsg = (`<br>` + await actor.applyBasicDamage(roll.total, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_AP, suppressMsg : true})).split("")
damageMsg.splice(damageMsg.length-1, 1) // Removes the parentheses and adds + AP amount.
msg += damageMsg.join("").concat(` + ${leastProtectedValue} AP)`)
let messageData = game.wfrp4e.utility.chatDataSetup(msg);
messageData.speaker = {alias: actor.data.token.name}
actor.runEffects("applyCondition", {effect, data : {messageData}})
return messageData
},
"poisoned" : async function (actor) {
let effect = actor.hasCondition("poisoned")
let msg = `<h2>Empoisonné</h2>`
actor.runEffects("preApplyCondition", {effect, data : {msg}})
let value = effect.conditionValue;
msg += await actor.applyBasicDamage(value, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL, suppressMsg : true})
let messageData = game.wfrp4e.utility.chatDataSetup(msg);
messageData.speaker = {alias: actor.data.token.name}
actor.runEffects("applyCondition", {effect, data : {messageData}})
return messageData
},
"bleeding" : async function(actor) {
let effect = actor.hasCondition("bleeding")
let bleedingAmt;
let bleedingRoll;
let msg = `<h2>Hémorragie</h2>`
actor.runEffects("preApplyCondition", {effect, data : {msg}})
let value = effect.conditionValue;
msg += await actor.applyBasicDamage(value, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL, minimumOne : false, suppressMsg : true})
if (actor.status.wounds.value == 0 && !actor.hasCondition("unconscious"))
{
await actor.addCondition("unconscious")
msg += `<br><b>${actor.data.token.name}</b> tombe inconscient!`
}
if (actor.hasCondition("unconscious"))
{
bleedingAmt = value;
bleedingRoll = new Roll("1d100").roll().total;
if (bleedingRoll <= bleedingAmt * 10)
{
msg += `<br><b>${actor.data.token.name}</b> meurt de la perte de sang! (Lancé ${bleedingRoll})`
actor.addCondition("dead")
}
else if (bleedingRoll % 11 == 0)
{
msg += `<br><b>${actor.data.token.name}'s</b> cicatrise un peu et élimine 1 Etat Hémorragique (Lancé ${bleedingRoll})`
actor.removeCondition("bleeding")
}
else
{
msg += `<br>Bleeding Roll: ${bleedingRoll}`
}
}
let messageData = game.wfrp4e.utility.chatDataSetup(msg);
messageData.speaker = {alias: actor.data.token.name}
actor.runEffects("applyCondition", {effect, data : {messageData, bleedingRoll}})
return messageData
}
}
game.wfrp4e.config.statusEffects = [
{
icon: "systems/wfrp4e/icons/conditions/bleeding.png",
id: "bleeding",
@ -375,8 +461,511 @@ export class WH4FRPatchConfig {
}
]
game.wfrp4e.config.systemEffects = {
"enc1" : {
label: "Encombrement 1",
icon: "systems/wfrp4e/icons/effects/enc1.png",
flags: {
wfrp4e: {
"effectTrigger": "prePrepareData",
"effectApplication": "actor",
"script": `
args.actor.characteristics.ag.modifier -= 10;
args.actor.details.move.value -= 1;
if (args.actor.details.move.value < 3)
args.actor.details.move.value = 3`
}
}
},
"enc2" : {
label: "Encombrement 2",
icon: "systems/wfrp4e/icons/effects/enc2.png",
flags: {
wfrp4e: {
"effectTrigger": "prePrepareData",
"effectApplication": "actor",
"script": `
args.actor.characteristics.ag.modifier -= 20;
args.actor.details.move.value -= 2;
if (args.actor.details.move.value < 2)
args.actor.details.move.value = 2`
}
}
},
"enc3" : {
label: "Encombrement 3",
icon: "systems/wfrp4e/icons/effects/enc3.png",
flags: {
wfrp4e: {
"effectTrigger": "prePrepareData",
"effectApplication": "actor",
"script": `
args.actor.details.move.value = 0;`
}
}
},
"cold1" : {
label: "Exposition au Froid 1",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -10},
{key : "data.characteristics.ag.modifier", mode: 2, value: -10},
{key : "data.characteristics.dex.modifier", mode: 2, value: -10},
],
flags: {
wfrp4e: {
"effectTrigger": "",
"effectApplication": "actor",
"script": ``
}
}
},
"cold2" : {
label: "Exposition au Froid 2",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -10},
{key : "data.characteristics.ag.modifier", mode: 2, value: -10},
{key : "data.characteristics.ws.modifier", mode: 2, value: -10},
{key : "data.characteristics.s.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.modifier", mode: 2, value: -10},
{key : "data.characteristics.i.modifier", mode: 2, value: -10},
{key : "data.characteristics.dex.modifier", mode: 2, value: -10},
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.modifier", mode: 2, value: -10},
{key : "data.characteristics.fel.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.s.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.wp.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "",
"effectApplication": "actor",
"script": ``
}
}
},
"cold3" : {
label: "Exposition au Froid 3",
icon: "",
flags: {
wfrp4e: {
"effectTrigger": "oneTime",
"effectApplication": "actor",
"script": `
let tb = this.actor.characteristics.t.bonus
let damage = new Roll("1d10").roll().total
damage -= tb
if (damage <= 0) damage = 1
if (this.actor.status.wounds.value <= damage)
{
this.actor.addCondition("unconscious")
}
this.actor.modifyWounds(-damage)
ui.notifications.notify("Encaisse " + damage + " dégats")
`
}
}
},
"heat1" : {
label: "Exposition à la chaleur 1",
icon: "",
changes : [
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "",
"effectApplication": "actor",
"script": ``
}
}
},
"heat2" : {
label: "Exposition à la chaleur 2",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -10},
{key : "data.characteristics.ag.modifier", mode: 2, value: -10},
{key : "data.characteristics.ws.modifier", mode: 2, value: -10},
{key : "data.characteristics.s.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.modifier", mode: 2, value: -10},
{key : "data.characteristics.i.modifier", mode: 2, value: -10},
{key : "data.characteristics.dex.modifier", mode: 2, value: -10},
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.modifier", mode: 2, value: -10},
{key : "data.characteristics.fel.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.s.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.wp.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "",
"effectApplication": "actor",
"script": ``
}
}
},
"heat3" : {
label: "Exposition à la chaleur 3",
icon: "",
flags: {
wfrp4e: {
"effectTrigger": "oneTime",
"effectApplication": "actor",
"script": `
let tb = this.actor.characteristics.t.bonus
let damage = new Roll("1d10").roll().total
damage -= tb
if (damage <= 0) damage = 1
this.actor.modifyWounds(-damage)
ui.notifications.notify("Encaisse " + damage + " dégats")
`
}
}
},
"thirst1" : {
label: "Assoiffé 1",
icon: "",
changes : [
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.modifier", mode: 2, value: -10},
{key : "data.characteristics.fel.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "",
"effectApplication": "actor",
"script": ``
}
}
},
"thirst2" : {
label: "Assoiffé 2+",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -10},
{key : "data.characteristics.ag.modifier", mode: 2, value: -10},
{key : "data.characteristics.ws.modifier", mode: 2, value: -10},
{key : "data.characteristics.s.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.modifier", mode: 2, value: -10},
{key : "data.characteristics.i.modifier", mode: 2, value: -10},
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.dex.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.modifier", mode: 2, value: -10},
{key : "data.characteristics.fel.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.s.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.wp.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "invoke",
"effectApplication": "actor",
"script": `
let tb = this.actor.characteristics.t.bonus
let damage = new Roll("1d10").roll().total
damage -= tb
if (damage <= 0) damage = 1
this.actor.modifyWounds(-damage)
ui.notifications.notify("Encasse " + damage + " dégats")
`
}
}
},
"starvation1" : {
label: "Affamé 1",
icon: "",
changes : [
{key : "data.characteristics.s.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.s.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "",
"effectApplication": "actor",
"script": ``
}
}
},
"starvation2" : {
label: "Affamé 2",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -10},
{key : "data.characteristics.ag.modifier", mode: 2, value: -10},
{key : "data.characteristics.ws.modifier", mode: 2, value: -10},
{key : "data.characteristics.s.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.modifier", mode: 2, value: -10},
{key : "data.characteristics.i.modifier", mode: 2, value: -10},
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.dex.modifier", mode: 2, value: -10},
{key : "data.characteristics.wp.modifier", mode: 2, value: -10},
{key : "data.characteristics.fel.modifier", mode: 2, value: -10},
{key : "data.characteristics.t.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.s.calculationBonusModifier", mode: 2, value: 1},
{key : "data.characteristics.wp.calculationBonusModifier", mode: 2, value: 1},
],
flags: {
wfrp4e: {
"effectTrigger": "invoke",
"effectApplication": "actor",
"script": `
let tb = this.actor.characteristics.t.bonus
let damage = new Roll("1d10").roll().total
damage -= tb
if (damage <= 0) damage = 1
this.actor.modifyWounds(-damage)
ui.notifications.notify("Encaisse " + damage + " dégats")
`
}
}
},
"infighting": {
label: "Combat au contact",
icon: "modules/wfrp4e-core/icons/talents/in-fighter.png",
flags: {
wfrp4e: {
"effectTrigger": "prePrepareItem",
"effectApplication": "actor",
"script": `
if (args.item.type == "weapon" && args.item.isEquipped)
{
let weaponLength = args.item.reachNum
if (weaponLength > 3)
{
let improv = duplicate(game.wfrp4e.config.systemItems.improv)
improv.data.twohanded.value = args.item.twohanded.value
improv.data.offhand.value = args.item.offhand.value
args.item.data.update({"data" : improv.data, name : args.item.name + " (Combat au Contact")})
}
}
`
}
}
},
"defensive": {
label: "Posture Défensive [Compétence]",
icon: "",
flags: {
wfrp4e: {
"effectTrigger": "prefillDialog",
"effectApplication": "actor",
"script": `
let skillName = this.effect.label.substring(this.effect.label.indexOf("[") + 1, this.effect.label.indexOf("]"))
if (!this.actor.isOpposing)
return
if ((args.type == "skill" && args.item.name == skillName) ||
(args.type == "weapon" && args.item.skillToUse.name == skillName) ||
(args.type == "cast" && skillName == "Langue (Magick)") ||
(args.type == "prayer" && skillName == "Prière") ||
(args.type == "trait" && args.item.rollable.skill == skillName))
args.prefillModifiers.modifier += 20`
}
}
},
"dualwielder" : {
label: "Maniement de 2 armes",
icon: "modules/wfrp4e-core/icons/talents/dual-wielder.png",
flags: {
wfrp4e: {
"effectTrigger": "prefillDialog",
"effectApplication": "actor",
"script": `
if (this.actor.isOpposing)
args.prefillModifiers.modifier -= 10`
}
}
},
"consumealcohol1" : {
label: "Résistance à l'alcool 1",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -10},
{key : "data.characteristics.ag.modifier", mode: 2, value: -10},
{key : "data.characteristics.ws.modifier", mode: 2, value: -10},
{key : "data.characteristics.int.modifier", mode: 2, value: -10},
{key : "data.characteristics.dex.modifier", mode: 2, value: -10},
]
},
"consumealcohol2" : {
label: "Résistance à l'alcool 2",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -20},
{key : "data.characteristics.ag.modifier", mode: 2, value: -20},
{key : "data.characteristics.ws.modifier", mode: 2, value: -20},
{key : "data.characteristics.int.modifier", mode: 2, value: -20},
{key : "data.characteristics.dex.modifier", mode: 2, value: -20},
]
},
"consumealcohol3" : {
label: "Résistance à l'alcool 3",
icon: "",
changes : [
{key : "data.characteristics.bs.modifier", mode: 2, value: -30},
{key : "data.characteristics.ag.modifier", mode: 2, value: -30},
{key : "data.characteristics.ws.modifier", mode: 2, value: -30},
{key : "data.characteristics.int.modifier", mode: 2, value: -30},
{key : "data.characteristics.dex.modifier", mode: 2, value: -30},
]
},
"stinkingdrunk1" : {
label: "Courage du Marienbourgeois",
icon: "",
flags: {
wfrp4e: {
"effectTrigger": "prefillDialog",
"effectApplication": "actor",
"script": `
if (args.type=="skill" && args.item.name=="Calme")
args.prefillModifiers.modifier += 20`
}
}
}
}
game.wfrp4e.config.symptomEffects = {
game.wfrp4e.config.systemItems = {
reload : {
type: "extendedTest",
name: "",
data: {
SL: {
},
test: {
value: ""
},
completion: {
value: "remove"
}
},
flags: {
wfrp4e: {
reloading: ""
}
}
},
improv : {
name: "Arme improvisée",
type: "weapon",
effects : [],
data: {
damage: { value: "SB + 1" },
reach: { value: "personal" },
weaponGroup: { value: "basic" },
twohanded: { value: false },
qualities: { value: "" },
flaws: { value: [{name : "undamaging"}] },
special: { value: "" },
range: { value: "" },
ammunitionGroup: { value: "" },
offhand: { value: false },
}
},
stomp : {
name: "Piétiner",
type: "trait",
effects : [],
data: {
specification: { value: "4" },
rollable: { value: true, rollCharacteristic: "ws", bonusCharacteristic: "s", defaultDifficulty: "challenging", damage : true },
}
},
unarmed : {
name: "Désarmé",
type: "weapon",
effects : [],
data: {
damage: { value: "SB + 0" },
reach: { value: "personal" },
weaponGroup: { value: "brawling" },
twohanded: { value: false },
qualities: { value: "" },
flaws: { value: [{name : "undamaging"}] },
special: { value: "" },
range: { value: "" },
ammunitionGroup: { value: "" },
offhand: { value: false },
}
},
fear : {
name : "Peur",
type : "extendedTest",
data : {
completion:{value: 'remove'},
description:{type: 'String', label: 'Description', value: ''},
failingDecreases:{value: true},
gmdescription:{type: 'String', label: 'Description', value: ''},
hide: { test: false, progress: false },
negativePossible: { value: false },
SL: { current: 0, target: 1 },
test: { value: 'Calme' }
},
effects:
[{
label: "Peur",
icon: "systems/wfrp4e/icons/conditions/fear.png",
transfer: true,
flags: {
core : {
statusId : "fear"
},
wfrp4e: {
"effectTrigger": "dialogChoice",
"effectData": {
"description": "Tests affectés",
"slBonus": "-1"
},
"script": `
if (this.flags.wfrp4e.fearName)
this.flags.wfrp4e.effectData.description += " " + this.flags.wfrp4e.fearName
else
this.flags.wfrp4e.effectData.description += " the source of fear"
`}
}
}
]
},
terror: {
label: "Terreur",
icon: "systems/wfrp4e/icons/conditions/terror.png",
transfer: true,
flags: {
wfrp4e: {
"effectTrigger": "oneTime",
"effectApplication": "actor",
"terrorValue": 1,
"script": `
args.actor.setupSkill("Calme").then(setupData =>{
args.actor.basicTest(setupData).then(test => {
if (test.result.outcome == "failure")
{
let terror = this.effect.flags.wfrp4e.terrorValue
if (test.result.SL < 0)
terror += Math.abs(test.result.SL)
args.actor.addCondition("broken", terror)
}
args.actor.applyFear(value, name)
})
})`
}
}
}
}
game.wfrp4e.config.symptomEffects = {
"blight": {
label: "Toxine",
icon: "modules/wfrp4e-core/icons/diseases/disease.png",