enefel 1.0.105 → 1.0.108

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/.yarnrc ADDED
@@ -0,0 +1 @@
1
+ registry "https://registry.yarnpkg.com"
package/improvement.js CHANGED
@@ -7,6 +7,26 @@ const SPP = {
7
7
  EXP_SOR: 2,
8
8
  EXP_TD: 3,
9
9
  };
10
+ const ranges = [6, 16, 31, 51, 76, 176];
11
+ const coachRanges = [3, 8, 15, 25, 36, 80];
12
+
13
+ const getNextRange = (currentRange) => {
14
+ for (let i = 0; i < ranges.length; i++) {
15
+ if (currentRange < ranges[i]) {
16
+ return ranges[i];
17
+ }
18
+ }
19
+ return "∞";
20
+ };
21
+
22
+ const getNextRangeCoach = (currentRange) => {
23
+ for (let i = 0; i < coachRanges.length; i++) {
24
+ if (currentRange < coachRanges[i]) {
25
+ return coachRanges[i];
26
+ }
27
+ }
28
+ return "∞";
29
+ };
10
30
 
11
31
  /*
12
32
  SPPs Title Star Player Rolls
@@ -19,10 +39,10 @@ SPPs Title Star Player Rolls
19
39
  176+ Legend Six
20
40
  */
21
41
 
22
- const ranges = [6, 16, 31, 51, 76, 176];
23
- const coachRanges = [3, 8, 15, 25, 36, 80];
24
42
  module.exports = {
25
43
  coachRanges,
44
+ getNextRange,
45
+ getNextRangeCoach,
26
46
  ranges,
27
47
  SPP,
28
48
  };
package/league.js CHANGED
@@ -1,8 +1,11 @@
1
1
  const { GAME_TYPE } = require(".");
2
2
  const { canPlayLeague } = require("./state");
3
3
 
4
- const GROUP_SIZE = 4;
5
- const HAS_NEXT_SEASON_PLAYOFF = true;
4
+ const MIN_OPEN_SIZE = 4;
5
+ const GROUP_SIZE = 8;
6
+ const HAS_NEXT_SEASON_PLAYOFF = false;
7
+ const CAN_CHOOSE_TO_PARTICIPATE = false;
8
+ const HOME_AND_AWAY = false;
6
9
 
