Skip to content

Commit

Permalink
UnitTypeWeapon attackType/range
Browse files Browse the repository at this point in the history
  • Loading branch information
rhazarian committed Mar 18, 2024
1 parent a45bc10 commit 959b9a7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/engine/object-data/entry/unit-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { ObjectDataEntryIdGenerator } from "../utility/object-data-entry-id-gene
import type { AbilityTypeId } from "./ability-type"
import type { UpgradeId } from "./upgrade"
import { AnimationQualifier } from "../auxiliary/animation-qualifier"
import { AttackType } from "../auxiliary/attack-type"

export type UnitTypeId = ObjectDataEntryId & { readonly __unitTypeId: unique symbol }

Expand All @@ -33,6 +34,14 @@ let getOrCreateUnitTypeWeapons: (unitType: UnitType) => TupleOf<UnitTypeWeapon,
export class UnitTypeWeapon {
private constructor(private readonly unitType: UnitType, private readonly index: 1 | 2) {}

public get attackType(): AttackType {
return this.unitType["getStringField"](`ua${this.index}t`) as AttackType
}

public set attackType(attackType: AttackType) {
this.unitType["setStringField"](`ua${this.index}t`, attackType)
}

public get backSwingDuration(): number {
return this.unitType["getNumberField"](`ubs${this.index}`)
}
Expand All @@ -57,6 +66,14 @@ export class UnitTypeWeapon {
this.unitType["setStringField"](`ua${this.index}m`, missileModelPath)
}

public get range(): number {
return this.unitType["getNumberField"](`ua${this.index}r`)
}

public set range(range: number) {
this.unitType["setNumberField"](`ua${this.index}r`, range)
}

public get soundType(): WeaponSoundType {
return this.unitType["getStringField"](`ucs${this.index}`) as WeaponSoundType
}
Expand Down

0 comments on commit 959b9a7

Please sign in to comment.