EffectBluff.java 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.ai.CtrlIntention;
  17. import net.sf.l2j.gameserver.model.L2CharPosition;
  18. import net.sf.l2j.gameserver.model.L2Effect;
  19. import net.sf.l2j.gameserver.model.actor.instance.L2FolkInstance;
  20. import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  21. import net.sf.l2j.gameserver.model.actor.instance.L2SiegeSummonInstance;
  22. import net.sf.l2j.gameserver.serverpackets.SystemMessage;
  23. import net.sf.l2j.gameserver.skills.Env;
  24. /**
  25. * @author decad
  26. *
  27. * Implementation of the Bluff Effect
  28. */
  29. final class EffectBluff extends L2Effect {
  30. public EffectBluff(Env env, EffectTemplate template)
  31. {
  32. super(env, template);
  33. }
  34. @Override
  35. public EffectType getEffectType()
  36. {
  37. return EffectType.BLUFF; //test for bluff effect
  38. }
  39. /** Notify started */
  40. @Override
  41. public void onStart()
  42. {
  43. getEffected().startFear();
  44. if(getEffected() instanceof L2FolkInstance) return;
  45. // if(getEffected() instanceof L2SiegeGuardInstance) return;
  46. // Cannot be used on Headquarters Flag.
  47. // bluff now is a PVE PVP skill
  48. if(getEffected() instanceof L2NpcInstance && ((L2NpcInstance)getEffected()).getNpcId() == 35062 || getSkill().getId() != 358) return;
  49. if(getEffected() instanceof L2SiegeSummonInstance)
  50. {
  51. return;
  52. }
  53. int posX = getEffected().getX();
  54. int posY = getEffected().getY();
  55. int posZ = getEffected().getZ();
  56. int signx=-1;
  57. int signy=-1;
  58. if (getEffected().getX()>getEffector().getX())
  59. signx=1;
  60. if (getEffected().getY()>getEffector().getY())
  61. signy=1;
  62. //posX += signx*40; //distance less than melee attacks (40)
  63. //posY += signy*40;
  64. getEffected().setRunning();
  65. getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO,
  66. new L2CharPosition(posX +(signx*40),posY + (signy*40),posZ,0));
  67. getEffected().sendPacket(SystemMessage.sendString("You can feel Bluff's effect"));
  68. getEffected().setTarget(null);
  69. onActionTime();
  70. }
  71. @Override
  72. public void onExit()
  73. {
  74. getEffected().stopFear(this);
  75. }
  76. @Override
  77. public boolean onActionTime()
  78. {
  79. return false;
  80. }
  81. }