Update Core to 1.4.1

Update Core to 1.4.1 and internal Version to 1.4.1.R1-A8
This commit is contained in:
supervj 2021-08-06 16:38:15 -04:00
parent f16383841b
commit 5bb253d9c3
56 changed files with 5440 additions and 3827 deletions

View file

@ -751,7 +751,7 @@ export default class Item5e extends Item {
}
// Verify that a consumed resource is available
if (!resource) {
if (resource === undefined) {
ui.notifications.warn(game.i18n.format("SW5E.ConsumeWarningNoSource", {name: this.name, type: typeLabel}));
return false;
}
@ -796,7 +796,7 @@ export default class Item5e extends Item {
// Render the chat card template
const token = this.actor.token;
const templateData = {
actor: this.actor,
actor: this.actor.data,
tokenId: token?.uuid || null,
item: this.data,
data: this.getChatData(),
@ -1025,24 +1025,22 @@ export default class Item5e extends Item {
}
// Compose roll options
const rollConfig = mergeObject(
{
parts: parts,
actor: this.actor,
data: rollData,
title: title,
flavor: title,
speaker: ChatMessage.getSpeaker({actor: this.actor}),
dialogOptions: {
width: 400,
top: options.event ? options.event.clientY - 80 : null,
left: window.innerWidth - 710
},
messageData: {"flags.sw5e.roll": {type: "attack", itemId: this.id}}
let rollConfig = {
parts: parts,
actor: this.actor,
data: rollData,
title: title,
flavor: title,
dialogOptions: {
width: 400,
top: options.event ? options.event.clientY - 80 : null,
left: window.innerWidth - 710
},
options
);
rollConfig.event = options.event;
messageData: {
"flags.sw5e.roll": {type: "attack", itemId: this.id},
"speaker": ChatMessage.getSpeaker({actor: this.actor})
}
};
// Expanded critical hit thresholds
if (this.data.type === "weapon" && flags.weaponCriticalThreshold) {
@ -1059,6 +1057,9 @@ export default class Item5e extends Item {
// Apply Halfling Lucky
if (flags.halflingLucky) rollConfig.halflingLucky = true;
// Compose calculated roll options with passed-in roll options
rollConfig = mergeObject(rollConfig, options);
// Invoke the d20 roll helper
const roll = await d20Roll(rollConfig);
if (!roll) return null;
@ -1121,8 +1122,10 @@ export default class Item5e extends Item {
// Scale damage from up-casting powers
if (this.data.type === "power") {
if (itemData.scaling.mode === "atwill") {
const level =
this.actor.data.type === "character" ? actorData.details.level : actorData.details.powerLevel;
let level;
if (this.actor.type === "character") level = actorData.details.level;
else if (itemData.preparation.mode === "innate") level = Math.ceil(actorData.details.cr);
else level = actorData.details.powerLevel;
this._scaleAtWillDamage(parts, itemData.scaling.formula, level, rollData);
} else if (powerLevel && itemData.scaling.mode === "level" && itemData.scaling.formula) {
const scaling = itemData.scaling.formula;
@ -1651,7 +1654,7 @@ export default class Item5e extends Item {
*/
static async createScrollFromPower(power) {
// Get power data
const itemData = power instanceof Item5e ? power.data : power;
const itemData = power instanceof Item5e ? power.toObject() : power;
const {actionType, description, source, activation, duration, target, range, damage, save, level} =
itemData.data;
@ -1672,7 +1675,7 @@ export default class Item5e extends Item {
const desc = `${scrollIntro}<hr/><h3>${itemData.name} (Level ${level})</h3><hr/>${description.value}<hr/><h3>Scroll Details</h3><hr/>${scrollDetails}`;
// Create the power scroll data
const powerScrollData = mergeObject(scrollData, {
const powerScrollData = foundry.utils.mergeObject(scrollData, {
name: `${game.i18n.localize("SW5E.PowerScroll")}: ${itemData.name}`,
img: itemData.img,
data: {