Skip to content

Commit 8b4a837

Browse files
committed
more fixes/qol requests
1 parent fac61d6 commit 8b4a837

44 files changed

Lines changed: 285 additions & 288 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/classes/Statblock.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ class Statblock {
303303
} else return '>> NO MECH SELECTED <<'
304304
}
305305

306-
public static GenerateNPC(npc: Unit, includeNarrative: boolean): string {
306+
public static GenerateNPC(npc: Unit, includeNarrative: boolean, includeFeatures = false): string {
307307
let output = `// ${npc.Name} //\n`
308308
if (npc.NpcTemplateController.Templates)
309309
output += `${npc.NpcTemplateController.Templates.map(t => t.Name).join(' ')}`
@@ -345,9 +345,9 @@ class Statblock {
345345
(item, index) => `${item.Name}${linebreak(index, npc.NpcFeatureController.Features.length)}`
346346
).join('')
347347

348-
if (includeNarrative) {
349-
output += this.generateNarrativeBlock(npc)
350-
}
348+
if (includeNarrative) output += this.generateNarrativeBlock(npc)
349+
350+
if (includeFeatures) output += this.getFeatures(npc, true)
351351

352352
return output
353353
}
@@ -379,10 +379,16 @@ class Statblock {
379379
'SensorRange'
380380
)} | TECH_ATK: ${npc.StatController.getMax('Tech Attack')} | SIZE: ${npc.StatController.getMax('Size')} \n\n`
381381

382-
output += '[ FEATURES ]\n'
383-
if (includeFeatures) {
382+
output += this.getFeatures(npc, includeFeatures)
383+
384+
return output
385+
}
386+
387+
private static getFeatures(npc: Unit, showFeatureDetails = false): string {
388+
let output = '[ FEATURES ]\n'
389+
if (showFeatureDetails) {
384390
output += npc.NpcFeatureController.Features.map(
385-
(item, index) =>
391+
item =>
386392
`${item.Name}\n ${(item.Description || item.EffectByTier(npc.Tier) || '')?.replace(/<[^>]*>/gi, '') || ''}${item.Actions ? mapNpcActions(item.Actions, npc.Tier) : ''}${mapNpcWeaponStats(item as NpcWeapon, npc.Tier)}`
387393
).join('\n')
388394
} else {
@@ -391,7 +397,6 @@ class Statblock {
391397
(item, index) => `${item.Name}${linebreak(index, npc.NpcFeatureController.Features.length)}`
392398
).join('\n')
393399
}
394-
395400
return output
396401
}
397402

src/classes/components/feature/active_effects/ActiveEffectEvent.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { StatusEvent } from './effect_events/statusEvent'
1111
import { OtherEvent } from './effect_events/otherEvent'
1212
import { SpecialEvent } from './effect_events/specialEvent'
1313
import { ActionSummary } from './EffectActionSummary'
14+
import { NpcWeapon } from '@/classes/npc/feature/NpcItem/NpcWeapon'
1415

1516
class ActiveEffectEvent {
1617
public ID: string
@@ -62,20 +63,17 @@ class ActiveEffectEvent {
6263
initiator.actor.CombatController?.ActiveActor.CombatController?.TechAttackBonus || 0
6364
}
6465

65-
// For NPC actors, add the feature-level tier accuracy/attack_bonus (e.g. NpcTech arrays).
66-
// NpcWeapon already bakes these into the ActiveEffectData via toActiveEffectData(), so the
67-
// lookup will find no match and is a no-op for weapon attacks.
6866
const npcFeatures = initiator.actor.NpcFeatureController?.Features
6967
if (npcFeatures?.length) {
7068
const tier = initiator.actor.CombatController.Tier
7169
const matchingFeature = npcFeatures.find(
7270
(f: any) => f.ID === effect.ID || f.Actions?.some((a: any) => a.ID === effect.ID)
7371
)
7472
if (matchingFeature) {
75-
if (typeof matchingFeature.Accuracy === 'function')
76-
this.Accuracy += matchingFeature.Accuracy(tier) || 0
77-
if (typeof matchingFeature.AttackBonus === 'function')
78-
this.AttackBonus += matchingFeature.AttackBonus(tier) || 0
73+
if (typeof (matchingFeature as NpcWeapon).Accuracy === 'function')
74+
this.Accuracy += (matchingFeature as NpcWeapon).Accuracy(tier) || 0
75+
if (typeof (matchingFeature as NpcWeapon).AttackBonus === 'function')
76+
this.AttackBonus += (matchingFeature as NpcWeapon).AttackBonus(tier) || 0
7977
}
8078
}
8179

@@ -172,6 +170,7 @@ class ActiveEffectEvent {
172170

173171
// add a new target slot
174172
public AddTarget() {
173+
console.log('Adding target slot')
175174
if (this.IsPcLocal)
176175
this._targets.push(new ActiveEventTarget(this, null as unknown as CombatantData, this.Effect))
177176
else this._targets.push(null as unknown as ActiveEventTarget)

src/classes/components/feature/active_effects/WeaponAttackEvent.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ class WeaponAttackEvent {
6565
this.OnAttackEvent = new ActiveEffectEvent(owner, weapon.OnAttack, instance)
6666
if (weapon.OnHit) this.OnHitEvent = new ActiveEffectEvent(owner, weapon.OnHit, instance)
6767
if (weapon.OnCrit) this.OnCritEvent = new ActiveEffectEvent(owner, weapon.OnCrit, instance)
68+
69+
if ((weapon as NpcWeapon).getAttacks(owner.actor.CombatController.Tier) > 1) {
70+
const attackCount = (weapon as NpcWeapon).getAttacks(owner.actor.CombatController.Tier) - 1
71+
for (let i = 0; i < attackCount; i++) {
72+
console.log('Adding additional attack event')
73+
this.BaseEvent.AddTarget()
74+
}
75+
}
6876
}
6977

7078
public get TargetEvents(): ActiveEffectEvent[] {

src/classes/components/feature/bonus/Bonus.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class Bonus {
3535
public readonly Condition: string | undefined
3636

3737
public constructor(data: IBonusData, source: string) {
38-
if (data.id === 'size') console.log(data)
3938
const entry = getBonusDictionary().find(x => x.id === data.id)
4039
this.ID = data.id || 'UNKNOWN_BONUS'
4140
this.Source = source

src/classes/narrative/elements/Clock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class Clock {
5858
resolution: c.Resolution,
5959
segments: c.Segments,
6060
progress: c.Progress,
61+
linear: c.Linear,
62+
gm_only: c.GmOnly,
6163
}
6264
}
6365

src/classes/npc/feature/NpcItem/NpcWeapon.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ export class NpcWeapon extends NpcFeature {
7171
return this.WeaponType.toLowerCase().includes('superheavy')
7272
}
7373

74+
public getAttacks(tier: number): number {
75+
if (!this.Attacks) return 1
76+
if (!Array.isArray(this.Attacks)) return this.Attacks
77+
return this.Attacks[tier - 1] || 1
78+
}
79+
7480
// public get IsLimited(): boolean {
7581
// return this.Tags.some((x) => x.IsLimited);
7682
// }
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
import type { Bonus } from '@/classes/components'
12
import { BonusController } from '@/classes/components/feature/bonus/BonusController'
3+
import type { CompendiumItem } from '@/classes/CompendiumItem'
4+
import type { IFeatureController } from '@/classes/components/feature/IFeatureController'
25

36
export const ITEM_BONUS_IDS = BonusController.ITEM_BONUS_IDS
47

5-
export function externalItemBonuses(this: any): any[] {
6-
return BonusController.filterForItem(this.mech, this.item)
8+
export function externalItemBonuses(mech: IFeatureController, item: CompendiumItem): Bonus[] {
9+
return BonusController.filterForItem(mech, item)
710
}
811

9-
export function externalPilotItemBonuses(this: any): any[] {
10-
return BonusController.filterForItem(this.pilot, this.item)
12+
export function externalPilotItemBonuses(pilot: IFeatureController, item: CompendiumItem): Bonus[] {
13+
return BonusController.filterForItem(pilot, item)
1114
}
1215

13-
export function externalUnitItemBonuses(this: any): any[] {
14-
return BonusController.filterForItem(this.unit, this.item)
16+
export function externalUnitItemBonuses(unit: IFeatureController, item: CompendiumItem): Bonus[] {
17+
return BonusController.filterForItem(unit, item)
1518
}

src/features/active_mode/runner/gm/EncounterPanels/EidolonPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ import type { CombatantData } from '@/classes/encounter/Encounter';
141141
import UnitFeatureCard from './_components/loadouts/_unitFeatureCard.vue';
142142
import PanelBase from './_PanelBase.vue';
143143
import PersistentTraits from '@/classes/npc/eidolon/persistent_traits.json';
144-
import { EncounterInstance } from '@/classes/encounter/EncounterInstance.js';
144+
import { EncounterInstance } from '@/classes/encounter/EncounterInstance';
145145
146146
const props = defineProps({
147147
combatant: {

src/features/active_mode/runner/gm/EncounterPanels/MechPanel.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ import MechCorePanel from './_components/loadouts/MechCorePanel.vue';
230230
import MechActionsPanel from './_components/MechActionsPanel.vue';
231231
import DeployButton from './_components/loadouts/_deployButton.vue';
232232
import CombatActionsBlock from './_CombatActionsBlock.vue';
233-
import { Deployable } from '@/classes/components/feature/deployable/Deployable.js';
233+
import { Deployable } from '@/classes/components/feature/deployable/Deployable';
234234
235235
const props = defineProps<{
236236
combatant: CombatantData

src/features/active_mode/runner/gm/EncounterPanels/_CombatActionsBlock.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ import { useEncounterContext } from './encounterContext'
2121
import type { EncounterInstance } from '@/classes/encounter/EncounterInstance'
2222
import type { CombatantData } from '@/classes/encounter/Encounter'
2323
import DeployButton from './_components/loadouts/_deployButton.vue'
24-
import { Deployable } from '@/classes/components/feature/deployable/Deployable.js';
25-
import { FrameTrait } from '@/classes/mech/components/frame/FrameTrait.js';
26-
import { CoreBonus } from '@/classes/pilot/components/corebonus/CoreBonus.js';
24+
import { Deployable } from '@/classes/components/feature/deployable/Deployable';
25+
import { FrameTrait } from '@/classes/mech/components/frame/FrameTrait';
26+
import { CoreBonus } from '@/classes/pilot/components/corebonus/CoreBonus';
2727
2828
const { encounterInstance } = useEncounterContext()
2929

0 commit comments

Comments
 (0)