enefel 2.9.1 → 2.11.0

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 (77) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/2025/newSkills.ts +769 -0
  3. package/2025/raceMigration.ts +66 -0
  4. package/2025/rawTeamsData.ts +1726 -0
  5. package/2025/skillMigration.ts +155 -0
  6. package/avatarsSeason.ts +61 -0
  7. package/career.ts +64 -8
  8. package/career2025.ts +2752 -0
  9. package/dice.ts +40 -8
  10. package/dist/2025/newSkills.d.ts +10 -0
  11. package/dist/2025/newSkills.js +663 -0
  12. package/dist/2025/raceMigration.d.ts +10 -0
  13. package/dist/2025/raceMigration.js +53 -0
  14. package/dist/2025/rawTeamsData.d.ts +12 -0
  15. package/dist/2025/rawTeamsData.js +1699 -0
  16. package/dist/2025/skillMigration.d.ts +31 -0
  17. package/dist/2025/skillMigration.js +95 -0
  18. package/dist/avatarsSeason.d.ts +22 -0
  19. package/dist/avatarsSeason.js +54 -0
  20. package/dist/career.d.ts +13 -4
  21. package/dist/career.js +36 -7
  22. package/dist/career2025.d.ts +192 -0
  23. package/dist/career2025.js +2611 -0
  24. package/dist/dice.d.ts +10 -2
  25. package/dist/dice.js +31 -8
  26. package/dist/index.d.ts +17 -2
  27. package/dist/index.js +44 -5
  28. package/dist/move.d.ts +6 -2
  29. package/dist/move.js +35 -0
  30. package/dist/package-lock.json +913 -7
  31. package/dist/package.json +6 -2
  32. package/dist/pitch.d.ts +10 -1
  33. package/dist/pitch.js +16 -0
  34. package/dist/player.d.ts +8 -4
  35. package/dist/player.js +104 -20
  36. package/dist/position.d.ts +4 -0
  37. package/dist/position.js +17 -1
  38. package/dist/race.d.ts +23 -12
  39. package/dist/race.js +210 -2
  40. package/dist/skill.d.ts +26 -3
  41. package/dist/skill.js +199 -81
  42. package/dist/skills/hitAndRun.d.ts +10 -0
  43. package/dist/skills/hitAndRun.js +12 -0
  44. package/dist/skills/safePairOfHands.d.ts +28 -0
  45. package/dist/skills/safePairOfHands.js +18 -0
  46. package/dist/skills/sidestep.d.ts +21 -0
  47. package/dist/skills/sidestep.js +20 -0
  48. package/dist/status.d.ts +4 -1
  49. package/dist/status.js +14 -4
  50. package/dist/store.d.ts +3 -0
  51. package/dist/store.js +3 -0
  52. package/dist/teams/career_v2025.d.ts +246 -0
  53. package/dist/teams/career_v2025.js +3512 -0
  54. package/dist/teams/convert-csv-to-career.d.ts +1 -0
  55. package/dist/teams/convert-csv-to-career.js +1085 -0
  56. package/dist/types/models.d.ts +4 -0
  57. package/index.ts +57 -4
  58. package/jest.config.js +3 -0
  59. package/move.ts +50 -2
  60. package/npm-login.sh +0 -0
  61. package/package.json +6 -2
  62. package/pitch.ts +22 -0
  63. package/player.ts +105 -22
  64. package/position.ts +16 -0
  65. package/race.ts +227 -13
  66. package/skill.ts +217 -83
  67. package/skills/hitAndRun.ts +14 -0
  68. package/skills/safePairOfHands.ts +33 -0
  69. package/skills/sidestep.ts +25 -0
  70. package/status.ts +15 -3
  71. package/store.ts +3 -0
  72. package/teams/README.md +53 -0
  73. package/teams/clean-stats.js +54 -0
  74. package/teams/convert-csv-to-career.ts +1209 -0
  75. package/teams/players_clean.csv +107 -0
  76. package/teams/players_next.csv +21 -0
  77. package/types/models.ts +4 -0
