EffectBluff.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.skills.Env;
  23. /**
  24. * @author decad
  25. *
  26. * Implementation of the Bluff Effect
  27. */
  28. final class EffectBluff extends L2Effect
  29. {
  30. public EffectBluff(Env env, EffectTemplate template)
  31. {
  32. super(env, template);
  33. }
  34. /**
  35. *
  36. * @see net.sf.l2j.gameserver.model.L2Effect#getEffectType()
  37. */
  38. @Override
  39. public EffectType getEffectType()
  40. {
  41. return EffectType.BLUFF; // test for bluff effect
  42. }
  43. /**
  44. *
  45. * @see net.sf.l2j.gameserver.model.L2Effect#onStart()
  46. */
  47. @Override
  48. public void onStart()
  49. {
  50. getEffected().startFear();
  51. if (getEffected() instanceof L2FolkInstance)
  52. return;
  53. if (getEffected() instanceof L2NpcInstance && ((L2NpcInstance) getEffected()).getNpcId() == 35062 || getSkill().getId() != 358)
  54. return;
  55. if (getEffected() instanceof L2SiegeSummonInstance)
  56. {
  57. return;
  58. }
  59. int posX = getEffected().getX();
  60. int posY = getEffected().getY();
  61. int posZ = getEffected().getZ();
  62. int signx = -1;
  63. int signy = -1;
  64. if (getEffected().getX() > getEffector().getX())
  65. signx = 1;
  66. if (getEffected().getY() > getEffector().getY())
  67. signy = 1;
  68. getEffected().setRunning();
  69. getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(posX + (signx * 40), posY + (signy * 40), posZ, 0));
  70. getEffected().sendMessage("You can feel Bluff's effect");
  71. getEffected().setTarget(null);
  72. onActionTime();
  73. }
  74. /**
  75. *
  76. * @see net.sf.l2j.gameserver.model.L2Effect#onExit()
  77. */
  78. @Override
  79. public void onExit()
  80. {
  81. getEffected().stopFear(this);
  82. }
  83. /**
  84. *
  85. * @see net.sf.l2j.gameserver.model.L2Effect#onActionTime()
  86. */
  87. @Override
  88. public boolean onActionTime()
  89. {
  90. return false;
  91. }
  92. }