enefel 1.0.123 → 1.0.126
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/game.js +3 -3
- package/improvement.js +6 -6
- package/index.js +12 -5
- package/inducement.js +41 -0
- package/league.js +1 -1
- package/package.json +1 -1
- package/player.js +52 -1
- package/random.js +6 -0
- package/skill.js +2 -2
- package/state.js +3 -0
- package/status.js +10 -2
package/game.js
CHANGED
|
@@ -21,9 +21,9 @@ const hasGameCasualty = (game) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const getGameFanBonus = (game) => {
|
|
24
|
-
if (game.type === GAME_TYPE.FRIENDLY) {
|
|
25
|
-
|
|
26
|
-
}
|
|
24
|
+
// if (game.type === GAME_TYPE.FRIENDLY) {
|
|
25
|
+
// return -5;
|
|
26
|
+
// }
|
|
27
27
|
if (game.type === GAME_TYPE.PLAYOFF) {
|
|
28
28
|
return 5;
|
|
29
29
|
}
|
package/improvement.js
CHANGED
|
@@ -12,12 +12,12 @@ const SPP_TYPE = {
|
|
|
12
12
|
|
|
13
13
|
const SPP = {
|
|
14
14
|
[GAME_TYPE.FRIENDLY]: {
|
|
15
|
-
EXP_BONUS:
|
|
16
|
-
EXP_INT:
|
|
17
|
-
EXP_KO:
|
|
18
|
-
EXP_REU:
|
|
19
|
-
EXP_SOR:
|
|
20
|
-
EXP_TD:
|
|
15
|
+
EXP_BONUS: 1,
|
|
16
|
+
EXP_INT: 2,
|
|
17
|
+
EXP_KO: 1,
|
|
18
|
+
EXP_REU: 1,
|
|
19
|
+
EXP_SOR: 2,
|
|
20
|
+
EXP_TD: 3,
|
|
21
21
|
},
|
|
22
22
|
[GAME_TYPE.DIVISION]: {
|
|
23
23
|
EXP_BONUS: 1,
|
package/index.js
CHANGED
|
@@ -148,7 +148,9 @@ const GAME_HISTORY_INFO = {
|
|
|
148
148
|
END_TURN: "et",
|
|
149
149
|
FOUL: "f",
|
|
150
150
|
GO_FOR_IT: "gfi",
|
|
151
|
+
HANDICAP: "handi",
|
|
151
152
|
HANDING_OFF: "ho",
|
|
153
|
+
INDUCEMENT_HALFLING_MASTER_CHEF: "ihmc",
|
|
152
154
|
INJURY: "in",
|
|
153
155
|
INTERCEPTION: "i",
|
|
154
156
|
JUMP_UP: "ju",
|
|
@@ -178,6 +180,7 @@ const GAME_HISTORY_INFO = {
|
|
|
178
180
|
};
|
|
179
181
|
|
|
180
182
|
const PLAYER_HISTORY_TYPE = {
|
|
183
|
+
AGING: "ag",
|
|
181
184
|
COACH_SKILL: "cs",
|
|
182
185
|
CREATE_TEAM: "ct",
|
|
183
186
|
CREATED: "c",
|
|
@@ -216,10 +219,6 @@ const p = (x, y) => {
|
|
|
216
219
|
return { x: +x, y: +y };
|
|
217
220
|
};
|
|
218
221
|
|
|
219
|
-
function shuffleArray(array) {
|
|
220
|
-
return [...array].sort(() => 0.5 - Math.random());
|
|
221
|
-
}
|
|
222
|
-
|
|
223
222
|
function addSeconds(date, days) {
|
|
224
223
|
const result = new Date(date);
|
|
225
224
|
result.setSeconds(result.getSeconds() + days);
|
|
@@ -841,6 +840,14 @@ const getMoralModifier = (player) => {
|
|
|
841
840
|
return career.cost / 10 + range;
|
|
842
841
|
};
|
|
843
842
|
|
|
843
|
+
const getTeamXP = (team) => {
|
|
844
|
+
let xp = 0;
|
|
845
|
+
for (const player of team.players) {
|
|
846
|
+
xp += player.experience;
|
|
847
|
+
}
|
|
848
|
+
return xp;
|
|
849
|
+
};
|
|
850
|
+
|
|
844
851
|
const getTeamMoral = (team) => {
|
|
845
852
|
let moral = 0;
|
|
846
853
|
for (const player of team.players) {
|
|
@@ -945,9 +952,9 @@ module.exports = {
|
|
|
945
952
|
PLAYER_HISTORY_TYPE,
|
|
946
953
|
PLAYER_STAT,
|
|
947
954
|
POSTULATION_HOURS,
|
|
948
|
-
shuffleArray,
|
|
949
955
|
arrayMove,
|
|
950
956
|
TAKE_BALL_TYPE,
|
|
951
957
|
getTeamMoralByPlayer,
|
|
952
958
|
getTeamMoral,
|
|
959
|
+
getTeamXP,
|
|
953
960
|
};
|
package/inducement.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { shuffleArray } = require("./random");
|
|
2
|
+
|
|
3
|
+
const MAX_INDUCEMENT = 5;
|
|
4
|
+
const INDUCEMENT = {
|
|
5
|
+
// APOTHECARY: { key: "apo" },
|
|
6
|
+
HALFLING_MASTER_CHEF: { key: "hmc" },
|
|
7
|
+
SPY: { key: "spy" },
|
|
8
|
+
XXX: { key: "xxx" },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const getInducements = (team, inducementList) => {
|
|
12
|
+
let random = Object.values(INDUCEMENT).filter((value) => {
|
|
13
|
+
return !inducementList.includes(value.key);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
if (random.length === 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
random = shuffleArray(random);
|
|
21
|
+
return random[0].key;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const getGameInducements = (game) => {
|
|
25
|
+
if (!game) {
|
|
26
|
+
return [null, []];
|
|
27
|
+
}
|
|
28
|
+
const [teamId, inducements] = game.inducements.split(";");
|
|
29
|
+
let inducementList = [];
|
|
30
|
+
if (inducements) {
|
|
31
|
+
inducementList = inducements.split("-");
|
|
32
|
+
}
|
|
33
|
+
return [teamId, inducementList];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = {
|
|
37
|
+
getGameInducements,
|
|
38
|
+
getInducements,
|
|
39
|
+
INDUCEMENT,
|
|
40
|
+
MAX_INDUCEMENT,
|
|
41
|
+
};
|
package/league.js
CHANGED
|
@@ -2,7 +2,7 @@ const { GAME_TYPE } = require("./game");
|
|
|
2
2
|
const { canPlayLeague } = require("./state");
|
|
3
3
|
|
|
4
4
|
const MIN_OPEN_SIZE = 4;
|
|
5
|
-
const GROUP_SIZE =
|
|
5
|
+
const GROUP_SIZE = 6;
|
|
6
6
|
const HAS_NEXT_SEASON_PLAYOFF = false;
|
|
7
7
|
const CAN_CHOOSE_TO_PARTICIPATE = false;
|
|
8
8
|
const HOME_AND_AWAY = false;
|
package/package.json
CHANGED
package/player.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
const { meteoMaxMA } = require("./meteo");
|
|
2
2
|
const { hasSkill, SKILL_NAMES } = require("./skill");
|
|
3
3
|
|
|
4
|
+
const PLAYER_CARAC = {
|
|
5
|
+
AG: "AG",
|
|
6
|
+
AV: "AV",
|
|
7
|
+
MA: "MA",
|
|
8
|
+
ST: "ST",
|
|
9
|
+
};
|
|
10
|
+
|
|
4
11
|
function getMaxMA(player, game) {
|
|
5
12
|
if (!player) {
|
|
6
13
|
return null;
|
|
@@ -20,4 +27,48 @@ function getMaxGfi(player) {
|
|
|
20
27
|
return hasSkill(player, SKILL_NAMES.SPRINT) ? 3 : 2;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
const AGING_SIZE_RANGE = 5;
|
|
31
|
+
|
|
32
|
+
function gamesforAgingRoll(totalGames) {
|
|
33
|
+
if (totalGames <= 0) {
|
|
34
|
+
return AGING_SIZE_RANGE;
|
|
35
|
+
}
|
|
36
|
+
if (totalGames % AGING_SIZE_RANGE === 0) {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return AGING_SIZE_RANGE - (totalGames % AGING_SIZE_RANGE);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function getAgingBonus(totalGames) {
|
|
44
|
+
const initialBonus = 5;
|
|
45
|
+
const minBonus = -3;
|
|
46
|
+
|
|
47
|
+
if (gamesforAgingRoll(totalGames) !== 0) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const range = totalGames / AGING_SIZE_RANGE;
|
|
52
|
+
// 5 = 1 = 4
|
|
53
|
+
// 10 = 2 = 3
|
|
54
|
+
// 15 = 3 = 2
|
|
55
|
+
// 20 = 4 = 1
|
|
56
|
+
// 25 = 5 = 0
|
|
57
|
+
// 30 = 6 = -1
|
|
58
|
+
// 35 = 7 = -2
|
|
59
|
+
// 40 = 8 = -3
|
|
60
|
+
let bonus = initialBonus - range;
|
|
61
|
+
if (bonus < minBonus) {
|
|
62
|
+
bonus = minBonus;
|
|
63
|
+
}
|
|
64
|
+
return bonus;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
module.exports = {
|
|
68
|
+
AGING_SIZE_RANGE,
|
|
69
|
+
gamesforAgingRoll,
|
|
70
|
+
getAgingBonus,
|
|
71
|
+
getMaxGfi,
|
|
72
|
+
getMaxMA,
|
|
73
|
+
PLAYER_CARAC,
|
|
74
|
+
};
|
package/random.js
CHANGED
|
@@ -6,6 +6,10 @@ const rollDice = (quantity, max) => {
|
|
|
6
6
|
return total;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
function shuffleArray(array) {
|
|
10
|
+
return [...array].sort(() => 0.5 - Math.random());
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
const tools = {
|
|
10
14
|
getRandomNumber: (min, max, r = Math.random) => {
|
|
11
15
|
return Math.floor(r() * (max - min + 1)) + min;
|
|
@@ -22,5 +26,7 @@ const tools = {
|
|
|
22
26
|
d3: (quantity = 1, max = 3) => {
|
|
23
27
|
return rollDice(quantity, max);
|
|
24
28
|
},
|
|
29
|
+
|
|
30
|
+
shuffleArray,
|
|
25
31
|
};
|
|
26
32
|
module.exports = tools;
|
package/skill.js
CHANGED
package/state.js
CHANGED
package/status.js
CHANGED
|
@@ -29,6 +29,13 @@ const hasStatusStanding = (player) => {
|
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
const hasStatusInjury = (player) => {
|
|
33
|
+
return (
|
|
34
|
+
player.status === PLAYER_STATUS.KO ||
|
|
35
|
+
player.status === PLAYER_STATUS.CASUALTY
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
32
39
|
const hasStatusFall = (player) => {
|
|
33
40
|
return (
|
|
34
41
|
player.status === PLAYER_STATUS.KNOCKED_DOWN ||
|
|
@@ -50,9 +57,10 @@ module.exports = {
|
|
|
50
57
|
PLAYER_STATUS,
|
|
51
58
|
hasStatusCanFaceup,
|
|
52
59
|
hasStatusCanStandup,
|
|
53
|
-
|
|
60
|
+
hasStatusCantPlay,
|
|
54
61
|
hasStatusFall,
|
|
62
|
+
hasStatusInjury,
|
|
55
63
|
hasStatusOnField,
|
|
64
|
+
hasStatusStanding,
|
|
56
65
|
hasStatusTacleZone,
|
|
57
|
-
hasStatusCantPlay,
|
|
58
66
|
};
|