qpremake 1.5.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +335 -180
- package/package.json +2 -7
- package/lib/_localizationFiles/English.d.ts +0 -2
- package/lib/_localizationFiles/English.js +0 -307
- package/lib/_mods/parserModules/addSymbol.d.ts +0 -7
- package/lib/_mods/parserModules/addSymbol.js +0 -18
- package/lib/_mods/parserModules/expression.d.ts +0 -7
- package/lib/_mods/parserModules/expression.js +0 -45
- package/lib/_mods/parserModules/expression_parser.d.ts +0 -143
- package/lib/_mods/parserModules/expression_parser.js +0 -728
- package/lib/_mods/parserModules/img.d.ts +0 -8
- package/lib/_mods/parserModules/img.js +0 -42
- package/lib/_mods/parserModules/qpOriginal.d.ts +0 -5
- package/lib/_mods/parserModules/qpOriginal.js +0 -27
- package/lib/_mods/parserModules/sectionID.d.ts +0 -13
- package/lib/_mods/parserModules/sectionID.js +0 -56
- package/lib/_mods/parserModules/tags.d.ts +0 -9
- package/lib/_mods/parserModules/tags.js +0 -29
- package/lib/_mods/parserModules/uaddminus.d.ts +0 -9
- package/lib/_mods/parserModules/uaddminus.js +0 -42
- package/lib/_mods/parserModules/variantCheck.d.ts +0 -10
- package/lib/_mods/parserModules/variantCheck.js +0 -53
- package/lib/_queenSystem/handler/actionGenrator.d.ts +0 -994
- package/lib/_queenSystem/handler/actionGenrator.js +0 -646
- package/lib/_queenSystem/handler/actionInputGenerator.d.ts +0 -95
- package/lib/_queenSystem/handler/actionInputGenerator.js +0 -373
- package/lib/_queenSystem/handler/actionInputRequesterGenerator.d.ts +0 -92
- package/lib/_queenSystem/handler/actionInputRequesterGenerator.js +0 -341
- package/lib/_queenSystem/handler/cardHandler.d.ts +0 -20
- package/lib/_queenSystem/handler/cardHandler.js +0 -61
- package/lib/_queenSystem/handler/effectGenerator.d.ts +0 -1
- package/lib/_queenSystem/handler/effectGenerator.js +0 -127
- package/lib/_queenSystem/handler/localizationHandler.d.ts +0 -28
- package/lib/_queenSystem/handler/localizationHandler.js +0 -166
- package/lib/_queenSystem/handler/modHandler.d.ts +0 -10
- package/lib/_queenSystem/handler/modHandler.js +0 -36
- package/lib/_queenSystem/handler/oldDataProcessor.d.ts +0 -9
- package/lib/_queenSystem/handler/oldDataProcessor.js +0 -129
- package/lib/_queenSystem/handler/registryHandler.d.ts +0 -36
- package/lib/_queenSystem/handler/registryHandler.js +0 -63
- package/lib/_queenSystem/handler/zoneHandler.d.ts +0 -102
- package/lib/_queenSystem/handler/zoneHandler.js +0 -606
- package/lib/_queenSystem/loader/loader_card.d.ts +0 -20
- package/lib/_queenSystem/loader/loader_card.js +0 -124
- package/lib/_queenSystem/loader/loader_effect.d.ts +0 -27
- package/lib/_queenSystem/loader/loader_effect.js +0 -163
- package/lib/_queenSystem/loader/loader_handler.d.ts +0 -11
- package/lib/_queenSystem/loader/loader_handler.js +0 -24
- package/lib/_queenSystem/loader/loader_localization.d.ts +0 -11
- package/lib/_queenSystem/loader/loader_localization.js +0 -73
- package/lib/_queenSystem/loader/loader_mod.d.ts +0 -10
- package/lib/_queenSystem/loader/loader_mod.js +0 -72
- package/lib/_queenSystem/loader/loader_subtype.d.ts +0 -9
- package/lib/_queenSystem/loader/loader_subtype.js +0 -39
- package/lib/_queenSystem/loader/loader_type.d.ts +0 -9
- package/lib/_queenSystem/loader/loader_type.js +0 -39
- package/lib/_queenSystem/loader/loader_zone.d.ts +0 -14
- package/lib/_queenSystem/loader/loader_zone.js +0 -35
- package/lib/_queenSystem/queenSystem.d.ts +0 -127
- package/lib/_queenSystem/queenSystem.js +0 -996
- package/lib/_queenSystem/renderer/rendererInterface.d.ts +0 -9
- package/lib/_queenSystem/renderer/rendererInterface.js +0 -2
- package/lib/data/actionRegistry.d.ts +0 -56
- package/lib/data/actionRegistry.js +0 -60
- package/lib/data/cardRegistry.d.ts +0 -1162
- package/lib/data/cardRegistry.js +0 -716
- package/lib/data/deckRegistry.d.ts +0 -19
- package/lib/data/deckRegistry.js +0 -41
- package/lib/data/effectRegistry.d.ts +0 -465
- package/lib/data/effectRegistry.js +0 -151
- package/lib/data/effectTypeRegistry.d.ts +0 -14
- package/lib/data/effectTypeRegistry.js +0 -14
- package/lib/data/operatorRegistry.d.ts +0 -92
- package/lib/data/operatorRegistry.js +0 -82
- package/lib/data/rarityRegistry.d.ts +0 -28
- package/lib/data/rarityRegistry.js +0 -63
- package/lib/data/registryRegistry.d.ts +0 -10
- package/lib/data/registryRegistry.js +0 -14
- package/lib/data/subtypeRegistry.d.ts +0 -15
- package/lib/data/subtypeRegistry.js +0 -15
- package/lib/data/systemRegistry.d.ts +0 -253
- package/lib/data/systemRegistry.js +0 -56
- package/lib/data/zoneRegistry.d.ts +0 -43
- package/lib/data/zoneRegistry.js +0 -157
- package/lib/effectTextParser/index.d.ts +0 -42
- package/lib/effectTextParser/index.js +0 -316
- package/lib/global/index.d.ts +0 -8
- package/lib/global/index.js +0 -12
- package/lib/index.d.ts +0 -6341
- package/lib/index.js +0 -212
- package/lib/specificEffects/e_cond.d.ts +0 -11
- package/lib/specificEffects/e_cond.js +0 -36
- package/lib/specificEffects/e_fruit.d.ts +0 -3
- package/lib/specificEffects/e_fruit.js +0 -187
- package/lib/specificEffects/e_generic.d.ts +0 -191
- package/lib/specificEffects/e_generic.js +0 -662
- package/lib/specificEffects/e_generic_cardTargetting.d.ts +0 -38
- package/lib/specificEffects/e_generic_cardTargetting.js +0 -82
- package/lib/specificEffects/e_generic_noneTargetting.d.ts +0 -10
- package/lib/specificEffects/e_generic_noneTargetting.js +0 -26
- package/lib/specificEffects/e_status.d.ts +0 -80
- package/lib/specificEffects/e_status.js +0 -151
- package/lib/specificEffects/e_test.d.ts +0 -3
- package/lib/specificEffects/e_test.js +0 -21
- package/lib/types/abstract/gameComponents/API.d.ts +0 -19
- package/lib/types/abstract/gameComponents/API.js +0 -2
- package/lib/types/abstract/gameComponents/card.d.ts +0 -108
- package/lib/types/abstract/gameComponents/card.js +0 -771
- package/lib/types/abstract/gameComponents/effect.d.ts +0 -82
- package/lib/types/abstract/gameComponents/effect.js +0 -331
- package/lib/types/abstract/gameComponents/effectSubtype.d.ts +0 -22
- package/lib/types/abstract/gameComponents/effectSubtype.js +0 -40
- package/lib/types/abstract/gameComponents/effectType.d.ts +0 -11
- package/lib/types/abstract/gameComponents/effectType.js +0 -8
- package/lib/types/abstract/gameComponents/settings.d.ts +0 -80
- package/lib/types/abstract/gameComponents/settings.js +0 -68
- package/lib/types/abstract/gameComponents/zone.d.ts +0 -113
- package/lib/types/abstract/gameComponents/zone.js +0 -614
- package/lib/types/abstract/gameComponents/zone_gridBased.d.ts +0 -18
- package/lib/types/abstract/gameComponents/zone_gridBased.js +0 -58
- package/lib/types/abstract/gameComponents/zone_stackBased.d.ts +0 -13
- package/lib/types/abstract/gameComponents/zone_stackBased.js +0 -55
- package/lib/types/abstract/generics/node.d.ts +0 -23
- package/lib/types/abstract/generics/node.js +0 -46
- package/lib/types/abstract/generics/position.d.ts +0 -23
- package/lib/types/abstract/generics/position.js +0 -91
- package/lib/types/abstract/generics/tree.d.ts +0 -25
- package/lib/types/abstract/generics/tree.js +0 -153
- package/lib/types/abstract/generics/universalResponse.d.ts +0 -4
- package/lib/types/abstract/generics/universalResponse.js +0 -2
- package/lib/types/abstract/generics/wraper.d.ts +0 -21
- package/lib/types/abstract/generics/wraper.js +0 -56
- package/lib/types/abstract/parser/component.d.ts +0 -88
- package/lib/types/abstract/parser/component.js +0 -132
- package/lib/types/abstract/parser/index.d.ts +0 -6
- package/lib/types/abstract/parser/index.js +0 -28
- package/lib/types/abstract/parser/modPack.d.ts +0 -21
- package/lib/types/abstract/parser/modPack.js +0 -48
- package/lib/types/abstract/parser/moduleInputObject.d.ts +0 -12
- package/lib/types/abstract/parser/moduleInputObject.js +0 -21
- package/lib/types/abstract/parser/options.d.ts +0 -31
- package/lib/types/abstract/parser/options.js +0 -45
- package/lib/types/abstract/serializedGameComponents/Gamestate.d.ts +0 -46
- package/lib/types/abstract/serializedGameComponents/Gamestate.js +0 -70
- package/lib/types/abstract/serializedGameComponents/Localized.d.ts +0 -69
- package/lib/types/abstract/serializedGameComponents/Localized.js +0 -84
- package/lib/types/defaultZones/ability.d.ts +0 -10
- package/lib/types/defaultZones/ability.js +0 -22
- package/lib/types/defaultZones/deck.d.ts +0 -25
- package/lib/types/defaultZones/deck.js +0 -90
- package/lib/types/defaultZones/drop.d.ts +0 -5
- package/lib/types/defaultZones/drop.js +0 -13
- package/lib/types/defaultZones/field.d.ts +0 -11
- package/lib/types/defaultZones/field.js +0 -35
- package/lib/types/defaultZones/grave.d.ts +0 -8
- package/lib/types/defaultZones/grave.js +0 -21
- package/lib/types/defaultZones/hand.d.ts +0 -5
- package/lib/types/defaultZones/hand.js +0 -14
- package/lib/types/defaultZones/storage.d.ts +0 -9
- package/lib/types/defaultZones/storage.js +0 -21
- package/lib/types/defaultZones/system.d.ts +0 -12
- package/lib/types/defaultZones/system.js +0 -35
- package/lib/types/defaultZones/void.d.ts +0 -4
- package/lib/types/defaultZones/void.js +0 -10
- package/lib/types/effects/effectSubtypes/subtype_chained.d.ts +0 -10
- package/lib/types/effects/effectSubtypes/subtype_chained.js +0 -17
- package/lib/types/effects/effectSubtypes/subtype_delayed.d.ts +0 -9
- package/lib/types/effects/effectSubtypes/subtype_delayed.js +0 -16
- package/lib/types/effects/effectSubtypes/subtype_fieldLock.d.ts +0 -9
- package/lib/types/effects/effectSubtypes/subtype_fieldLock.js +0 -21
- package/lib/types/effects/effectSubtypes/subtype_graveLock.d.ts +0 -9
- package/lib/types/effects/effectSubtypes/subtype_graveLock.js +0 -21
- package/lib/types/effects/effectSubtypes/subtype_hand_or_fieldLock.d.ts +0 -9
- package/lib/types/effects/effectSubtypes/subtype_hand_or_fieldLock.js +0 -21
- package/lib/types/effects/effectSubtypes/subtype_hardUnique.d.ts +0 -9
- package/lib/types/effects/effectSubtypes/subtype_hardUnique.js +0 -15
- package/lib/types/effects/effectSubtypes/subtype_instant.d.ts +0 -8
- package/lib/types/effects/effectSubtypes/subtype_instant.js +0 -20
- package/lib/types/effects/effectSubtypes/subtype_once.d.ts +0 -12
- package/lib/types/effects/effectSubtypes/subtype_once.js +0 -27
- package/lib/types/effects/effectSubtypes/subtype_unique.d.ts +0 -9
- package/lib/types/effects/effectSubtypes/subtype_unique.js +0 -16
- package/lib/types/effects/effectTypes/initEffect.d.ts +0 -7
- package/lib/types/effects/effectTypes/initEffect.js +0 -23
- package/lib/types/effects/effectTypes/lockEffect.d.ts +0 -9
- package/lib/types/effects/effectTypes/lockEffect.js +0 -25
- package/lib/types/effects/effectTypes/manualEffect.d.ts +0 -9
- package/lib/types/effects/effectTypes/manualEffect.js +0 -18
- package/lib/types/effects/effectTypes/passiveEffect.d.ts +0 -9
- package/lib/types/effects/effectTypes/passiveEffect.js +0 -23
- package/lib/types/effects/effectTypes/triggerEffect.d.ts +0 -9
- package/lib/types/effects/effectTypes/triggerEffect.js +0 -28
- package/lib/types/errors/cannotLoad.d.ts +0 -5
- package/lib/types/errors/cannotLoad.js +0 -13
- package/lib/types/errors/cardNotExist.d.ts +0 -5
- package/lib/types/errors/cardNotExist.js +0 -13
- package/lib/types/errors/cardNotInApplicableZone.d.ts +0 -5
- package/lib/types/errors/cardNotInApplicableZone.js +0 -13
- package/lib/types/errors/effectCondNotMet.d.ts +0 -5
- package/lib/types/errors/effectCondNotMet.js +0 -13
- package/lib/types/errors/effectNotExist.d.ts +0 -5
- package/lib/types/errors/effectNotExist.js +0 -13
- package/lib/types/errors/error.d.ts +0 -17
- package/lib/types/errors/error.js +0 -42
- package/lib/types/errors/incorrectActionType.d.ts +0 -5
- package/lib/types/errors/incorrectActionType.js +0 -13
- package/lib/types/errors/index.d.ts +0 -16
- package/lib/types/errors/index.js +0 -36
- package/lib/types/errors/invalidOrderMap.d.ts +0 -6
- package/lib/types/errors/invalidOrderMap.js +0 -14
- package/lib/types/errors/invalidPosition.d.ts +0 -6
- package/lib/types/errors/invalidPosition.js +0 -13
- package/lib/types/errors/subTypeOverrideConflict.d.ts +0 -7
- package/lib/types/errors/subTypeOverrideConflict.js +0 -15
- package/lib/types/errors/unknownError.d.ts +0 -5
- package/lib/types/errors/unknownError.js +0 -13
- package/lib/types/errors/unregisteredAction.d.ts +0 -6
- package/lib/types/errors/unregisteredAction.js +0 -13
- package/lib/types/errors/wrongEffectIdx.d.ts +0 -5
- package/lib/types/errors/wrongEffectIdx.js +0 -14
- package/lib/types/errors/zoneAttrConflict.d.ts +0 -5
- package/lib/types/errors/zoneAttrConflict.js +0 -15
- package/lib/types/errors/zoneFull.d.ts +0 -5
- package/lib/types/errors/zoneFull.js +0 -13
- package/lib/types/errors/zoneNotExist.d.ts +0 -5
- package/lib/types/errors/zoneNotExist.js +0 -13
- package/lib/types/misc.d.ts +0 -97
- package/lib/types/misc.js +0 -8
- package/lib/types/mods/effectTextParserModule.d.ts +0 -16
- package/lib/types/mods/effectTextParserModule.js +0 -81
- package/lib/types/mods/gameModule.d.ts +0 -5
- package/lib/types/mods/gameModule.js +0 -8
- package/lib/utils/index.d.ts +0 -78
- package/lib/utils/index.js +0 -562
package/README.md
CHANGED
|
@@ -1,9 +1,56 @@
|
|
|
1
|
-
# qpRemake
|
|
2
|
-
|
|
3
|
-
This is a card processing system for the game "Quantum Protocol" remade in native Typescript.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
# qpRemake
|
|
2
|
+
|
|
3
|
+
This is a card effect processing system for the game "Quantum Protocol" remade in native Typescript.
|
|
4
|
+
|
|
5
|
+
> Quantum Protocol and Jkong reserves all rights to the game and all related assets.
|
|
6
|
+
|
|
7
|
+
This README is outdated (not correspoinding to the latest commit's project structure) and will be update soon, stay tuned
|
|
8
|
+
|
|
9
|
+
## Table of contents
|
|
10
|
+
|
|
11
|
+
- [qpRemake](#qpremake)
|
|
12
|
+
- [Table of contents](#table-of-contents)
|
|
13
|
+
- [Installation](#installation)
|
|
14
|
+
- [Usage](#usage)
|
|
15
|
+
- [Basic usage](#basic-usage)
|
|
16
|
+
- [What the imported objects do](#what-the-imported-objects-do)
|
|
17
|
+
- [**queenSystem**](#queensystem)
|
|
18
|
+
- [**queenSystemComponents**](#queensystemcomponents)
|
|
19
|
+
- [**gameComponent**:](#gamecomponent)
|
|
20
|
+
- [**systemComponent**](#systemcomponent)
|
|
21
|
+
- [**queenSystemUtils**](#queensystemutils)
|
|
22
|
+
- [Advanced usage:](#advanced-usage)
|
|
23
|
+
- [Making your own renderer](#making-your-own-renderer)
|
|
24
|
+
- [Saving and loading game state:](#saving-and-loading-game-state)
|
|
25
|
+
- [Display texts](#display-texts)
|
|
26
|
+
- [Handling inputs](#handling-inputs)
|
|
27
|
+
- [Modding](#modding)
|
|
28
|
+
- [What is a mod?](#what-is-a-mod)
|
|
29
|
+
- [How mods are run](#how-mods-are-run)
|
|
30
|
+
- [How to make a mod](#how-to-make-a-mod)
|
|
31
|
+
- [Adding a mod](#adding-a-mod)
|
|
32
|
+
- [Example: Adding a custom effect](#example-adding-a-custom-effect)
|
|
33
|
+
- [Project contribution](#project-contribution)
|
|
34
|
+
- [Current progress:](#current-progress)
|
|
35
|
+
- [How to get and develop the project](#how-to-get-and-develop-the-project)
|
|
36
|
+
- [Clone the project:](#clone-the-project)
|
|
37
|
+
- [Run the project](#run-the-project)
|
|
38
|
+
- [Game components](#game-components)
|
|
39
|
+
- [Main gameplay loop](#main-gameplay-loop)
|
|
40
|
+
- [Project structure](#project-structure)
|
|
41
|
+
- [Contribution workflow guide](#contribution-workflow-guide)
|
|
42
|
+
- [Make effects](#make-effects)
|
|
43
|
+
- [Add more actions (if needed)](#add-more-actions-if-needed)
|
|
44
|
+
- [Update effect registry](#update-effect-registry)
|
|
45
|
+
- [Update card registry](#update-card-registry)
|
|
46
|
+
- [Update defaultSetting](#update-defaultsetting)
|
|
47
|
+
- [Running tests](#running-tests)
|
|
48
|
+
- [Make renderers](#make-renderers)
|
|
49
|
+
- [Improving the text parser](#improving-the-text-parser)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# Installation
|
|
7
54
|
|
|
8
55
|
The system is available via npm.
|
|
9
56
|
|
|
@@ -14,8 +61,9 @@ npm i qpremake
|
|
|
14
61
|
And then can be imported via
|
|
15
62
|
|
|
16
63
|
```ts
|
|
64
|
+
// ts
|
|
17
65
|
import {
|
|
18
|
-
queenSystem,
|
|
66
|
+
queenSystem as s,
|
|
19
67
|
queenSystemComponents,
|
|
20
68
|
queenSystemUtils
|
|
21
69
|
} from "qpremake"
|
|
@@ -24,6 +72,7 @@ import {
|
|
|
24
72
|
or
|
|
25
73
|
|
|
26
74
|
```js
|
|
75
|
+
// js
|
|
27
76
|
const {
|
|
28
77
|
queenSystem,
|
|
29
78
|
queenSystemComponents,
|
|
@@ -34,15 +83,21 @@ const {
|
|
|
34
83
|
There is also a default import for just the ```queenSystem```
|
|
35
84
|
|
|
36
85
|
```ts
|
|
86
|
+
// ts
|
|
37
87
|
import queenSystem from "qpRemake"
|
|
38
88
|
```
|
|
39
89
|
|
|
40
90
|
or
|
|
41
91
|
|
|
42
92
|
```js
|
|
93
|
+
// js
|
|
43
94
|
const queenSystem = require("qpRemake")
|
|
44
95
|
```
|
|
45
96
|
|
|
97
|
+
# Usage
|
|
98
|
+
|
|
99
|
+
This section is dedicated to thos who wish to use the system and render out a game, rather than modding stuff.
|
|
100
|
+
|
|
46
101
|
## Basic usage
|
|
47
102
|
|
|
48
103
|
This here is just a calculator for card effects. To have it renders out something visible, (like text or an HTML page), you have to hook it up to a ```Renderer```.
|
|
@@ -53,13 +108,15 @@ This code binds a renderer of your choice to the system for rendering. More info
|
|
|
53
108
|
import {queenSystem, queenSystemComponents} from "qpRemake"
|
|
54
109
|
|
|
55
110
|
const { operatorRegistry } = queenSystemComponents.registry
|
|
111
|
+
const sampleRenderer = queenSystemComponents.systemComponent.sampleRenderer
|
|
112
|
+
const defaultSetting = { queenSystemComponents }
|
|
56
113
|
|
|
57
114
|
let setting = new defaultSetting()
|
|
58
115
|
let renderer = new YourRendererHere()
|
|
59
116
|
// Your renderer shoudld be here
|
|
60
117
|
// What interface it follows is in the later sections.
|
|
61
118
|
|
|
62
|
-
let s = new queenSystem(setting,
|
|
119
|
+
let s = new queenSystem(setting, sampleRenderer)
|
|
63
120
|
renderer.bind(s)
|
|
64
121
|
s.addPlayers("player", operatorRegistry.o_esper)
|
|
65
122
|
s.addPlayers("enemy", operatorRegistry.o_null)
|
|
@@ -70,7 +127,7 @@ s.start();
|
|
|
70
127
|
|
|
71
128
|
## What the imported objects do
|
|
72
129
|
|
|
73
|
-
### queenSystem
|
|
130
|
+
### **queenSystem**
|
|
74
131
|
|
|
75
132
|
The queenSystem is a class that handles card effect calculations.
|
|
76
133
|
|
|
@@ -95,191 +152,289 @@ Here is a cheatsheet of what this class does from the perspective of a renderer:
|
|
|
95
152
|
3. ```addDeck``` : for adding decks
|
|
96
153
|
4. ```start``` : start the game
|
|
97
154
|
|
|
98
|
-
### queenSystemComponents
|
|
155
|
+
### **queenSystemComponents**
|
|
99
156
|
|
|
100
157
|
Various classes used in the processing of card effects.
|
|
101
158
|
|
|
102
159
|
Use from the perspective of a modder who wants to add more cards / effects.
|
|
103
160
|
Outside of this, one can read the data from the various registries (either enum or const key -> data pair).
|
|
104
161
|
|
|
105
|
-
|
|
162
|
+
For a cheat sheet, here are the properties of systemComponent:
|
|
163
|
+
|
|
164
|
+
1. ```gameComponent``` : holds various game component classes.
|
|
165
|
+
2. ```systemComponent``` : holds various services to operate on data
|
|
166
|
+
3. ```displayComponent``` : holds display parsed segements
|
|
167
|
+
4. ```registry``` : holds data
|
|
168
|
+
5. ```defaultSetting``` : holds the default setting
|
|
169
|
+
6. ```mod``` : holds what format mods must follows
|
|
170
|
+
|
|
171
|
+
#### **gameComponent**:
|
|
172
|
+
|
|
173
|
+
Holds various game component classes like ```Card, Effect, ...```.
|
|
174
|
+
|
|
175
|
+
The complete list is:
|
|
176
|
+
|
|
177
|
+
*Class entries*
|
|
178
|
+
1. ```Card```
|
|
179
|
+
2. ```Effect```
|
|
180
|
+
3. ```Zone_grid``` and ```Zone_stack``` : Default zone implementation
|
|
181
|
+
4. ```Action```
|
|
182
|
+
|
|
183
|
+
*Objects with classes inside*
|
|
184
|
+
|
|
185
|
+
5. ```EffectType``` :Various effect types
|
|
186
|
+
6. ```EffectSubType``` : Various effect subtypes
|
|
187
|
+
7. ```Zone``` : Various default zones
|
|
188
|
+
8. ```Serialized``` : Serialized components, for saving and loading
|
|
189
|
+
9. ```Localized``` : Localized components, passed to the renderer
|
|
190
|
+
|
|
191
|
+
#### **systemComponent**
|
|
192
|
+
|
|
193
|
+
Hold various services outside of gameplay intepretations.
|
|
194
|
+
|
|
195
|
+
The complete list is:
|
|
196
|
+
|
|
197
|
+
1. ```EffectTextParser``` : parses effect text
|
|
198
|
+
2. ```Localizer``` : localzied game components
|
|
199
|
+
3. ```ActionGenerator``` : generates actions
|
|
200
|
+
4. ```InputRequester``` : generates input requests
|
|
201
|
+
5. ```Renderer``` : an abstract class to how a renderer linked to the system shoudll be formatted.
|
|
202
|
+
6. ```SampleRenderer``` : an example renderer
|
|
203
|
+
|
|
204
|
+
### **queenSystemUtils**
|
|
205
|
+
|
|
206
|
+
Holds various utilities functions like rng or ID generation.
|
|
207
|
+
|
|
208
|
+
This object is also available as a global object in ```Utils```.
|
|
209
|
+
|
|
210
|
+
## Advanced usage:
|
|
211
|
+
|
|
212
|
+
### Making your own renderer
|
|
213
|
+
|
|
214
|
+
A renderer's job is to ..well render stuff.
|
|
215
|
+
|
|
216
|
+
The work flow of a renderer in **qpRemake** is to receive API like requests during the turn, renders it, then return control to the system to process more stuff.
|
|
217
|
+
|
|
218
|
+
The base abstract class / interface can be found in
|
|
106
219
|
|
|
107
220
|
```ts
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
//Action class, stores what to do (move card, delete, execute, etc)
|
|
111
|
-
Action,
|
|
112
|
-
|
|
113
|
-
//Card class, represents a card, all cards extends from this
|
|
114
|
-
Card,
|
|
115
|
-
|
|
116
|
-
//Effect class, cards contain effects, all effects extends from this
|
|
117
|
-
Effect,
|
|
118
|
-
|
|
119
|
-
//Two premade form of a zone class, mainly differ in how to store and interact with stored cards
|
|
120
|
-
Zone_grid, Zone_stack,
|
|
121
|
-
"Zone" : {
|
|
122
|
-
|
|
123
|
-
//Zone class, mainly just here for instanceof, use the above Zone_grid and Zone_stack instead
|
|
124
|
-
"ParentClass" : Zone,
|
|
125
|
-
|
|
126
|
-
//Below this are various premade zones
|
|
127
|
-
//To add your own, extend from one of Zone_grid or Zone_stack
|
|
128
|
-
//and implement zone methods to move cards and interupt events
|
|
129
|
-
|
|
130
|
-
//Zones initiates with a data structure
|
|
131
|
-
//to define capacity, shape, etc
|
|
132
|
-
//See zoneDataRegistry
|
|
133
|
-
|
|
134
|
-
Ability,
|
|
135
|
-
Deck,
|
|
136
|
-
Drop,
|
|
137
|
-
Field,
|
|
138
|
-
Grave,
|
|
139
|
-
Hand,
|
|
140
|
-
Storage,
|
|
141
|
-
System,
|
|
142
|
-
Void
|
|
143
|
-
},
|
|
144
|
-
"EffectSubType" : {
|
|
145
|
-
|
|
146
|
-
// Effects can have subtypes
|
|
147
|
-
// subtypes of an effect modifies an Effect's attribute
|
|
148
|
-
// and / or modifies the response
|
|
149
|
-
"ParentClass" : EffectSubtype,
|
|
150
|
-
|
|
151
|
-
//Below are various premade subtypes
|
|
152
|
-
|
|
153
|
-
Chained,
|
|
154
|
-
Delayed,
|
|
155
|
-
FieldLock,
|
|
156
|
-
GraveLock,
|
|
157
|
-
HandOrFieldLock,
|
|
158
|
-
HardUnique,
|
|
159
|
-
Instant,
|
|
160
|
-
Once,
|
|
161
|
-
Unique
|
|
162
|
-
},
|
|
163
|
-
"EffectType" : {
|
|
164
|
-
|
|
165
|
-
// Effects can also have a type
|
|
166
|
-
"ParentClass" : EffectType,
|
|
167
|
-
InitEffect,
|
|
168
|
-
LockEffect,
|
|
169
|
-
ManualEffect,
|
|
170
|
-
PassiveEffect,
|
|
171
|
-
TriggerEffect
|
|
172
|
-
},
|
|
173
|
-
"Serialized" : {
|
|
174
|
-
|
|
175
|
-
// The serialized version of game components
|
|
176
|
-
// remove circular references and should be save to JSON stringify
|
|
177
|
-
// and save
|
|
178
|
-
SerializedCard,
|
|
179
|
-
Serialized_effect,
|
|
180
|
-
SerializedZone,
|
|
181
|
-
SerializedPlayer,
|
|
182
|
-
SerializedSystem,
|
|
183
|
-
},
|
|
184
|
-
"Localized" : {
|
|
185
|
-
|
|
186
|
-
// Localized versions of game components
|
|
187
|
-
// All texts of these objects is parsed through the localizer already
|
|
188
|
-
// should also have no circular refs
|
|
189
|
-
LocalizedAction,
|
|
190
|
-
LocalizedCard,
|
|
191
|
-
LocalizedEffect,
|
|
192
|
-
LocalizedZone,
|
|
193
|
-
LocalizedPlayer,
|
|
194
|
-
LocalizedSystem,
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
"systemComponent" : {
|
|
198
|
-
|
|
199
|
-
// Various short hand services
|
|
200
|
-
|
|
201
|
-
// This one parses effect text, see more in later sections
|
|
202
|
-
"effectTextParser" : Parser,
|
|
203
|
-
|
|
204
|
-
// This one localizes the objects
|
|
205
|
-
"localizer" : Localizer,
|
|
206
|
-
|
|
207
|
-
// This one generate actions from a quick hand format
|
|
208
|
-
"actionGenerator" : actionConstructorRegistry,
|
|
209
|
-
|
|
210
|
-
// This one generates quick input array
|
|
211
|
-
"inputRequester" : Request,
|
|
212
|
-
},
|
|
213
|
-
"displayComponent" : {
|
|
214
|
-
|
|
215
|
-
// The parsed text is in an array of DisplayComponents
|
|
216
|
-
// For adaptability with various renderer
|
|
217
|
-
|
|
218
|
-
"ParentClass" : DisplayComponent,
|
|
219
|
-
TextComponent,
|
|
220
|
-
IconComponent,
|
|
221
|
-
ReferenceComponent,
|
|
222
|
-
ImageComponent,
|
|
223
|
-
SymbolComponent,
|
|
224
|
-
},
|
|
225
|
-
"registry" : {
|
|
226
|
-
// Registries are hard coded data
|
|
227
|
-
// some are enums, some are const key -> value
|
|
228
|
-
|
|
229
|
-
actionRegistry,
|
|
230
|
-
|
|
231
|
-
cardDataRegistry,
|
|
232
|
-
|
|
233
|
-
effectDataRegistry,
|
|
234
|
-
effectTypeRegistry,
|
|
235
|
-
|
|
236
|
-
operatorRegistry,
|
|
237
|
-
operatorDataRegistry,
|
|
238
|
-
|
|
239
|
-
rarityRegistry,
|
|
240
|
-
rarityDataRegistry,
|
|
241
|
-
|
|
242
|
-
subtypeRegistry,
|
|
243
|
-
|
|
244
|
-
zoneRegistry,
|
|
245
|
-
zoneDataRegistry,
|
|
246
|
-
},
|
|
247
|
-
"defaultSetting" : settings,
|
|
248
|
-
"mod" : {
|
|
249
|
-
|
|
250
|
-
//These are the class a mod must follows
|
|
251
|
-
// and extends from
|
|
252
|
-
|
|
253
|
-
GameModule,
|
|
254
|
-
ParserModule,
|
|
255
|
-
},
|
|
256
|
-
};
|
|
221
|
+
import {queenSystemComponents} from "qpremake"
|
|
222
|
+
const {Renderer} = queenSystemComponents.systemComponent
|
|
257
223
|
```
|
|
258
224
|
|
|
259
|
-
|
|
225
|
+
This class is as follows:
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
abstract class Renderer {
|
|
229
|
+
abstract gameStart(
|
|
230
|
+
s: LocalizedSystem,
|
|
231
|
+
callback: () => any
|
|
232
|
+
) : void;
|
|
233
|
+
|
|
234
|
+
abstract turnStart(
|
|
235
|
+
s: LocalizedSystem,
|
|
236
|
+
callback: (a? : Action) => any
|
|
237
|
+
) : void;
|
|
238
|
+
|
|
239
|
+
abstract update(
|
|
240
|
+
phase: TurnPhase,
|
|
241
|
+
s: LocalizedSystem,
|
|
242
|
+
a: Action,
|
|
243
|
+
callback: () => any
|
|
244
|
+
) : void;
|
|
245
|
+
|
|
246
|
+
abstract requestInput(
|
|
247
|
+
inputSet: inputData[],
|
|
248
|
+
phase: TurnPhase,
|
|
249
|
+
s: LocalizedSystem,
|
|
250
|
+
a: Action,
|
|
251
|
+
callback: (
|
|
252
|
+
input : inputData
|
|
253
|
+
) => any
|
|
254
|
+
) : void;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
These methods are called appropriately. There shoudl be guide comments when one implement these.
|
|
259
|
+
|
|
260
|
+
Notably, the system is paused after calling one of these. Sort of *"handing control over"* to the renderer. The system only resumes after **the provided callback()** is called.
|
|
261
|
+
|
|
262
|
+
One can make a new renderer to whatever front end frame work one likes by implementing this class.
|
|
263
|
+
|
|
264
|
+
### Saving and loading game state:
|
|
265
|
+
|
|
266
|
+
Game state or more specifically is an instance of ```SerializedSystem```.
|
|
267
|
+
|
|
268
|
+
At any time, this is obtained via:
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
s.toSerialized()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
This file can then be JSON and saved to a text file.
|
|
275
|
+
|
|
276
|
+
Loading said file is possible via the normal ```load()``` functionn before start:
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
const data = fs.readFileSync(...) as SerializedSystem
|
|
280
|
+
s.load(data)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Display texts
|
|
284
|
+
|
|
285
|
+
All texts provided via a ```Localized``` object is an array of ```Display components``` to guide the injection of icons and text formatting.
|
|
286
|
+
|
|
287
|
+
Those objects are available via:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
import {queenSystemComponents} from "qpremake"
|
|
291
|
+
const {TextComponent, IconComponent, ImageComponent} = queenSystemComponents.displayComponent
|
|
292
|
+
```
|
|
260
293
|
|
|
261
|
-
|
|
262
|
-
2. systemComponent : holds various services to operate on data
|
|
263
|
-
3. displayComponent : holds display parsed segements
|
|
264
|
-
4. registry : holds data
|
|
265
|
-
5. defaultSetting : holds the default setting
|
|
266
|
-
6. mod : holds what format mods must follows
|
|
294
|
+
### Handling inputs
|
|
267
295
|
|
|
268
|
-
|
|
296
|
+
Whenever an action wants an input (say, when a card says choose a card, choose a space on the board, etc). The method ```requestInput``` of the renderer is called.
|
|
269
297
|
|
|
270
|
-
|
|
298
|
+
All possible inputs is in the ```inputSet``` components, all these are in one specific type (a card, a spot on the field, a number, etc).
|
|
271
299
|
|
|
272
|
-
|
|
300
|
+
Inputs if required multiple are done sequentially. If a card wants the player to select 2 spots in the field, the request input function will be called twice for each.
|
|
301
|
+
|
|
302
|
+
At the start of the turn, there is also the need to select a **turn action**. Thus the ```turnStart``` method also have an option to continue with a player action.
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
# Modding
|
|
306
|
+
|
|
307
|
+
This section is dedicated to whomever wants to mod the system (add more cards, more localizations, etc).
|
|
308
|
+
|
|
309
|
+
## What is a mod?
|
|
310
|
+
|
|
311
|
+
Mods are ts files that changes the data od the system
|
|
312
|
+
|
|
313
|
+
There are 2 types:
|
|
314
|
+
|
|
315
|
+
1. gameplay mods, these can change what effects, cards, zones, characters, ... are possible
|
|
316
|
+
2. parsing mods, these changes the behavior of how card text are parse and localized. (If one specifically target changing localization, look in a localization file.)
|
|
317
|
+
|
|
318
|
+
## How mods are run
|
|
319
|
+
|
|
320
|
+
In the loading step of the system, mods are loaded and can change various registries via an API interface.
|
|
321
|
+
|
|
322
|
+
## How to make a mod
|
|
323
|
+
|
|
324
|
+
There are 2 ways. One either can clone / fork [the github rerpo](https://github.com/BlueG15/qpRemake).
|
|
325
|
+
Or add stuff after installing the system in the setting.
|
|
326
|
+
|
|
327
|
+
Both are essentially the same but you appear on the npm of the project under contribution :).
|
|
328
|
+
|
|
329
|
+
## Adding a mod
|
|
330
|
+
|
|
331
|
+
In the settings of the system, there is the field ```mods```, which stores an array of strings to code files inside the mod folder ("One can change this too").
|
|
332
|
+
|
|
333
|
+
A mod file exports default an implementation to the class ```mod``` available via:
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
import {queenSystemComponents} from "qpremake"
|
|
337
|
+
const {GameModule, ParserModule} = queenSystemComponents.mod
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
This game module is just this:
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
class GameModule {
|
|
344
|
+
//should override, call upon load
|
|
345
|
+
load(API : registryAPI) : void {}
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Very simple. That registryAPI looks like this:
|
|
350
|
+
|
|
351
|
+
```ts
|
|
352
|
+
interface registryAPI {
|
|
353
|
+
//SAFE registry edit
|
|
354
|
+
//There is also the registry for effectType and Action, but those doesnt need to be modified
|
|
355
|
+
registry_edit_card(key : string, value : cardData) : void;
|
|
356
|
+
registry_edit_effect_data(key : string, data : effectData) : void;
|
|
357
|
+
registry_edit_effect_class(
|
|
358
|
+
key : string,
|
|
359
|
+
constructors : typeof Effect | Record<string, typeof Effect>
|
|
360
|
+
) : void;
|
|
361
|
+
registry_edit_effect(
|
|
362
|
+
key : string,
|
|
363
|
+
data : effectData,
|
|
364
|
+
constructors : typeof Effect | Record<string, typeof Effect>
|
|
365
|
+
): void
|
|
366
|
+
registry_edit_effect_subtype(
|
|
367
|
+
key : string,
|
|
368
|
+
constructor : typeof EffectSubtype
|
|
369
|
+
) : void;
|
|
370
|
+
|
|
371
|
+
registry_edit_zone_data(key : string, data : zoneData) : void;
|
|
372
|
+
registry_edit_zone_class(
|
|
373
|
+
key : string,
|
|
374
|
+
constructor : typeof Zone
|
|
375
|
+
) : void;
|
|
376
|
+
registry_edit_zone(
|
|
377
|
+
key : string,
|
|
378
|
+
data : zoneData,
|
|
379
|
+
constructor : typeof Zone
|
|
380
|
+
) : void;
|
|
381
|
+
|
|
382
|
+
//UNSFAFE registry edit
|
|
383
|
+
registry_edit_custom_action_handler(
|
|
384
|
+
actionIDs : number[],
|
|
385
|
+
handlerFunc : ((a : Action, system : queenSystem) => undefined | void | Action[])
|
|
386
|
+
) : void;
|
|
387
|
+
|
|
388
|
+
//localization edit
|
|
389
|
+
registry_edit_localization(language : string, key : string, val : string) : void;
|
|
390
|
+
|
|
391
|
+
//... more coming
|
|
392
|
+
}
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
These methods are passed into the mod for editting.
|
|
396
|
+
|
|
397
|
+
## Example: Adding a custom effect
|
|
398
|
+
|
|
399
|
+
Effect have 2 parts, like almost every other gameplay components.
|
|
400
|
+
|
|
401
|
+
Those 2 parts are **Class part** and **Data part**
|
|
402
|
+
|
|
403
|
+
Those 2 parts are available via ```registry_edit_effect_data``` and ```registry_edit_effect_class``` respectively.
|
|
404
|
+
|
|
405
|
+
or both at the same time via ```registry_edit_effect```.
|
|
406
|
+
|
|
407
|
+
For this simple example, we ignore the data for now and implements the class part (data can be hard coded via the specified **effectData**) type.
|
|
408
|
+
|
|
409
|
+
We import the ```Effect``` class:
|
|
410
|
+
|
|
411
|
+
```ts
|
|
412
|
+
import {queenSystemComponents} from "qpremake"
|
|
413
|
+
const {Effect} = queenSystemComponents.gameComponent
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
And add it in:
|
|
417
|
+
|
|
418
|
+
```ts
|
|
419
|
+
class CustomEffect extends Effect {
|
|
420
|
+
// Your implementation here
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export default class customMod extends GameModule {
|
|
424
|
+
override load(API : registryAPI){
|
|
425
|
+
API.registry_edit_effect_class(
|
|
426
|
+
"customEffect1",
|
|
427
|
+
CustomEffect
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
```
|
|
273
432
|
|
|
274
|
-
|
|
275
|
-
2. add more actions (if needed)
|
|
276
|
-
3. update the effect registry
|
|
277
|
-
4. update the card registry
|
|
278
|
-
5. add a deck registry
|
|
279
|
-
6. make level / wave control
|
|
280
|
-
7. make a good renderer
|
|
433
|
+
What an effect does and how to implement its behavior is in the **make effect** section below.
|
|
281
434
|
|
|
435
|
+
Importantly, one **MUST NOT** override the contructor.
|
|
282
436
|
|
|
437
|
+
# Project contribution
|
|
283
438
|
|
|
284
439
|
## Current progress:
|
|
285
440
|
|
|
@@ -365,7 +520,7 @@ This child class has 5 jobs :
|
|
|
365
520
|
|
|
366
521
|
5. Return some parameters to inject into the effect text by overriding the ```getDisplayInput``` function.
|
|
367
522
|
|
|
368
|
-
Going over how to make an action, you need to invoke the const ```
|
|
523
|
+
Going over how to make an action, you need to invoke the const ```ActionGenerator```, hopefully ts takes over the rest of the guiding process if i do my magic correctly
|
|
369
524
|
|
|
370
525
|
|
|
371
526
|
Update 1.2.9:
|
|
@@ -376,9 +531,9 @@ If anyone knows how to write a better version of this rule, pls help
|
|
|
376
531
|
|
|
377
532
|
If you need more actions, please uhhh, notify me and skip that effect
|
|
378
533
|
|
|
379
|
-
Actions also have inputs with weird handling, I have made a template class for any effect that specifically wants the inputs for an
|
|
534
|
+
Actions also have inputs with weird handling, I have made a template class for any effect that specifically wants the inputs for an a_move but anything else is albeit possible, not short enough to be put on here so skip any effects that wants it
|
|
380
535
|
|
|
381
|
-
For me in the future, this requires updating
|
|
536
|
+
For me in the future, this requires updating ActionGenerator and changing the handling logic over in queenSystem
|
|
382
537
|
|
|
383
538
|
### Update effect registry
|
|
384
539
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qpremake",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "Remake of the qp engine in ts / js, with moddability in mind",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "node ./lib/testFile.js",
|
|
9
|
-
"build": "tsc",
|
|
9
|
+
"build": "IF EXIST \".\\lib\" RD /S /Q \".\\lib\" && tsc",
|
|
10
10
|
"dev": "npm run build && npm run test",
|
|
11
11
|
"prepublishOnly" : "npm run build"
|
|
12
12
|
},
|
|
@@ -29,11 +29,6 @@
|
|
|
29
29
|
"typescript": "^5.9.2",
|
|
30
30
|
"util": "^0.12.5"
|
|
31
31
|
},
|
|
32
|
-
"eslintConfig": {
|
|
33
|
-
"plugins": [
|
|
34
|
-
"local"
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
32
|
"files": [
|
|
38
33
|
"lib",
|
|
39
34
|
"README.md",
|