[L2NPC] Stuck, Root Ai check for prevent abuses.
Issue #93
resolved
if( myself::IsNullCreature( myself.top_desire_target ) == 0 )
{
if( myself::GetPathfindFailCount() > 10 && attacker == myself.top_desire_target && myself::FloatToInt( myself.sm.hp ) != myself::FloatToInt( myself.sm.max_hp ) )
{
myself::InstantTeleport( myself.sm, myself::FloatToInt( attacker.x ), myself::FloatToInt( attacker.y ), myself::FloatToInt( attacker.z ) );
}
if( myself::GetAbnormalLevel( myself.sm, myself::Skill_GetAbnormalType( @s_dryad_root11 ) ) >= 0 && myself::DistFromMe( myself.top_desire_target ) > 40 )
{
if( myself::CanAttack( myself.top_desire_target ) == 1 )
{
if( attacker.is_pc != 0 || myself::IsInCategory( @summon_npc_group, attacker.npc_class_id ) )
{
f0 = 0;
if( SetHateGroup >= 0 )
{
if( myself::IsInCategory( SetHateGroup, attacker.occupation ) )
{
f0 = ( f0 + SetHateGroupRatio );
}
}
if( attacker.occupation == SetHateOccupation )
{
f0 = ( f0 + SetHateOccupationRatio );
}
if( SetHateRace == attacker.race )
{
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( 1.000000 * damage / ( myself.sm.level + 7 ) + f0 / 100 * 1.000000 * damage / ( myself.sm.level + 7 ) );
myself::AddAttackDesire( attacker, @AMT_MOVE_TO_TARGET, f0 * 100 );
}
}
else
{
myself::RemoveAttackDesire( myself.top_desire_target.id );
if( attacker.is_pc != 0 || myself::IsInCategory( @summon_npc_group, attacker.npc_class_id ) )
{
f0 = 0;
if( SetHateGroup >= 0 )
{
if( myself::IsInCategory( SetHateGroup, attacker.occupation ) )
{
f0 = ( f0 + SetHateGroupRatio );
}
}
if( attacker.occupation == SetHateOccupation )
{
f0 = ( f0 + SetHateOccupationRatio );
}
if( SetHateRace == attacker.race )
{
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( 1.000000 * damage / ( myself.sm.level + 7 ) + f0 / 100 * 1.000000 * damage / ( myself.sm.level + 7 ) );
myself::AddAttackDesire( attacker, @AMT_MOVE_TO_TARGET, f0 * 100 );
}
}
}
}
Comments (4)
-
repo owner -
repo owner - edited description
-
repo owner -
repo owner - changed status to resolved
CanAttack is added
- Log in to comment
CanAttack
has to be implemented in AI