package/dist/dice.d.ts CHANGED
@@ -1,5 +1,13 @@
1
- declare const getPlayerDice: () => {
1
+ import { AVATAR_RARITY } from "./career";
2
+ export type DiceSkin = {
3
+ id: string;
2
4
  color: string;
3
5
  background: string;
6
+ price: number;
7
+ season?: number;
8
+ rarity?: AVATAR_RARITY;
4
9
  };
5
- export { getPlayerDice };
10
+ declare const DICE_LIST: DiceSkin[];
11
+ declare const getDiceById: (id: string | null | undefined) => DiceSkin;
12
+ declare const getPlayerDice: () => DiceSkin;
13
+ export { DICE_LIST, getDiceById, getPlayerDice };
package/dist/dice.js CHANGED
@@ -1,13 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPlayerDice = void 0;
4
- const DICE = {
5
- default: {
6
- color: "#000000",
7
- background: "#ffffff",
3
+ exports.getPlayerDice = exports.getDiceById = exports.DICE_LIST = void 0;
4
+ const career_1 = require("./career");
5
+ const DICE_LIST = [
6
+ { id: "default", color: "#000000", background: "#ffffff", price: 0 },
7
+ {
8
+ id: "s17-blood-debug",
9
+ color: "#ffffff",
10
+ background: "#cc0000",
11
+ price: 30,
12
+ season: 17,
13
+ rarity: career_1.AVATAR_RARITY.COMMUN,
8
14
  },
15
+ {
16
+ id: "s19-blood",
17
+ color: "#ffffff",
18
+ background: "#cc0000",
19
+ price: 30,
20
+ season: 19,
21
+ rarity: career_1.AVATAR_RARITY.COMMUN,
22
+ },
23
+ ];
24
+ exports.DICE_LIST = DICE_LIST;
25
+ const getDiceById = (id) => {
26
+ if (!id)
27
+ return DICE_LIST[0];
28
+ return DICE_LIST.find((d) => d.id === id) ?? DICE_LIST[0];
9
29
  };
10
- const getPlayerDice = () => {
11
- return DICE.default;
12
- };
30
+ exports.getDiceById = getDiceById;
31
+ // kept for backwards compatibility
32
+ const getPlayerDice = () => DICE_LIST[0];
13
33
  exports.getPlayerDice = getPlayerDice;
34
+ // TODO: when RARE or UNIQUE dice are added, add access conditions:
35
+ // - StoreDice.tsx: filter dice based on player eligibility before displaying
36
+ // - BuyService.js: enforce the same check server-side before allowing purchase
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Game, Player, PlayerWithSkill, Point, Team } from "types/models";
2
2
  import { METEO } from "./meteo";
3
+ import { getAllAdjacentSquares } from "./position";
3
4
  import version from "./version";
4
5
  declare const POSTULATION_HOURS = 24;
5
6
  declare const INACTIVE_DAYS = 10;
@@ -118,6 +119,7 @@ declare const GAME_HISTORY_INFO: {
118
119
  ARMOR: string;
119
120
  BALL: string;
120
121
  BLOCK: string;
122
+ BREATHE_FIRE: string;
121
123
  BRIBE: string;
122
124
  CARAC_CHANGE: string;
123
125
  CASUALTY: string;
@@ -142,17 +144,25 @@ declare const GAME_HISTORY_INFO: {
142
144
  METEO: string;
143
145
  MOVE: string;
144
146
  PASS: string;
147
+ PUNT_DIRECTION: string;
148
+ PUNT_DISTANCE: string;
149
+ PUNT_TO_CROWD: string;
150
+ PUNT_ON_PLAYER: string;
151
+ PUNT_SCATTER: string;
152
+ PRO: string;
145
153
  REJECTION: string;
146
154
  REROLL_COACH: string;
147
155
  REROLL_INITIAL: string;
148
156
  REROLL_METEO: string;
149
157
  REROLL_RACE_MALUS: string;
150
158
  REROLL: string;
159
+ SECURE_BALL: string;
151
160
  SCATTER: string;
152
161
  SKILL_GAIN: string;
153
162
  SKILL_LOSS: string;
154
163
  SKILL: string;
155
164
  SPY: string;
165
+ STAB: string;
156
166
  STANDUP: string;
157
167
  START_FAN: string;
158
168
  STATUS: string;
@@ -160,6 +170,8 @@ declare const GAME_HISTORY_INFO: {
160
170
  TD: string;
161
171
  THREATENING: string;
162
172
  THROW_TEAM_MATE: string;
173
+ BLOODLUST_BITE: string;
174
+ BLOODLUST_NO_TARGET: string;
163
175
  TURNOVER: string;
164
176
  };
165
177
  declare const PLAYER_HISTORY_TYPE: {
@@ -206,7 +218,7 @@ declare function addSeconds(date: Date, days: number): Date;
206
218
  declare const isSquareValidToPushBack: (availableSquares: Point[], targetIndex: number, players: Record<string, PlayerWithSkill>, w: number, h: number, busy?: Point[]) => boolean;
207
219
  declare const getPlayerOnCell: (x: number | null, y: number | null, players: Record<string, PlayerWithSkill>) => false | PlayerWithSkill | undefined;
208
220
  declare const getHypnoticGazeMalus: (player: Player, target: Player, players: Record<string, Player>) => number;
209
- declare const getBlockAssistance: (attackerPlayer: PlayerWithSkill, defenderPlayer: PlayerWithSkill, players: PlayerWithSkill[], isAttacker?: boolean) => PlayerWithSkill[];
221
+ declare const getBlockAssistance: (attackerPlayer: PlayerWithSkill, defenderPlayer: PlayerWithSkill, players: PlayerWithSkill[], isAttacker?: boolean, isFoul?: boolean) => PlayerWithSkill[];
210
222
  declare const getDicesBlock: (attackerStrength: number, defenderStrength: number) => 2 | 1 | 3;
211
223
  declare const haveSameTeam: (p1: Player, p2: Player) => boolean;
212
224
  declare const isSamePlayer: (p1: Player, p2: Player) => boolean;
@@ -243,4 +255,7 @@ declare const arrayMove: (arr: any[], old_index: number, new_index: number) => a
243
255
  declare const swapArrayLocs: (arr: any[], index1: number, index2: number) => any[];
244
256
  declare const getInactiveDays: (isDev?: boolean) => 10 | 10000;
245
257
  declare const getMaxPlayers: (isDev?: boolean) => number;
246
- export { addSeconds, arrayMove, availableSquaresToPushBack, canBlock, canEndTurn, canFaceUp, canFoul, canMove, canPass, canPlayerIntercepts, canStandup, canThrowTeamMate, canTransmit, FORMATION_DEFAULT_NAME, GAME_HISTORY_INFO, GAME_HISTORY_TYPE, getAttackerStrength, getBestInterceptor, getBlockAssistance, getDefenderStrength, getDicesBlock, getHypnoticGazeMalus, getInactiveDays, getMaxPlayers, getMoralModifier, getPlayerOnCell, getTeamColor, getTeamMoral, getTeamMoralByPlayer, getTeamXP, getThrowingBonus, haveSameTeam, INACTIVE_DAYS, isCoach, isGameRunning, isOnField, isOnLine, isSamePlayer, isSetUp, isSquareValidToPushBack, LAST_SEASON_ALPHA, MAX_PLAYER_TEAM, MAX_PLAYER_USER, p, PLAYER_HISTORY_INFO, PLAYER_HISTORY_TYPE, PLAYER_STAT, POSTULATION_HOURS, swapArrayLocs, TAKE_BALL_TYPE, version, };
258
+ export { addSeconds, arrayMove, availableSquaresToPushBack, canBlock, canEndTurn, canFaceUp, canFoul, canMove, canPass, canPlayerIntercepts, canStandup, canThrowTeamMate, canTransmit, FORMATION_DEFAULT_NAME, GAME_HISTORY_INFO, GAME_HISTORY_TYPE, getAllAdjacentSquares, getAttackerStrength, getBestInterceptor, getBlockAssistance, getDefenderStrength, getDicesBlock, getHypnoticGazeMalus, getInactiveDays, getMaxPlayers, getMoralModifier, getPlayerOnCell, getTeamColor, getTeamMoral, getTeamMoralByPlayer, getTeamXP, getThrowingBonus, haveSameTeam, INACTIVE_DAYS, isCoach, isGameRunning, isOnField, isOnLine, isSamePlayer, isSetUp, isSquareValidToPushBack, LAST_SEASON_ALPHA, MAX_PLAYER_TEAM, MAX_PLAYER_USER, p, PLAYER_HISTORY_INFO, PLAYER_HISTORY_TYPE, PLAYER_STAT, POSTULATION_HOURS, swapArrayLocs, TAKE_BALL_TYPE, version, };
259
+ export { SidestepMode, SidestepStrategy, SidestepPreference, } from "./skills/sidestep";
260
+ export { HitAndRunMode, HitAndRunStrategy, HitAndRunPreference, } from "./skills/hitAndRun";
261
+ export { SafePairOfHandsMode, SafePairOfHandsStrategy, SafePairOfHandsPreference, } from "./skills/safePairOfHands";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.version = exports.TAKE_BALL_TYPE = exports.swapArrayLocs = exports.POSTULATION_HOURS = exports.PLAYER_STAT = exports.PLAYER_HISTORY_TYPE = exports.PLAYER_HISTORY_INFO = exports.p = exports.MAX_PLAYER_USER = exports.MAX_PLAYER_TEAM = exports.LAST_SEASON_ALPHA = exports.isSquareValidToPushBack = exports.isSamePlayer = exports.isOnLine = exports.isOnField = exports.isCoach = exports.INACTIVE_DAYS = exports.haveSameTeam = exports.getThrowingBonus = exports.getTeamXP = exports.getTeamMoralByPlayer = exports.getTeamMoral = exports.getPlayerOnCell = exports.getMoralModifier = exports.getMaxPlayers = exports.getInactiveDays = exports.getHypnoticGazeMalus = exports.getDicesBlock = exports.getDefenderStrength = exports.getBlockAssistance = exports.getBestInterceptor = exports.getAttackerStrength = exports.GAME_HISTORY_TYPE = exports.GAME_HISTORY_INFO = exports.FORMATION_DEFAULT_NAME = exports.canPlayerIntercepts = exports.availableSquaresToPushBack = exports.arrayMove = void 0;
6
+ exports.SafePairOfHandsStrategy = exports.SafePairOfHandsMode = exports.HitAndRunStrategy = exports.HitAndRunMode = exports.SidestepStrategy = exports.SidestepMode = exports.version = exports.TAKE_BALL_TYPE = exports.swapArrayLocs = exports.POSTULATION_HOURS = exports.PLAYER_STAT = exports.PLAYER_HISTORY_TYPE = exports.PLAYER_HISTORY_INFO = exports.p = exports.MAX_PLAYER_USER = exports.MAX_PLAYER_TEAM = exports.LAST_SEASON_ALPHA = exports.isSquareValidToPushBack = exports.isSamePlayer = exports.isOnLine = exports.isOnField = exports.isCoach = exports.INACTIVE_DAYS = exports.haveSameTeam = exports.getThrowingBonus = exports.getTeamXP = exports.getTeamMoralByPlayer = exports.getTeamMoral = exports.getPlayerOnCell = exports.getMoralModifier = exports.getMaxPlayers = exports.getInactiveDays = exports.getHypnoticGazeMalus = exports.getDicesBlock = exports.getDefenderStrength = exports.getBlockAssistance = exports.getBestInterceptor = exports.getAttackerStrength = exports.getAllAdjacentSquares = exports.GAME_HISTORY_TYPE = exports.GAME_HISTORY_INFO = exports.FORMATION_DEFAULT_NAME = exports.canPlayerIntercepts = exports.availableSquaresToPushBack = exports.arrayMove = void 0;
7
7
  exports.addSeconds = addSeconds;
8
8
  exports.canBlock = canBlock;
9
9
  exports.canEndTurn = canEndTurn;
@@ -23,6 +23,7 @@ const improvement_1 = require("./improvement");
23
23
  const meteo_1 = require("./meteo");
24
24
  const player_1 = require("./player");
25
25
  const position_1 = require("./position");
26
+ Object.defineProperty(exports, "getAllAdjacentSquares", { enumerable: true, get: function () { return position_1.getAllAdjacentSquares; } });
26
27
  const race_1 = require("./race");
27
28
  const skill_1 = require("./skill");
28
29
  const status_1 = require("./status");
@@ -153,6 +154,7 @@ const GAME_HISTORY_INFO = {
153
154
  ARMOR: "ar",
154
155
  BALL: "ball",
155
156
  BLOCK: "b",
157
+ BREATHE_FIRE: "brf",
156
158
  BRIBE: "br",
157
159
  CARAC_CHANGE: "cc",
158
160
  CASUALTY: "ca",
@@ -177,17 +179,25 @@ const GAME_HISTORY_INFO = {
177
179
  METEO: "met",
178
180
  MOVE: "m",
179
181
  PASS: "p",
182
+ PUNT_DIRECTION: "puntd",
183
+ PUNT_DISTANCE: "puntdist",
184
+ PUNT_TO_CROWD: "puntc",
185
+ PUNT_ON_PLAYER: "puntp",
186
+ PUNT_SCATTER: "punts",
187
+ PRO: "pro",
180
188
  REJECTION: "r",
181
189
  REROLL_COACH: "rc",
182
190
  REROLL_INITIAL: "rei",
183
191
  REROLL_METEO: "rm",
184
192
  REROLL_RACE_MALUS: "rrm",
185
193
  REROLL: "re",
194
+ SECURE_BALL: "sb",
186
195
  SCATTER: "sc",
187
196
  SKILL_GAIN: "skg",
188
197
  SKILL_LOSS: "skl",
189
198
  SKILL: "sk",
190
199
  SPY: "spy",
200
+ STAB: "stab",
191
201
  STANDUP: "st",
192
202
  START_FAN: "fan",
193
203
  STATUS: "s",
@@ -195,6 +205,8 @@ const GAME_HISTORY_INFO = {
195
205
  TD: "td",
196
206
  THREATENING: "thr",
197
207
  THROW_TEAM_MATE: "ttm",
208
+ BLOODLUST_BITE: "blb",
209
+ BLOODLUST_NO_TARGET: "blnt",
198
210
  TURNOVER: "to",
199
211
  };
200
212
  exports.GAME_HISTORY_INFO = GAME_HISTORY_INFO;
@@ -303,7 +315,7 @@ exports.getHypnoticGazeMalus = getHypnoticGazeMalus;
303
315
  // opposing team, and ...
304
316
  // 3. Must be standing, and …
305
317
  // 4. Must have his tackle zones.
306
- const getBlockAssistance = (attackerPlayer, defenderPlayer, players, isAttacker = false) => {
318
+ const getBlockAssistance = (attackerPlayer, defenderPlayer, players, isAttacker = false, isFoul = false) => {
307
319
  const OtherPlayersThanInvolved = players.filter((player) => {
308
320
  return player.id !== attackerPlayer.id && player.id !== defenderPlayer.id;
309
321
  });
@@ -314,14 +326,15 @@ const getBlockAssistance = (attackerPlayer, defenderPlayer, players, isAttacker
314
326
  };
315
327
  // 1. Must be adjacent to the enemy player involved in the block,
316
328
  // 3. Must be standing, and …
329
+ // 5. Must not be Eye Gouged (cannot provide assists)
317
330
  const adjacentEnemyPlayers = OtherPlayersThanInvolved.filter((player) => {
318
- return isValidAdjacentEnemy(player, defenderPlayer);
331
+ return isValidAdjacentEnemy(player, defenderPlayer) && (0, status_1.hasStatusCanAssist)(player);
319
332
  });
320
333
  // 2. Must not be in the tackle zone of any other player from the
321
334
  // opposing team, and ...
322
335
  const assistantPlayers = adjacentEnemyPlayers.filter((adjacentEnemyPlayer) => {
323
336
  let hasGard = false;
324
- if ((0, skill_1.hasSkill)(adjacentEnemyPlayer, skill_1.SKILL_NAMES.GUARD)) {
337
+ if (!isFoul && (0, skill_1.hasSkill)(adjacentEnemyPlayer, skill_1.SKILL_NAMES.GUARD)) {
325
338
  hasGard = true;
326
339
  if (isAttacker && // player is the attacker player.
327
340
  [...OtherPlayersThanInvolved, defenderPlayer].some((player) => {
@@ -331,7 +344,12 @@ const getBlockAssistance = (attackerPlayer, defenderPlayer, players, isAttacker
331
344
  hasGard = false;
332
345
  }
333
346
  }
347
+ // Put the Boot In: can provide offensive assist on fouls even when marked
348
+ const hasPutTheBootIn = isFoul &&
349
+ isAttacker &&
350
+ (0, skill_1.hasSkill)(adjacentEnemyPlayer, skill_1.SKILL_NAMES.PUT_THE_BOOT_IN);
334
351
  return (hasGard ||
352
+ hasPutTheBootIn ||
335
353
  !OtherPlayersThanInvolved.some((player) => {
336
354
  return (
337
355
  // 4. Must have his tackle zones.
@@ -715,7 +733,8 @@ function canFoul(attacker, defender, attackerTeam) {
715
733
  (0, position_1.isAdjacent)(attacker, defender));
716
734
  }
717
735
  function canPass(player, playerTeam, playerIdWithBall) {
718
- return ((0, status_1.hasStatusTacleZone)(player) &&
736
+ return (player.status !== status_1.PLAYER_STATUS.BLOODLUST &&
737
+ (0, status_1.hasStatusTacleZone)(player) &&
719
738
  player.has_action === true &&
720
739
  playerTeam.date_next_pass === null &&
721
740
  player.id === playerIdWithBall);
@@ -746,9 +765,20 @@ function canTransmit(player, target, playerTeam, playerIdWithBall) {
746
765
  if (!player || !target || isSamePlayer(player, target)) {
747
766
  return false;
748
767
  }
768
+ // Cannot transmit from or to a player in Bloodlust state
769
+ if (player.status === status_1.PLAYER_STATUS.BLOODLUST) {
770
+ return false;
771
+ }
772
+ if (target.status === status_1.PLAYER_STATUS.BLOODLUST) {
773
+ return false;
774
+ }
749
775
  if (player.id !== playerIdWithBall && target.id !== playerIdWithBall) {
750
776
  return false;
751
777
  }
778
+ // Cannot transmit if player has already ended turn (e.g., after Bloodlust bite)
779
+ if (player.hasEndTurn === true) {
780
+ return false;
781
+ }
752
782
  return (player.teamId === target.teamId &&
753
783
  playerTeam.date_next_transmission === null &&
754
784
  (0, status_1.hasStatusTacleZone)(player) &&
@@ -864,3 +894,12 @@ const getMaxPlayers = (isDev = false) => {
864
894
  return maxPlayers;
865
895
  };
866
896
  exports.getMaxPlayers = getMaxPlayers;
897
+ var sidestep_1 = require("./skills/sidestep");
898
+ Object.defineProperty(exports, "SidestepMode", { enumerable: true, get: function () { return sidestep_1.SidestepMode; } });
899
+ Object.defineProperty(exports, "SidestepStrategy", { enumerable: true, get: function () { return sidestep_1.SidestepStrategy; } });
900
+ var hitAndRun_1 = require("./skills/hitAndRun");
901
+ Object.defineProperty(exports, "HitAndRunMode", { enumerable: true, get: function () { return hitAndRun_1.HitAndRunMode; } });
902
+ Object.defineProperty(exports, "HitAndRunStrategy", { enumerable: true, get: function () { return hitAndRun_1.HitAndRunStrategy; } });
903
+ var safePairOfHands_1 = require("./skills/safePairOfHands");
904
+ Object.defineProperty(exports, "SafePairOfHandsMode", { enumerable: true, get: function () { return safePairOfHands_1.SafePairOfHandsMode; } });
905
+ Object.defineProperty(exports, "SafePairOfHandsStrategy", { enumerable: true, get: function () { return safePairOfHands_1.SafePairOfHandsStrategy; } });
package/dist/move.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- import { PlayerWithSkill, Point } from "./types/models";
1
+ import { Game, PlayerWithSkill, Point } from "./types/models";
2
2
  declare function bonusDodge(player: PlayerWithSkill, adjEnemies: PlayerWithSkill[], adjDestinationEnemies: PlayerWithSkill[]): number;
3
3
  declare function modifJumping(player: PlayerWithSkill, destination: Point, playerTeamId: string, players: Record<string, PlayerWithSkill>): {
4
4
  modif: number;
5
5
  enemies: PlayerWithSkill[];
6
6
  };
7
- export { bonusDodge, modifJumping };
7
+ declare function hasOpponentStandingAroundBall(players: Record<string, PlayerWithSkill> | PlayerWithSkill[], ball: Point, teamId: string, distance?: number): boolean;
8
+ declare function getGameBall(game: Game | null | undefined): Point | null;
9
+ declare function listGamePlayers(game: Game | null | undefined): PlayerWithSkill[];
10
+ declare function canUseSecureBall(player: PlayerWithSkill): boolean;
11
+ export { bonusDodge, canUseSecureBall, getGameBall, hasOpponentStandingAroundBall, listGamePlayers, modifJumping, };
package/dist/move.js CHANGED
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bonusDodge = bonusDodge;
4
+ exports.canUseSecureBall = canUseSecureBall;
5
+ exports.getGameBall = getGameBall;
6
+ exports.hasOpponentStandingAroundBall = hasOpponentStandingAroundBall;
7
+ exports.listGamePlayers = listGamePlayers;
4
8
  exports.modifJumping = modifJumping;
5
9
  const position_1 = require("./position");
6
10
  const skill_1 = require("./skill");
11
+ const status_1 = require("./status");
7
12
  function bonusDodge(player, adjEnemies, adjDestinationEnemies) {
8
13
  let bonus = 1;
9
14
  if ((0, skill_1.hasSkill)(player, skill_1.SKILL_NAMES.TWO_HEADS)) {
@@ -68,3 +73,33 @@ function modifJumping(player, destination, playerTeamId, players) {
68
73
  }
69
74
  return { modif, enemies };
70
75
  }
76
+ function hasOpponentStandingAroundBall(players, ball, teamId, distance = 2) {
77
+ const list = Array.isArray(players) ? players : Object.values(players);
78
+ return list.some((p) => p.teamId !== teamId &&
79
+ (0, status_1.hasStatusStanding)(p) &&
80
+ p.x !== null &&
81
+ p.y !== null &&
82
+ ball.x !== null &&
83
+ ball.y !== null &&
84
+ Math.max(Math.abs(p.x - ball.x), Math.abs(p.y - ball.y)) <= distance);
85
+ }
86
+ function getGameBall(game) {
87
+ if (!game)
88
+ return null;
89
+ if (game.ball_player_id !== null)
90
+ return null;
91
+ if (game.ball_x == null || game.ball_y == null)
92
+ return null;
93
+ return { x: game.ball_x, y: game.ball_y };
94
+ }
95
+ function listGamePlayers(game) {
96
+ if (!game)
97
+ return [];
98
+ const team1Players = game.team1?.players || [];
99
+ const team2Players = game.team2?.players || [];
100
+ return [...team1Players, ...team2Players];
101
+ }
102
+ function canUseSecureBall(player) {
103
+ return (!(0, skill_1.hasSkill)(player, skill_1.SKILL_NAMES.BIG_GUY) &&
104
+ !(0, skill_1.hasSkill)(player, skill_1.SKILL_NAMES.UNSTEADY));
105
+ }