diff --git a/src/shapes/aerial.js b/src/shapes/aerial.js index f2ac5d0..df99cb1 100644 --- a/src/shapes/aerial.js +++ b/src/shapes/aerial.js @@ -1,5 +1,5 @@ import { FORM_AERIAL, SIZE_MEDIUM, SIZE_HUGE, SIZE_LARGE } from "./constants" -import { getDexAttackModifier } from "./utils" +import { getAthleticsModifier, getDexAttackModifier } from "./utils" const baseAerialForms = [{ id: 'Bat', @@ -31,7 +31,7 @@ const baseAerialForms = [{ diceDamage: 11.5, }] -function scaleAerialForm (baseForm, level, attackModifier, athleticsModifer) { +function scaleAerialForm (baseForm, level) { const form = { type: FORM_AERIAL, size: SIZE_MEDIUM, @@ -41,8 +41,8 @@ function scaleAerialForm (baseForm, level, attackModifier, athleticsModifer) { lowLight: true, ...(baseForm.senses || {}), }, - attackModifier: getDexAttackModifier(attackModifier, 16), - athletics: athleticsModifer, + attackModifier: getDexAttackModifier(level, 16), + athletics: getAthleticsModifier(level, 0), damageBonus: 5, reach: 5, ...baseForm, @@ -55,7 +55,7 @@ function scaleAerialForm (baseForm, level, attackModifier, athleticsModifer) { form.reach = 10 form.armorClass = 21 + level form.tempHitPoints = 15 - form.attackModifier = getDexAttackModifier(attackModifier, 21) + form.attackModifier = getDexAttackModifier(level, 21) form.damageBonus = 4 form.diceDamage *= 2 if (form.agileDiceDamage) { @@ -66,7 +66,7 @@ function scaleAerialForm (baseForm, level, attackModifier, athleticsModifer) { form.size = SIZE_LARGE form.fly += 10 form.tempHitPoints = 10 - form.attackModifier = getDexAttackModifier(attackModifier, 18) + form.attackModifier = getDexAttackModifier(level, 18) form.damageBonus = 8 break; } @@ -74,6 +74,6 @@ function scaleAerialForm (baseForm, level, attackModifier, athleticsModifer) { return form } -export default function scaleAerialForms (level, attackModifier, athleticsModifer) { - return baseAerialForms.map(form => scaleAerialForm(form, level, attackModifier, athleticsModifer)) +export default function scaleAerialForms (level) { + return baseAerialForms.map(form => scaleAerialForm(form, level)) } \ No newline at end of file diff --git a/src/shapes/animal.js b/src/shapes/animal.js index 7da84fa..d29ea55 100644 --- a/src/shapes/animal.js +++ b/src/shapes/animal.js @@ -47,7 +47,7 @@ const baseAnimalForms = [{ diceDamage: 8.5, }] -function scaleAnimalForm (baseForm, level, attackModifier, athleticsModifer) { +function scaleAnimalForm (baseForm, level) { const form = { type: FORM_ANIMAL, armorClass: 16 + level, @@ -56,8 +56,8 @@ function scaleAnimalForm (baseForm, level, attackModifier, athleticsModifer) { lowLight: true, impreciseScent: 30 }, - athletics: getAthleticsModifier(athleticsModifer, 9), - attackModifier: getAttackModifier(attackModifier, 9), + athletics: getAthleticsModifier(level, 9), + attackModifier: getAttackModifier(level, 9), damageBonus: 1, reach: 5, ...baseForm, @@ -69,18 +69,18 @@ function scaleAnimalForm (baseForm, level, attackModifier, athleticsModifer) { form.reach = 15 form.tempHitPoints = 20 form.armorClass = 18 + level - form.attackModifier = getAttackModifier(attackModifier, 18) + form.attackModifier = getAttackModifier(level, 18) form.damageBonus = 7 form.diceDamage *= 2 if (form.agileDiceDamage) { form.agileDiceDamage *= 2 } - form.athletics = getAthleticsModifier(athleticsModifer, 20) + form.athletics = getAthleticsModifier(level, 20) } return form } -export default function scaleAnimalForms (level, attackModifier, athleticsModifer) { - return baseAnimalForms.map(form => scaleAnimalForm(form, level, attackModifier, athleticsModifer)) +export default function scaleAnimalForms (level) { + return baseAnimalForms.map(form => scaleAnimalForm(form, level)) } \ No newline at end of file diff --git a/src/shapes/dinosaur.js b/src/shapes/dinosaur.js index 285e7e3..9525e75 100644 --- a/src/shapes/dinosaur.js +++ b/src/shapes/dinosaur.js @@ -36,7 +36,7 @@ const baseDinosaurForms = [{ criticalDamage: 6.5, }] -function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) { +function scaleDinosaurForm (baseForm, level) { const form = { type: FORM_DINOSAUR, armorClass: 18 + level, @@ -45,8 +45,8 @@ function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) { lowLight: true, impreciseScent: 30 }, - athletics: getAthleticsModifier(athleticsModifer, 18), - attackModifier: getAttackModifier(attackModifier, 16), + athletics: getAthleticsModifier(level, 18), + attackModifier: getAttackModifier(level, 16), damageBonus: 9, reach: 5, ...baseForm @@ -58,10 +58,10 @@ function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) { form.reach = form.Reach >= 15 ? 25 : 20 form.tempHitPoints = 25 form.armorClass = 21 + level - form.attackModifier = getAttackModifier(attackModifier, 25) + form.attackModifier = getAttackModifier(level, 25) form.damageBonus = 15 form.diceDamage *= 2 - form.athletics = getAthleticsModifier(athleticsModifer, 25) + form.athletics = getAthleticsModifier(level, 25) if (form.agileDiceDamage) { form.agileDiceDamage *= 2 } @@ -70,10 +70,10 @@ function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) { form.size = SIZE_HUGE form.reach = form.Reach >= 15 ? 20 : 15 form.tempHitPoints = 20 - form.attackModifier = getAttackModifier(attackModifier, 18) + form.attackModifier = getAttackModifier(level, 18) form.damageBonus = 6 form.diceDamage *= 2 - form.athletics = getAthleticsModifier(athleticsModifer, 21) + form.athletics = getAthleticsModifier(level, 21) if (form.agileDiceDamage) { form.agileDiceDamage *= 2 } @@ -82,6 +82,6 @@ function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) { return form } -export default function scaleDinosaurForms (level, attackModifier, athleticsModifer) { - return baseDinosaurForms.map(form => scaleDinosaurForm(form, level, attackModifier, athleticsModifer)) +export default function scaleDinosaurForms (level) { + return baseDinosaurForms.map(form => scaleDinosaurForm(form, level)) } \ No newline at end of file diff --git a/src/shapes/dragon.js b/src/shapes/dragon.js index 7f8074c..2808c91 100644 --- a/src/shapes/dragon.js +++ b/src/shapes/dragon.js @@ -1,7 +1,7 @@ import { FORM_DRAGON, SIZE_LARGE, SIZE_HUGE } from "./constants" import { getAttackModifier, getAthleticsModifier } from "./utils" -export default function scaleDragonForm (level, attackModifier, athleticsModifer) { +export default function scaleDragonForm (level) { const form = { id: 'Dragon', type: FORM_DRAGON, @@ -15,8 +15,8 @@ export default function scaleDragonForm (level, attackModifier, athleticsModifer lowLight: true, impreciseScent: 60 }, - athletics: getAthleticsModifier(athleticsModifer, 23), - attackModifier: getAttackModifier(attackModifier, 22), + athletics: getAthleticsModifier(level, 23), + attackModifier: getAttackModifier(level, 22), damageBonus: 6, diceDamage: 20, agileDiceDamage: 16.5, @@ -29,9 +29,9 @@ export default function scaleDragonForm (level, attackModifier, athleticsModifer form.reach = 10 form.tempHitPoints = 15 form.armorClass = 21 + level - form.attackModifier = getAttackModifier(attackModifier, 28) + form.attackModifier = getAttackModifier(level, 28) form.damageBonus = 12 - form.athletics = getAttackModifier(attackModifier, 28) + form.athletics = getAttackModifier(level, 28) } return form diff --git a/src/shapes/index.js b/src/shapes/index.js index 582a091..fea153c 100644 --- a/src/shapes/index.js +++ b/src/shapes/index.js @@ -3,42 +3,11 @@ import scaleAnimalForms from "./animal" import scaleAerialForms from "./aerial" import scaleDragonForm from "./dragon" -function getBaseAttackModifiers (level) { - const proficiency = 4 - let strength = 4 - let rune = 2 - - if (level >= 15) { - strength++ - } - - if (level >= 16) { - rune++ - } - - return level + proficiency + strength + rune -} - -function getBaseAthleticsModifiers (level) { - const proficiency = 2 - let strength = 4 - - if (level >= 15) { - strength++ - } - - return level + proficiency + strength -} - - export default function listForms (level) { - const attackModifier = getBaseAttackModifiers(level) - const athleticsModifier = getBaseAthleticsModifiers(level) - return [ - ...scaleAnimalForms(level, attackModifier, athleticsModifier), - ...scaleAerialForms(level, attackModifier, athleticsModifier), - ...scaleDinosaurForms(level, attackModifier, athleticsModifier), - scaleDragonForm(level, attackModifier, athleticsModifier), + ...scaleAnimalForms(level), + ...scaleAerialForms(level), + ...scaleDinosaurForms(level), + scaleDragonForm(level), ] } \ No newline at end of file diff --git a/src/shapes/utils.js b/src/shapes/utils.js index c736827..122ce4a 100644 --- a/src/shapes/utils.js +++ b/src/shapes/utils.js @@ -1,17 +1,63 @@ -export function getAttackModifier (attackModifier, base) { - if (attackModifier > base) { +export function getAttackModifier (level, formValue) { + const attackModifier = getBaseAttackModifiers(level) + if (attackModifier > formValue) { return attackModifier + 2 } - return base + return formValue } -export function getDexAttackModifier (attackModifier, base) { - if (attackModifier - 1 > base) { - return attackModifier + 1 +export function getDexAttackModifier (level, formValue) { + const attackModifier = getBaseDexAttackModifiers(level) + if (attackModifier > formValue) { + return attackModifier + 2 } - return base + return formValue +} + +export function getAthleticsModifier (level, formValue) { + const modifier = getBaseAthleticsModifiers(level) + return modifier > formValue ? modifier : formValue } -export function getAthleticsModifier (modifier, base) { - return modifier > base ? modifier : base +function getBaseAttackModifiers (level) { + const proficiency = 4 + let strength = 4 + let rune = 2 + + if (level >= 15) { + strength++ + } + + if (level >= 16) { + rune++ + } + + return level + proficiency + strength + rune } + +function getBaseDexAttackModifiers (level) { + const proficiency = 4 + let dexterity = 4 + let rune = 2 + + if (level >= 20) { + dexterity++ + } + + if (level >= 16) { + rune++ + } + + return level + proficiency + dexterity + rune +} + +function getBaseAthleticsModifiers (level) { + const proficiency = 2 + let strength = 4 + + if (level >= 15) { + strength++ + } + + return level + proficiency + strength +} \ No newline at end of file