Skip to content

Commit

Permalink
Don't muck with document data model
Browse files Browse the repository at this point in the history
  • Loading branch information
ben committed Aug 29, 2024
1 parent 11f3426 commit 7aae8e9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions src/module/datasworn2/import/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@ for (const collection of collections) {
},
Oracles: legacyOracleIds,
dsOracleIds,
Source: {
Title: move._source.title,
Authors: move._source.authors.map((x) => x.name),
Date: move._source.date,
Page: move._source.page
},
Suggestions: {}
},
sort: move._source.page ?? 0,
Expand Down
16 changes: 9 additions & 7 deletions src/module/item/subtypes/sfmove.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { DataforgedIDField } from '../../fields/DataforgedIDField'
import { SourceField } from '../../fields/SourceField'
import type { IronswornItem } from '../item'
import {
DFIMove,
DFIMoveTrigger,
DFIMoveTriggerOptionAction,
DFIMoveTriggerOptionProgress,
DFIOutcomeInfo
Expand Down Expand Up @@ -90,6 +93,7 @@ export class SFMoveModel extends foundry.abstract.TypeDataModel<
return {
dfid: new DataforgedIDField(),
Category: new DataforgedIDField(),
Source: new SourceField(),
'Progress Move': new fields.BooleanField(),
Text: new fields.HTMLField(),
Oracles: new fields.ArrayField(new DataforgedIDField()),
Expand Down Expand Up @@ -174,12 +178,11 @@ export class SFMoveOutcomeMatchableField extends foundry.data.fields
}
export interface SFMoveModel extends SFMoveDataSourceData {}

export interface SFMoveDataSourceData {
export interface SFMoveDataSourceData
extends Required<
Pick<DFIMove, 'Category' | 'Source' | 'Text' | 'Oracles' | 'Progress Move'>
> {
dfid: string
Category: string
Text: string
Oracles?: string[]
'Progress Move'?: boolean
Trigger: SFMoveTrigger
Outcomes?: {
'Strong Hit': SFMoveOutcomeMatchable
Expand All @@ -189,8 +192,7 @@ export interface SFMoveDataSourceData {
dsOracleIds: string[]
}

export interface SFMoveTrigger {
Text: string
export interface SFMoveTrigger extends Pick<DFIMoveTrigger, 'Text'> {
Options: SFMoveTriggerOption[]
}

Expand Down

0 comments on commit 7aae8e9

Please sign in to comment.