enefel 1.0.98 → 1.0.99

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/calcul.js ADDED
@@ -0,0 +1,8 @@
1
+ const distance = (p1, p2) => {
2
+ return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
3
+ };
4
+
5
+ const distanceSquares = (p1, p2, distance) => {
6
+ return Math.abs(p1.x - p2.x) <= distance && Math.abs(p1.y - p2.y) <= distance;
7
+ };
8
+ module.exports = { distance, distanceSquares };
package/index.js CHANGED
@@ -1,4 +1,8 @@
1
- const { hasSkill, SKILL_NAMES } = require("./skill");
1
+ const {
2
+ hasSkill,
3
+ SKILL_NAMES,
4
+ getDisturbingPresenceMalus,
5
+ } = require("./skill");
2
6
  const { ranges } = require("./improvement");
3
7
  const races = require("./race");
4
8
  const {
@@ -14,6 +18,7 @@ const {
14
18
  meteoMaxPassDistance,
15
19
  METEO,
16
20
  } = require("./meteo");
21
+ const { distance } = require("./calcul");
17
22
  const INITIAL_REROLL = 2;
18
23
  const POSTULATION_HOURS = 24;
19
24
  const INACTIVE_DAYS = 10;
@@ -580,10 +585,6 @@ const availableSquaresToPushBack = (p1, p2) => {
580
585
  }
581
586
  };
582
587
 
583
- const distance = (p1, p2) => {
584
- return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
585
- };
586
-
587
588
  // playerFrom, pointTo, foe
