SignetNoise.java 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 handlers.effecthandlers;
  16. import com.l2jserver.gameserver.model.actor.L2Character;
  17. import com.l2jserver.gameserver.model.actor.instance.L2EffectPointInstance;
  18. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  19. import com.l2jserver.gameserver.model.effects.EffectTemplate;
  20. import com.l2jserver.gameserver.model.effects.L2Effect;
  21. import com.l2jserver.gameserver.model.effects.L2EffectType;
  22. import com.l2jserver.gameserver.model.stats.Env;
  23. /**
  24. * @authors Forsaiken, Sami
  25. */
  26. public class SignetNoise extends L2Effect
  27. {
  28. private L2EffectPointInstance _actor;
  29. public SignetNoise(Env env, EffectTemplate template)
  30. {
  31. super(env, template);
  32. }
  33. @Override
  34. public L2EffectType getEffectType()
  35. {
  36. return L2EffectType.SIGNET_GROUND;
  37. }
  38. @Override
  39. public boolean onStart()
  40. {
  41. _actor = (L2EffectPointInstance) getEffected();
  42. return true;
  43. }
  44. @Override
  45. public boolean onActionTime()
  46. {
  47. if (getCount() == getTotalCount() - 1)
  48. return true; // do nothing first time
  49. L2PcInstance caster = (L2PcInstance) getEffector();
  50. for (L2Character target : _actor.getKnownList().getKnownCharactersInRadius(getSkill().getSkillRadius()))
  51. {
  52. if (target == null || target == caster)
  53. continue;
  54. if (caster.canAttackCharacter(target))
  55. {
  56. L2Effect[] effects = target.getAllEffects();
  57. if (effects != null)
  58. {
  59. for (L2Effect effect : effects)
  60. {
  61. if (effect.getSkill().isDance())
  62. effect.exit();
  63. }
  64. }
  65. }
  66. }
  67. return true;
  68. }
  69. @Override
  70. public void onExit()
  71. {
  72. if (_actor != null)
  73. _actor.deleteMe();
  74. }
  75. }