EffectGrow.java 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 com.l2jserver.gameserver.skills.effects;
  16. import com.l2jserver.gameserver.model.L2Effect;
  17. import com.l2jserver.gameserver.model.actor.L2Npc;
  18. import com.l2jserver.gameserver.skills.AbnormalEffect;
  19. import com.l2jserver.gameserver.skills.Env;
  20. import com.l2jserver.gameserver.templates.effects.EffectTemplate;
  21. import com.l2jserver.gameserver.templates.skills.L2EffectType;
  22. public class EffectGrow extends L2Effect
  23. {
  24. public EffectGrow(Env env, EffectTemplate template)
  25. {
  26. super(env, template);
  27. }
  28. @Override
  29. public L2EffectType getEffectType()
  30. {
  31. return L2EffectType.BUFF;
  32. }
  33. @Override
  34. public boolean onStart()
  35. {
  36. if (getEffected() instanceof L2Npc)
  37. {
  38. L2Npc npc = (L2Npc) getEffected();
  39. //TODO: Uncomment line when fix for mobs falling underground is found
  40. //npc.setCollisionHeight((int) (npc.getCollisionHeight() * 1.24));
  41. npc.setCollisionRadius((npc.getCollisionRadius() * 1.19));
  42. getEffected().startAbnormalEffect(AbnormalEffect.GROW);
  43. return true;
  44. }
  45. return false;
  46. }
  47. @Override
  48. public boolean onActionTime()
  49. {
  50. return false;
  51. }
  52. @Override
  53. public void onExit()
  54. {
  55. if (getEffected() instanceof L2Npc)
  56. {
  57. L2Npc npc = (L2Npc) getEffected();
  58. //TODO: Uncomment line when fix for mobs falling underground is found
  59. //npc.setCollisionHeight(npc.getTemplate().collisionHeight);
  60. npc.setCollisionRadius(npc.getTemplate().fCollisionRadius);
  61. getEffected().stopAbnormalEffect(AbnormalEffect.GROW);
  62. }
  63. }
  64. }