You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

297 lines
6.1 KiB

  1. module.exports = {
  2. name: 'Necromancer Class',
  3. extraScripts: [
  4. 'spells/spellHarvestLife',
  5. 'spells/spellSummonSkeleton',
  6. 'spells/spellBloodBarrier'
  7. ],
  8. init: function () {
  9. this.events.on('onBeforeGetSkins', this.beforeGetSkins.bind(this));
  10. this.events.on('onBeforeGetItemTypes', this.beforeGetItemTypes.bind(this));
  11. this.events.on('onBeforeGetSpellsInfo', this.beforeGetSpellsInfo.bind(this));
  12. this.events.on('onBeforeGetSpellsConfig', this.beforeGetSpellsConfig.bind(this));
  13. this.events.on('onBeforeGetSpellTemplate', this.beforeGetSpellTemplate.bind(this));
  14. this.events.on('onBeforeGetResourceList', this.beforeGetResourceList.bind(this));
  15. this.events.on('onBeforeGetAnimations', this.beforeGetAnimations.bind(this));
  16. this.events.on('onAfterGetZone', this.onAfterGetZone.bind(this));
  17. },
  18. onAfterGetZone: function (zone, config) {
  19. if (zone !== 'fjolarok')
  20. return;
  21. let newRunes = [{
  22. generate: true,
  23. spell: true,
  24. spellQuality: 'basic',
  25. infinite: true,
  26. spellName: 'harvest life',
  27. worth: 3
  28. }, {
  29. generate: true,
  30. spell: true,
  31. spellQuality: 'basic',
  32. infinite: true,
  33. spellName: 'summon skeleton',
  34. worth: 3
  35. }];
  36. let vikarTrade = config.mobs.vikar.properties.cpnTrade;
  37. Array.prototype.push.apply(vikarTrade.items.extra, newRunes);
  38. },
  39. beforeGetAnimations: function (animations) {
  40. let spritesheet = `${this.folderName}/images/inGameSprite.png`;
  41. animations.mobs[spritesheet] = {
  42. 0: {
  43. magic: {
  44. spritesheet: spritesheet,
  45. row: 0,
  46. col: 1,
  47. frames: 4,
  48. frameDelay: 4
  49. },
  50. melee: {
  51. spritesheet: spritesheet,
  52. row: 1,
  53. col: 1,
  54. frames: 3,
  55. frameDelay: 4
  56. }
  57. }
  58. };
  59. //Skeleton animations
  60. let mobsheet = `${this.folderName}/images/mobs.png`;
  61. if (!animations.mobs[mobsheet])
  62. animations.mobs[mobsheet] = {};
  63. animations.mobs[mobsheet]['0'] = {
  64. melee: {
  65. spritesheet: mobsheet,
  66. row: 1,
  67. col: 0,
  68. frames: 2,
  69. frameDelay: 5
  70. },
  71. spawn: {
  72. spritesheet: mobsheet,
  73. row: 2,
  74. col: 0,
  75. frames: 3,
  76. frameDelay: 4,
  77. hideSprite: true,
  78. type: 'attackAnimation'
  79. },
  80. death: {
  81. spritesheet: mobsheet,
  82. row: 3,
  83. col: 0,
  84. frames: 4,
  85. frameDelay: 4,
  86. type: 'attackAnimation'
  87. }
  88. };
  89. },
  90. beforeGetResourceList: function (list) {
  91. list.push(`${this.folderName}/images/inGameSprite.png`);
  92. list.push(`${this.folderName}/images/abilityIcons.png`);
  93. list.push(`${this.folderName}/images/mobs.png`);
  94. },
  95. beforeGetSpellTemplate: function (spell) {
  96. if (spell.type === 'HarvestLife')
  97. spell.template = require('./spells/spellHarvestLife');
  98. else if (spell.type === 'SummonSkeleton')
  99. spell.template = require('./spells/spellSummonSkeleton');
  100. else if (spell.type === 'BloodBarrier')
  101. spell.template = require('./spells/spellBloodBarrier');
  102. },
  103. beforeGetSkins: function (skins) {
  104. skins['1.8'] = {
  105. name: 'Necromancer 1',
  106. sprite: [0, 0],
  107. spritesheet: `${this.folderName}/images/inGameSprite.png`
  108. };
  109. },
  110. beforeGetItemTypes: function (types) {
  111. ['Sickle', 'Jade Sickle', 'Golden Sickle', 'Bone Sickle'].forEach(function (s, i) {
  112. types.oneHanded[s] = {
  113. spritesheet: `${this.folderName}/images/items.png`,
  114. sprite: [i, 0],
  115. spellName: 'melee',
  116. attrRequire: ['int'],
  117. spellConfig: {
  118. statType: ['str', 'int'],
  119. statMult: 0.76,
  120. cdMax: 6,
  121. useWeaponRange: true,
  122. random: {
  123. damage: [1.5, 5.7]
  124. }
  125. },
  126. implicitStat: {
  127. stat: 'attackSpeed',
  128. value: [1, 5]
  129. }
  130. };
  131. }, this);
  132. },
  133. beforeGetSpellsConfig: function (spells) {
  134. spells['harvest life'] = {
  135. statType: ['str', 'int'],
  136. statMult: 1,
  137. cdMax: 12,
  138. manaCost: 5,
  139. range: 1,
  140. random: {
  141. damage: [3, 11],
  142. healPercent: [10, 30]
  143. }
  144. };
  145. spells['summon skeleton'] = {
  146. statType: ['str', 'int'],
  147. statMult: 0.27,
  148. cdMax: 7,
  149. manaCost: 5,
  150. range: 9,
  151. random: {
  152. damagePercent: [20, 76],
  153. hpPercent: [40, 60]
  154. }
  155. };
  156. spells['blood barrier'] = {
  157. statType: ['str', 'int'],
  158. statMult: 0.1,
  159. cdMax: 20,
  160. manaCost: 5,
  161. range: 9,
  162. random: {
  163. i_drainPercentage: [10, 50],
  164. shieldMultiplier: [2, 5],
  165. i_frenzyDuration: [5, 15]
  166. }
  167. };
  168. },
  169. beforeGetSpellsInfo: function (spells) {
  170. spells.push({
  171. name: 'Harvest Life',
  172. description: 'Absorbs the life-force of your enemies.',
  173. type: 'harvestLife',
  174. icon: [0, 0],
  175. animation: 'melee',
  176. spritesheet: `${this.folderName}/images/abilityIcons.png`,
  177. particles: {
  178. color: {
  179. start: ['ff4252', 'b34b3a'],
  180. end: ['b34b3a', 'ff4252']
  181. },
  182. scale: {
  183. start: {
  184. min: 2,
  185. max: 14
  186. },
  187. end: {
  188. min: 0,
  189. max: 8
  190. }
  191. },
  192. lifetime: {
  193. min: 1,
  194. max: 3
  195. },
  196. alpha: {
  197. start: 0.7,
  198. end: 0
  199. },
  200. randomScale: true,
  201. randomColor: true,
  202. chance: 0.6
  203. }
  204. });
  205. spells.push({
  206. name: 'Summon Skeleton',
  207. description: 'Summons a skeletal warrior to assist you in combat.',
  208. type: 'summonSkeleton',
  209. icon: [1, 0],
  210. animation: 'magic',
  211. spritesheet: `${this.folderName}/images/abilityIcons.png`,
  212. particles: {
  213. color: {
  214. start: ['ff4252', 'b34b3a'],
  215. end: ['b34b3a', 'ff4252']
  216. },
  217. scale: {
  218. start: {
  219. min: 2,
  220. max: 14
  221. },
  222. end: {
  223. min: 0,
  224. max: 8
  225. }
  226. },
  227. lifetime: {
  228. min: 1,
  229. max: 3
  230. },
  231. alpha: {
  232. start: 0.7,
  233. end: 0
  234. },
  235. randomScale: true,
  236. randomColor: true,
  237. chance: 0.6
  238. }
  239. });
  240. spells.push({
  241. name: 'Blood Barrier',
  242. description: 'Sacrifice some life force to grant an ally a protective barrier and increased attack speed.',
  243. type: 'bloodBarrier',
  244. icon: [2, 0],
  245. animation: 'magic',
  246. spellType: 'buff',
  247. spritesheet: `${this.folderName}/images/abilityIcons.png`,
  248. particles: {
  249. color: {
  250. start: ['ff4252', 'b34b3a'],
  251. end: ['b34b3a', 'ff4252']
  252. },
  253. scale: {
  254. start: {
  255. min: 2,
  256. max: 14
  257. },
  258. end: {
  259. min: 0,
  260. max: 8
  261. }
  262. },
  263. lifetime: {
  264. min: 1,
  265. max: 3
  266. },
  267. alpha: {
  268. start: 0.7,
  269. end: 0
  270. },
  271. randomScale: true,
  272. randomColor: true,
  273. chance: 0.6
  274. }
  275. });
  276. }
  277. };