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
|
@@ -1,606 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//zones handler is handler of all the zones
|
|
3
|
-
//and importantly, converter from action to zone func calls
|
|
4
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
-
};
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const system_1 = __importDefault(require("../../types/defaultZones/system"));
|
|
9
|
-
const deck_1 = __importDefault(require("../../types/defaultZones/deck"));
|
|
10
|
-
const storage_1 = __importDefault(require("../../types/defaultZones/storage"));
|
|
11
|
-
const grave_1 = __importDefault(require("../../types/defaultZones/grave"));
|
|
12
|
-
const hand_1 = __importDefault(require("../../types/defaultZones/hand"));
|
|
13
|
-
const field_1 = __importDefault(require("../../types/defaultZones/field"));
|
|
14
|
-
const ability_1 = __importDefault(require("../../types/defaultZones/ability"));
|
|
15
|
-
const void_1 = __importDefault(require("../../types/defaultZones/void"));
|
|
16
|
-
const zoneRegistry_1 = __importDefault(require("../../data/zoneRegistry"));
|
|
17
|
-
const zoneRegistry_2 = require("../../data/zoneRegistry");
|
|
18
|
-
const errors_1 = require("../../types/errors");
|
|
19
|
-
const position_1 = __importDefault(require("../../types/abstract/generics/position"));
|
|
20
|
-
const actionGenrator_1 = require("./actionGenrator");
|
|
21
|
-
const actionRegistry_1 = __importDefault(require("../../data/actionRegistry"));
|
|
22
|
-
const misc_1 = require("../../types/misc");
|
|
23
|
-
const actionInputGenerator_1 = require("./actionInputGenerator");
|
|
24
|
-
const drop_1 = __importDefault(require("../../types/defaultZones/drop"));
|
|
25
|
-
// import type { Zone_T } from "../../types/abstract/gameComponents/zone";
|
|
26
|
-
class zoneHandler {
|
|
27
|
-
//old
|
|
28
|
-
// async load(zoneReg : typeof zoneDataRegistry){
|
|
29
|
-
// //every entries in zoneReg house an importURL leading to a child class extended from zone
|
|
30
|
-
// //assuming the importURL are correct, import and create a new instance of those class
|
|
31
|
-
// //stores inside this class's zoneArr
|
|
32
|
-
// //using promise.all for concurrency
|
|
33
|
-
// const zonePromises = Object.entries(zoneReg)
|
|
34
|
-
// .sort((a, b) => isNaN(a[1].priority) ? 1 : isNaN(b[1].priority) ? -1 : a[1].priority - b[1].priority)
|
|
35
|
-
// .map(async ([keyStr, zoneData], index) => {
|
|
36
|
-
// let zoneClass = (await import(zoneData.importURL)).default as typeof zone;
|
|
37
|
-
// let zoneInstance = new zoneClass(index, keyStr, zoneRegistry[keyStr as zoneName], zoneData) as zone;
|
|
38
|
-
// this.zoneArr.push(zoneInstance);
|
|
39
|
-
// });
|
|
40
|
-
// await Promise.all(zonePromises);
|
|
41
|
-
// }
|
|
42
|
-
constructor(regs) {
|
|
43
|
-
this.zoneArr = [];
|
|
44
|
-
this.loader = regs.zoneLoader;
|
|
45
|
-
}
|
|
46
|
-
loadZones(s, players) {
|
|
47
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_system], zoneRegistry_1.default.z_system, system_1.default);
|
|
48
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_drop], zoneRegistry_1.default.z_drop, drop_1.default);
|
|
49
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_void], zoneRegistry_1.default.z_void, void_1.default);
|
|
50
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_deck], zoneRegistry_1.default.z_deck, deck_1.default);
|
|
51
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_hand], zoneRegistry_1.default.z_hand, hand_1.default);
|
|
52
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_storage], zoneRegistry_1.default.z_storage, storage_1.default);
|
|
53
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_field], zoneRegistry_1.default.z_field, field_1.default);
|
|
54
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_grave], zoneRegistry_1.default.z_grave, grave_1.default);
|
|
55
|
-
this.loader.load(zoneRegistry_2.zoneRegistry[zoneRegistry_2.zoneRegistry.z_ability], zoneRegistry_1.default.z_ability, ability_1.default);
|
|
56
|
-
// this.maxPlayerIndex = s.players.length
|
|
57
|
-
Object.entries(zoneRegistry_1.default).forEach(([zkey, zdata], index) => {
|
|
58
|
-
if (!zdata.instancedFor.length) {
|
|
59
|
-
let zinstance = this.loader.getZone(zkey, s);
|
|
60
|
-
Utils.insertionSort(this.zoneArr, zinstance, this.sortFunc);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
players.forEach((p, pindex) => {
|
|
64
|
-
let zinstance = this.loader.getZone(zkey, s, p.playerType, pindex);
|
|
65
|
-
if (zdata.instancedFor.includes(p.playerType)) {
|
|
66
|
-
Utils.insertionSort(this.zoneArr, zinstance, this.sortFunc);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
this.correctID();
|
|
72
|
-
}
|
|
73
|
-
sortFunc(a, b) {
|
|
74
|
-
const x = a.priority, y = b.priority;
|
|
75
|
-
if (Object.is(x, y))
|
|
76
|
-
return 0;
|
|
77
|
-
const rank = (a) => isNaN(a) ? 0 : a === -Infinity ? 1 : a === +Infinity ? 3 : 2;
|
|
78
|
-
const ra = rank(x), rb = rank(y);
|
|
79
|
-
return (ra !== rb) ? rb - ra : y - x;
|
|
80
|
-
}
|
|
81
|
-
correctID() {
|
|
82
|
-
for (let i = 0; i < this.zoneArr.length; i++)
|
|
83
|
-
this.zoneArr[i].id = i;
|
|
84
|
-
}
|
|
85
|
-
load(key, data, c) {
|
|
86
|
-
this.loader.load(key, data, c);
|
|
87
|
-
}
|
|
88
|
-
add(zclassID, s, ptype, pid, zDataID) {
|
|
89
|
-
let instance = this.loader.getZone(zclassID, s, ptype, pid, zDataID);
|
|
90
|
-
if (!instance)
|
|
91
|
-
throw new Error(`Fail to create instance of zone ${zclassID}`);
|
|
92
|
-
Utils.insertionSort(this.zoneArr, instance, this.sortFunc);
|
|
93
|
-
this.correctID();
|
|
94
|
-
}
|
|
95
|
-
load_and_add_noPlayer(key, s, param3, param4) {
|
|
96
|
-
//case 1, add both
|
|
97
|
-
if (typeof param3 === "object" && typeof param4 === "function") {
|
|
98
|
-
this.loader.load(key, param3, param4);
|
|
99
|
-
this.add(key, s, -1, -1, key);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (!param4)
|
|
103
|
-
param4 = key;
|
|
104
|
-
//case 2, add class only
|
|
105
|
-
if (typeof param3 === "function") {
|
|
106
|
-
this.loader.load(key, undefined, param3);
|
|
107
|
-
this.add(key, s, -1, -1, param4);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
//case 3, add data only
|
|
111
|
-
if (typeof param3 === "object") {
|
|
112
|
-
this.loader.load(key, param3);
|
|
113
|
-
this.add(key, s, -1, -1, param4);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
//technically unreachable code
|
|
117
|
-
throw new Error("Undefined behavior: load_and_add, zoneHandler");
|
|
118
|
-
}
|
|
119
|
-
addNewPlayerInstancedZones(s, ptype, pid = -1) {
|
|
120
|
-
let insertNew = [];
|
|
121
|
-
this.zoneArr.forEach(i => {
|
|
122
|
-
let data = this.loader.getData(i.dataID);
|
|
123
|
-
if (data && data.instancedFor.includes(ptype)) {
|
|
124
|
-
let z = this.loader.getZone(i.classID, s, ptype, pid, i.dataID);
|
|
125
|
-
if (z)
|
|
126
|
-
insertNew.push(z);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
insertNew.forEach(i => Utils.insertionSort(this.zoneArr, i, this.sortFunc));
|
|
130
|
-
this.correctID();
|
|
131
|
-
}
|
|
132
|
-
//operations
|
|
133
|
-
genericHandler_card(s, a) {
|
|
134
|
-
let target = a.targets[0];
|
|
135
|
-
let z = this.zoneArr[target.card.pos.zoneID];
|
|
136
|
-
let c = z.getCardByPosition(new position_1.default(target.card.pos));
|
|
137
|
-
if (!c) {
|
|
138
|
-
c = this.getCardWithID(target.card.id);
|
|
139
|
-
if (!c)
|
|
140
|
-
return [true, [new errors_1.cardNotExist()]];
|
|
141
|
-
}
|
|
142
|
-
if (!a.resolvable(s, z, c))
|
|
143
|
-
return [true, []];
|
|
144
|
-
return [false, c];
|
|
145
|
-
}
|
|
146
|
-
genericHandler_effect(s, a) {
|
|
147
|
-
let target = a.targets[0];
|
|
148
|
-
let z = this.zoneArr[target.card.pos.zoneID];
|
|
149
|
-
let c = z.getCardByPosition(new position_1.default(target.card.pos));
|
|
150
|
-
if (!c) {
|
|
151
|
-
c = this.getCardWithID(target.card.id);
|
|
152
|
-
if (!c)
|
|
153
|
-
return [true, [new errors_1.cardNotExist()]];
|
|
154
|
-
}
|
|
155
|
-
let eff;
|
|
156
|
-
let eindex = c.findEffectIndex(target.eff.id);
|
|
157
|
-
if (eindex < 0) {
|
|
158
|
-
eff = this.getEffectWithID(target.eff.id);
|
|
159
|
-
if (!eff)
|
|
160
|
-
return [true, [new errors_1.effectNotExist(target.eff.id, c.id)]];
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
eff = c.totalEffects[eindex];
|
|
164
|
-
}
|
|
165
|
-
if (!a.resolvable(s, z, c, eff))
|
|
166
|
-
return [true, []];
|
|
167
|
-
return [false, c, eff];
|
|
168
|
-
}
|
|
169
|
-
genericHandler_subtype(s, a) {
|
|
170
|
-
let target = a.targets[0];
|
|
171
|
-
let z = this.zoneArr[target.card.pos.zoneID];
|
|
172
|
-
let c = z.getCardByPosition(new position_1.default(target.card.pos));
|
|
173
|
-
if (!c) {
|
|
174
|
-
c = this.getCardWithID(target.card.id);
|
|
175
|
-
if (!c)
|
|
176
|
-
return [true, [new errors_1.cardNotExist()]];
|
|
177
|
-
}
|
|
178
|
-
let eff;
|
|
179
|
-
let eindex = c.findEffectIndex(target.eff.id);
|
|
180
|
-
if (eindex < 0) {
|
|
181
|
-
eff = this.getEffectWithID(target.eff.id);
|
|
182
|
-
if (!eff)
|
|
183
|
-
return [true, [new errors_1.effectNotExist(target.eff.id, c.id)]];
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
eff = c.totalEffects[eindex];
|
|
187
|
-
}
|
|
188
|
-
let st = eff.getSubtypeidx(target.subtype.dataID);
|
|
189
|
-
if (st < 0)
|
|
190
|
-
return [true, [new errors_1.effectNotExist(target.eff.id, c.id).add("zoneHandler", "handleActivateEffectSubtypeFunc", 326)]];
|
|
191
|
-
if (!a.resolvable(s, z, c, eff, eff.subTypes[st]))
|
|
192
|
-
return [true, []];
|
|
193
|
-
return [false, c, eff, st];
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
*
|
|
197
|
-
* @param a : a pos change action, with 2 targets, a card target and a position target in index 0 and 1
|
|
198
|
-
* @returns
|
|
199
|
-
*/
|
|
200
|
-
handlePosChange(s, a) {
|
|
201
|
-
let k1 = a.targets[0];
|
|
202
|
-
let k2 = a.targets[1];
|
|
203
|
-
let pos = new position_1.default(k2.pos);
|
|
204
|
-
let res = [];
|
|
205
|
-
let z = this.zoneArr[k1.card.pos.zoneID];
|
|
206
|
-
let c = z.getCardByPosition(new position_1.default(k1.card.pos));
|
|
207
|
-
// let idxFrom = pos.zoneID
|
|
208
|
-
// let cardIdx = utils.positionToIndex(pos.flat(), this.zoneArr[idxFrom].shape)
|
|
209
|
-
// let c = this.zoneArr[idxFrom].cardArr[cardIdx]
|
|
210
|
-
if (!c) {
|
|
211
|
-
c = this.getCardWithID(k1.card.id);
|
|
212
|
-
if (!c)
|
|
213
|
-
return [
|
|
214
|
-
new errors_1.cardNotExist().add("zoneHandler", "handlePosChange", 54)
|
|
215
|
-
];
|
|
216
|
-
}
|
|
217
|
-
if (!a.resolvable(s, z, c))
|
|
218
|
-
return [];
|
|
219
|
-
let temp;
|
|
220
|
-
if (pos && pos.valid && pos.zoneID === c.pos.zoneID) {
|
|
221
|
-
console.log("move is triggered");
|
|
222
|
-
let idxTo = pos.zoneID;
|
|
223
|
-
temp = this.zoneArr[idxTo].move(c, pos);
|
|
224
|
-
//move is prioritized
|
|
225
|
-
if (temp[0])
|
|
226
|
-
res.push(temp[0]);
|
|
227
|
-
else
|
|
228
|
-
res.push(...temp[1]);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
temp = this.zoneArr[c.pos.zoneID].remove(c);
|
|
232
|
-
if (temp[0])
|
|
233
|
-
res.push(temp[0]);
|
|
234
|
-
else
|
|
235
|
-
res.push(...temp[1]);
|
|
236
|
-
temp = this.zoneArr[pos.zoneID].add(c, pos);
|
|
237
|
-
if (temp[0])
|
|
238
|
-
res.push(temp[0]);
|
|
239
|
-
else
|
|
240
|
-
res.push(...temp[1]);
|
|
241
|
-
}
|
|
242
|
-
return res;
|
|
243
|
-
}
|
|
244
|
-
handleDraw(s, a) {
|
|
245
|
-
let zone = this.zoneArr[a.targets[0].zone.id];
|
|
246
|
-
if (!zone || !zone.draw)
|
|
247
|
-
return [
|
|
248
|
-
new errors_1.zoneNotExist(a.targets[0].zone.id).add("zoneHandler", "handleDraw", 213)
|
|
249
|
-
];
|
|
250
|
-
if (!a.resolvable(s, zone)) {
|
|
251
|
-
console.log("from handle draw: ", zone.id, a.targets[0].zone.id);
|
|
252
|
-
return [];
|
|
253
|
-
}
|
|
254
|
-
let deck = zone;
|
|
255
|
-
let playerindex = deck.playerIndex;
|
|
256
|
-
let hand = this.hands.filter(i => i.playerIndex === playerindex);
|
|
257
|
-
if (hand.length !== 1)
|
|
258
|
-
return [
|
|
259
|
-
new errors_1.zoneNotExist(-1).add("zoneHandler", "handleDraw", 222)
|
|
260
|
-
];
|
|
261
|
-
let res = deck.draw(s, a, hand[0]);
|
|
262
|
-
console.log("2", a, res);
|
|
263
|
-
if (res[0])
|
|
264
|
-
return [res[0]];
|
|
265
|
-
else
|
|
266
|
-
return res[1];
|
|
267
|
-
}
|
|
268
|
-
handleShuffle(s, a) {
|
|
269
|
-
let z = this.zoneArr[a.targets[0].zone.id];
|
|
270
|
-
if (!z || !z.draw)
|
|
271
|
-
return [
|
|
272
|
-
new errors_1.zoneNotExist(a.targets[0].zone.id).add("zoneHandler", "handleDraw", 213)
|
|
273
|
-
];
|
|
274
|
-
if (!a.resolvable(s, z))
|
|
275
|
-
return [];
|
|
276
|
-
let temp = z.shuffle(a.flatAttr().shuffleMap);
|
|
277
|
-
if (temp[0])
|
|
278
|
-
return [temp[0]];
|
|
279
|
-
return temp[1];
|
|
280
|
-
}
|
|
281
|
-
handleTurnReset(s, a) {
|
|
282
|
-
//only do field refresh
|
|
283
|
-
let res = [];
|
|
284
|
-
this.zoneArr.forEach(i => res.push(...i.turnReset(a)));
|
|
285
|
-
return res;
|
|
286
|
-
}
|
|
287
|
-
handleCardReset(s, a) {
|
|
288
|
-
let res = this.genericHandler_card(s, a);
|
|
289
|
-
if (res[0])
|
|
290
|
-
return res[1];
|
|
291
|
-
return res[1].reset();
|
|
292
|
-
}
|
|
293
|
-
handleEffectReset(s, a) {
|
|
294
|
-
let res = this.genericHandler_effect(s, a);
|
|
295
|
-
if (res[0])
|
|
296
|
-
return res[1];
|
|
297
|
-
return res[2].reset();
|
|
298
|
-
}
|
|
299
|
-
handleEffectActivation(s, a) {
|
|
300
|
-
const card = a.targets[0].card;
|
|
301
|
-
const pid = a.targets[1].pid;
|
|
302
|
-
const gen = card.getParititonInputObj(pid, s, a);
|
|
303
|
-
if (!gen)
|
|
304
|
-
return card.activatePartition(pid, s, a);
|
|
305
|
-
return [
|
|
306
|
-
actionGenrator_1.actionConstructorRegistry.a_get_input(a.cause, {
|
|
307
|
-
requester: gen,
|
|
308
|
-
applicator: new actionInputGenerator_1.inputApplicator(card.activatePartition, [pid, s, a], card)
|
|
309
|
-
})
|
|
310
|
-
];
|
|
311
|
-
}
|
|
312
|
-
handleActivateEffectSubtypeFunc(s, a) {
|
|
313
|
-
let res = this.genericHandler_subtype(s, a);
|
|
314
|
-
if (res[0])
|
|
315
|
-
return res[1];
|
|
316
|
-
return res[2].activateSubtypeSpecificFunc(res[3], res[1], s, a);
|
|
317
|
-
}
|
|
318
|
-
handleAddStatusEffect(s, a, e) {
|
|
319
|
-
let res = this.genericHandler_card(s, a);
|
|
320
|
-
if (res[0])
|
|
321
|
-
return res[1];
|
|
322
|
-
res[1].addStatusEffect(e);
|
|
323
|
-
return [];
|
|
324
|
-
}
|
|
325
|
-
handleClearAllStatusEffect(s, a) {
|
|
326
|
-
let res = this.genericHandler_card(s, a);
|
|
327
|
-
if (res[0])
|
|
328
|
-
return res[1];
|
|
329
|
-
res[1].clearAllStatus();
|
|
330
|
-
return [];
|
|
331
|
-
}
|
|
332
|
-
handleRemoveStatusEffect(s, a) {
|
|
333
|
-
let res = this.genericHandler_effect(s, a);
|
|
334
|
-
if (res[0])
|
|
335
|
-
return res[1];
|
|
336
|
-
res[1].removeStatusEffect(res[2].id);
|
|
337
|
-
return [];
|
|
338
|
-
}
|
|
339
|
-
handleCardStatus(s, a) {
|
|
340
|
-
let res = this.genericHandler_card(s, a);
|
|
341
|
-
if (res[0])
|
|
342
|
-
return res[1];
|
|
343
|
-
res[1].canAct = (a.typeID === actionRegistry_1.default.a_enable_card);
|
|
344
|
-
return [];
|
|
345
|
-
}
|
|
346
|
-
getWouldBeAttackTarget(s, a) {
|
|
347
|
-
//find opposite
|
|
348
|
-
if (a.cause.card === undefined)
|
|
349
|
-
return [];
|
|
350
|
-
let c = a.cause.card;
|
|
351
|
-
let oppositeZones = this.zoneArr[c.pos.zoneID];
|
|
352
|
-
if (!oppositeZones)
|
|
353
|
-
return [];
|
|
354
|
-
let targetZone = oppositeZones.getOppositeZone(this.zoneArr);
|
|
355
|
-
if (!targetZone.length)
|
|
356
|
-
return [];
|
|
357
|
-
return [oppositeZones, targetZone[0].getOppositeCards(c).sort((a, b) => a.pos.y - b.pos.y)];
|
|
358
|
-
}
|
|
359
|
-
handleAttack(s, a) {
|
|
360
|
-
var _a, _b;
|
|
361
|
-
let attr = a.flatAttr();
|
|
362
|
-
let c = a.cause.card;
|
|
363
|
-
if (!c)
|
|
364
|
-
return [];
|
|
365
|
-
let targets = this.getWouldBeAttackTarget(s, a);
|
|
366
|
-
if (!targets.length)
|
|
367
|
-
return [];
|
|
368
|
-
if (!targets[1].length) {
|
|
369
|
-
return [
|
|
370
|
-
actionGenrator_1.actionConstructorRegistry.a_deal_heart_damage(s, targets[0].playerIndex)(a.cause, {
|
|
371
|
-
dmg: (_a = c.attr.get("atk")) !== null && _a !== void 0 ? _a : 0
|
|
372
|
-
})
|
|
373
|
-
];
|
|
374
|
-
}
|
|
375
|
-
return [
|
|
376
|
-
actionGenrator_1.actionConstructorRegistry.a_deal_damage_internal(s, targets[1][0])(a.cause, {
|
|
377
|
-
dmg: (attr.dmg === undefined) ? (_b = c.attr.get("atk")) !== null && _b !== void 0 ? _b : 0 : attr.dmg,
|
|
378
|
-
dmgType: (attr.dmgType === undefined) ? misc_1.damageType.physical : attr.dmgType
|
|
379
|
-
})
|
|
380
|
-
];
|
|
381
|
-
}
|
|
382
|
-
handleDealDamage_1(s, a) {
|
|
383
|
-
let res = this.genericHandler_card(s, a);
|
|
384
|
-
if (res[0])
|
|
385
|
-
return res[1];
|
|
386
|
-
let attr = a.flatAttr();
|
|
387
|
-
res[1].hp -= attr.dmg;
|
|
388
|
-
if (res[1].hp === 0) {
|
|
389
|
-
return [
|
|
390
|
-
actionGenrator_1.actionConstructorRegistry.a_destroy(s, res[1])(actionGenrator_1.actionFormRegistry.system())
|
|
391
|
-
];
|
|
392
|
-
}
|
|
393
|
-
return [];
|
|
394
|
-
}
|
|
395
|
-
handleDealDamage_2(s, a) {
|
|
396
|
-
let pos = a.targets[0].pos;
|
|
397
|
-
let c = this.getCardWithPosition(new position_1.default(pos));
|
|
398
|
-
if (!c)
|
|
399
|
-
return [
|
|
400
|
-
new errors_1.cardNotExist()
|
|
401
|
-
];
|
|
402
|
-
let attr = a.flatAttr();
|
|
403
|
-
c.hp -= attr.dmg;
|
|
404
|
-
if (c.hp === 0) {
|
|
405
|
-
return [
|
|
406
|
-
actionGenrator_1.actionConstructorRegistry.a_destroy(s, c)(actionGenrator_1.actionFormRegistry.system())
|
|
407
|
-
];
|
|
408
|
-
}
|
|
409
|
-
return [];
|
|
410
|
-
}
|
|
411
|
-
handleExecute(s, a) {
|
|
412
|
-
let res = this.genericHandler_card(s, a);
|
|
413
|
-
if (res[0])
|
|
414
|
-
return res[1];
|
|
415
|
-
//unpacks to an attack and a send to grave
|
|
416
|
-
let zoneid = res[1].pos.zoneID;
|
|
417
|
-
let z = this.zoneArr[zoneid];
|
|
418
|
-
if (!z)
|
|
419
|
-
return [
|
|
420
|
-
new errors_1.zoneNotExist(zoneid)
|
|
421
|
-
];
|
|
422
|
-
let pid = z.playerIndex;
|
|
423
|
-
let g = this.getPlayerZone(pid, zoneRegistry_2.zoneRegistry.z_grave);
|
|
424
|
-
if (!g || !g.length)
|
|
425
|
-
return [
|
|
426
|
-
new errors_1.zoneNotExist(pid)
|
|
427
|
-
];
|
|
428
|
-
return [
|
|
429
|
-
actionGenrator_1.actionConstructorRegistry.a_attack(s, a.targets[0].card)(a.cause, {
|
|
430
|
-
dmg: res[1].atk,
|
|
431
|
-
dmgType: misc_1.damageType.physical
|
|
432
|
-
}),
|
|
433
|
-
actionGenrator_1.actionConstructorRegistry.a_pos_change_force(s, res[1])(g[0].top)(actionGenrator_1.actionFormRegistry.system()).dontchain()
|
|
434
|
-
];
|
|
435
|
-
}
|
|
436
|
-
handleSendToTop(s, a, zid) {
|
|
437
|
-
let res = this.genericHandler_card(s, a);
|
|
438
|
-
if (res[0])
|
|
439
|
-
return res[1];
|
|
440
|
-
let zoneid = res[1].pos.zoneID;
|
|
441
|
-
let z = this.zoneArr[zoneid];
|
|
442
|
-
if (!z)
|
|
443
|
-
return [
|
|
444
|
-
new errors_1.zoneNotExist(zoneid)
|
|
445
|
-
];
|
|
446
|
-
let pid = z.playerIndex;
|
|
447
|
-
let targetZone = this.getPlayerZone(pid, zid);
|
|
448
|
-
if (!targetZone)
|
|
449
|
-
return [
|
|
450
|
-
new errors_1.zoneNotExist(pid)
|
|
451
|
-
];
|
|
452
|
-
return [
|
|
453
|
-
actionGenrator_1.actionConstructorRegistry.a_pos_change_force(s, res[1])(targetZone[0].top)(actionGenrator_1.actionFormRegistry.system())
|
|
454
|
-
];
|
|
455
|
-
}
|
|
456
|
-
getZoneRespond(z, s, a) {
|
|
457
|
-
const gen = z.getInput_ZoneRespond(a, s);
|
|
458
|
-
if (gen === undefined)
|
|
459
|
-
return z.getZoneRespond(a, s, undefined);
|
|
460
|
-
return [
|
|
461
|
-
actionGenrator_1.actionConstructorRegistry.a_get_input(actionGenrator_1.actionFormRegistry.system(), {
|
|
462
|
-
requester: gen,
|
|
463
|
-
applicator: new actionInputGenerator_1.inputApplicator(z.getZoneRespond, [a, s], z)
|
|
464
|
-
})
|
|
465
|
-
];
|
|
466
|
-
}
|
|
467
|
-
handleZoneInteract(z, s, a) {
|
|
468
|
-
const gen = z.getInput_interact(s, a.cause);
|
|
469
|
-
if (gen === undefined)
|
|
470
|
-
return z.interact(s, a.cause, undefined);
|
|
471
|
-
return [
|
|
472
|
-
actionGenrator_1.actionConstructorRegistry.a_get_input(actionGenrator_1.actionFormRegistry.system(), {
|
|
473
|
-
requester: gen,
|
|
474
|
-
applicator: new actionInputGenerator_1.inputApplicator(z.interact, [s, a.cause], z)
|
|
475
|
-
})
|
|
476
|
-
];
|
|
477
|
-
}
|
|
478
|
-
respond(system, a, zoneResponsesOnly = false) {
|
|
479
|
-
let arr = [];
|
|
480
|
-
let infoLog = new Map(); //cardID, effectIDs[]
|
|
481
|
-
this.zoneArr.forEach(i => {
|
|
482
|
-
arr.push(...this.getZoneRespond(i, system, a));
|
|
483
|
-
});
|
|
484
|
-
if (zoneResponsesOnly)
|
|
485
|
-
return [arr, []];
|
|
486
|
-
this.zoneArr.forEach(i => {
|
|
487
|
-
let respondMap = i.getCanRespondMap(a, system);
|
|
488
|
-
respondMap.forEach((pidxArr, cardInfo) => {
|
|
489
|
-
pidxArr.forEach(pidx => {
|
|
490
|
-
arr.push(actionGenrator_1.actionConstructorRegistry.a_activate_effect_internal(system, cardInfo)(pidx)(a.cause));
|
|
491
|
-
if (infoLog.has(cardInfo.id)) {
|
|
492
|
-
infoLog.get(cardInfo.id).push(cardInfo.effects[pidx].id);
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
495
|
-
infoLog.set(cardInfo.id, [cardInfo.effects[pidx].id]);
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
});
|
|
499
|
-
});
|
|
500
|
-
return [arr, Object.entries(infoLog)];
|
|
501
|
-
}
|
|
502
|
-
forEach(depth, callback) {
|
|
503
|
-
switch (depth) {
|
|
504
|
-
case 0:
|
|
505
|
-
return this.zoneArr.forEach((z, zid) => callback(z, zid));
|
|
506
|
-
case 1:
|
|
507
|
-
return this.zoneArr.forEach((z, zid) => z.cardArr.forEach((c, cid) => {
|
|
508
|
-
if (c)
|
|
509
|
-
callback(c, zid, cid);
|
|
510
|
-
}));
|
|
511
|
-
case 2:
|
|
512
|
-
return this.zoneArr.forEach((z, zid) => z.cardArr.forEach((c, cid) => {
|
|
513
|
-
if (c)
|
|
514
|
-
c.totalEffects.forEach((e, eid) => callback(e, zid, cid, eid));
|
|
515
|
-
}));
|
|
516
|
-
case 3:
|
|
517
|
-
return this.zoneArr.forEach((z, zid) => z.cardArr.forEach((c, cid) => {
|
|
518
|
-
if (c)
|
|
519
|
-
c.totalEffects.forEach((e, eid) => e.subTypes.forEach((st, stid) => callback(st, zid, cid, eid, stid)));
|
|
520
|
-
}));
|
|
521
|
-
default: return;
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
map(depth, callback) {
|
|
525
|
-
let final = [];
|
|
526
|
-
this.forEach(depth, (c, ...index) => {
|
|
527
|
-
final.push(callback(c, ...index));
|
|
528
|
-
});
|
|
529
|
-
return final;
|
|
530
|
-
}
|
|
531
|
-
filter(depth, callback) {
|
|
532
|
-
let final = [];
|
|
533
|
-
this.forEach(depth, (c, ...index) => {
|
|
534
|
-
if (callback(c, ...index))
|
|
535
|
-
final.push(c);
|
|
536
|
-
});
|
|
537
|
-
return final;
|
|
538
|
-
}
|
|
539
|
-
getEffectWithID(eid) {
|
|
540
|
-
for (let i = 0; i < this.zoneArr.length; i++) {
|
|
541
|
-
for (let j = 0; j < this.zoneArr[i].cardArr.length; j++) {
|
|
542
|
-
let c = this.zoneArr[i].cardArr[j];
|
|
543
|
-
if (!c)
|
|
544
|
-
continue;
|
|
545
|
-
let x = c.findEffectIndex(eid);
|
|
546
|
-
if (x < 0)
|
|
547
|
-
continue;
|
|
548
|
-
return c.effects[x];
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
return undefined;
|
|
552
|
-
}
|
|
553
|
-
getZoneWithType(type) {
|
|
554
|
-
return this.zoneArr.filter(i => i.types.includes(type));
|
|
555
|
-
}
|
|
556
|
-
enforceCardIntoZone(zoneIdx, cardArr) {
|
|
557
|
-
this.zoneArr[zoneIdx].forceCardArrContent(cardArr);
|
|
558
|
-
}
|
|
559
|
-
getZoneWithDataID(dataID) {
|
|
560
|
-
return this.zoneArr.filter(i => i.dataID === dataID);
|
|
561
|
-
}
|
|
562
|
-
getZoneWithClassID(classID) {
|
|
563
|
-
return this.zoneArr.filter(i => i.classID === classID);
|
|
564
|
-
}
|
|
565
|
-
getZoneWithName(zoneName) {
|
|
566
|
-
return this.zoneArr.find(a => a.name == zoneName);
|
|
567
|
-
}
|
|
568
|
-
getZoneWithID(id) {
|
|
569
|
-
return this.zoneArr[id];
|
|
570
|
-
}
|
|
571
|
-
getCardWithID(cardID) {
|
|
572
|
-
for (let i = 0; i < this.zoneArr.length; i++) {
|
|
573
|
-
let index = this.zoneArr[i].cardArr.findIndex(i => i && i.id === cardID);
|
|
574
|
-
if (index < 0)
|
|
575
|
-
continue;
|
|
576
|
-
return this.zoneArr[i].cardArr[index];
|
|
577
|
-
}
|
|
578
|
-
return undefined;
|
|
579
|
-
}
|
|
580
|
-
getCardWithPosition(pos) {
|
|
581
|
-
let z = this.zoneArr[pos.zoneID];
|
|
582
|
-
if (!z)
|
|
583
|
-
return undefined;
|
|
584
|
-
return z.getCardByPosition(pos);
|
|
585
|
-
}
|
|
586
|
-
//get stuff
|
|
587
|
-
get system() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_system); }
|
|
588
|
-
get void() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_void); }
|
|
589
|
-
get decks() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_deck); }
|
|
590
|
-
get storages() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_storage); }
|
|
591
|
-
get hands() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_hand); }
|
|
592
|
-
get abilityZones() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_ability); }
|
|
593
|
-
get graves() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_grave); }
|
|
594
|
-
get fields() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_field); }
|
|
595
|
-
get drops() { return this.getZoneWithType(zoneRegistry_2.zoneRegistry.z_drop); }
|
|
596
|
-
getPlayerZone(pid, type) {
|
|
597
|
-
return this.zoneArr.filter(i => i.playerIndex === pid && i.types.includes(type));
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
exports.default = zoneHandler;
|
|
601
|
-
/*
|
|
602
|
-
note:
|
|
603
|
-
this file isnt complete
|
|
604
|
-
i havent added the ability for zones and cards to respond to actions
|
|
605
|
-
|
|
606
|
-
*/
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Card from "../../types/abstract/gameComponents/card";
|
|
2
|
-
import type { cardData, cardData_unified, effectData } from "../../data/cardRegistry";
|
|
3
|
-
import type effectLoader from "./loader_effect";
|
|
4
|
-
import type { Setting } from "../../types/abstract/gameComponents/settings";
|
|
5
|
-
import Effect from "../../types/abstract/gameComponents/effect";
|
|
6
|
-
export default class cardLoader {
|
|
7
|
-
private dataCache;
|
|
8
|
-
private customClassCache;
|
|
9
|
-
private countCache;
|
|
10
|
-
private effectHandler;
|
|
11
|
-
constructor(effectHandler: effectLoader);
|
|
12
|
-
get classkeys(): string[];
|
|
13
|
-
get datakeys(): string[];
|
|
14
|
-
load(key: string, data: cardData, c?: typeof Card | Record<string, typeof Card>): void;
|
|
15
|
-
getCard(cid: string, s: Setting, variantid?: string[], dataOnly?: false): Card;
|
|
16
|
-
getCard(cid: string, s: Setting, variantid: string[], dataOnly: true): Omit<cardData_unified, "effects"> & {
|
|
17
|
-
effects: effectData[];
|
|
18
|
-
};
|
|
19
|
-
getDirect(cid: string, s: Setting, ...eff: Effect<any>[]): Card | undefined;
|
|
20
|
-
}
|