DemonRace.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright (C) 2004-2013 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package transformations;
  20. import com.l2jserver.gameserver.datatables.SkillTable;
  21. import com.l2jserver.gameserver.instancemanager.TransformationManager;
  22. import com.l2jserver.gameserver.model.L2Transformation;
  23. /*
  24. * TODO: Skill levels. How do they work? Transformation is given at level 83, there are 6 levels of the skill. How are they assigned? Based on player level somehow? Based on servitor?
  25. */
  26. public class DemonRace extends L2Transformation
  27. {
  28. private static final int[] SKILLS =
  29. {
  30. 901,
  31. 902,
  32. 903,
  33. 904,
  34. 905,
  35. 5491,
  36. 619
  37. };
  38. public DemonRace()
  39. {
  40. // id, colRadius, colHeight
  41. super(221, 11, 27);
  42. }
  43. @Override
  44. public void onTransform()
  45. {
  46. if ((getPlayer().getTransformationId() != 221) || getPlayer().isCursedWeaponEquipped())
  47. {
  48. return;
  49. }
  50. if (getPlayer().hasSummon())
  51. {
  52. getPlayer().getSummon().unSummon(getPlayer());
  53. }
  54. transformedSkills();
  55. }
  56. @Override
  57. public void onUntransform()
  58. {
  59. removeSkills();
  60. }
  61. public void removeSkills()
  62. {
  63. // Dark Strike
  64. getPlayer().removeSkill(SkillTable.getInstance().getInfo(901, 4), false);
  65. // Bursting Flame
  66. getPlayer().removeSkill(SkillTable.getInstance().getInfo(902, 4), false);
  67. // Stratum Explosion
  68. getPlayer().removeSkill(SkillTable.getInstance().getInfo(903, 4), false);
  69. // Corpse Burst
  70. getPlayer().removeSkill(SkillTable.getInstance().getInfo(904, 4), false);
  71. // Dark Detonation
  72. getPlayer().removeSkill(SkillTable.getInstance().getInfo(905, 4), false);
  73. // Decrease Bow/Crossbow Attack Speed
  74. getPlayer().removeSkill(SkillTable.getInstance().getInfo(5491, 1), false);
  75. // Transform Dispel
  76. getPlayer().removeSkill(SkillTable.getInstance().getInfo(619, 1), false);
  77. getPlayer().setTransformAllowedSkills(EMPTY_ARRAY);
  78. }
  79. public void transformedSkills()
  80. {
  81. // Dark Strike (up to 6)
  82. getPlayer().addSkill(SkillTable.getInstance().getInfo(901, 4), false);
  83. // Bursting Flame (up to 6)
  84. getPlayer().addSkill(SkillTable.getInstance().getInfo(902, 4), false);
  85. // Stratum Explosion (up to 6)
  86. getPlayer().addSkill(SkillTable.getInstance().getInfo(903, 4), false);
  87. // Corpse Burst (up to 6)
  88. getPlayer().addSkill(SkillTable.getInstance().getInfo(904, 4), false);
  89. // Dark Detonation (up to 6)
  90. getPlayer().addSkill(SkillTable.getInstance().getInfo(905, 4), false);
  91. // Decrease Bow/Crossbow Attack Speed
  92. getPlayer().addSkill(SkillTable.getInstance().getInfo(5491, 1), false);
  93. // Transform Dispel
  94. getPlayer().addSkill(SkillTable.getInstance().getInfo(619, 1), false);
  95. getPlayer().setTransformAllowedSkills(SKILLS);
  96. }
  97. public static void main(String[] args)
  98. {
  99. TransformationManager.getInstance().registerTransformation(new DemonRace());
  100. }
  101. }