Package npc.model

Examples of npc.model.MeleonInstance


      if (_polimorphTask != null)
      {
        _polimorphTask.cancel(false);
        _polimorphTask = null;
      }
      final MeleonInstance actor = getActor();
      actor.deleteMe();
    }
    return false;
  }
View Full Code Here


   * @param caster Creature
   */
  @Override
  protected void onEvtSeeSpell(Skill skill, Creature caster)
  {
    final MeleonInstance actor = getActor();
    if ((actor == null) || (skill.getId() != 2005))
    {
      return;
    }
    if ((actor.getNpcId() != Young_Watermelon) && (actor.getNpcId() != Young_Honey_Watermelon))
    {
      return;
    }
    switch (_tryCount)
    {
      case 0:
        _tryCount++;
        _lastNectarUse = System.currentTimeMillis();
        if (Rnd.chance(50))
        {
          _nectar++;
          Functions.npcSay(actor, textSuccess0[Rnd.get(textSuccess0.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
        }
        else
        {
          Functions.npcSay(actor, textFail0[Rnd.get(textFail0.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
        }
        break;
      case 1:
        if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
        {
          Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
          return;
        }
        _tryCount++;
        _lastNectarUse = System.currentTimeMillis();
        if (Rnd.chance(50))
        {
          _nectar++;
          Functions.npcSay(actor, textSuccess1[Rnd.get(textSuccess1.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
        }
        else
        {
          Functions.npcSay(actor, textFail1[Rnd.get(textFail1.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
        }
        break;
      case 2:
        if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
        {
          Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
          return;
        }
        _tryCount++;
        _lastNectarUse = System.currentTimeMillis();
        if (Rnd.chance(50))
        {
          _nectar++;
          Functions.npcSay(actor, textSuccess2[Rnd.get(textSuccess2.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
        }
        else
        {
          Functions.npcSay(actor, textFail2[Rnd.get(textFail2.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
        }
        break;
      case 3:
        if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
        {
          Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
          return;
        }
        _tryCount++;
        _lastNectarUse = System.currentTimeMillis();
        if (Rnd.chance(50))
        {
          _nectar++;
          Functions.npcSay(actor, textSuccess3[Rnd.get(textSuccess3.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
        }
        else
        {
          Functions.npcSay(actor, textFail3[Rnd.get(textFail3.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
        }
        break;
      case 4:
        if ((System.currentTimeMillis() - _lastNectarUse) < NECTAR_REUSE)
        {
          Functions.npcSay(actor, textTooFast[Rnd.get(textTooFast.length)]);
          return;
        }
        _tryCount++;
        _lastNectarUse = System.currentTimeMillis();
        if (Rnd.chance(50))
        {
          _nectar++;
          Functions.npcSay(actor, textSuccess4[Rnd.get(textSuccess4.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Level_up, 1, NECTAR_REUSE, 0));
        }
        else
        {
          Functions.npcSay(actor, textFail4[Rnd.get(textFail4.length)]);
          actor.broadcastPacket(new MagicSkillUse(actor, actor, Squash_Poisoned, 1, NECTAR_REUSE, 0));
        }
        if (_npcId == Young_Watermelon)
        {
          if (_nectar < 3)
          {
View Full Code Here

   * @param damage int
   */
  @Override
  protected void onEvtAttacked(Creature attacker, int damage)
  {
    final MeleonInstance actor = getActor();
    if ((actor != null) && Rnd.chance(5))
    {
      Functions.npcSay(actor, textOnAttack[Rnd.get(textOnAttack.length)]);
    }
  }
View Full Code Here

   */
  @Override
  protected void onEvtDead(Creature killer)
  {
    _tryCount = -1;
    final MeleonInstance actor = getActor();
    if (actor == null)
    {
      return;
    }
    double dropMod = 1.5;
    switch (_npcId)
    {
      case Defective_Watermelon:
        dropMod *= 1;
        Functions.npcSay(actor, "�?рбуз открывает�?�?!");
        Functions.npcSay(actor, "�?хо-хо! Да тут жалкие крохи, �?тарай�?�? луч�?е!");
        break;
      case Rain_Watermelon:
        dropMod *= 2;
        Functions.npcSay(actor, "�?рбуз открывает�?�?!");
        Functions.npcSay(actor, "�?й-ай-ай! �?еплохой улов!");
        break;
      case Large_Rain_Watermelon:
        dropMod *= 4;
        Functions.npcSay(actor, "�?рбуз открывает�?�?!");
        Functions.npcSay(actor, "Вот �?то да! �?акие �?окровища!");
        break;
      case Defective_Honey_Watermelon:
        dropMod *= 12.5;
        Functions.npcSay(actor, "�?рбуз открывает�?�?!");
        Functions.npcSay(actor, "�?отратил много, а выудил мало!");
        break;
      case Rain_Honey_Watermelon:
        dropMod *= 25;
        Functions.npcSay(actor, "�?рбуз открывает�?�?!");
        Functions.npcSay(actor, "Бум-бум-бах! Улов хоро�?!");
        break;
      case Large_Rain_Honey_Watermelon:
        dropMod *= 50;
        Functions.npcSay(actor, "�?рбуз открывает�?�?!");
        Functions.npcSay(actor, "Фанфары! Ты открыл гигант�?кий арбуз! �?е�?метные богат�?тва на земле! Лови их!");
        break;
      default:
        dropMod *= 0;
        Functions.npcSay(actor, "Я вед�? ничего тебе не дам, е�?ли умру вот так...");
        Functions.npcSay(actor, "Этот позор навеки покроет твое им�?...");
        break;
    }
    super.onEvtDead(actor);
    if (dropMod > 0)
    {
      if (_polimorphTask != null)
      {
        _polimorphTask.cancel(false);
        _polimorphTask = null;
        Log.add("SummerMeleons :: Player " + actor.getSpawner().getName() + " tried to use cheat (SquashAI clone): killed " + actor + " after polymorfing started", "illegal-actions");
        return;
      }
      for (RewardData d : _dropList)
      {
        List<RewardItem> itd = d.roll(null, dropMod);
        for (RewardItem i : itd)
        {
          actor.dropItem(actor.getSpawner(), i.itemId, i.count);
        }
      }
    }
  }
View Full Code Here

     * Method runImpl.
     */
    @Override
    public void runImpl()
    {
      final MeleonInstance actor = getActor();
      if (actor == null)
      {
        return;
      }
      SimpleSpawner spawn = null;
      try
      {
        spawn = new SimpleSpawner(NpcHolder.getInstance().getTemplate(_npcId));
        spawn.setLoc(actor.getLoc());
        final NpcInstance npc = spawn.doSpawn(true);
        npc.setAI(new MeleonAI(npc));
        ((MeleonInstance) npc).setSpawner(actor.getSpawner());
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
      _timeToUnspawn = Long.MAX_VALUE;
      actor.deleteMe();
    }
View Full Code Here

TOP

Related Classes of npc.model.MeleonInstance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.