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);
|
||||
overflow: hidden;
|
||||
}
|
||||
.roll-box {
|
||||
border-width: 1px;
|
||||
border-color: #000000;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
ul.no-bullets {
|
||||
list-style-type: none; /* Remove bullets */
|
||||
padding: 0; /* Remove padding */
|
||||
margin: 0; /* Remove margins */
|
||||
}
|
||||
.ellipsis {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
|
@ -148,6 +148,8 @@
|
||||
"BOL.ui.status": "Status",
|
||||
"BOL.ui.toactivated": "Active (>Désactiver)",
|
||||
"BOL.ui.todeactivated": "Inactive (>Activer)",
|
||||
"BOL.ui.armorAgiMalus": "Armor+Shield Malus (Agi)",
|
||||
"BOL.ui.armorInitMalus": "Armor Malus (Init)",
|
||||
|
||||
"BOL.featureCategory.origins": "Origines",
|
||||
"BOL.featureCategory.races": "Races",
|
||||
|
@ -150,6 +150,8 @@
|
||||
"BOL.ui.toactivated": "Active (>Désactiver)",
|
||||
"BOL.ui.todeactivated": "Inactive (>Activer)",
|
||||
"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.races": "Races",
|
||||
|
@ -172,7 +172,7 @@ export class BoLActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/*-------------------------------------------- */
|
||||
get armorMalusValue() { // used for Fight Options
|
||||
for (let armor of this.armors) {
|
||||
if (armor.data.properties.armorQuality.includes("light")) {
|
||||
@ -290,12 +290,52 @@ export class BoLActor extends Actor {
|
||||
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) {
|
||||
let newPP = this.data.data.resources.power.value - ppCost
|
||||
newPP = (newPP < 0) ? 0 : newPP
|
||||
this.update({ 'data.resources.power.value': newPP })
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
resetAlchemyStatus(alchemyId) {
|
||||
let alchemy = this.data.items.get(alchemyId)
|
||||
if (alchemy) {
|
||||
@ -303,6 +343,7 @@ export class BoLActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
async spendAlchemyPoint(alchemyId, pcCost) {
|
||||
let alchemy = this.data.items.get(alchemyId)
|
||||
if (alchemy) {
|
||||
@ -456,14 +497,14 @@ export class BoLActor extends Actor {
|
||||
/*-------------------------------------------- */
|
||||
buildRollList() {
|
||||
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]
|
||||
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) {
|
||||
if ( key != "def") {
|
||||
for (let key in this.data.data.aptitudes) {
|
||||
if (key != "def") {
|
||||
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
|
||||
|
@ -4,7 +4,7 @@ const _apt2attr = { init: "mind", melee: "agility", ranged: "agility", def: "vig
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class BoLRoll {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static options() {
|
||||
return { classes: ["bol", "dialog"], width: 480, height: 540 };
|
||||
@ -14,9 +14,9 @@ export class BoLRoll {
|
||||
static getDefaultAttribute(key) {
|
||||
return _apt2attr[key]
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static attributeCheck(actor, key ) {
|
||||
static attributeCheck(actor, key) {
|
||||
|
||||
let attribute = eval(`actor.data.data.attributes.${key}`)
|
||||
let label = (attribute.label) ? game.i18n.localize(attribute.label) : null
|
||||
@ -31,13 +31,15 @@ export class BoLRoll {
|
||||
label: label,
|
||||
careerBonus: 0,
|
||||
description: description,
|
||||
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||
armorInitMalus: actor.getArmorAgiMalus(),
|
||||
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 attrKey = this.getDefaultAttribute(key)
|
||||
@ -53,6 +55,8 @@ export class BoLRoll {
|
||||
aptitude: aptitude,
|
||||
attrValue: attribute.value,
|
||||
aptValue: aptitude.value,
|
||||
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||
armorInitMalus: actor.getArmorAgiMalus(),
|
||||
label: label,
|
||||
careerBonus: 0,
|
||||
description: description,
|
||||
@ -62,16 +66,16 @@ export class BoLRoll {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static weaponCheckWithWeapon(actor, weapon) {
|
||||
|
||||
|
||||
let target = BoLUtility.getTarget()
|
||||
|
||||
|
||||
let weaponData = weapon.data.data
|
||||
let attribute = eval(`actor.data.data.attributes.${weaponData.properties.attackAttribute}`)
|
||||
let attribute = eval(`actor.data.data.attributes.${weaponData.properties.attackAttribute}`)
|
||||
let aptitude = eval(`actor.data.data.aptitudes.${weaponData.properties.attackAptitude}`)
|
||||
|
||||
|
||||
// Manage specific case
|
||||
let fightOption= actor.getActiveFightOption()
|
||||
if ( fightOption && fightOption.data.fightoptiontype == "fulldefense") {
|
||||
let fightOption = actor.getActiveFightOption()
|
||||
if (fightOption && fightOption.data.fightoptiontype == "fulldefense") {
|
||||
ui.notifications.warn(`{{actor.name}} est en Défense Totale ! Il ne peut pas attaquer ce round.`)
|
||||
return
|
||||
}
|
||||
@ -89,6 +93,8 @@ export class BoLRoll {
|
||||
aptitude: aptitude,
|
||||
attrValue: attribute.value,
|
||||
aptValue: aptitude.value,
|
||||
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||
armorInitMalus: actor.getArmorAgiMalus(),
|
||||
mod: 0,
|
||||
modRanged: 0,
|
||||
label: (weapon.name) ? weapon.name : game.i18n.localize('BOL.ui.noWeaponName'),
|
||||
@ -132,6 +138,8 @@ export class BoLRoll {
|
||||
pcCost: Number(alchemyData.properties.pccost),
|
||||
pcCostCurrent: Number(alchemyData.properties.pccurrent),
|
||||
mod: Number(alchemyData.properties.difficulty),
|
||||
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||
armorInitMalus: actor.getArmorAgiMalus(),
|
||||
label: alchemy.name,
|
||||
description: game.i18n.localize('BOL.ui.makeAlchemy') + "+" + alchemy.name,
|
||||
}
|
||||
@ -162,8 +170,11 @@ export class BoLRoll {
|
||||
aptValue: 0,
|
||||
ppCurrent: Number(actor.data.data.resources.power.value),
|
||||
careerBonus: actor.getSorcererBonus(),
|
||||
ppCostArmor: actor.getPPCostArmor(),
|
||||
ppCost: Number(spell.data.data.properties.ppcost),
|
||||
mod: Number(spellData.properties.difficulty),
|
||||
armorAgiMalus: actor.getArmorAgiMalus(),
|
||||
armorInitMalus: actor.getArmorAgiMalus(),
|
||||
label: spell.name,
|
||||
description: game.i18n.localize('BOL.ui.focusSpell') + " : " + spell.name,
|
||||
}
|
||||
@ -173,28 +184,32 @@ export class BoLRoll {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateTotalDice() {
|
||||
this.rollData.bmDice = this.rollData.nbBoons - this.rollData.nbFlaws + this.rollData.bDice - this.rollData.mDice
|
||||
|
||||
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.nbDice = 2 + Math.abs(this.rollData.bmDice)
|
||||
if (this.rollData.bmDice == 0 ) {
|
||||
$('#roll-nbdice').val( "2" )
|
||||
} else {
|
||||
let letter = (this.rollData.bmDice > 0) ? "B" : "M"
|
||||
$('#roll-nbdice').val( "2 + " + String(Math.abs(this.rollData.bmDice)) + letter )
|
||||
if (this.rollData.bmDice == 0) {
|
||||
$('#roll-nbdice').val("2")
|
||||
} else {
|
||||
let letter = (this.rollData.bmDice > 0) ? "B" : "M"
|
||||
$('#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 + "+" +
|
||||
this.rollData.modRanged + "+" + this.rollData.weaponModifier + "-" + this.rollData.defence + "-" + this.rollData.modArmorMalus + "-" +
|
||||
this.rollData.shieldMalus + "+" + this.rollData.attackModifier )
|
||||
$('#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.shieldMalus + "+" + this.rollData.attackModifier + "+" + this.rollData.appliedArmorMalus)
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static preProcessFightOption( rollData) {
|
||||
static preProcessFightOption(rollData) {
|
||||
rollData.damagesIgnoresArmor = false // Always reset flags
|
||||
rollData.modArmorMalus = 0
|
||||
rollData.attackModifier = 0
|
||||
|
||||
let fgItem = rollData.fightOption
|
||||
if (fgItem ) {
|
||||
if (fgItem) {
|
||||
console.log(fgItem)
|
||||
if (fgItem.data.properties.fightoptiontype == "armordefault") {
|
||||
rollData.modArmorMalus = rollData.armorMalus // Activate the armor malus
|
||||
@ -214,41 +229,62 @@ 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) {
|
||||
|
||||
|
||||
this.updateTotalDice()
|
||||
|
||||
|
||||
html.find('#optcond').change((event) => { // Dynamic change of PP cost of spell
|
||||
let pp = BoLUtility.computeSpellCost(this.rollData.spell, event.currentTarget.selectedOptions.length)
|
||||
$('#ppcost').html(pp)
|
||||
this.rollData.ppCost = pp
|
||||
this.updatePPCost( this.rollData)
|
||||
})
|
||||
|
||||
html.find('#mod').change((event) => {
|
||||
this.rollData.mod = Number(event.currentTarget.value)
|
||||
this.rollData.mod = Number(event.currentTarget.value)
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('#modRanged').change((event) => {
|
||||
this.rollData.modRanged = Number(event.currentTarget.value)
|
||||
this.rollData.modRanged = Number(event.currentTarget.value)
|
||||
this.updateTotalDice()
|
||||
})
|
||||
|
||||
html.find('#attr').change((event) => {
|
||||
html.find('#attr').change((event) => {
|
||||
let attrKey = event.currentTarget.value
|
||||
this.rollData.attribute = duplicate(this.rollData.actor.data.data.attributes[attrKey])
|
||||
this.rollData.attrValue = this.rollData.actor.data.data.attributes[attrKey].value
|
||||
this.updateTotalDice()
|
||||
} )
|
||||
html.find('#apt').change((event) => {
|
||||
})
|
||||
html.find('#apt').change((event) => {
|
||||
let aptKey = event.currentTarget.value
|
||||
this.rollData.aptitude = duplicate(this.rollData.actor.data.data.aptitudes[aptKey])
|
||||
this.rollData.aptValue = this.rollData.actor.data.data.aptitudes[aptKey].value
|
||||
this.updateTotalDice()
|
||||
} )
|
||||
})
|
||||
|
||||
html.find('#applyShieldMalus').click( (event) => {
|
||||
html.find('#applyShieldMalus').click((event) => {
|
||||
if (event.currentTarget.checked) {
|
||||
this.rollData.shieldMalus = this.rollData.shieldAttackMalus
|
||||
} else {
|
||||
@ -256,35 +292,35 @@ export class BoLRoll {
|
||||
}
|
||||
})
|
||||
|
||||
html.find('#career').change((event) => {
|
||||
html.find('#career').change((event) => {
|
||||
let careers = $('#career').val()
|
||||
this.rollData.careerBonus = (!careers || careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i)))
|
||||
this.rollData.careerBonus = (!careers || careers.length == 0) ? 0 : Math.max(...careers.map(i => parseInt(i)))
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('#boon').change((event) => {
|
||||
html.find('#boon').change((event) => {
|
||||
let boons = $('#boon').val()
|
||||
this.rollData.nbBoons = (!boons || boons.length == 0) ? 0 : Math.max(...boons.map(i => parseInt(i)))
|
||||
this.rollData.nbBoons = (!boons || boons.length == 0) ? 0 : Math.max(...boons.map(i => parseInt(i)))
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('#flaw').change((event) => {
|
||||
html.find('#flaw').change((event) => {
|
||||
let flaws = $('#flaw').val()
|
||||
this.rollData.nbFlaws = (!flaws || flaws.length == 0) ? 0 : Math.max(...flaws.map(i => parseInt(i)))
|
||||
this.rollData.nbFlaws = (!flaws || flaws.length == 0) ? 0 : Math.max(...flaws.map(i => parseInt(i)))
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('.bdice').click((event) => {
|
||||
this.rollData.mDice = 0
|
||||
this.rollData.bDice = Number(event.currentTarget.value)
|
||||
this.rollData.bDice = Number(event.currentTarget.value)
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('.mdice').click((event) => {
|
||||
html.find('.mdice').click((event) => {
|
||||
this.rollData.bDice = 0
|
||||
this.rollData.mDice = Number(event.currentTarget.value)
|
||||
this.rollData.mDice = Number(event.currentTarget.value)
|
||||
this.updateTotalDice()
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static preProcessWeapon( rollData) {
|
||||
static preProcessWeapon(rollData) {
|
||||
if (rollData.mode == "weapon") {
|
||||
rollData.weaponModifier = rollData.weapon.data.data.properties.attackModifiers ?? 0;
|
||||
rollData.attackBonusDice = rollData.weapon.data.data.properties.attackBonusDice
|
||||
@ -314,11 +350,11 @@ export class BoLRoll {
|
||||
rollData.defence = 0
|
||||
rollData.attackModifier = 0 // Used for fight options
|
||||
rollData.modArmorMalus = 0 // Used for fight options
|
||||
rollData.bDice = 0
|
||||
rollData.mDice = 0
|
||||
rollData.bDice = 0
|
||||
rollData.mDice = 0
|
||||
rollData.nbBoons = 0
|
||||
rollData.nbFlaws = 0
|
||||
rollData.nbDice = 0
|
||||
rollData.nbDice = 0
|
||||
if (rollData.shieldBlock == 'blockall') {
|
||||
rollData.shieldMalus = rollData.shieldAttackMalus;
|
||||
} else {
|
||||
@ -334,6 +370,8 @@ export class BoLRoll {
|
||||
// Specific stuff
|
||||
this.preProcessWeapon(rollData)
|
||||
this.preProcessFightOption(rollData)
|
||||
this.updateArmorMalus(rollData)
|
||||
this.updatePPCost(rollData)
|
||||
// Save
|
||||
this.rollData = rollData
|
||||
console.log("ROLLDATA", rollData)
|
||||
@ -360,13 +398,13 @@ export class BoLRoll {
|
||||
ui.notifications.warn("Pas assez de Points de Pouvoir !")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
rollData.registerInit = (rollData.aptitude && rollData.aptitude.key == 'init') ? $('#register-init').is(":checked") : false;
|
||||
|
||||
const isMalus = rollData.mDice > 0
|
||||
const isMalus = rollData.mDice > 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
|
||||
rollData.formula = formula
|
||||
rollData.modifiers = modifiers
|
||||
@ -384,6 +422,7 @@ export class BoLRoll {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class BoLDefaultRoll {
|
||||
|
||||
constructor(rollData) {
|
||||
@ -404,6 +443,7 @@ export class BoLDefaultRoll {
|
||||
this.rollData.applyId = randomID(16)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async roll() {
|
||||
|
||||
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)
|
||||
}
|
||||
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
|
||||
this.rollData.actor.resetAlchemyStatus(this.rollData.alchemy.id)
|
||||
@ -434,6 +474,7 @@ export class BoLDefaultRoll {
|
||||
await this.sendChatMessage()
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async sendChatMessage() {
|
||||
this._buildChatMessage(this.rollData).then(msgFlavor => {
|
||||
this.rollData.roll.toMessage({
|
||||
@ -445,6 +486,7 @@ export class BoLDefaultRoll {
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
upgradeToCritical() {
|
||||
// Force to Critical roll
|
||||
this.rollData.isCritical = true
|
||||
@ -457,10 +499,12 @@ export class BoLDefaultRoll {
|
||||
this.sendChatMessage()
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
setSuccess(flag) {
|
||||
this.rollData.isSuccess = flag
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async sendDamageMessage() {
|
||||
this._buildDamageChatMessage(this.rollData).then(msgFlavor => {
|
||||
this.rollData.damageRoll.toMessage({
|
||||
@ -472,6 +516,7 @@ export class BoLDefaultRoll {
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDamageAttributeValue(attrDamage) {
|
||||
let attrDamageValue = 0
|
||||
if (attrDamage.includes("vigor")) {
|
||||
@ -483,6 +528,7 @@ export class BoLDefaultRoll {
|
||||
return attrDamageValue
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollDamage() {
|
||||
if (this.rollData.mode != "weapon") { // Only specific process in Weapon mode
|
||||
return;
|
||||
@ -498,7 +544,7 @@ export class BoLDefaultRoll {
|
||||
bonusDmg = 12
|
||||
}
|
||||
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
|
||||
console.log("DAMAGE !!!", damageFormula, attrDamageValue, this.rollData)
|
||||
@ -514,11 +560,13 @@ export class BoLDefaultRoll {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_buildDamageChatMessage(rollData) {
|
||||
const rollMessageTpl = 'systems/bol/templates/chat/rolls/damage-roll-card.hbs';
|
||||
return renderTemplate(rollMessageTpl, rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_buildChatMessage(rollData) {
|
||||
const rollMessageTpl = 'systems/bol/templates/chat/rolls/default-roll-card.hbs';
|
||||
return renderTemplate(rollMessageTpl, rollData);
|
||||
|
@ -190,10 +190,11 @@ export class BoLUtility {
|
||||
});
|
||||
|
||||
html.on("click", '.damage-handling', event => {
|
||||
event.preventDefault();
|
||||
let attackId = event.currentTarget.attributes['data-attack-id'].value;
|
||||
let defenseMode = event.currentTarget.attributes['data-defense-mode'].value;
|
||||
event.preventDefault()
|
||||
let attackId = event.currentTarget.attributes['data-attack-id'].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
|
||||
console.log("Process handling !!! -> socket emit")
|
||||
if (game.user.isGM) {
|
||||
BoLUtility.processDamageHandling(event, attackId, defenseMode, weaponId)
|
||||
} else {
|
||||
@ -209,7 +210,7 @@ export class BoLUtility {
|
||||
}
|
||||
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
|
||||
let attackDef = this.attackStore[attackId]
|
||||
if (attackDef) {
|
||||
@ -365,6 +366,7 @@ export class BoLUtility {
|
||||
BoLUtility.processAttackSuccess(sockmsg.data);
|
||||
}
|
||||
if (sockmsg.name == "msg_damage_handling") {
|
||||
console.log("Msg received !!!!")
|
||||
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">
|
||||
<label for="attr">{{localize 'BOL.ui.attribute'}}</label>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{#if (count boons)}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.boons'}}</label>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{#if careers}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box">
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.careers'}}</label>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{#if fightOption}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box">
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="fg">{{localize 'BOL.ui.fightOption'}}</label>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{#if (count flaws)}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box">
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.flaws'}}</label>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
{{#if isRanged}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box">
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="modRanged">{{localize 'BOL.ui.rangeModifiers'}}</label>
|
||||
</div>
|
||||
@ -19,7 +19,25 @@
|
||||
</div>
|
||||
{{/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">
|
||||
<label for="mod">{{localize 'BOL.ui.modifiers'}}</label>
|
||||
</div>
|
||||
|
@ -10,41 +10,43 @@
|
||||
|
||||
{{> "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">
|
||||
<label for="mod">{{localize 'BOL.ui.sorcererRank'}}</label>
|
||||
</div>
|
||||
<div class="flex1 center cell">{{careerBonus}}</div>
|
||||
</div>
|
||||
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.ppcost'}}</label>
|
||||
</div>
|
||||
<div class="flex1 center cell" id="ppcost">{{ppCost}}</div>
|
||||
</div>
|
||||
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.ppAvailable'}}</label>
|
||||
</div>
|
||||
<div class="flex1 center cell">{{ppCurrent}}</div>
|
||||
</div>
|
||||
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.mandatoryconditions'}}</label>
|
||||
</div>
|
||||
<div class="flex1 center cell">
|
||||
<ul class="no-bullets">
|
||||
{{#each spell.data.data.properties.mandatoryconditions as | cond idx|}}
|
||||
{{#if (lt idx @root.spell.data.data.properties.nbmandatoryconditions)}}
|
||||
<label for="mod">{{cond}}</label>
|
||||
<li><label for="mod">{{cond}}</label></li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.optionnalconditions'}}</label>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.nbdices'}}</label>
|
||||
</div>
|
||||
@ -6,7 +6,7 @@
|
||||
<input class="flex1" type="text" id="roll-nbdice" value="2" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.totalmod'}}</label>
|
||||
</div>
|
||||
|
@ -12,14 +12,14 @@
|
||||
|
||||
{{> "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">
|
||||
<label for="mod">{{localize 'BOL.ui.targetDefence'}}</label>
|
||||
</div>
|
||||
<div class="flex1 center cell">{{defence}}</div>
|
||||
</div>
|
||||
{{#if (eq shieldBlock 'blockall')}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
|
||||
</div>
|
||||
@ -27,7 +27,7 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if (eq shieldBlock 'blockone')}}
|
||||
<div class="flexrow" style="margin-bottom: 1px;">
|
||||
<div class="flexrow roll-box" >
|
||||
<div class="flex1 center bg-darkred">
|
||||
<label for="mod">{{localize 'BOL.ui.shieldMalus'}}</label>
|
||||
</div>
|
||||
|
@ -83,7 +83,7 @@
|
||||
<div class="form-group">
|
||||
<label class="property-label">{{localize "BOL.itemModifiers.init"}}</label>
|
||||
<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 class="form-group">
|
||||
|
Loading…
Reference in New Issue
Block a user