DemonRace.java 3.4 KB

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