03-08-2011, 04:43 PM
немного топорно, но вполне работающе:
З.Ы. описания зон и скиллов в них не привожу - это сделать самому раз плюнуть.
Код:
package ai;
import l2p.gameserver.ai.Fighter;
import l2p.gameserver.instancemanager.RaidBossSpawnManager;
import l2p.gameserver.instancemanager.RaidBossSpawnManager.Status;
import l2p.gameserver.instancemanager.ZoneManager;
import l2p.gameserver.model.L2Character;
import l2p.gameserver.model.L2Zone;
import l2p.gameserver.model.L2Zone.ZoneType;
import l2p.gameserver.model.instances.L2NpcInstance;
public class StakatoQueen extends Fighter
{
private final static int _playerDebuffZone = 708008;
private final static int _npcBuffZone = 708009;
private final static int _playerBuffZone = 708010;
private static boolean _zoneDisabled = false;
public StakatoQueen(L2Character actor)
{
super(actor);
}
@Override
public boolean isGlobalAI()
{
return true;
}
@Override
protected boolean thinkActive()
{
L2NpcInstance actor = getActor();
if(actor == null || actor.isDead())
return true;
if (!_zoneDisabled && RaidBossSpawnManager.getInstance().getRaidBossStatusId(actor.getNpcId()) == Status.ALIVE)
{
switchZone(false, _playerBuffZone);
switchZone(true, _playerDebuffZone);
switchZone(true, _npcBuffZone);
}
return super.thinkActive();
}
@Override
protected void onEvtDead(L2Character killer)
{
switchZone(true, _playerBuffZone);
switchZone(false, _playerDebuffZone);
switchZone(false, _npcBuffZone);
super.onEvtDead(killer);
}
private void switchZone(boolean zoneMode, int zoneId)
{
L2Zone _zone = ZoneManager.getInstance().getZoneById(ZoneType.buff_skill, zoneId, false);
if(_zone != null && _zone.isActive() != zoneMode)
{
_zone.setActive(zoneMode);
if (zoneId == _playerBuffZone)
_zoneDisabled = !zoneMode;
}
}
}