/** * Method checkCondition. * * @return boolean */ @Override public boolean checkCondition() { Player player = _effected.getPlayer(); if (player == null) { return false; } if (player.isMounted()) { player.sendPacket( new SystemMessage(SystemMessage.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS) .addSkillName(_skill.getId(), _skill.getLevel())); return false; } return super.checkCondition(); }
/** * Method canDuel0. * * @param requestor Player * @param target Player * @return IStaticPacket */ protected IStaticPacket canDuel0(Player requestor, Player target) { IStaticPacket packet = null; if (target.isInCombat()) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_BATTLE) .addName(target); } else if (target.isDead() || target.isAlikeDead() || (target.getCurrentHpPercents() < 50) || (target.getCurrentMpPercents() < 50) || (target.getCurrentCpPercents() < 50)) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1S_HP_OR_MP_IS_BELOW_50) .addName(target); } else if (target.getEvent(DuelEvent.class) != null) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_ALREADY_ENGAGED_IN_A_DUEL) .addName(target); } else if ((target.getEvent(ClanHallSiegeEvent.class) != null) || (target.getEvent(ClanHallNpcSiegeEvent.class) != null)) { packet = new SystemMessage2( SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_PARTICIPATING_IN_A_CLAN_HALL_WAR) .addName(target); } else if (target.getEvent(SiegeEvent.class) != null) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_PARTICIPATING_IN_A_SIEGE_WAR) .addName(target); } else if (target.isInOlympiadMode()) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_PARTICIPATING_IN_THE_OLYMPIAD) .addName(target); } else if (target.isCursedWeaponEquipped() || (target.isChaotic()) || (target.getPvpFlag() > 0)) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_IN_A_CHAOTIC_STATE) .addName(target); } else if (target.isInStoreMode()) { packet = new SystemMessage2( SystemMsg .C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_ENGAGED_IN_A_PRIVATE_STORE_OR_MANUFACTURE) .addName(target); } else if (target.isMounted() || target.isInBoat()) { packet = new SystemMessage2( SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_RIDING_A_BOAT_STEED_OR_STRIDER) .addName(target); } else if (target.isFishing()) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING) .addName(target); } else if (target.isInCombatZone() || target.isInPeaceZone() || target.isInWater() || target.isInZone(Zone.ZoneType.no_restart)) { packet = new SystemMessage2( SystemMsg .C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUELPROHIBITED_AREA_PEACEFUL_ZONE__SEVEN_SIGNS_ZONE__NEAR_WATER__RESTART_PROHIBITED_AREA) .addName(target); } else if (!requestor.isInRangeZ(target, 1200)) { packet = new SystemMessage2( SystemMsg.C1_CANNOT_RECEIVE_A_DUEL_CHALLENGE_BECAUSE_C1_IS_TOO_FAR_AWAY) .addName(target); } else if (target.getTransformation() != 0) { packet = new SystemMessage2(SystemMsg.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_POLYMORPHED) .addName(target); } return packet; }