Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HASE numerical bonuses. #2218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/classes/components/feature/bonus/Bonus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DamageType, Mech, Pilot, RangeType, WeaponSize, WeaponType } from '@/cl
import { IFeatureController } from '../IFeatureController'
import dict from './bonus_dictionary'
import { IBonusDataContainer } from './IBonusDataContainer'
import { MechSkillsController } from '../../mechskills/MechSkillsController'

interface IBonusData {
id: string
Expand Down Expand Up @@ -104,8 +105,17 @@ class Bonus {
let valStr = bonus.Value
const ll = source.FeatureController.getRootProperty('Level')?.toString() || '0'
const grit = source.FeatureController.getRootProperty('Grit')?.toString() || '0'
const meSkills : MechSkillsController = source.FeatureController.getRootProperty('MechSkillsController');
const hull = meSkills?.MechSkills.Hull.toString() || '0'
const agility = meSkills?.MechSkills.Agi.toString() || '0'
const systems = meSkills?.MechSkills.Sys.toString() || '0'
const engineering = meSkills?.MechSkills.Eng.toString() || '0'
valStr = valStr.replace(/{ll}/g, ll)
valStr = valStr.replace(/{grit}/g, grit)
valStr = valStr.replace(/{hull}/g, hull)
valStr = valStr.replace(/{agi}/g, agility)
valStr = valStr.replace(/{sys}/g, systems)
valStr = valStr.replace(/{eng}/g, engineering)
valStr = valStr.replace(/[^-()\d/*+.]/g, '')
return Math.ceil(eval(valStr))
}
Expand Down Expand Up @@ -134,4 +144,4 @@ class Bonus {
}
}

export { Bonus, IBonusData }
export { Bonus, IBonusData }