CT2.5 l2j code...
// =========================================================
// Method - Private
/**
* Launch a physical attack against a target (Simple, Bow, Pole or Dual).<BR><BR>
*
* <B><U> Actions</U> :</B><BR><BR>
* <li>Get the active weapon (always equiped in the right hand) </li><BR><BR>
* <li>If weapon is a bow, check for arrows, MP and bow re-use delay (if necessary, equip the L2PcInstance with arrows in left hand)</li>
* <li>If weapon is a bow, consume MP and set the new period of bow non re-use </li><BR><BR>
* <li>Get the Attack Speed of the L2Character (delay (in milliseconds) before next attack) </li>
* <li>Select the type of attack to start (Simple, Bow, Pole or Dual) and verify if SoulShot are charged then start calculation</li>
* <li>If the Server->Client packet Attack contains at least 1 hit, send the Server->Client packet Attack to the L2Character AND to all L2PcInstance in the _KnownPlayers of the L2Character</li>
* <li>Notify AI with EVT_READY_TO_ACT</li><BR><BR>
*
* @param target The L2Character targeted
*
*/
protected void doAttack(L2Character target)
{
if (Config.DEBUG)
_log.fine(getName()+" doAttack: target="+target);
if (!isAlikeDead() && target != null)
{
if (this instanceof L2Npc && target.isAlikeDead()
|| !getKnownList().knowsObject(target))
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (this instanceof L2PcInstance)
{
if (target.isDead())
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
L2PcInstance actor = (L2PcInstance)this;
/*
* Players riding wyvern or with special (flying) transformations can do melee attacks, only with skills
*/
if ((actor.isMounted() && actor.getMountNpcId() == 12621)
|| (actor.isTransformed() && !actor.getTransformation().canDoMeleeAttack()))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
}
if (isAttackingDisabled())
return;