Ejemplo n.º 1
0
 public void toggleAttackOnCharacter(final Char character) {
   if (isAttacking(character)) {
     standDown();
   } else {
     setAttackTarget(character);
   }
 }
Ejemplo n.º 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();
   }
 }
Ejemplo n.º 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);
    }
  }
Ejemplo n.º 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();
    }
  }
Ejemplo n.º 5
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();
      }
    }
  }