enefel 1.0.105 → 1.0.106

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 (3) hide show
  1. package/package.json +1 -1
  2. package/race.js +7 -0
  3. package/skill.js +12 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enefel",
3
- "version": "1.0.105",
3
+ "version": "1.0.106",
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)