volleyballsimtypes 0.0.68 → 0.0.69
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.
|
@@ -14,15 +14,17 @@ interface TeamOpts {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class Team {
|
|
16
16
|
readonly id: string;
|
|
17
|
-
readonly rating: number;
|
|
18
17
|
readonly roster: Player[];
|
|
19
18
|
readonly name: string;
|
|
20
19
|
readonly shortName: string;
|
|
21
20
|
readonly coach?: Coach;
|
|
22
21
|
readonly league?: League;
|
|
23
22
|
readonly country?: Country;
|
|
23
|
+
private _rating;
|
|
24
24
|
constructor({ id, rating, name, shortName, country, roster, coach, league }: TeamOpts);
|
|
25
25
|
isPlayerInRoster(player: Player): boolean;
|
|
26
26
|
toString(): string;
|
|
27
|
+
get rating(): number;
|
|
28
|
+
updateRating(ratingChange: number): void;
|
|
27
29
|
}
|
|
28
30
|
export {};
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Team = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
|
+
const match_1 = require("../match");
|
|
5
6
|
class Team {
|
|
6
7
|
constructor({ id, rating, name, shortName, country, roster, coach, league }) {
|
|
7
8
|
(0, utils_1.validateUUID)(id);
|
|
8
9
|
this.id = id;
|
|
9
|
-
this.
|
|
10
|
+
this._rating = rating;
|
|
10
11
|
this.roster = roster;
|
|
11
12
|
this.coach = coach;
|
|
12
13
|
this.name = name;
|
|
@@ -20,5 +21,13 @@ class Team {
|
|
|
20
21
|
toString() {
|
|
21
22
|
return `${this.name} [${this.shortName}] (${this.country?.name})`;
|
|
22
23
|
}
|
|
24
|
+
get rating() {
|
|
25
|
+
return this._rating;
|
|
26
|
+
}
|
|
27
|
+
updateRating(ratingChange) {
|
|
28
|
+
if (Math.abs(ratingChange) > match_1.MatchRating.K)
|
|
29
|
+
throw new Error(`INVALID RATING CHANGE: ${ratingChange}`);
|
|
30
|
+
this._rating += ratingChange;
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
exports.Team = Team;
|
|
@@ -14,15 +14,17 @@ interface TeamOpts {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class Team {
|
|
16
16
|
readonly id: string;
|
|
17
|
-
readonly rating: number;
|
|
18
17
|
readonly roster: Player[];
|
|
19
18
|
readonly name: string;
|
|
20
19
|
readonly shortName: string;
|
|
21
20
|
readonly coach?: Coach;
|
|
22
21
|
readonly league?: League;
|
|
23
22
|
readonly country?: Country;
|
|
23
|
+
private _rating;
|
|
24
24
|
constructor({ id, rating, name, shortName, country, roster, coach, league }: TeamOpts);
|
|
25
25
|
isPlayerInRoster(player: Player): boolean;
|
|
26
26
|
toString(): string;
|
|
27
|
+
get rating(): number;
|
|
28
|
+
updateRating(ratingChange: number): void;
|
|
27
29
|
}
|
|
28
30
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { validateUUID } from '../utils';
|
|
2
|
+
import { MatchRating } from '../match';
|
|
2
3
|
export class Team {
|
|
3
4
|
constructor({ id, rating, name, shortName, country, roster, coach, league }) {
|
|
4
5
|
validateUUID(id);
|
|
5
6
|
this.id = id;
|
|
6
|
-
this.
|
|
7
|
+
this._rating = rating;
|
|
7
8
|
this.roster = roster;
|
|
8
9
|
this.coach = coach;
|
|
9
10
|
this.name = name;
|
|
@@ -17,4 +18,12 @@ export class Team {
|
|
|
17
18
|
toString() {
|
|
18
19
|
return `${this.name} [${this.shortName}] (${this.country?.name})`;
|
|
19
20
|
}
|
|
21
|
+
get rating() {
|
|
22
|
+
return this._rating;
|
|
23
|
+
}
|
|
24
|
+
updateRating(ratingChange) {
|
|
25
|
+
if (Math.abs(ratingChange) > MatchRating.K)
|
|
26
|
+
throw new Error(`INVALID RATING CHANGE: ${ratingChange}`);
|
|
27
|
+
this._rating += ratingChange;
|
|
28
|
+
}
|
|
20
29
|
}
|