Beispiel #1
0
 public void toggleAttackOnCharacter(final Char character) {
   if (isAttacking(character)) {
     standDown();
   } else {
     setAttackTarget(character);
   }
 }
Beispiel #2
0
 /**
  * Set the new combat mode.
  *
  * @param newMode <code>true</code> to enable the combat mode
  */
 public void setCombatMode(final boolean newMode) {
   if (combatActive && !newMode) {
     combatActive = false;
     standDown();
   } else if (!combatActive && newMode) {
     combatActive = true;
     Game.getMusicBox().playFightingMusic();
   }
 }
Beispiel #3
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);
    }
  }
Beispiel #4
0
  /**
   * 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();
    }
  }
  /**
   * 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();
      }
    }
  }