Scarecrow.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 Scarecrow extends L2Transformation
  24. {
  25. private static final int[] SKILLS =
  26. {
  27. 940,
  28. 942,
  29. 5437,
  30. 619
  31. };
  32. public Scarecrow()
  33. {
  34. // id, colRadius, colHeight
  35. super(115, 13, 30);
  36. }
  37. @Override
  38. public void onTransform()
  39. {
  40. if ((getPlayer().getTransformationId() != 115) || getPlayer().isCursedWeaponEquipped())
  41. {
  42. return;
  43. }
  44. transformedSkills();
  45. }
  46. @Override
  47. public void onUntransform()
  48. {
  49. removeSkills();
  50. }
  51. public void removeSkills()
  52. {
  53. // Fake Attack
  54. getPlayer().removeSkill(SkillTable.getInstance().getInfo(940, 1), false);
  55. // Special Motion
  56. getPlayer().removeSkill(SkillTable.getInstance().getInfo(942, 1), false);
  57. // Dissonance
  58. getPlayer().removeSkill(SkillTable.getInstance().getInfo(5437, 2), false);
  59. // Transform Dispel
  60. getPlayer().removeSkill(SkillTable.getInstance().getInfo(619, 1), false);
  61. getPlayer().setTransformAllowedSkills(EMPTY_ARRAY);
  62. }
  63. public void transformedSkills()
  64. {
  65. // Fake Attack
  66. getPlayer().addSkill(SkillTable.getInstance().getInfo(940, 1), false);
  67. // Special Motion
  68. getPlayer().addSkill(SkillTable.getInstance().getInfo(942, 1), false);
  69. // Dissonance
  70. getPlayer().addSkill(SkillTable.getInstance().getInfo(5437, 2), false);
  71. // Transform Dispel
  72. getPlayer().addSkill(SkillTable.getInstance().getInfo(619, 1), false);
  73. getPlayer().setTransformAllowedSkills(SKILLS);
  74. }
  75. public static void main(String[] args)
  76. {
  77. TransformationManager.getInstance().registerTransformation(new Scarecrow());
  78. }
  79. }