Skip to content

Commit

Permalink
Add missing forms
Browse files Browse the repository at this point in the history
  • Loading branch information
jbblanchet committed May 20, 2024
1 parent 191a404 commit 4c47f89
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 1 deletion.
79 changes: 79 additions & 0 deletions src/shapes/aerial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { FORM_AERIAL, SIZE_MEDIUM, SIZE_HUGE, SIZE_LARGE } from "./constants"
import { getDexAttackModifier } from "./utils"

const baseAerialForms = [{
id: 'Bat',
speed: 20,
fly: 30,
senses: {
echolocation: 40,
},
diceDamage: 9,
agileDiceDamage: 7,
}, {
id: 'Bird',
speed: 10,
fly: 50,
diceDamage: 9,
agileDiceDamage: 5.5,
}, {
id: 'Pterosaur',
speed: 10,
fly: 40,
senses: {
impreciseScent: 30,
},
diceDamage: 10.5,
}, {
id: 'Wasp',
speed: 20,
fly: 40,
diceDamage: 11.5,
}]

function scaleAerialForm (baseForm, level, attackModifier, athleticsModifer) {
const form = {
type: FORM_AERIAL,
size: SIZE_MEDIUM,
armorClass: 18 + level,
tempHitPoints: 5,
senses: {
lowLight: true,
...(baseForm.senses || {}),
},
attackModifier: getDexAttackModifier(attackModifier, 16),
athletics: athleticsModifer,
damageBonus: 5,
reach: 5,
...baseForm,
}

switch (true) {
case level >= 11:
form.size = SIZE_HUGE
form.fly += 15
form.reach = 10
form.armorClass = 21 + level
form.tempHitPoints = 15
form.attackModifier = getDexAttackModifier(attackModifier, 21)
form.damageBonus = 4
form.diceDamage *= 2
if (form.agileDiceDamage) {
form.agileDiceDamage *= 2
}
break;
case level >= 9:
form.size = SIZE_LARGE
form.fly += 10
form.tempHitPoints = 10
form.attackModifier = getDexAttackModifier(attackModifier, 18)
form.damageBonus = 8
break;
}

return form
}

export default function scaleAerialForms (level, attackModifier, athleticsModifer) {
return baseAerialForms.map(form => scaleAerialForm(form, level, attackModifier, athleticsModifer))
}
29 changes: 29 additions & 0 deletions src/shapes/animal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,40 @@ const baseAnimalForms = [{
speed: 30,
diceDamage: 9,
agileDiceDamage: 4.5,
}, {
id: 'Bull',
speed: 30,
diceDamage: 9,
}, {
id: 'Canine',
speed: 40,
diceDamage: 9,
}, {
id: 'Cat',
speed: 40,
diceDamage: 7,
agileDiceDamage: 5.5,
}, {
id: 'Deer',
speed: 50,
diceDamage: 7,
}, {
id: 'Frog',
speed: 25,
swim: 25,
reach: 15,
diceDamage: 7,
agileDiceDamage: 5,
}, {
id: 'Shark',
speed: 0,
swim: 35,
diceDamage: 9,
}, {
id: 'Snake',
speed: 20,
climb: 20,
diceDamage: 8.5,
}]

function scaleAnimalForm (baseForm, level, attackModifier, athleticsModifer) {
Expand Down
2 changes: 2 additions & 0 deletions src/shapes/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const FORM_ANIMAL = 'animal'
export const FORM_AERIAL = 'aerial'
export const FORM_DINOSAUR = 'dinosaur'
export const FORM_DRAGON = 'dragon'
export const SIZE_MEDIUM = 'medium'
export const SIZE_LARGE = 'large'
export const SIZE_HUGE = 'huge'
export const SIZE_GARGANTUAN = 'gargantuan'
24 changes: 23 additions & 1 deletion src/shapes/dinosaur.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,38 @@ import { FORM_DINOSAUR, SIZE_GARGANTUAN, SIZE_HUGE } from "./constants"
import { getAttackModifier, getAthleticsModifier } from "./utils"

const baseDinosaurForms = [{
id: 'Ankylosaurus',
speed: 25,
reach: 10,
diceDamage: 7,
}, {
id: 'Brontosaurus',
speed: 25,
reach: 15,
diceDamage: 7,
}, {
id: 'Deinonychus',
speed: 40,
diceDamage: 7,
agileDiceDamage: 7,
}, {
id: 'Stegosaurus',
speed: 30,
reach: 10,
diceDamage: 9,
}, {
id: 'Triceratops',
speed: 30,
diceDamage: 9,
agileDiceDamage: 7,
criticalDamage: 7,
}, {
id: 'Tyrannosaurus',
speed: 30,
reach: 10,
diceDamage: 6.5,
agileDiceDamage: 5.5,
criticalDamage: 6.5,
}]

function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) {
Expand All @@ -34,7 +56,7 @@ function scaleDinosaurForm (baseForm, level, attackModifier, athleticsModifer) {
case level >= 13:
form.size = SIZE_GARGANTUAN
form.reach = form.Reach >= 15 ? 25 : 20
form.tempHitPoints = 15
form.tempHitPoints = 25
form.armorClass = 21 + level
form.attackModifier = getAttackModifier(attackModifier, 25)
form.damageBonus = 15
Expand Down
2 changes: 2 additions & 0 deletions src/shapes/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import scaleDinosaurForms from "./dinosaur"
import scaleAnimalForms from "./animal"
import scaleAerialForms from "./aerial"
import scaleDragonForm from "./dragon"

function getBaseAttackModifiers (level) {
Expand Down Expand Up @@ -36,6 +37,7 @@ export default function listForms (level) {

return [
...scaleAnimalForms(level, attackModifier, athleticsModifier),
...scaleAerialForms(level, attackModifier, athleticsModifier),
...scaleDinosaurForms(level, attackModifier, athleticsModifier),
scaleDragonForm(level, attackModifier, athleticsModifier),
]
Expand Down
7 changes: 7 additions & 0 deletions src/shapes/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ export function getAttackModifier (attackModifier, base) {
return base
}

export function getDexAttackModifier (attackModifier, base) {
if (attackModifier - 1 > base) {
return attackModifier + 1
}
return base
}

export function getAthleticsModifier (modifier, base) {
return modifier > base ? modifier : base
}

0 comments on commit 4c47f89

Please sign in to comment.