enefel 1.0.85 → 1.0.89
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/index.js +18 -5
- package/meteo.js +1 -1
- package/package.json +1 -1
- package/stadium.js +8 -3
- package/state.js +19 -0
package/index.js
CHANGED
|
@@ -9,7 +9,11 @@ const {
|
|
|
9
9
|
hasStatusCanFaceup,
|
|
10
10
|
hasStatusCanStandup,
|
|
11
11
|
} = require("./status");
|
|
12
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
meteoAttackerStrengthBlitz,
|
|
14
|
+
meteoMaxPassDistance,
|
|
15
|
+
METEO,
|
|
16
|
+
} = require("./meteo");
|
|
13
17
|
const INITIAL_REROLL = 2;
|
|
14
18
|
const POSTULATION_HOURS = 24;
|
|
15
19
|
const INACTIVE_DAYS = 10;
|
|
@@ -846,10 +850,19 @@ const getMoralModifier = (player) => {
|
|
|
846
850
|
return race.cost / 10 + range;
|
|
847
851
|
};
|
|
848
852
|
|
|
849
|
-
const getAttackerStrength = (
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
+
const getAttackerStrength = (
|
|
854
|
+
player,
|
|
855
|
+
isBlitz = false,
|
|
856
|
+
meteoValue = METEO.PERFECT_CONDITION
|
|
857
|
+
) => {
|
|
858
|
+
try {
|
|
859
|
+
let bonus = isBlitz ? meteoAttackerStrengthBlitz(meteoValue) : 0;
|
|
860
|
+
const hasHorn = hasSkill(player, SKILL_NAMES.HORNS);
|
|
861
|
+
bonus += isBlitz && hasHorn ? 1 : 0;
|
|
862
|
+
return player.current_ST + bonus;
|
|
863
|
+
} catch (e) {
|
|
864
|
+
throw new Error(`Error in getAttackerStrength: ${e}`);
|
|
865
|
+
}
|
|
853
866
|
};
|
|
854
867
|
|
|
855
868
|
const getDefenderStrength = (player) => {
|
package/meteo.js
CHANGED
package/package.json
CHANGED
package/stadium.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
const { INITIAL_REROLL, p } = require(".");
|
|
2
2
|
const { d6 } = require("./random");
|
|
3
3
|
|
|
4
|
+
const MIN_SCRIMMAGE = 3; // TODO: in league param
|
|
5
|
+
const MAX_LATERAL = 2;
|
|
6
|
+
|
|
4
7
|
const TILES_STADIUM = {
|
|
5
8
|
a: {
|
|
6
9
|
price: 0,
|
|
@@ -253,21 +256,23 @@ function splitList(w, s) {
|
|
|
253
256
|
|
|
254
257
|
module.exports = {
|
|
255
258
|
addCenterZone,
|
|
259
|
+
getRerollCoachCost,
|
|
256
260
|
getStadiumCapacity,
|
|
257
261
|
getStadiumCapacityByGame,
|
|
258
262
|
getStadiumFan,
|
|
259
263
|
getStadiumReroll,
|
|
264
|
+
getStadiumRerollCoach,
|
|
260
265
|
insertLine,
|
|
261
266
|
insertTile,
|
|
267
|
+
MAX_LATERAL,
|
|
262
268
|
maxHeight,
|
|
263
269
|
maxWidth,
|
|
270
|
+
MIN_SCRIMMAGE,
|
|
264
271
|
minHeight,
|
|
265
272
|
minWidth,
|
|
266
273
|
priceSize,
|
|
267
274
|
removeLine,
|
|
268
275
|
removeTile,
|
|
269
|
-
TILES_STADIUM,
|
|
270
|
-
getStadiumRerollCoach,
|
|
271
276
|
STADIUM_REROLL_COACH_SUCCESS,
|
|
272
|
-
|
|
277
|
+
TILES_STADIUM,
|
|
273
278
|
};
|
package/state.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { MIN_SCRIMMAGE } = require("./stadium");
|
|
2
|
+
|
|
1
3
|
const TEAM_STATE = {
|
|
2
4
|
ACTIVE: 0,
|
|
3
5
|
EMPTY: 1,
|
|
@@ -48,6 +50,10 @@ function isTeamEmpty(state) {
|
|
|
48
50
|
return state === TEAM_STATE.EMPTY;
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
function isTeamLessMin(team) {
|
|
54
|
+
return team.players && team.players.length < MIN_SCRIMMAGE;
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
function isTeamBlocked(state) {
|
|
52
58
|
return state === TEAM_STATE.BLOCKED;
|
|
53
59
|
}
|
|
@@ -56,6 +62,17 @@ function isTeamActive(state) {
|
|
|
56
62
|
return state === TEAM_STATE.ACTIVE;
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
function canPlayLeague(team) {
|
|
66
|
+
if (
|
|
67
|
+
isTeamEmpty(team.state) ||
|
|
68
|
+
isTeamBlocked(team.state) ||
|
|
69
|
+
isTeamLessMin(team)
|
|
70
|
+
) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
|
|
59
76
|
function getPlayableStates() {
|
|
60
77
|
return [PLAYER_STATE.ACTIVE, PLAYER_STATE.INACTIVE];
|
|
61
78
|
}
|
|
@@ -71,6 +88,7 @@ function shouldBeRemovedFromTeam(state) {
|
|
|
71
88
|
module.exports = {
|
|
72
89
|
canBeSelectedByUser,
|
|
73
90
|
canJoinTeamWithState,
|
|
91
|
+
canPlayLeague,
|
|
74
92
|
canTeamPlayLeague,
|
|
75
93
|
getPlayableStates,
|
|
76
94
|
isActive,
|
|
@@ -82,6 +100,7 @@ module.exports = {
|
|
|
82
100
|
isTeamActive,
|
|
83
101
|
isTeamBlocked,
|
|
84
102
|
isTeamEmpty,
|
|
103
|
+
isTeamLessMin,
|
|
85
104
|
PLAYER_STATE,
|
|
86
105
|
shouldBeRemovedFromTeam,
|
|
87
106
|
TEAM_STATE,
|