volleyballsimtypes 0.0.73 → 0.0.75
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/dist/cjs/src/data/init-models.js +2 -2
- package/dist/cjs/src/data/models/player.d.ts +22 -22
- package/dist/cjs/src/data/models/team.d.ts +0 -1
- package/dist/cjs/src/data/transformers/team.js +2 -2
- package/dist/cjs/src/service/coach/formation.d.ts +6 -6
- package/dist/cjs/src/service/coach/formation.js +1 -1
- package/dist/cjs/src/service/coach/index.d.ts +2 -3
- package/dist/cjs/src/service/coach/index.js +16 -5
- package/dist/cjs/src/service/competition/index.d.ts +7 -8
- package/dist/cjs/src/service/competition/index.js +21 -15
- package/dist/cjs/src/service/country/index.d.ts +1 -2
- package/dist/cjs/src/service/country/index.js +15 -3
- package/dist/cjs/src/service/draft/index.d.ts +2 -3
- package/dist/cjs/src/service/draft/index.js +16 -5
- package/dist/cjs/src/service/event/index.d.ts +10 -11
- package/dist/cjs/src/service/event/index.js +24 -33
- package/dist/cjs/src/service/index.d.ts +9 -10
- package/dist/cjs/src/service/index.js +23 -68
- package/dist/cjs/src/service/match/index.d.ts +7 -8
- package/dist/cjs/src/service/match/index.js +21 -18
- package/dist/cjs/src/service/player/index.d.ts +5 -6
- package/dist/cjs/src/service/player/index.js +19 -11
- package/dist/cjs/src/service/player/role.d.ts +13 -11
- package/dist/cjs/src/service/player/role.js +32 -20
- package/dist/cjs/src/service/player/trait.js +12 -5
- package/dist/cjs/src/service/team/index.d.ts +1 -2
- package/dist/cjs/src/service/team/index.js +15 -3
- package/dist/esm/src/data/init-models.js +2 -2
- package/dist/esm/src/data/models/player.d.ts +22 -22
- package/dist/esm/src/data/models/team.d.ts +0 -1
- package/dist/esm/src/data/transformers/team.js +2 -2
- package/dist/esm/src/service/coach/formation.d.ts +6 -6
- package/dist/esm/src/service/coach/formation.js +1 -1
- package/dist/esm/src/service/coach/index.d.ts +2 -3
- package/dist/esm/src/service/coach/index.js +2 -3
- package/dist/esm/src/service/competition/index.d.ts +7 -8
- package/dist/esm/src/service/competition/index.js +7 -8
- package/dist/esm/src/service/country/index.d.ts +1 -2
- package/dist/esm/src/service/country/index.js +1 -2
- package/dist/esm/src/service/draft/index.d.ts +2 -3
- package/dist/esm/src/service/draft/index.js +2 -3
- package/dist/esm/src/service/event/index.d.ts +10 -11
- package/dist/esm/src/service/event/index.js +10 -11
- package/dist/esm/src/service/index.d.ts +9 -10
- package/dist/esm/src/service/index.js +9 -10
- package/dist/esm/src/service/match/index.d.ts +7 -8
- package/dist/esm/src/service/match/index.js +7 -8
- package/dist/esm/src/service/player/index.d.ts +5 -6
- package/dist/esm/src/service/player/index.js +5 -6
- package/dist/esm/src/service/player/role.d.ts +13 -11
- package/dist/esm/src/service/player/role.js +31 -20
- package/dist/esm/src/service/player/trait.js +12 -5
- package/dist/esm/src/service/team/index.d.ts +1 -2
- package/dist/esm/src/service/team/index.js +1 -2
- package/package.json +1 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { PerformanceStats } from './performance-stats';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export declare class Role {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
static readonly SETTER: Role;
|
|
5
|
+
static readonly LIBERO: Role;
|
|
6
|
+
static readonly OUTSIDE_HITTER: Role;
|
|
7
|
+
static readonly OPPOSITE_HITTER: Role;
|
|
8
|
+
static readonly MIDDLE_BLOCKER: Role;
|
|
9
|
+
static readonly DEFENSIVE_SPECIALIST: Role;
|
|
10
|
+
private static readonly ROLES;
|
|
11
|
+
private constructor();
|
|
12
|
+
static getRoles(): Role[];
|
|
13
|
+
static calculateScore(stats: PerformanceStats, role: Role): number;
|
|
14
|
+
static assignRoles(stats: PerformanceStats): Role[];
|
|
13
15
|
}
|
|
@@ -5,30 +5,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Role = void 0;
|
|
7
7
|
const role_formula_json_1 = __importDefault(require("../../../data/role.formula.json"));
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
Role["LIBERO"] = "Libero";
|
|
12
|
-
Role["OUTSIDE_HITTER"] = "Outside Hitter";
|
|
13
|
-
Role["OPPOSITE_HITTER"] = "Opposite Hitter";
|
|
14
|
-
Role["MIDDLE_BLOCKER"] = "Middle Blocker";
|
|
15
|
-
Role["DEFENSIVE_SPECIALIST"] = "Defensive Specialist";
|
|
16
|
-
})(Role = exports.Role || (exports.Role = {}));
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
18
|
-
(function (Role) {
|
|
19
|
-
const ROLES = [Role.LIBERO, Role.SETTER, Role.OPPOSITE_HITTER, Role.OUTSIDE_HITTER, Role.MIDDLE_BLOCKER,
|
|
20
|
-
Role.DEFENSIVE_SPECIALIST];
|
|
21
|
-
function getRoles() {
|
|
22
|
-
return [...ROLES];
|
|
8
|
+
class Role {
|
|
9
|
+
constructor(name) {
|
|
10
|
+
this.name = name;
|
|
23
11
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
12
|
+
static getRoles() {
|
|
13
|
+
return [...Role.ROLES];
|
|
14
|
+
}
|
|
15
|
+
static calculateScore(stats, role) {
|
|
16
|
+
const weights = role_formula_json_1.default.find(r => r.role === role.name);
|
|
27
17
|
if (weights == null)
|
|
28
18
|
throw new Error('COULD_NOT_FIND_ROLE_WEIGHT');
|
|
29
19
|
const score = Object.entries(weights.weight)
|
|
30
20
|
.reduce((score, [key, value]) => score + (stats[key] * weights.weight[key]), 0);
|
|
31
21
|
return Math.round(score);
|
|
32
22
|
}
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
static assignRoles(stats) {
|
|
24
|
+
const scores = this.getRoles().map(role => ({
|
|
25
|
+
role,
|
|
26
|
+
score: this.calculateScore(stats, role)
|
|
27
|
+
})).sort((x, y) => y.score - x.score);
|
|
28
|
+
const out = [scores[0].role];
|
|
29
|
+
if (scores[1].score >= 60) {
|
|
30
|
+
out.push(scores[1].role);
|
|
31
|
+
}
|
|
32
|
+
if (scores[2].score >= 70) {
|
|
33
|
+
out.push(scores[2].role);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Role = Role;
|
|
39
|
+
Role.SETTER = new Role('Setter');
|
|
40
|
+
Role.LIBERO = new Role('Libero');
|
|
41
|
+
Role.OUTSIDE_HITTER = new Role('Outside Hitter');
|
|
42
|
+
Role.OPPOSITE_HITTER = new Role('Opposite Hitter');
|
|
43
|
+
Role.MIDDLE_BLOCKER = new Role('Middle Blocker');
|
|
44
|
+
Role.DEFENSIVE_SPECIALIST = new Role('Defensive Specialist');
|
|
45
|
+
Role.ROLES = [Role.LIBERO, Role.SETTER, Role.OPPOSITE_HITTER, Role.OUTSIDE_HITTER, Role.MIDDLE_BLOCKER,
|
|
46
|
+
Role.DEFENSIVE_SPECIALIST];
|
|
@@ -41,15 +41,18 @@ class Trait {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.Trait = Trait;
|
|
44
|
+
// A Setter gets a bonus to their score and the receiving attacker gets a bonus as well.
|
|
45
|
+
// Stacks with attacker bonus
|
|
44
46
|
Trait.MASTER_MIND = new Trait({
|
|
45
47
|
name: 'Master Mind',
|
|
46
48
|
roles: [role_1.Role.SETTER],
|
|
47
49
|
modifier: 1.25,
|
|
48
|
-
chance: 0.
|
|
50
|
+
chance: 0.25,
|
|
49
51
|
statThreshold: 80,
|
|
50
52
|
stat: stats_1.GeneralStat.ATTACK,
|
|
51
53
|
weight: 10
|
|
52
54
|
});
|
|
55
|
+
// Will always participate in blocking regardless of chance
|
|
53
56
|
Trait.MOVING_WALL = new Trait({
|
|
54
57
|
name: 'Moving Wall',
|
|
55
58
|
roles: [role_1.Role.MIDDLE_BLOCKER, role_1.Role.DEFENSIVE_SPECIALIST],
|
|
@@ -59,6 +62,7 @@ Trait.MOVING_WALL = new Trait({
|
|
|
59
62
|
stat: stats_1.GeneralStat.DEFENSE,
|
|
60
63
|
weight: 5
|
|
61
64
|
});
|
|
65
|
+
// On attack, will always pick the worst receiver
|
|
62
66
|
Trait.MARKSMAN = new Trait({
|
|
63
67
|
name: 'Marksman',
|
|
64
68
|
roles: [role_1.Role.OUTSIDE_HITTER, role_1.Role.OPPOSITE_HITTER, role_1.Role.SETTER],
|
|
@@ -68,15 +72,17 @@ Trait.MARKSMAN = new Trait({
|
|
|
68
72
|
stat: stats_1.GeneralStat.ATTACK,
|
|
69
73
|
weight: 5
|
|
70
74
|
});
|
|
75
|
+
// Increases the score of the serve by 25% when serve type is Jumping.
|
|
71
76
|
Trait.METEOR_SERVE = new Trait({
|
|
72
77
|
name: 'Meteor Serve',
|
|
73
78
|
roles: [role_1.Role.OUTSIDE_HITTER, role_1.Role.OPPOSITE_HITTER, role_1.Role.SETTER, role_1.Role.DEFENSIVE_SPECIALIST, role_1.Role.MIDDLE_BLOCKER],
|
|
74
|
-
modifier: 1.
|
|
75
|
-
chance: 0.
|
|
79
|
+
modifier: 1.25,
|
|
80
|
+
chance: 0.1,
|
|
76
81
|
statThreshold: 75,
|
|
77
82
|
stat: stats_1.GeneralStat.SERVE,
|
|
78
83
|
weight: 10
|
|
79
84
|
});
|
|
85
|
+
// Has a 50% chance of taking an action without decreasing energy.
|
|
80
86
|
Trait.VIGOROUS = new Trait({
|
|
81
87
|
name: 'Vigorous',
|
|
82
88
|
roles: [],
|
|
@@ -86,12 +92,13 @@ Trait.VIGOROUS = new Trait({
|
|
|
86
92
|
stat: stats_1.GeneralStat.PHYSICAL,
|
|
87
93
|
weight: 1
|
|
88
94
|
});
|
|
95
|
+
// Takes place of the receiver and increases reception score by 25%. Can only trigger in back-row.
|
|
89
96
|
Trait.GUARDIAN = new Trait({
|
|
90
97
|
name: 'Guardian',
|
|
91
98
|
roles: [role_1.Role.DEFENSIVE_SPECIALIST, role_1.Role.LIBERO],
|
|
92
|
-
chance: 0.
|
|
99
|
+
chance: 0.25,
|
|
93
100
|
statThreshold: 75,
|
|
94
|
-
modifier: 1.
|
|
101
|
+
modifier: 1.25,
|
|
95
102
|
stat: stats_1.GeneralStat.DEFENSE,
|
|
96
103
|
weight: 10
|
|
97
104
|
});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Team };
|
|
1
|
+
export * from './team';
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports
|
|
4
|
-
const team_1 = require("./team");
|
|
5
|
-
Object.defineProperty(exports, "Team", { enumerable: true, get: function () { return team_1.Team; } });
|
|
17
|
+
__exportStar(require("./team"), exports);
|
|
@@ -102,8 +102,8 @@ export function initModels(sequelize) {
|
|
|
102
102
|
Player.hasMany(Serve, { as: 'Serves', foreignKey: 'player_id' });
|
|
103
103
|
Player.hasMany(Set, { as: 'Sets', foreignKey: 'player_id' });
|
|
104
104
|
Player.hasMany(Spike, { as: 'Spikes', foreignKey: 'player_id' });
|
|
105
|
-
Player.hasMany(Substitution, { as: '
|
|
106
|
-
Player.hasMany(Substitution, { as: '
|
|
105
|
+
Player.hasMany(Substitution, { as: 'OutSubstitutions', foreignKey: 'player_out' });
|
|
106
|
+
Player.hasMany(Substitution, { as: 'InSubstitutions', foreignKey: 'player_id' });
|
|
107
107
|
Player.hasOne(PerformanceStats, { as: 'PerformanceStat', foreignKey: 'player_id' });
|
|
108
108
|
Player.hasOne(DraftPick, { as: 'DraftPick', foreignKey: 'player_id' });
|
|
109
109
|
Player.hasOne(PlayerTeam, { as: 'PlayerTeam', foreignKey: 'player_id' });
|
|
@@ -238,27 +238,27 @@ export declare class PlayerModel extends Model<PlayerAttributes, PlayerCreationA
|
|
|
238
238
|
hasSpike: Sequelize.HasManyHasAssociationMixin<SpikeModel, SpikeId>;
|
|
239
239
|
hasSpikes: Sequelize.HasManyHasAssociationsMixin<SpikeModel, SpikeId>;
|
|
240
240
|
countSpikes: Sequelize.HasManyCountAssociationsMixin;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
241
|
+
outSubstitutions: SubstitutionModel[];
|
|
242
|
+
getOutSubstitutions: Sequelize.HasManyGetAssociationsMixin<SubstitutionModel>;
|
|
243
|
+
setOutSubstitutions: Sequelize.HasManySetAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
244
|
+
addOutSubstitution: Sequelize.HasManyAddAssociationMixin<SubstitutionModel, SubstitutionId>;
|
|
245
|
+
addOutSubstitutions: Sequelize.HasManyAddAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
246
|
+
createOutSubstitution: Sequelize.HasManyCreateAssociationMixin<SubstitutionModel>;
|
|
247
|
+
removeOutSubstitution: Sequelize.HasManyRemoveAssociationMixin<SubstitutionModel, SubstitutionId>;
|
|
248
|
+
removeOutSubstitutions: Sequelize.HasManyRemoveAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
249
|
+
hasOutSubstitution: Sequelize.HasManyHasAssociationMixin<SubstitutionModel, SubstitutionId>;
|
|
250
|
+
hasOutSubstitutions: Sequelize.HasManyHasAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
251
|
+
countOutSubstitutions: Sequelize.HasManyCountAssociationsMixin;
|
|
252
|
+
InSubstitutions: SubstitutionModel[];
|
|
253
|
+
getInSubstitutions: Sequelize.HasManyGetAssociationsMixin<SubstitutionModel>;
|
|
254
|
+
setInSubstitutions: Sequelize.HasManySetAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
255
|
+
addInSubstitution: Sequelize.HasManyAddAssociationMixin<SubstitutionModel, SubstitutionId>;
|
|
256
|
+
addInSubstitutions: Sequelize.HasManyAddAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
257
|
+
createInSubstitution: Sequelize.HasManyCreateAssociationMixin<SubstitutionModel>;
|
|
258
|
+
removeInSubstitution: Sequelize.HasManyRemoveAssociationMixin<SubstitutionModel, SubstitutionId>;
|
|
259
|
+
removeInSubstitutions: Sequelize.HasManyRemoveAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
260
|
+
hasInSubstitution: Sequelize.HasManyHasAssociationMixin<SubstitutionModel, SubstitutionId>;
|
|
261
|
+
hasInSubstitutions: Sequelize.HasManyHasAssociationsMixin<SubstitutionModel, SubstitutionId>;
|
|
262
|
+
countInSubstitutions: Sequelize.HasManyCountAssociationsMixin;
|
|
263
263
|
static initModel(sequelize: Sequelize.Sequelize): typeof PlayerModel;
|
|
264
264
|
}
|
|
@@ -26,7 +26,6 @@ export declare class TeamModel extends Model<TeamAttributes, TeamCreationAttribu
|
|
|
26
26
|
league_id: string;
|
|
27
27
|
country_id: string;
|
|
28
28
|
coach: CoachModel;
|
|
29
|
-
Players: PlayerModel[];
|
|
30
29
|
getCoach: Sequelize.BelongsToGetAssociationMixin<CoachModel>;
|
|
31
30
|
setCoach: Sequelize.BelongsToSetAssociationMixin<CoachModel, CoachId>;
|
|
32
31
|
createCoach: Sequelize.BelongsToCreateAssociationMixin<CoachModel>;
|
|
@@ -19,7 +19,7 @@ function transformToObject(team) {
|
|
|
19
19
|
shortName: team.short_name,
|
|
20
20
|
country: team.country != null ? transformToCountry(team.country) : undefined,
|
|
21
21
|
coach: team.coach != null ? transformToCoach(team.coach) : undefined,
|
|
22
|
-
roster: team.
|
|
22
|
+
roster: team.PlayerTeams != null ? team.PlayerTeams.map(pt => transformToPlayer(pt.player)) : [],
|
|
23
23
|
rating: team.rating
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -30,7 +30,7 @@ function transformToAPIObject(team) {
|
|
|
30
30
|
shortName: team.short_name,
|
|
31
31
|
country: team.country != null ? transformToCountry(team.country) : undefined,
|
|
32
32
|
coach: team.coach != null ? transformToAPICoach(team.coach) : undefined,
|
|
33
|
-
roster: team.
|
|
33
|
+
roster: team.PlayerTeams != null ? team.PlayerTeams.map(pt => transformToAPIPlayer(pt.player)) : []
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
export { transformToObject as transformToTeam, transformToAPIObject as transformToAPITeam, transformToAttributes as transformFromTeam };
|
|
@@ -9,12 +9,12 @@ interface PositionRole {
|
|
|
9
9
|
readonly [CourtPosition.RIGHT_BACK]: Role[];
|
|
10
10
|
}
|
|
11
11
|
export interface SubPriority {
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
12
|
+
readonly 'Middle Blocker': number;
|
|
13
|
+
readonly 'Outside Hitter': number;
|
|
14
|
+
readonly 'Opposite Hitter': number;
|
|
15
|
+
readonly 'Defensive Specialist': number;
|
|
16
|
+
readonly Setter: number;
|
|
17
|
+
readonly Libero: number;
|
|
18
18
|
}
|
|
19
19
|
export declare class Formation {
|
|
20
20
|
static readonly '5-1': Formation;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Coach, Formation, SubPriority };
|
|
1
|
+
export * from './coach';
|
|
2
|
+
export * from './formation';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Coach, Formation };
|
|
1
|
+
export * from './coach';
|
|
2
|
+
export * from './formation';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { TournamentMatch, Stage, Tournament, Season, Standing, League, Iteration, };
|
|
1
|
+
export * from './standing';
|
|
2
|
+
export * from './season';
|
|
3
|
+
export * from './league';
|
|
4
|
+
export * from './iteration';
|
|
5
|
+
export * from './tournament';
|
|
6
|
+
export * from './tournament-match';
|
|
7
|
+
export * from './stage';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { TournamentMatch, Stage, Tournament, Season, Standing, League, Iteration, };
|
|
1
|
+
export * from './standing';
|
|
2
|
+
export * from './season';
|
|
3
|
+
export * from './league';
|
|
4
|
+
export * from './iteration';
|
|
5
|
+
export * from './tournament';
|
|
6
|
+
export * from './tournament-match';
|
|
7
|
+
export * from './stage';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Country };
|
|
1
|
+
export * from './country';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Country };
|
|
1
|
+
export * from './country';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Draft, DraftPick };
|
|
1
|
+
export * from './draft';
|
|
2
|
+
export * from './draft-pick';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export { Draft, DraftPick };
|
|
1
|
+
export * from './draft';
|
|
2
|
+
export * from './draft-pick';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { Spike, SpikeFailure, SpikeType, ServeType, Set, SetFailure, SetType, ReceptionFailure, ReceptionType, BlockFailure, BlockType, Block, ServeFailure, Serve, EventType, RallyEvent, RallyEventOpts, InPlayEventOpts, InPlayEvent, Reception, Substitution, LiberoReplacementType, LiberoReplacement, Score };
|
|
1
|
+
export * from './score';
|
|
2
|
+
export * from './set';
|
|
3
|
+
export * from './block';
|
|
4
|
+
export * from './serve';
|
|
5
|
+
export * from './in-play-event';
|
|
6
|
+
export * from './rally-event';
|
|
7
|
+
export * from './reception';
|
|
8
|
+
export * from './spike';
|
|
9
|
+
export * from './substitution';
|
|
10
|
+
export * from './libero-replacement';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export { Spike, SpikeFailure, SpikeType, ServeType, Set, SetFailure, SetType, ReceptionFailure, ReceptionType, BlockFailure, BlockType, Block, ServeFailure, Serve, EventType, RallyEvent, InPlayEvent, Reception, Substitution, LiberoReplacementType, LiberoReplacement, Score };
|
|
1
|
+
export * from './score';
|
|
2
|
+
export * from './set';
|
|
3
|
+
export * from './block';
|
|
4
|
+
export * from './serve';
|
|
5
|
+
export * from './in-play-event';
|
|
6
|
+
export * from './rally-event';
|
|
7
|
+
export * from './reception';
|
|
8
|
+
export * from './spike';
|
|
9
|
+
export * from './substitution';
|
|
10
|
+
export * from './libero-replacement';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { Draft, DraftPick, Stage, TournamentMatch, Tournament, Block, BlockFailure, BlockType, Coach, Country, CourtPosition, CourtRow, CourtTarget, EventStat, EventType, Formation, formatNumber, GeneralStat, generateModifier, getKeys, getRandomEnumValue, InPlayEvent, InPlayEventOpts, League, LiberoReplacement, LiberoReplacementType, Match, MatchSet, MatchRating, MatchSetState, MatchTeam, Name, PerformanceStats, Player, PlayerPosition, Rally, RallyEvent, RallyEventOpts, RallyState, randomNumber, Reception, ReceptionFailure, ReceptionType, Role, Score, Season, Serve, ServeFailure, ServeType, Set, SetFailure, SetStatistics, SetType, shuffle, Spike, SpikeFailure, SpikeType, Standing, Stat, SubPriority, Substitution, Team, Trait, Iteration, validateUUID };
|
|
1
|
+
export * from './match';
|
|
2
|
+
export * from './coach';
|
|
3
|
+
export * from './country';
|
|
4
|
+
export * from './draft';
|
|
5
|
+
export * from './team';
|
|
6
|
+
export * from './event';
|
|
7
|
+
export * from './player';
|
|
8
|
+
export * from './competition';
|
|
9
|
+
export * from './utils';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { Draft, DraftPick, Stage, TournamentMatch, Tournament, Block, BlockFailure, BlockType, Coach, Country, CourtPosition, CourtRow, CourtTarget, EventType, Formation, formatNumber, GeneralStat, generateModifier, getKeys, getRandomEnumValue, InPlayEvent, League, LiberoReplacement, LiberoReplacementType, Match, MatchSet, MatchRating, MatchSetState, MatchTeam, PerformanceStats, Player, Rally, RallyEvent, RallyState, randomNumber, Reception, ReceptionFailure, ReceptionType, Role, Score, Season, Serve, ServeFailure, ServeType, Set, SetFailure, SetType, shuffle, Spike, SpikeFailure, SpikeType, Standing, Substitution, Team, Trait, Iteration, validateUUID };
|
|
1
|
+
export * from './match';
|
|
2
|
+
export * from './coach';
|
|
3
|
+
export * from './country';
|
|
4
|
+
export * from './draft';
|
|
5
|
+
export * from './team';
|
|
6
|
+
export * from './event';
|
|
7
|
+
export * from './player';
|
|
8
|
+
export * from './competition';
|
|
9
|
+
export * from './utils';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { CourtPosition, CourtRow, CourtTarget, EventStat, Match, MatchSet, MatchRating, MatchSetState, MatchTeam, PlayerPosition, Rally, RallyState, SetStatistics, };
|
|
1
|
+
export * from './match';
|
|
2
|
+
export * from './match-rating';
|
|
3
|
+
export * from './match-set';
|
|
4
|
+
export * from './rally';
|
|
5
|
+
export * from './court-position';
|
|
6
|
+
export * from './court-target';
|
|
7
|
+
export * from './match-team';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export { CourtPosition, CourtRow, CourtTarget, Match, MatchSet, MatchRating, MatchSetState, MatchTeam, Rally, RallyState, };
|
|
1
|
+
export * from './match';
|
|
2
|
+
export * from './match-rating';
|
|
3
|
+
export * from './match-set';
|
|
4
|
+
export * from './rally';
|
|
5
|
+
export * from './court-position';
|
|
6
|
+
export * from './court-target';
|
|
7
|
+
export * from './match-team';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { Player, PerformanceStats, GeneralStat, Name, Stat, Role, Trait };
|
|
1
|
+
export * from './player';
|
|
2
|
+
export * from './performance-stats';
|
|
3
|
+
export * from './role';
|
|
4
|
+
export * from './trait';
|
|
5
|
+
export * from './stats';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export { Player, PerformanceStats, GeneralStat, Role, Trait };
|
|
1
|
+
export * from './player';
|
|
2
|
+
export * from './performance-stats';
|
|
3
|
+
export * from './role';
|
|
4
|
+
export * from './trait';
|
|
5
|
+
export * from './stats';
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { PerformanceStats } from './performance-stats';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export declare class Role {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
static readonly SETTER: Role;
|
|
5
|
+
static readonly LIBERO: Role;
|
|
6
|
+
static readonly OUTSIDE_HITTER: Role;
|
|
7
|
+
static readonly OPPOSITE_HITTER: Role;
|
|
8
|
+
static readonly MIDDLE_BLOCKER: Role;
|
|
9
|
+
static readonly DEFENSIVE_SPECIALIST: Role;
|
|
10
|
+
private static readonly ROLES;
|
|
11
|
+
private constructor();
|
|
12
|
+
static getRoles(): Role[];
|
|
13
|
+
static calculateScore(stats: PerformanceStats, role: Role): number;
|
|
14
|
+
static assignRoles(stats: PerformanceStats): Role[];
|
|
13
15
|
}
|
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
import roleWeights from '../../../data/role.formula.json';
|
|
2
|
-
export
|
|
3
|
-
(
|
|
4
|
-
|
|
5
|
-
Role["LIBERO"] = "Libero";
|
|
6
|
-
Role["OUTSIDE_HITTER"] = "Outside Hitter";
|
|
7
|
-
Role["OPPOSITE_HITTER"] = "Opposite Hitter";
|
|
8
|
-
Role["MIDDLE_BLOCKER"] = "Middle Blocker";
|
|
9
|
-
Role["DEFENSIVE_SPECIALIST"] = "Defensive Specialist";
|
|
10
|
-
})(Role || (Role = {}));
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
12
|
-
(function (Role) {
|
|
13
|
-
const ROLES = [Role.LIBERO, Role.SETTER, Role.OPPOSITE_HITTER, Role.OUTSIDE_HITTER, Role.MIDDLE_BLOCKER,
|
|
14
|
-
Role.DEFENSIVE_SPECIALIST];
|
|
15
|
-
function getRoles() {
|
|
16
|
-
return [...ROLES];
|
|
2
|
+
export class Role {
|
|
3
|
+
constructor(name) {
|
|
4
|
+
this.name = name;
|
|
17
5
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
static getRoles() {
|
|
7
|
+
return [...Role.ROLES];
|
|
8
|
+
}
|
|
9
|
+
static calculateScore(stats, role) {
|
|
10
|
+
const weights = roleWeights.find(r => r.role === role.name);
|
|
21
11
|
if (weights == null)
|
|
22
12
|
throw new Error('COULD_NOT_FIND_ROLE_WEIGHT');
|
|
23
13
|
const score = Object.entries(weights.weight)
|
|
24
14
|
.reduce((score, [key, value]) => score + (stats[key] * weights.weight[key]), 0);
|
|
25
15
|
return Math.round(score);
|
|
26
16
|
}
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
static assignRoles(stats) {
|
|
18
|
+
const scores = this.getRoles().map(role => ({
|
|
19
|
+
role,
|
|
20
|
+
score: this.calculateScore(stats, role)
|
|
21
|
+
})).sort((x, y) => y.score - x.score);
|
|
22
|
+
const out = [scores[0].role];
|
|
23
|
+
if (scores[1].score >= 60) {
|
|
24
|
+
out.push(scores[1].role);
|
|
25
|
+
}
|
|
26
|
+
if (scores[2].score >= 70) {
|
|
27
|
+
out.push(scores[2].role);
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
Role.SETTER = new Role('Setter');
|
|
33
|
+
Role.LIBERO = new Role('Libero');
|
|
34
|
+
Role.OUTSIDE_HITTER = new Role('Outside Hitter');
|
|
35
|
+
Role.OPPOSITE_HITTER = new Role('Opposite Hitter');
|
|
36
|
+
Role.MIDDLE_BLOCKER = new Role('Middle Blocker');
|
|
37
|
+
Role.DEFENSIVE_SPECIALIST = new Role('Defensive Specialist');
|
|
38
|
+
Role.ROLES = [Role.LIBERO, Role.SETTER, Role.OPPOSITE_HITTER, Role.OUTSIDE_HITTER, Role.MIDDLE_BLOCKER,
|
|
39
|
+
Role.DEFENSIVE_SPECIALIST];
|