Various enhancements

This commit is contained in:
2022-12-21 14:42:28 +01:00
parent e0026adfcd
commit f73af29949
7 changed files with 83 additions and 18 deletions

View File

@@ -62,6 +62,9 @@ export class Avd12Actor extends Actor {
/* -------------------------------------------- */
rebuildSkills() {
let armorPenalties = Avd12Utility.getArmorPenalty( this.items.find( item => item.type == "armor") )
let shieldPenalties = Avd12Utility.getArmorPenalty( this.items.find( item => item.type == "shield") )
for (let attrKey in this.system.attributes) {
let attr = this.system.attributes[attrKey]
for (let skillKey in attr.skills) {
@@ -72,10 +75,38 @@ export class Avd12Actor extends Actor {
for (let trait of availableTraits) {
skill.modifier += Number(trait.system.bonusvalue)
}
// Apply armor penalties
if ( armorPenalties[skillKey]) {
console.log("Found armor penalties : ", armorPenalties, skillKey)
skill.modifier += Number(armorPenalties[skillKey])
}
// Apply shield penalties
if ( shieldPenalties[skillKey]) {
console.log("Found shield penalties : ", shieldPenalties, skillKey)
skill.modifier += Number(shieldPenalties[skillKey])
}
// Process additionnal bonuses
for(let item of this.items) {
if (item.system.bonus && item.system.bonus[skillKey]) {
skill.modifier += Number(item.system.bonus[skillKey].value)
}
}
skill.finalvalue = skill.modifier + attr.value
}
}
}
/* -------------------------------------------- */
rebuildMitigations() {
for (let mitiKey in this.system.mitigation) {
let mitigation = this.system.mitigation[mitiKey]
for(let item of this.items) {
if (item.system.mitigation && item.system.mitigation[mitiKey]) {
mitigation.value += Number(item.system.mitigation[mitiKey].value)
}
}
}
}
/* -------------------------------------------- */
prepareDerivedData() {
@@ -86,6 +117,7 @@ export class Avd12Actor extends Actor {
this.computeHitPoints()
this.rebuildSkills()
this.rebuildMitigations()
}
super.prepareDerivedData();

View File

@@ -11,7 +11,11 @@ const __focusRegenBond = { "bondnone": 6, "bondeasy": 8, "bondcommon": 12, "bond
const __bonusSpellDamageBond = { "bondnone": 0, "bondeasy": 1, "bondcommon": 1, "bonduncommon": 1, "bondrare": 2, "bondlegendary": 2, "bondmythic": 3, "bonddivine": 4 }
const __bonusSpellAttackBond = { "bondnone": 0, "bondeasy": 0, "bondcommon": 1, "bonduncommon": 1, "bondrare": 2, "bondlegendary": 2, "bondmythic": 3, "bonddivine": 4 }
const __spellCost = { "beginner": 1, "novice": 2, "expert": 4, "master": 6, "grandmaster": 8 }
const __armorPenalties = {"light": { block: -2, dodge: -1}, "medium": { dodge: -3, block: -2, castingtime: 1, stealth: -2, speed: -1,
"heavy": { dodge: -4, block: -3, stealth: -3, castingtime: 2, speed: -3 }, "ultraheavy": { dodge: -5, block: -4, stealth: -5, castingtime: 2, speed: -3 },
"lightshield": {dodge: -1, block: +1}, "heavyshield": {dodge: -2, block: 2, speed: -1, stealth: -1} }
}
/* -------------------------------------------- */
export class Avd12Utility {
@@ -439,6 +443,15 @@ export class Avd12Utility {
static getSpellCost(spell) {
return __spellCost[spell.system.level]
}
/* -------------------------------------------- */
static getArmorPenalty( item ) {
if (item && (item.type == "shield" || item.type == "armor")) {
return __armorPenalties[item.system.category]
}
return {}
}
/* -------------------------------------------- */
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
let chatData = {