EffectImmobilePetBuff.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 net.sf.l2j.gameserver.skills.effects;
  16. import net.sf.l2j.gameserver.model.L2Effect;
  17. import net.sf.l2j.gameserver.model.actor.L2Summon;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  19. import net.sf.l2j.gameserver.skills.Env;
  20. import net.sf.l2j.gameserver.templates.effects.EffectTemplate;
  21. import net.sf.l2j.gameserver.templates.skills.L2EffectType;
  22. /**
  23. * @author demonia
  24. *
  25. * TODO To change the template for this generated type comment go to
  26. * Window - Preferences - Java - Code Style - Code Templates
  27. */
  28. public class EffectImmobilePetBuff extends L2Effect
  29. {
  30. private L2Summon _pet;
  31. public EffectImmobilePetBuff(Env env, EffectTemplate template)
  32. {
  33. super(env, template);
  34. }
  35. /**
  36. *
  37. * @see net.sf.l2j.gameserver.model.L2Effect#getEffectType()
  38. */
  39. @Override
  40. public L2EffectType getEffectType()
  41. {
  42. return L2EffectType.BUFF;
  43. }
  44. /**
  45. *
  46. * @see net.sf.l2j.gameserver.model.L2Effect#onStart()
  47. */
  48. @Override
  49. public boolean onStart()
  50. {
  51. _pet = null;
  52. if (getEffected() instanceof L2Summon
  53. && getEffector() instanceof L2PcInstance
  54. && ((L2Summon) getEffected()).getOwner() == getEffector())
  55. {
  56. _pet = (L2Summon) getEffected();
  57. _pet.setIsImmobilized(true);
  58. return true;
  59. }
  60. return false;
  61. }
  62. /**
  63. *
  64. * @see net.sf.l2j.gameserver.model.L2Effect#onExit()
  65. */
  66. @Override
  67. public void onExit()
  68. {
  69. _pet.setIsImmobilized(false);
  70. }
  71. /**
  72. *
  73. * @see net.sf.l2j.gameserver.model.L2Effect#onActionTime()
  74. */
  75. public boolean onActionTime()
  76. {
  77. // just stop this effect
  78. return false;
  79. }
  80. }