Compare commits
3 Commits
fvtt-cruci
...
fvtt-cruci
Author | SHA1 | Date | |
---|---|---|---|
35d500f24b | |||
fa501abbd5 | |||
b84f34d560 |
@ -560,11 +560,17 @@ export class CrucibleActor extends Actor {
|
|||||||
let defender = defenderToken.actor
|
let defender = defenderToken.actor
|
||||||
|
|
||||||
// Distance management
|
// Distance management
|
||||||
if ( this.token) {
|
let token = this.token
|
||||||
const ray = new Ray(this.token.object.center, defenderToken.center)
|
if ( !token) {
|
||||||
|
let tokens =this.getActiveTokens()
|
||||||
|
token = tokens[0]
|
||||||
|
}
|
||||||
|
if ( token ) {
|
||||||
|
const ray = new Ray(token.object?.center || token.center, defenderToken.center)
|
||||||
rollData.tokensDistance = canvas.grid.measureDistances([{ray}], {gridSpaces:false})[0] / canvas.grid.grid.options.dimensions.distance
|
rollData.tokensDistance = canvas.grid.measureDistances([{ray}], {gridSpaces:false})[0] / canvas.grid.grid.options.dimensions.distance
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.info("No token connected to this actor, unable to compute distance.")
|
ui.notifications.info("No token connected to this actor, unable to compute distance.")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (defender ) {
|
if (defender ) {
|
||||||
rollData.forceAdvantage = defender.isAttackerAdvantage()
|
rollData.forceAdvantage = defender.isAttackerAdvantage()
|
||||||
@ -634,10 +640,10 @@ export class CrucibleActor extends Actor {
|
|||||||
if ( !rollData.forceDisadvantage) { // This is an attack, check if disadvantaged
|
if ( !rollData.forceDisadvantage) { // This is an attack, check if disadvantaged
|
||||||
rollData.forceDisadvantage = this.isAttackDisadvantage()
|
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})` )
|
ui.notifications.warn(`Your target is out of range of your weapon (max: ${CrucibleUtility.getWeaponMaxRange(rollData.weapon)} - current : ${rollData.tokensDistance})` )
|
||||||
return
|
return
|
||||||
}
|
}*/
|
||||||
this.startRoll(rollData)
|
this.startRoll(rollData)
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
|
ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
|
||||||
@ -685,7 +691,7 @@ export class CrucibleActor extends Actor {
|
|||||||
rollData.sizeDice = CrucibleUtility.getSizeDice( this.system.biodata.size )
|
rollData.sizeDice = CrucibleUtility.getSizeDice( this.system.biodata.size )
|
||||||
rollData.effectiveRange = CrucibleUtility.getWeaponRange(attackRollData.weapon)
|
rollData.effectiveRange = CrucibleUtility.getWeaponRange(attackRollData.weapon)
|
||||||
rollData.tokensDistance = attackRollData.tokensDistance // QoL copy
|
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.hasCover = "none"
|
||||||
rollData.situational = "none"
|
rollData.situational = "none"
|
||||||
rollData.useshield = false
|
rollData.useshield = false
|
||||||
@ -746,10 +752,10 @@ export class CrucibleActor extends Actor {
|
|||||||
let diceColor = armor.system.absorprionroll
|
let diceColor = armor.system.absorprionroll
|
||||||
let armorResult = await CrucibleUtility.getRollTableFromDiceColor( diceColor, false )
|
let armorResult = await CrucibleUtility.getRollTableFromDiceColor( diceColor, false )
|
||||||
console.log("Armor log", armorResult)
|
console.log("Armor log", armorResult)
|
||||||
let armorValue = (Number(armorResult.text) - reduce) * multiply
|
let armorValue = (Number(armorResult.text) + reduce) * multiply
|
||||||
if ( advantage || disadvantage) {
|
if ( advantage || disadvantage) {
|
||||||
let armorResult2 = await CrucibleUtility.getRollTableFromDiceColor( diceColor, false )
|
let armorResult2 = await CrucibleUtility.getRollTableFromDiceColor( diceColor, false )
|
||||||
let armorValue2 = (Number(armorResult2.text) - reduce) * multiply
|
let armorValue2 = (Number(armorResult2.text) + reduce) * multiply
|
||||||
if ( advantage) {
|
if ( advantage) {
|
||||||
armorValue = (armorValue2 > armorValue) ? armorValue2 : armorValue
|
armorValue = (armorValue2 > armorValue) ? armorValue2 : armorValue
|
||||||
messages.push(`Armor advantage - Roll 1 = ${armorValue} - Roll 2 = ${armorValue2}`)
|
messages.push(`Armor advantage - Roll 1 = ${armorValue} - Roll 2 = ${armorValue2}`)
|
||||||
@ -764,7 +770,7 @@ export class CrucibleActor extends Actor {
|
|||||||
ChatMessage.create( { content: "Armor result : " + armorValue } )
|
ChatMessage.create( { content: "Armor result : " + armorValue } )
|
||||||
}
|
}
|
||||||
messages.push( "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."] }
|
return { armorIgnored: true, nbSuccess: 0, messages: ["No armor equipped."] }
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,9 @@ export class CrucibleRollDialog extends Dialog {
|
|||||||
html.find('#situational').change((event) => {
|
html.find('#situational').change((event) => {
|
||||||
this.rollData.situational = event.currentTarget.value
|
this.rollData.situational = event.currentTarget.value
|
||||||
})
|
})
|
||||||
|
html.find('#distanceBonusDice').change((event) => {
|
||||||
|
this.rollData.distanceBonusDice = Number(event.currentTarget.value)
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -338,11 +338,19 @@ export class CrucibleUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static getSuccessResult(rollData) {
|
static getSuccessResult(rollData) {
|
||||||
if (rollData.sumSuccess <= -3) {
|
if (rollData.sumSuccess <= -3) {
|
||||||
|
if (rollData.attackRollData.weapon.system.isranged ) {
|
||||||
|
return { result: "miss", fumble: true, hpLossType: "melee" }
|
||||||
|
} else {
|
||||||
return { result: "miss", fumble: true, attackerHPLoss: "2d3", hpLossType: "melee" }
|
return { result: "miss", fumble: true, attackerHPLoss: "2d3", hpLossType: "melee" }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rollData.sumSuccess == -2) {
|
if (rollData.sumSuccess == -2) {
|
||||||
|
if (rollData.attackRollData.weapon.system.isranged ) {
|
||||||
|
return { result: "miss", dangerous_fumble: true }
|
||||||
|
} else {
|
||||||
return { result: "miss", dangerous_fumble: true, attackerHPLoss: "1d3", hpLossType: "melee" }
|
return { result: "miss", dangerous_fumble: true, attackerHPLoss: "1d3", hpLossType: "melee" }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (rollData.sumSuccess == -1) {
|
if (rollData.sumSuccess == -1) {
|
||||||
return { result: "miss" }
|
return { result: "miss" }
|
||||||
}
|
}
|
||||||
|
@ -199,15 +199,15 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"styles/simple.css"
|
"styles/simple.css"
|
||||||
],
|
],
|
||||||
"version": "10.0.4",
|
"version": "10.0.7",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "10.278",
|
"verified": "10.279",
|
||||||
"maximum": "10"
|
"maximum": "10"
|
||||||
},
|
},
|
||||||
"title": "Crucible RPG",
|
"title": "Crucible RPG",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/raw/master/system.json",
|
"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.4.zip",
|
"download": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg/archive/fvtt-crucible-rpg-v10.0.7.zip",
|
||||||
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
"url": "https://www.uberwald.me/gitea/public/fvtt-crucible-rpg",
|
||||||
"background": "images/ui/crucible_welcome_page.webp",
|
"background": "images/ui/crucible_welcome_page.webp",
|
||||||
"id": "fvtt-crucible-rpg"
|
"id": "fvtt-crucible-rpg"
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
<li>Fumble ! : {{successDetails.fumbleDetails.data.text}} </li>
|
<li>Fumble ! : {{successDetails.fumbleDetails.data.text}} </li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
||||||
{{#if armorResult}}
|
{{#if armorResult}}
|
||||||
|
<li>Armor initial result : {{armorResult.rawArmor}}</li>
|
||||||
{{#each armorResult.messages as |message idx|}}
|
{{#each armorResult.messages as |message idx|}}
|
||||||
<li>{{message}}</li>
|
<li>{{message}}</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -16,7 +16,15 @@
|
|||||||
|
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Distance bonus dice(s) : </span>
|
<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>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user