/** * Method canAttack. * * @param target Creature * @param attacker Creature * @param skill Skill * @param force boolean * @return boolean */ @Override public boolean canAttack(Creature target, Creature attacker, Skill skill, boolean force) { if ((target.getTeam() == TeamType.NONE) || (attacker.getTeam() == TeamType.NONE) || (target.getTeam() == attacker.getTeam())) { return false; } DuelEvent duelEvent = target.getEvent(DuelEvent.class); return !((duelEvent == null) || (duelEvent != this)); }
/** * Method checkForAttack. * * @param target Creature * @param attacker Creature * @param skill Skill * @param force boolean * @return SystemMsg */ @Override public SystemMsg checkForAttack(Creature target, Creature attacker, Skill skill, boolean force) { if ((target.getTeam() == TeamType.NONE) || (attacker.getTeam() == TeamType.NONE) || (target.getTeam() == attacker.getTeam())) { return SystemMsg.INVALID_TARGET; } DuelEvent duelEvent = target.getEvent(DuelEvent.class); if ((duelEvent == null) || (duelEvent != this)) { return SystemMsg.INVALID_TARGET; } return null; }