qpremake 1.5.1 → 1.5.2

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 CHANGED
@@ -1,6 +1,275 @@
1
1
  # qpRemake
2
- Alpha branch is finally ended and will be merged into main!!, only a renderer pending!
3
2
 
3
+ This is a card processing system for the game "Quantum Protocol" remade in native Typescript.
4
+ Quantum Protocol and Jkong reserves all rights to the game and all related assets.
5
+
6
+ ## Installation
7
+
8
+ The system is available via npm.
9
+
10
+ ```bash
11
+ npm i qpremake
12
+ ```
13
+
14
+ And then can be imported via
15
+
16
+ ```ts
17
+ import {
18
+ queenSystem,
19
+ queenSystemComponents,
20
+ queenSystemUtils
21
+ } from "qpremake"
22
+ ```
23
+
24
+ or
25
+
26
+ ```js
27
+ const {
28
+ queenSystem,
29
+ queenSystemComponents,
30
+ queenSystemUtils
31
+ } = require("qpremake")
32
+ ```
33
+
34
+ There is also a default import for just the ```queenSystem```
35
+
36
+ ```ts
37
+ import queenSystem from "qpRemake"
38
+ ```
39
+
40
+ or
41
+
42
+ ```js
43
+ const queenSystem = require("qpRemake")
44
+ ```
45
+
46
+ ## Basic usage
47
+
48
+ 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```.
49
+
50
+ This code binds a renderer of your choice to the system for rendering. More info on how the rendering life cycle work in later sections.
51
+
52
+ ```ts
53
+ import {queenSystem, queenSystemComponents} from "qpRemake"
54
+
55
+ const { operatorRegistry } = queenSystemComponents.registry
56
+
57
+ let setting = new defaultSetting()
58
+ let renderer = new YourRendererHere()
59
+ // Your renderer shoudld be here
60
+ // What interface it follows is in the later sections.
61
+
62
+ let s = new queenSystem(setting, renderer)
63
+ renderer.bind(s)
64
+ s.addPlayers("player", operatorRegistry.o_esper)
65
+ s.addPlayers("enemy", operatorRegistry.o_null)
66
+ await s.load()
67
+
68
+ s.start();
69
+ ```
70
+
71
+ ## What the imported objects do
72
+
73
+ ### queenSystem
74
+
75
+ The queenSystem is a class that handles card effect calculations.
76
+
77
+ It must first be loaded (async sadly cause file import is async) via ```load()```.
78
+
79
+ You can then load players gradually by ```addPlayers```, this will only accept 2 type "player" and "enemy" at the moment. The appropriate zones will be added correctly to the internal zone list.
80
+
81
+ With a renderer bound, the ```start``` method begins the communication loops between the queenSystem and the renderer.
82
+
83
+ The procedure goes as follows:
84
+ 1. The queenSystem calls ```turnStart``` of the renderer to begin a turn play.
85
+ 2. Once the Renderer can continue with player's action for that turn, ```processTurn``` is called
86
+ 3. Inside ```processTurn```, certain events will cause the system to halt and return control to the renderer. The renderer can decide when to continue by calling ```continue```;
87
+ 4. This continues until the player loses or won the round.
88
+
89
+ from the renderer's perspective, these functions are passed in so they need not remember what to call.
90
+
91
+ Here is a cheatsheet of what this class does from the perspective of a renderer:
92
+
93
+ 1. ```load``` : required to run before starting the game, async
94
+ 2. ```addPlayers``` : for adding players
95
+ 3. ```addDeck``` : for adding decks
96
+ 4. ```start``` : start the game
97
+
98
+ ### queenSystemComponents
99
+
100
+ Various classes used in the processing of card effects.
101
+
102
+ Use from the perspective of a modder who wants to add more cards / effects.
103
+ Outside of this, one can read the data from the various registries (either enum or const key -> data pair).
104
+
105
+ The structure of this object is as follows:
106
+
107
+ ```ts
108
+ const queenSystemComponents = {
109
+ "gameComponent" : {
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
+ };
257
+ ```
258
+
259
+ For a cheat sheet, here are the properties of systemComponent:
260
+
261
+ 1. gameComponent : holds various game component classes
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
267
+
268
+ ### Utils
269
+
270
+ Utils is a custom util object which hodl various utility methods. ts should suggest what it has already.
271
+
272
+ ## Pending Tasks
4
273
 
5
274
  1. make effects
6
275
  2. add more actions (if needed)
@@ -21,7 +290,7 @@ Alpha branch is finally ended and will be merged into main!!, only a renderer pe
21
290
 
22
291
  ( * ) : Fruit and Some of Generic
23
292
 
24
- ## How to get and run the project
293
+ ## How to get and develop the project
25
294
 
26
295
  ### Clone the project:
27
296
 
@@ -165,7 +434,13 @@ There are only a handful of modules right now, allowing stuff like
165
434
  ```XML
166
435
  <if type = "number"><numeric> a + b > c </><string> A + B </><string> C + D </></>
167
436
  ```
168
- Check the GitHub repo for the parser for more info.
437
+
438
+ Effect text now allow these short hand
439
+
440
+ ```
441
+ =abc prints a, b, c out
442
+ =<exprerssion>; inserts the expression
443
+ ```
169
444
 
170
445
 
171
446