public void toggleAttackOnCharacter(final Char character) { if (isAttacking(character)) { standDown(); } else { setAttackTarget(character); } }
/** * 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(); } }
/** * 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); } }
/** * 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(); } } }