Skip to content

Commit

Permalink
v13.1.12 - if DM approves companions
Browse files Browse the repository at this point in the history
• Added optional suffix for linking CreatureList objects to CompanionList objects. Now you can add “_not_al” (e.g. “mount_not_al) for the creature to only be listed in the menu when the sheet is not in Adventurers League mode (DCI field visible) and when listed, the text “(if DM approves)” is added.
• Improved tables on the Notes page for magic items that use real-life playing cards, like the Deck of Many Things.
• Changed Improved Divine Smite to now add “in melee” to the description of a thrown weapon, so it reads “+1d8 Radiant damage in melee” (MBUG-126).
• Improved the highlight colour options by making them lighter. Text should now be easier to read when the field highlight colour is set to one of the colourful options. Note that this won’t change the colour when you import an old sheet, for that you’ll have to select the colour anew from the menu.
• Fix “Black Tentacles” short description.
• Fix “Improved Pact Weapon” and similar features not applying to magic weapons that use the `chooseGear` attribute (MBUG-125).
• Fix error due to incorrect documentation “_common spell list object.js”, the `class` attribute worked only with “any” not “all”. The function has now been changed to work with both “any” and “all” for backwards compatibility.
• Fix bug with magic ammunition with a pop-up for selecting the type (`chooseGear` attribute) not appearing on the 1st page and throwing an error when being added/removed.
  • Loading branch information
morepurplemorebetter committed Dec 30, 2023
1 parent f7fd669 commit b7bda5a
Show file tree
Hide file tree
Showing 14 changed files with 261 additions and 197 deletions.
22 changes: 11 additions & 11 deletions _functions/Functions1.js
Original file line number Diff line number Diff line change
Expand Up @@ -3172,7 +3172,7 @@ function ParseGear(input) {
};

