@Override public void onDeath(final Creature self, final Creature killer) { if (self.isNpc() && (self.getId() == NOKTUM)) { self.broadcastPacketToOthers( new ExShowScreenMessage( NpcString.GHOST_OF_HARNAK_CAN_ONLY_BE_HIT_NEAR_SOUL_CIRCLE, 5000, ExShowScreenMessage.ScreenMessageAlign.BOTTOM_CENTER, true, ExShowScreenMessage.STRING_TYPE, 0, false, 0)); self.removeListener(_deathListener); } if (self.isNpc() && (self.getId() == DEMONIC_NOKTUM)) { self.broadcastPacketToOthers( new ExShowScreenMessage( NpcString.GHOST_OF_HARNAK_CAN_ONLY_BE_HIT_NEAR_SOUL_CIRCLE, 5000, ExShowScreenMessage.ScreenMessageAlign.BOTTOM_CENTER, true, ExShowScreenMessage.STRING_TYPE, 0, false, 0)); self.removeListener(_deathListener); } }
/** * Method onEvtClanAttacked. * * @param attacked_member Creature * @param attacker Creature * @param damage int */ @Override protected void onEvtClanAttacked(Creature attacked_member, Creature attacker, int damage) { super.onEvtClanAttacked(attacked_member, attacker, damage); final NpcInstance actor = getActor(); if (_healSkills.length == 0) { return; } if (attacked_member.isDead() || actor.isDead() || (attacked_member.getCurrentHpPercents() > 50)) { return; } int heal_chance = 0; if (attacked_member.getId() == actor.getId()) { heal_chance = (attacked_member.getObjectId() == actor.getObjectId()) ? 100 : 0; } else { heal_chance = (attacked_member.getId() == Orfen_id) ? 90 : 10; } if (Rnd.chance(heal_chance) && canUseSkill(_healSkills[0], attacked_member, -1)) { addTaskAttack(attacked_member, _healSkills[0], 1000000); } }
/** * Method canAttackCharacter. * * @param target Creature * @return boolean */ @Override protected boolean canAttackCharacter(Creature target) { final NpcInstance actor = getActor(); if (getIntention() == CtrlIntention.AI_INTENTION_ATTACK) { final AggroList.AggroInfo ai = actor.getAggroList().get(target); return (ai != null) && (ai.hate > 0); } if (!startBattle) { return false; } return Util.contains(ATTACK_IDS, target.getId()); }
/** * Method checkAggression. * * @param target Creature * @return boolean */ @Override public boolean checkAggression(Creature target) { if ((getIntention() != CtrlIntention.AI_INTENTION_ACTIVE) || !isGlobalAggro()) { return false; } if (target.isNpc() && !Util.contains(ATTACK_IDS, target.getId())) { return false; } if (!startBattle) { return false; } return super.checkAggression(target); }
/** * Method thinkActive. * * @return boolean */ @Override protected boolean thinkActive() { final NpcInstance actor = getActor(); if ((actor == null) || actor.isDead()) { return true; } if (_def_think) { doTask(); return true; } if ((diedTentacle < 3) || (currentPoint > (MOVE_LOC.length - 1))) { final List<Creature> list = World.getAroundCharacters( getActor(), getActor().getAggroRange(), getActor().getAggroRange()); for (Creature target : list) { if ((target != null) && !target.isDead() && Util.contains(ATTACK_IDS, target.getId())) { clearTasks(); actor.setRunning(); addTaskAttack(target); return true; } } if ((currentPoint > (MOVE_LOC.length - 1)) && (currentPoint2 <= (way.length - 1))) { if (loc == null) { loc = new Location( (way[currentPoint2].getX() + Rnd.get(50)) - Rnd.get(50), (way[currentPoint2].getY() + Rnd.get(50)) - Rnd.get(50), (way[currentPoint2].getZ() + Rnd.get(50)) - Rnd.get(50)); } actor.setRunning(); clearTasks(); addTaskMove(loc, true); doTask(); return true; } return false; } else if ((diedTentacle >= 3) && (currentPoint <= (MOVE_LOC.length - 1))) { if (loc == null) { loc = new Location( (MOVE_LOC[currentPoint].getX() + Rnd.get(50)) - Rnd.get(50), (MOVE_LOC[currentPoint].getY() + Rnd.get(50)) - Rnd.get(50), (MOVE_LOC[currentPoint].getZ() + Rnd.get(50)) - Rnd.get(50)); } actor.setRunning(); clearTasks(); addTaskMove(loc, true); doTask(); return true; } return false; }