コード例 #1
0
  /**
   * Set the character that is attacked from now in.
   *
   * @param character the character that is now attacked
   */
  public void setAttackTarget(final Char character) {
    standDown();
    if (character == attackedChar) {
      return;
    }

    if (character != null) {
      attackedChar = character;
      sendAttackToServer(character.getCharId());
      character.setAttackMarker(true);
    }
  }
コード例 #2
0
ファイル: CombatHandler.java プロジェクト: Tiim/Illarion-Java
  /**
   * Set the character that is attacked from now in.
   *
   * @param character the character that is now attacked
   */
  public void setAttackTarget(final Char character) {
    if (character == attackedChar) {
      return;
    }

    standDown();

    if ((character != null) && canBeAttacked(character)) {
      attackedChar = character;
      sendAttackToServer(character.getCharId());
      character.setAttackMarker(true);
      World.getMusicBox().playFightingMusic();
    }
  }
コード例 #3
0
  /**
   * Set the character that is attacked from now in.
   *
   * @param character the character that is now attacked
   */
  public void setAttackTarget(@Nonnull final Char character) {
    synchronized (this) {
      if (character == attackedChar) {
        return;
      }

      standDown();

      final CharacterId characterId = character.getCharId();
      if (characterId == null) {
        LOGGER.error("Trying to attack a character without character ID.");
        return;
      }

      if (canBeAttacked(character)) {
        attackedChar = character;
        sendAttackToServer(characterId);
        character.setAttackMarker(true);
        World.getMusicBox().playFightingMusic();
      }
    }
  }