enefel 1.0.190 → 1.0.192

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/improvement.js CHANGED
@@ -61,9 +61,18 @@ const getSPP = (game, type) => {
61
61
  return SPP[game.type][`EXP_${type}`];
62
62
  };
63
63
 
64
- const getNextRange = (currentRange) => {
64
+ const getCurrentRange = (currentExp) => {
65
65
  for (let i = 0; i < ranges.length; i++) {
66
- if (currentRange < ranges[i]) {
66
+ if (currentExp < ranges[i]) {
67
+ return i + 1;
68
+ }
69
+ }
70
+ return ranges.length + 1;
71
+ };
72
+
73
+ const getNextRange = (currentExp) => {
74
+ for (let i = 0; i < ranges.length; i++) {
75
+ if (currentExp < ranges[i]) {
67
76
  return ranges[i];
68
77
  }
69
78
  }
@@ -102,4 +111,5 @@ module.exports = {
102
111
  getSPP,
103
112
  ranges,
104
113
  SPP_TYPE,
114
+ getCurrentRange,
105
115
  };
package/index.js CHANGED
@@ -226,10 +226,10 @@ const PLAYER_HISTORY_INFO = {
226
226
  };
227
227
 
228
228
  const TAKE_BALL_TYPE = {
229
- CATCH_PASS: "pass",
230
- CATCH_HANDOFF: "hand-off",
231
- PICKUP: "pick-up",
232
- CATCH_BOUNCE: "bounce",
229
+ CATCH_PASS: "pass", // Reception passe
230
+ CATCH_HANDOFF: "hand-off", // Reception d'une Transmission
231
+ PICKUP: "pick-up", // Ramasse la balle au sol
232
+ CATCH_BOUNCE: "bounce", // Reception d'un rebond
233
233
  };
234
234
 
235
235
  const p = (x, y) => {
package/move.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const { getEnemyTackleZones } = require("./position");
2
+ const { shuffleArray } = require("./random");
2
3
  const { hasSkill, SKILL_NAMES } = require("./skill");
3
4
 
4
5
  function bonusDodge(player, adjEnemies, adjDestinationEnemies) {
@@ -12,6 +13,7 @@ function bonusDodge(player, adjEnemies, adjDestinationEnemies) {
12
13
  if (adjEnemies.find((p) => hasSkill(p, SKILL_NAMES.PREHENSILE_TAIL))) {
13
14
  bonus -= 1;
14
15
  }
16
+
15
17
  // STUNTY should not be valid if it has a special weapon
16
18
  if (!hasSkill(player, SKILL_NAMES.STUNTY)) {
17
19
  bonus -= adjDestinationEnemies.filter(
@@ -22,18 +24,26 @@ function bonusDodge(player, adjEnemies, adjDestinationEnemies) {
22
24
  return bonus;
23
25
  }
24
26
 
25
- function malusJumpingLocation(destination, playerTeamId, players) {
27
+ function malusJumpingLocation(
28
+ destination,
29
+ playerTeamId,
30
+ players,
31
+ isCurrentLocation = false
32
+ ) {
26
33
  const enemies = getEnemyTackleZones(destination, playerTeamId, players);
27
34
  let malus = 0;
28
35
  malus += enemies.length;
29
- if (enemies.find((p) => hasSkill(p, SKILL_NAMES.PREHENSILE_TAIL))) {
30
- malus += 1;
36
+ if (isCurrentLocation) {
37
+ // Prehensile Tail : When an active opposition player attempts to Dodge, Jump or Leap in order to vacate a square in which they are being Marked by this player
38
+ if (enemies.find((p) => hasSkill(p, SKILL_NAMES.PREHENSILE_TAIL))) {
39
+ malus += 1;
40
+ }
31
41
  }
32
42
  return malus;
33
43
  }
34
44
 
35
45
  function modifJumping(player, destination, playerTeamId, players) {
36
- let malusCurrent = malusJumpingLocation(player, playerTeamId, players);
46
+ let malusCurrent = malusJumpingLocation(player, playerTeamId, players, true);
37
47
  let malusDestination = malusJumpingLocation(
38
48
  destination,
39
49
  playerTeamId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enefel",
3
- "version": "1.0.190",
3
+ "version": "1.0.192",
4
4
  "main": "index.js",
5
5
  "author": "Manest",
6
6
  "license": "MIT",
package/skill.js CHANGED
@@ -44,6 +44,7 @@ const SKILL_NAMES = {
44
44
  DEFENSIVE: "defensive",
45
45
  DIRTY_PLAYER: "dirty-player",
46
46
  DISTURBING_PRESENCE: "distrubing-presence",
47
+ DIVING_TACKLE: "diving-tackle",
47
48
  DODGE: "dodge",
48
49
  DRUNKARD: "drunkard",
49
50
  DUMP_OFF: "dump-off",
@@ -98,6 +99,7 @@ const SKILL_NAMES = {
98
99
  UNCHANNELLED_FURY: "unchannelled-fury",
99
100
  VERY_LONG_LEGS: "very-long-legs",
100
101
  WRESTLE: "wrestle",
102
+ DIVING_CATCH: "diving-catch",
101
103
  };
102
104
 
103
105
  const SKILL_TYPE = {
@@ -132,6 +134,7 @@ const SKILLS = {
132
134
  [SKILL_NAMES.DEFENSIVE]: SKILL_TYPE.AGILITY,
133
135
  [SKILL_NAMES.DIRTY_PLAYER]: SKILL_TYPE.GENERAL,
134
136
  [SKILL_NAMES.DISTURBING_PRESENCE]: SKILL_TYPE.MUTATION,
137
+ [SKILL_NAMES.DIVING_TACKLE]: SKILL_TYPE.AGILITY,
135
138
  [SKILL_NAMES.DODGE]: SKILL_TYPE.AGILITY,
136
139
  [SKILL_NAMES.DRUNKARD]: SKILL_TYPE.EXTRAORDINARY,
137
140
  [SKILL_NAMES.DUMP_OFF]: SKILL_TYPE.PASSING,
@@ -186,6 +189,8 @@ const SKILLS = {
186
189
  [SKILL_NAMES.UNCHANNELLED_FURY]: SKILL_TYPE.EXTRAORDINARY,
187
190
  [SKILL_NAMES.VERY_LONG_LEGS]: SKILL_TYPE.MUTATION,
188
191
  [SKILL_NAMES.WRESTLE]: SKILL_TYPE.GENERAL,
192
+ [SKILL_NAMES.DIVING_CATCH]: SKILL_TYPE.AGILITY,
193
+
189
194
  // [SKILL_NAMES.SIDE_STEP]: SKILL_TYPE.AGILITY,
190
195
  };
191
196
 
@@ -293,10 +298,21 @@ const isActivableSkills = (skill) => {
293
298
  };
294
299
 
295
300
  const isSelectPlayersSkills = (skill) => {
296
- const activables = [];
301
+ const activables = [SKILL_NAMES.DIVING_TACKLE];
297
302
  return activables.includes(skill);
298
303
  };
299
304
 
305
+ const hasSkillForPlayer = (playerWithSkill, playerTarget, skillId) => {
306
+ if (hasSkill(playerWithSkill, skillId)) {
307
+ const skill = getSkill(playerWithSkill, skillId);
308
+ const data = skill?.data || [];
309
+ if (skill && data.includes(playerTarget.id)) {
310
+ return true;
311
+ }
312
+ }
313
+ return false;
314
+ };
315
+
300
316
  function getStarLimit(teamPlayers) {
301
317
  const specialists = getPlayersWithSkill(
302
318
  teamPlayers,
@@ -413,6 +429,7 @@ const hasToAgilityJumpUp = (player) => {
413
429
  };
414
430
 
415
431
  module.exports = {
432
+ hasSkillForPlayer,
416
433
  BIG_GUY_LIMIT,
417
434
  getDisturbingPresenceMalus,
418
435
  getNoTurnoverSkill,