Skip to content

Commit

Permalink
Re-organised source code
Browse files Browse the repository at this point in the history
  • Loading branch information
rajch committed Aug 16, 2024
1 parent 05e8178 commit f08a674
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 34 deletions.
14 changes: 7 additions & 7 deletions src/brass-basilisk.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict'

import { ChanceRollPlugin } from "./chancerollplugin"
import { CharacterSheetPlugin } from "./charactersheetplugin"
import { CombatPlugin } from "./combatplugin"
import { ChanceRollPlugin } from "./plugins/chancerollplugin"
import { CharacterSheetPlugin } from "./plugins/charactersheetplugin"
import { CombatPlugin } from "./plugins/combatplugin"
import { DefaultView } from "./defaultview"
import { DiceBoardPlugin } from "./diceboardplugin"
import { DiceBoardPlugin } from "./plugins/diceboardplugin"
import { DefaultStory } from "./defaultstory"
import { Player } from "./player"
import { TurnToLinksPlugin } from "./turntolinksplugin"
import { AttributePhrasePlugin } from "./attributephraseplugin"
import { Player } from "./core/player"
import { TurnToLinksPlugin } from "./plugins/turntolinksplugin"
import { AttributePhrasePlugin } from "./plugins/attributephraseplugin"


try {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/defaultstory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

import { Passage } from "./passage"
import { Passage } from "./core/passage"

export class DefaultStory {
/** @type {HTMLElement} */
Expand Down
4 changes: 2 additions & 2 deletions src/defaultview.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

import './types'
import './core/types'

export class DefaultView {
/** @type {HTMLElement} */
Expand Down Expand Up @@ -180,7 +180,7 @@ export class DefaultView {
}

/**
* Gets a container for a "tools" UI element.
* Gets a dialog UI element.
*
* In the default implementation, this looks for a dialog with
* the specified id.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

import { CharacterSheetPlugin } from './charactersheetplugin'
import { Passage } from './passage'
import { BBScannerPlugin } from './plugin'
import { Passage } from '../core/passage'
import { BBScannerPlugin } from '../core/plugin'

import './types'
import '../core/types'

// This matches a sentence that ends a paragraph.
const phraseRegex = /Your (VIGOUR|AGILITY|PSI) ((?:is restored)|(?:increases by)|(?:decreases by))( \d{1,2})?\.\n/g
Expand Down Expand Up @@ -62,15 +62,6 @@ export class AttributePhrasePlugin extends BBScannerPlugin {
this.setCurrentState({ acted: true })
}

// for (let i = 0; i < this.#phraseActions.length; i++) {
// const phraseAction = this.#phraseActions[i]
// const rexp = new RegExp(phraseAction.phraseRegExp)
// const rexMatches = passageBody.match(rexp)
// if (rexMatches) {
// result = result || phraseAction.action(rexMatches)
// }
// }

return result
}
}
6 changes: 3 additions & 3 deletions src/chancerollplugin.js → src/plugins/chancerollplugin.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

import { DiceBoardPlugin } from "./diceboardplugin";
import { Passage } from "./passage";
import { BBScannerPlugin } from "./plugin";
import { Passage } from "../core/passage";
import { BBScannerPlugin } from "../core/plugin";

import './types'
import '../core/types'

const chanceRegEx = /(?:[Rr]oll|[Tt]hrow) (\S*?) di(?:c?)e\.(.*?)(?:\n|$)/
const actionRegEx = /If you roll (?:a )?(\d{1,2})( or(?: a)? | to |)(\d{0,2}),([^\.\n]*?)(?: [Tt]urn to (\d{1,3}))?\./g
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

import { BBGlobalStatePlugin } from "./plugin";
import './types'
import { BBGlobalStatePlugin } from "../core/plugin";
import '../core/types'

export class CharacterSheetPlugin extends BBGlobalStatePlugin {
/** @type CharacterSheet */
Expand Down
6 changes: 3 additions & 3 deletions src/combatplugin.js → src/plugins/combatplugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { CharacterSheetPlugin } from "./charactersheetplugin";
import { DiceBoardPlugin } from "./diceboardplugin";
import { Passage } from "./passage";
import { BBScannerPlugin } from "./plugin";
import { Passage } from "../core/passage";
import { BBScannerPlugin } from "../core/plugin";

import './types'
import '../core/types'

const combatRegex = /\n+([A-Z\s]+)\s+VIGOUR\s+(\d+)\s*\n+\s*?[Rr]oll\s+(\w+)\s+dice:\n+\s*((?:[Ss]core\s+\d+\s+to\s+\d+[^\n]+\n\s*)+)(?:\n+(.*?)\n)/
const combatRuleRegex = /score\s+(\d+)\s+to\s+(\d+)\s+(?:[\w;,\-:]+\s)+?(loses?)\s+(\d+)\s+VIGOUR/g
Expand Down
4 changes: 2 additions & 2 deletions src/diceboardplugin.js → src/plugins/diceboardplugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

import { BBScannerPlugin } from "./plugin";
import './types'
import { BBScannerPlugin } from "../core/plugin";
import '../core/types'

// Raises 'roll' event, with event.detail containing the total roll
export class DiceBoardPlugin extends BBScannerPlugin {
Expand Down
4 changes: 2 additions & 2 deletions src/turntolinksplugin.js → src/plugins/turntolinksplugin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

import { BBPlugin } from "./plugin";
import { BBPlugin } from "../core/plugin";

import "./types"
import "../core/types"

export class TurnToLinksPlugin extends BBPlugin {

Expand Down

0 comments on commit f08a674

Please sign in to comment.