@reldens/skills 0.5.0-beta.5 → 0.10.0-beta.21

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 (36) hide show
  1. package/index.js +0 -1
  2. package/lib/class-path.js +7 -2
  3. package/lib/client/receiver.js +2 -2
  4. package/lib/level.js +8 -4
  5. package/lib/levels-set.js +7 -2
  6. package/lib/server/data-server-validator.js +30 -0
  7. package/lib/server/sender.js +1 -1
  8. package/lib/server/storage/models/{class-path-level-labels.js → objection-js/class-path-level-labels-model.js} +7 -7
  9. package/lib/server/storage/models/{class-path-level-skills.js → objection-js/class-path-level-skills-model.js} +9 -9
  10. package/lib/server/storage/models/{class-path.js → objection-js/class-path-model.js} +11 -11
  11. package/lib/server/storage/models/{level.js → objection-js/level-model.js} +7 -7
  12. package/lib/server/storage/models/{level-modifiers.js → objection-js/level-modifiers-model.js} +5 -5
  13. package/lib/server/storage/models/{levels-set.js → objection-js/levels-set-model.js} +7 -7
  14. package/lib/server/storage/models/objection-js/owners-class-path-model.js +35 -0
  15. package/lib/server/storage/models/{registered-entities.js → objection-js/registered-entities-objection-js.js} +14 -14
  16. package/lib/server/storage/models/{skill-attack.js → objection-js/skill-attack.js} +5 -5
  17. package/lib/server/storage/models/{skill-group-relation.js → objection-js/skill-group-relation.js} +7 -7
  18. package/lib/server/storage/models/{skill.js → objection-js/skill-model.js} +15 -15
  19. package/lib/server/storage/models/{skill-owner-conditions.js → objection-js/skill-owner-conditions-model.js} +5 -5
  20. package/lib/server/storage/models/{skill-owner-effects.js → objection-js/skill-owner-effects-model.js} +5 -5
  21. package/lib/server/storage/models/{skill-physical-data.js → objection-js/skill-physical-data-model.js} +5 -5
  22. package/lib/server/storage/models/{skill-target-effects.js → objection-js/skill-target-effects-model.js} +5 -5
  23. package/lib/server/storage/models/{skills-groups.js → objection-js/skills-groups-model.js} +4 -4
  24. package/lib/server/storage/models-manager.js +15 -27
  25. package/lib/server/storage-observer.js +4 -4
  26. package/lib/server.js +3 -1
  27. package/lib/skill.js +47 -37
  28. package/lib/types/attack.js +4 -6
  29. package/lib/types/effect.js +2 -2
  30. package/lib/types/physical-attack.js +8 -27
  31. package/lib/types/physical-effect.js +8 -27
  32. package/lib/types/physical-properties-validator.js +30 -0
  33. package/lib/types/physical-skill-runner.js +31 -0
  34. package/package.json +4 -4
  35. package/lib/server/storage/models/index.js +0 -34
  36. package/lib/server/storage/models/owners-class-path.js +0 -49
@@ -0,0 +1,31 @@
1
+ /**
2
+ *
3
+ * Reldens - Skills - PhysicalSkillRunner
4
+ *
5
+ */
6
+
7
+ class PhysicalSkillRunner
8
+ {
9
+
10
+ static async runSkillLogic(skill)
11
+ {
12
+ if(!skill.validateRange(skill.target)){
13
+ // out of range, the owner or the target could moved away
14
+ return false;
15
+ }
16
+ await skill.owner.executePhysicalSkill(skill.target, skill);
17
+ return false;
18
+ }
19
+
20
+ static async executeOnHit(target, skill, skillType)
21
+ {
22
+ await skill.fireEvent(skillType, skill, target);
23
+ if(!skill.validateTargetOnHit || target === skill.target){
24
+ return await super.runSkillLogic(target);
25
+ }
26
+ return false;
27
+ }
28
+
29
+ }
30
+
31
+ module.exports.PhysicalSkillRunner = PhysicalSkillRunner;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@reldens/skills",
3
3
  "scope": "@reldens",
4
- "version": "0.5.0-beta.5",
4
+ "version": "0.10.0-beta.21",
5
5
  "description": "Reldens - Skills",
