Malus armure/bouclier et cout en PP supplementaire
This commit is contained in:
parent
e5b8c8f2c7
commit
9e5e07b227
10
css/bol.css
10
css/bol.css
@ -92,9 +92,19 @@ a:hover {
|
|||||||
clip: rect(0 0 0 0);
|
clip: rect(0 0 0 0);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
.roll-box {
|
||||||
|
border-width: 1px;
|
||||||
|
border-color: #000000;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
.hide {
|
.hide {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
ul.no-bullets {
|
||||||
|
list-style-type: none; /* Remove bullets */
|
||||||
|
padding: 0; /* Remove padding */
|
||||||
|
margin: 0; /* Remove margins */
|
||||||
|
}
|
||||||
.ellipsis {
|
.ellipsis {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -148,6 +148,8 @@
|
|||||||
"BOL.ui.status": "Status",
|
"BOL.ui.status": "Status",
|
||||||
"BOL.ui.toactivated": "Active (>Désactiver)",
|
"BOL.ui.toactivated": "Active (>Désactiver)",
|
||||||
"BOL.ui.todeactivated": "Inactive (>Activer)",
|
"BOL.ui.todeactivated": "Inactive (>Activer)",
|
||||||
|
"BOL.ui.armorAgiMalus": "Armor+Shield Malus (Agi)",
|
||||||
|
"BOL.ui.armorInitMalus": "Armor Malus (Init)",
|
||||||
|
|
||||||
"BOL.featureCategory.origins": "Origines",
|
"BOL.featureCategory.origins": "Origines",
|
||||||
"BOL.featureCategory.races": "Races",
|
"BOL.featureCategory.races": "Races",
|
||||||
|
@ -150,6 +150,8 @@
|
|||||||
"BOL.ui.toactivated": "Active (>Désactiver)",
|
"BOL.ui.toactivated": "Active (>Désactiver)",
|
||||||
"BOL.ui.todeactivated": "Inactive (>Activer)",
|
"BOL.ui.todeactivated": "Inactive (>Activer)",
|
||||||
"BOL.ui.status": "Statut",
|
"BOL.ui.status": "Statut",
|
||||||
|
"BOL.ui.armorAgiMalus": "Malus d'Armure+Bouclier (Agi)",
|
||||||
|
"BOL.ui.armorInitMalus": "Malus d'Armure (Init)",
|
||||||
|
|
||||||
"BOL.featureCategory.origins": "Origines",
|
"BOL.featureCategory.origins": "Origines",
|
||||||
"BOL.featureCategory.races": "Races",
|
"BOL.featureCategory.races": "Races",
|
||||||
|
@ -172,7 +172,7 @@ export class BoLActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
get armorMalusValue() { // used for Fight Options
|
get armorMalusValue() { // used for Fight Options
|
||||||
for (let armor of this.armors) {
|
for (let armor of this.armors) {
|
||||||
if (armor.data.properties.armorQuality.includes("light")) {
|
if (armor.data.properties.armorQuality.includes("light")) {
|
||||||
@ -290,12 +290,52 @@ export class BoLActor extends Actor {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------- */
|
||||||
|
getPPCostArmor() {
|
||||||
|
let armors = this.armors
|
||||||
|
let ppCostArmor = 0
|
||||||
|
for (let armor of armors) {
|
||||||
|
if (armor.data.worn) {
|
||||||
|
ppCostArmor += Number(armor.data.properties.modifiers.powercost) || 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ppCostArmor
|
||||||
|
}
|
||||||
|
/*-------------------------------------------- */
|
||||||
|
getArmorAgiMalus() {
|
||||||
|
let malusAgi = 0
|
||||||
|
for (let armor of this.armors) {
|
||||||
|
if (armor.data.worn) {
|
||||||
|
malusAgi += Number(armor.data.properties.modifiers.agility) || 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let shield of this.shields) {
|
||||||
|
if (shield.data.worn) {
|
||||||
|
malusAgi += Number(shield.data.properties.modifiers.agility) || 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return malusAgi
|
||||||
|
}
|
||||||
|
/*-------------------------------------------- */
|
||||||
|
getArmorInitMalus() {
|
||||||
|
let armors = this.armors
|
||||||
|
let malusInit = 0
|
||||||
|
for (let armor of armors) {
|
||||||
|
if (armor.data.worn) {
|
||||||
|
malusInit += Number(armor.data.properties.modifiers.init) || 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return malusInit
|
||||||
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------- */
|
||||||
spendPowerPoint(ppCost) {
|
spendPowerPoint(ppCost) {
|
||||||
let newPP = this.data.data.resources.power.value - ppCost
|
let newPP = this.data.data.resources.power.value - ppCost
|
||||||
newPP = (newPP < 0) ? 0 : newPP
|
newPP = (newPP < 0) ? 0 : newPP
|
||||||
this.update({ 'data.resources.power.value': newPP })
|
this.update({ 'data.resources.power.value': newPP })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------- */
|
||||||
resetAlchemyStatus(alchemyId) {
|
resetAlchemyStatus(alchemyId) {
|
||||||
let alchemy = this.data.items.get(alchemyId)
|
let alchemy = this.data.items.get(alchemyId)
|
||||||
if (alchemy) {
|
if (alchemy) {
|
||||||
@ -303,6 +343,7 @@ export class BoLActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------------------------- */
|
||||||
async spendAlchemyPoint(alchemyId, pcCost) {
|
async spendAlchemyPoint(alchemyId, pcCost) {
|
||||||
let alchemy = this.data.items.get(alchemyId)
|
let alchemy = this.data.items.get(alchemyId)
|
||||||
if (alchemy) {
|
if (alchemy) {
|
||||||
@ -456,14 +497,14 @@ export class BoLActor extends Actor {
|
|||||||
/*-------------------------------------------- */
|
/*-------------------------------------------- */
|
||||||
buildRollList() {
|
buildRollList() {
|
||||||
let rolls = []
|
let rolls = []
|
||||||
for ( let key in this.data.data.attributes) {
|
for (let key in this.data.data.attributes) {
|
||||||
let attr = this.data.data.attributes[key]
|
let attr = this.data.data.attributes[key]
|
||||||
rolls.push( { key: key, value: attr.value, name: attr.label, type: "attribute"})
|
rolls.push({ key: key, value: attr.value, name: attr.label, type: "attribute" })
|
||||||
}
|
}
|
||||||
for ( let key in this.data.data.aptitudes) {
|
for (let key in this.data.data.aptitudes) {
|
||||||
if ( key != "def") {
|
if (key != "def") {
|
||||||
let apt = this.data.data.aptitudes[key]
|
let apt = this.data.data.aptitudes[key]
|
||||||
rolls.push( { key: key, value: apt.value, name: apt.label, type: "aptitude"})
|
rolls.push({ key: key, value: apt.value, name: apt.label, type: "aptitude" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rolls
|
return rolls
|
||||||
|
@ -16,7 +16,7 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static attributeCheck(actor, key ) {
|
static attributeCheck(actor, key) {
|
||||||
|
|
||||||
let attribute = eval(`actor.data.data.attributes.${key}`)
|
let attribute = eval(`actor.data.data.attributes.${key}`)
|
||||||
let label = (attribute.label) ? game.i18n.localize(attribute.label) : null
|
let label = (attribute.label) ? game.i18n.localize(attribute.label) : null
|
||||||
@ -31,13 +31,15 @@ export class BoLRoll {
|
|||||||
label: label,
|
label: label,
|
||||||
careerBonus: 0,
|
careerBonus: 0,
|
||||||
description: description,
|
description: description,
|
||||||
|
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||||
|
armorInitMalus: actor.getArmorAgiMalus(),
|
||||||
mod: 0
|
mod: 0
|
||||||
}
|
}
|
||||||
return this.displayRollDialog( rollData )
|
return this.displayRollDialog(rollData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static aptitudeCheck(actor, key ) {
|
static aptitudeCheck(actor, key) {
|
||||||
|
|
||||||
let aptitude = eval(`actor.data.data.aptitudes.${key}`)
|
let aptitude = eval(`actor.data.data.aptitudes.${key}`)
|
||||||
let attrKey = this.getDefaultAttribute(key)
|
let attrKey = this.getDefaultAttribute(key)
|
||||||
@ -53,6 +55,8 @@ export class BoLRoll {
|
|||||||
aptitude: aptitude,
|
aptitude: aptitude,
|
||||||
attrValue: attribute.value,
|
attrValue: attribute.value,
|
||||||
aptValue: aptitude.value,
|
aptValue: aptitude.value,
|
||||||
|
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||||
|
armorInitMalus: actor.getArmorAgiMalus(),
|
||||||
label: label,
|
label: label,
|
||||||
careerBonus: 0,
|
careerBonus: 0,
|
||||||
description: description,
|
description: description,
|
||||||
@ -70,8 +74,8 @@ export class BoLRoll {
|
|||||||
let aptitude = eval(`actor.data.data.aptitudes.${weaponData.properties.attackAptitude}`)
|
let aptitude = eval(`actor.data.data.aptitudes.${weaponData.properties.attackAptitude}`)
|
||||||
|
|
||||||
// Manage specific case
|
// Manage specific case
|
||||||
let fightOption= actor.getActiveFightOption()
|
let fightOption = actor.getActiveFightOption()
|
||||||
if ( fightOption && fightOption.data.fightoptiontype == "fulldefense") {
|
if (fightOption && fightOption.data.fightoptiontype == "fulldefense") {
|
||||||
ui.notifications.warn(`{{actor.name}} est en Défense Totale ! Il ne peut pas attaquer ce round.`)
|
ui.notifications.warn(`{{actor.name}} est en Défense Totale ! Il ne peut pas attaquer ce round.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -89,6 +93,8 @@ export class BoLRoll {
|
|||||||
aptitude: aptitude,
|
aptitude: aptitude,
|
||||||
attrValue: attribute.value,
|
attrValue: attribute.value,
|
||||||
aptValue: aptitude.value,
|
aptValue: aptitude.value,
|
||||||
|
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||||
|
armorInitMalus: actor.getArmorAgiMalus(),
|
||||||
mod: 0,
|
mod: 0,
|
||||||
modRanged: 0,
|
modRanged: 0,
|
||||||
label: (weapon.name) ? weapon.name : game.i18n.localize('BOL.ui.noWeaponName'),
|
label: (weapon.name) ? weapon.name : game.i18n.localize('BOL.ui.noWeaponName'),
|
||||||
@ -132,6 +138,8 @@ export class BoLRoll {
|
|||||||
pcCost: Number(alchemyData.properties.pccost),
|
pcCost: Number(alchemyData.properties.pccost),
|
||||||
pcCostCurrent: Number(alchemyData.properties.pccurrent),
|
pcCostCurrent: Number(alchemyData.properties.pccurrent),
|
||||||
mod: Number(alchemyData.properties.difficulty),
|
mod: Number(alchemyData.properties.difficulty),
|
||||||
|
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||||
|
armorInitMalus: actor.getArmorAgiMalus(),
|
||||||
label: alchemy.name,
|
label: alchemy.name,
|
||||||
description: game.i18n.localize('BOL.ui.makeAlchemy') + "+" + alchemy.name,
|
description: game.i18n.localize('BOL.ui.makeAlchemy') + "+" + alchemy.name,
|
||||||
}
|
}
|
||||||
@ -162,8 +170,11 @@ export class BoLRoll {
|
|||||||
aptValue: 0,
|
aptValue: 0,
|
||||||
ppCurrent: Number(actor.data.data.resources.power.value),
|
ppCurrent: Number(actor.data.data.resources.power.value),
|
||||||
careerBonus: actor.getSorcererBonus(),
|
careerBonus: actor.getSorcererBonus(),
|
||||||
|
ppCostArmor: actor.getPPCostArmor(),
|
||||||
ppCost: Number(spell.data.data.properties.ppcost),
|
ppCost: Number(spell.data.data.properties.ppcost),
|
||||||
mod: Number(spellData.properties.difficulty),
|
mod: Number(spellData.properties.difficulty),
|
||||||
|
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||||
|
armorInitMalus: actor.getArmorAgiMalus(),
|
||||||
label: spell.name,
|
label: spell.name,
|
||||||
description: game.i18n.localize('BOL.ui.focusSpell') + " : " + spell.name,
|
description: game.i18n.localize('BOL.ui.focusSpell') + " : " + spell.name,
|
||||||
}
|
}
|
||||||
@ -173,28 +184,32 @@ export class BoLRoll {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static updateTotalDice() {
|
static updateTotalDice() {
|
||||||
|
|
||||||
|
this.updateArmorMalus(this.rollData)
|
||||||
|
this.updatePPCost(this.rollData)
|
||||||
|
|
||||||
this.rollData.bmDice = this.rollData.nbBoons - this.rollData.nbFlaws + this.rollData.bDice - this.rollData.mDice
|
this.rollData.bmDice = this.rollData.nbBoons - this.rollData.nbFlaws + this.rollData.bDice - this.rollData.mDice
|
||||||
this.rollData.nbDice = 2 + Math.abs(this.rollData.bmDice)
|
this.rollData.nbDice = 2 + Math.abs(this.rollData.bmDice)
|
||||||
if (this.rollData.bmDice == 0 ) {
|
if (this.rollData.bmDice == 0) {
|
||||||
$('#roll-nbdice').val( "2" )
|
$('#roll-nbdice').val("2")
|
||||||
} else {
|
} else {
|
||||||
let letter = (this.rollData.bmDice > 0) ? "B" : "M"
|
let letter = (this.rollData.bmDice > 0) ? "B" : "M"
|
||||||
$('#roll-nbdice').val( "2 + " + String(Math.abs(this.rollData.bmDice)) + letter )
|
$('#roll-nbdice').val("2 + " + String(Math.abs(this.rollData.bmDice)) + letter)
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#roll-modifier').val( this.rollData.attrValue + "+" + this.rollData.aptValue + "+" + this.rollData.careerBonus + "+" + this.rollData.mod + "+" +
|
$('#roll-modifier').val(this.rollData.attrValue + "+" + this.rollData.aptValue + "+" + this.rollData.careerBonus + "+" + this.rollData.mod + "+" +
|
||||||
this.rollData.modRanged + "+" + this.rollData.weaponModifier + "-" + this.rollData.defence + "-" + this.rollData.modArmorMalus + "-" +
|
this.rollData.modRanged + "+" + this.rollData.weaponModifier + "-" + this.rollData.defence + "-" + this.rollData.modArmorMalus + "-" +
|
||||||
this.rollData.shieldMalus + "+" + this.rollData.attackModifier )
|
this.rollData.shieldMalus + "+" + this.rollData.attackModifier + "+" + this.rollData.appliedArmorMalus)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static preProcessFightOption( rollData) {
|
static preProcessFightOption(rollData) {
|
||||||
rollData.damagesIgnoresArmor = false // Always reset flags
|
rollData.damagesIgnoresArmor = false // Always reset flags
|
||||||
rollData.modArmorMalus = 0
|
rollData.modArmorMalus = 0
|
||||||
rollData.attackModifier = 0
|
rollData.attackModifier = 0
|
||||||
|
|
||||||
let fgItem = rollData.fightOption
|
let fgItem = rollData.fightOption
|
||||||
if (fgItem ) {
|
if (fgItem) {
|
||||||
console.log(fgItem)
|
console.log(fgItem)
|
||||||
if (fgItem.data.properties.fightoptiontype == "armordefault") {
|
if (fgItem.data.properties.fightoptiontype == "armordefault") {
|
||||||
rollData.modArmorMalus = rollData.armorMalus // Activate the armor malus
|
rollData.modArmorMalus = rollData.armorMalus // Activate the armor malus
|
||||||
@ -214,16 +229,37 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
static updateArmorMalus(rollData) {
|
||||||
|
rollData.appliedArmorMalus = 0
|
||||||
|
if (rollData.attribute.key == "agility") {
|
||||||
|
$("#armor-agi-malus").show()
|
||||||
|
rollData.appliedArmorMalus += rollData.armorAgiMalus
|
||||||
|
} else {
|
||||||
|
$("#armor-agi-malus").hide()
|
||||||
|
}
|
||||||
|
if (rollData.aptitude && rollData.aptitude.key == "init") {
|
||||||
|
$("#armor-init-malus").show()
|
||||||
|
rollData.appliedArmorMalus += rollData.armorInitMalus
|
||||||
|
} else {
|
||||||
|
$("#armor-init-malus").hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------ -------------- */
|
||||||
|
static updatePPCost(rollData) {
|
||||||
|
$('#ppcost').html(rollData.ppCost + " + Armor(" + rollData.ppCostArmor + ")=" + Number(rollData.ppCost + rollData.ppCostArmor))
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------ -------------- */
|
||||||
static rollDialogListener(html) {
|
static rollDialogListener(html) {
|
||||||
|
|
||||||
this.updateTotalDice()
|
this.updateTotalDice()
|
||||||
|
|
||||||
html.find('#optcond').change((event) => { // Dynamic change of PP cost of spell
|
html.find('#optcond').change((event) => { // Dynamic change of PP cost of spell
|
||||||
let pp = BoLUtility.computeSpellCost(this.rollData.spell, event.currentTarget.selectedOptions.length)
|
let pp = BoLUtility.computeSpellCost(this.rollData.spell, event.currentTarget.selectedOptions.length)
|
||||||
$('#ppcost').html(pp)
|
|
||||||
this.rollData.ppCost = pp
|
this.rollData.ppCost = pp
|
||||||
|
this.updatePPCost( this.rollData)
|
||||||
})
|
})
|
||||||
|
|
||||||
html.find('#mod').change((event) => {
|
html.find('#mod').change((event) => {
|
||||||
@ -240,15 +276,15 @@ export class BoLRoll {
|
|||||||
this.rollData.attribute = duplicate(this.rollData.actor.data.data.attributes[attrKey])
|
this.rollData.attribute = duplicate(this.rollData.actor.data.data.attributes[attrKey])
|
||||||
this.rollData.attrValue = this.rollData.actor.data.data.attributes[attrKey].value
|
this.rollData.attrValue = this.rollData.actor.data.data.attributes[attrKey].value
|
||||||
this.updateTotalDice()
|
this.updateTotalDice()
|
||||||
} )
|
})
|
||||||
html.find('#apt').change((event) => {
|
html.find('#apt').change((event) => {
|
||||||
let aptKey = event.currentTarget.value
|
let aptKey = event.currentTarget.value
|
||||||
this.rollData.aptitude = duplicate(this.rollData.actor.data.data.aptitudes[aptKey])
|
this.rollData.aptitude = duplicate(this.rollData.actor.data.data.aptitudes[aptKey])
|
||||||
this.rollData.aptValue = this.rollData.actor.data.data.aptitudes[aptKey].value
|
this.rollData.aptValue = this.rollData.actor.data.data.aptitudes[aptKey].value
|
||||||
this.updateTotalDice()
|
this.updateTotalDice()
|
||||||
} )
|
})
|
||||||
|
|
||||||
html.find('#applyShieldMalus').click( (event) => {
|
html.find('#applyShieldMalus').click((event) => {
|
||||||
if (event.currentTarget.checked) {
|
if (event.currentTarget.checked) {
|
||||||
this.rollData.shieldMalus = this.rollData.shieldAttackMalus
|
this.rollData.shieldMalus = this.rollData.shieldAttackMalus
|
||||||
} else {
|
} else {
|
||||||
@ -284,7 +320,7 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static preProcessWeapon( rollData) {
|
static preProcessWeapon(rollData) {
|
||||||
if (rollData.mode == "weapon") {
|
if (rollData.mode == "weapon") {
|
||||||
rollData.weaponModifier = rollData.weapon.data.data.properties.attackModifiers ?? 0;
|
rollData.weaponModifier = rollData.weapon.data.data.properties.attackModifiers ?? 0;
|
||||||
rollData.attackBonusDice = rollData.weapon.data.data.properties.attackBonusDice
|
rollData.attackBonusDice = rollData.weapon.data.data.properties.attackBonusDice
|
||||||
@ -334,6 +370,8 @@ export class BoLRoll {
|
|||||||
// Specific stuff
|
// Specific stuff
|
||||||
this.preProcessWeapon(rollData)
|
this.preProcessWeapon(rollData)
|
||||||
this.preProcessFightOption(rollData)
|
this.preProcessFightOption(rollData)
|
||||||
|
this.updateArmorMalus(rollData)
|
||||||
|
this.updatePPCost(rollData)
|
||||||
// Save
|
// Save
|
||||||
this.rollData = rollData
|
this.rollData = rollData
|
||||||
console.log("ROLLDATA", rollData)
|
console.log("ROLLDATA", rollData)
|
||||||
@ -366,7 +404,7 @@ export class BoLRoll {
|
|||||||
const isMalus = rollData.mDice > 0
|
const isMalus = rollData.mDice > 0
|
||||||
rollData.nbDice += (rollData.attackBonusDice) ? 1 : 0
|
rollData.nbDice += (rollData.attackBonusDice) ? 1 : 0
|
||||||
|
|
||||||
const modifiers = rollData.attrValue + rollData.aptValue + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier
|
const modifiers = rollData.attrValue + rollData.aptValue + rollData.careerBonus + rollData.mod + rollData.weaponModifier - rollData.defence - rollData.modArmorMalus + rollData.shieldMalus + rollData.attackModifier + rollData.appliedArmorMalus
|
||||||
const formula = (isMalus) ? rollData.nbDice + "d6kl2 + " + modifiers : rollData.nbDice + "d6kh2 + " + modifiers
|
const formula = (isMalus) ? rollData.nbDice + "d6kl2 + " + modifiers : rollData.nbDice + "d6kh2 + " + modifiers
|
||||||
rollData.formula = formula
|
rollData.formula = formula
|
||||||
rollData.modifiers = modifiers
|
rollData.modifiers = modifiers
|
||||||
@ -384,6 +422,7 @@ export class BoLRoll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
export class BoLDefaultRoll {
|
export class BoLDefaultRoll {
|
||||||
|
|
||||||
constructor(rollData) {
|
constructor(rollData) {
|
||||||
@ -404,6 +443,7 @@ export class BoLDefaultRoll {
|
|||||||
this.rollData.applyId = randomID(16)
|
this.rollData.applyId = randomID(16)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async roll() {
|
async roll() {
|
||||||
|
|
||||||
const r = new Roll(this.rollData.formula)
|
const r = new Roll(this.rollData.formula)
|
||||||
@ -425,7 +465,7 @@ export class BoLDefaultRoll {
|
|||||||
this.rollData.actor.registerInit(r.total, this.rollData.isCritical, this.rollData.isFumble)
|
this.rollData.actor.registerInit(r.total, this.rollData.isCritical, this.rollData.isFumble)
|
||||||
}
|
}
|
||||||
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
|
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
|
||||||
this.rollData.actor.spendPowerPoint(this.rollData.ppCost)
|
this.rollData.actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)
|
||||||
}
|
}
|
||||||
if (this.rollData.mode == "alchemy") { // PP cost management
|
if (this.rollData.mode == "alchemy") { // PP cost management
|
||||||
this.rollData.actor.resetAlchemyStatus(this.rollData.alchemy.id)
|
this.rollData.actor.resetAlchemyStatus(this.rollData.alchemy.id)
|
||||||
@ -434,6 +474,7 @@ export class BoLDefaultRoll {
|
|||||||
await this.sendChatMessage()
|
await this.sendChatMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async sendChatMessage() {
|
async sendChatMessage() {
|
||||||
this._buildChatMessage(this.rollData).then(msgFlavor => {
|
this._buildChatMessage(this.rollData).then(msgFlavor => {
|
||||||
this.rollData.roll.toMessage({
|
this.rollData.roll.toMessage({
|
||||||
@ -445,6 +486,7 @@ export class BoLDefaultRoll {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
upgradeToCritical() {
|
upgradeToCritical() {
|
||||||
// Force to Critical roll
|
// Force to Critical roll
|
||||||
this.rollData.isCritical = true
|
this.rollData.isCritical = true
|
||||||
@ -457,10 +499,12 @@ export class BoLDefaultRoll {
|
|||||||
this.sendChatMessage()
|
this.sendChatMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
setSuccess(flag) {
|
setSuccess(flag) {
|
||||||
this.rollData.isSuccess = flag
|
this.rollData.isSuccess = flag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async sendDamageMessage() {
|
async sendDamageMessage() {
|
||||||
this._buildDamageChatMessage(this.rollData).then(msgFlavor => {
|
this._buildDamageChatMessage(this.rollData).then(msgFlavor => {
|
||||||
this.rollData.damageRoll.toMessage({
|
this.rollData.damageRoll.toMessage({
|
||||||
@ -472,6 +516,7 @@ export class BoLDefaultRoll {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
getDamageAttributeValue(attrDamage) {
|
getDamageAttributeValue(attrDamage) {
|
||||||
let attrDamageValue = 0
|
let attrDamageValue = 0
|
||||||
if (attrDamage.includes("vigor")) {
|
if (attrDamage.includes("vigor")) {
|
||||||
@ -483,6 +528,7 @@ export class BoLDefaultRoll {
|
|||||||
return attrDamageValue
|
return attrDamageValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
async rollDamage() {
|
async rollDamage() {
|
||||||
if (this.rollData.mode != "weapon") { // Only specific process in Weapon mode
|
if (this.rollData.mode != "weapon") { // Only specific process in Weapon mode
|
||||||
return;
|
return;
|
||||||
@ -498,7 +544,7 @@ export class BoLDefaultRoll {
|
|||||||
bonusDmg = 12
|
bonusDmg = 12
|
||||||
}
|
}
|
||||||
let attrDamageValue = this.getDamageAttributeValue(this.rollData.weapon.data.data.properties.damageAttribute)
|
let attrDamageValue = this.getDamageAttributeValue(this.rollData.weapon.data.data.properties.damageAttribute)
|
||||||
let weaponFormula = BoLUtility.getDamageFormula(this.rollData.weapon.data.data, this.rollData.fightOption )
|
let weaponFormula = BoLUtility.getDamageFormula(this.rollData.weapon.data.data, this.rollData.fightOption)
|
||||||
|
|
||||||
let damageFormula = weaponFormula + "+" + bonusDmg + "+" + attrDamageValue
|
let damageFormula = weaponFormula + "+" + bonusDmg + "+" + attrDamageValue
|
||||||
console.log("DAMAGE !!!", damageFormula, attrDamageValue, this.rollData)
|
console.log("DAMAGE !!!", damageFormula, attrDamageValue, this.rollData)
|
||||||
@ -514,11 +560,13 @@ export class BoLDefaultRoll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
_buildDamageChatMessage(rollData) {
|
_buildDamageChatMessage(rollData) {
|
||||||
const rollMessageTpl = 'systems/bol/templates/chat/rolls/damage-roll-card.hbs';
|
const rollMessageTpl = 'systems/bol/templates/chat/rolls/damage-roll-card.hbs';
|
||||||
return renderTemplate(rollMessageTpl, rollData)
|
return renderTemplate(rollMessageTpl, rollData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
_buildChatMessage(rollData) {
|
_buildChatMessage(rollData) {
|
||||||
const rollMessageTpl = 'systems/bol/templates/chat/rolls/default-roll-card.hbs';
|
const rollMessageTpl = 'systems/bol/templates/chat/rolls/default-roll-card.hbs';
|
||||||
return renderTemplate(rollMessageTpl, rollData);
|
return renderTemplate(rollMessageTpl, rollData);
|
||||||
|
@ -190,10 +190,11 @@ export class BoLUtility {
|
|||||||
});
|
});
|
||||||
|
|
||||||
html.on("click", '.damage-handling', event => {
|
html.on("click", '.damage-handling', event => {
|
||||||
event.preventDefault();
|
event.preventDefault()
|
||||||
let attackId = event.currentTarget.attributes['data-attack-id'].value;
|
let attackId = event.currentTarget.attributes['data-attack-id'].value
|
||||||
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value;
|
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value
|
||||||
let weaponId = (event.currentTarget.attributes['data-weapon-id']) ? event.currentTarget.attributes['data-weapon-id'].value : -1
|
let weaponId = (event.currentTarget.attributes['data-weapon-id']) ? event.currentTarget.attributes['data-weapon-id'].value : -1
|
||||||
|
console.log("Process handling !!! -> socket emit")
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
BoLUtility.processDamageHandling(event, attackId, defenseMode, weaponId)
|
BoLUtility.processDamageHandling(event, attackId, defenseMode, weaponId)
|
||||||
} else {
|
} else {
|
||||||
@ -209,7 +210,7 @@ export class BoLUtility {
|
|||||||
}
|
}
|
||||||
BoLUtility.removeChatMessageId(BoLUtility.findChatMessageId(event.currentTarget));
|
BoLUtility.removeChatMessageId(BoLUtility.findChatMessageId(event.currentTarget));
|
||||||
|
|
||||||
//console.log("Damage Handling", event, attackId, defenseMode, weaponId)
|
console.log("Damage Handling", event, attackId, defenseMode, weaponId)
|
||||||
// Only GM process this
|
// Only GM process this
|
||||||
let attackDef = this.attackStore[attackId]
|
let attackDef = this.attackStore[attackId]
|
||||||
if (attackDef) {
|
if (attackDef) {
|
||||||
@ -365,6 +366,7 @@ export class BoLUtility {
|
|||||||
BoLUtility.processAttackSuccess(sockmsg.data);
|
BoLUtility.processAttackSuccess(sockmsg.data);
|
||||||
}
|
}
|
||||||
if (sockmsg.name == "msg_damage_handling") {
|
if (sockmsg.name == "msg_damage_handling") {
|
||||||
|
console.log("Msg received !!!!")
|
||||||
BoLUtility.processDamageHandling(sockmsg.data.event, sockmsg.data.attackId, sockmsg.data.defenseMode)
|
BoLUtility.processDamageHandling(sockmsg.data.event, sockmsg.data.attackId, sockmsg.data.defenseMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow box-roll">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="attr">{{localize 'BOL.ui.attribute'}}</label>
|
<label for="attr">{{localize 'BOL.ui.attribute'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if (count boons)}}
|
{{#if (count boons)}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.boons'}}</label>
|
<label for="mod">{{localize 'BOL.ui.boons'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if careers}}
|
{{#if careers}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.careers'}}</label>
|
<label for="mod">{{localize 'BOL.ui.careers'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if fightOption}}
|
{{#if fightOption}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="fg">{{localize 'BOL.ui.fightOption'}}</label>
|
<label for="fg">{{localize 'BOL.ui.fightOption'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if (count flaws)}}
|
{{#if (count flaws)}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.flaws'}}</label>
|
<label for="mod">{{localize 'BOL.ui.flaws'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{#if isRanged}}
|
{{#if isRanged}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="modRanged">{{localize 'BOL.ui.rangeModifiers'}}</label>
|
<label for="modRanged">{{localize 'BOL.ui.rangeModifiers'}}</label>
|
||||||
</div>
|
</div>
|
||||||
@ -19,7 +19,25 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box hide" id="armor-agi-malus">
|
||||||
|
<div class="flex1 center bg-darkred">
|
||||||
|
<label for="mod">{{localize 'BOL.ui.armorAgiMalus'}}</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex1 center cell">
|
||||||
|
<label>{{armorAgiMalus}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flexrow roll-box hide" id="armor-init-malus">
|
||||||
|
<div class="flex1 center bg-darkred">
|
||||||
|
<label for="mod">{{localize 'BOL.ui.armorInitMalus'}}</label>
|
||||||
|
</div>
|
||||||
|
<div class="flex1 center cell">
|
||||||
|
<label>{{armorInitMalus}}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.modifiers'}}</label>
|
<label for="mod">{{localize 'BOL.ui.modifiers'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,41 +10,43 @@
|
|||||||
|
|
||||||
{{> "systems/bol/templates/dialogs/attribute-roll-part.hbs"}}
|
{{> "systems/bol/templates/dialogs/attribute-roll-part.hbs"}}
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box">
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.sorcererRank'}}</label>
|
<label for="mod">{{localize 'BOL.ui.sorcererRank'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">{{careerBonus}}</div>
|
<div class="flex1 center cell">{{careerBonus}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.ppcost'}}</label>
|
<label for="mod">{{localize 'BOL.ui.ppcost'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell" id="ppcost">{{ppCost}}</div>
|
<div class="flex1 center cell" id="ppcost">{{ppCost}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.ppAvailable'}}</label>
|
<label for="mod">{{localize 'BOL.ui.ppAvailable'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">{{ppCurrent}}</div>
|
<div class="flex1 center cell">{{ppCurrent}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.mandatoryconditions'}}</label>
|
<label for="mod">{{localize 'BOL.ui.mandatoryconditions'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">
|
<div class="flex1 center cell">
|
||||||
|
<ul class="no-bullets">
|
||||||
{{#each spell.data.data.properties.mandatoryconditions as | cond idx|}}
|
{{#each spell.data.data.properties.mandatoryconditions as | cond idx|}}
|
||||||
{{#if (lt idx @root.spell.data.data.properties.nbmandatoryconditions)}}
|
{{#if (lt idx @root.spell.data.data.properties.nbmandatoryconditions)}}
|
||||||
<label for="mod">{{cond}}</label>
|
<li><label for="mod">{{cond}}</label></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.optionnalconditions'}}</label>
|
<label for="mod">{{localize 'BOL.ui.optionnalconditions'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.nbdices'}}</label>
|
<label for="mod">{{localize 'BOL.ui.nbdices'}}</label>
|
||||||
</div>
|
</div>
|
||||||
@ -6,7 +6,7 @@
|
|||||||
<input class="flex1" type="text" id="roll-nbdice" value="2" disabled>
|
<input class="flex1" type="text" id="roll-nbdice" value="2" disabled>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.totalmod'}}</label>
|
<label for="mod">{{localize 'BOL.ui.totalmod'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
{{> "systems/bol/templates/dialogs/aptitude-roll-part.hbs"}}
|
{{> "systems/bol/templates/dialogs/aptitude-roll-part.hbs"}}
|
||||||
|
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.targetDefence'}}</label>
|
<label for="mod">{{localize 'BOL.ui.targetDefence'}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex1 center cell">{{defence}}</div>
|
<div class="flex1 center cell">{{defence}}</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if (eq shieldBlock 'blockall')}}
|
{{#if (eq shieldBlock 'blockall')}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
|
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
|
||||||
</div>
|
</div>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (eq shieldBlock 'blockone')}}
|
{{#if (eq shieldBlock 'blockone')}}
|
||||||
<div class="flexrow" style="margin-bottom: 1px;">
|
<div class="flexrow roll-box" >
|
||||||
<div class="flex1 center bg-darkred">
|
<div class="flex1 center bg-darkred">
|
||||||
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
|
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="property-label">{{localize "BOL.itemModifiers.init"}}</label>
|
<label class="property-label">{{localize "BOL.itemModifiers.init"}}</label>
|
||||||
<div class="form-fields">
|
<div class="form-fields">
|
||||||
<input class="field-value" type="text" name="data.properties.modifiers.init" value="{{data.properties.modifiers.init}}" data-dtype="Number"/>
|
<input class="field-value" type="text" name="data.properties.modifiers.init" value="{{data.properties.modifiers.c}}" data-dtype="Number"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user