qpremake 1.5.3 → 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.
Files changed (234) hide show
  1. package/README.md +5 -3
  2. package/package.json +2 -7
  3. package/lib/_localizationFiles/English.d.ts +0 -2
  4. package/lib/_localizationFiles/English.js +0 -307
  5. package/lib/_mods/parserModules/addSymbol.d.ts +0 -7
  6. package/lib/_mods/parserModules/addSymbol.js +0 -18
  7. package/lib/_mods/parserModules/expression.d.ts +0 -7
  8. package/lib/_mods/parserModules/expression.js +0 -45
  9. package/lib/_mods/parserModules/expression_parser.d.ts +0 -143
  10. package/lib/_mods/parserModules/expression_parser.js +0 -728
  11. package/lib/_mods/parserModules/img.d.ts +0 -8
  12. package/lib/_mods/parserModules/img.js +0 -42
  13. package/lib/_mods/parserModules/qpOriginal.d.ts +0 -5
  14. package/lib/_mods/parserModules/qpOriginal.js +0 -27
  15. package/lib/_mods/parserModules/sectionID.d.ts +0 -13
  16. package/lib/_mods/parserModules/sectionID.js +0 -56
  17. package/lib/_mods/parserModules/tags.d.ts +0 -9
  18. package/lib/_mods/parserModules/tags.js +0 -29
  19. package/lib/_mods/parserModules/uaddminus.d.ts +0 -9
  20. package/lib/_mods/parserModules/uaddminus.js +0 -42
  21. package/lib/_mods/parserModules/variantCheck.d.ts +0 -10
  22. package/lib/_mods/parserModules/variantCheck.js +0 -53
  23. package/lib/_queenSystem/handler/actionGenrator.d.ts +0 -994
  24. package/lib/_queenSystem/handler/actionGenrator.js +0 -646
  25. package/lib/_queenSystem/handler/actionInputGenerator.d.ts +0 -95
  26. package/lib/_queenSystem/handler/actionInputGenerator.js +0 -373
  27. package/lib/_queenSystem/handler/actionInputRequesterGenerator.d.ts +0 -92
  28. package/lib/_queenSystem/handler/actionInputRequesterGenerator.js +0 -341
  29. package/lib/_queenSystem/handler/cardHandler.d.ts +0 -20
  30. package/lib/_queenSystem/handler/cardHandler.js +0 -61
  31. package/lib/_queenSystem/handler/effectGenerator.d.ts +0 -1
  32. package/lib/_queenSystem/handler/effectGenerator.js +0 -127
  33. package/lib/_queenSystem/handler/localizationHandler.d.ts +0 -28
  34. package/lib/_queenSystem/handler/localizationHandler.js +0 -166
  35. package/lib/_queenSystem/handler/modHandler.d.ts +0 -10
  36. package/lib/_queenSystem/handler/modHandler.js +0 -36
  37. package/lib/_queenSystem/handler/oldDataProcessor.d.ts +0 -9
  38. package/lib/_queenSystem/handler/oldDataProcessor.js +0 -129
  39. package/lib/_queenSystem/handler/registryHandler.d.ts +0 -36
  40. package/lib/_queenSystem/handler/registryHandler.js +0 -63
  41. package/lib/_queenSystem/handler/zoneHandler.d.ts +0 -102
  42. package/lib/_queenSystem/handler/zoneHandler.js +0 -606
  43. package/lib/_queenSystem/loader/loader_card.d.ts +0 -20
  44. package/lib/_queenSystem/loader/loader_card.js +0 -124
  45. package/lib/_queenSystem/loader/loader_effect.d.ts +0 -27
  46. package/lib/_queenSystem/loader/loader_effect.js +0 -163
  47. package/lib/_queenSystem/loader/loader_handler.d.ts +0 -11
  48. package/lib/_queenSystem/loader/loader_handler.js +0 -24
  49. package/lib/_queenSystem/loader/loader_localization.d.ts +0 -11
  50. package/lib/_queenSystem/loader/loader_localization.js +0 -73
  51. package/lib/_queenSystem/loader/loader_mod.d.ts +0 -10
  52. package/lib/_queenSystem/loader/loader_mod.js +0 -72
  53. package/lib/_queenSystem/loader/loader_subtype.d.ts +0 -9
  54. package/lib/_queenSystem/loader/loader_subtype.js +0 -39
  55. package/lib/_queenSystem/loader/loader_type.d.ts +0 -9
  56. package/lib/_queenSystem/loader/loader_type.js +0 -39
  57. package/lib/_queenSystem/loader/loader_zone.d.ts +0 -14
  58. package/lib/_queenSystem/loader/loader_zone.js +0 -35
  59. package/lib/_queenSystem/queenSystem.d.ts +0 -127
  60. package/lib/_queenSystem/queenSystem.js +0 -996
  61. package/lib/_queenSystem/renderer/rendererInterface.d.ts +0 -27
  62. package/lib/_queenSystem/renderer/rendererInterface.js +0 -25
  63. package/lib/data/actionRegistry.d.ts +0 -56
  64. package/lib/data/actionRegistry.js +0 -60
  65. package/lib/data/cardRegistry.d.ts +0 -1162
  66. package/lib/data/cardRegistry.js +0 -716
  67. package/lib/data/deckRegistry.d.ts +0 -19
  68. package/lib/data/deckRegistry.js +0 -41
  69. package/lib/data/effectRegistry.d.ts +0 -465
  70. package/lib/data/effectRegistry.js +0 -151
  71. package/lib/data/effectTypeRegistry.d.ts +0 -14
  72. package/lib/data/effectTypeRegistry.js +0 -14
  73. package/lib/data/operatorRegistry.d.ts +0 -92
  74. package/lib/data/operatorRegistry.js +0 -82
  75. package/lib/data/rarityRegistry.d.ts +0 -28
  76. package/lib/data/rarityRegistry.js +0 -63
  77. package/lib/data/registryRegistry.d.ts +0 -10
  78. package/lib/data/registryRegistry.js +0 -14
  79. package/lib/data/subtypeRegistry.d.ts +0 -15
  80. package/lib/data/subtypeRegistry.js +0 -15
  81. package/lib/data/systemRegistry.d.ts +0 -253
  82. package/lib/data/systemRegistry.js +0 -56
  83. package/lib/data/zoneRegistry.d.ts +0 -43
  84. package/lib/data/zoneRegistry.js +0 -157
  85. package/lib/effectTextParser/index.d.ts +0 -42
  86. package/lib/effectTextParser/index.js +0 -316
  87. package/lib/global/index.d.ts +0 -8
  88. package/lib/global/index.js +0 -12
  89. package/lib/index.d.ts +0 -6335
  90. package/lib/index.js +0 -205
  91. package/lib/specificEffects/e_cond.d.ts +0 -11
  92. package/lib/specificEffects/e_cond.js +0 -36
  93. package/lib/specificEffects/e_fruit.d.ts +0 -3
  94. package/lib/specificEffects/e_fruit.js +0 -187
  95. package/lib/specificEffects/e_generic.d.ts +0 -191
  96. package/lib/specificEffects/e_generic.js +0 -662
  97. package/lib/specificEffects/e_generic_cardTargetting.d.ts +0 -38
  98. package/lib/specificEffects/e_generic_cardTargetting.js +0 -82
  99. package/lib/specificEffects/e_generic_noneTargetting.d.ts +0 -10
  100. package/lib/specificEffects/e_generic_noneTargetting.js +0 -26
  101. package/lib/specificEffects/e_status.d.ts +0 -80
  102. package/lib/specificEffects/e_status.js +0 -151
  103. package/lib/specificEffects/e_test.d.ts +0 -3
  104. package/lib/specificEffects/e_test.js +0 -21
  105. package/lib/types/abstract/gameComponents/API.d.ts +0 -19
  106. package/lib/types/abstract/gameComponents/API.js +0 -2
  107. package/lib/types/abstract/gameComponents/card.d.ts +0 -108
  108. package/lib/types/abstract/gameComponents/card.js +0 -771
  109. package/lib/types/abstract/gameComponents/effect.d.ts +0 -82
  110. package/lib/types/abstract/gameComponents/effect.js +0 -331
  111. package/lib/types/abstract/gameComponents/effectSubtype.d.ts +0 -22
  112. package/lib/types/abstract/gameComponents/effectSubtype.js +0 -40
  113. package/lib/types/abstract/gameComponents/effectType.d.ts +0 -11
  114. package/lib/types/abstract/gameComponents/effectType.js +0 -8
  115. package/lib/types/abstract/gameComponents/settings.d.ts +0 -80
  116. package/lib/types/abstract/gameComponents/settings.js +0 -72
  117. package/lib/types/abstract/gameComponents/zone.d.ts +0 -113
  118. package/lib/types/abstract/gameComponents/zone.js +0 -614
  119. package/lib/types/abstract/gameComponents/zone_gridBased.d.ts +0 -18
  120. package/lib/types/abstract/gameComponents/zone_gridBased.js +0 -58
  121. package/lib/types/abstract/gameComponents/zone_stackBased.d.ts +0 -13
  122. package/lib/types/abstract/gameComponents/zone_stackBased.js +0 -55
  123. package/lib/types/abstract/generics/node.d.ts +0 -23
  124. package/lib/types/abstract/generics/node.js +0 -46
  125. package/lib/types/abstract/generics/position.d.ts +0 -23
  126. package/lib/types/abstract/generics/position.js +0 -91
  127. package/lib/types/abstract/generics/tree.d.ts +0 -25
  128. package/lib/types/abstract/generics/tree.js +0 -153
  129. package/lib/types/abstract/generics/universalResponse.d.ts +0 -4
  130. package/lib/types/abstract/generics/universalResponse.js +0 -2
  131. package/lib/types/abstract/generics/wraper.d.ts +0 -21
  132. package/lib/types/abstract/generics/wraper.js +0 -56
  133. package/lib/types/abstract/parser/component.d.ts +0 -88
  134. package/lib/types/abstract/parser/component.js +0 -132
  135. package/lib/types/abstract/parser/index.d.ts +0 -6
  136. package/lib/types/abstract/parser/index.js +0 -28
  137. package/lib/types/abstract/parser/modPack.d.ts +0 -21
  138. package/lib/types/abstract/parser/modPack.js +0 -48
  139. package/lib/types/abstract/parser/moduleInputObject.d.ts +0 -12
  140. package/lib/types/abstract/parser/moduleInputObject.js +0 -21
  141. package/lib/types/abstract/parser/options.d.ts +0 -31
  142. package/lib/types/abstract/parser/options.js +0 -45
  143. package/lib/types/abstract/serializedGameComponents/Gamestate.d.ts +0 -46
  144. package/lib/types/abstract/serializedGameComponents/Gamestate.js +0 -70
  145. package/lib/types/abstract/serializedGameComponents/Localized.d.ts +0 -69
  146. package/lib/types/abstract/serializedGameComponents/Localized.js +0 -84
  147. package/lib/types/defaultZones/ability.d.ts +0 -10
  148. package/lib/types/defaultZones/ability.js +0 -22
  149. package/lib/types/defaultZones/deck.d.ts +0 -25
  150. package/lib/types/defaultZones/deck.js +0 -90
  151. package/lib/types/defaultZones/drop.d.ts +0 -5
  152. package/lib/types/defaultZones/drop.js +0 -13
  153. package/lib/types/defaultZones/field.d.ts +0 -11
  154. package/lib/types/defaultZones/field.js +0 -35
  155. package/lib/types/defaultZones/grave.d.ts +0 -8
  156. package/lib/types/defaultZones/grave.js +0 -21
  157. package/lib/types/defaultZones/hand.d.ts +0 -5
  158. package/lib/types/defaultZones/hand.js +0 -14
  159. package/lib/types/defaultZones/storage.d.ts +0 -9
  160. package/lib/types/defaultZones/storage.js +0 -21
  161. package/lib/types/defaultZones/system.d.ts +0 -12
  162. package/lib/types/defaultZones/system.js +0 -35
  163. package/lib/types/defaultZones/void.d.ts +0 -4
  164. package/lib/types/defaultZones/void.js +0 -10
  165. package/lib/types/effects/effectSubtypes/subtype_chained.d.ts +0 -10
  166. package/lib/types/effects/effectSubtypes/subtype_chained.js +0 -17
  167. package/lib/types/effects/effectSubtypes/subtype_delayed.d.ts +0 -9
  168. package/lib/types/effects/effectSubtypes/subtype_delayed.js +0 -16
  169. package/lib/types/effects/effectSubtypes/subtype_fieldLock.d.ts +0 -9
  170. package/lib/types/effects/effectSubtypes/subtype_fieldLock.js +0 -21
  171. package/lib/types/effects/effectSubtypes/subtype_graveLock.d.ts +0 -9
  172. package/lib/types/effects/effectSubtypes/subtype_graveLock.js +0 -21
  173. package/lib/types/effects/effectSubtypes/subtype_hand_or_fieldLock.d.ts +0 -9
  174. package/lib/types/effects/effectSubtypes/subtype_hand_or_fieldLock.js +0 -21
  175. package/lib/types/effects/effectSubtypes/subtype_hardUnique.d.ts +0 -9
  176. package/lib/types/effects/effectSubtypes/subtype_hardUnique.js +0 -15
  177. package/lib/types/effects/effectSubtypes/subtype_instant.d.ts +0 -8
  178. package/lib/types/effects/effectSubtypes/subtype_instant.js +0 -20
  179. package/lib/types/effects/effectSubtypes/subtype_once.d.ts +0 -12
  180. package/lib/types/effects/effectSubtypes/subtype_once.js +0 -27
  181. package/lib/types/effects/effectSubtypes/subtype_unique.d.ts +0 -9
  182. package/lib/types/effects/effectSubtypes/subtype_unique.js +0 -16
  183. package/lib/types/effects/effectTypes/initEffect.d.ts +0 -7
  184. package/lib/types/effects/effectTypes/initEffect.js +0 -23
  185. package/lib/types/effects/effectTypes/lockEffect.d.ts +0 -9
  186. package/lib/types/effects/effectTypes/lockEffect.js +0 -25
  187. package/lib/types/effects/effectTypes/manualEffect.d.ts +0 -9
  188. package/lib/types/effects/effectTypes/manualEffect.js +0 -18
  189. package/lib/types/effects/effectTypes/passiveEffect.d.ts +0 -9
  190. package/lib/types/effects/effectTypes/passiveEffect.js +0 -23
  191. package/lib/types/effects/effectTypes/triggerEffect.d.ts +0 -9
  192. package/lib/types/effects/effectTypes/triggerEffect.js +0 -28
  193. package/lib/types/errors/cannotLoad.d.ts +0 -5
  194. package/lib/types/errors/cannotLoad.js +0 -13
  195. package/lib/types/errors/cardNotExist.d.ts +0 -5
  196. package/lib/types/errors/cardNotExist.js +0 -13
  197. package/lib/types/errors/cardNotInApplicableZone.d.ts +0 -5
  198. package/lib/types/errors/cardNotInApplicableZone.js +0 -13
  199. package/lib/types/errors/effectCondNotMet.d.ts +0 -5
  200. package/lib/types/errors/effectCondNotMet.js +0 -13
  201. package/lib/types/errors/effectNotExist.d.ts +0 -5
  202. package/lib/types/errors/effectNotExist.js +0 -13
  203. package/lib/types/errors/error.d.ts +0 -17
  204. package/lib/types/errors/error.js +0 -42
  205. package/lib/types/errors/incorrectActionType.d.ts +0 -5
  206. package/lib/types/errors/incorrectActionType.js +0 -13
  207. package/lib/types/errors/index.d.ts +0 -16
  208. package/lib/types/errors/index.js +0 -36
  209. package/lib/types/errors/invalidOrderMap.d.ts +0 -6
  210. package/lib/types/errors/invalidOrderMap.js +0 -14
  211. package/lib/types/errors/invalidPosition.d.ts +0 -6
  212. package/lib/types/errors/invalidPosition.js +0 -13
  213. package/lib/types/errors/subTypeOverrideConflict.d.ts +0 -7
  214. package/lib/types/errors/subTypeOverrideConflict.js +0 -15
  215. package/lib/types/errors/unknownError.d.ts +0 -5
  216. package/lib/types/errors/unknownError.js +0 -13
  217. package/lib/types/errors/unregisteredAction.d.ts +0 -6
  218. package/lib/types/errors/unregisteredAction.js +0 -13
  219. package/lib/types/errors/wrongEffectIdx.d.ts +0 -5
  220. package/lib/types/errors/wrongEffectIdx.js +0 -14
  221. package/lib/types/errors/zoneAttrConflict.d.ts +0 -5
  222. package/lib/types/errors/zoneAttrConflict.js +0 -15
  223. package/lib/types/errors/zoneFull.d.ts +0 -5
  224. package/lib/types/errors/zoneFull.js +0 -13
  225. package/lib/types/errors/zoneNotExist.d.ts +0 -5
  226. package/lib/types/errors/zoneNotExist.js +0 -13
  227. package/lib/types/misc.d.ts +0 -97
  228. package/lib/types/misc.js +0 -8
  229. package/lib/types/mods/effectTextParserModule.d.ts +0 -16
  230. package/lib/types/mods/effectTextParserModule.js +0 -81
  231. package/lib/types/mods/gameModule.d.ts +0 -5
  232. package/lib/types/mods/gameModule.js +0 -8
  233. package/lib/utils/index.d.ts +0 -78
  234. package/lib/utils/index.js +0 -562
