From b92edb420009d7b9a186ccf9842f3da8fda691c9 Mon Sep 17 00:00:00 2001 From: Kakeman89 Date: Mon, 19 Oct 2020 15:52:56 -0400 Subject: [PATCH] Update from 0.98 DND Current 10-18-20 --- lang/en.json | 14 ++++++++++++++ module/actor/entity.js | 3 ++- module/actor/sheets/character.js | 3 +-- module/item/sheet.js | 4 ++++ module/pixi/ability-template.js | 2 +- sw5e.css | 1 + template.json | 11 +---------- templates/items/parts/item-activation.html | 10 ++++++++++ 8 files changed, 34 insertions(+), 14 deletions(-) diff --git a/lang/en.json b/lang/en.json index 7a9b16f6..cdba75c1 100644 --- a/lang/en.json +++ b/lang/en.json @@ -1,4 +1,17 @@ { +"ACTOR.TypeCharacter": "Player Character", +"ACTOR.TypeNpc": "Non-Player Character", +"ACTOR.TypeVehicle": "Vehicle", +"ITEM.TypeBackpack": "Backpack", +"ITEM.TypeClass": "Class", +"ITEM.TypeConsumable": "Consumable", +"ITEM.TypeEquipment": "Equipment", +"ITEM.TypeFeat": "Feature", +"ITEM.TypeLoot": "Loot", +"ITEM.TypePower": "Power", +"ITEM.TypeTool": "Tool", +"ITEM.TypeWeapon": "Weapon", + "Star Wars 5th Edition": "Star Wars 5th Edition", "SW5E.title": "Star Wars 5th Edition", "SW5E.AbbreviationCR": "CR", @@ -686,6 +699,7 @@ "SW5E.TargetSquare": "Square", "SW5E.TargetWall": "Wall", "SW5E.TargetWeapon": "Weapon", +"SW5E.TargetWidth": "Line Width", "SW5E.Temp": "Temp", "SW5E.Threshold": "Threshold", "SW5E.TimeDay": "Days", diff --git a/module/actor/entity.js b/module/actor/entity.js index d0943067..ca4632a0 100644 --- a/module/actor/entity.js +++ b/module/actor/entity.js @@ -100,7 +100,7 @@ export default class Actor5e extends Actor { } // Ability modifiers and saves - const dcBonus = Number.isNumeric(data.bonuses.power?.dc) ? parseInt(data.bonuses.power.dc) : 0; + const dcBonus = Number.isNumeric(data.bonuses?.power?.dc) ? parseInt(data.bonuses.power.dc) : 0; const saveBonus = Number.isNumeric(bonuses.save) ? parseInt(bonuses.save) : 0; const checkBonus = Number.isNumeric(bonuses.check) ? parseInt(bonuses.check) : 0; for (let [id, abl] of Object.entries(data.abilities)) { @@ -186,6 +186,7 @@ export default class Actor5e extends Actor { // Get the configuration of features which may be added const clsConfig = CONFIG.SW5E.classFeatures[className]; + if (!clsConfig) return []; let featureIDs = clsConfig["features"][level] || []; const subclassName = cls.data.subclass.toLowerCase().slugify(); diff --git a/module/actor/sheets/character.js b/module/actor/sheets/character.js index a624c338..dd2121c5 100644 --- a/module/actor/sheets/character.js +++ b/module/actor/sheets/character.js @@ -266,8 +266,7 @@ export default class ActorSheet5eCharacter extends ActorSheet5e { /** @override */ async _onDropItemCreate(itemData) { - // Upgrade the number of class levels a character has - // and add features + // Upgrade the number of class levels a character has and add features if ( itemData.type === "class" ) { const cls = this.actor.itemTypes.class.find(c => c.name === itemData.name); const classWasAlreadyPresent = !!cls; diff --git a/module/item/sheet.js b/module/item/sheet.js index c61258b1..fe87275f 100644 --- a/module/item/sheet.js +++ b/module/item/sheet.js @@ -47,6 +47,10 @@ export default class ItemSheet5e extends ItemSheet { data.itemStatus = this._getItemStatus(data.item); data.itemProperties = this._getItemProperties(data.item); data.isPhysical = data.item.data.hasOwnProperty("quantity"); + + // Item Area Target + data.isLine = ["line", "wall"].includes(data.item.data.target.type); + // Potential consumption targets data.abilityConsumptionTargets = this._getItemConsumptionTargets(data.item); diff --git a/module/pixi/ability-template.js b/module/pixi/ability-template.js index ccdb85fa..e07795e6 100644 --- a/module/pixi/ability-template.js +++ b/module/pixi/ability-template.js @@ -38,7 +38,7 @@ export default class AbilityTemplate extends MeasuredTemplate { templateData.direction = 45; break; case "ray": // 5e rays are most commonly 1 square (5 ft) in width - templateData.width = canvas.dimensions.distance; + templateData.width = target.width ?? canvas.dimensions.distance; break; default: break; diff --git a/sw5e.css b/sw5e.css index 6d277f17..2c343828 100644 --- a/sw5e.css +++ b/sw5e.css @@ -840,6 +840,7 @@ cursor: pointer; max-height: 30px; overflow: hidden; + color: #191813 } .sw5e.sheet.actor .inventory-list .item .item-name .item-image { flex: 0 0 30px; diff --git a/template.json b/template.json index ddc7e3c4..89c3ac09 100644 --- a/template.json +++ b/template.json @@ -170,52 +170,42 @@ "powers": { "power1": { "value": 0, - "max": 0, "override": null }, "power2": { "value": 0, - "max": 0, "override": null }, "power3": { "value": 0, - "max": 0, "override": null }, "power4": { "value": 0, - "max": 0, "override": null }, "power5": { "value": 0, - "max": 0, "override": null }, "power6": { "value": 0, - "max": 0, "override": null }, "power7": { "value": 0, - "max": 0, "override": null }, "power8": { "value": 0, - "max": 0, "override": null }, "power9": { "value": 0, - "max": 0, "override": null }, "pact": { "value": 0, - "max": 0, "override": null } }, @@ -438,6 +428,7 @@ }, "target": { "value": null, + "width": null, "units": "", "type": "" }, diff --git a/templates/items/parts/item-activation.html b/templates/items/parts/item-activation.html index 3d181e28..0afc2d24 100644 --- a/templates/items/parts/item-activation.html +++ b/templates/items/parts/item-activation.html @@ -63,6 +63,16 @@ +{{!-- Ability Target Width --}} +{{#if isLine}} +
+ +
+ +
+
+{{/if}} + {{!-- Ability Range --}}