@civ-clone/library-unit 0.1.3 → 0.1.4
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/Actions/SetHomeCity.d.ts +1 -1
- package/Actions/SetHomeCity.js +2 -16
- package/Actions/SetHomeCity.js.map +1 -1
- package/Actions/SetHomeCity.ts +3 -3
- package/Actions/SneakAttack.d.ts +1 -1
- package/Actions/SneakAttack.js +2 -16
- package/Actions/SneakAttack.js.map +1 -1
- package/Actions/SneakAttack.ts +3 -3
- package/Actions/SneakCaptureCity.d.ts +1 -1
- package/Actions/SneakCaptureCity.js +2 -16
- package/Actions/SneakCaptureCity.js.map +1 -1
- package/Actions/SneakCaptureCity.ts +3 -3
- package/package.json +1 -1
package/Actions/SetHomeCity.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import Action from '@civ-clone/core-unit/Action';
|
|
|
4
4
|
import Tile from '@civ-clone/core-world/Tile';
|
|
5
5
|
import Unit from '@civ-clone/core-unit/Unit';
|
|
6
6
|
export declare class SetHomeCity extends Action {
|
|
7
|
-
|
|
7
|
+
private _cityRegistry;
|
|
8
8
|
constructor(
|
|
9
9
|
from: Tile,
|
|
10
10
|
to: Tile,
|
package/Actions/SetHomeCity.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _SetHomeCity_cityRegistry;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.SetHomeCity = void 0;
|
|
16
4
|
const CityRegistry_1 = require("@civ-clone/core-city/CityRegistry");
|
|
@@ -19,11 +7,10 @@ const Action_1 = require("@civ-clone/core-unit/Action");
|
|
|
19
7
|
class SetHomeCity extends Action_1.default {
|
|
20
8
|
constructor(from, to, unit, ruleRegistry = RuleRegistry_1.instance, cityRegistry = CityRegistry_1.instance) {
|
|
21
9
|
super(from, to, unit, ruleRegistry);
|
|
22
|
-
|
|
23
|
-
__classPrivateFieldSet(this, _SetHomeCity_cityRegistry, cityRegistry, "f");
|
|
10
|
+
this._cityRegistry = cityRegistry;
|
|
24
11
|
}
|
|
25
12
|
perform(...args) {
|
|
26
|
-
const targetCity =
|
|
13
|
+
const targetCity = this._cityRegistry.getByTile(this.from());
|
|
27
14
|
if (!targetCity) {
|
|
28
15
|
return;
|
|
29
16
|
}
|
|
@@ -31,6 +18,5 @@ class SetHomeCity extends Action_1.default {
|
|
|
31
18
|
}
|
|
32
19
|
}
|
|
33
20
|
exports.SetHomeCity = SetHomeCity;
|
|
34
|
-
_SetHomeCity_cityRegistry = new WeakMap();
|
|
35
21
|
exports.default = SetHomeCity;
|
|
36
22
|
//# sourceMappingURL=SetHomeCity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SetHomeCity.js","sourceRoot":"","sources":["SetHomeCity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SetHomeCity.js","sourceRoot":"","sources":["SetHomeCity.ts"],"names":[],"mappings":";;;AAAA,oEAG2C;AAC3C,oEAG2C;AAC3C,wDAAiD;AAIjD,MAAa,WAAY,SAAQ,gBAAM;IAGrC,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,eAA6B,uBAAoB,EACjD,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAEpC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IACD,OAAO,CAAC,GAAG,IAAW;QACpB,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7D,IAAI,CAAC,UAAU,EAAE;YACf,OAAO;SACR;QAED,IAAI,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;CACF;AAvBD,kCAuBC;AAED,kBAAe,WAAW,CAAC"}
|
package/Actions/SetHomeCity.ts
CHANGED
|
@@ -11,7 +11,7 @@ import Tile from '@civ-clone/core-world/Tile';
|
|
|
11
11
|
import Unit from '@civ-clone/core-unit/Unit';
|
|
12
12
|
|
|
13
13
|
export class SetHomeCity extends Action {
|
|
14
|
-
|
|
14
|
+
private _cityRegistry: CityRegistry;
|
|
15
15
|
|
|
16
16
|
constructor(
|
|
17
17
|
from: Tile,
|
|
@@ -22,10 +22,10 @@ export class SetHomeCity extends Action {
|
|
|
22
22
|
) {
|
|
23
23
|
super(from, to, unit, ruleRegistry);
|
|
24
24
|
|
|
25
|
-
this
|
|
25
|
+
this._cityRegistry = cityRegistry;
|
|
26
26
|
}
|
|
27
27
|
perform(...args: any[]): void {
|
|
28
|
-
const targetCity = this
|
|
28
|
+
const targetCity = this._cityRegistry.getByTile(this.from());
|
|
29
29
|
|
|
30
30
|
if (!targetCity) {
|
|
31
31
|
return;
|
package/Actions/SneakAttack.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import Player from '@civ-clone/core-player/Player';
|
|
|
5
5
|
import Tile from '@civ-clone/core-world/Tile';
|
|
6
6
|
import Unit from '@civ-clone/core-unit/Unit';
|
|
7
7
|
export declare class SneakAttack extends Attack {
|
|
8
|
-
|
|
8
|
+
private _enemy;
|
|
9
9
|
constructor(
|
|
10
10
|
from: Tile,
|
|
11
11
|
to: Tile,
|
package/Actions/SneakAttack.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _SneakAttack_enemy;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.SneakAttack = void 0;
|
|
16
4
|
const RuleRegistry_1 = require("@civ-clone/core-rule/RuleRegistry");
|
|
@@ -19,15 +7,13 @@ const Actions_1 = require("../Actions");
|
|
|
19
7
|
class SneakAttack extends Actions_1.Attack {
|
|
20
8
|
constructor(from, to, unit, enemy, ruleRegistry = RuleRegistry_1.instance, unitRegistry = UnitRegistry_1.instance) {
|
|
21
9
|
super(from, to, unit, ruleRegistry, unitRegistry);
|
|
22
|
-
|
|
23
|
-
__classPrivateFieldSet(this, _SneakAttack_enemy, enemy, "f");
|
|
10
|
+
this._enemy = enemy;
|
|
24
11
|
this.addKey('enemy');
|
|
25
12
|
}
|
|
26
13
|
enemy() {
|
|
27
|
-
return
|
|
14
|
+
return this._enemy;
|
|
28
15
|
}
|
|
29
16
|
}
|
|
30
17
|
exports.SneakAttack = SneakAttack;
|
|
31
|
-
_SneakAttack_enemy = new WeakMap();
|
|
32
18
|
exports.default = SneakAttack;
|
|
33
19
|
//# sourceMappingURL=SneakAttack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SneakAttack.js","sourceRoot":"","sources":["SneakAttack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SneakAttack.js","sourceRoot":"","sources":["SneakAttack.ts"],"names":[],"mappings":";;;AAAA,oEAG2C;AAC3C,oEAG2C;AAC3C,wCAAoC;AAKpC,MAAa,WAAY,SAAQ,gBAAM;IAGrC,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,KAAa,EACb,eAA6B,uBAAoB,EACjD,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QAElD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AArBD,kCAqBC;AAED,kBAAe,WAAW,CAAC"}
|
package/Actions/SneakAttack.ts
CHANGED
|
@@ -12,7 +12,7 @@ import Tile from '@civ-clone/core-world/Tile';
|
|
|
12
12
|
import Unit from '@civ-clone/core-unit/Unit';
|
|
13
13
|
|
|
14
14
|
export class SneakAttack extends Attack {
|
|
15
|
-
|
|
15
|
+
private _enemy: Player;
|
|
16
16
|
|
|
17
17
|
constructor(
|
|
18
18
|
from: Tile,
|
|
@@ -24,13 +24,13 @@ export class SneakAttack extends Attack {
|
|
|
24
24
|
) {
|
|
25
25
|
super(from, to, unit, ruleRegistry, unitRegistry);
|
|
26
26
|
|
|
27
|
-
this
|
|
27
|
+
this._enemy = enemy;
|
|
28
28
|
|
|
29
29
|
this.addKey('enemy');
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
enemy(): Player {
|
|
33
|
-
return this
|
|
33
|
+
return this._enemy;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -5,7 +5,7 @@ import Player from '@civ-clone/core-player/Player';
|
|
|
5
5
|
import Tile from '@civ-clone/core-world/Tile';
|
|
6
6
|
import Unit from '@civ-clone/core-unit/Unit';
|
|
7
7
|
export declare class SneakCaptureCity extends CaptureCity {
|
|
8
|
-
|
|
8
|
+
private _enemy;
|
|
9
9
|
constructor(
|
|
10
10
|
from: Tile,
|
|
11
11
|
to: Tile,
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _SneakCaptureCity_enemy;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.SneakCaptureCity = void 0;
|
|
16
4
|
const RuleRegistry_1 = require("@civ-clone/core-rule/RuleRegistry");
|
|
@@ -18,15 +6,13 @@ const Actions_1 = require("../Actions");
|
|
|
18
6
|
class SneakCaptureCity extends Actions_1.CaptureCity {
|
|
19
7
|
constructor(from, to, unit, city, enemy, ruleRegistry = RuleRegistry_1.instance) {
|
|
20
8
|
super(from, to, unit, city, ruleRegistry);
|
|
21
|
-
|
|
22
|
-
__classPrivateFieldSet(this, _SneakCaptureCity_enemy, enemy, "f");
|
|
9
|
+
this._enemy = enemy;
|
|
23
10
|
this.addKey('enemy');
|
|
24
11
|
}
|
|
25
12
|
enemy() {
|
|
26
|
-
return
|
|
13
|
+
return this._enemy;
|
|
27
14
|
}
|
|
28
15
|
}
|
|
29
16
|
exports.SneakCaptureCity = SneakCaptureCity;
|
|
30
|
-
_SneakCaptureCity_enemy = new WeakMap();
|
|
31
17
|
exports.default = SneakCaptureCity;
|
|
32
18
|
//# sourceMappingURL=SneakCaptureCity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SneakCaptureCity.js","sourceRoot":"","sources":["SneakCaptureCity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SneakCaptureCity.js","sourceRoot":"","sources":["SneakCaptureCity.ts"],"names":[],"mappings":";;;AAAA,oEAG2C;AAC3C,wCAAyC;AAMzC,MAAa,gBAAiB,SAAQ,qBAAW;IAG/C,YACE,IAAU,EACV,EAAQ,EACR,IAAU,EACV,IAAU,EACV,KAAa,EACb,eAA6B,uBAAoB;QAEjD,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AArBD,4CAqBC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import Tile from '@civ-clone/core-world/Tile';
|
|
|
9
9
|
import Unit from '@civ-clone/core-unit/Unit';
|
|
10
10
|
|
|
11
11
|
export class SneakCaptureCity extends CaptureCity {
|
|
12
|
-
|
|
12
|
+
private _enemy: Player;
|
|
13
13
|
|
|
14
14
|
constructor(
|
|
15
15
|
from: Tile,
|
|
@@ -21,13 +21,13 @@ export class SneakCaptureCity extends CaptureCity {
|
|
|
21
21
|
) {
|
|
22
22
|
super(from, to, unit, city, ruleRegistry);
|
|
23
23
|
|
|
24
|
-
this
|
|
24
|
+
this._enemy = enemy;
|
|
25
25
|
|
|
26
26
|
this.addKey('enemy');
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
enemy(): Player {
|
|
30
|
-
return this
|
|
30
|
+
return this._enemy;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|