@@ -1,646 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.actionFormRegistry = exports.actionConstructorRegistry = exports.Action_class = void 0;
7
- exports.getDefaultObjContructionObj = getDefaultObjContructionObj;
8
- const actionRegistry_1 = __importDefault(require("../../data/actionRegistry"));
9
- const systemRegistry_1 = require("../../data/systemRegistry");
10
- const zoneRegistry_1 = require("../../data/zoneRegistry");
11
- const position_1 = __importDefault(require("../../types/abstract/generics/position"));
12
- class Action_class {
13
- cost() {
14
- this.isCost = true;
15
- this.attr.set("canBeChainedTo", false);
16
- this.attr.set("canBeTriggeredTo", false);
17
- }
18
- deleteInputObj() {
19
- this.attr.delete("input");
20
- }
21
- clone() {
22
- return Utils.clone(this);
23
- }
24
- copy(a) {
25
- this.id = a.id;
26
- this.typeID = a.typeID;
27
- this.isDisabled = a.isDisabled;
28
- this.targets = a.targets;
29
- this.cause = a.cause;
30
- this.originalCause = a.originalCause;
31
- this.originalTargets = a.originalTargets;
32
- this.modifiedSinceLastAccessed = true;
33
- this.checkers = a.checkers;
34
- this.__inputs = a.__inputs;
35
- // this.isInputsApplied_internal = a.isInputsApplied_internal;
36
- this.attr = a.attr;
37
- }
38
- // protected isInputsApplied_internal = false;
39
- // get isInputsApplied() {
40
- // return this.inputs === undefined || this.isInputsApplied_internal
41
- // }
42
- // isChain: boolean; //if false, attach as new tree, if not, attach to curr action
43
- //isChain is not up to the action, its up to whatever type and subtype is attached
44
- //somewhat
45
- //if no trigger, no passive, no chained subtype, isChain here is used instead
46
- //so isChain here is a default
47
- flat() {
48
- let x = {
49
- targets: this.targets,
50
- cause: this.cause,
51
- originalTargets: this.originalTargets,
52
- originalCause: this.originalCause,
53
- modifiedSinceLastAccessed: this.modifiedSinceLastAccessed,
54
- isDisabled: this.isDisabled,
55
- id: this.id,
56
- typeID: this.typeID,
57
- isChain: this.isChain,
58
- canBeChainedTo: this.canBeChainedTo,
59
- canBeTriggeredTo: this.canBeTriggeredTo,
60
- attr: {}
61
- };
62
- this.attr.forEach((val, key) => {
63
- x.attr[key] = val;
64
- });
65
- return x;
66
- }
67
- flatAttr() {
68
- let x = {};
69
- this.attr.forEach((val, key) => {
70
- x[key] = val;
71
- });
72
- return x;
73
- }
74
- resolvable(s, z, c, eff, subtype) {
75
- //Oct 5th, i forgor what this is for but it breaks for stuff with multiple of the same type
76
- //like a_draw
77
- //no way the id check matches 2 times for 2 different zones man
78
- //this now checks for at least 1 one per type thats in the target
79
- //i.e if target has 2 zones, only 1 zone needs to match teh condition
80
- //TODO : figure out what i was trying to do here
81
- const seenTypes = new Set();
82
- return this.targets.every(target => {
83
- if (seenTypes.has(target.type))
84
- return true;
85
- seenTypes.add(target.type);
86
- switch (target.type) {
87
- case systemRegistry_1.identificationType.zone: return z ? this.checkers.zone(target, z) : false;
88
- case systemRegistry_1.identificationType.card: return (c && z) ? this.checkers.card(target, c, z) : false;
89
- case systemRegistry_1.identificationType.effect: return (eff && c && z) ? this.checkers.effect(target, eff, c, z) : false;
90
- case systemRegistry_1.identificationType.effectSubtype: return (subtype && eff && c && z) ? this.checkers.effectSubtype(target, subtype, eff, c, z) : false;
91
- default: return true;
92
- }
93
- });
94
- }
95
- get isChain() {
96
- let t = this.attr.get("isChain");
97
- if (typeof t === "boolean")
98
- return t;
99
- else
100
- this.isChain = true;
101
- return true;
102
- }
103
- set isChain(newVal) {
104
- this.attr.set("isChain", newVal);
105
- }
106
- get canBeChainedTo() { return Boolean(this.attr.get("canBeChainedTo")); }
107
- ;
108
- get canBeTriggeredTo() { return Boolean(this.attr.get("canBeTriggeredTo")); }
109
- ;
110
- get firstCardTarget() {
111
- return this.targets.find(i => i.type === systemRegistry_1.identificationType.card);
112
- }
113
- get firstPosTarget() {
114
- return this.targets.find(i => i.type === systemRegistry_1.identificationType.position);
115
- }
116
- get firstZoneTarget() {
117
- return this.targets.find(i => i.type === systemRegistry_1.identificationType.zone);
118
- }
119
- constructor(o) {
120
- var _a, _b;
121
- this.id = NaN;
122
- this.isDisabled = false;
123
- this.isCost = false;
124
- this.attr = new Map();
125
- this.__inputs = [];
126
- this.typeID = o.type;
127
- this.isChain = (o.isChainDefault === false) ? false : true;
128
- this.targets = ((_a = o.targets) !== null && _a !== void 0 ? _a : []);
129
- this.cause = ((_b = o.cause) !== null && _b !== void 0 ? _b : {
130
- type: systemRegistry_1.identificationType.none
131
- });
132
- this.originalCause = this.cause;
133
- this.originalTargets = this.targets;
134
- this.modifyAttr("canBeChainedTo", (o.canBeChainTo === false) ? false : true);
135
- this.modifyAttr("canBeTriggeredTo", (o.canBeTriggeredTo === false) ? false : true);
136
- this.modifiedSinceLastAccessed = false;
137
- //binding checker
138
- this.checkers = defaultChecker;
139
- if (o.checkers) {
140
- Utils.patchGeneric(this.checkers, o.checkers);
141
- }
142
- Object.entries(o).forEach(([key, val]) => {
143
- if (key !== "type" &&
144
- key !== "targets" &&
145
- key !== "cause" &&
146
- val !== undefined) {
147
- this.attr.set(key, val);
148
- }
149
- });
150
- }
151
- dontchain() {
152
- this.isChain = false;
153
- return this;
154
- }
155
- chain() {
156
- this.isChain = true;
157
- return this;
158
- }
159
- assignID(n) {
160
- this.id = n;
161
- }
162
- get hasCardTarget() {
163
- return this.targets.length !== 0 && this.targets.some(i => i.type === systemRegistry_1.identificationType.card);
164
- }
165
- get hasActionTarget() {
166
- return this.targets.length !== 0 && this.targets.some(i => i.type === systemRegistry_1.identificationType.action);
167
- }
168
- get hasCause() {
169
- return this.cause.type !== systemRegistry_1.identificationType.none;
170
- }
171
- //dont have cause -> cause is from playerAction
172
- // get fromPlayer() {
173
- // return this.hasCause;
174
- // }
175
- get fromCard() {
176
- return this.cause.type === systemRegistry_1.identificationType.card;
177
- }
178
- get type() {
179
- return actionRegistry_1.default[this.typeID];
180
- }
181
- // get requireInput() {
182
- // return this.inputs !== undefined
183
- // }
184
- verifyNewValue(key, newVal) {
185
- if (key === "target")
186
- return true; //handled later
187
- if (key === "canBeChainedTo" && typeof newVal === "boolean")
188
- return true;
189
- if (key === "canBeTriggeredTo" && typeof newVal === "boolean")
190
- return true;
191
- let oldVal = this.attr.get(key);
192
- if (Utils.getTypeSigature(oldVal) === Utils.getTypeSigature(newVal))
193
- return true;
194
- return false;
195
- }
196
- modifyAttr(key, newVal) {
197
- if (newVal === this.attr.get(key))
198
- return;
199
- //check type
200
- if (!this.verifyNewValue(key, newVal))
201
- return;
202
- if (key === "target") {
203
- if (Array.isArray(newVal)) {
204
- if (this.targets.length !== newVal.length)
205
- return;
206
- newVal = newVal.map((i, index) => this.verifyTarget(i, this.targets[index].type));
207
- if (newVal.some((i) => i === undefined))
208
- return;
209
- this.targets = newVal;
210
- this.modifiedSinceLastAccessed = true;
211
- return;
212
- }
213
- else {
214
- if (this.targets.length !== 1)
215
- return;
216
- newVal = this.verifyTarget(newVal, this.targets[0].type);
217
- if (!newVal)
218
- return;
219
- this.targets = [newVal];
220
- this.modifiedSinceLastAccessed = true;
221
- return;
222
- }
223
- }
224
- this.modifiedSinceLastAccessed = true;
225
- this.attr.set(key, newVal);
226
- }
227
- verifyTarget(val, compareType) {
228
- if (typeof val !== "object")
229
- return undefined;
230
- if (typeof val.type !== "number")
231
- return undefined;
232
- if (val.type !== compareType)
233
- return undefined;
234
- switch (val.type) {
235
- case systemRegistry_1.identificationType.none: return val;
236
- case systemRegistry_1.identificationType.player:
237
- case systemRegistry_1.identificationType.zone: {
238
- if (typeof val.id === "number")
239
- return val;
240
- else
241
- return undefined;
242
- }
243
- case systemRegistry_1.identificationType.card: {
244
- if (typeof val.id === "string")
245
- return val;
246
- else
247
- return undefined;
248
- }
249
- case systemRegistry_1.identificationType.effect: {
250
- if (typeof val.cid === "string" && typeof val.eid === "string")
251
- return val;
252
- return undefined;
253
- }
254
- case systemRegistry_1.identificationType.position: {
255
- if (val.pos instanceof position_1.default)
256
- return val;
257
- return undefined;
258
- }
259
- case systemRegistry_1.identificationType.action: {
260
- if (val.action instanceof Action_class)
261
- return val;
262
- return undefined;
263
- }
264
- case systemRegistry_1.identificationType.effectSubtype: {
265
- if (typeof val.cid === "string" && typeof val.eid === "string" && typeof val.stid === "string")
266
- return val;
267
- return undefined;
268
- }
269
- default: return undefined;
270
- }
271
- }
272
- // private verifyInput_all(input : inputData[]){
273
- // const obj = this.inputs
274
- // if(!obj) return false
275
- // return input.length === obj.inputs.length && input.every((i, index) => i.type === obj.inputs[index])
276
- // }
277
- verifyInput_target_all(input) {
278
- return (input.length === this.targets.length &&
279
- input.every((i, index) => (typeof i.data === "object" && (!Array.isArray(i.data)) && i.data.type === this.targets[index].type)));
280
- }
281
- //false : no restriction
282
- //true : completed
283
- //inputData[] : restricted to this set
284
- // applyUserInput(system : dry_system, input?: inputData): boolean | inputData[]{
285
- // const obj = this.inputs
286
- // if(!obj) return true
287
- // let v : inputData[] | -1 | void = obj.getValid.next(input as any).value
288
- // let nextInputType = obj.inputs[this.__inputs.length]
289
- // if(input === undefined){
290
- // if(Array.isArray(v)) return v;
291
- // return this.__getAllInputs(system, nextInputType);
292
- // } //first next
293
- // if(this.__inputs.length >= obj.inputs.length) return true;
294
- // this.__inputs.push(input);
295
- // if(this.__inputs.length === obj.inputs.length) {
296
- // this.isInputsApplied_internal = true;
297
- // obj.applyInput(system, this, this.__inputs);
298
- // return true;
299
- // } else {
300
- // if(v === undefined) throw new Error(`try to apply input when input is finished taking`)
301
- // if(Array.isArray(v)) return v;
302
- // return this.__getAllInputs(system, nextInputType);
303
- // }
304
- // }
305
- disable() {
306
- this.isDisabled = true;
307
- }
308
- enable() {
309
- this.isDisabled = false;
310
- }
311
- is(type) {
312
- return this.typeID === actionRegistry_1.default[type];
313
- }
314
- }
315
- exports.Action_class = Action_class;
316
- function defaultChecker_zone(target, currZone) {
317
- return target.zone.id === currZone.id;
318
- }
319
- function defaultCheker_card(target, currCard, currZone, strict = false) {
320
- return target.card.id === currCard.id && (!strict || target.card.pos.is(currCard.pos));
321
- }
322
- function defaultChecker_effect(target, currEffect, currCard, currZone, recur = true, strict = false) {
323
- return target.eff.id === currEffect.id && (!recur || defaultCheker_card(target, currCard, currZone, strict));
324
- }
325
- function defaultChecker_effectSubtype(target, currSubtype, currEffect, currCard, currZone, recur = false, strict = false) {
326
- return target.subtype.dataID === currSubtype.dataID && defaultChecker_effect(target, currEffect, currCard, currZone, recur, strict);
327
- }
328
- const defaultChecker = {
329
- zone: defaultChecker_zone,
330
- card: defaultCheker_card,
331
- effect: defaultChecker_effect,
332
- effectSubtype: defaultChecker_effectSubtype
333
- };
334
- function form_card(s) {
335
- return (card) => {
336
- return {
337
- type: systemRegistry_1.identificationType.card,
338
- sys: s,
339
- card: card,
340
- is(card) {
341
- return card.id === this.card.id;
342
- }
343
- };
344
- };
345
- }
346
- function form_action(s) {
347
- return (a) => {
348
- return {
349
- type: systemRegistry_1.identificationType.action,
350
- sys: s,
351
- action: a,
352
- is(type) {
353
- return this.action.is(type);
354
- }
355
- };
356
- };
357
- }
358
- function form_effect(s) {
359
- return (card, eff) => {
360
- return {
361
- type: systemRegistry_1.identificationType.effect,
362
- sys: s,
363
- card: card,
364
- eff: eff,
365
- is(card, eff) {
366
- return this.card.is(card) && this.eff.is(eff);
367
- },
368
- };
369
- };
370
- }
371
- function form_zone(s) {
372
- return (zone) => {
373
- return {
374
- type: systemRegistry_1.identificationType.zone,
375
- sys: s,
376
- zone: zone,
377
- is(p) {
378
- return this.zone.is(p);
379
- },
380
- of(p) {
381
- return this.zone.of(p);
382
- }
383
- };
384
- };
385
- }
386
- function form_position(s) {
387
- return (pos) => {
388
- return {
389
- type: systemRegistry_1.identificationType.position,
390
- sys: s,
391
- pos: pos,
392
- is(pos) {
393
- return this.pos.is(pos);
394
- },
395
- };
396
- };
397
- }
398
- function form_player(s) {
399
- return (pid) => {
400
- return {
401
- type: systemRegistry_1.identificationType.player,
402
- sys: s,
403
- id: pid,
404
- is(player_owned_obj) {
405
- return player_owned_obj.playerIndex === this.id;
406
- },
407
- };
408
- };
409
- }
410
- function form_partition(s) {
411
- return (pid) => {
412
- return {
413
- type: systemRegistry_1.identificationType.partition,
414
- sys: s,
415
- pid,
416
- is(n) {
417
- return n === pid;
418
- }
419
- };
420
- };
421
- }
422
- function form_subtype(s) {
423
- return (card, eff, subtype) => {
424
- return {
425
- type: systemRegistry_1.identificationType.effectSubtype,
426
- sys: s,
427
- card: card,
428
- eff: eff,
429
- subtype: subtype,
430
- is(card, eff, subtype) {
431
- return this.card.is(card) && this.eff.is(eff) && this.subtype.dataID === subtype.dataID;
432
- },
433
- };
434
- };
435
- }
436
- function form_none() {
437
- return {
438
- type: systemRegistry_1.identificationType.none
439
- };
440
- }
441
- function form_system() {
442
- return {
443
- type: systemRegistry_1.identificationType.system
444
- };
445
- }
446
- function ActionAssembler_base(name, targets, cause, info) {
447
- const o1 = getDefaultObjContructionObj(actionRegistry_1.default[name]);
448
- const o2 = Object.assign(Object.assign({ targets: targets, cause: cause }, o1), info);
449
- return new Action_class(o2);
450
- }
451
- //end overload-with info section
452
- function ActionAssembler(name, ...f) {
453
- //for a general solution, we curried up to f[len - 2], if that last element is an object, we stop
454
- //so the standard calls is (s, ...p) => ...ps
455
- //we pre-curried the first param, then reuse s for the rest
456
- if (f.length === 0)
457
- return (cause, infoObj = {}) => ActionAssembler_base(name, [form_none()], cause, infoObj);
458
- const extractLast = (typeof (f[f.length - 1]) === "object");
459
- if (f.length === 1 && extractLast)
460
- return (cause, infoObj = {}) => ActionAssembler_base(name, [form_none()], cause, infoObj);
461
- if (extractLast)
462
- f.splice(-1, 1);
463
- // console.log("DEBUG1: " + name + " -- " + f.map(i => (typeof i === "object") ? Object.keys(i).join("==") : typeof i).join("_") + extractLast);
464
- return (s, ...p) => {
465
- const [first, ...rest] = f.map(i => i(s));
466
- // console.log("DEBUG2: " + name + " -- " + f.map(i => (typeof i === "object") ? Object.keys(i).join("==") : typeof i).join("_") + extractLast);
467
- return Utils.genericCurrier(rest, (resArr) => {
468
- resArr.unshift(first(...p));
469
- return (cause, infoObj = {}) => ActionAssembler_base(name, resArr, cause, infoObj);
470
- });
471
- };
472
- }
473
- function modifyActionContructor(type) {
474
- return (s, action) => (cause) => (p) => ActionAssembler_base("a_modify_action", [form_action(s)(action)], cause, p);
475
- }
476
- function addEffectContructor(type, isStatus) {
477
- return (s, card) => (cause, p) => ActionAssembler_base((isStatus ? "a_add_status_effect" : "a_add_effect"), [form_card(s)(card)], cause, Object.assign(Object.assign({}, p), { typeID: type }));
478
- }
479
- //default restriction is the loosest possible restriction
480
- //card : none (practically)
481
- //zone : none (practically)
482
- //effect : same card
483
- //effect subtype : same effect
484
- function getDefaultObjContructionObj(id) {
485
- let o = {
486
- type: id
487
- };
488
- switch (id) {
489
- case actionRegistry_1.default.a_activate_effect_internal: {
490
- o.canBeChainTo = false,
491
- o.canBeTriggeredTo = true;
492
- break;
493
- }
494
- case actionRegistry_1.default.a_turn_end: {
495
- o.canBeTriggeredTo = false;
496
- break;
497
- }
498
- case actionRegistry_1.default.error: {
499
- o.canBeChainTo = false,
500
- o.canBeTriggeredTo = false;
501
- break;
502
- }
503
- case actionRegistry_1.default.a_deal_damage_internal: {
504
- o.canBeChainTo = false,
505
- o.canBeTriggeredTo = true;
506
- break;
507
- }
508
- case actionRegistry_1.default.a_deal_damage_card: {
509
- o.checkers = {
510
- card: (target, currCard, currZone) => {
511
- //move whereever you want, if its still on the field, its damagable
512
- if (!defaultCheker_card(target, currCard, currZone))
513
- return false;
514
- return currZone.types.some(i => {
515
- return i === zoneRegistry_1.zoneRegistry.z_deck || i === zoneRegistry_1.zoneRegistry.z_field || i === zoneRegistry_1.zoneRegistry.z_hand;
516
- });
517
- }
518
- };
519
- break;
520
- }
521
- case actionRegistry_1.default.a_destroy: {
522
- o.checkers = {
523
- card: (target, currCard, currZone) => {
524
- //move whereever you want, if its not in grave, its destroyable
525
- if (!defaultCheker_card(target, currCard, currZone))
526
- return false;
527
- return currZone.types.some(i => {
528
- return i === zoneRegistry_1.zoneRegistry.z_deck || i === zoneRegistry_1.zoneRegistry.z_field || i === zoneRegistry_1.zoneRegistry.z_hand;
529
- });
530
- }
531
- };
532
- break;
533
- }
534
- case actionRegistry_1.default.a_execute: {
535
- o.checkers = {
536
- card: (target, currCard, currZone) => {
537
- //move whereever you want, if its still on the field, its damagable
538
- if (!defaultCheker_card(target, currCard, currZone))
539
- return false;
540
- return currZone.types.some(i => {
541
- return i === zoneRegistry_1.zoneRegistry.z_deck || i === zoneRegistry_1.zoneRegistry.z_field || i === zoneRegistry_1.zoneRegistry.z_hand;
542
- });
543
- }
544
- };
545
- break;
546
- }
547
- case actionRegistry_1.default.a_pos_change: {
548
- o.checkers = {
549
- card: (target, currCard, currZone) => {
550
- //pos_change default is strict
551
- return defaultCheker_card(target, currCard, currZone, true);
552
- }
553
- };
554
- break;
555
- }
556
- }
557
- return o;
558
- }
559
- const actionConstructorRegistry = {
560
- error: ActionAssembler("error"),
561
- a_null: ActionAssembler("a_null"),
562
- a_negate_action: ActionAssembler("a_negate_action"),
563
- a_do_threat_burn: ActionAssembler("a_do_threat_burn"),
564
- a_force_end_game: ActionAssembler("a_force_end_game"),
565
- a_increase_turn_count: ActionAssembler("a_increase_turn_count"),
566
- a_set_threat_level: ActionAssembler("a_set_threat_level", {
567
- newThreatLevel: 0
568
- }),
569
- a_turn_end: ActionAssembler("a_turn_end", {
570
- doIncreaseTurnCount: true
571
- }),
572
- a_turn_reset: ActionAssembler("a_turn_reset"),
573
- a_turn_start: ActionAssembler("a_turn_start"),
574
- a_reprogram_start: ActionAssembler("a_reprogram_start"),
575
- a_reprogram_end: ActionAssembler("a_reprogram_end"),
576
- a_clear_all_status_effect: ActionAssembler("a_clear_all_status_effect", form_card),
577
- a_clear_all_counters: ActionAssembler("a_clear_all_counters", form_card),
578
- a_deal_damage_card: ActionAssembler("a_deal_damage_card", form_card, {
579
- dmg: 0,
580
- dmgType: 0
581
- }),
582
- a_deal_damage_position: ActionAssembler("a_deal_damage_position", form_position, {
583
- dmg: 0,
584
- dmgType: 0
585
- }),
586
- a_deal_damage_internal: ActionAssembler("a_deal_damage_internal", form_card, {
587
- dmg: 0,
588
- dmgType: 0
589
- }),
590
- a_deal_heart_damage: ActionAssembler("a_deal_heart_damage", form_player, {
591
- dmg: 0,
592
- }),
593
- a_destroy: ActionAssembler("a_destroy", form_card),
594
- a_disable_card: ActionAssembler("a_disable_card", form_card),
595
- a_enable_card: ActionAssembler("a_enable_card", form_card),
596
- a_execute: ActionAssembler("a_execute", form_card),
597
- a_pos_change: ActionAssembler("a_pos_change", form_card, form_position),
598
- a_pos_change_force: ActionAssembler("a_pos_change_force", form_card, form_position),
599
- a_attack: ActionAssembler("a_attack", form_card, {}),
600
- a_deal_damage_ahead: ActionAssembler("a_deal_damage_ahead", form_card, {}),
601
- a_reset_card: ActionAssembler("a_reset_card", form_card),
602
- a_decompile: ActionAssembler("a_decompile", form_card),
603
- a_void: ActionAssembler("a_void", form_card),
604
- a_reset_all_once: ActionAssembler("a_reset_all_once", form_card),
605
- a_declare_activation: ActionAssembler("a_declare_activation", form_effect),
606
- a_reset_effect: ActionAssembler("a_reset_effect", form_effect),
607
- a_activate_effect: ActionAssembler("a_activate_effect", form_card, form_partition),
608
- a_activate_effect_internal: ActionAssembler("a_activate_effect_internal", form_card, form_partition),
609
- a_add_status_effect: addEffectContructor,
610
- a_add_effect: addEffectContructor,
611
- a_duplicate_effect: ActionAssembler("a_duplicate_effect", form_card, form_card, form_partition, {}), //duplicate partition of card[1] into card[0]
612
- a_duplicate_card: ActionAssembler("a_duplicate_card", form_card, form_position, {}), //duplicate card onto position
613
- a_remove_status_effect: ActionAssembler("a_remove_status_effect", form_effect),
614
- a_remove_effect: ActionAssembler("a_remove_effect", form_card, form_partition),
615
- a_remove_all_effects: ActionAssembler("a_remove_all_effects", form_card),
616
- a_activate_effect_subtype: ActionAssembler("a_activate_effect_subtype", form_subtype, {
617
- newEffectData: 0
618
- }),
619
- a_modify_action: modifyActionContructor,
620
- a_replace_action: ActionAssembler("a_replace_action", form_action),
621
- a_zone_interact: ActionAssembler("a_zone_interact", form_zone),
622
- a_shuffle: ActionAssembler("a_shuffle", form_zone, {
623
- shuffleMap: {}
624
- }),
625
- a_draw: ActionAssembler("a_draw", form_zone, form_zone, {
626
- cooldown: 0,
627
- doTurnReset: true,
628
- actuallyDraw: true,
629
- }),
630
- a_add_top: ActionAssembler("a_add_top", form_card, form_zone),
631
- a_get_input: ActionAssembler("a_get_input", {}),
632
- a_delay: ActionAssembler("a_delay", {}),
633
- };
634
- exports.actionConstructorRegistry = actionConstructorRegistry;
635
- const actionFormRegistry = {
636
- action: (s, a) => form_action(s)(a),
637
- card: (s, c) => form_card(s)(c),
638
- effect: (s, c, eff) => form_effect(s)(c, eff),
639
- subtype: (s, c, eff, subtype) => form_subtype(s)(c, eff, subtype),
640
- position: (s, pos) => form_position(s)(pos),
641
- zone: (s, zone) => form_zone(s)(zone),
642
- player: (s, pid) => form_player(s)(pid),
643
- none: form_none,
644
- system: form_system
645
- };
646
- exports.actionFormRegistry = actionFormRegistry;