Esempio n. 1
0
  @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);
  }
Esempio n. 3
0
 @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);
 }
Esempio n. 5
0
 @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);
 }
Esempio n. 6
0
  @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);
  }
Esempio n. 7
0
 @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);
 }
Esempio n. 8
0
 @Override
 public void calculate(Effect effect) {
   effect.increaseSuccessEffect();
 }
Esempio n. 9
0
 @Override
 public void calculate(Effect effect) {
   effect.addSucessEffect(this);
 }
Esempio n. 10
0
 @Override
 public void applyEffect(Effect effect) {
   effect.addToEffectedController();
 }
Esempio n. 11
0
 @Override
 public void endEffect(Effect effect) {
   AttackCalcObserver acObserver = effect.getAttackStatusObserver(position);
   if (acObserver != null)
     effect.getEffected().getObserveController().removeAttackCalcObserver(acObserver);
 }
Esempio n. 12
0
 @Override
 public void calculate(Effect effect) {
   if (calculateEffectResistRate(effect, StatEnum.CONFUSE_RESISTANCE))
     effect.addSucessEffect(this);
 }
Esempio n. 13
0
  @Override
  public boolean validate(Effect effect) {
    if (effect.getEffected() == null || effect.getEffector() == null) return false;

    return PositionUtil.isInFrontOfTarget(effect.getEffector(), effect.getEffected());
  }