DwarfGolem.java 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. public class DwarfGolem extends L2Transformation
  20. {
  21. private static final int[] SKILLS =
  22. {
  23. 806, 807, 808, 809, 5491, 619
  24. };
  25. public DwarfGolem()
  26. {
  27. // id, colRadius, colHeight
  28. super(259, 31, 51.8);
  29. }
  30. @Override
  31. public void onTransform()
  32. {
  33. if ((getPlayer().getTransformationId() != 259) || getPlayer().isCursedWeaponEquipped())
  34. {
  35. return;
  36. }
  37. transformedSkills();
  38. }
  39. public void transformedSkills()
  40. {
  41. // Magic Obstacle
  42. getPlayer().addSkill(SkillTable.getInstance().getInfo(806, 1), false);
  43. // Over-hit
  44. getPlayer().addSkill(SkillTable.getInstance().getInfo(807, 1), false);
  45. // Golem Punch
  46. getPlayer().addSkill(SkillTable.getInstance().getInfo(808, 1), false);
  47. // Golem Tornado Swing
  48. getPlayer().addSkill(SkillTable.getInstance().getInfo(809, 1), false);
  49. // Decrease Bow/Crossbow Attack Speed
  50. getPlayer().addSkill(SkillTable.getInstance().getInfo(5491, 1), false);
  51. // Transform Dispel
  52. getPlayer().addSkill(SkillTable.getInstance().getInfo(619, 1), false);
  53. getPlayer().setTransformAllowedSkills(SKILLS);
  54. }
  55. @Override
  56. public void onUntransform()
  57. {
  58. removeSkills();
  59. }
  60. public void removeSkills()
  61. {
  62. // Magic Obstacle
  63. getPlayer().removeSkill(SkillTable.getInstance().getInfo(806, 1), false);
  64. // Over-hit
  65. getPlayer().removeSkill(SkillTable.getInstance().getInfo(807, 1), false);
  66. // Golem Punch
  67. getPlayer().removeSkill(SkillTable.getInstance().getInfo(808, 1), false);
  68. // Golem Tornado Swing
  69. getPlayer().removeSkill(SkillTable.getInstance().getInfo(809, 1), false);
  70. // Decrease Bow/Crossbow Attack Speed
  71. getPlayer().removeSkill(SkillTable.getInstance().getInfo(5491, 1), false);
  72. // Transform Dispel
  73. getPlayer().removeSkill(SkillTable.getInstance().getInfo(619, 1), false);
  74. getPlayer().setTransformAllowedSkills(EMPTY_ARRAY);
  75. }
  76. public static void main(String[] args)
  77. {
  78. TransformationManager.getInstance().registerTransformation(new DwarfGolem());
  79. }
  80. }