mons-rust 0.1.60 → 0.1.62

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/mons-rust.d.ts CHANGED
@@ -18,6 +18,31 @@ export enum OutputModelKind {
18
18
  }
19
19
  /**
20
20
  */
21
+ export enum ManaKind {
22
+ Regular = 0,
23
+ Supermana = 1,
24
+ }
25
+ /**
26
+ */
27
+ export enum MonKind {
28
+ Demon = 0,
29
+ Drainer = 1,
30
+ Angel = 2,
31
+ Spirit = 3,
32
+ Mystic = 4,
33
+ }
34
+ /**
35
+ */
36
+ export enum SquareModelKind {
37
+ Regular = 0,
38
+ ConsumableBase = 1,
39
+ SupermanaBase = 2,
40
+ ManaBase = 3,
41
+ ManaPool = 4,
42
+ MonBase = 5,
43
+ }
44
+ /**
45
+ */
21
46
  export enum NextInputKind {
22
47
  MonMove = 0,
23
48
  ManaMove = 1,
@@ -31,15 +56,6 @@ export enum NextInputKind {
31
56
  }
32
57
  /**
33
58
  */
34
- export enum ItemModelKind {
35
- Mon = 0,
36
- Mana = 1,
37
- MonWithMana = 2,
38
- MonWithConsumable = 3,
39
- Consumable = 4,
40
- }
41
- /**
42
- */
43
59
  export enum Modifier {
44
60
  SelectPotion = 0,
45
61
  SelectBomb = 1,
@@ -47,13 +63,12 @@ export enum Modifier {
47
63
  }
48
64
  /**
49
65
  */
50
- export enum SquareModelKind {
51
- Regular = 0,
52
- ConsumableBase = 1,
53
- SupermanaBase = 2,
54
- ManaBase = 3,
55
- ManaPool = 4,
56
- MonBase = 5,
66
+ export enum ItemModelKind {
67
+ Mon = 0,
68
+ Mana = 1,
69
+ MonWithMana = 2,
70
+ MonWithConsumable = 3,
71
+ Consumable = 4,
57
72
  }
58
73
  /**
59
74
  */
@@ -63,14 +78,6 @@ export enum Color {
63
78
  }
64
79
  /**
65
80
  */
66
- export enum AvailableMoveKind {
67
- MonMove = 0,
68
- ManaMove = 1,
69
- Action = 2,
70
- Potion = 3,
71
- }
72
- /**
73
- */
74
81
  export enum EventModelKind {
75
82
  MonMove = 0,
76
83
  ManaMove = 1,
@@ -95,6 +102,14 @@ export enum EventModelKind {
95
102
  }
96
103
  /**
97
104
  */
105
+ export enum AvailableMoveKind {
106
+ MonMove = 0,
107
+ ManaMove = 1,
108
+ Action = 2,
109
+ Potion = 3,
110
+ }
111
+ /**
112
+ */
98
113
  export enum Consumable {
99
114
  Potion = 0,
100
115
  Bomb = 1,
@@ -102,21 +117,6 @@ export enum Consumable {
102
117
  }
103
118
  /**
104
119
  */
105
- export enum ManaKind {
106
- Regular = 0,
107
- Supermana = 1,
108
- }
109
- /**
110
- */
111
- export enum MonKind {
112
- Demon = 0,
113
- Drainer = 1,
114
- Angel = 2,
115
- Spirit = 3,
116
- Mystic = 4,
117
- }
118
- /**
119
- */
120
120
  export class EventModel {
121
121
  free(): void;
122
122
  /**
@@ -230,9 +230,10 @@ export class MonsGameModel {
230
230
  */
231
231
  static from_fen(fen: string): MonsGameModel | undefined;
232
232
  /**
233
+ * @param {(string)[]} takeback_fens
233
234
  * @returns {MonsGameModel | undefined}
234
235
  */
235
- without_last_turn(): MonsGameModel | undefined;
236
+ without_last_turn(takeback_fens: (string)[]): MonsGameModel | undefined;
236
237
  /**
237
238
  * @returns {string}
238
239
  */
@@ -319,6 +320,10 @@ export class MonsGameModel {
319
320
  */
320
321
  inactive_player_items_counters(): Int32Array;
321
322
  /**
323
+ * @returns {(string)[]}
324
+ */
325
+ takeback_fens(): (string)[];
326
+ /**
322
327
  * @returns {Int32Array}
323
328
  */
324
329
  available_move_kinds(): Int32Array;
package/mons-rust.js CHANGED
@@ -106,6 +106,10 @@ function passStringToWasm0(arg, malloc, realloc) {
106
106
  return ptr;
107
107
  }
108
108
 
109
+ function isLikeNone(x) {
110
+ return x === undefined || x === null;
111
+ }
112
+
109
113
  let cachedInt32Memory0 = null;
110
114
 
111
115
  function getInt32Memory0() {
@@ -134,10 +138,6 @@ function passArrayJsValueToWasm0(array, malloc) {
134
138
  return ptr;
135
139
  }
136
140
 
137
- function isLikeNone(x) {
138
- return x === undefined || x === null;
139
- }
140
-
141
141
  function _assertClass(instance, klass) {
142
142
  if (!(instance instanceof klass)) {
143
143
  throw new Error(`expected instance of ${klass.name}`);
@@ -204,34 +204,34 @@ function handleError(f, args) {
204
204
  module.exports.OutputModelKind = Object.freeze({ InvalidInput:0,"0":"InvalidInput",LocationsToStartFrom:1,"1":"LocationsToStartFrom",NextInputOptions:2,"2":"NextInputOptions",Events:3,"3":"Events", });
205
205
  /**
206
206
  */
207
- module.exports.NextInputKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",MysticAction:2,"2":"MysticAction",DemonAction:3,"3":"DemonAction",DemonAdditionalStep:4,"4":"DemonAdditionalStep",SpiritTargetCapture:5,"5":"SpiritTargetCapture",SpiritTargetMove:6,"6":"SpiritTargetMove",SelectConsumable:7,"7":"SelectConsumable",BombAttack:8,"8":"BombAttack", });
207
+ module.exports.ManaKind = Object.freeze({ Regular:0,"0":"Regular",Supermana:1,"1":"Supermana", });
208
208
  /**
209
209
  */
210
- module.exports.ItemModelKind = Object.freeze({ Mon:0,"0":"Mon",Mana:1,"1":"Mana",MonWithMana:2,"2":"MonWithMana",MonWithConsumable:3,"3":"MonWithConsumable",Consumable:4,"4":"Consumable", });
210
+ module.exports.MonKind = Object.freeze({ Demon:0,"0":"Demon",Drainer:1,"1":"Drainer",Angel:2,"2":"Angel",Spirit:3,"3":"Spirit",Mystic:4,"4":"Mystic", });
211
211
  /**
212
212
  */
213
- module.exports.Modifier = Object.freeze({ SelectPotion:0,"0":"SelectPotion",SelectBomb:1,"1":"SelectBomb",Cancel:2,"2":"Cancel", });
213
+ module.exports.SquareModelKind = Object.freeze({ Regular:0,"0":"Regular",ConsumableBase:1,"1":"ConsumableBase",SupermanaBase:2,"2":"SupermanaBase",ManaBase:3,"3":"ManaBase",ManaPool:4,"4":"ManaPool",MonBase:5,"5":"MonBase", });
214
214
  /**
215
215
  */
216
- module.exports.SquareModelKind = Object.freeze({ Regular:0,"0":"Regular",ConsumableBase:1,"1":"ConsumableBase",SupermanaBase:2,"2":"SupermanaBase",ManaBase:3,"3":"ManaBase",ManaPool:4,"4":"ManaPool",MonBase:5,"5":"MonBase", });
216
+ module.exports.NextInputKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",MysticAction:2,"2":"MysticAction",DemonAction:3,"3":"DemonAction",DemonAdditionalStep:4,"4":"DemonAdditionalStep",SpiritTargetCapture:5,"5":"SpiritTargetCapture",SpiritTargetMove:6,"6":"SpiritTargetMove",SelectConsumable:7,"7":"SelectConsumable",BombAttack:8,"8":"BombAttack", });
217
217
  /**
218
218
  */
219
- module.exports.Color = Object.freeze({ White:0,"0":"White",Black:1,"1":"Black", });
219
+ module.exports.Modifier = Object.freeze({ SelectPotion:0,"0":"SelectPotion",SelectBomb:1,"1":"SelectBomb",Cancel:2,"2":"Cancel", });
220
220
  /**
221
221
  */
222
- module.exports.AvailableMoveKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",Action:2,"2":"Action",Potion:3,"3":"Potion", });
222
+ module.exports.ItemModelKind = Object.freeze({ Mon:0,"0":"Mon",Mana:1,"1":"Mana",MonWithMana:2,"2":"MonWithMana",MonWithConsumable:3,"3":"MonWithConsumable",Consumable:4,"4":"Consumable", });
223
223
  /**
224
224
  */
225
- module.exports.EventModelKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",ManaScored:2,"2":"ManaScored",MysticAction:3,"3":"MysticAction",DemonAction:4,"4":"DemonAction",DemonAdditionalStep:5,"5":"DemonAdditionalStep",SpiritTargetMove:6,"6":"SpiritTargetMove",PickupBomb:7,"7":"PickupBomb",PickupPotion:8,"8":"PickupPotion",PickupMana:9,"9":"PickupMana",MonFainted:10,"10":"MonFainted",ManaDropped:11,"11":"ManaDropped",SupermanaBackToBase:12,"12":"SupermanaBackToBase",BombAttack:13,"13":"BombAttack",MonAwake:14,"14":"MonAwake",BombExplosion:15,"15":"BombExplosion",NextTurn:16,"16":"NextTurn",GameOver:17,"17":"GameOver",Takeback:18,"18":"Takeback",UsePotion:19,"19":"UsePotion", });
225
+ module.exports.Color = Object.freeze({ White:0,"0":"White",Black:1,"1":"Black", });
226
226
  /**
227
227
  */
228
- module.exports.Consumable = Object.freeze({ Potion:0,"0":"Potion",Bomb:1,"1":"Bomb",BombOrPotion:2,"2":"BombOrPotion", });
228
+ module.exports.EventModelKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",ManaScored:2,"2":"ManaScored",MysticAction:3,"3":"MysticAction",DemonAction:4,"4":"DemonAction",DemonAdditionalStep:5,"5":"DemonAdditionalStep",SpiritTargetMove:6,"6":"SpiritTargetMove",PickupBomb:7,"7":"PickupBomb",PickupPotion:8,"8":"PickupPotion",PickupMana:9,"9":"PickupMana",MonFainted:10,"10":"MonFainted",ManaDropped:11,"11":"ManaDropped",SupermanaBackToBase:12,"12":"SupermanaBackToBase",BombAttack:13,"13":"BombAttack",MonAwake:14,"14":"MonAwake",BombExplosion:15,"15":"BombExplosion",NextTurn:16,"16":"NextTurn",GameOver:17,"17":"GameOver",Takeback:18,"18":"Takeback",UsePotion:19,"19":"UsePotion", });
229
229
  /**
230
230
  */
231
- module.exports.ManaKind = Object.freeze({ Regular:0,"0":"Regular",Supermana:1,"1":"Supermana", });
231
+ module.exports.AvailableMoveKind = Object.freeze({ MonMove:0,"0":"MonMove",ManaMove:1,"1":"ManaMove",Action:2,"2":"Action",Potion:3,"3":"Potion", });
232
232
  /**
233
233
  */
234
- module.exports.MonKind = Object.freeze({ Demon:0,"0":"Demon",Drainer:1,"1":"Drainer",Angel:2,"2":"Angel",Spirit:3,"3":"Spirit",Mystic:4,"4":"Mystic", });
234
+ module.exports.Consumable = Object.freeze({ Potion:0,"0":"Potion",Bomb:1,"1":"Bomb",BombOrPotion:2,"2":"BombOrPotion", });
235
235
 
236
236
  const EventModelFinalization = (typeof FinalizationRegistry === 'undefined')
237
237
  ? { register: () => {}, unregister: () => {} }
@@ -734,10 +734,13 @@ class MonsGameModel {
734
734
  return ret === 0 ? undefined : MonsGameModel.__wrap(ret);
735
735
  }
736
736
  /**
737
+ * @param {(string)[]} takeback_fens
737
738
  * @returns {MonsGameModel | undefined}
738
739
  */
739
- without_last_turn() {
740
- const ret = wasm.monsgamemodel_without_last_turn(this.__wbg_ptr);
740
+ without_last_turn(takeback_fens) {
741
+ const ptr0 = passArrayJsValueToWasm0(takeback_fens, wasm.__wbindgen_malloc);
742
+ const len0 = WASM_VECTOR_LEN;
743
+ const ret = wasm.monsgamemodel_without_last_turn(this.__wbg_ptr, ptr0, len0);
741
744
  return ret === 0 ? undefined : MonsGameModel.__wrap(ret);
742
745
  }
743
746
  /**
@@ -919,6 +922,22 @@ class MonsGameModel {
919
922
  }
920
923
  }
921
924
  /**
925
+ * @returns {(string)[]}
926
+ */
927
+ takeback_fens() {
928
+ try {
929
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
930
+ wasm.monsgamemodel_takeback_fens(retptr, this.__wbg_ptr);
931
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
932
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
933
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
934
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
935
+ return v1;
936
+ } finally {
937
+ wasm.__wbindgen_add_to_stack_pointer(16);
938
+ }
939
+ }
940
+ /**
922
941
  * @returns {Int32Array}
923
942
  */
924
943
  available_move_kinds() {
@@ -1320,8 +1339,8 @@ class VerboseTrackingEntityModel {
1320
1339
  }
1321
1340
  module.exports.VerboseTrackingEntityModel = VerboseTrackingEntityModel;
1322
1341
 
1323
- module.exports.__wbg_location_new = function(arg0) {
1324
- const ret = Location.__wrap(arg0);
1342
+ module.exports.__wbg_eventmodel_new = function(arg0) {
1343
+ const ret = EventModel.__wrap(arg0);
1325
1344
  return addHeapObject(ret);
1326
1345
  };
1327
1346
 
@@ -1330,8 +1349,8 @@ module.exports.__wbg_nextinputmodel_new = function(arg0) {
1330
1349
  return addHeapObject(ret);
1331
1350
  };
1332
1351
 
1333
- module.exports.__wbg_eventmodel_new = function(arg0) {
1334
- const ret = EventModel.__wrap(arg0);
1352
+ module.exports.__wbg_location_new = function(arg0) {
1353
+ const ret = Location.__wrap(arg0);
1335
1354
  return addHeapObject(ret);
1336
1355
  };
1337
1356
 
@@ -1418,6 +1437,15 @@ module.exports.__wbg_call_27c0f87801dedf93 = function() { return handleError(fun
1418
1437
  return addHeapObject(ret);
1419
1438
  }, arguments) };
1420
1439
 
1440
+ module.exports.__wbindgen_string_get = function(arg0, arg1) {
1441
+ const obj = getObject(arg1);
1442
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1443
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1444
+ var len1 = WASM_VECTOR_LEN;
1445
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
1446
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1447
+ };
1448
+
1421
1449
  module.exports.__wbindgen_object_clone_ref = function(arg0) {
1422
1450
  const ret = getObject(arg0);
1423
1451
  return addHeapObject(ret);
package/mons-rust_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mons-rust",
3
3
  "description": "super metal mons",
4
- "version": "0.1.60",
4
+ "version": "0.1.62",
5
5
  "license": "CC0-1.0",
6
6
  "repository": {
7
7
  "type": "git",