@Override public boolean validate(Effect effect) { if (effect.getEffected() == null) return false; switch (restriction) { case FLY: return effect.getEffected().isFlying(); case GROUND: return !effect.getEffected().isFlying(); } return true; }
@Override public void applyEffect(Effect effect) { Creature effector = effect.getEffector(); SpawnEngine spawnEngine = SpawnEngine.getInstance(); float x = effector.getX(); float y = effector.getY(); float z = effector.getZ(); byte heading = effector.getHeading(); int worldId = effector.getWorldId(); int instanceId = effector.getInstanceId(); SpawnTemplate spawn = spawnEngine.addNewSpawn(worldId, instanceId, npcId, x, y, z, heading, 0, 0, true, true); final Servant servant = spawnEngine.spawnServant(spawn, instanceId, effector, skillId, hpRatio); Future<?> task = ThreadPoolManager.getInstance() .schedule( new Runnable() { @Override public void run() { servant.getController().onDespawn(true); } }, 60 * 1000); servant.getController().addTask(TaskId.DESPAWN, task); }
@Override public void applyEffect(Effect effect) { super.applyEffect(effect); if (effect.getEffected() instanceof Player) { final Player player = (Player) effect.getEffected(); player .getKnownList() .doOnAllNpcs( new Visitor<Npc>() { @Override public void visit(Npc npc) { PacketSendUtility.sendPacket( player, new SM_CUSTOM_SETTINGS(npc.getObjectId(), 0, npc.getType(player), 0)); } }); } }
@Override public void applyEffect(Effect effect) { Creature effector = effect.getEffector(); float x = effector.getX(); float y = effector.getY(); float z = effector.getZ(); spawnServant(effect, time, NpcObjectType.TOTEM, x, y, z); }
@Override public void startEffect(Effect effect) { if (model > 0) { Creature effected = effect.getEffected(); NpcTemplate template = DataManager.NPC_DATA.getNpcTemplate(model); if (template != null) effected.getTransformModel().setTribe(template.getTribe(), false); } super.startEffect(effect); }
@Override public void startEffect(final Effect effect) { AttackCalcObserver acObserver = new AttackStatusObserver(value, AttackStatus.PARRY) { @Override public boolean checkStatus(AttackStatus status) { if (status == AttackStatus.PARRY) { if (value <= 1) effect.endEffect(); else value--; return true; } else return false; } }; effect.getEffected().getObserveController().addAttackCalcObserver(acObserver); effect.setAttackStatusObserver(acObserver, position); }
@Override public void endEffect(Effect effect) { effect.getEffected().getTransformModel().setActive(false); if (effect.getEffected() instanceof Player) { final Player player = (Player) effect.getEffected(); player .getKnownList() .doOnAllNpcs( new Visitor<Npc>() { @Override public void visit(Npc npc) { PacketSendUtility.sendPacket( player, new SM_CUSTOM_SETTINGS(npc.getObjectId(), 0, npc.getType(player), 0)); player.getTransformModel().setTribe(null, false); } }); } super.endEffect(effect); }
@Override public void calculate(Effect effect) { effect.increaseSuccessEffect(); }
@Override public void calculate(Effect effect) { effect.addSucessEffect(this); }
@Override public void applyEffect(Effect effect) { effect.addToEffectedController(); }
@Override public void endEffect(Effect effect) { AttackCalcObserver acObserver = effect.getAttackStatusObserver(position); if (acObserver != null) effect.getEffected().getObserveController().removeAttackCalcObserver(acObserver); }
@Override public void calculate(Effect effect) { if (calculateEffectResistRate(effect, StatEnum.CONFUSE_RESISTANCE)) effect.addSucessEffect(this); }
@Override public boolean validate(Effect effect) { if (effect.getEffected() == null || effect.getEffector() == null) return false; return PositionUtil.isInFrontOfTarget(effect.getEffector(), effect.getEffected()); }