/** * @author Mobius * @version $Revision: 1.0 $ */ public final class YehanBrother extends Fighter { private long _spawnTimer = 0; private static final int[] _minions = ArrayUtils.createAscendingArray(22509, 22512); /** * Constructor for YehanBrother. * * @param actor NpcInstance */ public YehanBrother(NpcInstance actor) { super(actor); } /** Method onEvtSpawn. */ @Override protected void onEvtSpawn() { super.onEvtSpawn(); _spawnTimer = System.currentTimeMillis(); } /** * Method getBrother. * * @return NpcInstance */ private NpcInstance getBrother() { final NpcInstance actor = getActor(); int brotherId = 0; if (actor.getId() == 25665) { brotherId = 25666; } else if (actor.getId() == 25666) { brotherId = 25665; } for (NpcInstance npc : actor.getReflection().getNpcs()) { if (npc.getId() == brotherId) { return npc; } } return null; } /** Method thinkAttack. */ @Override protected void thinkAttack() { final NpcInstance actor = getActor(); final NpcInstance brother = getBrother(); if (!brother.isDead() && !actor.isInRange(brother, 300)) { actor.altOnMagicUseTimer(getActor(), SkillTable.getInstance().getInfo(6371, 1)); } else { removeInvul(actor); } if ((_spawnTimer + 40000) < System.currentTimeMillis()) { _spawnTimer = System.currentTimeMillis(); final NpcInstance mob = actor .getReflection() .addSpawnWithoutRespawn( _minions[Rnd.get(_minions.length)], Location.findAroundPosition(actor, 300), 0); mob.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, actor.getAggressionTarget(), 1000); } super.thinkAttack(); } /** * Method removeInvul. * * @param npc NpcInstance */ private void removeInvul(NpcInstance npc) { for (Effect e : npc.getEffectList().getAllEffects()) { if (e.getSkill().getId() == 6371) { e.exit(); } } } }