enefel 1.0.190 → 1.0.191

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.
Files changed (4) hide show
  1. package/index.js +4 -4
  2. package/move.js +14 -4
  3. package/package.json +1 -1
  4. package/skill.js +15 -1
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.191",
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",
@@ -132,6 +133,7 @@ const SKILLS = {
132
133
  [SKILL_NAMES.DEFENSIVE]: SKILL_TYPE.AGILITY,
133
134
  [SKILL_NAMES.DIRTY_PLAYER]: SKILL_TYPE.GENERAL,
134
135
  [SKILL_NAMES.DISTURBING_PRESENCE]: SKILL_TYPE.MUTATION,
136
+ [SKILL_NAMES.DIVING_TACKLE]: SKILL_TYPE.AGILITY,
135
137
  [SKILL_NAMES.DODGE]: SKILL_TYPE.AGILITY,
136
138
  [SKILL_NAMES.DRUNKARD]: SKILL_TYPE.EXTRAORDINARY,
137
139
  [SKILL_NAMES.DUMP_OFF]: SKILL_TYPE.PASSING,
@@ -293,10 +295,21 @@ const isActivableSkills = (skill) => {
293
295
  };
294
296
 
295
297
  const isSelectPlayersSkills = (skill) => {
296
- const activables = [];
298
+ const activables = [SKILL_NAMES.DIVING_TACKLE];
297
299
  return activables.includes(skill);
298
300
  };
299
301
 
302
+ const hasSkillForPlayer = (playerWithSkill, playerTarget, skillId) => {
303
+ if (hasSkill(playerWithSkill, skillId)) {
304
+ const skill = getSkill(playerWithSkill, skillId);
305
+ const data = skill?.data || [];
306
+ if (skill && data.includes(playerTarget.id)) {
307
+ return true;
308
+ }
309
+ }
310
+ return false;
311
+ };
312
+
300
313
  function getStarLimit(teamPlayers) {
301
314
  const specialists = getPlayersWithSkill(
302
315
  teamPlayers,
@@ -413,6 +426,7 @@ const hasToAgilityJumpUp = (player) => {
413
426
  };
414
427
 
415
428
  module.exports = {
429
+ hasSkillForPlayer,
416
430
  BIG_GUY_LIMIT,
417
431
  getDisturbingPresenceMalus,
418
432
  getNoTurnoverSkill,