588
589
  const isOnLine = (A, B, C) => {
589
590
  //http://www.luccini.it/bloodbowl/downloads/Tabella_Intercetti.pdf
@@ -673,7 +674,8 @@ const getBestInterceptor = (playerFrom, pointTo, players) => {
673
674
  let bestAGPlayers = [];
674
675
  possiblePlayers.forEach((player) => {
675
676
  const zdt = getEnemyTackleZones(player, player.teamId, players).length;
676
- if (player.current_AG - zdt > bestAG) {
677
+ const disturbingPresence = getDisturbingPresenceMalus(player, players);
678
+ if (player.current_AG - zdt - disturbingPresence > bestAG) {
677
679
  bestAG = player.current_AG - zdt;
678
680
  bestAGPlayers = [];
679
681
  bestAGPlayers.push(player);
@@ -889,7 +891,6 @@ module.exports = {
889
891
  canStandup,
890
892
  canThrowTeamMate,
891
893
  canTransmit,
892
- distance,
893
894
  FORMATION_DEFAULT_NAME,
894
895
  GAME_HISTORY_INFO,
895
896
  GAME_HISTORY_TYPE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enefel",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "main": "index.js",
5
5
  "author": "Manest",
6
6
  "license": "MIT",
package/race.js CHANGED
@@ -33,25 +33,25 @@ module.exports = {
33
33
  range: 0,
34
34
  cost: 60,
35
35
  },
36
- // "lizardmen-chameleon": {
37
- // MA: 7,
38
- // ST: 2,
39
- // AG: 3,
40
- // AV: 7,
41
- // normal: "A",
42
- // double: "GPS",
43
- // normalCoach: "G",
44
- // icons: ["lizardmen-chameleon1"],
45
- // skills: [
46
- // SKILL_NAMES.DODGE,
47
- // // SKILL_NAMES.ON_THE_BALL,
48
- // // SKILL_NAMES.SHADOWING,
49
- // SKILL_NAMES.STUNTY,
50
- // ],
51
- // badge: "lizardmen-career",
52
- // range: 1,
53
- // cost: 70,
54
- // },
36
+ "lizardmen-chameleon": {
37
+ MA: 7,
38
+ ST: 2,
39
+ AG: 3,
40
+ AV: 7,
41
+ normal: "A",
42
+ double: "GPS",
43
+ normalCoach: "G",
44
+ icons: ["lizardmen-chameleon1"],
45
+ skills: [
46
+ SKILL_NAMES.DODGE,
47
+ SKILL_NAMES.ON_THE_BALL,
48
+ SKILL_NAMES.SHADOWING,
49
+ SKILL_NAMES.STUNTY,
50
+ ],
51
+ badge: "lizardmen-career",
52
+ range: 1,
53
+ cost: 70,
54
+ },
55
55
  "lizardmen-saurus": {
56
56
  MA: 6,
57
57
  ST: 4,
@@ -175,7 +175,7 @@ module.exports = {
175
175
  icons: ["norse-yhetee1"],
176
176
  skills: [
177
177
  SKILL_NAMES.CLAW,
178
- // SKILL_NAMES.DISTURBING_PRESENCE,
178
+ SKILL_NAMES.DISTURBING_PRESENCE,
179
179
  SKILL_NAMES.FRENZY,
180
180
  [SKILL_NAMES.LONER, 4],
181
181
  SKILL_NAMES.UNCHANNELLED_FURY,
package/skill.js CHANGED
@@ -1,3 +1,5 @@
1
+ const { distanceSquares } = require("./calcul");
2
+ const { hasStatusOnField } = require("./status");
1
3
  const { getTime, TYPE_TIMER } = require("./time");
2
4
 
3
5
  const BIG_GUY_LIMIT = 1;
@@ -7,6 +9,7 @@ const SPECIALIST_LIMIT = 6;
7
9
  const SKILL_INFO_ACTIVE = "active";
8
10
  const SKILL_INFO_INACTIVE = "inactive";
9
11
 
12
+ // Missing for races
10
13
  const SKILL_NAMES = {
11
14
  ACCURATE: "accurate",
12
15
  ALWAYS_HUNGRY: "always-hungry",
@@ -24,6 +27,7 @@ const SKILL_NAMES = {
24
27
  DAUNTLESS: "dauntless",
25
28
  DEFENSIVE: "defensive",
26
29
  DIRTY_PLAYER: "dirty-player",
30
+ DISTURBING_PRESENCE: "distrubing-presence",
27
31
  DODGE: "dodge",
28
32
  DUMP_OFF: "dump-off",
29
33
  FEND: "fend",
@@ -38,6 +42,7 @@ const SKILL_NAMES = {
38
42
  LONER: "loner",
39
43
  MIGHTY_BLOW: "mighty-blow",
40
44
  NERVES_OF_STEEL: "nerves-of-steel",
45
+ ON_THE_BALL: "on-the-ball",
41
46
  PASS: "pass",
42
47
  PILE_DRIVER: "pile-driver",
43
48
  PREHENSILE_TAIL: "prehensile-tail",
@@ -47,6 +52,7 @@ const SKILL_NAMES = {
47
52
  RIGHT_STUFF: "right-stuff",
48
53
  RUNNING_PASS: "running-pass",
49
54
  SAFE_PASS: "safe-pass",
55
+ SHADOWING: "shadowing",
50
56
  SNEAKY_GIT: "sneaky-git",
51
57
  SPECIALIST: "specialist",
52
58
  SPRINT: "sprint",
@@ -98,6 +104,7 @@ const SKILLS = {
98
104
  [SKILL_NAMES.DAUNTLESS]: SKILL_TYPE.GENERAL,
99
105
  [SKILL_NAMES.DEFENSIVE]: SKILL_TYPE.AGILITY,
100
106
  [SKILL_NAMES.DIRTY_PLAYER]: SKILL_TYPE.GENERAL,
107
+ [SKILL_NAMES.DISTURBING_PRESENCE]: SKILL_TYPE.MUTATION,
101
108
  [SKILL_NAMES.DODGE]: SKILL_TYPE.AGILITY,
102
109
  [SKILL_NAMES.DUMP_OFF]: SKILL_TYPE.PASSING,
103
110
  [SKILL_NAMES.FEND]: SKILL_TYPE.GENERAL,
@@ -112,6 +119,7 @@ const SKILLS = {
112
119
  [SKILL_NAMES.LONER]: SKILL_TYPE.EXTRAORDINARY,
113
120
  [SKILL_NAMES.MIGHTY_BLOW]: SKILL_TYPE.STRENGTH,
114
121
  [SKILL_NAMES.NERVES_OF_STEEL]: SKILL_TYPE.PASSING,
122
+ [SKILL_NAMES.ON_THE_BALL]: SKILL_TYPE.PASSING,
115
123
  [SKILL_NAMES.PASS]: SKILL_TYPE.PASSING,
116
124
  [SKILL_NAMES.PILE_DRIVER]: SKILL_TYPE.STRENGTH,
117
125
  [SKILL_NAMES.PREHENSILE_TAIL]: SKILL_TYPE.MUTATION,
@@ -121,6 +129,7 @@ const SKILLS = {
121
129
  [SKILL_NAMES.RIGHT_STUFF]: SKILL_TYPE.EXTRAORDINARY,
122
130
  [SKILL_NAMES.RUNNING_PASS]: SKILL_TYPE.PASSING,
123
131
  [SKILL_NAMES.SAFE_PASS]: SKILL_TYPE.PASSING,
132
+ [SKILL_NAMES.SHADOWING]: SKILL_TYPE.GENERAL,
124
133
  [SKILL_NAMES.SNEAKY_GIT]: SKILL_TYPE.AGILITY,
125
134
  [SKILL_NAMES.SPECIALIST]: SKILL_TYPE.EXTRAORDINARY,
126
135
  [SKILL_NAMES.SPRINT]: SKILL_TYPE.AGILITY,
@@ -211,6 +220,7 @@ const isActivableSkills = (skill) => {
211
220
  SKILL_NAMES.PILE_DRIVER,
212
221
  SKILL_NAMES.TENTACLES,
213
222
  SKILL_NAMES.WRESTLE,
223
+ SKILL_NAMES.SHADOWING,
214
224
  ];
215
225
  return activables.includes(skill);
216
226
  };
@@ -254,6 +264,30 @@ function getSkillLimitSizeTeam(player, teamPlayers) {
254
264
  return null;
255
265
  }
256
266
 
267
+ /*
268
+ DISTURBING PRESENCE
269
+ When an opposition player performs either a
270
+ Pass action,
271
+ a Throw Team- mate action
272
+ or a Throw Bomb Special action,
273
+ or attempts to either interfere with a pass
274
+ or to catch the ball,
275
+ they must apply a -1 modifier to the test for each player on your team with this Skill
276
+ that is within three squares of them,
277
+ even if the player with this Skill is Prone,
278
+ Stunned or has lost their Tackle Zone. */
279
+ function getDisturbingPresenceMalus(player, players) {
280
+ const malus = players.filter((p) => {
281
+ return (
282
+ p.teamId !== player.teamId &&
283
+ hasStatusOnField(p) &&
284
+ hasSkill(p, SKILL_NAMES.DISTURBING_PRESENCE) &&
285
+ distanceSquares(player, p, 3)
286
+ );
287
+ }).length;
288
+ return malus;
289
+ }
290
+
257
291
  module.exports = {
258
292
  BIG_GUY_LIMIT,
259
293
  getPlayersWithSkill,
@@ -268,4 +302,5 @@ module.exports = {
268
302
  SKILL_NAMES,
269
303
  SKILLS,
270
304
  useSkill,
305
+ getDisturbingPresenceMalus,
271
306
  };