enefel 1.0.81 → 1.0.85
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/index.js +19 -10
- package/meteo.js +144 -0
- package/package.json +1 -1
- package/random.js +6 -2
- package/skill.js +12 -3
- package/skillCoach.js +2 -0
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
hasStatusCanFaceup,
|
|
10
10
|
hasStatusCanStandup,
|
|
11
11
|
} = require("./status");
|
|
12
|
-
|
|
12
|
+
const { meteoAttackerStrengthBlitz, meteoMaxPassDistance } = require("./meteo");
|
|
13
13
|
const INITIAL_REROLL = 2;
|
|
14
14
|
const POSTULATION_HOURS = 24;
|
|
15
15
|
const INACTIVE_DAYS = 10;
|
|
@@ -144,6 +144,7 @@ const GAME_HISTORY_INFO = {
|
|
|
144
144
|
KO: "ko",
|
|
145
145
|
LANDING: "la",
|
|
146
146
|
LEAP: "l",
|
|
147
|
+
METEO: "met",
|
|
147
148
|
MOVE: "m",
|
|
148
149
|
PASS: "p",
|
|
149
150
|
REJECTION: "r",
|
|
@@ -156,6 +157,7 @@ const GAME_HISTORY_INFO = {
|
|
|
156
157
|
STATUS: "s",
|
|
157
158
|
TAKE_BALL: "t",
|
|
158
159
|
TD: "td",
|
|
160
|
+
THREATENING: "thr",
|
|
159
161
|
THROW_TEAM_MATE: "ttm",
|
|
160
162
|
TURNOVER: "to",
|
|
161
163
|
};
|
|
@@ -229,10 +231,6 @@ const p = (x, y) => {
|
|
|
229
231
|
return { x: +x, y: +y };
|
|
230
232
|
};
|
|
231
233
|
|
|
232
|
-
const getRandomNumber = (min, max, r = Math.random) => {
|
|
233
|
-
return Math.floor(r() * (max - min + 1)) + min;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
234
|
function shuffleArray(array) {
|
|
237
235
|
return [...array].sort(() => 0.5 - Math.random());
|
|
238
236
|
}
|
|
@@ -592,7 +590,7 @@ const isOnLine = (A, B, C) => {
|
|
|
592
590
|
return AC + BC >= AB - 0.1 && AC + BC <= AB + 0.7 && AC < AB;
|
|
593
591
|
};
|
|
594
592
|
|
|
595
|
-
const getThrowingBonus = (p1, p2) => {
|
|
593
|
+
const getThrowingBonus = (p1, p2, game) => {
|
|
596
594
|
if (
|
|
597
595
|
!(
|
|
598
596
|
Number.isInteger(p1.x) &&
|
|
@@ -616,7 +614,7 @@ const getThrowingBonus = (p1, p2) => {
|
|
|
616
614
|
//empireoublie.free.fr/docs/table_intercept.pdf
|
|
617
615
|
//https://play.google.com/store/apps/details?id=com.cyberedelf.interception
|
|
618
616
|
|
|
619
|
-
if (dist < 1 || dist >=
|
|
617
|
+
if (dist < 1 || dist >= meteoMaxPassDistance(game.meteo)) {
|
|
620
618
|
return null;
|
|
621
619
|
}
|
|
622
620
|
if (dist >= 1 && dist < 3.5) {
|
|
@@ -848,16 +846,29 @@ const getMoralModifier = (player) => {
|
|
|
848
846
|
return race.cost / 10 + range;
|
|
849
847
|
};
|
|
850
848
|
|
|
849
|
+
const getAttackerStrength = (player, isBlitz, meteoValue) => {
|
|
850
|
+
let bonus = isBlitz ? meteoAttackerStrengthBlitz(meteoValue) : 0;
|
|
851
|
+
bonus += isBlitz && hasSkill(attacker, SKILL_NAMES.HORNS) ? 1 : 0;
|
|
852
|
+
return player.current_ST + bonus;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
const getDefenderStrength = (player) => {
|
|
856
|
+
return player.current_ST;
|
|
857
|
+
};
|
|
858
|
+
|
|
851
859
|
module.exports = {
|
|
860
|
+
getDefenderStrength,
|
|
852
861
|
addSeconds,
|
|
853
862
|
availableSquaresToPushBack,
|
|
854
863
|
canBlock,
|
|
864
|
+
canEndTurn,
|
|
855
865
|
canFaceUp,
|
|
856
866
|
canFoul,
|
|
857
867
|
canMove,
|
|
858
868
|
canPass,
|
|
859
869
|
canPlayerIntercepts,
|
|
860
870
|
canStandup,
|
|
871
|
+
canThrowTeamMate,
|
|
861
872
|
canTransmit,
|
|
862
873
|
distance,
|
|
863
874
|
FORMATION_DEFAULT_NAME,
|
|
@@ -865,6 +876,7 @@ module.exports = {
|
|
|
865
876
|
GAME_HISTORY_TYPE,
|
|
866
877
|
GAME_STATUS,
|
|
867
878
|
GAME_TYPE,
|
|
879
|
+
getAttackerStrength,
|
|
868
880
|
getBestInterceptor,
|
|
869
881
|
getBlockAssistance,
|
|
870
882
|
getCareers,
|
|
@@ -873,7 +885,6 @@ module.exports = {
|
|
|
873
885
|
getMaxGfi,
|
|
874
886
|
getMoralModifier,
|
|
875
887
|
getPlayerOnCell,
|
|
876
|
-
getRandomNumber,
|
|
877
888
|
getTeamColor,
|
|
878
889
|
getThrowingBonus,
|
|
879
890
|
haveSameTeam,
|
|
@@ -895,7 +906,5 @@ module.exports = {
|
|
|
895
906
|
PLAYER_STAT,
|
|
896
907
|
POSTULATION_HOURS,
|
|
897
908
|
shuffleArray,
|
|
898
|
-
canThrowTeamMate,
|
|
899
|
-
canEndTurn,
|
|
900
909
|
TAKE_BALL_TYPE,
|
|
901
910
|
};
|
package/meteo.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
const METEO = {
|
|
2
|
+
AUTUMN_LEAF_STREWN_PITCH: 1,
|
|
3
|
+
AUTUMNAL_CHILL: 2,
|
|
4
|
+
POURING_RAIN: 3,
|
|
5
|
+
STRONG_WINDS: 4,
|
|
6
|
+
COLD_WINDS: 5,
|
|
7
|
+
FREEZING: 6,
|
|
8
|
+
PERFECT_CONDITION: 7,
|
|
9
|
+
HEAVY_SNOW: 8,
|
|
10
|
+
BLIZZARD: 9,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const SEASON = {
|
|
14
|
+
AUTUMN: 4,
|
|
15
|
+
SPRING: 2,
|
|
16
|
+
SUMMER: 3,
|
|
17
|
+
WINTER: 1,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const getSeason = () => {
|
|
21
|
+
return SEASON.WINTER;
|
|
22
|
+
// return SEASON.AUTUMN;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getMeteo = (value) => {
|
|
26
|
+
const season = getSeason();
|
|
27
|
+
if (season === SEASON.WINTER) {
|
|
28
|
+
switch (value) {
|
|
29
|
+
case 2:
|
|
30
|
+
return METEO.COLD_WINDS;
|
|
31
|
+
case 3:
|
|
32
|
+
return METEO.FREEZING;
|
|
33
|
+
case 11:
|
|
34
|
+
return METEO.HEAVY_SNOW;
|
|
35
|
+
case 12:
|
|
36
|
+
return METEO.BLIZZARD;
|
|
37
|
+
default:
|
|
38
|
+
return METEO.PERFECT_CONDITION;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (season === SEASON.AUTUMN) {
|
|
42
|
+
switch (value) {
|
|
43
|
+
case 2:
|
|
44
|
+
return METEO.AUTUMN_LEAF_STREWN_PITCH;
|
|
45
|
+
case 3:
|
|
46
|
+
return METEO.AUTUMNAL_CHILL;
|
|
47
|
+
case 11:
|
|
48
|
+
return METEO.POURING_RAIN;
|
|
49
|
+
case 12:
|
|
50
|
+
return METEO.STRONG_WINDS;
|
|
51
|
+
default:
|
|
52
|
+
return METEO.PERFECT_CONDITION;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return METEO.PERFECT_CONDITION;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const meteoAttackerStrengthBlitz = (meteoValue) => {
|
|
59
|
+
let modif = 0;
|
|
60
|
+
if (meteoValue === METEO.FREEZING) {
|
|
61
|
+
modif = -1;
|
|
62
|
+
}
|
|
63
|
+
return modif;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const meteoPlayerFall = (meteoValue) => {
|
|
67
|
+
let modif = 0;
|
|
68
|
+
if (meteoValue === METEO.AUTUMN_LEAF_STREWN_PITCH) {
|
|
69
|
+
modif = -1;
|
|
70
|
+
}
|
|
71
|
+
if (meteoValue === METEO.FREEZING) {
|
|
72
|
+
modif = 1;
|
|
73
|
+
}
|
|
74
|
+
return modif;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const meteoKO = (meteoValue) => {
|
|
78
|
+
let modif = 0;
|
|
79
|
+
if (meteoValue === METEO.AUTUMNAL_CHILL) {
|
|
80
|
+
modif = -1;
|
|
81
|
+
}
|
|
82
|
+
if (meteoValue === METEO.COLD_WINDS) {
|
|
83
|
+
modif = -1;
|
|
84
|
+
}
|
|
85
|
+
return modif;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const meteoTakeBall = (meteoValue) => {
|
|
89
|
+
let modif = 0;
|
|
90
|
+
if (meteoValue === METEO.POURING_RAIN) {
|
|
91
|
+
modif = -1;
|
|
92
|
+
}
|
|
93
|
+
return modif;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const meteoPassRebound = (meteoValue) => {
|
|
97
|
+
let modif = 0;
|
|
98
|
+
if (meteoValue === METEO.STRONG_WINDS) {
|
|
99
|
+
modif = 3;
|
|
100
|
+
}
|
|
101
|
+
return modif;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const meteoPassBonus = (meteoValue) => {
|
|
105
|
+
let modif = 0;
|
|
106
|
+
if (meteoValue === METEO.STRONG_WINDS) {
|
|
107
|
+
modif = -1;
|
|
108
|
+
}
|
|
109
|
+
if (meteoValue === METEO.COLD_WINDS) {
|
|
110
|
+
modif = -1;
|
|
111
|
+
}
|
|
112
|
+
return modif;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const meteoGfi = (meteoValue) => {
|
|
116
|
+
let modif = 0;
|
|
117
|
+
if (meteoValue === METEO.BLIZZARD) {
|
|
118
|
+
modif = -1;
|
|
119
|
+
}
|
|
120
|
+
return modif;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const meteoMaxPassDistance = (meteoValue) => {
|
|
124
|
+
// 3.5, 7, 10.2, 13.1
|
|
125
|
+
let max = 14;
|
|
126
|
+
if (meteoValue === METEO.BLIZZARD) {
|
|
127
|
+
max = 7;
|
|
128
|
+
}
|
|
129
|
+
return max;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const tools = {
|
|
133
|
+
getMeteo,
|
|
134
|
+
METEO,
|
|
135
|
+
meteoAttackerStrengthBlitz,
|
|
136
|
+
meteoGfi,
|
|
137
|
+
meteoKO,
|
|
138
|
+
meteoMaxPassDistance,
|
|
139
|
+
meteoPassBonus,
|
|
140
|
+
meteoPassRebound,
|
|
141
|
+
meteoPlayerFall,
|
|
142
|
+
meteoTakeBall,
|
|
143
|
+
};
|
|
144
|
+
module.exports = tools;
|
package/package.json
CHANGED
package/random.js
CHANGED
|
@@ -7,8 +7,12 @@ const rollDice = (quantity, max) => {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
const tools = {
|
|
10
|
-
getRandomNumber: (min, max) => {
|
|
11
|
-
return Math.floor(
|
|
10
|
+
getRandomNumber: (min, max, r = Math.random) => {
|
|
11
|
+
return Math.floor(r() * (max - min + 1)) + min;
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
d8: (quantity = 1, max = 8) => {
|
|
15
|
+
return rollDice(quantity, max);
|
|
12
16
|
},
|
|
13
17
|
|
|
14
18
|
d6: (quantity = 1, max = 6) => {
|
package/skill.js
CHANGED
|
@@ -28,8 +28,10 @@ const SKILL_NAMES = {
|
|
|
28
28
|
DUMP_OFF: "dump-off",
|
|
29
29
|
FEND: "fend",
|
|
30
30
|
FRENZY: "frenzy",
|
|
31
|
+
FUMBLEROOSKIE: "fumblerooskie",
|
|
31
32
|
GUARD: "guard",
|
|
32
33
|
HORNS: "horns",
|
|
34
|
+
IRON_HARD_SKIN: "iron-hard-skin",
|
|
33
35
|
JUGGERNAUT: "juggernaut",
|
|
34
36
|
JUMP_UP: "jump-up",
|
|
35
37
|
LEAP: "leap",
|
|
@@ -56,6 +58,7 @@ const SKILL_NAMES = {
|
|
|
56
58
|
SURE_FEET: "sure-feet",
|
|
57
59
|
SURE_HANDS: "sure-hands",
|
|
58
60
|
TACKLE: "tackle",
|
|
61
|
+
TENTACLES: "tentacles",
|
|
59
62
|
THICK_SKULL: "thick-skull",
|
|
60
63
|
THROW_TEAM_MATE: "throw-team-mate",
|
|
61
64
|
TWO_HEADS: "two-heads",
|
|
@@ -99,8 +102,10 @@ const SKILLS = {
|
|
|
99
102
|
[SKILL_NAMES.DUMP_OFF]: SKILL_TYPE.PASSING,
|
|
100
103
|
[SKILL_NAMES.FEND]: SKILL_TYPE.GENERAL,
|
|
101
104
|
[SKILL_NAMES.FRENZY]: SKILL_TYPE.GENERAL,
|
|
105
|
+
[SKILL_NAMES.FUMBLEROOSKIE]: SKILL_TYPE.PASSING,
|
|
102
106
|
[SKILL_NAMES.GUARD]: SKILL_TYPE.STRENGTH,
|
|
103
107
|
[SKILL_NAMES.HORNS]: SKILL_TYPE.MUTATION,
|
|
108
|
+
[SKILL_NAMES.IRON_HARD_SKIN]: SKILL_TYPE.MUTATION,
|
|
104
109
|
[SKILL_NAMES.JUGGERNAUT]: SKILL_TYPE.STRENGTH,
|
|
105
110
|
[SKILL_NAMES.JUMP_UP]: SKILL_TYPE.AGILITY,
|
|
106
111
|
[SKILL_NAMES.LEAP]: SKILL_TYPE.AGILITY,
|
|
@@ -127,6 +132,7 @@ const SKILLS = {
|
|
|
127
132
|
[SKILL_NAMES.SURE_FEET]: SKILL_TYPE.AGILITY,
|
|
128
133
|
[SKILL_NAMES.SURE_HANDS]: SKILL_TYPE.GENERAL,
|
|
129
134
|
[SKILL_NAMES.TACKLE]: SKILL_TYPE.GENERAL,
|
|
135
|
+
[SKILL_NAMES.TENTACLES]: SKILL_TYPE.MUTATION,
|
|
130
136
|
[SKILL_NAMES.THICK_SKULL]: SKILL_TYPE.STRENGTH,
|
|
131
137
|
[SKILL_NAMES.THROW_TEAM_MATE]: SKILL_TYPE.EXTRAORDINARY,
|
|
132
138
|
[SKILL_NAMES.TWO_HEADS]: SKILL_TYPE.MUTATION,
|
|
@@ -146,7 +152,9 @@ function useSkill(player, skillId, date = -1, info = null) {
|
|
|
146
152
|
}
|
|
147
153
|
const skill = playerSkills.find((s) => s.skill_id === skillId);
|
|
148
154
|
skill.date_next =
|
|
149
|
-
date === -1
|
|
155
|
+
date === -1
|
|
156
|
+
? new Date(Date.now() + getTime(TYPE_TIMER.ACTION) * 1000)
|
|
157
|
+
: date;
|
|
150
158
|
skill.info = info;
|
|
151
159
|
}
|
|
152
160
|
|
|
@@ -197,11 +205,12 @@ const getPlayersWithSkill = (players, skillId) => {
|
|
|
197
205
|
|
|
198
206
|
const isActivableSkills = (skill) => {
|
|
199
207
|
const activables = [
|
|
200
|
-
SKILL_NAMES.
|
|
208
|
+
SKILL_NAMES.BRAWLER,
|
|
201
209
|
SKILL_NAMES.DUMP_OFF,
|
|
202
210
|
SKILL_NAMES.JUGGERNAUT,
|
|
203
|
-
SKILL_NAMES.BRAWLER,
|
|
204
211
|
SKILL_NAMES.PILE_DRIVER,
|
|
212
|
+
SKILL_NAMES.TENTACLES,
|
|
213
|
+
SKILL_NAMES.WRESTLE,
|
|
205
214
|
];
|
|
206
215
|
return activables.includes(skill);
|
|
207
216
|
};
|
package/skillCoach.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const SKILL_COACH_NAMES = {
|
|
2
2
|
SPONSOR: "sponsor",
|
|
3
3
|
SPY: "spy",
|
|
4
|
+
THREATENING: "threatening",
|
|
4
5
|
};
|
|
5
6
|
|
|
6
7
|
const SKILL_COACH_TYPE = {
|
|
@@ -13,6 +14,7 @@ const SKILL_COACH_TYPE = {
|
|
|
13
14
|
const COACH_SKILLS = {
|
|
14
15
|
[SKILL_COACH_NAMES.SPONSOR]: SKILL_COACH_TYPE.GENERAL,
|
|
15
16
|
[SKILL_COACH_NAMES.SPY]: SKILL_COACH_TYPE.GENERAL,
|
|
17
|
+
[SKILL_COACH_NAMES.THREATENING]: SKILL_COACH_TYPE.GENERAL,
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
function shouldDisplayInfoInName(skillId) {
|