Fix spells bugs

This commit is contained in:
sladecraven 2020-11-07 00:42:04 +01:00
parent 8451ed0743
commit b9ca7c0489
4 changed files with 89 additions and 85 deletions

View File

@ -28,7 +28,6 @@ Hooks.once('init', () => {
//WFRP_Tables = game.wfrp4e.tables;
//WFRP4E = game.wfrp4e.config;
CONFIG.Actor.entityClass = ActorWfrp4e_fr;
console.log("PATCH !DONE !!", CONFIG.Actor.entityClass);
// Babele stuff
if(typeof Babele !== 'undefined') {

View File

@ -3,7 +3,7 @@
"name": "WH4-fr-translation",
"title": "Traduction du module WH4 en Français.",
"description": "La traduction du module WH4.",
"version": "1.3.14",
"version": "1.3.15",
"minimumCoreVersion" : "0.6.6",
"compatibleCoreVersion": "1.0.0",
"author": "LeRatierBretonnien",

View File

@ -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.
*
@ -57,8 +50,8 @@ export default class ActorWfrp4e_fr extends Actor {
autoCalcEnc: true,
autoCalcSize: true,
}
let basicSkills = await WFRP_Utility.allBasicSkills() || [];
let moneyItems = await WFRP_Utility.allMoneyItems() || [];
let basicSkills = await game.wfrp4e.utility.allBasicSkills() || [];
let moneyItems = await game.wfrp4e.utility.allMoneyItems() || [];
moneyItems = moneyItems.sort((a, b) => (a.data.coinValue.value > b.data.coinValue.value) ? -1 : 1);
// 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)) {
ch.value = ch.initial + ch.advances + (ch.modifier || 0);
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
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
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)
// 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,
testData: testData,
cardOptions: cardOptions
@ -514,7 +507,7 @@ export default class ActorWfrp4e_fr extends Actor {
cardOptions.rollMode = "gmroll"
// 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,
testData: testData,
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)
// 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,
testData: testData,
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)
// 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,
testData: testData,
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)
// 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,
testData: testData,
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)
// 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,
testData: testData,
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)
// 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,
testData: testData,
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)
*/
async basicTest({ testData, cardOptions }, options = {}) {
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollTest(testData);
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollTest(testData);
result.postFunction = "basicTest";
if (testData.extra)
@ -1223,7 +1216,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
}
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
}
catch
@ -1237,8 +1230,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (!options.suppressMessage)
if (!options.suppressMessage)
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
})
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)
*/
async incomeTest({ testData, cardOptions }, options = {}) {
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollTest(testData);
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollTest(testData);
result.postFunction = "incomeTest"
Hooks.call("wfrp4e:rollIncomeTest", result, cardOptions)
@ -1269,10 +1262,10 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
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)
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";
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
if (result.description.includes("Success")) {
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":
result.incomeResult += ` ${game.i18n.localize("NAME.BPPlural").toLowerCase()}.`
break;
@ -1301,7 +1294,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
else if (Number(result.SL) > -6) {
moneyEarned /= 2;
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":
result.incomeResult += ` ${game.i18n.localize("NAME.BPPlural").toLowerCase()}.`
break;
@ -1322,10 +1315,10 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
}
// let contextAudio = await WFRP_Audio.MatchContextAudio(WFRP_Audio.FindContext(result))
// 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)
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
OpposedWFRP.handleOpposedTarget(msg)
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
game.wfrp4e.opposed.handleOpposedTarget(msg)
})
return {result, cardOptions};
}
@ -1345,8 +1338,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
cardOptions.isOpposedTest = true
}
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollWeaponTest(testData);
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollWeaponTest(testData);
result.postFunction = "weaponTest";
// Reduce ammo if necessary
@ -1356,7 +1349,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
}
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
}
catch
@ -1365,8 +1358,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (!options.suppressMessage)
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
})
return {result, cardOptions};
}
@ -1386,8 +1379,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
cardOptions.isOpposedTest = true
}
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollCastTest(testData);
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollCastTest(testData);
result.postFunction = "castTest";
@ -1404,7 +1397,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
testData.extra.ingredient = false;
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
}
catch
@ -1413,12 +1406,12 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
// 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)
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};
}
@ -1438,8 +1431,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
cardOptions.isOpposedTest = true
}
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollChannellTest(testData, WFRP_Utility.getSpeaker(cardOptions.speaker));
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollChannellTest(testData, game.wfrp4e.utility.getSpeaker(cardOptions.speaker));
result.postFunction = "channelTest";
// Find ingredient being used, if any
@ -1455,7 +1448,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
testData.extra.ingredient = false;
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
}
catch
@ -1464,7 +1457,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (!options.suppressMessage)
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};
}
@ -1484,12 +1477,12 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
cardOptions.isOpposedTest = true
}
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollPrayTest(testData, WFRP_Utility.getSpeaker(cardOptions.speaker));
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollPrayTest(testData, game.wfrp4e.utility.getSpeaker(cardOptions.speaker));
result.postFunction = "prayerTest";
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
}
catch
@ -1497,8 +1490,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
Hooks.call("wfrp4e:rollPrayerTest", result, cardOptions)
if (!options.suppressMessage)
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
})
return {result, cardOptions};
}
@ -1518,8 +1511,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
cardOptions.title += ` - ${game.i18n.localize("Opposed")}`,
cardOptions.isOpposedTest = true
}
testData = await DiceWFRP.rollDices(testData, cardOptions);
let result = DiceWFRP.rollTest(testData);
testData = await game.wfrp4e.dice.rollDices(testData, cardOptions);
let result = game.wfrp4e.dice.rollTest(testData);
result.postFunction = "traitTest";
try {
// 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);
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
}
catch
@ -1548,8 +1541,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
Hooks.call("wfrp4e:rollTraitTest", result, cardOptions)
if (!options.suppressMessage)
DiceWFRP.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
OpposedWFRP.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
game.wfrp4e.dice.renderRollCard(cardOptions, result, options.rerenderMessage).then(msg => {
game.wfrp4e.opposed.handleOpposedTarget(msg) // Send to handleOpposed to determine opposed status, if any.
})
return {result, cardOptions};
}
@ -2184,8 +2177,8 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
return {
inventory,
containers,
basicSkills: basicSkills.sort(WFRP_Utility.nameSorter),
advancedOrGroupedSkills: advancedOrGroupedSkills.sort(WFRP_Utility.nameSorter),
basicSkills: basicSkills.sort(game.wfrp4e.utility.nameSorter),
advancedOrGroupedSkills: advancedOrGroupedSkills.sort(game.wfrp4e.utility.nameSorter),
talents,
traits,
weapons,
@ -2234,7 +2227,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
skill.modified = "negative"
}
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
}
@ -2318,7 +2311,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
// prepareQualitiesFlaws turns the comma separated qualities/flaws string into a string array
// 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
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 = "";
}
// 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)
{
@ -2406,7 +2399,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
*/
prepareArmorCombat(armor, AP) {
// 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
for (let apLoc in armor.data.currentAP) {
@ -2420,32 +2413,32 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (armor.data.maxAP.head > 0) {
armor["protectsHead"] = true;
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) {
armor["protectsBody"] = true;
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) {
armor["protectslArm"] = true;
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) {
armor["protectsrArm"] = true;
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) {
armor["protectslLeg"] = true;
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) {
armor["protectsrLeg"] = true
AP.rLeg.value += armor.data.currentAP.rLeg;
WFRP_Utility.addLayer(AP, armor, "rLeg")
game.wfrp4e.utility.addLayer(AP, armor, "rLeg")
}
return armor;
}
@ -2468,7 +2461,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (!ammo)
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
// with the weapon's "Special" property
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 (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)
item.data.cn.value *= 2;
}
@ -2829,7 +2822,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
async addBasicSkills() {
let allItems = duplicate(this.data.items)
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
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");
// Get actor/tokens for those in the opposed test
let actor = WFRP_Utility.getSpeaker(victim);
let attacker = WFRP_Utility.getSpeaker(opposeData.speakerAttack)
let actor = game.wfrp4e.utility.getSpeaker(victim);
let attacker = game.wfrp4e.utility.getSpeaker(opposeData.speakerAttack)
let soundContext = { item: {}, action: "hit" };
// Start wound loss at the damage value
@ -3081,7 +3074,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
newWounds -= totalWoundLoss
WFRP_Audio.PlayContextAudio(soundContext)
game.wfrp4e.audio.PlayContextAudio(soundContext)
// If damage taken reduces wounds to 0, show Critical
if (newWounds <= 0 && !impenetrable) {
@ -3142,7 +3135,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (!skillList) {
// 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)
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) {
throw game.i18n.localize("Error.SpeciesSkills") + " " + this.data.data.details.species.value;
}
@ -3193,7 +3186,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (!talentList) {
// 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)
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)
throw game.i18n.localize("Error.SpeciesTalents") + " " + this.data.data.details.species.value;
}
@ -3261,7 +3254,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
try {
// 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))
let skillToAdd = await WFRP_Utility.findSkill(skillName)
let skillToAdd = await game.wfrp4e.utility.findSkill(skillName)
skillToAdd.data.data.advances.value = advances;
await this.createEmbeddedEntity("OwnedItem", skillToAdd.data);
}
@ -3284,7 +3277,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
try {
// 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))
let talent = await WFRP_Utility.findTalent(talentName);
let talent = await game.wfrp4e.utility.findTalent(talentName);
await this.createEmbeddedEntity("OwnedItem", talent.data);
}
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 += `<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);
//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>`;
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}`;
ChatMessage.create(WFRP_Utility.chatDataSetup(html));
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(html));
this.update({ "data.status.corruption.value": corruption }).then(() => {
this.checkCorruption();
});
@ -3537,7 +3530,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
break;
}
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 })
if (corruption > 0)
this.checkCorruption();
@ -3566,7 +3559,7 @@ DiceWFRP.renderRollCard() as well as handleOpposedTarget().
if (failed) {
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("")
ChatMessage.create(WFRP_Utility.chatDataSetup(`
ChatMessage.create(game.wfrp4e.utility.chatDataSetup(`
<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><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 })
}
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