7
10
  const calculateTeamsStandingForPlayoff = (flatTeams, division) => {
8
11
  const standings = [{ teams: [] }];
@@ -75,10 +78,17 @@ const calculateTeamsStandingForPlayoff = (flatTeams, division) => {
75
78
  return flatedTeams;
76
79
  };
77
80
 
78
- const calculateTeamsStandingForLeagues = (newStandings, division) => {
81
+ const calculateTeamsStandingForLeagues = (
82
+ newStandings,
83
+ division,
84
+ currentSeason
85
+ ) => {
86
+ const openDivision = newStandings[division.length - 1];
79
87
  for (let i = 0; i < division.length - 1; ++i) {
80
88
  const currentDivision = newStandings[i];
81
- const nextDivision = newStandings[i + 1];
89
+ const nextDivision = currentSeason.playoff
90
+ ? openDivision
91
+ : newStandings[i + 1];
82
92
 
83
93
  const currentDivisionLastTeam =
84
94
  currentDivision.teams[currentDivision.teams.length - 1];
@@ -87,13 +97,20 @@ const calculateTeamsStandingForLeagues = (newStandings, division) => {
87
97
 
88
98
  if (nextDivision.name === GAME_TYPE.OPEN) {
89
99
  // To avoid some teams block the open, we take the first team with canChampionship
90
- indexNextDivisionFirstTeam = nextDivision.teams.findIndex(
91
- (t) => t.canChampionship
92
- );
100
+
101
+ let alreadyFind = i;
102
+ indexNextDivisionFirstTeam = nextDivision.teams.findIndex((t, i) => {
103
+ if (currentSeason.playoff && i < alreadyFind) {
104
+ // Fix Si CAN_CHOOSE_TO_PARTICIPATE ?
105
+ return false;
106
+ }
107
+ return t.canChampionship || !CAN_CHOOSE_TO_PARTICIPATE;
108
+ });
93
109
  if (indexNextDivisionFirstTeam === -1) {
94
- indexNextDivisionFirstTeam = 0;
110
+ indexNextDivisionFirstTeam = currentSeason.playoff ? i : 0;
95
111
  }
96
112
  }
113
+
97
114
  const nextDivisionFirstTeam =
98
115
  nextDivision.teams[indexNextDivisionFirstTeam];
99
116
 
@@ -109,7 +126,7 @@ const calculateTeamsStandingForLeagues = (newStandings, division) => {
109
126
  return flatTeams;
110
127
  };
111
128
 
112
- const calculateTeamsStandingForNextSeason = (division) => {
129
+ const calculateTeamsStandingForNextSeason = (division, currentSeason) => {
113
130
  division = division.filter(
114
131
  (d) => d.name !== GAME_TYPE.FRIENDLY && d.name !== GAME_TYPE.PLAYOFF
115
132
  );
@@ -123,7 +140,11 @@ const calculateTeamsStandingForNextSeason = (division) => {
123
140
  if (HAS_NEXT_SEASON_PLAYOFF && GROUP_SIZE * 3 < flatTeams.length) {
124
141
  return calculateTeamsStandingForPlayoff(flatTeams, division);
125
142
  }
126
- return calculateTeamsStandingForLeagues(newStandings, division);
143
+ return calculateTeamsStandingForLeagues(
144
+ newStandings,
145
+ division,
146
+ currentSeason
147
+ );
127
148
  };
128
149
 
129
150
  const forcastNextSeason = (flatTeams) => {
@@ -137,7 +158,10 @@ const forcastNextSeason = (flatTeams) => {
137
158
  return;
138
159
  }
139
160
  // En playoff on n'a que les ligues A et B + open
140
- if (!team.canChampionship || i >= 2) {
161
+ if (
162
+ (CAN_CHOOSE_TO_PARTICIPATE && !team.canChampionship) ||
163
+ (i >= 2 && HAS_NEXT_SEASON_PLAYOFF)
164
+ ) {
141
165
  open.push(team);
142
166
  return;
143
167
  }
@@ -150,8 +174,7 @@ const forcastNextSeason = (flatTeams) => {
150
174
  }
151
175
  });
152
176
  open = [...currentGroup, ...open];
153
-
154
- if (open.length < GROUP_SIZE) {
177
+ if (open.length < MIN_OPEN_SIZE) {
155
178
  const lastDivision = groups.pop();
156
179
  if (lastDivision) {
157
180
  open = [...lastDivision, ...open];
@@ -182,7 +205,7 @@ const playoffNextSeason = (flatTeams) => {
182
205
  // Le reste est mis en open
183
206
  open = [...currentGroup, ...open];
184
207
 
185
- if (open.length < GROUP_SIZE) {
208
+ if (open.length < MIN_OPEN_SIZE) {
186
209
  const lastDivision = groups.pop();
187
210
  if (lastDivision) {
188
211
  open = [...lastDivision, ...open];
@@ -240,7 +263,12 @@ function sortLeagues(a, b) {
240
263
 
241
264
  module.exports = {
242
265
  calculateTeamsStandingForNextSeason,
266
+ CAN_CHOOSE_TO_PARTICIPATE,
267
+ GROUP_SIZE,
268
+ HAS_NEXT_SEASON_PLAYOFF,
243
269
  hasCalendar,
270
+ HOME_AND_AWAY,
271
+ MIN_OPEN_SIZE,
244
272
  playoffNextSeason,
245
273
  sortLeagues,
246
274
  tournament,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enefel",
3
- "version": "1.0.105",
3
+ "version": "1.0.108",
4
4
  "main": "index.js",
5
5
  "author": "Manest",
6
6
  "license": "MIT",
package/race.js CHANGED
@@ -1023,6 +1023,12 @@ function getTeamGroups(team) {
1023
1023
  return groups;
1024
1024
  }
1025
1025
 
1026
+ function isPlayerNeutralGroup(player) {
1027
+ const group = getPlayerGroup(player);
1028
+ const neutrals = [GROUP_NAME.NEUTRAL];
1029
+ return neutrals.includes(group);
1030
+ }
1031
+
1026
1032
  function isNeutralGroup(group) {
1027
1033
  const neutrals = [GROUP_NAME.NEUTRAL];
1028
1034
  return neutrals.includes(group);
@@ -1079,5 +1085,6 @@ module.exports = {
1079
1085
  getTeamIncompatibleGroups,
1080
1086
  GROUP_NAME,
1081
1087
  isNeutralGroup,
1088
+ isPlayerNeutralGroup,
1082
1089
  RACE,
1083
1090
  };
package/skill.js CHANGED
@@ -171,7 +171,7 @@ function useSkill(player, skillId, date = -1, info = null) {
171
171
  skill.info = info;
172
172
  }
173
173
 
174
- function getSkill(player, skillId) {
174
+ function getSkill(player, skillId, info = null) {
175
175
  if (!SKILLS.hasOwnProperty(skillId)) {
176
176
  throw `Skill '${skillId}' does not exist`;
177
177
  }
@@ -179,12 +179,20 @@ function getSkill(player, skillId) {
179
179
  if (!playerSkills) {
180
180
  return false;
181
181
  }
182
- const skill = playerSkills.find((s) => s.skill_id === skillId);
182
+ const skill = playerSkills.find(
183
+ (s) => s.skill_id === skillId && (info ? s.info === info : true)
184
+ );
183
185
  return skill;
184
186
  }
185
187
 
186
- function hasSkill(player, skillId, withDate = false, checkActivated = true) {
187
- const skill = getSkill(player, skillId);
188
+ function hasSkill(
189
+ player,
190
+ skillId,
191
+ withDate = false,
192
+ checkActivated = true,
193
+ info = null
194
+ ) {
195
+ const skill = getSkill(player, skillId, info);
188
196
 
189
197
  const isActivated = (skill) =>
190
198
  checkActivated && isActivableSkills(skillId)
package/yarn-error.log ADDED
@@ -0,0 +1,46 @@
1
+ Arguments:
2
+ C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js
3
+
4
+ PATH:
5
+ C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;C:\Users\yoann\.windows-build-tools\python27\;C:\Users\yoann\AppData\Local\Microsoft\WindowsApps;C:\Users\yoann\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\yoann\AppData\Local\Yarn\bin;C:\Program Files\Docker Toolbox;C:\Program Files\Java\jdk1.8.0_221;C:\Users\yoann\AppData\Roaming\npm;C:\Program Files\heroku\bin
6
+
7
+ Yarn version:
8
+ 1.10.1
9
+
10
+ Node version:
11
+ 12.13.1
12
+
13
+ Platform:
14
+ win32 x64
15
+
16
+ Trace:
17
+ SyntaxError: Unknown token: { line: 1, col: 39, type: 'INVALID', value: undefined } 1:39 in C:\dev\e2\enefel\.yarnrc
18
+ at Parser.unexpected (C:\Program Files (x86)\Yarn\lib\cli.js:57347:11)
19
+ at Parser.parse (C:\Program Files (x86)\Yarn\lib\cli.js:57478:14)
20
+ at parse (C:\Program Files (x86)\Yarn\lib\cli.js:57549:17)
21
+ at module.exports.exports.default (C:\Program Files (x86)\Yarn\lib\cli.js:57113:96)
22
+ at YarnRegistry.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:82396:64)
23
+ at Generator.next (<anonymous>)
24
+ at step (C:\Program Files (x86)\Yarn\lib\cli.js:98:30)
25
+ at C:\Program Files (x86)\Yarn\lib\cli.js:109:13
26
+
27
+ npm manifest:
28
+ {
29
+ "name": "enefel",
30
+ "version": "1.0.1",
31
+ "main": "index.js",
32
+ "author": "Manest",
33
+ "license": "MIT",
34
+ "devDependencies": {
35
+ "jest": "^24.9.0"
36
+ },
37
+ "scripts": {
38
+ "test": "jest"
39
+ }
40
+ }
41
+
42
+ yarn manifest:
43
+ No manifest
44
+
45
+ Lockfile:
46
+ No lockfile