forked from GitHub-Mirrors/foundry-sw5e
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:
parent
f16383841b
commit
5bb253d9c3
56 changed files with 5440 additions and 3827 deletions
|
@ -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: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import TraitSelector from "../apps/trait-selector.js";
|
||||
import {onManageActiveEffect, prepareActiveEffectCategories} from "../effects.js";
|
||||
import ActiveEffect5e from "../active-effect.js";
|
||||
|
||||
/**
|
||||
* Override and extend the core ItemSheet implementation to handle specific item types
|
||||
|
@ -71,7 +71,7 @@ export default class ItemSheet5e extends ItemSheet {
|
|||
data.isMountable = this._isItemMountable(itemData);
|
||||
|
||||
// Prepare Active Effects
|
||||
data.effects = prepareActiveEffectCategories(this.item.effects);
|
||||
data.effects = ActiveEffect5e.prepareActiveEffectCategories(this.item.effects);
|
||||
|
||||
// Re-define the template data references (backwards compatible)
|
||||
data.item = itemData;
|
||||
|
@ -347,12 +347,15 @@ export default class ItemSheet5e extends ItemSheet {
|
|||
options.choices = CONFIG.SW5E.abilities;
|
||||
options.valueKey = null;
|
||||
break;
|
||||
case "skills.choices":
|
||||
options.choices = CONFIG.SW5E.skills;
|
||||
options.valueKey = null;
|
||||
break;
|
||||
case "skills":
|
||||
const skills = this.item.data.data.skills;
|
||||
const choiceSet =
|
||||
skills.choices && skills.choices.length ? skills.choices : Object.keys(CONFIG.SW5E.skills);
|
||||
const choiceSet = skills.choices?.length ? skills.choices : Object.keys(CONFIG.SW5E.skills);
|
||||
options.choices = Object.fromEntries(
|
||||
Object.entries(CONFIG.SW5E.skills).filter((skill) => choiceSet.includes(skill[0]))
|
||||
Object.entries(CONFIG.SW5E.skills).filter(([skill]) => choiceSet.includes(skill))
|
||||
);
|
||||
options.maximum = skills.number;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue