mirror of
https://github.com/Nighthawk42/roll20-character-sheets.git
synced 2026-09-05 22:52:32 +00:00
+494
-2284
File diff suppressed because one or more lines are too long
@@ -3,7 +3,7 @@
|
||||
"css": "styles.css",
|
||||
"authors": "Noel da Costa",
|
||||
"roll20userid": "3920005",
|
||||
"instructions": "# Instructions/r/r## Using the sheet/r/r### Overview/r/rThis sheet is for use with the GammaWorld 3rd edition rules./r/r### Abilities/r/r3e required that character abilities be rolled randomly. This is currently a requirement on the sheet -Â you can't edit your attributes directly. To roll your character's abilities, click on the `Roll-up` tab, here you can roll attributes and hitpoints. If you wish to re-roll you need to first click `Reset`./r/r- Adv. - This represents your character's advancement through XP. If you take your ability scores up with XP add the amount in this field./r- Tmp. - Any temporary modifiers to an ability score should be entered in this field/r- Mod. - The ability modifier is calculated automatically/r/r### Combat Stats/r/r#### Defence/r/rNote that this is a slight departure from the original character sheets included with the rules in that it splits defence ratings across `energy`, `physical` and `mental`. These were implied in the rules but not fully represented on the PnP character sheet. These are calculated values based on Gear, Armour and Mutation entries./r/r- _CS_: Column Shift/r- _RF_: Result Factor/r- _DR_: Damage Reduction",
|
||||
"instructions": "This sheet is for use with the GammaWorld 3rd edition rules. Character abilities must be rolled randomly, this is currently a requirement on the sheet - you cannot edit your attributes directly. To roll your character's abilities, click on the `Roll-up` tab, here you can roll attributes and hitpoints. If you wish to re-roll you need to first click `Reset`. Note that this is a slight departure from the original character sheets included with the rules in that it splits defence ratings across `energy`, `physical` and `mental`. These were implied in the rules but not fully represented on the PnP character sheet. These are calculated values based on Gear, Armour and Mutation entries. CS: Column Shift RF: Result Factor DR: Damage Reduction",
|
||||
"preview": "GW3-sheet.png",
|
||||
"legacy": true
|
||||
}
|
||||
@@ -48,8 +48,7 @@ function empty(mixedVar) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @license: GammaWorld compendium not included for licensing reasons, but you can create your own, contact me for advice on how
|
||||
// import compendium from './compendium'
|
||||
import compendium from "./compendium";
|
||||
|
||||
var GW3Companion =
|
||||
GW3Companion ||
|
||||
@@ -63,10 +62,12 @@ var GW3Companion =
|
||||
// Styling for the chat responses.
|
||||
const styles = {
|
||||
reset: "padding: 0; margin: 0;",
|
||||
menuborder:
|
||||
"border: 0px solid transparent; border-radius: 4px; padding: 6px; background: red;",
|
||||
menu:
|
||||
"background-color: #fff; border: 1px dashed #ae2400; padding: 5px 5px 10px 5px; border-radius: 5px;",
|
||||
"background-color: #f1f1f1; border: 5px solid transparent; padding: 6px 5px 10px 5px; border-radius: 4px;",
|
||||
button:
|
||||
"background-color: #000; border: 1px solid #292929; border-radius: 3px; padding: 5px; color: #fff; text-align: center;",
|
||||
"background-color: #000; border: 1px solid #292929; border-radius: 3px; padding: 5px; color: #f1f1f1; text-align: center;",
|
||||
list: "list-style: none;",
|
||||
float: {
|
||||
right: "float: right;",
|
||||
@@ -83,6 +84,10 @@ var GW3Companion =
|
||||
fullWidth: "width: 100%;",
|
||||
underline: "text-decoration: underline;",
|
||||
strikethrough: "text-decoration: strikethrough",
|
||||
border:
|
||||
"margin-top: 1rem; border: 1px solid #aaa; padding: 1rem; border-radius: 5px;",
|
||||
description:
|
||||
"font-weight: normal; margin-top: 5px; border: 1px solid grey; padding: 1rem; border-radius: 5px; background-color: #aaa; color: white;",
|
||||
effect:
|
||||
"font-weight: bold; margin-top: 5px; border: 1px solid grey; padding: 1rem; border-radius: 5px; background-color: #aaa; color: white;",
|
||||
},
|
||||
@@ -217,6 +222,7 @@ var GW3Companion =
|
||||
log(msg);
|
||||
log("GM issued " + script_name + " msg: " + msg.content);
|
||||
log("GM issued " + script_name + " command: " + command);
|
||||
log("state config", state[state_name].config.command);
|
||||
if (command == state[state_name].config.command) {
|
||||
switch (extracommand) {
|
||||
case "reset":
|
||||
@@ -294,10 +300,14 @@ var GW3Companion =
|
||||
case "act":
|
||||
log("ACT roll");
|
||||
if (args.length > 0) {
|
||||
log("args obj...");
|
||||
log(args);
|
||||
// Get main settings
|
||||
let rankSetting = args.shift().split("|");
|
||||
log("rankSetting...");
|
||||
log(rankSetting);
|
||||
let rank = rankSetting.shift();
|
||||
log("rank: ", rank);
|
||||
let roll1 = rankSetting[0];
|
||||
let roll2 = rankSetting[1];
|
||||
|
||||
@@ -306,6 +316,7 @@ var GW3Companion =
|
||||
log("parameters: ");
|
||||
log(parameters);
|
||||
log("act passed rank: " + rank);
|
||||
log("roll1 & roll2...");
|
||||
log(roll1);
|
||||
log(roll2);
|
||||
// log(value);
|
||||
@@ -326,14 +337,21 @@ var GW3Companion =
|
||||
break;
|
||||
case "category":
|
||||
log("category");
|
||||
log("args length:" + args.length);
|
||||
if (args.length > 0) {
|
||||
let category = args.shift();
|
||||
log("category: " + category);
|
||||
let cost = 0;
|
||||
data = getData();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
log("got data");
|
||||
listItems = [];
|
||||
let items = Object.keys(data[category]);
|
||||
let subcat = {};
|
||||
let header = "";
|
||||
log("got items");
|
||||
_.each(items, (item) => {
|
||||
// render type headers
|
||||
if (data[category][item].type) {
|
||||
@@ -394,8 +412,18 @@ var GW3Companion =
|
||||
case "compendium":
|
||||
log("compendium");
|
||||
data = getData();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
listItems = [];
|
||||
let categories = ["armour", "attacks", "gear", "mutations"];
|
||||
let categories = [
|
||||
"armour",
|
||||
"attacks",
|
||||
"gear",
|
||||
"mutations",
|
||||
"skills",
|
||||
"talents",
|
||||
];
|
||||
_.each(categories, (category) => {
|
||||
button = makeButton(
|
||||
ucFirst(category),
|
||||
@@ -484,10 +512,20 @@ var GW3Companion =
|
||||
}
|
||||
return { colour, RF, background };
|
||||
},
|
||||
/**
|
||||
* @param {object} msg the msg object from chat window
|
||||
* @param {string} rank the rank column to roll against
|
||||
* @param {object} parameters the message content parsed as key, value pairs
|
||||
* @param {Number} roll1 the ability ACT roll (i.e. number from 1 - 100)
|
||||
* @param {Number} roll2 the save ACT roll (i.e. number from 1 - 100)
|
||||
*/
|
||||
rollAct = (msg, rank, parameters = {}, roll1, roll2) => {
|
||||
const self = this;
|
||||
log("rollACT: " + rank);
|
||||
const data = getData();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
let save,
|
||||
rankHTML = "",
|
||||
effectType = "effect",
|
||||
@@ -497,7 +535,8 @@ var GW3Companion =
|
||||
colorResult = {},
|
||||
effectName = "",
|
||||
category = parameters["category"],
|
||||
dmgTotalString = "";
|
||||
dmgTotalString = "",
|
||||
orig_rank = parseInt(rank);
|
||||
rank = parseInt(rank);
|
||||
rankHTML = `<span style="${styles.rank}" title="Score: ${rank}">${rank}</span>`;
|
||||
sendChat(msg.playerid, "/roll 2d100", function (ops) {
|
||||
@@ -517,9 +556,9 @@ var GW3Companion =
|
||||
log("roll1: " + roll1);
|
||||
log("roll2: " + roll2);
|
||||
if (parameters["mod"]) {
|
||||
// log('calculating rank based on mod');
|
||||
// log('calculating rank based on modifier');
|
||||
// log(parameters['character']);
|
||||
// log(`${parameters['mod']}_mod`);
|
||||
// log(`${parameters['modifier']}_mod`);
|
||||
// log(getAttrByName(parameters['character'], 'PS_modifier'));
|
||||
|
||||
const mod = parseInt(
|
||||
@@ -532,9 +571,9 @@ var GW3Companion =
|
||||
rank += mod;
|
||||
}
|
||||
if (parameters["character"]) {
|
||||
character = getObj("character", parameters["character"]);
|
||||
log("character: ");
|
||||
log(character);
|
||||
character = getObj("character", parameters["character"]);
|
||||
}
|
||||
if (parameters["CS"]) {
|
||||
log("calculating rank based on CS: " + parseInt(parameters["CS"]));
|
||||
@@ -585,18 +624,92 @@ var GW3Companion =
|
||||
// log(attribute);
|
||||
// });
|
||||
}
|
||||
|
||||
// minus target's DX mod for melee attacks
|
||||
if (
|
||||
parameters["category"] === "attacks" &&
|
||||
parameters["type"] === "melee"
|
||||
) {
|
||||
let targetDXmod = getAttrByName(
|
||||
targetCharacter.id,
|
||||
"DX_modifier"
|
||||
if (parameters["category"] === "attacks") {
|
||||
let character_rank = parseInt(
|
||||
getAttrByName(character.id, "character_rank")
|
||||
);
|
||||
log("targetDXmod: " + targetDXmod);
|
||||
rankHTML += ` - <span style="${styles.rank}" title="Melee target DX mod">${targetDXmod}</span>`;
|
||||
rank -= parseInt(targetDXmod);
|
||||
log("character");
|
||||
log(character);
|
||||
log("talents");
|
||||
|
||||
rank += character_rank;
|
||||
rankHTML += ` + <span style="${styles.rank}" title="Character rank">${character_rank}</span>`;
|
||||
if (parameters["type"] === "melee") {
|
||||
let targetDXmod = getAttrByName(
|
||||
targetCharacter.id,
|
||||
"DX_modifier"
|
||||
);
|
||||
log("targetDXmod: " + targetDXmod);
|
||||
rankHTML += ` - <span style="${styles.rank}" title="Melee target DX mod">${targetDXmod}</span>`;
|
||||
rank -= parseInt(targetDXmod);
|
||||
}
|
||||
if (parameters["type"] === "throwing") {
|
||||
let throwingTalent = filterObjs(
|
||||
(a) =>
|
||||
a.get("type") === "attribute" &&
|
||||
a.get("characterid") === character.id &&
|
||||
/^repeating_talents_[^_]*_ref$/.test(a.get("name")) &&
|
||||
a.get("current") === "throwing"
|
||||
);
|
||||
if (throwingTalent.length) {
|
||||
rankHTML += ` + <span style="${styles.rank}" title="Throwing talent">${character_rank}</span>`;
|
||||
rank += character_rank;
|
||||
}
|
||||
}
|
||||
if (parameters["type"] === "shooting") {
|
||||
let shootingTalent = filterObjs(
|
||||
(a) =>
|
||||
a.get("type") === "attribute" &&
|
||||
a.get("characterid") === character.id &&
|
||||
/^repeating_talents_[^_]*_ref$/.test(a.get("name")) &&
|
||||
a.get("current") === "shooting"
|
||||
);
|
||||
if (shootingTalent.length) {
|
||||
rankHTML += ` + <span style="${styles.rank}" title="Shooting talent">${character_rank}</span>`;
|
||||
rank += character_rank;
|
||||
}
|
||||
}
|
||||
if (parameters["type"] === "grappling") {
|
||||
let grapplingTalent = filterObjs(
|
||||
(a) =>
|
||||
a.get("type") === "attribute" &&
|
||||
a.get("characterid") === character.id &&
|
||||
/^repeating_talents_[^_]*_ref$/.test(a.get("name")) &&
|
||||
a.get("current") === "grappling"
|
||||
);
|
||||
if (grapplingTalent.length) {
|
||||
rankHTML += ` + <span style="${styles.rank}" title="Wrestling talent">${character_rank}</span>`;
|
||||
rank += character_rank;
|
||||
}
|
||||
}
|
||||
if (parameters["type"] === "martialarts") {
|
||||
let martialartsTalent = filterObjs(
|
||||
(a) =>
|
||||
a.get("type") === "attribute" &&
|
||||
a.get("characterid") === character.id &&
|
||||
/^repeating_talents_[^_]*_ref$/.test(a.get("name")) &&
|
||||
a.get("current") === "martialarts"
|
||||
);
|
||||
if (martialartsTalent.length) {
|
||||
rankHTML += ` + <span style="${styles.rank}" title="Martialarts talent">${character_rank}</span>`;
|
||||
rank += character_rank;
|
||||
}
|
||||
}
|
||||
if (parameters["type"] === "brawling") {
|
||||
let brawlingTalent = filterObjs(
|
||||
(a) =>
|
||||
a.get("type") === "attribute" &&
|
||||
a.get("characterid") === character.id &&
|
||||
/^repeating_talents_[^_]*_ref$/.test(a.get("name")) &&
|
||||
a.get("current") === "brawling"
|
||||
);
|
||||
if (brawlingTalent.length) {
|
||||
rankHTML += ` + <span style="${styles.rank}" title="Brawling talent">${character_rank}</span>`;
|
||||
rank += character_rank;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,7 +730,7 @@ var GW3Companion =
|
||||
}
|
||||
|
||||
colorResult = getRollColour(roll1, row);
|
||||
// log('color: ' + colour);
|
||||
log("colorResult: " + colorResult);
|
||||
// log('background: ' + background);
|
||||
// log('RC: ' + background);
|
||||
// log('RF: ' + RF);
|
||||
@@ -643,36 +756,53 @@ var GW3Companion =
|
||||
"damage parameter: " +
|
||||
parameters["dmg"] +
|
||||
" - " +
|
||||
parameters["damage_type"]
|
||||
parameters["dmg_type"]
|
||||
);
|
||||
let baseDmg,
|
||||
let baseDmg = 0,
|
||||
DR = 0,
|
||||
soaked;
|
||||
if (parameters["dmg"] === "mutation") {
|
||||
baseDmg = parseInt(rank) / 2;
|
||||
dmgAfterDRsoak = 0;
|
||||
if (parameters["dmg"] === "mutation" || parameters["dmg"] === "M") {
|
||||
baseDmg = parseInt(orig_rank) / 2;
|
||||
} else if (parameters["dmg"].includes("/")) {
|
||||
//- cater for damage ratings for different sizes
|
||||
let dmg = parameters["dmg"].split("/");
|
||||
log("dmg: ");
|
||||
log(dmg);
|
||||
let size =
|
||||
getAttrByName(targetCharacter.id, "character_size") || 3;
|
||||
log("size: " + size);
|
||||
baseDmg = parseInt(size) < 4 ? dmg[0] : dmg[1];
|
||||
baseDmg =
|
||||
parseInt(size) < 4 ? parseInt(dmg[0]) : parseInt(dmg[1]);
|
||||
log("baseDmg after size: " + baseDmg);
|
||||
if (_.isNaN(baseDmg)) baseDmg = 0;
|
||||
} else {
|
||||
baseDmg = parseInt(parameters["dmg"]);
|
||||
if (_.isNaN(baseDmg)) baseDmg = 0;
|
||||
}
|
||||
|
||||
if (parameters["category"] === "attacks") {
|
||||
if (parameters["skilldmg"]) {
|
||||
log("baseDmg orig_rank: " + orig_rank);
|
||||
log("baseDmg before skilldmg: " + baseDmg);
|
||||
baseDmg += parseInt(orig_rank);
|
||||
log("baseDmg after skilldmg: " + baseDmg);
|
||||
}
|
||||
}
|
||||
|
||||
log("baseDMG: " + baseDmg);
|
||||
log("RF: " + colorResult.RF);
|
||||
DR = getAttrByName(targetCharacter.id, "DR_physical") || 0;
|
||||
log("DR: " + DR);
|
||||
log("DR in: " + parseInt(DR));
|
||||
|
||||
let dmgTotal = parseInt(colorResult.RF) * parseInt(baseDmg);
|
||||
if (DR) {
|
||||
soaked = dmgTotal + parseInt(DR);
|
||||
}
|
||||
soaked = soaked < 1 ? 0 : soaked;
|
||||
if (_.isNaN(dmgTotal)) dmgTotal = 0;
|
||||
dmgAfterDRsoak = dmgTotal;
|
||||
dmgAfterDRsoak += parseInt(DR);
|
||||
dmgAfterDRsoak = dmgAfterDRsoak < 1 ? 0 : dmgAfterDRsoak;
|
||||
log("dmgTotal: " + dmgTotal);
|
||||
dmgTotalString = `Physical Damage: <span title="Base: ${baseDmg}, Dmg: ${dmgTotal} DR: ${DR}">${soaked}</span>`;
|
||||
log("dmgAfterDRsoak: " + dmgAfterDRsoak);
|
||||
dmgTotalString = `Physical Damage: <span title="Base: ${baseDmg}, Dmg: ${dmgTotal} DR: ${DR}">${dmgAfterDRsoak}</span>`;
|
||||
}
|
||||
|
||||
content += makeResult(
|
||||
@@ -698,35 +828,70 @@ var GW3Companion =
|
||||
}
|
||||
};
|
||||
|
||||
// check save from item or from damage type
|
||||
if (parameters["damage_type"]) {
|
||||
if (data["damage_types"][parameters["damage_type"]]) {
|
||||
if (data["damage_types"][parameters["damage_type"]]["save"]) {
|
||||
save = data["damage_types"][parameters["damage_type"]].save;
|
||||
// show ability description
|
||||
if (parameters["describe"] === "on") {
|
||||
const description = _.defaults(
|
||||
data[parameters["category"]][parameters["id"]],
|
||||
{ description: false }
|
||||
).description;
|
||||
if (description) {
|
||||
content += `<div style="${styles.description};">${description}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters["save"]) {
|
||||
save = parameters["save"];
|
||||
}
|
||||
let effectsContent = "";
|
||||
// override save type from damage type
|
||||
if (parameters["dmg_type"]) {
|
||||
log(
|
||||
"Damage Type: " +
|
||||
data["damage_types"][parameters["dmg_type"]].name
|
||||
);
|
||||
if (data["damage_types"][parameters["dmg_type"]]) {
|
||||
if (data["damage_types"][parameters["dmg_type"]].save) {
|
||||
save = data["damage_types"][parameters["dmg_type"]].save;
|
||||
}
|
||||
if (data["damage_types"][parameters["dmg_type"]].effect_crit) {
|
||||
parameters["effect_crit"] =
|
||||
data["damage_types"][parameters["dmg_type"]].effect_crit;
|
||||
}
|
||||
if (data["damage_types"][parameters["dmg_type"]].effect) {
|
||||
parameters["effect"] =
|
||||
data["damage_types"][parameters["dmg_type"]].effect;
|
||||
}
|
||||
if (data["damage_types"][parameters["dmg_type"]].description) {
|
||||
content += `<div style="${
|
||||
styles.description
|
||||
};"><b style="${row}">Damage Type: ${
|
||||
data["damage_types"][parameters["dmg_type"]].name
|
||||
}</b><p>${
|
||||
data["damage_types"][parameters["dmg_type"]].description
|
||||
}</p></div>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters["effect"]) {
|
||||
effectName = parameters["effect"];
|
||||
log("effect name: " + effectName);
|
||||
if (
|
||||
!empty(data.effects) &&
|
||||
!empty(data.effects[parameters["effect"]])
|
||||
) {
|
||||
effectName = data.effects[parameters["effect"]].name;
|
||||
effectDisplayName = data.effects[parameters["effect"]].name;
|
||||
log("effect name: " + effectDisplayName);
|
||||
// let result = getEffectResult(parameters['effect'], colorResult.background);
|
||||
content += `<div style="font-weight: bold">Effect: </div><div>${effectName}</div>`;
|
||||
content += `<div style="font-weight: bold">Effect: </div><div>${effectDisplayName}</div>`;
|
||||
} else if (
|
||||
!empty(data.damage_types) &&
|
||||
data.damage_types[parameters["effect"]]
|
||||
) {
|
||||
log(
|
||||
"damage_type based on effect: " +
|
||||
parameters["effect"] +
|
||||
", " +
|
||||
data.damage_types[parameters["effect"]]
|
||||
);
|
||||
content += `<div style="${
|
||||
log("damage_type based on effect: " + effectName);
|
||||
log(data.damage_types[parameters["effect"]]);
|
||||
|
||||
effectsContent += `<div style="${
|
||||
styles.effect
|
||||
}">Effect: <span style="font-weight: normal" title="${
|
||||
data.damage_types[parameters["effect"]].description
|
||||
@@ -736,61 +901,106 @@ var GW3Companion =
|
||||
}
|
||||
|
||||
if (parameters["effect_crit"]) {
|
||||
effectName = "(Critical)";
|
||||
log("effect_crit: " + parameters["effect_crit"]);
|
||||
log("background: " + colorResult.background);
|
||||
log(
|
||||
!empty(data.effects) && data.effects[parameters["effect_crit"]]
|
||||
);
|
||||
if (colorResult.background === "red") {
|
||||
log("RED show save");
|
||||
if (data.effects[parameters["effect_crit"]]) {
|
||||
log("Crit effect according to Ability setting");
|
||||
effectType = "effect_crit";
|
||||
content += `<div style="${
|
||||
effectsContent += `<div style="${
|
||||
styles.effect
|
||||
}">Critical Effect: <span style="font-weight: normal">${
|
||||
data.effects[parameters["effect_crit"]].name
|
||||
}</span></div>`;
|
||||
} else if (data.damage_types[parameters["effect_crit"]]) {
|
||||
log(data.damage_types);
|
||||
log(parameters["effect_crit"]);
|
||||
log(data.damage_types[parameters["effect_crit"]]);
|
||||
content += `<div style="${
|
||||
styles.effect
|
||||
}">Critical Effect: <span style="font-weight: normal" title="${
|
||||
data.damage_types[parameters["effect_crit"]].description
|
||||
}">${
|
||||
data.damage_types[parameters["effect_crit"]].name
|
||||
}</span></div>`;
|
||||
save = data.damage_types[parameters["effect_crit"]].save;
|
||||
}
|
||||
// else if (data.damage_types[parameters["effect_crit"]]) {
|
||||
// log("Crit effect according to Damage Type");
|
||||
// log(data.damage_types);
|
||||
// log(parameters["effect_crit"]);
|
||||
// log(data.damage_types[parameters["effect_crit"]]);
|
||||
// content += `<div style="${
|
||||
// styles.effect
|
||||
// }">Critical Effect: <span style="font-weight: normal" title="${
|
||||
// data.damage_types[parameters["effect_crit"]].description
|
||||
// }">${
|
||||
// data.damage_types[parameters["effect_crit"]].name
|
||||
// }</span></div>`;
|
||||
// save = data.damage_types[parameters["effect_crit"]].save;
|
||||
// content += renderSaveRoll(
|
||||
// save,
|
||||
// targetCharacter,
|
||||
// roll2,
|
||||
// parameters,
|
||||
// effectType,
|
||||
// colorResult,
|
||||
// effectName
|
||||
// );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters["save"]) {
|
||||
save = save || parameters["save"];
|
||||
let saveScore = getAttrByName(targetCharacter.id, `${save}`);
|
||||
let effectsActRow = getActRow(saveScore);
|
||||
let effectsColorResult = getRollColour(roll2, effectsActRow);
|
||||
let effectsResult = { result: effectsColorResult.background };
|
||||
let result = "";
|
||||
log("effectType: " + effectType);
|
||||
log(parameters[effectType]);
|
||||
if (!empty(data.effects) && data.effects[parameters[effectType]]) {
|
||||
effectsResult = getEffectResult(
|
||||
parameters[effectType],
|
||||
effectsColorResult.background
|
||||
);
|
||||
}
|
||||
result = effectsResult.result;
|
||||
let success =
|
||||
parseInt(effectsColorResult.RF) >= parseInt(colorResult.RF);
|
||||
let successMessage = success
|
||||
? `<span style="${styles.success}">success</span>`
|
||||
: `<span style="${styles.fail}">fail</span>`;
|
||||
content += `<div style="font-weight: bold; margin-top: 1rem; border: 1px solid #aaa; padding: 1rem; border-radius: 5px; background-color: ${effectsColorResult.background}; color: ${effectsColorResult.colour};">Save (${effectName}): <span style="font-weight: normal; font-variant:small-caps;">${result} ${successMessage}</span></div>`;
|
||||
if (!empty(save)) {
|
||||
content += renderSaveRoll(
|
||||
save,
|
||||
targetCharacter,
|
||||
roll2,
|
||||
parameters,
|
||||
effectType,
|
||||
colorResult,
|
||||
effectsContent
|
||||
);
|
||||
} else {
|
||||
log('Will not render Save as the "save" parameter was not set.');
|
||||
}
|
||||
send(msg, parameters, title, content);
|
||||
});
|
||||
},
|
||||
renderSaveRoll = (
|
||||
save,
|
||||
targetCharacter,
|
||||
roll2,
|
||||
parameters,
|
||||
effectType,
|
||||
colorResult,
|
||||
effectsContent
|
||||
) => {
|
||||
const data = getData();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
log("START renderSaveRoll");
|
||||
let saveScore = getAttrByName(targetCharacter.id, `${save}`);
|
||||
log("saveScore: " + saveScore);
|
||||
let effectsActRow = getActRow(saveScore);
|
||||
log("effectsActRow");
|
||||
log(effectsActRow);
|
||||
let effectsColorResult = getRollColour(roll2, effectsActRow);
|
||||
let effectsResult = { result: effectsColorResult.background };
|
||||
let result = "";
|
||||
if (!empty(data.effects) && data.effects[parameters[effectType]]) {
|
||||
effectsResult = getEffectResult(
|
||||
parameters[effectType],
|
||||
effectsColorResult.background
|
||||
);
|
||||
}
|
||||
result = effectsResult.result;
|
||||
let success =
|
||||
parseInt(effectsColorResult.RF) >= parseInt(colorResult.RF);
|
||||
let successMessage = success
|
||||
? `<span style="${styles.success}">success</span>`
|
||||
: `<span style="${styles.fail}">fail</span>`;
|
||||
|
||||
log("END renderSaveRoll");
|
||||
let content = `<div style="${styles.border} font-weight: bold; background-color: ${effectsColorResult.background}; color: ${effectsColorResult.colour};">Save vs. ${save}: <span style="font-weight: normal; font-variant:small-caps;">${result} ${successMessage}</span></div>`;
|
||||
if (!success) {
|
||||
content += effectsContent;
|
||||
}
|
||||
return content;
|
||||
},
|
||||
getActRow = (rank) => {
|
||||
log("getActRow");
|
||||
rank = parseInt(rank);
|
||||
@@ -799,27 +1009,27 @@ var GW3Companion =
|
||||
A: [18, 74, 99, null, null, 100],
|
||||
B: [17, 73, 98, 99, null, 100],
|
||||
C: [16, 72, 97, 99, null, 100],
|
||||
"1": [15, 71, 96, 98, 99, 100],
|
||||
"2": [14, 69, 94, 97, 99, 100],
|
||||
"3": [13, 68, 93, 97, 97, 100],
|
||||
"4": [12, 66, 91, 96, 97, 100],
|
||||
"5": [11, 62, 87, 93, 97, 99],
|
||||
"6": [10, 60, 85, 92, 96, 99],
|
||||
"7": [9, 58, 83, 91, 96, 99],
|
||||
"8": [8, 56, 80, 89, 95, 99],
|
||||
"9": [7, 54, 78, 88, 93, 99],
|
||||
"10": [6, 52, 75, 86, 92, 99],
|
||||
"11": [5, 49, 71, 83, 91, 98],
|
||||
"12": [5, 47, 68, 81, 90, 98],
|
||||
"13": [4, 44, 65, 79, 89, 98],
|
||||
"14": [4, 42, 62, 77, 88, 98],
|
||||
"15": [4, 40, 58, 75, 87, 98],
|
||||
"16": [3, 37, 53, 72, 86, 97],
|
||||
"17": [3, 35, 49, 70, 85, 97],
|
||||
"18": [3, 33, 45, 68, 84, 97],
|
||||
"19": [3, 30, 41, 66, 83, 97],
|
||||
"20": [2, 26, 36, 63, 82, 96],
|
||||
"21": [2, 23, 32, 61, 81, 96],
|
||||
1: [15, 71, 96, 98, 99, 100],
|
||||
2: [14, 69, 94, 97, 99, 100],
|
||||
3: [13, 68, 93, 97, 97, 100],
|
||||
4: [12, 66, 91, 96, 97, 100],
|
||||
5: [11, 62, 87, 93, 97, 99],
|
||||
6: [10, 60, 85, 92, 96, 99],
|
||||
7: [9, 58, 83, 91, 96, 99],
|
||||
8: [8, 56, 80, 89, 95, 99],
|
||||
9: [7, 54, 78, 88, 93, 99],
|
||||
10: [6, 52, 75, 86, 92, 99],
|
||||
11: [5, 49, 71, 83, 91, 98],
|
||||
12: [5, 47, 68, 81, 90, 98],
|
||||
13: [4, 44, 65, 79, 89, 98],
|
||||
14: [4, 42, 62, 77, 88, 98],
|
||||
15: [4, 40, 58, 75, 87, 98],
|
||||
16: [3, 37, 53, 72, 86, 97],
|
||||
17: [3, 35, 49, 70, 85, 97],
|
||||
18: [3, 33, 45, 68, 84, 97],
|
||||
19: [3, 30, 41, 66, 83, 97],
|
||||
20: [2, 26, 36, 63, 82, 96],
|
||||
21: [2, 23, 32, 61, 81, 96],
|
||||
X: [2, 20, 27, 59, 80, 96],
|
||||
Y: [2, 17, 22, 56, 78, 95],
|
||||
Z: [2, 13, 16, 51, 76, 94],
|
||||
@@ -973,21 +1183,23 @@ var GW3Companion =
|
||||
}
|
||||
if (category === "attacks" || category === "ammo") {
|
||||
if (category === "attacks") {
|
||||
let character_rank = parseInt(
|
||||
getAttrByName(character.id, "character_rank")
|
||||
);
|
||||
log("character rank:" + character_rank);
|
||||
if (character_rank === NaN) {
|
||||
log(
|
||||
"character rank was not found and thus the attack rank could not be accurately determined and will default to 1"
|
||||
);
|
||||
character_rank = 1;
|
||||
}
|
||||
let obj = Object.assign(objTemplate, {
|
||||
name: `repeating_${category}_${rowId}_rank`,
|
||||
current: character_rank,
|
||||
});
|
||||
createObj("attribute", obj);
|
||||
//@deprecated: Attack ranks are distinct from Character ranks
|
||||
// log("import attack");
|
||||
// let character_rank = parseInt(
|
||||
// getAttrByName(character.id, "character_rank")
|
||||
// );
|
||||
// log("character rank:" + character_rank);
|
||||
// if (_.isNaN(character_rank)) {
|
||||
// log(
|
||||
// "character rank was not found and thus the attack rank could not be accurately determined and will default to 1"
|
||||
// );
|
||||
// character_rank = 1;
|
||||
// }
|
||||
// let obj = Object.assign(objTemplate, {
|
||||
// name: `repeating_${category}_${rowId}_rank`,
|
||||
// current: character_rank,
|
||||
// });
|
||||
// createObj("attribute", obj);
|
||||
}
|
||||
// also add it to gear
|
||||
_.each(itemAttributes, (attributeValue, attributeName) => {
|
||||
@@ -1138,13 +1350,13 @@ var GW3Companion =
|
||||
sendChat(
|
||||
script_name,
|
||||
whisper +
|
||||
'<div style="' +
|
||||
'<div style="'+styles.menuborder+'"><div style="' +
|
||||
styles.menu +
|
||||
styles.overflow +
|
||||
'">' +
|
||||
title +
|
||||
contents +
|
||||
"</div>",
|
||||
"</div></div>",
|
||||
null,
|
||||
{
|
||||
noarchive: true,
|
||||
@@ -1160,13 +1372,13 @@ var GW3Companion =
|
||||
sendChat(
|
||||
`${type}|${id}`,
|
||||
whisper +
|
||||
'<div style="' +
|
||||
'<div style="'+styles.menuborder+'"><div style="' +
|
||||
styles.menu +
|
||||
styles.overflow +
|
||||
'">' +
|
||||
title +
|
||||
contents +
|
||||
"</div>",
|
||||
"</div></div>",
|
||||
null,
|
||||
{
|
||||
noarchive: true,
|
||||
@@ -1261,6 +1473,10 @@ var GW3Companion =
|
||||
}
|
||||
},
|
||||
getData = () => {
|
||||
if (typeof compendium === "undefined") {
|
||||
log("The compendium is not installed");
|
||||
return false;
|
||||
}
|
||||
return compendium;
|
||||
// return {}
|
||||
};
|
||||
|
||||
+114
-47
@@ -29,7 +29,7 @@
|
||||
.col-xs-3
|
||||
label Rank:
|
||||
.col-xs-3
|
||||
input(type="number" name="attr_character_rank" value=1)
|
||||
input(type="number" name="attr_character_rank" title="@{character_rank}" value=1)
|
||||
.col-xs-5
|
||||
.row.middle-xs
|
||||
.col-xs-2
|
||||
@@ -77,6 +77,8 @@
|
||||
option(value=1) I
|
||||
option(value=2) II
|
||||
option(value=3) III
|
||||
option(value=4) IV
|
||||
option(value=5) V
|
||||
.row.top-xs
|
||||
.col-xs-8
|
||||
.row.underline
|
||||
@@ -247,25 +249,37 @@
|
||||
.col-xs-1
|
||||
input(type="number" name="attr_rank")
|
||||
.col-xs-1
|
||||
input(type="number" name="attr_dmg")
|
||||
input(type="text" name="attr_dmg")
|
||||
.col-xs-1
|
||||
input(type="hidden" name="attr_id")
|
||||
input(type="hidden" name="attr_ref")
|
||||
button(type='roll' name='roll_mutation' value='!gw act @{rank} CS|?{CS|0} id|@{ref} title|ref category|mutations save|@{save} effect|@{effect} effect_crit|@{effect_crit} dmg|@{dmg} mod|@{mod} character|@{character_id} target_id|@{target|target1|token_id} ')
|
||||
button(type='roll' name='roll_mutation' value='!gw act @{rank} CS|?{CS|0} id|@{ref} title|ref describe|@{describe} category|mutations save|@{save} effect|@{effect} effect_crit|@{effect_crit} dmg|@{dmg} dmg_type|@{dmg_type} mod|@{modifier} character|@{character_id} target_id|@{target|target1|token_id} ')
|
||||
//- button(type='roll' name='roll_mutation2' value='!gw act @{rank} title|@{name} character|@{character_id} target_id|@{target|token_id}')
|
||||
//- button(type='roll' name='roll_mutation4' value='!gw act @{rank} title|@{name} character|@{character_id} target_id|@{target|target1|token_name}')
|
||||
input.short.options-flag(type="checkbox" name="attr_options-flag" class="options-flag" )
|
||||
span y
|
||||
.options
|
||||
.row.middle-xs
|
||||
.col-xs-1
|
||||
.col-xs-3
|
||||
label Effort
|
||||
.col-xs-3
|
||||
select(name="attr_effort")
|
||||
option(value="passive") Subconscious
|
||||
option(value="active") Conscious
|
||||
.col-xs-3
|
||||
label Targets
|
||||
.col-xs-3
|
||||
input(type="text" name="attr_number")
|
||||
|
||||
.row.middle-xs
|
||||
.col-xs-2
|
||||
label Mod.
|
||||
.col-xs-1
|
||||
input(type="hidden" name="attr_save")
|
||||
.col-xs-2
|
||||
//- input(type="hidden" name="attr_save")
|
||||
input(type="hidden" name="attr_effect")
|
||||
input(type="hidden" name="attr_effect_crit")
|
||||
input(type="hidden" name="attr_dmg_type")
|
||||
select(name="attr_mod")
|
||||
select(name="attr_modifier")
|
||||
option(value="PS") PS
|
||||
option(value="DX") DX
|
||||
option(value="CN") CN
|
||||
@@ -273,15 +287,16 @@
|
||||
option(value="MS") MS
|
||||
option(value="CH") CH
|
||||
.col-xs-2
|
||||
label Effort
|
||||
label Save
|
||||
.col-xs-2
|
||||
select(name="attr_effort")
|
||||
option(value="passive") Subconscious
|
||||
option(value="active") Conscious
|
||||
.col-xs-1
|
||||
label No.
|
||||
.col-xs-1
|
||||
input(type="text" name="attr_number")
|
||||
select(name="attr_save")
|
||||
option(value="PS") PS
|
||||
option(value="DX") DX
|
||||
option(value="CN") CN
|
||||
option(value="IN") IN
|
||||
option(value="MS") MS
|
||||
option(value="CH") CH
|
||||
|
||||
.col-xs-2
|
||||
label Duration
|
||||
.col-xs-2
|
||||
@@ -290,26 +305,28 @@
|
||||
label Description
|
||||
.col-xs-12
|
||||
textarea(name="attr_description")
|
||||
.col-xs-12 Show description on roll
|
||||
input.short(type="checkbox" name="attr_describe" class="check-flag" )
|
||||
.row.underline
|
||||
.col-xs-12
|
||||
h2 Attacks
|
||||
.row.middle-xs
|
||||
.col-xs-3
|
||||
.col-xs-5
|
||||
label Name
|
||||
.col-xs-1
|
||||
.col-xs-2
|
||||
label Mod.
|
||||
.col-xs-1
|
||||
label Range
|
||||
.col-xs-1
|
||||
label Dmg.
|
||||
.col-xs-2
|
||||
label Rank
|
||||
.col-xs-1
|
||||
label Skill
|
||||
fieldset.repeating_attacks
|
||||
.row
|
||||
.col-xs-3
|
||||
.col-xs-5
|
||||
input(type="text" name="attr_name")
|
||||
.col-xs-1
|
||||
select(name="attr_mod")
|
||||
.col-xs-2
|
||||
select(name="attr_modifier")
|
||||
option(value="PS") PS
|
||||
option(value="DX") DX
|
||||
option(value="CN") CN
|
||||
@@ -324,8 +341,8 @@
|
||||
input(type="hidden" name="attr_ref")
|
||||
input(type="text" name="attr_rank")
|
||||
.col-xs-1
|
||||
button(type='roll' name='roll_attack' value='!gw act @{rank} CS|?{CS|0} id|@{ref} title|ref category|attacks effect|@{effect} effect_crit|@{effect_crit} dmg|@{dmg} mod|@{mod} skill|@{skill} tech|@{tech} type|@{type} character|@{character_id} target_id|@{target|target1|token_id}')
|
||||
//- button(type='roll' name='roll_attack' value='!gw act @{rank} CS|?{CS|0} title|@{name} mod|@{mod} tech|@{tech} type|@{type} effect|@{effect} character|@{character_id}')
|
||||
button(type='roll' name='roll_attack' value='!gw act @{rank} CS|?{CS|0} id|@{ref} title|ref category|attacks effect|@{effect} effect_crit|@{effect_crit} dmg|@{dmg} skilldmg|@{skilldmg} mod|@{modifier} skill|@{skill} tech|@{tech} type|@{type} character|@{character_id} target_id|@{target|target1|token_id}')
|
||||
//- button(type='roll' name='roll_attack' value='!gw act @{rank} CS|?{CS|0} title|@{name} mod|@{modifier} tech|@{tech} type|@{type} effect|@{effect} character|@{character_id}')
|
||||
input.short.options-flag(type="checkbox" name="attr_options-flag" class="options-flag" )
|
||||
span y
|
||||
.options
|
||||
@@ -438,10 +455,29 @@
|
||||
.row.middle-xs
|
||||
.col-xs-2 Tech Lvl.
|
||||
.col-xs-2
|
||||
select(name="attr_tech")
|
||||
option(value=1) I
|
||||
option(value=2) II
|
||||
option(value=3) III
|
||||
option(value=4) IV
|
||||
option(value=5) V
|
||||
input(type="number" name="attr_tech")
|
||||
.col-xs-2 Tech Rank
|
||||
.col-xs-2
|
||||
input(type="text" name="attr_tech_rank")
|
||||
select(name="attr_tech_rank")
|
||||
option(value="N") N
|
||||
option(value="A") A
|
||||
option(value="B") B
|
||||
option(value="C") C
|
||||
option(value="D") D
|
||||
option(value="E") E
|
||||
option(value="F") F
|
||||
option(value="G") G
|
||||
option(value="H") H
|
||||
option(value="I") I
|
||||
option(value="J") J
|
||||
.col-xs-12 Add attack rank to damage
|
||||
input.short(type="checkbox" name="attr_skilldmg" class="check-flag" )
|
||||
.col-xs-12 Notes
|
||||
.col-xs-12
|
||||
textarea(name="attr_notes")
|
||||
@@ -671,7 +707,7 @@
|
||||
option(value=5) V
|
||||
.col-xs-1
|
||||
select(name="attr_tech_rank")
|
||||
option(value="N") A
|
||||
option(value="N") N
|
||||
option(value="A") A
|
||||
option(value="B") B
|
||||
option(value="C") C
|
||||
@@ -794,7 +830,7 @@
|
||||
.row
|
||||
.col-xs-5
|
||||
label Name
|
||||
.col-xs-3
|
||||
.col-xs-2
|
||||
label Rank
|
||||
.col-xs-3
|
||||
label Mod.
|
||||
@@ -802,10 +838,10 @@
|
||||
.row
|
||||
.col-xs-5
|
||||
input(type="text" name="attr_name")
|
||||
.col-xs-3
|
||||
.col-xs-2
|
||||
input(type="number" name="attr_rank")
|
||||
.col-xs-3
|
||||
select(name="attr_mod")
|
||||
select(name="attr_modifier")
|
||||
option(value="PS") PS
|
||||
option(value="DX") DX
|
||||
option(value="CN") CN
|
||||
@@ -813,7 +849,14 @@
|
||||
option(value="MS") MS
|
||||
option(value="CH") CH
|
||||
.col-xs-1
|
||||
button(type='roll' name='roll_skill' value='!gw act @{rank} title|@{name} mod|@{mod} character|@{character_id}')
|
||||
button(type='roll' name='roll_skill' value='!gw act @{rank} title|@{name} mod|@{modifier} character|@{character_id}')
|
||||
input.short.options-flag(type="checkbox" name="attr_options-flag" class="options-flag" )
|
||||
span y
|
||||
.options
|
||||
.row
|
||||
.col-xs-12 Description
|
||||
.col-xs-12
|
||||
textarea(name="attr_description")
|
||||
.row.underline
|
||||
.col-xs-12
|
||||
h2 Talents
|
||||
@@ -823,6 +866,7 @@
|
||||
fieldset.repeating_talents
|
||||
.row
|
||||
.col-xs-8
|
||||
input(type="hidden" name="attr_ref")
|
||||
input(type="text" name="attr_name")
|
||||
.col-xs-2
|
||||
button(type='roll' name='roll_talent' value='!gw act @{character_rank} title|@{name} character|@{character_id}')
|
||||
@@ -830,15 +874,18 @@
|
||||
span y
|
||||
.options
|
||||
.row
|
||||
.col-xs-3 Affects:
|
||||
.col-xs-3
|
||||
input(type="text" name="attr_affects")
|
||||
.col-xs-3 Act Factor:
|
||||
.col-xs-3
|
||||
input(type="text" name="attr_act_factor")
|
||||
.col-xs-12 Notes
|
||||
//- .col-xs-3 Affects:
|
||||
//- .col-xs-3
|
||||
//- input(type="text" name="attr_affects")
|
||||
//- .col-xs-3 Act Factor:
|
||||
//- .col-xs-3
|
||||
//- input(type="text" name="attr_act_factor")
|
||||
.col-xs-12 Description
|
||||
.col-xs-12
|
||||
textarea(name="attr_notes")
|
||||
textarea(name="attr_description")
|
||||
//- .col-xs-12 Notes
|
||||
//- .col-xs-12
|
||||
//- textarea(name="attr_notes")
|
||||
.row.underline
|
||||
.col-xs-12
|
||||
h2 Coins
|
||||
@@ -1160,7 +1207,7 @@
|
||||
.col-xs-1
|
||||
input(type="number" name="attr_rank")
|
||||
.col-xs-1
|
||||
input(type="number" name="attr_dmg")
|
||||
input(type="text" name="attr_dmg")
|
||||
.col-xs-1
|
||||
input(type="hidden" name="attr_id")
|
||||
button(type='roll' name='roll_mutation' value='!gw act @{rank} title|@{name} character|@{character_id}')
|
||||
@@ -1171,7 +1218,7 @@
|
||||
.col-xs-2
|
||||
label Mod.
|
||||
.col-xs-2
|
||||
select(name="attr_mod")
|
||||
select(name="attr_modifier")
|
||||
option(value="PS") PS
|
||||
option(value="DX") DX
|
||||
option(value="CN") CN
|
||||
@@ -1208,13 +1255,13 @@
|
||||
.col-xs-1
|
||||
label Dmg.
|
||||
.col-xs-2
|
||||
label Rank
|
||||
label Skill
|
||||
fieldset.repeating_attacks
|
||||
.row
|
||||
.col-xs-3
|
||||
input(type="text" name="attr_name")
|
||||
.col-xs-1
|
||||
select(name="attr_mod")
|
||||
select(name="attr_modifier")
|
||||
option(value="PS") PS
|
||||
option(value="DX") DX
|
||||
option(value="CN") CN
|
||||
@@ -1226,9 +1273,11 @@
|
||||
.col-xs-1
|
||||
input(type="text" name="attr_dmg")
|
||||
.col-xs-1
|
||||
input(type="hidden" name="attr_ref")
|
||||
input(type="text" name="attr_rank")
|
||||
.col-xs-1
|
||||
button(type='roll' name='roll_attack' value='!gw act @{rank} CS|?{CS|0} title|@{name} mod|@{mod} tech| type|@{type} effect|@{effect} character|@{character_id}')
|
||||
button(type='roll' name='roll_attack' value='!gw act @{rank} CS|?{CS|0} id|@{ref} title|ref category|attacks effect|@{effect} effect_crit|@{effect_crit} dmg|@{dmg} skilldmg|@{skilldmg} mod|@{modifier} skill|@{skill} tech|@{tech} type|@{type} character|@{character_id} target_id|@{target|target1|token_id}')
|
||||
|
||||
input.short.options-flag(type="checkbox" name="attr_options-flag" class="options-flag" )
|
||||
span y
|
||||
.options
|
||||
@@ -1341,10 +1390,28 @@
|
||||
.row.middle-xs
|
||||
.col-xs-2 Tech Lvl.
|
||||
.col-xs-2
|
||||
input(type="number" name="attr_tech")
|
||||
select(name="attr_tech")
|
||||
option(value=1) I
|
||||
option(value=2) II
|
||||
option(value=3) III
|
||||
option(value=4) IV
|
||||
option(value=5) V
|
||||
.col-xs-2 Tech Rank
|
||||
.col-xs-2
|
||||
input(type="text" name="attr_tech_rank")
|
||||
select(name="attr_tech_rank")
|
||||
option(value="N") N
|
||||
option(value="A") A
|
||||
option(value="B") B
|
||||
option(value="C") C
|
||||
option(value="D") D
|
||||
option(value="E") E
|
||||
option(value="F") F
|
||||
option(value="G") G
|
||||
option(value="H") H
|
||||
option(value="I") I
|
||||
option(value="J") J
|
||||
.col-xs-12 Add attack rank to damage
|
||||
input.short(type="checkbox" name="attr_skilldmg" class="check-flag" )
|
||||
.col-xs-12 Notes
|
||||
.col-xs-12
|
||||
textarea(name="attr_notes")
|
||||
@@ -1434,5 +1501,5 @@ input(type="hidden" name="attr_RF_energy" title="@RF_energy" value="0")
|
||||
script(type="text/worker")
|
||||
|
|
||||
|
|
||||
include dice3.js
|
||||
include sheetworkers.js
|
||||
include src/dice3.js
|
||||
include src/sheetworkers.js
|
||||
Reference in New Issue
Block a user