Esempio n. 1
0
 @Override
 public void runImpl() throws Exception {
   try {
     switch (_taskId) {
       case 1:
         int angle =
             Math.abs(
                 (weakScarlet.getHeading() < 32768 ? 180 : 540)
                     - (int) (weakScarlet.getHeading() / 182.044444444));
         for (Player pc : getPlayers()) pc.enterMovieMode();
         blockAll(true);
         showSocialActionMovie(weakScarlet, 500, angle, 5, 500, 15000, 0);
         ThreadPoolManager.getInstance().schedule(new SecondMorph(2), 2000);
         break;
       case 2:
         weakScarlet.broadcastPacket(new SocialActionPacket(weakScarlet.getObjectId(), 1));
         weakScarlet.setCurrentHp(weakScarlet.getMaxHp() * 3 / 4, false);
         weakScarlet.setRHandId(_frintezzasSwordId);
         weakScarlet.broadcastCharInfo();
         ThreadPoolManager.getInstance().schedule(new SecondMorph(3), 5500);
         break;
       case 3:
         weakScarlet.broadcastPacket(new SocialActionPacket(weakScarlet.getObjectId(), 4));
         blockAll(false);
         Skill skill = SkillTable.getInstance().getInfo(5017, 1);
         skill.getEffects(weakScarlet, weakScarlet, false, false);
         for (Player pc : getPlayers()) pc.leaveMovieMode();
         break;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  @Override
  public boolean useItem(Playable playable, ItemInstance item, boolean ctrl) {
    Player player;
    if (playable.isPlayer()) player = (Player) playable;
    else if (playable.isPet()) player = playable.getPlayer();
    else return false;

    GameObject target = player.getTarget();
    if (target == null || !target.isMonster()) {
      player.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      return false;
    }

    MonsterInstance monster = (MonsterInstance) player.getTarget();

    if (!monster.isDead()) {
      player.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      return false;
    }

    Skill skill = SkillTable.getInstance().getInfo(HARVESTER_SKILL_ID, 1);
    if (skill != null && skill.checkCondition(player, monster, false, false, true)) {
      player.getAI().Cast(skill, monster);
      return true;
    }
    return false;
  }
Esempio n. 3
0
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets) {
    if (!activeChar.isPlayer()) return;

    boolean ss = activeChar.getChargedSoulShot() && isSSPossible();
    if (ss && getTargetType() != SkillTargetType.TARGET_SELF) activeChar.unChargeShots(false);

    Creature realTarget;
    boolean reflected;

    for (Creature target : targets) {
      if (target.isDead()) continue;

      if (target != activeChar) {
        reflected = target.checkReflectSkill(activeChar, this);
        realTarget = reflected ? activeChar : target;

        if (getPower() > 0) // Если == 0 значит скилл "отключен"
        {
          AttackInfo info =
              Formulas.calcPhysDam(activeChar, realTarget, this, false, false, ss, false);
          realTarget.reduceCurrentHp(
              info.damage,
              activeChar,
              this,
              true,
              true,
              false,
              true,
              false,
              false,
              true,
              true,
              info.crit || info.blow,
              false,
              false,
              false);
          if (!info.miss || info.damage >= 1) {
            double lethalDmg = Formulas.calcLethalDamage(activeChar, realTarget, this);
            if (lethalDmg > 0)
              realTarget.reduceCurrentHp(
                  lethalDmg, activeChar, this, true, true, false, false, false, false, false);
            else if (!reflected) realTarget.doCounterAttack(this, activeChar, false);
          }
        }

        getEffects(activeChar, target, false, reflected);
      } else getEffects(activeChar, target, false);
    }

    chargePlayer((Player) activeChar, getId());

    super.useSkill(activeChar, targets);
  }
Esempio n. 4
0
  @Override
  public List<L2GameServerPacket> addPacketList(Player forPlayer, Creature dropper) {
    if (isInvisible()) return Collections.emptyList();

    List<L2GameServerPacket> list = new ArrayList<L2GameServerPacket>();
    list.add(new FakePlayerInfo(this));

    boolean dualCast = isDualCastingNow();
    if (isCastingNow()) {
      Creature castingTarget = getCastingTarget();
      Skill castingSkill = getCastingSkill();
      long animationEndTime = getAnimationEndTime();
      if (castingSkill != null
          && castingTarget != null
          && castingTarget.isCreature()
          && animationEndTime > 0)
        list.add(
            new MagicSkillUse(
                this,
                castingTarget,
                castingSkill.getId(),
                castingSkill.getLevel(),
                (int) (animationEndTime - System.currentTimeMillis()),
                0,
                dualCast));
    }

    if (dualCast) {
      Creature castingTarget = getDualCastingTarget();
      Skill castingSkill = getDualCastingSkill();
      long animationEndTime = getDualAnimationEndTime();
      if (castingSkill != null
          && castingTarget != null
          && castingTarget.isCreature()
          && animationEndTime > 0)
        list.add(
            new MagicSkillUse(
                this,
                castingTarget,
                castingSkill.getId(),
                castingSkill.getLevel(),
                (int) (animationEndTime - System.currentTimeMillis()),
                0,
                dualCast));
    }

    if (isInCombat()) list.add(new AutoAttackStart(getObjectId()));

    // list.add(RelationChanged.update(forPlayer, this, forPlayer));

    if (isMoving || isFollow) list.add(movePacket());

    return list;
  }
Esempio n. 5
0
  @Override
  public void useSkill(Creature activeChar, List<Creature> targets) {
    double percent = _power;

    for (Creature target : targets) {
      if (target.isPlayer()) {
        Player player = target.getPlayer();
        int points = (int) (Player.MAX_VITALITY_POINTS / 100 * percent);
        player.setVitality(player.getVitality() + points);
      }
      getEffects(activeChar, target, false);
    }

    if (isSSPossible()) activeChar.unChargeShots(isMagic());

    super.useSkill(activeChar, targets);
  }
Esempio n. 6
0
  @Override
  public void useSkill(final Creature activeChar, List<Creature> targets) {
    for (final Creature target : targets)
      if (target != null) {
        final Player pcTarget = target.getPlayer();
        if (pcTarget == null) continue;
        if (!pcTarget.getPlayerAccess().UseTeleport) continue;
        if (pcTarget.getActiveWeaponFlagAttachment() != null) {
          activeChar.sendPacket(SystemMsg.YOU_CANNOT_TELEPORT_WHILE_IN_POSSESSION_OF_A_WARD);
          continue;
        }
        if (pcTarget.isInOlympiadMode()) {
          activeChar.sendPacket(
              SystemMsg
                  .YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_CURRENTLY_PARTICIPATING_IN_THE_GRAND_OLYMPIAD);
          return;
        }
        if (pcTarget.isInObserverMode()) {
          activeChar.sendPacket(
              new SystemMessagePacket(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
                  .addSkillName(getId(), getLevel()));
          return;
        }

        for (GlobalEvent e : pcTarget.getEvents()) {
          if (!e.canUseTeleport(pcTarget)) {
            activeChar.sendPacket(
                new SystemMessagePacket(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
                    .addSkillName(getId(), getLevel()));
            return;
          }
        }

        if (pcTarget.isInDuel() || pcTarget.getTeam() != TeamType.NONE) {
          activeChar.sendMessage(new CustomMessage("common.RecallInDuel", (Player) activeChar));
          return;
        }
        if (_isItemHandler) {
          // TODO: переделать SOE по TownId на SOE по Loc_id
          if (_itemConsumeId[0] == 7127) // hardin's academy
          {
            pcTarget.teleToLocation(105918, 109759, -3207, 0);
            return;
          }
          if (_itemConsumeId[0] == 7130) // ivory
          {
            pcTarget.teleToLocation(85475, 16087, -3672, 0);
            return;
          }
          if (_itemConsumeId[0] == 7618) {
            pcTarget.teleToLocation(149864, -81062, -5618, 0);
            return;
          }
          if (_itemConsumeId[0] == 7619) {
            pcTarget.teleToLocation(108275, -53785, -2524, 0);
            return;
          }
        }
        if (_loc != null) {
          pcTarget.teleToLocation(_loc, 0);
          return;
        }
        // FIXME [G1ta0] перенести координаты в скиллы
        switch (_townId)
        // To town by Id
        {
          case 1: // Talking Island
            pcTarget.teleToLocation(-114558, 253605, -1536, 0);
            return;
          case 2: // Elven Village
            pcTarget.teleToLocation(45576, 49412, -2950, 0);
            return;
          case 3: // Dark Elven Village
            pcTarget.teleToLocation(12501, 16768, -4500, 0);
            return;
          case 4: // Orc Village
            pcTarget.teleToLocation(-44884, -115063, -80, 0);
            return;
          case 5: // Dwarven Village
            pcTarget.teleToLocation(115790, -179146, -890, 0);
            return;
          case 6: // Town of Gludio
            pcTarget.teleToLocation(-14279, 124446, -3000, 0);
            return;
          case 7: // Gludin Village
            pcTarget.teleToLocation(-82909, 150357, -3000, 0);
            return;
          case 8: // Town of Dion
            pcTarget.teleToLocation(19025, 145245, -3107, 0);
            return;
          case 9: // Town of Giran
            pcTarget.teleToLocation(82272, 147801, -3350, 0);
            return;
          case 10: // Town of Oren
            pcTarget.teleToLocation(82323, 55466, -1480, 0);
            return;
          case 11: // Town of Aden
            pcTarget.teleToLocation(144526, 24661, -2100, 0);
            return;
          case 12: // Hunters Village
            pcTarget.teleToLocation(117189, 78952, -2210, 0);
            return;
          case 13: // Heine
            pcTarget.teleToLocation(110768, 219824, -3624, 0);
            return;
          case 14: // Rune Township
            pcTarget.teleToLocation(43536, -50416, -800, 0);
            return;
          case 15: // Town of Goddard
            pcTarget.teleToLocation(148288, -58304, -2979, 0);
            return;
          case 16: // Town of Schuttgart
            pcTarget.teleToLocation(87776, -140384, -1536, 0);
            return;
          case 17: // Kamael Village
            pcTarget.teleToLocation(-117081, 44171, 507, 0);
            return;
          case 18: // Primeval Isle
            pcTarget.teleToLocation(10568, -24600, -3648, 0);
            return;
          case 19: // Floran Village
            pcTarget.teleToLocation(17144, 170156, -3502, 0);
            return;
          case 20: // Hellbound
            pcTarget.teleToLocation(-16434, 208803, -3664, 0);
            return;
          case 21: // Keucereus Alliance Base
            pcTarget.teleToLocation(-184200, 243080, 1568, 0);
            return;
          case 22: // Steel Citadel
            pcTarget.teleToLocation(8976, 252416, -1928, 0);
            return;
          case 23: // Town of Arcan
            pcTarget.teleToLocation(207559, 86429, -1000, 0);
            return;
          case 24: // Vernon Village
            pcTarget.teleToLocation(-80403, 247853, -3496, 0);
            return;
          case 25: // Gludin Church
            pcTarget.teleToLocation(-79592, 150824, -3066, 0);
            return;
          case 26: // Windy Hill
            pcTarget.teleToLocation(-93649, 89763, -3208, 0);
            return;
          case 27: // Orc Barrack
            pcTarget.teleToLocation(-85672, 106664, -3577, 0);
            return;
          case 28: // Town of Dion - front of Sylvain
            pcTarget.teleToLocation(16376, 142296, -2718, 0);
            return;
          case 29: // Cruma Tower - front of Lorain
            pcTarget.teleToLocation(16520, 113384, -3605, 0);
            return;
          case 30: // Cruma Tower - front of Rombel
            pcTarget.teleToLocation(17776, 114851, -11704, 0);
            return;
          case 31: // Town of Oren - front of Hollint
            pcTarget.teleToLocation(83633, 53064, -1456, 0);
            return;
          case 32: // Sea of Spore - front of Andy
            pcTarget.teleToLocation(64328, 26803, -3768, 0);
            return;
          case 33: // Town of Aden - front of Orven
            pcTarget.teleToLocation(147446, 22761, -1984, 0);
            return;
          case 34: // Forsaken Plains - front of Novain
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 35: // Scroll of Escape: Fields of Massacre
            pcTarget.teleToLocation(183543, -14974, -2768, 0);
            return;
          case 36: // Scroll of Escape: Town of Rune
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 37: // Scroll of Escape: Swamp of Screams
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 38: // Scroll of Escape: Town of Goddard
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 39: // Scroll of Escape: Wall of Argos
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 40: // croll of Escape: Town of Giran
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 41: // Scroll of Escape: Dragon Valley
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
        }
        if (_castle) // To castle
        {
          pcTarget.teleToCastle();
          return;
        }
        if (_clanhall) // to clanhall
        {
          pcTarget.teleToClanhall();
          return;
        }
        if (_fortress) // To fortress
        {
          pcTarget.teleToFortress();
          return;
        }

        pcTarget.teleToClosestTown();
      }

    if (isSSPossible()) activeChar.unChargeShots(isMagic());

    super.useSkill(activeChar, targets);
  }
Esempio n. 7
0
 @Override
 public void runImpl() throws Exception {
   try {
     switch (_taskId) {
       case 1:
         _angle =
             Math.abs(
                 (weakScarlet.getHeading() < 32768 ? 180 : 540)
                     - (int) (weakScarlet.getHeading() / 182.044444444));
         for (Player pc : getPlayers()) pc.enterMovieMode();
         blockAll(true);
         frintezza.broadcastPacket(new MagicSkillCanceled(frintezza.getObjectId()));
         frintezza.broadcastPacket(new SocialActionPacket(frintezza.getObjectId(), 4));
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(2), 100);
         break;
       case 2:
         showSocialActionMovie(frintezza, 250, 120, 15, 0, 1000, 0);
         showSocialActionMovie(frintezza, 250, 120, 15, 0, 10000, 0);
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(3), 6500);
         break;
       case 3:
         frintezza.broadcastPacket(new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
         showSocialActionMovie(frintezza, 500, 70, 15, 3000, 10000, 0);
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(4), 3000);
         break;
       case 4:
         showSocialActionMovie(frintezza, 2500, 90, 12, 6000, 10000, 0);
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(5), 3000);
         break;
       case 5:
         showSocialActionMovie(weakScarlet, 250, _angle, 12, 0, 1000, 0);
         showSocialActionMovie(weakScarlet, 250, _angle, 12, 0, 10000, 0);
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(6), 500);
         break;
       case 6:
         weakScarlet.doDie(weakScarlet);
         showSocialActionMovie(weakScarlet, 450, _angle, 14, 8000, 8000, 0);
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(7), 6250);
         break;
       case 7:
         NpcLocation loc = new NpcLocation();
         loc.set(weakScarlet.getLoc());
         loc.npcId = _strongScarletId;
         weakScarlet.deleteMe();
         weakScarlet = null;
         strongScarlet = spawn(loc);
         strongScarlet.addListener(_deathListener);
         block(strongScarlet, true);
         showSocialActionMovie(strongScarlet, 450, _angle, 12, 500, 14000, 2);
         ThreadPoolManager.getInstance().schedule(new ThirdMorph(9), 5000);
         break;
       case 9:
         blockAll(false);
         for (Player pc : getPlayers()) pc.leaveMovieMode();
         Skill skill = SkillTable.getInstance().getInfo(5017, 1);
         skill.getEffects(strongScarlet, strongScarlet, false, false);
         break;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }