Fix spells bugs
This commit is contained in:
parent
8451ed0743
commit
b9ca7c0489
@ -28,7 +28,6 @@ Hooks.once('init', () => {
|
|||||||
//WFRP_Tables = game.wfrp4e.tables;
|
//WFRP_Tables = game.wfrp4e.tables;
|
||||||
//WFRP4E = game.wfrp4e.config;
|
//WFRP4E = game.wfrp4e.config;
|
||||||
CONFIG.Actor.entityClass = ActorWfrp4e_fr;
|
CONFIG.Actor.entityClass = ActorWfrp4e_fr;
|
||||||
console.log("PATCH !DONE !!", CONFIG.Actor.entityClass);
|
|
||||||
|
|
||||||
// Babele stuff
|
// Babele stuff
|
||||||
if(typeof Babele !== 'undefined') {
|
if(typeof Babele !== 'undefined') {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "WH4-fr-translation",
|
"name": "WH4-fr-translation",
|
||||||
"title": "Traduction du module WH4 en Français.",
|
"title": "Traduction du module WH4 en Français.",
|
||||||
"description": "La traduction du module WH4.",
|
"description": "La traduction du module WH4.",
|
||||||
"version": "1.3.14",
|
"version": "1.3.15",
|
||||||
"minimumCoreVersion" : "0.6.6",
|
"minimumCoreVersion" : "0.6.6",
|
||||||
"compatibleCoreVersion": "1.0.0",
|
"compatibleCoreVersion": "1.0.0",
|
||||||
"author": "LeRatierBretonnien",
|
"author": "LeRatierBretonnien",
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
import WFRP_Utility from "/systems/wfrp4e/modules/system/utility-wfrp4e.js";
|
|
||||||
import WFRP4E from "/systems/wfrp4e/modules/system/config-wfrp4e.js"
|
|
||||||
import DiceWFRP from "/systems/wfrp4e/modules/system/dice-wfrp4e.js";
|
|
||||||
import OpposedWFRP from "/systems/wfrp4e/modules/system/opposed-wfrp4e.js";
|
|
||||||
import WFRP_Audio from "/systems/wfrp4e/modules/system/audio-wfrp4e.js";
|
|
||||||
import WFRP_Tables from "/systems/wfrp4e/modules/system/tables-wfrp4e.js";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the main Actor data computation and organization.
|
* Provides the main Actor data computation and organization.
|
||||||
*
|
*
|
||||||
@ -57,8 +50,8 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
autoCalcEnc: true,
|
autoCalcEnc: true,
|
||||||
autoCalcSize: true,
|
autoCalcSize: true,
|
||||||
}
|
}
|
||||||
let basicSkills = await WFRP_Utility.allBasicSkills() || [];
|
let basicSkills = await game.wfrp4e.utility.allBasicSkills() || [];
|
||||||
let moneyItems = await WFRP_Utility.allMoneyItems() || [];
|
let moneyItems = await game.wfrp4e.utility.allMoneyItems() || [];
|
||||||
moneyItems = moneyItems.sort((a, b) => (a.data.coinValue.value > b.data.coinValue.value) ? -1 : 1);
|
moneyItems = moneyItems.sort((a, b) => (a.data.coinValue.value > b.data.coinValue.value) ? -1 : 1);
|
||||||
|
|
||||||
// If character, automatically add basic skills and money items
|
// If character, automatically add basic skills and money items
|
||||||
@ -110,7 +103,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
for (let ch of Object.values(this.data.data.characteristics)) {
|
for (let ch of Object.values(this.data.data.characteristics)) {
|
||||||
ch.value = ch.initial + ch.advances + (ch.modifier || 0);
|
ch.value = ch.initial + ch.advances + (ch.modifier || 0);
|
||||||
ch.bonus = Math.floor(ch.value / 10)
|
ch.bonus = Math.floor(ch.value / 10)
|
||||||
ch.cost = WFRP_Utility._calculateAdvCost(ch.advances, "characteristic")
|
ch.cost = game.wfrp4e.utility._calculateAdvCost(ch.advances, "characteristic")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +171,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the size has been changed since the last known value, update the value
|
// If the size has been changed since the last known value, update the value
|
||||||
data.data.details.size.value = WFRP_Utility.findKey(size, game.wfrp4e.config.actorSizes) || "avg"
|
data.data.details.size.value = game.wfrp4e.utility.findKey(size, game.wfrp4e.config.actorSizes) || "avg"
|
||||||
|
|
||||||
// Now that we have size, calculate wounds and token size
|
// Now that we have size, calculate wounds and token size
|
||||||
if (data.flags.autoCalcWounds) {
|
if (data.flags.autoCalcWounds) {
|
||||||
@ -408,7 +401,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/characteristic-card.html", title)
|
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/characteristic-card.html", title)
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -514,7 +507,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
cardOptions.rollMode = "gmroll"
|
cardOptions.rollMode = "gmroll"
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -720,7 +713,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/weapon-card.html", title)
|
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/weapon-card.html", title)
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -830,7 +823,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/spell-card.html", title)
|
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/spell-card.html", title)
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -944,7 +937,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/channel-card.html", title)
|
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/channel-card.html", title)
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -1047,7 +1040,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/prayer-card.html", title)
|
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/prayer-card.html", title)
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -1127,7 +1120,7 @@ export default class ActorWfrp4e_fr extends Actor {
|
|||||||
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/skill-card.html", title)
|
let cardOptions = this._setupCardOptions("systems/wfrp4e/templates/chat/roll/skill-card.html", title)
|
||||||
|
|
||||||
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
// Provide these 3 objects to setupDialog() to create the dialog and assign the roll function
|
||||||
return DiceWFRP.setupDialog({
|
return game.wfrp4e.dice.setupDialog({
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
testData: testData,
|
testData: testData,
|
||||||
cardOptions: cardOptions
|
cardOptions: cardOptions
|
||||||
@ -1203,8 +1196,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
* @param {Object} rerenderMessage The message to be updated (used if editing the chat card)
|
* @param {Object} rerenderMessage The message to be updated (used if editing the chat card)
|
||||||
*/
|
*/
|
||||||
async basicTest({ testData, cardOptions }, options = {}) {
|
async basicTest({ testData, cardOptions }, options = {}) {
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollTest(testData);
|
let result = game.wfrp4e.dice.rollTest(testData);
|
||||||
|
|
||||||
result.postFunction = "basicTest";
|
result.postFunction = "basicTest";
|
||||||
if (testData.extra)
|
if (testData.extra)
|
||||||
@ -1223,7 +1216,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
|
||||||
cardOptions.sound = contextAudio.file || cardOptions.sound
|
cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -1237,8 +1230,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -1255,8 +1248,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
* @param {Object} rerenderMessage The message to be updated (used if editing the chat card)
|
* @param {Object} rerenderMessage The message to be updated (used if editing the chat card)
|
||||||
*/
|
*/
|
||||||
async incomeTest({ testData, cardOptions }, options = {}) {
|
async incomeTest({ testData, cardOptions }, options = {}) {
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollTest(testData);
|
let result = game.wfrp4e.dice.rollTest(testData);
|
||||||
result.postFunction = "incomeTest"
|
result.postFunction = "incomeTest"
|
||||||
|
|
||||||
Hooks.call("wfrp4e:rollIncomeTest", result, cardOptions)
|
Hooks.call("wfrp4e:rollIncomeTest", result, cardOptions)
|
||||||
@ -1269,10 +1262,10 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
let status = testData.income.value.split(' ')
|
let status = testData.income.value.split(' ')
|
||||||
|
|
||||||
let dieAmount = game.wfrp4e.config.earningValues[WFRP_Utility.findKey(status[0], game.wfrp4e.config.statusTiers)][0] // b, s, or g maps to 2d10, 1d10, or 1 respectively (takes the first letter)
|
let dieAmount = game.wfrp4e.config.earningValues[game.wfrp4e.utility.findKey(status[0], game.wfrp4e.config.statusTiers)][0] // b, s, or g maps to 2d10, 1d10, or 1 respectively (takes the first letter)
|
||||||
dieAmount = Number(dieAmount) * status[1]; // Multilpy that first letter by your standing (Brass 4 = 8d10 pennies)
|
dieAmount = Number(dieAmount) * status[1]; // Multilpy that first letter by your standing (Brass 4 = 8d10 pennies)
|
||||||
let moneyEarned;
|
let moneyEarned;
|
||||||
if (WFRP_Utility.findKey(status[0], game.wfrp4e.config.statusTiers) != "g") // Don't roll for gold, just use standing value
|
if (game.wfrp4e.utility.findKey(status[0], game.wfrp4e.config.statusTiers) != "g") // Don't roll for gold, just use standing value
|
||||||
{
|
{
|
||||||
dieAmount = dieAmount + "d10";
|
dieAmount = dieAmount + "d10";
|
||||||
moneyEarned = new Roll(dieAmount).roll().total;
|
moneyEarned = new Roll(dieAmount).roll().total;
|
||||||
@ -1283,7 +1276,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
// After rolling, determined how much, if any, was actually earned
|
// After rolling, determined how much, if any, was actually earned
|
||||||
if (result.description.includes("Success")) {
|
if (result.description.includes("Success")) {
|
||||||
result.incomeResult = game.i18n.localize("INCOME.YouEarn") + " " + moneyEarned;
|
result.incomeResult = game.i18n.localize("INCOME.YouEarn") + " " + moneyEarned;
|
||||||
switch (WFRP_Utility.findKey(status[0], game.wfrp4e.config.statusTiers)) {
|
switch (game.wfrp4e.utility.findKey(status[0], game.wfrp4e.config.statusTiers)) {
|
||||||
case "b":
|
case "b":
|
||||||
result.incomeResult += ` ${game.i18n.localize("NAME.BPPlural").toLowerCase()}.`
|
result.incomeResult += ` ${game.i18n.localize("NAME.BPPlural").toLowerCase()}.`
|
||||||
break;
|
break;
|
||||||
@ -1301,7 +1294,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
else if (Number(result.SL) > -6) {
|
else if (Number(result.SL) > -6) {
|
||||||
moneyEarned /= 2;
|
moneyEarned /= 2;
|
||||||
result.incomeResult = game.i18n.localize("INCOME.YouEarn") + " " + moneyEarned;
|
result.incomeResult = game.i18n.localize("INCOME.YouEarn") + " " + moneyEarned;
|
||||||
switch (WFRP_Utility.findKey(status[0], game.wfrp4e.config.statusTiers)) {
|
switch (game.wfrp4e.utility.findKey(status[0], game.wfrp4e.config.statusTiers)) {
|
||||||
case "b":
|
case "b":
|
||||||
result.incomeResult += ` ${game.i18n.localize("NAME.BPPlural").toLowerCase()}.`
|
result.incomeResult += ` ${game.i18n.localize("NAME.BPPlural").toLowerCase()}.`
|
||||||
break;
|
break;
|
||||||
@ -1322,10 +1315,10 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
}
|
}
|
||||||
// let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
// let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
||||||
// cardOptions.sound = contextAudio.file || cardOptions.sound
|
// cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
result.moneyEarned = moneyEarned + WFRP_Utility.findKey(status[0], game.wfrp4e.config.statusTiers);
|
result.moneyEarned = moneyEarned + game.wfrp4e.utility.findKey(status[0], game.wfrp4e.config.statusTiers);
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg)
|
game.wfrp4e.opposed.handleOpposedTarget(msg)
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -1345,8 +1338,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
||||||
cardOptions.isOpposedTest = true
|
cardOptions.isOpposedTest = true
|
||||||
}
|
}
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollWeaponTest(testData);
|
let result = game.wfrp4e.dice.rollWeaponTest(testData);
|
||||||
result.postFunction = "weaponTest";
|
result.postFunction = "weaponTest";
|
||||||
|
|
||||||
// Reduce ammo if necessary
|
// Reduce ammo if necessary
|
||||||
@ -1356,7 +1349,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
|
||||||
cardOptions.sound = contextAudio.file || cardOptions.sound
|
cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -1365,8 +1358,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
|
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -1386,8 +1379,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
||||||
cardOptions.isOpposedTest = true
|
cardOptions.isOpposedTest = true
|
||||||
}
|
}
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollCastTest(testData);
|
let result = game.wfrp4e.dice.rollCastTest(testData);
|
||||||
result.postFunction = "castTest";
|
result.postFunction = "castTest";
|
||||||
|
|
||||||
|
|
||||||
@ -1404,7 +1397,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
testData.extra.ingredient = false;
|
testData.extra.ingredient = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
|
||||||
cardOptions.sound = contextAudio.file || cardOptions.sound
|
cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -1413,12 +1406,12 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
|
|
||||||
// Update spell to reflect SL from channelling resetting to 0
|
// Update spell to reflect SL from channelling resetting to 0
|
||||||
WFRP_Utility.getSpeaker(cardOptions.speaker).updateEmbeddedEntity("OwnedItem", { _id: testData.extra.spell._id, 'data.cn.SL': 0 });
|
game.wfrp4e.utility.getSpeaker(cardOptions.speaker).updateEmbeddedEntity("OwnedItem", { _id: testData.extra.spell._id, 'data.cn.SL': 0 });
|
||||||
|
|
||||||
|
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -1438,8 +1431,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
||||||
cardOptions.isOpposedTest = true
|
cardOptions.isOpposedTest = true
|
||||||
}
|
}
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollChannellTest(testData, WFRP_Utility.getSpeaker(cardOptions.speaker));
|
let result = game.wfrp4e.dice.rollChannellTest(testData, game.wfrp4e.utility.getSpeaker(cardOptions.speaker));
|
||||||
result.postFunction = "channelTest";
|
result.postFunction = "channelTest";
|
||||||
|
|
||||||
// Find ingredient being used, if any
|
// Find ingredient being used, if any
|
||||||
@ -1455,7 +1448,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
testData.extra.ingredient = false;
|
testData.extra.ingredient = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
|
||||||
cardOptions.sound = contextAudio.file || cardOptions.sound
|
cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -1464,7 +1457,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -1484,12 +1477,12 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
||||||
cardOptions.isOpposedTest = true
|
cardOptions.isOpposedTest = true
|
||||||
}
|
}
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollPrayTest(testData, WFRP_Utility.getSpeaker(cardOptions.speaker));
|
let result = game.wfrp4e.dice.rollPrayTest(testData, game.wfrp4e.utility.getSpeaker(cardOptions.speaker));
|
||||||
result.postFunction = "prayerTest";
|
result.postFunction = "prayerTest";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
|
||||||
cardOptions.sound = contextAudio.file || cardOptions.sound
|
cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -1497,8 +1490,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
Hooks.call("wfrp4e:rollPrayerTest", result, cardOptions)
|
Hooks.call("wfrp4e:rollPrayerTest", result, cardOptions)
|
||||||
|
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -1518,8 +1511,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
|
||||||
cardOptions.isOpposedTest = true
|
cardOptions.isOpposedTest = true
|
||||||
}
|
}
|
||||||
testData = await DiceWFRP.rollDices(testData, cardOptions);
|
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
|
||||||
let result = DiceWFRP.rollTest(testData);
|
let result = game.wfrp4e.dice.rollTest(testData);
|
||||||
result.postFunction = "traitTest";
|
result.postFunction = "traitTest";
|
||||||
try {
|
try {
|
||||||
// If the specification of a trait is a number, it's probably damage. (Animosity (Elves) - not a number specification: no damage)
|
// If the specification of a trait is a number, it's probably damage. (Animosity (Elves) - not a number specification: no damage)
|
||||||
@ -1540,7 +1533,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
mergeObject(result, testData.extra);
|
mergeObject(result, testData.extra);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
|
let contextAudio = await game.wfrp4e.audio.MatchContextAudio(game.wfrp4e.audio.FindContext(result))
|
||||||
cardOptions.sound = contextAudio.file || cardOptions.sound
|
cardOptions.sound = contextAudio.file || cardOptions.sound
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@ -1548,8 +1541,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
Hooks.call("wfrp4e:rollTraitTest", result, cardOptions)
|
Hooks.call("wfrp4e:rollTraitTest", result, cardOptions)
|
||||||
|
|
||||||
if (!options.suppressMessage)
|
if (!options.suppressMessage)
|
||||||
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
|
||||||
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
|
||||||
})
|
})
|
||||||
return {result, cardOptions};
|
return {result, cardOptions};
|
||||||
}
|
}
|
||||||
@ -2184,8 +2177,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
return {
|
return {
|
||||||
inventory,
|
inventory,
|
||||||
containers,
|
containers,
|
||||||
basicSkills: basicSkills.sort(WFRP_Utility.nameSorter),
|
basicSkills: basicSkills.sort(game.wfrp4e.utility.nameSorter),
|
||||||
advancedOrGroupedSkills: advancedOrGroupedSkills.sort(WFRP_Utility.nameSorter),
|
advancedOrGroupedSkills: advancedOrGroupedSkills.sort(game.wfrp4e.utility.nameSorter),
|
||||||
talents,
|
talents,
|
||||||
traits,
|
traits,
|
||||||
weapons,
|
weapons,
|
||||||
@ -2234,7 +2227,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
skill.modified = "negative"
|
skill.modified = "negative"
|
||||||
}
|
}
|
||||||
skill.data.characteristic.abrev = game.wfrp4e.config.characteristicsAbbrev[skill.data.characteristic.value];
|
skill.data.characteristic.abrev = game.wfrp4e.config.characteristicsAbbrev[skill.data.characteristic.value];
|
||||||
skill.data.cost = WFRP_Utility._calculateAdvCost(skill.data.advances.value, "skill", skill.data.advances.costModifier)
|
skill.data.cost = game.wfrp4e.utility._calculateAdvCost(skill.data.advances.value, "skill", skill.data.advances.costModifier)
|
||||||
return skill
|
return skill
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2318,7 +2311,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
// prepareQualitiesFlaws turns the comma separated qualities/flaws string into a string array
|
// prepareQualitiesFlaws turns the comma separated qualities/flaws string into a string array
|
||||||
// Does not include qualities if no skill could be found above
|
// Does not include qualities if no skill could be found above
|
||||||
weapon["properties"] = WFRP_Utility._prepareQualitiesFlaws(weapon, !!weapon.skillToUse);
|
weapon["properties"] = game.wfrp4e.utility._prepareQualitiesFlaws(weapon, !!weapon.skillToUse);
|
||||||
|
|
||||||
// Special flail rule - if no skill could be found, add the Dangerous property
|
// Special flail rule - if no skill could be found, add the Dangerous property
|
||||||
if (weapon.data.weaponGroup.value == game.i18n.localize("SPEC.Flail") && !weapon.skillToUse && !weapon.properties.includes(game.i18n.localize("PROPERTY.Dangerous")))
|
if (weapon.data.weaponGroup.value == game.i18n.localize("SPEC.Flail") && !weapon.skillToUse && !weapon.properties.includes(game.i18n.localize("PROPERTY.Dangerous")))
|
||||||
@ -2376,7 +2369,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
weapon.data.ammunitionGroup.value = "";
|
weapon.data.ammunitionGroup.value = "";
|
||||||
}
|
}
|
||||||
// Separate qualities and flaws into their own arrays: weapon.properties.qualities/flaws
|
// Separate qualities and flaws into their own arrays: weapon.properties.qualities/flaws
|
||||||
weapon.properties = WFRP_Utility._separateQualitiesFlaws(weapon.properties);
|
weapon.properties = game.wfrp4e.utility._separateQualitiesFlaws(weapon.properties);
|
||||||
|
|
||||||
if (weapon.properties.spec)
|
if (weapon.properties.spec)
|
||||||
{
|
{
|
||||||
@ -2406,7 +2399,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
*/
|
*/
|
||||||
prepareArmorCombat(armor, AP) {
|
prepareArmorCombat(armor, AP) {
|
||||||
// Turn comma separated qualites/flaws into a more structured 'properties.qualities/flaws` string array
|
// Turn comma separated qualites/flaws into a more structured 'properties.qualities/flaws` string array
|
||||||
armor.properties = WFRP_Utility._separateQualitiesFlaws(WFRP_Utility._prepareQualitiesFlaws(armor));
|
armor.properties = game.wfrp4e.utility._separateQualitiesFlaws(game.wfrp4e.utility._prepareQualitiesFlaws(armor));
|
||||||
|
|
||||||
// Iterate through armor locations covered
|
// Iterate through armor locations covered
|
||||||
for (let apLoc in armor.data.currentAP) {
|
for (let apLoc in armor.data.currentAP) {
|
||||||
@ -2420,32 +2413,32 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
if (armor.data.maxAP.head > 0) {
|
if (armor.data.maxAP.head > 0) {
|
||||||
armor["protectsHead"] = true;
|
armor["protectsHead"] = true;
|
||||||
AP.head.value += armor.data.currentAP.head;
|
AP.head.value += armor.data.currentAP.head;
|
||||||
WFRP_Utility.addLayer(AP, armor, "head")
|
game.wfrp4e.utility.addLayer(AP, armor, "head")
|
||||||
}
|
}
|
||||||
if (armor.data.maxAP.body > 0) {
|
if (armor.data.maxAP.body > 0) {
|
||||||
armor["protectsBody"] = true;
|
armor["protectsBody"] = true;
|
||||||
AP.body.value += armor.data.currentAP.body;
|
AP.body.value += armor.data.currentAP.body;
|
||||||
WFRP_Utility.addLayer(AP, armor, "body")
|
game.wfrp4e.utility.addLayer(AP, armor, "body")
|
||||||
}
|
}
|
||||||
if (armor.data.maxAP.lArm > 0) {
|
if (armor.data.maxAP.lArm > 0) {
|
||||||
armor["protectslArm"] = true;
|
armor["protectslArm"] = true;
|
||||||
AP.lArm.value += armor.data.currentAP.lArm;
|
AP.lArm.value += armor.data.currentAP.lArm;
|
||||||
WFRP_Utility.addLayer(AP, armor, "lArm")
|
game.wfrp4e.utility.addLayer(AP, armor, "lArm")
|
||||||
}
|
}
|
||||||
if (armor.data.maxAP.rArm > 0) {
|
if (armor.data.maxAP.rArm > 0) {
|
||||||
armor["protectsrArm"] = true;
|
armor["protectsrArm"] = true;
|
||||||
AP.rArm.value += armor.data.currentAP.rArm;
|
AP.rArm.value += armor.data.currentAP.rArm;
|
||||||
WFRP_Utility.addLayer(AP, armor, "rArm")
|
game.wfrp4e.utility.addLayer(AP, armor, "rArm")
|
||||||
}
|
}
|
||||||
if (armor.data.maxAP.lLeg > 0) {
|
if (armor.data.maxAP.lLeg > 0) {
|
||||||
armor["protectslLeg"] = true;
|
armor["protectslLeg"] = true;
|
||||||
AP.lLeg.value += armor.data.currentAP.lLeg;
|
AP.lLeg.value += armor.data.currentAP.lLeg;
|
||||||
WFRP_Utility.addLayer(AP, armor, "lLeg")
|
game.wfrp4e.utility.addLayer(AP, armor, "lLeg")
|
||||||
}
|
}
|
||||||
if (armor.data.maxAP.rLeg > 0) {
|
if (armor.data.maxAP.rLeg > 0) {
|
||||||
armor["protectsrLeg"] = true
|
armor["protectsrLeg"] = true
|
||||||
AP.rLeg.value += armor.data.currentAP.rLeg;
|
AP.rLeg.value += armor.data.currentAP.rLeg;
|
||||||
WFRP_Utility.addLayer(AP, armor, "rLeg")
|
game.wfrp4e.utility.addLayer(AP, armor, "rLeg")
|
||||||
}
|
}
|
||||||
return armor;
|
return armor;
|
||||||
}
|
}
|
||||||
@ -2468,7 +2461,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
if (!ammo)
|
if (!ammo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let ammoProperties = WFRP_Utility._prepareQualitiesFlaws(ammo);
|
let ammoProperties = game.wfrp4e.utility._prepareQualitiesFlaws(ammo);
|
||||||
// If ammo properties include a "special" value, rename the property as "Special Ammo" to not overlap
|
// If ammo properties include a "special" value, rename the property as "Special Ammo" to not overlap
|
||||||
// with the weapon's "Special" property
|
// with the weapon's "Special" property
|
||||||
let specialPropInd = ammoProperties.indexOf(ammoProperties.find(p => p && p.toLowerCase() == game.i18n.localize("Special").toLowerCase()));
|
let specialPropInd = ammoProperties.indexOf(ammoProperties.find(p => p && p.toLowerCase() == game.i18n.localize("Special").toLowerCase()));
|
||||||
@ -2618,7 +2611,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
// If it's a spell, augment the description (see _spellDescription() and CN based on memorization)
|
// If it's a spell, augment the description (see _spellDescription() and CN based on memorization)
|
||||||
if (item.type == "spell") {
|
if (item.type == "spell") {
|
||||||
item.data.description.value = WFRP_Utility._spellDescription(item);
|
item.data.description.value = game.wfrp4e.utility._spellDescription(item);
|
||||||
if (!item.data.memorized.value)
|
if (!item.data.memorized.value)
|
||||||
item.data.cn.value *= 2;
|
item.data.cn.value *= 2;
|
||||||
}
|
}
|
||||||
@ -2829,7 +2822,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
async addBasicSkills() {
|
async addBasicSkills() {
|
||||||
let allItems = duplicate(this.data.items)
|
let allItems = duplicate(this.data.items)
|
||||||
let ownedBasicSkills = allItems.filter(i => i.type == "skill" && i.data.advanced.value == "bsc");
|
let ownedBasicSkills = allItems.filter(i => i.type == "skill" && i.data.advanced.value == "bsc");
|
||||||
let allBasicSkills = await WFRP_Utility.allBasicSkills()
|
let allBasicSkills = await game.wfrp4e.utility.allBasicSkills()
|
||||||
|
|
||||||
// Filter allBasicSkills with ownedBasicSkills, resulting in all the missing skills
|
// Filter allBasicSkills with ownedBasicSkills, resulting in all the missing skills
|
||||||
let skillsToAdd = allBasicSkills.filter(s => !ownedBasicSkills.find(ownedSkill => ownedSkill.name == s.name))
|
let skillsToAdd = allBasicSkills.filter(s => !ownedBasicSkills.find(ownedSkill => ownedSkill.name == s.name))
|
||||||
@ -2930,8 +2923,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
return game.i18n.localize("CHAT.DamageAppliedErrorTiring");
|
return game.i18n.localize("CHAT.DamageAppliedErrorTiring");
|
||||||
|
|
||||||
// Get actor/tokens for those in the opposed test
|
// Get actor/tokens for those in the opposed test
|
||||||
let actor = WFRP_Utility.getSpeaker(victim);
|
let actor = game.wfrp4e.utility.getSpeaker(victim);
|
||||||
let attacker = WFRP_Utility.getSpeaker(opposeData.speakerAttack)
|
let attacker = game.wfrp4e.utility.getSpeaker(opposeData.speakerAttack)
|
||||||
let soundContext = { item: {}, action: "hit" };
|
let soundContext = { item: {}, action: "hit" };
|
||||||
|
|
||||||
// Start wound loss at the damage value
|
// Start wound loss at the damage value
|
||||||
@ -3081,7 +3074,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
|
|
||||||
newWounds -= totalWoundLoss
|
newWounds -= totalWoundLoss
|
||||||
|
|
||||||
WFRP_Audio.PlayContextAudio(soundContext)
|
game.wfrp4e.audio.PlayContextAudio(soundContext)
|
||||||
|
|
||||||
// If damage taken reduces wounds to 0, show Critical
|
// If damage taken reduces wounds to 0, show Critical
|
||||||
if (newWounds <= 0 && !impenetrable) {
|
if (newWounds <= 0 && !impenetrable) {
|
||||||
@ -3142,7 +3135,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
if (!skillList) {
|
if (!skillList) {
|
||||||
// findKey() will do an inverse lookup of the species key in the species object defined in config.js, and use that if
|
// findKey() will do an inverse lookup of the species key in the species object defined in config.js, and use that if
|
||||||
// user-entered species value does not work (which it probably will not)
|
// user-entered species value does not work (which it probably will not)
|
||||||
skillList = game.wfrp4e.config.speciesSkills[WFRP_Utility.findKey(this.data.data.details.species.value, game.wfrp4e.config.species)]
|
skillList = game.wfrp4e.config.speciesSkills[game.wfrp4e.utility.findKey(this.data.data.details.species.value, game.wfrp4e.config.species)]
|
||||||
if (!skillList) {
|
if (!skillList) {
|
||||||
throw game.i18n.localize("Error.SpeciesSkills") + " " + this.data.data.details.species.value;
|
throw game.i18n.localize("Error.SpeciesSkills") + " " + this.data.data.details.species.value;
|
||||||
}
|
}
|
||||||
@ -3193,7 +3186,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
if (!talentList) {
|
if (!talentList) {
|
||||||
// findKey() will do an inverse lookup of the species key in the species object defined in config.js, and use that if
|
// findKey() will do an inverse lookup of the species key in the species object defined in config.js, and use that if
|
||||||
// user-entered species value does not work (which it probably will not)
|
// user-entered species value does not work (which it probably will not)
|
||||||
talentList = game.wfrp4e.config.speciesTalents[WFRP_Utility.findKey(this.data.data.details.species.value, game.wfrp4e.config.species)]
|
talentList = game.wfrp4e.config.speciesTalents[game.wfrp4e.utility.findKey(this.data.data.details.species.value, game.wfrp4e.config.species)]
|
||||||
if (!talentList)
|
if (!talentList)
|
||||||
throw game.i18n.localize("Error.SpeciesTalents") + " " + this.data.data.details.species.value;
|
throw game.i18n.localize("Error.SpeciesTalents") + " " + this.data.data.details.species.value;
|
||||||
}
|
}
|
||||||
@ -3261,7 +3254,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
try {
|
try {
|
||||||
// See findSkill() for a detailed explanation of how it works
|
// See findSkill() for a detailed explanation of how it works
|
||||||
// Advanced find function, returns the skill the user expects it to return, even with skills not included in the compendium (Lore (whatever))
|
// Advanced find function, returns the skill the user expects it to return, even with skills not included in the compendium (Lore (whatever))
|
||||||
let skillToAdd = await WFRP_Utility.findSkill(skillName)
|
let skillToAdd = await game.wfrp4e.utility.findSkill(skillName)
|
||||||
skillToAdd.data.data.advances.value = advances;
|
skillToAdd.data.data.advances.value = advances;
|
||||||
await this.createEmbeddedEntity("OwnedItem", skillToAdd.data);
|
await this.createEmbeddedEntity("OwnedItem", skillToAdd.data);
|
||||||
}
|
}
|
||||||
@ -3284,7 +3277,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
try {
|
try {
|
||||||
// See findTalent() for a detailed explanation of how it works
|
// See findTalent() for a detailed explanation of how it works
|
||||||
// Advanced find function, returns the Talent the user expects it to return, even with Talents not included in the compendium (Etiquette (whatever))
|
// Advanced find function, returns the Talent the user expects it to return, even with Talents not included in the compendium (Etiquette (whatever))
|
||||||
let talent = await WFRP_Utility.findTalent(talentName);
|
let talent = await game.wfrp4e.utility.findTalent(talentName);
|
||||||
await this.createEmbeddedEntity("OwnedItem", talent.data);
|
await this.createEmbeddedEntity("OwnedItem", talent.data);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@ -3356,7 +3349,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
html += `${game.i18n.format("FORTUNE.UsageAddSLText", { character: '<b>' + this.name + '</b>' })}<br>`;
|
html += `${game.i18n.format("FORTUNE.UsageAddSLText", { character: '<b>' + this.name + '</b>' })}<br>`;
|
||||||
|
|
||||||
html += `<b>${game.i18n.localize("FORTUNE.PointsRemaining")} </b>${this.data.data.status.fortune.value - 1}`;
|
html += `<b>${game.i18n.localize("FORTUNE.PointsRemaining")} </b>${this.data.data.status.fortune.value - 1}`;
|
||||||
ChatMessage.create(WFRP_Utility.chatDataSetup(html));
|
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(html));
|
||||||
|
|
||||||
let cardOptions = this.preparePostRollAction(message);
|
let cardOptions = this.preparePostRollAction(message);
|
||||||
//Then we do the actual fortune action
|
//Then we do the actual fortune action
|
||||||
@ -3418,7 +3411,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
html += `${game.i18n.format("DARKDEAL.UsageText", { character: '<b>' + this.name + '</b>' })}<br>`;
|
html += `${game.i18n.format("DARKDEAL.UsageText", { character: '<b>' + this.name + '</b>' })}<br>`;
|
||||||
let corruption = Math.trunc(this.data.data.status.corruption.value) + 1;
|
let corruption = Math.trunc(this.data.data.status.corruption.value) + 1;
|
||||||
html += `<b>${game.i18n.localize("Corruption")}: </b>${corruption}/${this.data.data.status.corruption.max}`;
|
html += `<b>${game.i18n.localize("Corruption")}: </b>${corruption}/${this.data.data.status.corruption.max}`;
|
||||||
ChatMessage.create(WFRP_Utility.chatDataSetup(html));
|
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(html));
|
||||||
this.update({ "data.status.corruption.value": corruption }).then(() => {
|
this.update({ "data.status.corruption.value": corruption }).then(() => {
|
||||||
this.checkCorruption();
|
this.checkCorruption();
|
||||||
});
|
});
|
||||||
@ -3537,7 +3530,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let newCorruption = Number(this.data.data.status.corruption.value) + corruption
|
let newCorruption = Number(this.data.data.status.corruption.value) + corruption
|
||||||
ChatMessage.create(WFRP_Utility.chatDataSetup(`<b>${this.name}</b> gains ${corruption} Corruption.`, "gmroll", false))
|
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(`<b>${this.name}</b> gains ${corruption} Corruption.`, "gmroll", false))
|
||||||
await this.update({ "data.status.corruption.value": newCorruption })
|
await this.update({ "data.status.corruption.value": newCorruption })
|
||||||
if (corruption > 0)
|
if (corruption > 0)
|
||||||
this.checkCorruption();
|
this.checkCorruption();
|
||||||
@ -3566,7 +3559,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
if (failed) {
|
if (failed) {
|
||||||
let wpb = this.data.data.characteristics.wp.bonus;
|
let wpb = this.data.data.characteristics.wp.bonus;
|
||||||
let tableText = "Roll on a Corruption Table:<br>" + game.wfrp4e.config.corruptionTables.map(t => `@Table[${t}]<br>`).join("")
|
let tableText = "Roll on a Corruption Table:<br>" + game.wfrp4e.config.corruptionTables.map(t => `@Table[${t}]<br>`).join("")
|
||||||
ChatMessage.create(WFRP_Utility.chatDataSetup(`
|
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(`
|
||||||
<h3>Dissolution of Body and Mind</h3>
|
<h3>Dissolution of Body and Mind</h3>
|
||||||
<p>As corruption ravages your soul, the warping breath of Chaos whispers within, either fanning your flesh into a fresh, new form, or fracturing your psyche with exquisite knowledge it can never unlearn.</p>
|
<p>As corruption ravages your soul, the warping breath of Chaos whispers within, either fanning your flesh into a fresh, new form, or fracturing your psyche with exquisite knowledge it can never unlearn.</p>
|
||||||
<p><b>${this.name}</b> loses ${wpb} Corruption.
|
<p><b>${this.name}</b> loses ${wpb} Corruption.
|
||||||
@ -3575,7 +3568,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
|
|||||||
this.update({ "data.status.corruption.value": Number(this.data.data.status.corruption.value) - wpb })
|
this.update({ "data.status.corruption.value": Number(this.data.data.status.corruption.value) - wpb })
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ChatMessage.create(WFRP_Utility.chatDataSetup(`You have managed to hold off your corruption. For now.`, "gmroll", false))
|
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(`You have managed to hold off your corruption. For now.`, "gmroll", false))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user