Update with minor fixes/updates

This commit is contained in:
2022-07-19 20:51:48 +02:00
parent 2ab1cbe24c
commit a2e0eb213f
11 changed files with 214 additions and 105 deletions

View File

@ -49,11 +49,6 @@ export class PegasusRollDialog extends Dialog {
effect.applied = toggled
let level, genre, idVal, key
if (effect.type == 'hindrance') {
level = effect.value
genre = 'positive'
idVal = "#hindranceDicesLevel"
}
if (effect.type == 'effect') {
let effectData = effect.effect
level = effectData.data.effectlevel
@ -63,15 +58,6 @@ export class PegasusRollDialog extends Dialog {
idVal = "#statDicesLevel"
key = "statLevelBonus"
}
if (effectData.data.otherdice) {
idVal = "#damageDiceLevel"
key = "damageLevelBonus"
}
if (effectData.data.hindrance) {
idVal = "#hindranceDicesLevel"
genre = 'positive' // Dynamic fix
key = "hindranceLevelBonus"
}
}
// Now process the dice level update
if (idVal) {
@ -99,13 +85,10 @@ export class PegasusRollDialog extends Dialog {
}
//console.log("Effect", effect, toggled)
this.rollData.statDicesLevel = Number($('#statDicesLevel').val())
this.rollData.specDicesLevel = Number($('#specDicesLevel').val())
//this.rollData.bonusDicesLevel = Number($('#bonusDicesLevel').val())
//this.rollData.hindranceDicesLevel = Number($('#hindranceDicesLevel').val())
this.rollData.damageDiceLevel = Number($('#damageDiceLevel').val())
PegasusUtility.updateSpecDicePool(this.rollData)
PegasusUtility.updateDamageDicePool(this.rollData)
PegasusUtility.updateEffectsBonusDice(this.rollData)
PegasusUtility.updateHindranceBonusDice(this.rollData)
}
/* -------------------------------------------- */
@ -113,17 +96,9 @@ export class PegasusRollDialog extends Dialog {
let armor = this.rollData.armorsList[armorIdx]
if (armor) {
armor.applied = toggled
if (armor.type == 'other') {
if (toggled) {
this.rollData.otherDicesLevel += Number(armor.value)
} else {
this.rollData.otherDicesLevel -= Number(armor.value)
this.rollData.otherDicesLevel = (this.rollData.otherDicesLevel < 0) ? 0 : this.rollData.otherDicesLevel
}
$("#otherDicesLevel").val(this.rollData.otherDicesLevel)
}
}
console.log("Armor", armorIdx, toggled)
PegasusUtility.updateArmorDicePool(this.rollData)
}
/* -------------------------------------------- */
@ -136,18 +111,9 @@ export class PegasusRollDialog extends Dialog {
this.rollData.weaponName = undefined
}
weapon.applied = toggled
if (weapon.type == 'damage' || weapon.type == 'enhanced') {
if (toggled) {
this.rollData.otherDicesLevel += Number(weapon.value)
} else {
this.rollData.weaponName = undefined
this.rollData.otherDicesLevel -= Number(weapon.value)
this.rollData.otherDicesLevel = (this.rollData.otherDicesLevel < 0) ? 0 : this.rollData.otherDicesLevel
}
$("#otherDicesLevel").val(this.rollData.otherDicesLevel)
}
}
console.log("Weapon", weaponIdx, toggled, this.rollData.otherDicesLevel, weapon)
console.log("Weapon", weaponIdx, toggled, weapon)
PegasusUtility.updateDamageDicePool(this.rollData)
}
/* -------------------------------------------- */
@ -178,7 +144,6 @@ export class PegasusRollDialog extends Dialog {
this.rollData.specDicesLevel = Number($('#specDicesLevel').val())
this.rollData.bonusDicesLevel = Number($('#bonusDicesLevel').val())
this.rollData.hindranceDicesLevel = Number($('#hindranceDicesLevel').val())
this.rollData.damageDiceLevel = Number($('#damageDiceLevel').val())
}
}
@ -221,11 +186,6 @@ export class PegasusRollDialog extends Dialog {
PegasusUtility.updateSpecDicePool(this.rollData)
this.refreshDialog()
});
html.find('#damageDiceLevel').change(async (event) => {
this.rollData.damageDiceLevel = Number(event.currentTarget.value)
PegasusUtility.updateDamageDicePool(this.rollData)
this.refreshDialog()
});
html.find('.effect-clicked').change(async (event) => {
let toggled = event.currentTarget.checked
let effectIdx = $(event.currentTarget).data("effect-idx")
@ -236,11 +196,13 @@ export class PegasusRollDialog extends Dialog {
let toggled = event.currentTarget.checked
let armorIdx = $(event.currentTarget).data("armor-idx")
this.manageArmors(armorIdx, toggled)
this.refreshDialog()
});
html.find('.weapon-clicked').change((event) => {
let toggled = event.currentTarget.checked
let weaponIdx = $(event.currentTarget).data("weapon-idx")
this.manageWeapons(weaponIdx, toggled)
this.refreshDialog()
});
html.find('.equip-clicked').change((event) => {
let toggled = event.currentTarget.checked