//see if it is an ammunition weapon
var findAmmo = ParseAmmo(tempString, true);
var findAmmo = ParseAmmo(tempString, true, true);
if (findAmmo) {
testLen = Math.min(findAmmo[1], tempStrLen);
if (testLen > foundLen) {
Expand Down Expand Up @@ -7397,7 +7397,7 @@ function SetEncumbrance(variant) {
};

//see if a known ammunition is in a string, and return the ammo name
function ParseAmmo(input, onlyInv) {
function ParseAmmo(input, onlyInv, bReturnLength) {
var found = "";
if (!input) return found;

Expand Down Expand Up @@ -7445,7 +7445,7 @@ function ParseAmmo(input, onlyInv) {
keyLen = foundLen;
foundDat = tempDate;
}
return onlyInv && found ? [found, keyLen] : found;
return bReturnLength && found ? [found, keyLen] : found;
}

//Reset the visibility of all the ammo fields of a particular side (input = "Left" or "Right")
Expand Down Expand Up @@ -7944,8 +7944,8 @@ function ApplyColorScheme(aColour) {

// Set the highlighting color if it has been coupled to the headers
if (Who("Highlighting") === "headers") {
app.runtimeHighlightColor = LightColorList[colour];
tDoc.getField("Highlighting").fillColor = LightColorList[colour];
app.runtimeHighlightColor = HighlightColorList[colour];
tDoc.getField("Highlighting").fillColor = HighlightColorList[colour];
}
// See if any of the Ability Save DC's or the HP Dragons have the color connected to this
if (What("Color.DC").indexOf("headers") != -1) ApplyDCColorScheme();
Expand Down Expand Up @@ -8096,8 +8096,8 @@ function ApplyDragonColorScheme(aColour) {

// Set the highlighting color if it has been coupled to the dragon heads color
if (Who("Highlighting") === "dragons") {
app.runtimeHighlightColor = LightColorList[colour];
tDoc.getField("Highlighting").fillColor = LightColorList[colour];
app.runtimeHighlightColor = HighlightColorList[colour];
tDoc.getField("Highlighting").fillColor = HighlightColorList[colour];
}
// See if any of the Ability Save DC's or the HP Dragons have the color connected to this
if (What("Color.DC").indexOf("dragons") != -1) ApplyDCColorScheme();
Expand Down Expand Up @@ -8297,14 +8297,14 @@ function ColoryOptions(input) {
var theColour = ["RGB", 0.9, 0.9, 1];
break;
case "headers" :
var theColour = LightColorList[What("Color.Theme")];
var theColour = HighlightColorList[What("Color.Theme")];
break;
case "dragons" :
var theColour = LightColorList[What("Color.DragonHeads")];
var theColour = HighlightColorList[What("Color.DragonHeads")];
break;
default :
if (!LightColorList[MenuSelection[2]]) return;
var theColour = LightColorList[MenuSelection[2]];
if (!HighlightColorList[MenuSelection[2]]) return;
var theColour = HighlightColorList[MenuSelection[2]];
break;
};
app.runtimeHighlight = highlightsOn;
Expand Down
14 changes: 12 additions & 2 deletions _functions/Functions2.js
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ function MakeCompMenu_CompOptions(prefix, MenuSelection, force) {
// Menu options for creating special companions
// First get a list of all the companion options that should be available
var oCompanions = {};
var bIsAL = !isDisplay("DCI.Text");
for (var sComp in CompanionList) {
if (testSource(sComp, CompanionList[sComp], "compExcl")) continue;
oCompanions[sComp] = [];
Expand All @@ -702,13 +703,17 @@ function MakeCompMenu_CompOptions(prefix, MenuSelection, force) {
if (!isArray(oCrea.companion)) oCrea.companion = [oCrea.companion];
for (var i = 0; i < oCrea.companion.length; i++) {
if (oCompanions[oCrea.companion[i]]) objToAdd[oCrea.companion[i]] = "";
if (!bIsAL && oCrea.companion[i].substr(-7) === "_not_al") {
var notAlComp = oCrea.companion[i].replace("_not_al", "");
if (oCompanions[notAlComp]) objToAdd[notAlComp] = " (if DM approves)";
}
}
}
// Now test for each companion type with the includeCheck attribute if this creature should be added
for (var sComp in oCompanions) {
if (CompanionList[sComp].includeCheck && typeof CompanionList[sComp].includeCheck === "function") {
try {
var returnStr = CompanionList[sComp].includeCheck(sCrea, oCrea, iCreaCR);
var returnStr = CompanionList[sComp].includeCheck(sCrea, oCrea, iCreaCR, bIsAL);
if (returnStr !== false && returnStr !== undefined) {
objToAdd[sComp] = typeof returnStr === "string" ? returnStr : "";
}
Expand Down Expand Up @@ -7311,6 +7316,7 @@ function SetProf(ProfType, AddRemove, ProfObj, ProfSrc, Extra) {
//Process the input. //for the simple text strings, immediately add/remove it
for (var attr in ProfObj) {
var setT = set[attr];
if (!setT) continue;
var addT = ProfObj[attr];
for (var i = 0; i < addT.length; i++) {
var iAdd = addT[i];
Expand Down Expand Up @@ -7882,7 +7888,8 @@ function getHighestTotal(nmbrObj, notRound, replaceWalk, extraMods, prefix, with

// open a dialog with a number of lines of choices and return the choices in an array; if knownOpt === "radio", show radio buttons instead, and return the entry selected
// if notProficiencies is set to true, the optType will serve as the dialog header, and optSrc will serve as the multiline explanatory text
function AskUserOptions(optType, optSrc, optSubj, knownOpt, notProficiencies, sBottomMsg) {
// bReturnIndex only does something if knownOpt === "radio"; it will return the index of the selection from the input optSubj array
function AskUserOptions(optType, optSrc, optSubj, knownOpt, notProficiencies, sBottomMsg, bReturnIndex) {
if (!IsNotImport) return optSubj;
//first make the entry lines
var selectionLines = [];
Expand Down Expand Up @@ -8104,6 +8111,9 @@ function AskUserOptions(optType, optSrc, optSubj, knownOpt, notProficiencies, sB
theDialog["sl" + ("0" + i).slice(-2)] = Function("dialog", "this.check(dialog, " + i + ");");
}; };
app.execDialog(theDialog)
if (bReturnIndex && knownOpt === "radio" && typeof theDialog.choices == 'string') {
return optSubj.indexOf(theDialog.choices);
}
return theDialog.choices;
};

Expand Down
8 changes: 4 additions & 4 deletions _functions/Functions3.js
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ function processAddWeapons(AddRemove, weapons) {
// set ammuntion or remove the ammuntion
function processAddAmmo(AddRemove, ammos) {
if (!ammos) return;
if (!isArray(ammos) || (ammos.length === 2 && isNaN(ammos[1]))) {
if (!isArray(ammos) || (ammos.length === 2 && !isNaN(ammos[1]))) {
ammos = [ammos];
}
for (var a = 0; a < ammos.length; a++) {
Expand Down Expand Up @@ -3653,13 +3653,13 @@ function selectMagicItemGearType(AddRemove, FldNmbr, typeObj, oldChoice, correct
if (!correctingDescrLong) {
switch (typeNm) {
case "ammunition":
processAddAmmo(AddRemove, [itemToProcess ? itemToProcess : newMIname.replace(/ammunition (\+\d)/i, "$1").replace(/(\+\d) *\((.*?)\)/i, "$1 $2"), typeObj.ammoAmount && !isNaN(typeObj.ammoAmount) ? typeObj.ammoAmount : 1]);
processAddAmmo(AddRemove, [[itemToProcess ? itemToProcess : newMIname.replace(/ammunition (\+\d+)/i, "$1").replace(/(\+\d+) *\((.*?)\)/i, "$1 $2"), typeObj.ammoAmount && !isNaN(typeObj.ammoAmount) ? typeObj.ammoAmount : 1]]);
break;
case "weapon":
processAddWeapons(AddRemove, itemToProcess ? itemToProcess : newMIname.replace(/weapon (\+\d)/i, "$1").replace(/(\+\d) *\((.*?)\)/i, "$1 $2"));
processAddWeapons(AddRemove, itemToProcess ? itemToProcess : newMIname.replace(/weapon (\+\d+)/i, "$1").replace(/(\+\d+) *\((.*?)\)/i, "$1 $2"));
break;
case "armor":
processAddArmour(AddRemove, itemToProcess ? itemToProcess : newMIname.replace(/armou?r (\+\d)/i, "$1").replace(/(\+\d) *\((.*?)\)/i, "$1 $2"));
processAddArmour(AddRemove, itemToProcess ? itemToProcess : newMIname.replace(/armou?r (\+\d+)/i, "$1").replace(/(\+\d+) *\((.*?)\)/i, "$1 $2"));
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions _functions/FunctionsSpells.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,10 +1049,10 @@ function CreateSpellList(inputObject, toDisplay, extraArray, returnOrdered, objN
continue;
} else if (isArray(inputObject.class)) {
addSp = inputObject.class.some(function (v) {
return v === "any" || aSpell.classes.indexOf(v) !== -1;
return v === "any" || v === "all" || aSpell.classes.indexOf(v) !== -1;
});
} else {
addSp = inputObject.class === "any" || aSpell.classes.indexOf(inputObject.class) !== -1;
addSp = inputObject.class === "any" || inputObject.class === "all" || aSpell.classes.indexOf(inputObject.class) !== -1;
}
}
if (addSp && inputObject.level) {
Expand Down
46 changes: 30 additions & 16 deletions _variables/Lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,33 +1138,47 @@ var ColorList = {
} //for gradients, add 15% brightness as BHS color

var DarkColorList = {
aqua : ["CMYK", 0.85, 0.5, 0.01, 0.5], //144671
blue : ["CMYK", 0.75, 0.13, 0.09, 0.5], //066882
brown : ["CMYK", 0.38, 0.53, 0.51, 0.9], //291d16
gray : ["CMYK", 0.7, 0.6, 0.56, 0.67], //303131
green : ["CMYK", 0.9, 0.33, 0.96, 0.77], //003012
aqua : ["CMYK", 0.85, 0.5, 0.01, 0.5], //144671
blue : ["CMYK", 0.75, 0.13, 0.09, 0.5], //066882
brown : ["CMYK", 0.38, 0.53, 0.51, 0.9], //291d16
gray : ["CMYK", 0.7, 0.6, 0.56, 0.67], //303131
green : ["CMYK", 0.9, 0.33, 0.96, 0.77], //003012
orange : ["CMYK", 0, 0.8, 1, 0.5], //8d3200
pink : ["CMYK", 0, 0.9, 0.15, 0.5], //8e204c
pink : ["CMYK", 0, 0.9, 0.15, 0.5], //8e204c
purple : ["CMYK", 0.76, 1, 0.03, 0.5], //401150
red : ["CMYK", 0.18, 1, 0.91, 0.58], //6e110b
teal : ["CMYK", 0.79, 0.12, 0.45, 0.5], //00645f
red : ["CMYK", 0.18, 1, 0.91, 0.58], //6e110b
teal : ["CMYK", 0.79, 0.12, 0.45, 0.5], //00645f
yellow : ["CMYK", 0, 0.5, 1, 0.5] //935b00
} // +50% black

var LightColorList = {
aqua : ["CMYK", 0.68, 0.29, 0, 0], //4e9ad9
blue : ["CMYK", 0.7, 0.06, 0.11, 0], //2bb3d9
brown : ["CMYK", 0.29, 0.39, 0.38, 0.14], //ad9189
gray : ["CMYK", 0.33, 0.25, 0.26, 0.04], //b3b3b3
green : ["CMYK", 0.8, 0.13, 0.78, 0], //219a5e
aqua : ["CMYK", 0.68, 0.29, 0, 0], //4e9ad9
blue : ["CMYK", 0.7, 0.06, 0.11, 0], //2bb3d9
brown : ["CMYK", 0.29, 0.39, 0.38, 0.14], //ad9189
gray : ["CMYK", 0.33, 0.25, 0.26, 0.04], //b3b3b3
green : ["CMYK", 0.8, 0.13, 0.78, 0], //219a5e
orange : ["CMYK", 0, 0.62, 0.7, 0], //f77d4d
pink : ["CMYK", 0, 0.69, 0.01, 0], //f772a9
pink : ["CMYK", 0, 0.69, 0.01, 0], //f772a9
purple : ["CMYK", 0.58, 0.78, 0.01, 0], //844e99
red : ["CMYK", 0.1, 0.79, 0.55, 0], //db535c
teal : ["CMYK", 0.7, 0, 0.35, 0], //26bdb8
red : ["CMYK", 0.1, 0.79, 0.55, 0], //db535c
teal : ["CMYK", 0.7, 0, 0.35, 0], //26bdb8
yellow : ["CMYK", 0, 0.38, 0.82, 0] //f8ad3c
}

var HighlightColorList = { // = LightColorList with Luminosity at 85%
aqua : ['RGB', 0.75, 0.86, 0.95], //c0dbf2
blue : ['RGB', 0.75, 0.91, 0.96], //bee8f4
brown : ['RGB', 0.88, 0.84, 0.82], //e0d5d2
gray : ['RGB', 0.85, 0.85, 0.85], //d9d9d9
green : ['RGB', 0.75, 0.95, 0.85], //c0f2d9
orange : ['RGB', 0.99, 0.79, 0.71], //fccab6
pink : ['RGB', 0.98, 0.72, 0.83], //fbb7d3
purple : ['RGB', 0.87, 0.80, 0.90], //decde5
red : ['RGB', 0.95, 0.75, 0.76], //f2c0c3
teal : ['RGB', 0.75, 0.95, 0.95], //bff2f1
yellow : ['RGB', 0.99, 0.88, 0.71] //fce0b5
}

//The dialog for setting the unit system and decimal
var SetUnitDecimals_Dialog = {
//variables to be set by the calling function
Expand Down
2 changes: 1 addition & 1 deletion _variables/ListsClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ var Base_ClassList = {
calcChanges : {
atkAdd : [
function (fields, v) {
if (v.isMeleeWeapon) fields.Description += (fields.Description ? '; ' : '') + '+1d8 Radiant damage';
if (v.isMeleeWeapon) fields.Description += (fields.Description ? '; ' : '') + '+1d8 Radiant damage' + (v.isThrownWeapon ? ' in melee' : '');
},
"With my melee weapon attacks I deal an extra 1d8 radiant damage."
]
Expand Down
8 changes: 2 additions & 6 deletions _variables/ListsCompanions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ var Base_CompanionList = {
nameOrigin : "1st-level conjuration [ritual] spell",
nameMenu : "Familiar (Find Familiar spell)", // required
source : [["SRD", 143], ["P", 240]], // required
includeCheck : function(sCrea, objCrea, iCreaCR) {
// return true if to be included, or a string to add a note to the menu option
return !!isDisplay("DCI.Text") && objCrea.companion && objCrea.companion.indexOf("familiar_not_al") !== -1 ? " (if DM approves)" : false;
},
action : [
["action", "Familiar (dismiss/reappear)"],
["action", "Use familiar's senses"]
Expand Down Expand Up @@ -82,9 +78,9 @@ var Base_CompanionList = {
nameOrigin : "variant of the Find Familiar 1st-level conjuration [ritual] spell",
nameMenu : "Pact of the Chain familiar (Warlock feature)",
source : [["SRD", 47], ["P", 107]],
includeCheck : function(sCrea, objCrea, iCreaCR) {
includeCheck : function(sCrea, objCrea, iCreaCR, bIsAL) {
// return true if to be included, or a string to add a note to the menu option
return !objCrea.companion ? false : objCrea.companion.indexOf("familiar") !== -1 ? true : !!isDisplay("DCI.Text") && objCrea.companion.indexOf("familiar_not_al") !== -1 ? " (if DM approves)" : false;
return !objCrea.companion ? false : objCrea.companion.indexOf("familiar") !== -1 ? true : bIsAL && objCrea.companion.indexOf("familiar_not_al") !== -1 ? " (if DM approves)" : false;
},
action : [
["action", "Familiar (dismiss/reappear)"],
Expand Down
15 changes: 9 additions & 6 deletions _variables/ListsCreatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ var Base_CreatureList = {
damage_resistances : "cold; bludgeoning, piercing, and slashing from nonmagical attacks that aren't silver weapons",
damage_immunities : "fire, poison",
condition_immunities : "poisoned",
senses : "Darkvision 120 ft; Devil's Sight (Magical darkness doesn't impede the imp's Darkvision)",
senses : "Darkvision 120 ft; Devil's Sight (Magical darkness doesn't impede the imp's darkvision)",
passivePerception : 11,
languages : "Infernal, Common",
challengeRating : "1",
Expand Down Expand Up @@ -744,7 +744,6 @@ var Base_CreatureList = {
ability : 2,
damage : [1, "", "piercing"],
range : "40/160 ft",
description : "",
abilitytodamage : false,
description : "DC 10 Con save or poisoned 1 min; fail by 5 or more: also unconscious 1 min, until damaged or awakened",
tooltip : "The target hit must succeed on a DC 10 Constitution saving throw or become poisoned for 1 minute. If its saving throw result is 5 or lower, the poisoned target falls unconscious for the same duration, or until it takes damage or another creature takes an action to shake it awake."
Expand Down Expand Up @@ -1079,14 +1078,18 @@ var Base_CreatureList = {
ability : 2,
damage : [1, 8, "piercing"],
range : "150/600 ft",
description : "Ammunition, heavy, two-handed)"
description : "Ammunition, heavy, two-handed"
}],
traits : [{
name : "Sunlight Sensitivity",
description : "While in sunlight, the wight has disadvantage on attack rolls, as well as on Wisdom (Perception) checks that rely on sight."
}, {
name : "Life Drain",
description : "A target of the wight's life drain attack must succeed on a DC 13 Constitution saving throw or its hit point maximum is reduced by an amount equal to the damage taken. This reduction lasts until the target finishes a long rest. The target dies if this effect reduces its hit point maximum to 0.\n A humanoid slain by this attack rises 24 hours later as a zombie under the wight's control, unless the humanoid is restored to life or its body is destroyed. The wight can have no more than twelve zombies under its control at one time."
}],
actions : [{
name : "Multiattack",
description : "The wight makes two longsword attacks or two longbow attacks. It can use its Life Drain in place of one longsword attack."
}]
},
"zombie" : {
Expand Down Expand Up @@ -1615,7 +1618,7 @@ var Base_CreatureList = {
damage : [2, 10, "bludgeoning"],
modifiers : [-1, ""],
range : "Melee (5 ft)",
description : "DC 15 Con save or HP max reduced; Two Slam attacks as an Attack action; Counts as magical",
description : "DC 15 Con save or HP max reduced; Two slam attacks as an Attack action; Counts as magical",
abilitytodamage : true,
tooltip : "If the target is a creature, it must succeed on a DC 15 Constitution saving throw or have its hit point maximum reduced by an amount equal to the damage taken. The target dies if this attack reduces its hit point maximum to 0. The reduction lasts until removed by the greater restoration spell or other magic."
}, {
Expand Down Expand Up @@ -1677,7 +1680,7 @@ var Base_CreatureList = {
ability : 1,
damage : [2, 8, "bludgeoning"],
range : "Melee (5 ft)",
description : "Two Slam attacks as an Attack action; Counts as magical",
description : "Two slam attacks as an Attack action; Counts as magical",
abilitytodamage : true
}],
traits : [{
Expand Down Expand Up @@ -1790,7 +1793,7 @@ var Base_CreatureList = {
ability : 1,
damage : [3, 8, "bludgeoning"],
range : "Melee (5 ft)",
description : "Two Slam attacks as an Attack action; Counts as magical"
description : "Two slam attacks as an Attack action; Counts as magical"
}, {
name : "Slow (Recharge 5-6)",
ability : 3,
Expand Down
Loading

0 comments on commit b7bda5a

Please sign in to comment.