6
6
  "author": "Damian A. Pastorini",
7
7
  "license": "MIT",
@@ -40,8 +40,8 @@
40
40
  "url": "https://github.com/damian-pastorini/reldens-skills/issues"
41
41
  },
42
42
  "dependencies": {
43
- "@reldens/modifiers": "^0.4.7",
44
- "@reldens/storage": "^0.5.0-beta.8",
45
- "@reldens/utils": "^0.4.6"
43
+ "@reldens/modifiers": "^0.5.0",
44
+ "@reldens/storage": "^0.10.0-beta.21",
45
+ "@reldens/utils": "^0.5.0"
46
46
  }
47
47
  }
@@ -1,34 +0,0 @@
1
-
2
- const { ClassPathModel } = require('./class-path');
3
- const { ClassPathLevelLabelsModel } = require('./class-path-level-labels');
4
- const { ClassPathLevelSkillsModel } = require('./class-path-level-skills');
5
- const { LevelModel } = require('./level');
6
- const { LevelModifiersModels } = require('./level-modifiers');
7
- const { LevelsSetModel } = require('./levels-set');
8
- const { OwnersClassPathModel } = require('./owners-class-path');
9
- const { SkillModel } = require('./skill');
10
- const { SkillAttackModel } = require('./skill-attack');
11
- const { SkillTargetEffectsModel } = require('./skill-target-effects');
12
- const { SkillPhysicalDataModel } = require('./skill-physical-data');
13
- const { SkillGroupRelationModel } = require('./skill-group-relation');
14
- const { SkillOwnerConditionsModel } = require('./skill-owner-conditions');
15
- const { SkillOwnerEffectsModel } = require('./skill-owner-effects');
16
- const { SkillsGroupsModel } = require('./skills-groups');
17
-
18
- module.exports = {
19
- classPath: ClassPathModel,
20
- classPathLevelLabels: ClassPathLevelLabelsModel,
21
- classPathLevelSkills: ClassPathLevelSkillsModel,
22
- level: LevelModel,
23
- levelModifiers: LevelModifiersModels,
24
- levelsSet: LevelsSetModel,
25
- ownersClassPath: OwnersClassPathModel,
26
- skill: SkillModel,
27
- skillAttack: SkillAttackModel,
28
- skillTargetEffects: SkillTargetEffectsModel,
29
- skillPhysicalData: SkillPhysicalDataModel,
30
- skillGroupRelation: SkillGroupRelationModel,
31
- skillOwnerConditions: SkillOwnerConditionsModel,
32
- skillOwnerEffects: SkillOwnerEffectsModel,
33
- skillGroups: SkillsGroupsModel
34
- };
@@ -1,49 +0,0 @@
1
- /**
2
- *
3
- * Reldens - Skills - OwnersClassPathModel
4
- *
5
- */
6
-
7
- const { ModelClassDeprecated } = require('@reldens/storage');
8
- const SkillsConst = require('../../../constants');
9
-
10
- class OwnersClassPathModel extends ModelClassDeprecated
11
- {
12
-
13
- static get tableName()
14
- {
15
- return SkillsConst.MODELS_PREFIX+'owners_class_path';
16
- }
17
-
18
- static get relationMappings()
19
- {
20
- const { ClassPathModel } = require('./class-path');
21
- return {
22
- owner_full_class_path: {
23
- relation: ModelClassDeprecated.HasOneRelation,
24
- modelClass: ClassPathModel,
25
- join: {
26
- from: this.tableName+'.class_path_id',
27
- to: ClassPathModel.tableName+'.id'
28
- }
29
- }
30
- };
31
- }
32
-
33
- static async loadOwnerClassPath(ownerId)
34
- {
35
- return this.query()
36
- .where('owner_id', ownerId)
37
- .withGraphFetched('[owner_full_class_path]');
38
- }
39
-
40
- static async updateByOwner(ownerId, patchData)
41
- {
42
- return this.query()
43
- .patch(patchData)
44
- .where('owner_id', ownerId);
45
- }
46
-
47
- }
48
-
49
- module.exports.OwnersClassPathModel = OwnersClassPathModel;