enefel 1.0.155 → 1.0.156
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/block.js +9 -0
- package/card.js +24 -0
- package/index.js +2 -3
- package/package.json +1 -1
- package/player.js +13 -1
- package/skill.js +10 -1
- package/state.js +1 -0
package/block.js
CHANGED
|
@@ -65,6 +65,15 @@ const getOrderDice = (attacker, defender) => {
|
|
|
65
65
|
|
|
66
66
|
const getOrderDiceAgainst = (attacker, defender) => {
|
|
67
67
|
if (hasSkill(defender, SKILL_NAMES.BLOCK)) {
|
|
68
|
+
if (hasSkill(defender, SKILL_NAMES.WRESTLE)) {
|
|
69
|
+
return [
|
|
70
|
+
{ value: 1, isReroll: true },
|
|
71
|
+
{ value: 3, isReroll: false },
|
|
72
|
+
{ value: 2, isReroll: !hasSkill(attacker, SKILL_NAMES.BLOCK) },
|
|
73
|
+
{ value: 4, isReroll: false },
|
|
74
|
+
{ value: 5, isReroll: false },
|
|
75
|
+
];
|
|
76
|
+
}
|
|
68
77
|
return [
|
|
69
78
|
{ value: 1, isReroll: true },
|
|
70
79
|
{ value: 2, isReroll: !hasSkill(attacker, SKILL_NAMES.BLOCK) },
|
package/card.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const CARD_TYPE = {
|
|
2
|
+
PLAYER: "player",
|
|
3
|
+
TEAM: "team",
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const CARD_RARITY = {
|
|
7
|
+
COMMUN: "c",
|
|
8
|
+
UNCOMMUN: "u",
|
|
9
|
+
RARE: "r",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const CARD_DISPLAY = {
|
|
13
|
+
N1: "1",
|
|
14
|
+
N2: "2",
|
|
15
|
+
N3: "3",
|
|
16
|
+
N4: "4",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const card = {
|
|
20
|
+
CARD_TYPE,
|
|
21
|
+
CARD_RARITY,
|
|
22
|
+
CARD_DISPLAY,
|
|
23
|
+
};
|
|
24
|
+
module.exports = card;
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const {
|
|
|
20
20
|
} = require("./meteo");
|
|
21
21
|
const { distance } = require("./calcul");
|
|
22
22
|
const { getCareerFromPlayer } = require("./race");
|
|
23
|
-
const { getMaxCarac, PLAYER_CARAC } = require("./player");
|
|
23
|
+
const { getMaxCarac, PLAYER_CARAC, hasMove } = require("./player");
|
|
24
24
|
const { GAME_STATUS } = require("./game");
|
|
25
25
|
|
|
26
26
|
const POSTULATION_HOURS = 24;
|
|
@@ -758,8 +758,7 @@ function canPass(player, playerTeam, playerIdWithBall) {
|
|
|
758
758
|
function canEndTurn(player, game) {
|
|
759
759
|
return (
|
|
760
760
|
player.date_next_action === null &&
|
|
761
|
-
(player.has_action === false ||
|
|
762
|
-
player.current_MA < getMaxCarac(player, PLAYER_CARAC.MA, game))
|
|
761
|
+
(player.has_action === false || hasMove(player, game))
|
|
763
762
|
);
|
|
764
763
|
}
|
|
765
764
|
|
package/package.json
CHANGED
package/player.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { getAgingMinExperience } = require("./improvement");
|
|
2
2
|
const { meteoMaxMA } = require("./meteo");
|
|
3
3
|
const { getCareerFromPlayer } = require("./race");
|
|
4
|
-
const { hasSkill, SKILL_NAMES } = require("./skill");
|
|
4
|
+
const { hasSkill, SKILL_NAMES, hasUsedSkill } = require("./skill");
|
|
5
5
|
|
|
6
6
|
const PLAYER_CARAC = {
|
|
7
7
|
AG: "AG",
|
|
@@ -10,6 +10,17 @@ const PLAYER_CARAC = {
|
|
|
10
10
|
ST: "ST",
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
function hasMove(player, game) {
|
|
14
|
+
if (
|
|
15
|
+
player.current_MA >= getMaxCarac(player, PLAYER_CARAC.MA, game) &&
|
|
16
|
+
player.current_gfi >= getMaxGfi(player) &&
|
|
17
|
+
!hasUsedSkill(player, SKILL_NAMES.JUMP_UP)
|
|
18
|
+
) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
function arePlayingSameGame(p1, p2) {
|
|
14
25
|
return p1.gameId == p2.gameId;
|
|
15
26
|
}
|
|
@@ -210,4 +221,5 @@ module.exports = {
|
|
|
210
221
|
isTeamPlaying,
|
|
211
222
|
areFromSameTeam,
|
|
212
223
|
hasTeam,
|
|
224
|
+
hasMove,
|
|
213
225
|
};
|
package/skill.js
CHANGED
|
@@ -214,7 +214,15 @@ function getSkill(player, skillId, info = null) {
|
|
|
214
214
|
const skill = playerSkills.find(
|
|
215
215
|
(s) => s.skill_id === skillId && (info ? s.info === info : true)
|
|
216
216
|
);
|
|
217
|
-
return skill;
|
|
217
|
+
return !!skill ? skill : false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function hasUsedSkill(player, skill) {
|
|
221
|
+
const hasSkill = getSkill(player, skill);
|
|
222
|
+
if (hasSkill === false) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
return hasSkill.date_next !== null ? true : false;
|
|
218
226
|
}
|
|
219
227
|
|
|
220
228
|
function hasSkill(
|
|
@@ -415,4 +423,5 @@ module.exports = {
|
|
|
415
423
|
useSkill,
|
|
416
424
|
isNoTurnoverSkill,
|
|
417
425
|
getNoTurnoverSkill,
|
|
426
|
+
hasUsedSkill,
|
|
418
427
|
};
|