Review range + display raw armor result

This commit is contained in:
sladecraven 2022-08-26 13:23:06 +02:00
parent b84f34d560
commit 78cadeaec0
6 changed files with 30 additions and 9 deletions

View File

@ -640,10 +640,10 @@ export class CrucibleActor extends Actor {
if ( !rollData.forceDisadvantage) { // This is an attack, check if disadvantaged
rollData.forceDisadvantage = this.isAttackDisadvantage()
}
if (rollData.weapon.system.isranged && rollData.tokensDistance > CrucibleUtility.getWeaponMaxRange(rollData.weapon) ) {
/*if (rollData.weapon.system.isranged && rollData.tokensDistance > CrucibleUtility.getWeaponMaxRange(rollData.weapon) ) {
ui.notifications.warn(`Your target is out of range of your weapon (max: ${CrucibleUtility.getWeaponMaxRange(rollData.weapon)} - current : ${rollData.tokensDistance})` )
return
}
}*/
this.startRoll(rollData)
} else {
ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
@ -691,7 +691,7 @@ export class CrucibleActor extends Actor {
rollData.sizeDice = CrucibleUtility.getSizeDice( this.system.biodata.size )
rollData.effectiveRange = CrucibleUtility.getWeaponRange(attackRollData.weapon)
rollData.tokensDistance = attackRollData.tokensDistance // QoL copy
rollData.distanceBonusDice = Math.max(0, Math.floor((rollData.tokensDistance - rollData.effectiveRange) + 0.5))
rollData.distanceBonusDice = 0 //Math.max(0, Math.floor((rollData.tokensDistance - rollData.effectiveRange) + 0.5))
rollData.hasCover = "none"
rollData.situational = "none"
rollData.useshield = false
@ -770,7 +770,7 @@ export class CrucibleActor extends Actor {
ChatMessage.create( { content: "Armor result : " + armorValue } )
}
messages.push( "Armor result : " + armorValue)
return { armorIgnored: false, nbSuccess: armorValue, messages: messages }
return { armorIgnored: false, nbSuccess: armorValue, rawArmor: armorResult.text, messages: messages }
}
return { armorIgnored: true, nbSuccess: 0, messages: ["No armor equipped."] }
}

View File

@ -76,6 +76,9 @@ export class CrucibleRollDialog extends Dialog {
html.find('#situational').change((event) => {
this.rollData.situational = event.currentTarget.value
})
html.find('#distanceBonusDice').change((event) => {
this.rollData.distanceBonusDice = Number(event.currentTarget.value)
})
}
}

View File

@ -338,10 +338,18 @@ export class CrucibleUtility {
/* -------------------------------------------- */
static getSuccessResult(rollData) {
if (rollData.sumSuccess <= -3) {
return { result: "miss", fumble: true, attackerHPLoss: "2d3", hpLossType: "melee" }
if (rollData.attackRollData.weapon.system.isranged ) {
return { result: "miss", fumble: true, hpLossType: "melee" }
} else {
return { result: "miss", fumble: true, attackerHPLoss: "2d3", hpLossType: "melee" }
}
}
if (rollData.sumSuccess == -2) {
return { result: "miss", dangerous_fumble: true, attackerHPLoss: "1d3", hpLossType: "melee" }
if (rollData.attackRollData.weapon.system.isranged ) {
return { result: "miss", dangerous_fumble: true }
} else {
return { result: "miss", dangerous_fumble: true, attackerHPLoss: "1d3", hpLossType: "melee" }
}
}
if (rollData.sumSuccess == -1) {
return { result: "miss" }

View File

@ -199,7 +199,7 @@
"styles": [
"styles/simple.css"
],
"version": "10.0.5",
"version": "10.0.6",
"compatibility": {
"minimum": "10",
"verified": "10.278",
@ -207,7 +207,7 @@
},
"title": "Crucible RPG",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v10.0.5.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v10.0.6.zip",
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
"background": "images/ui/crucible_welcome_page.webp",
"id": "fvtt-crucible-rpg"

View File

@ -23,7 +23,9 @@
<li>Fumble ! : {{successDetails.fumbleDetails.data.text}} </li>
{{/if}}
{{#if armorResult}}
<li>Armor initial result : {{armorResult.rawArmor}}</li>
{{#each armorResult.messages as |message idx|}}
<li>{{message}}</li>
{{/each}}

View File

@ -16,7 +16,15 @@
<div class="flexrow">
<span class="roll-dialog-label">Distance bonus dice(s) : </span>
<span class="roll-dialog-label">{{distanceBonusDice}}</span>
<select class="status-small-label color-class-common" type="text" id="distanceBonusDice" value="{{distanceBonusDice}}" data-dtype="String" >
{{#select distanceBonusDice}}
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
{{/select}}
</select>
</div>
{{/if}}