GuardsoftheDawn.java 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. public class GuardsoftheDawn extends L2Transformation
  24. {
  25. private static final int[] SKILLS =
  26. {
  27. 5491,
  28. 619,
  29. 963
  30. };
  31. public GuardsoftheDawn()
  32. {
  33. // id, colRadius, colHeight
  34. super(113, 8, 23.5);
  35. }
  36. @Override
  37. public void onTransform()
  38. {
  39. if ((getPlayer().getTransformationId() != 113) || getPlayer().isCursedWeaponEquipped())
  40. {
  41. return;
  42. }
  43. transformedSkills();
  44. }
  45. @Override
  46. public void onUntransform()
  47. {
  48. removeSkills();
  49. }
  50. public void removeSkills()
  51. {
  52. // Decrease Bow/Crossbow Attack Speed
  53. getPlayer().removeSkill(SkillTable.getInstance().getInfo(5491, 1), false);
  54. // Transform Dispel
  55. getPlayer().removeSkill(SkillTable.getInstance().getInfo(619, 1), false);
  56. // Guard's Ambush
  57. getPlayer().removeSkill(SkillTable.getInstance().getInfo(963, 1), false);
  58. getPlayer().setTransformAllowedSkills(EMPTY_ARRAY);
  59. }
  60. public void transformedSkills()
  61. {
  62. // Decrease Bow/Crossbow Attack Speed
  63. getPlayer().addSkill(SkillTable.getInstance().getInfo(5491, 1), false);
  64. // Transform Dispel
  65. getPlayer().addSkill(SkillTable.getInstance().getInfo(619, 1), false);
  66. // Guard Ambush
  67. getPlayer().addSkill(SkillTable.getInstance().getInfo(963, 1), false);
  68. getPlayer().setTransformAllowedSkills(SKILLS);
  69. }
  70. public static void main(String[] args)
  71. {
  72. TransformationManager.getInstance().registerTransformation(new GuardsoftheDawn());
  73. }
  74. }