Manage ranged weapons

This commit is contained in:
LeRatierBretonnien 2025-01-30 20:55:22 +01:00
parent d3302386ca
commit e3727a8374
30 changed files with 129 additions and 74 deletions

View File

@ -1948,6 +1948,10 @@ i.lethalfantasy {
.lethalfantasy-roll-dialog fieldset {
padding: 4px;
}
.dialog-form .form-footer button {
min-width: 14rem;
min-height: 3.2rem;
}
.dialog-modifier {
display: flex;
justify-content: center;

View File

@ -602,7 +602,7 @@ export default class LethalFantasyRoll extends Roll {
buttons: [
{
action: "roll",
label: label,
label: "Roll Progression Dice or Continue Loading",
callback: (event, button, dialog) => {
const output = Array.from(button.form.elements).reduce((obj, input) => {
if (input.name) obj[input.name] = input.value
@ -632,10 +632,39 @@ export default class LethalFantasyRoll extends Roll {
// Get the weapons from the actor items
let actor = game.actors.get(options.actorId)
let weapon = actor.items.find(i => i.type === "weapon" && i.id === rollContext.progressionDiceId)
let isMonster = actor.type === "monster"
// Get the dice and roll it
let rangedMode
let searchId = rollContext.progressionDiceId
if ( searchId.match("simpleAim")) {
searchId = searchId.replace("simpleAim", "")
rangedMode = "simpleAim"
}
if ( searchId.match("carefulAim")) {
searchId = searchId.replace("carefulAim", "")
rangedMode = "carefulAim"
}
if ( searchId.match("focusedAim")) {
searchId = searchId.replace("focusedAim", "")
rangedMode = "focusedAim"
}
let weapon = actor.items.find(i => i.type === "weapon" && i.id === searchId)
let formula = weapon.system.combatProgressionDice
let rangedLoad
if (rangedMode) {
let toSplit = weapon.system.speed[rangedMode]
let split = toSplit.split("+")
rangedLoad = Number(split[0]) || 0
formula = split[1]
console.log("Ranged Mode", rangedMode, rangedLoad, formula, options.rollProgressionCount)
}
if (rangedLoad && options.rollProgressionCount <= rangedLoad ) {
let message = `Ranged weapon ${weapon.name} is loading, loading count : ${options.rollProgressionCount}/${rangedLoad}`
ChatMessage.create({ content: message, speaker: ChatMessage.getSpeaker({ actor: actor }) })
return
}
let isMonster = actor.type === "monster"
// Get the dice and roll it if
let roll = new Roll(formula)
await roll.evaluate()

View File

@ -279,8 +279,14 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
async rollProgressionDice(combatId, combatantId, rollProgressionCount) {
// Get all weapons from the actor
let weapons = this.parent.items.filter(i => i.type === "weapon")
let weapons = this.parent.items.filter(i => i.type === "weapon" && i.system.weaponType === "melee")
let weaponsChoices = weapons.map(w => { return { id: w.id, name: `${w.name} (${w.system.combatProgressionDice.toUpperCase()})`, combatProgressionDice: w.system.combatProgressionDice.toUpperCase() } })
let rangeWeapons = this.parent.items.filter(i => i.type === "weapon" && i.system.weaponType === "ranged")
for (let w of rangeWeapons) {
weaponsChoices.push({ id: `${w.id}simpleAim`, name: `${w.name} (Simple Aim: ${w.system.speed.simpleAim.toUpperCase()})`, combatProgressionDice: w.system.speed.simpleAim.toUpperCase() })
weaponsChoices.push({ id: `${w.id}carefulAim`, name: `${w.name} (Careful Aim: ${w.system.speed.carefulAim.toUpperCase()})`, combatProgressionDice: w.system.speed.carefulAim.toUpperCase() })
weaponsChoices.push({ id: `${w.id}focusedAim`, name: `${w.name} (Focused Aim: ${w.system.speed.focusedAim.toUpperCase()})`, combatProgressionDice: w.system.speed.focusedAim.toUpperCase() })
}
let roll = await LethalFantasyRoll.promptProgressionDice({
actorId: this.parent.id,

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000122
MANIFEST-000126

View File

@ -1,8 +1,15 @@
2025/01/30-13:15:14.918312 7ff407fff6c0 Recovering log #120
2025/01/30-13:15:14.929657 7ff407fff6c0 Delete type=3 #118
2025/01/30-13:15:14.929719 7ff407fff6c0 Delete type=0 #120
2025/01/30-13:39:44.181843 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.181878 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.188409 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.188600 7ff4077fe6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zFrygJ2TnrxchBai' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.188646 7ff4077fe6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zFrygJ2TnrxchBai' @ 0 : 0; will stop at (end)
2025/01/30-20:09:05.238844 7ff407fff6c0 Recovering log #124
2025/01/30-20:09:05.248561 7ff407fff6c0 Delete type=3 #122
2025/01/30-20:09:05.248624 7ff407fff6c0 Delete type=0 #124
2025/01/30-20:54:56.196391 7ff4077fe6c0 Level-0 table #129: started
2025/01/30-20:54:56.199740 7ff4077fe6c0 Level-0 table #129: 7303 bytes OK
2025/01/30-20:54:56.206420 7ff4077fe6c0 Delete type=0 #127
2025/01/30-20:54:56.220607 7ff4077fe6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!znm6T1ef4qQI8BX7' @ 0 : 0; will stop at (end)
2025/01/30-20:54:56.220651 7ff4077fe6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!znm6T1ef4qQI8BX7' @ 0 : 0; will stop at '!items!znm6T1ef4qQI8BX7' @ 78 : 1
2025/01/30-20:54:56.220659 7ff4077fe6c0 Compacting 1@1 + 1@2 files
2025/01/30-20:54:56.225095 7ff4077fe6c0 Generated table #130@1: 82 keys, 36413 bytes
2025/01/30-20:54:56.225145 7ff4077fe6c0 Compacted 1@1 + 1@2 files => 36413 bytes
2025/01/30-20:54:56.231754 7ff4077fe6c0 compacted to: files[ 0 0 1 0 0 0 0 ]
2025/01/30-20:54:56.231930 7ff4077fe6c0 Delete type=2 #53
2025/01/30-20:54:56.232143 7ff4077fe6c0 Delete type=2 #129
2025/01/30-20:54:56.238551 7ff4077fe6c0 Manual compaction at level-1 from '!items!znm6T1ef4qQI8BX7' @ 78 : 1 .. '!items!znm6T1ef4qQI8BX7' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,8 @@
2025/01/30-07:59:30.631841 7ff40cdf86c0 Recovering log #116
2025/01/30-07:59:30.841049 7ff40cdf86c0 Delete type=3 #114
2025/01/30-07:59:30.841132 7ff40cdf86c0 Delete type=0 #116
2025/01/30-08:19:17.497882 7ff4077fe6c0 Level-0 table #121: started
2025/01/30-08:19:17.497911 7ff4077fe6c0 Level-0 table #121: 0 bytes OK
2025/01/30-08:19:17.504198 7ff4077fe6c0 Delete type=0 #119
2025/01/30-08:19:17.504366 7ff4077fe6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zFrygJ2TnrxchBai' @ 0 : 0; will stop at (end)
2025/01/30-08:19:17.504391 7ff4077fe6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zFrygJ2TnrxchBai' @ 0 : 0; will stop at (end)
2025/01/30-13:15:14.918312 7ff407fff6c0 Recovering log #120
2025/01/30-13:15:14.929657 7ff407fff6c0 Delete type=3 #118
2025/01/30-13:15:14.929719 7ff407fff6c0 Delete type=0 #120
2025/01/30-13:39:44.181843 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.181878 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.188409 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.188600 7ff4077fe6c0 Manual compaction at level-0 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zFrygJ2TnrxchBai' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.188646 7ff4077fe6c0 Manual compaction at level-1 from '!folders!ATr9wZhg5uTVTksM' @ 72057594037927935 : 1 .. '!items!zFrygJ2TnrxchBai' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000122
MANIFEST-000126

View File

@ -1,8 +1,8 @@
2025/01/30-13:15:14.932713 7ff40cdf86c0 Recovering log #120
2025/01/30-13:15:14.942469 7ff40cdf86c0 Delete type=3 #118
2025/01/30-13:15:14.942527 7ff40cdf86c0 Delete type=0 #120
2025/01/30-13:39:44.163166 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.163210 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.169687 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.188551 7ff4077fe6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.188611 7ff4077fe6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)
2025/01/30-20:09:05.251602 7ff40ddfa6c0 Recovering log #124
2025/01/30-20:09:05.262861 7ff40ddfa6c0 Delete type=3 #122
2025/01/30-20:09:05.262926 7ff40ddfa6c0 Delete type=0 #124
2025/01/30-20:54:56.214077 7ff4077fe6c0 Level-0 table #129: started
2025/01/30-20:54:56.214134 7ff4077fe6c0 Level-0 table #129: 0 bytes OK
2025/01/30-20:54:56.220429 7ff4077fe6c0 Delete type=0 #127
2025/01/30-20:54:56.220630 7ff4077fe6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)
2025/01/30-20:54:56.232262 7ff4077fe6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,8 @@
2025/01/30-07:59:30.844287 7ff40ddfa6c0 Recovering log #116
2025/01/30-07:59:30.958513 7ff40ddfa6c0 Delete type=3 #114
2025/01/30-07:59:30.958598 7ff40ddfa6c0 Delete type=0 #116
2025/01/30-08:19:17.484154 7ff4077fe6c0 Level-0 table #121: started
2025/01/30-08:19:17.484188 7ff4077fe6c0 Level-0 table #121: 0 bytes OK
2025/01/30-08:19:17.490585 7ff4077fe6c0 Delete type=0 #119
2025/01/30-08:19:17.504345 7ff4077fe6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)
2025/01/30-08:19:17.504400 7ff4077fe6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)
2025/01/30-13:15:14.932713 7ff40cdf86c0 Recovering log #120
2025/01/30-13:15:14.942469 7ff40cdf86c0 Delete type=3 #118
2025/01/30-13:15:14.942527 7ff40cdf86c0 Delete type=0 #120
2025/01/30-13:39:44.163166 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.163210 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.169687 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.188551 7ff4077fe6c0 Manual compaction at level-0 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.188611 7ff4077fe6c0 Manual compaction at level-1 from '!folders!yPWGvxHJbDNHVSnY' @ 72057594037927935 : 1 .. '!items!zjvGljrLk5SshC9D' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000122
MANIFEST-000126

View File

@ -1,8 +1,8 @@
2025/01/30-13:15:14.903736 7ff40ddfa6c0 Recovering log #120
2025/01/30-13:15:14.914198 7ff40ddfa6c0 Delete type=3 #118
2025/01/30-13:15:14.914248 7ff40ddfa6c0 Delete type=0 #120
2025/01/30-13:39:44.169809 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.169838 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.175750 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.188573 7ff4077fe6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.188620 7ff4077fe6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2025/01/30-20:09:05.224305 7ff40d5f96c0 Recovering log #124
2025/01/30-20:09:05.235259 7ff40d5f96c0 Delete type=3 #122
2025/01/30-20:09:05.235310 7ff40d5f96c0 Delete type=0 #124
2025/01/30-20:54:56.206670 7ff4077fe6c0 Level-0 table #129: started
2025/01/30-20:54:56.206730 7ff4077fe6c0 Level-0 table #129: 0 bytes OK
2025/01/30-20:54:56.213236 7ff4077fe6c0 Delete type=0 #127
2025/01/30-20:54:56.220618 7ff4077fe6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2025/01/30-20:54:56.232241 7ff4077fe6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,8 @@
2025/01/30-07:59:30.483984 7ff407fff6c0 Recovering log #116
2025/01/30-07:59:30.627999 7ff407fff6c0 Delete type=3 #114
2025/01/30-07:59:30.628097 7ff407fff6c0 Delete type=0 #116
2025/01/30-08:19:17.477906 7ff4077fe6c0 Level-0 table #121: started
2025/01/30-08:19:17.477957 7ff4077fe6c0 Level-0 table #121: 0 bytes OK
2025/01/30-08:19:17.484025 7ff4077fe6c0 Delete type=0 #119
2025/01/30-08:19:17.504332 7ff4077fe6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2025/01/30-08:19:17.504375 7ff4077fe6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2025/01/30-13:15:14.903736 7ff40ddfa6c0 Recovering log #120
2025/01/30-13:15:14.914198 7ff40ddfa6c0 Delete type=3 #118
2025/01/30-13:15:14.914248 7ff40ddfa6c0 Delete type=0 #120
2025/01/30-13:39:44.169809 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.169838 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.175750 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.188573 7ff4077fe6c0 Manual compaction at level-0 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.188620 7ff4077fe6c0 Manual compaction at level-1 from '!folders!7j8H7DbmBb9Uza2X' @ 72057594037927935 : 1 .. '!items!zt8s7564ep1La4XQ' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@ -1 +1 @@
MANIFEST-000122
MANIFEST-000126

View File

@ -1,8 +1,8 @@
2025/01/30-13:15:14.945218 7ff40d5f96c0 Recovering log #120
2025/01/30-13:15:14.955687 7ff40d5f96c0 Delete type=3 #118
2025/01/30-13:15:14.955744 7ff40d5f96c0 Delete type=0 #120
2025/01/30-13:39:44.200949 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.200977 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.206854 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.214246 7ff4077fe6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.214303 7ff4077fe6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2025/01/30-20:09:05.265191 7ff40cdf86c0 Recovering log #124
2025/01/30-20:09:05.275685 7ff40cdf86c0 Delete type=3 #122
2025/01/30-20:09:05.275743 7ff40cdf86c0 Delete type=0 #124
2025/01/30-20:54:56.189419 7ff4077fe6c0 Level-0 table #129: started
2025/01/30-20:54:56.189497 7ff4077fe6c0 Level-0 table #129: 0 bytes OK
2025/01/30-20:54:56.196235 7ff4077fe6c0 Delete type=0 #127
2025/01/30-20:54:56.220594 7ff4077fe6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2025/01/30-20:54:56.220640 7ff4077fe6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)

View File

@ -1,8 +1,8 @@
2025/01/30-07:59:30.961782 7ff40d5f96c0 Recovering log #116
2025/01/30-07:59:31.068433 7ff40d5f96c0 Delete type=3 #114
2025/01/30-07:59:31.068492 7ff40d5f96c0 Delete type=0 #116
2025/01/30-08:19:17.490778 7ff4077fe6c0 Level-0 table #121: started
2025/01/30-08:19:17.490810 7ff4077fe6c0 Level-0 table #121: 0 bytes OK
2025/01/30-08:19:17.497744 7ff4077fe6c0 Delete type=0 #119
2025/01/30-08:19:17.504356 7ff4077fe6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2025/01/30-08:19:17.504383 7ff4077fe6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2025/01/30-13:15:14.945218 7ff40d5f96c0 Recovering log #120
2025/01/30-13:15:14.955687 7ff40d5f96c0 Delete type=3 #118
2025/01/30-13:15:14.955744 7ff40d5f96c0 Delete type=0 #120
2025/01/30-13:39:44.200949 7ff4077fe6c0 Level-0 table #125: started
2025/01/30-13:39:44.200977 7ff4077fe6c0 Level-0 table #125: 0 bytes OK
2025/01/30-13:39:44.206854 7ff4077fe6c0 Delete type=0 #123
2025/01/30-13:39:44.214246 7ff4077fe6c0 Manual compaction at level-0 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)
2025/01/30-13:39:44.214303 7ff4077fe6c0 Manual compaction at level-1 from '!folders!mnO9OzE7BEE2KDfh' @ 72057594037927935 : 1 .. '!items!zkK6ixtCsCw3RH9X' @ 0 : 0; will stop at (end)

View File

@ -15,6 +15,15 @@
}
}
.dialog-form {
.form-footer {
button {
min-width: 14rem;
min-height: 3.2rem;
}
}
}
.dialog-modifier {
display: flex;
justify-content: center;

View File

@ -6,7 +6,7 @@
"download": "#{DOWNLOAD}#",
"url": "#{URL}#",
"license": "LICENSE",
"version": "12.0.28",
"version": "12.0.29",
"authors": [
{
"name": "Uberwald",