diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b4c4dcf7..67428a1c 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -5,22 +5,23 @@ * [#740] Holding shift now rolls some rolls without a prompt * [#769] UI has been updated - - User interface has been redesigned with a new look and feel. - - Character inventory supports drag and drop reordering. - - Holding shift while clicking on a rollable links will bypass the roll prompt, rolling with unmodified values. + - User interface has been redesigned with a new look and feel + - Character inventory now supports drag and drop reordering of items + - Holding shift while clicking on a rollable link will bypass the roll prompt, rolling with normal values * [#798] Allow for tokens and combat tracker to display dynamic AC - `system.attributes.ac.value` now always holds the current AC -* [#820] All ability scores now store a total value of bast stats + modifiers e.g. system.abilities.str.total +* [#820] All ability scores now store a total value of base stats + modifiers. e.g. `system.abilities.str.total` ## Bugfixes * [#809] Add new `grid.distance` and `grid.units` values to `system.json` *(Foundry V12 compatibility)* * [#811] `description` typo in `system.json` * [#814] The roll initiative button on the player sheet will no longer double roll when re-rolling initiative * [#816] Updated Ranger Herbalism talent description to the latest version -* [#822] The spellbook now works for Knight of St. Ydris and other such classes using another class's spell lists. +* [#822] The spellbook now works for Knight of St. Ydris and other classes that use another class's spell list +* [#832] Melee weapons with the "Thrown" property now rolling correctly when used as a ranged attack * [#835] Update Sleep spell description to the latest version ## Chores diff --git a/system/src/documents/ActorSD.mjs b/system/src/documents/ActorSD.mjs index f438248a..ca4925c2 100644 --- a/system/src/documents/ActorSD.mjs +++ b/system/src/documents/ActorSD.mjs @@ -481,8 +481,12 @@ export default class ActorSD extends Actor { itemId, }); } + // if thrown build range attack option if (await item.hasProperty("thrown")) { - weaponOptions.attackBonus = baseAttackBonus + + const thrownBaseBonus = Math.max(meleeAttack, rangedAttack); + + weaponOptions.attackBonus = thrownBaseBonus + parseInt(this.system.bonuses.rangedAttackBonus, 10) + parseInt(item.system.bonuses.attackBonus, 10) + weaponMasterBonus; @@ -494,6 +498,10 @@ export default class ActorSD extends Actor { item.system.range ]; + weaponOptions.bonusDamage += + parseInt(this.system.bonuses.rangedDamageBonus, 10) + + parseInt(item.system.bonuses.damageBonus, 10); + weaponDisplays.ranged.push({ display: await this.buildWeaponDisplay(weaponOptions), itemId, @@ -995,7 +1003,10 @@ export default class ActorSD extends Actor { data.canBackstab = await this.canBackstab(); - if (item.system.type === "melee") { + // Use set options for type of attack or assume item type + data.attackType = options.attackType ?? item.system.type; + + if (data.attackType === "melee") { if (await item.isFinesseWeapon()) { data.abilityBonus = Math.max( this.abilityModifier("str"), @@ -1011,7 +1022,16 @@ export default class ActorSD extends Actor { data.damageParts.push("@meleeDamageBonus"); } else { - data.abilityBonus = this.abilityModifier("dex"); + // if thrown item used as range, use highest modifier. + if (await item.isThrownWeapon()) { + data.abilityBonus = Math.max( + this.abilityModifier("str"), + this.abilityModifier("dex") + ); + } + else { + data.abilityBonus = this.abilityModifier("dex"); + } data.talentBonus = bonuses.rangedAttackBonus; data.rangedDamageBonus = bonuses.rangedDamageBonus * damageMultiplier; diff --git a/system/src/documents/ItemSD.mjs b/system/src/documents/ItemSD.mjs index dc613a09..322e301d 100644 --- a/system/src/documents/ItemSD.mjs +++ b/system/src/documents/ItemSD.mjs @@ -271,6 +271,10 @@ export default class ItemSD extends Item { return this.hasProperty("finesse"); } + isThrownWeapon() { + return this.hasProperty("thrown"); + } + isMagicItem() { return this.system.isPhysical && this.system.magicItem; } diff --git a/system/src/sheets/ActorSheetSD.mjs b/system/src/sheets/ActorSheetSD.mjs index 34f4f1e1..1dd3f3ed 100644 --- a/system/src/sheets/ActorSheetSD.mjs +++ b/system/src/sheets/ActorSheetSD.mjs @@ -237,14 +237,18 @@ export default class ActorSheetSD extends ActorSheet { event.preventDefault(); const itemId = $(event.currentTarget).data("item-id"); + const attackType = $(event.currentTarget).data("attack-type"); + + const options = { + attackType, + }; // skip roll prompt if shift clicked if (event.shiftKey) { - this.actor.rollAttack(itemId, {fastForward: true}); - } - else { - this.actor.rollAttack(itemId); + options.fastForward = true; } + + this.actor.rollAttack(itemId, options); } async _onToggleLost(event) { diff --git a/system/templates/actors/player/abilities/attacks.hbs b/system/templates/actors/player/abilities/attacks.hbs index 2e40819c..80bda28d 100644 --- a/system/templates/actors/player/abilities/attacks.hbs +++ b/system/templates/actors/player/abilities/attacks.hbs @@ -5,7 +5,17 @@