/**
   * That method drops current alliance and retrograde badge.<br>
   * If any Varka quest is in progress, it stops the quest (and drop all related qItems) :
   *
   * @param player The player to check.
   */
  private static void testKetraDemote(L2PcInstance player) {
    if (player.isAlliedWithKetra()) {
      // Drop the alliance (old friends become aggro).
      player.setAllianceWithVarkaKetra(0);

      final PcInventory inventory = player.getInventory();

      // Drop by 1 the level of that alliance (symbolized by a quest item).
      for (int i = 7215; i >= 7211; i--) {
        L2ItemInstance item = inventory.getItemByItemId(i);
        if (item != null) {
          // Destroy the badge.
          player.destroyItemByItemId("Quest", i, item.getCount(), player, true);

          // Badge lvl 1 ; no addition of badge of lower level.
          if (i != 7211) player.addItem("Quest", i - 1, 1, player, true);

          break;
        }
      }

      for (String mission : ketraMissions) {
        QuestState pst = player.getQuestState(mission);
        if (pst != null) pst.exitQuest(true);
      }
    }
  }
  @Override
  public String onSkillSee(
      L2Npc npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) {
    // Caster is an allied.
    if (caster.isAlliedWithKetra()) {
      // Caster's skill is a positive effect ? Go further.
      switch (skill.getSkillType()) {
        case BUFF:
        case HEAL:
        case HEAL_PERCENT:
        case HEAL_STATIC:
        case BALANCE_LIFE:
        case HOT:
          for (L2Character target : (L2Character[]) targets) {
            // Character isn't existing, is dead or is current caster, we drop check.
            if (target == null || target.isDead() || target == caster) continue;

            // Target isn't a summon nor a player, we drop check.
            if (!(target instanceof L2Playable)) continue;

            // Retrieve the player behind that target.
            final L2PcInstance player = target.getActingPlayer();

            // If player is neutral or enemy, go further.
            if (!(player.isAlliedWithKetra())) {
              // If the NPC got that player registered in aggro list, go further.
              if (((L2Attackable) npc).containsTarget(player)) {
                // Save current target for future use.
                final L2Object oldTarget = npc.getTarget();

                // Curse the heretic or his pet.
                npc.setTarget((isPet && player.getPet() != null) ? caster.getPet() : caster);
                npc.doCast(FrequentSkill.VARKA_KETRA_PETRIFICATION.getSkill());

                // Revert to old target && drop the loop.
                npc.setTarget(oldTarget);
                break;
              }
            }
          }
          break;
      }
    }

    // Continue normal behavior.
    return super.onSkillSee(npc, caster, skill, targets, isPet);
  }