enefel 1.0.102 → 1.0.105
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/badge.js +2 -2
- package/index.js +22 -32
- package/league.js +0 -9
- package/meteo.js +60 -4
- package/package-lock.json +9738 -0
- package/package.json +1 -1
- package/player.js +23 -0
- package/race.js +300 -65
- package/skill.js +20 -4
- package/stadium.js +1 -1
- package/.yarnrc +0 -1
- package/yarn-error.log +0 -46
package/badge.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { ranges } = require("./improvement");
|
|
2
|
-
const
|
|
2
|
+
const { getCareers } = require("./race");
|
|
3
3
|
|
|
4
4
|
const BADGE_NAMES = {
|
|
5
5
|
KILL: "kill",
|
|
@@ -10,7 +10,7 @@ const badges = {};
|
|
|
10
10
|
// "human-career": ranges,
|
|
11
11
|
// "orc-career": ranges,
|
|
12
12
|
// ...
|
|
13
|
-
Object.values(
|
|
13
|
+
Object.values(getCareers()).forEach((r) => {
|
|
14
14
|
if (!badges[r.badge]) {
|
|
15
15
|
badges[r.badge] = ranges;
|
|
16
16
|
}
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const {
|
|
|
4
4
|
getDisturbingPresenceMalus,
|
|
5
5
|
} = require("./skill");
|
|
6
6
|
const { ranges } = require("./improvement");
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
const {
|
|
9
9
|
hasStatusStanding,
|
|
10
10
|
hasStatusTacleZone,
|
|
@@ -19,7 +19,9 @@ const {
|
|
|
19
19
|
METEO,
|
|
20
20
|
} = require("./meteo");
|
|
21
21
|
const { distance } = require("./calcul");
|
|
22
|
-
const
|
|
22
|
+
const { getCareerFromPlayer } = require("./race");
|
|
23
|
+
const { getMaxMA } = require("./player");
|
|
24
|
+
|
|
23
25
|
const POSTULATION_HOURS = 24;
|
|
24
26
|
const INACTIVE_DAYS = 10;
|
|
25
27
|
const MAX_PLAYER_USER = 2;
|
|
@@ -158,6 +160,8 @@ const GAME_HISTORY_INFO = {
|
|
|
158
160
|
PASS: "p",
|
|
159
161
|
REJECTION: "r",
|
|
160
162
|
REROLL_COACH: "rc",
|
|
163
|
+
REROLL_RACE_MALUS: "rrm",
|
|
164
|
+
REROLL_METEO: "rm",
|
|
161
165
|
REROLL: "re",
|
|
162
166
|
SCATTER: "sc",
|
|
163
167
|
SKILL: "sk",
|
|
@@ -222,21 +226,6 @@ const TAKE_BALL_TYPE = {
|
|
|
222
226
|
CATCH_BOUNCE: "bounce",
|
|
223
227
|
};
|
|
224
228
|
|
|
225
|
-
const getCareers = () => {
|
|
226
|
-
const carrers = {};
|
|
227
|
-
for (const [name, values] of Object.entries(races)) {
|
|
228
|
-
const badge = values.badge;
|
|
229
|
-
if (!carrers[badge]) {
|
|
230
|
-
carrers[badge] = [];
|
|
231
|
-
}
|
|
232
|
-
if (!carrers[badge][values.range]) {
|
|
233
|
-
carrers[badge][values.range] = {};
|
|
234
|
-
}
|
|
235
|
-
carrers[badge][values.range][name] = values;
|
|
236
|
-
}
|
|
237
|
-
return carrers;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
229
|
const p = (x, y) => {
|
|
241
230
|
return { x: +x, y: +y };
|
|
242
231
|
};
|
|
@@ -245,10 +234,6 @@ function shuffleArray(array) {
|
|
|
245
234
|
return [...array].sort(() => 0.5 - Math.random());
|
|
246
235
|
}
|
|
247
236
|
|
|
248
|
-
function getMaxGfi(player) {
|
|
249
|
-
return hasSkill(player, SKILL_NAMES.SPRINT) ? 3 : 2;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
237
|
function addSeconds(date, days) {
|
|
253
238
|
const result = new Date(date);
|
|
254
239
|
result.setSeconds(result.getSeconds() + days);
|
|
@@ -709,7 +694,7 @@ function getEnemyTackleZones(location, teamId, players) {
|
|
|
709
694
|
});
|
|
710
695
|
}
|
|
711
696
|
|
|
712
|
-
function canBlock(attacker, defender, attackerTeam) {
|
|
697
|
+
function canBlock(attacker, defender, attackerTeam, game) {
|
|
713
698
|
if (
|
|
714
699
|
!attacker ||
|
|
715
700
|
!defender ||
|
|
@@ -733,7 +718,7 @@ function canBlock(attacker, defender, attackerTeam) {
|
|
|
733
718
|
|
|
734
719
|
// No blitz available
|
|
735
720
|
if (attackerTeam.date_next_blitz !== null) {
|
|
736
|
-
return attacker.current_MA === attacker
|
|
721
|
+
return attacker.current_MA === getMaxMA(attacker, game);
|
|
737
722
|
} else {
|
|
738
723
|
// Blitz available
|
|
739
724
|
|
|
@@ -768,10 +753,10 @@ function canPass(player, playerTeam, playerIdWithBall) {
|
|
|
768
753
|
);
|
|
769
754
|
}
|
|
770
755
|
|
|
771
|
-
function canEndTurn(player) {
|
|
756
|
+
function canEndTurn(player, game) {
|
|
772
757
|
return (
|
|
773
758
|
player.date_next_action === null &&
|
|
774
|
-
(player.has_action === false || player.current_MA < player
|
|
759
|
+
(player.has_action === false || player.current_MA < getMaxMA(player, game))
|
|
775
760
|
);
|
|
776
761
|
}
|
|
777
762
|
|
|
@@ -851,12 +836,12 @@ const isCoach = (player, team = null) => {
|
|
|
851
836
|
};
|
|
852
837
|
|
|
853
838
|
const getMoralModifier = (player) => {
|
|
854
|
-
const
|
|
839
|
+
const career = getCareerFromPlayer(player);
|
|
855
840
|
let range = ranges.findIndex((range) => player.experience < range);
|
|
856
841
|
if (range === -1) {
|
|
857
842
|
range = ranges.length;
|
|
858
843
|
}
|
|
859
|
-
return
|
|
844
|
+
return career.cost / 10 + range;
|
|
860
845
|
};
|
|
861
846
|
|
|
862
847
|
const getAttackerStrength = (
|
|
@@ -898,7 +883,17 @@ const swapArrayLocs = (arr, index1, index2) => {
|
|
|
898
883
|
return arr;
|
|
899
884
|
};
|
|
900
885
|
|
|
886
|
+
const getInactiveDays = (isDev = false) => {
|
|
887
|
+
return isDev ? 10000 : INACTIVE_DAYS;
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
const getMaxPlayers = (isDev = false) => {
|
|
891
|
+
return isDev ? 10000 : MAX_PLAYER_USER;
|
|
892
|
+
};
|
|
893
|
+
|
|
901
894
|
module.exports = {
|
|
895
|
+
getInactiveDays,
|
|
896
|
+
getMaxPlayers,
|
|
902
897
|
addSeconds,
|
|
903
898
|
availableSquaresToPushBack,
|
|
904
899
|
canBlock,
|
|
@@ -919,18 +914,14 @@ module.exports = {
|
|
|
919
914
|
getAttackerStrength,
|
|
920
915
|
getBestInterceptor,
|
|
921
916
|
getBlockAssistance,
|
|
922
|
-
getCareers,
|
|
923
917
|
getDefenderStrength,
|
|
924
918
|
getDicesBlock,
|
|
925
919
|
getEnemyTackleZones,
|
|
926
|
-
getMaxGfi,
|
|
927
920
|
getMoralModifier,
|
|
928
921
|
getPlayerOnCell,
|
|
929
922
|
getTeamColor,
|
|
930
923
|
getThrowingBonus,
|
|
931
924
|
haveSameTeam,
|
|
932
|
-
INACTIVE_DAYS,
|
|
933
|
-
INITIAL_REROLL,
|
|
934
925
|
isAdjacent,
|
|
935
926
|
isCoach,
|
|
936
927
|
isGameRunning,
|
|
@@ -941,7 +932,6 @@ module.exports = {
|
|
|
941
932
|
isSquareValidToPushBack,
|
|
942
933
|
LAST_SEASON_ALPHA,
|
|
943
934
|
MAX_PLAYER_TEAM,
|
|
944
|
-
MAX_PLAYER_USER,
|
|
945
935
|
swapArrayLocs,
|
|
946
936
|
p,
|
|
947
937
|
PLAYER_HISTORY_INFO,
|
package/league.js
CHANGED
|
@@ -238,16 +238,7 @@ function sortLeagues(a, b) {
|
|
|
238
238
|
return 0;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
function getWinner(game) {
|
|
242
|
-
// TODO
|
|
243
|
-
if (game.score1 > game.score2) {
|
|
244
|
-
return game.team1_id;
|
|
245
|
-
} else {
|
|
246
|
-
return game.team2_id;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
241
|
module.exports = {
|
|
250
|
-
getWinner,
|
|
251
242
|
calculateTeamsStandingForNextSeason,
|
|
252
243
|
hasCalendar,
|
|
253
244
|
playoffNextSeason,
|
package/meteo.js
CHANGED
|
@@ -8,22 +8,40 @@ const METEO = {
|
|
|
8
8
|
PERFECT_CONDITION: 7,
|
|
9
9
|
HEAVY_SNOW: 8,
|
|
10
10
|
BLIZZARD: 9,
|
|
11
|
+
MORNING_DEW: 10,
|
|
12
|
+
BLOSSOMING_FLOWERS: 11,
|
|
13
|
+
MISTY_MORNING: 12,
|
|
14
|
+
HIGH_WINDS: 13,
|
|
11
15
|
};
|
|
12
16
|
|
|
13
17
|
const SEASON = {
|
|
14
|
-
|
|
18
|
+
WINTER: 1,
|
|
15
19
|
SPRING: 2,
|
|
16
20
|
SUMMER: 3,
|
|
17
|
-
|
|
21
|
+
AUTUMN: 4,
|
|
18
22
|
};
|
|
19
23
|
|
|
20
24
|
const getSeason = () => {
|
|
21
|
-
return SEASON.
|
|
25
|
+
return SEASON.SPRING;
|
|
22
26
|
// return SEASON.AUTUMN;
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
const getMeteo = (value) => {
|
|
26
30
|
const season = getSeason();
|
|
31
|
+
if (season === SEASON.SPRING) {
|
|
32
|
+
switch (value) {
|
|
33
|
+
case 2:
|
|
34
|
+
return METEO.MORNING_DEW;
|
|
35
|
+
case 3:
|
|
36
|
+
return METEO.BLOSSOMING_FLOWERS;
|
|
37
|
+
case 11:
|
|
38
|
+
return METEO.MISTY_MORNING;
|
|
39
|
+
case 12:
|
|
40
|
+
return METEO.HIGH_WINDS;
|
|
41
|
+
default:
|
|
42
|
+
return METEO.PERFECT_CONDITION;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
27
45
|
if (season === SEASON.WINTER) {
|
|
28
46
|
switch (value) {
|
|
29
47
|
case 2:
|
|
@@ -85,6 +103,17 @@ const meteoKO = (meteoValue) => {
|
|
|
85
103
|
return modif;
|
|
86
104
|
};
|
|
87
105
|
|
|
106
|
+
// only pickup ball interaction
|
|
107
|
+
const meteoPickUpBall = (meteoValue) => {
|
|
108
|
+
let modif = 0;
|
|
109
|
+
|
|
110
|
+
if (meteoValue === METEO.MORNING_DEW) {
|
|
111
|
+
modif = -1;
|
|
112
|
+
}
|
|
113
|
+
return modif;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// All ball interaction
|
|
88
117
|
const meteoTakeBall = (meteoValue) => {
|
|
89
118
|
let modif = 0;
|
|
90
119
|
if (meteoValue === METEO.POURING_RAIN) {
|
|
@@ -117,28 +146,55 @@ const meteoGfi = (meteoValue) => {
|
|
|
117
146
|
if (meteoValue === METEO.BLIZZARD) {
|
|
118
147
|
modif = -1;
|
|
119
148
|
}
|
|
149
|
+
if (meteoValue === METEO.MORNING_DEW) {
|
|
150
|
+
modif = -1;
|
|
151
|
+
}
|
|
120
152
|
return modif;
|
|
121
153
|
};
|
|
122
154
|
|
|
123
155
|
const meteoMaxPassDistance = (meteoValue) => {
|
|
124
156
|
// 3.5, 7, 10.2, 13.1
|
|
125
157
|
let max = 14;
|
|
126
|
-
if (meteoValue === METEO.BLIZZARD) {
|
|
158
|
+
if (meteoValue === METEO.BLIZZARD || meteoValue === METEO.MISTY_MORNING) {
|
|
127
159
|
max = 7;
|
|
128
160
|
}
|
|
129
161
|
return max;
|
|
130
162
|
};
|
|
131
163
|
|
|
164
|
+
const meteoHasExpulsion = (meteoValue) => {
|
|
165
|
+
if (meteoValue === METEO.BLOSSOMING_FLOWERS) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const meteoMaxMA = (meteoValue) => {
|
|
172
|
+
if (meteoValue === METEO.MISTY_MORNING) {
|
|
173
|
+
return 6;
|
|
174
|
+
}
|
|
175
|
+
return Infinity;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const meteoRerollRoll = (meteoValue) => {
|
|
179
|
+
if (meteoValue === METEO.HIGH_WINDS) {
|
|
180
|
+
return 2;
|
|
181
|
+
}
|
|
182
|
+
return 1;
|
|
183
|
+
};
|
|
132
184
|
const tools = {
|
|
133
185
|
getMeteo,
|
|
134
186
|
METEO,
|
|
135
187
|
meteoAttackerStrengthBlitz,
|
|
136
188
|
meteoGfi,
|
|
189
|
+
meteoHasExpulsion,
|
|
137
190
|
meteoKO,
|
|
191
|
+
meteoMaxMA,
|
|
138
192
|
meteoMaxPassDistance,
|
|
139
193
|
meteoPassBonus,
|
|
140
194
|
meteoPassRebound,
|
|
195
|
+
meteoPickUpBall,
|
|
141
196
|
meteoPlayerFall,
|
|
197
|
+
meteoRerollRoll,
|
|
142
198
|
meteoTakeBall,
|
|
143
199
|
};
|
|
144
200
|
module.exports = tools;
|