Added missing final modifiers.
This commit is contained in:
@@ -93,7 +93,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
return;
|
||||
}
|
||||
|
||||
L2Character followTarget = _followTarget; // copy to prevent NPE
|
||||
final L2Character followTarget = _followTarget; // copy to prevent NPE
|
||||
if (followTarget == null)
|
||||
{
|
||||
if (_actor instanceof L2Summon)
|
||||
@@ -660,7 +660,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
{
|
||||
if (_actor instanceof L2Summon)
|
||||
{
|
||||
L2Summon summon = (L2Summon) _actor;
|
||||
final L2Summon summon = (L2Summon) _actor;
|
||||
if (summon.getOwner() != null)
|
||||
{
|
||||
summon.getOwner().getAI().setAutoAttacking(isAutoAttacking);
|
||||
@@ -678,7 +678,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
{
|
||||
if (_actor instanceof L2Summon)
|
||||
{
|
||||
L2Summon summon = (L2Summon) _actor;
|
||||
final L2Summon summon = (L2Summon) _actor;
|
||||
if (summon.getOwner() != null)
|
||||
{
|
||||
summon.getOwner().getAI().clientStartAutoAttack();
|
||||
@@ -711,7 +711,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
{
|
||||
if (_actor instanceof L2Summon)
|
||||
{
|
||||
L2Summon summon = (L2Summon) _actor;
|
||||
final L2Summon summon = (L2Summon) _actor;
|
||||
if (summon.getOwner() != null)
|
||||
{
|
||||
summon.getOwner().getAI().clientStopAutoAttack();
|
||||
@@ -739,7 +739,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
protected void clientNotifyDead()
|
||||
{
|
||||
// Send a Server->Client packet Die to the actor and all L2PcInstance in its _knownPlayers
|
||||
Die msg = new Die(_actor);
|
||||
final Die msg = new Die(_actor);
|
||||
_actor.broadcastPacket(msg);
|
||||
|
||||
// Init AI
|
||||
|
@@ -338,7 +338,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
if ((intention == AI_INTENTION_IDLE) || (intention == AI_INTENTION_ACTIVE))
|
||||
{
|
||||
// Check if actor is not dead
|
||||
L2Attackable npc = getActiveChar();
|
||||
final L2Attackable npc = getActiveChar();
|
||||
if (!npc.isAlikeDead())
|
||||
{
|
||||
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
|
||||
@@ -466,7 +466,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
*/
|
||||
protected void thinkActive()
|
||||
{
|
||||
L2Attackable npc = getActiveChar();
|
||||
final L2Attackable npc = getActiveChar();
|
||||
|
||||
// Update every 1s the _globalAggro counter to come close to 0
|
||||
if (_globalAggro != 0)
|
||||
@@ -486,7 +486,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
if (_globalAggro >= 0)
|
||||
{
|
||||
// Get all visible objects inside its Aggro Range
|
||||
Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
|
||||
final Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
|
||||
|
||||
for (L2Object obj : objs)
|
||||
{
|
||||
@@ -494,7 +494,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
continue;
|
||||
}
|
||||
L2Character target = (L2Character) obj;
|
||||
final L2Character target = (L2Character) obj;
|
||||
|
||||
// For each L2Character check if the target is autoattackable
|
||||
if (autoAttackCondition(target)) // check aggression
|
||||
@@ -509,7 +509,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
int hating = npc.getHating(target);
|
||||
final int hating = npc.getHating(target);
|
||||
|
||||
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
|
||||
if (hating == 0)
|
||||
@@ -534,7 +534,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
if ((hated != null) && !npc.isCoreAIDisabled())
|
||||
{
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
int aggro = npc.getHating(hated);
|
||||
final int aggro = npc.getHating(hated);
|
||||
|
||||
if ((aggro + _globalAggro) > 0)
|
||||
{
|
||||
@@ -681,12 +681,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
|
||||
// Calculate the distance between the current position of the L2Character and the target (x,y)
|
||||
double distance2 = npc.calculateDistance(x1, y1, 0, false, true);
|
||||
final double distance2 = npc.calculateDistance(x1, y1, 0, false, true);
|
||||
|
||||
if (distance2 > ((range + range) * (range + range)))
|
||||
{
|
||||
npc.setisReturningToSpawnPoint(true);
|
||||
float delay = (float) Math.sqrt(distance2) / range;
|
||||
final float delay = (float) Math.sqrt(distance2) / range;
|
||||
x1 = npc.getX() + (int) ((x1 - npc.getX()) / delay);
|
||||
y1 = npc.getY() + (int) ((y1 - npc.getY()) / delay);
|
||||
}
|
||||
@@ -709,7 +709,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
else
|
||||
{
|
||||
int deltaX = Rnd.nextInt(range * 2); // x
|
||||
final int deltaX = Rnd.nextInt(range * 2); // x
|
||||
int deltaY = Rnd.get(deltaX, range * 2); // distance
|
||||
deltaY = (int) Math.sqrt((deltaY * deltaY) - (deltaX * deltaX)); // y
|
||||
x1 = (deltaX + x1) - range;
|
||||
@@ -741,7 +741,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
L2Character originalAttackTarget = getAttackTarget();
|
||||
final L2Character originalAttackTarget = getAttackTarget();
|
||||
// Check if target is dead or if timeout is expired to stop this attack
|
||||
if ((originalAttackTarget == null) || originalAttackTarget.isAlikeDead())
|
||||
{
|
||||
@@ -774,7 +774,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
|
||||
// Handle all L2Object of its Faction inside the Faction Range
|
||||
|
||||
Set<Integer> clans = getActiveChar().getTemplate().getClans();
|
||||
final Set<Integer> clans = getActiveChar().getTemplate().getClans();
|
||||
if ((clans != null) && !clans.isEmpty())
|
||||
{
|
||||
final int factionRange = npc.getTemplate().getClanHelpRange() + collision;
|
||||
@@ -785,7 +785,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
if (obj instanceof L2Npc)
|
||||
{
|
||||
L2Npc called = (L2Npc) obj;
|
||||
final L2Npc called = (L2Npc) obj;
|
||||
|
||||
if (!getActiveChar().getTemplate().isClan(called.getTemplate().getClans()))
|
||||
{
|
||||
@@ -826,7 +826,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
|
||||
// Initialize data
|
||||
L2Character mostHate = npc.getMostHated();
|
||||
final L2Character mostHate = npc.getMostHated();
|
||||
if (mostHate == null)
|
||||
{
|
||||
setIntention(AI_INTENTION_ACTIVE);
|
||||
@@ -884,7 +884,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
|
||||
if (!npc.isInsideRadius(newX, newY, 0, collision, false, false))
|
||||
{
|
||||
int newZ = npc.getZ() + 30;
|
||||
final int newZ = npc.getZ() + 30;
|
||||
if (GeoData.getInstance().canMove(npc.getX(), npc.getY(), npc.getZ(), newX, newY, newZ, npc.getInstanceId()))
|
||||
{
|
||||
moveTo(newX, newY, newZ);
|
||||
@@ -900,12 +900,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
if (Rnd.get(100) <= npc.getDodge())
|
||||
{
|
||||
// Micht: kepping this one otherwise we should do 2 sqrt
|
||||
double distance2 = npc.calculateDistance(mostHate, false, true);
|
||||
final double distance2 = npc.calculateDistance(mostHate, false, true);
|
||||
if (Math.sqrt(distance2) <= (60 + combinedCollision))
|
||||
{
|
||||
int posX = npc.getX();
|
||||
int posY = npc.getY();
|
||||
int posZ = npc.getZ() + 30;
|
||||
final int posZ = npc.getZ() + 30;
|
||||
|
||||
if (originalAttackTarget.getX() < posX)
|
||||
{
|
||||
@@ -970,7 +970,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
if (_chaosTime > Config.GRAND_CHAOS_TIME)
|
||||
{
|
||||
double chaosRate = 100 - ((npc.getCurrentHp() * 300) / npc.getMaxHp());
|
||||
final double chaosRate = 100 - ((npc.getCurrentHp() * 300) / npc.getMaxHp());
|
||||
if (((chaosRate <= 10) && (Rnd.get(100) <= 10)) || ((chaosRate > 10) && (Rnd.get(100) <= chaosRate)))
|
||||
{
|
||||
aggroReconsider();
|
||||
@@ -1004,7 +1004,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
double percentage = (npc.getCurrentHp() / npc.getMaxHp()) * 100;
|
||||
if (npc.isMinion())
|
||||
{
|
||||
L2Character leader = npc.getLeader();
|
||||
final L2Character leader = npc.getLeader();
|
||||
if ((leader != null) && !leader.isDead() && (Rnd.get(100) > ((leader.getCurrentHp() / leader.getMaxHp()) * 100)))
|
||||
{
|
||||
for (Skill healSkill : aiHealSkills)
|
||||
@@ -1113,7 +1113,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
if (npc.isMinion())
|
||||
{
|
||||
L2Character leader = npc.getLeader();
|
||||
final L2Character leader = npc.getLeader();
|
||||
if ((leader != null) && leader.isDead())
|
||||
{
|
||||
for (Skill sk : aiResSkills)
|
||||
@@ -1163,7 +1163,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Attackable targets = ((L2Attackable) obj);
|
||||
final L2Attackable targets = ((L2Attackable) obj);
|
||||
if (!npc.isInMyClan(targets))
|
||||
{
|
||||
continue;
|
||||
@@ -1198,8 +1198,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
double dist = npc.calculateDistance(mostHate, false, false);
|
||||
int dist2 = (int) dist - collision;
|
||||
final double dist = npc.calculateDistance(mostHate, false, false);
|
||||
final int dist2 = (int) dist - collision;
|
||||
int range = npc.getPhysicalAttackRange() + combinedCollision;
|
||||
if (mostHate.isMoving())
|
||||
{
|
||||
@@ -1300,10 +1300,10 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
double dist = caster.calculateDistance(attackTarget, false, false);
|
||||
final double dist = caster.calculateDistance(attackTarget, false, false);
|
||||
double dist2 = dist - attackTarget.getTemplate().getCollisionRadius();
|
||||
double range = caster.getPhysicalAttackRange() + caster.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
|
||||
double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
|
||||
final double range = caster.getPhysicalAttackRange() + caster.getTemplate().getCollisionRadius() + attackTarget.getTemplate().getCollisionRadius();
|
||||
final double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
|
||||
if (attackTarget.isMoving())
|
||||
{
|
||||
dist2 = dist2 - 30;
|
||||
@@ -1329,7 +1329,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
if (sk.getTargetType() == L2TargetType.ONE)
|
||||
{
|
||||
L2Character target = effectTargetReconsider(sk, true);
|
||||
final L2Character target = effectTargetReconsider(sk, true);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1376,7 +1376,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
else if (sk.getTargetType() == L2TargetType.ONE)
|
||||
{
|
||||
L2Character target = effectTargetReconsider(sk, false);
|
||||
final L2Character target = effectTargetReconsider(sk, false);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1397,7 +1397,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
caster.doCast(sk);
|
||||
return true;
|
||||
}
|
||||
L2Character target = effectTargetReconsider(sk, false);
|
||||
final L2Character target = effectTargetReconsider(sk, false);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1430,7 +1430,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
double percentage = (caster.getCurrentHp() / caster.getMaxHp()) * 100;
|
||||
if (caster.isMinion() && (sk.getTargetType() != L2TargetType.SELF))
|
||||
{
|
||||
L2Character leader = caster.getLeader();
|
||||
final L2Character leader = caster.getLeader();
|
||||
if ((leader != null) && !leader.isDead() && (Rnd.get(100) > ((leader.getCurrentHp() / leader.getMaxHp()) * 100)))
|
||||
{
|
||||
if (!Util.checkIfInRange((sk.getCastRange() + caster.getTemplate().getCollisionRadius() + leader.getTemplate().getCollisionRadius()), caster, leader, false) && !isParty(sk) && !caster.isMovementDisabled())
|
||||
@@ -1466,7 +1466,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Attackable targets = ((L2Attackable) obj);
|
||||
final L2Attackable targets = ((L2Attackable) obj);
|
||||
if (!caster.isInMyClan(targets))
|
||||
{
|
||||
continue;
|
||||
@@ -1495,7 +1495,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Npc targets = ((L2Npc) obj);
|
||||
final L2Npc targets = ((L2Npc) obj);
|
||||
if (targets.isInMyClan(caster))
|
||||
{
|
||||
if ((obj.getCurrentHp() < obj.getMaxHp()) && (Rnd.get(100) <= 20))
|
||||
@@ -1522,7 +1522,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return true;
|
||||
}
|
||||
|
||||
L2Character target = skillTargetReconsider(sk);
|
||||
final L2Character target = skillTargetReconsider(sk);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1557,7 +1557,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
L2Character target = effectTargetReconsider(sk, false);
|
||||
final L2Character target = effectTargetReconsider(sk, false);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1610,7 +1610,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
else if (sk.getTargetType() == L2TargetType.ONE)
|
||||
{
|
||||
L2Character target = effectTargetReconsider(sk, false);
|
||||
final L2Character target = effectTargetReconsider(sk, false);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1648,7 +1648,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
else if (sk.getTargetType() == L2TargetType.ONE)
|
||||
{
|
||||
L2Character target = effectTargetReconsider(sk, false);
|
||||
final L2Character target = effectTargetReconsider(sk, false);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1664,7 +1664,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
if (caster.isMinion() && (sk.getTargetType() != L2TargetType.SELF))
|
||||
{
|
||||
L2Character leader = caster.getLeader();
|
||||
final L2Character leader = caster.getLeader();
|
||||
if (leader != null)
|
||||
{
|
||||
if (leader.isDead())
|
||||
@@ -1692,7 +1692,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Attackable targets = ((L2Attackable) obj);
|
||||
final L2Attackable targets = ((L2Attackable) obj);
|
||||
if (!caster.isInMyClan(targets))
|
||||
{
|
||||
continue;
|
||||
@@ -1719,7 +1719,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
continue;
|
||||
}
|
||||
L2Npc targets = ((L2Npc) obj);
|
||||
final L2Npc targets = ((L2Npc) obj);
|
||||
if (caster.isInMyClan(targets))
|
||||
{
|
||||
if ((obj.getCurrentHp() < obj.getMaxHp()) && (Rnd.get(100) <= 20))
|
||||
@@ -1745,7 +1745,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return true;
|
||||
}
|
||||
|
||||
L2Character target = skillTargetReconsider(sk);
|
||||
final L2Character target = skillTargetReconsider(sk);
|
||||
if (target != null)
|
||||
{
|
||||
clientStopMoving(null);
|
||||
@@ -1797,7 +1797,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
// -------------------------------------------------------------
|
||||
// Try to stop the target or disable the target as priority
|
||||
int random = Rnd.get(100);
|
||||
final int random = Rnd.get(100);
|
||||
if (!getAttackTarget().isImmobilized() && (random < 2))
|
||||
{
|
||||
for (Skill sk : npc.getTemplate().getAISkills(AISkillScope.IMMOBILIZE))
|
||||
@@ -2020,7 +2020,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
return null;
|
||||
}
|
||||
L2Attackable actor = getActiveChar();
|
||||
final L2Attackable actor = getActiveChar();
|
||||
if (!sk.hasEffectType(L2EffectType.DISPEL, L2EffectType.DISPEL_BY_SLOT))
|
||||
{
|
||||
if (!positive)
|
||||
@@ -2107,7 +2107,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Attackable targets = ((L2Attackable) obj);
|
||||
final L2Attackable targets = ((L2Attackable) obj);
|
||||
if (targets.isInMyClan(actor))
|
||||
{
|
||||
continue;
|
||||
@@ -2187,7 +2187,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
double dist = 0;
|
||||
double dist2 = 0;
|
||||
int range = 0;
|
||||
L2Attackable actor = getActiveChar();
|
||||
final L2Attackable actor = getActiveChar();
|
||||
if (actor.getHateList() != null)
|
||||
{
|
||||
for (L2Character obj : actor.getHateList())
|
||||
@@ -2218,7 +2218,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
|
||||
if (!(actor instanceof L2GuardInstance))
|
||||
{
|
||||
Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
|
||||
final Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
|
||||
for (L2Object target : objs)
|
||||
{
|
||||
try
|
||||
@@ -2274,8 +2274,8 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
double dist = 0;
|
||||
double dist2 = 0;
|
||||
int range = 0;
|
||||
L2Attackable actor = getActiveChar();
|
||||
L2Character MostHate = actor.getMostHated();
|
||||
final L2Attackable actor = getActiveChar();
|
||||
final L2Character MostHate = actor.getMostHated();
|
||||
if (actor.getHateList() != null)
|
||||
{
|
||||
for (L2Character obj : actor.getHateList())
|
||||
@@ -2317,7 +2317,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
if (!(actor instanceof L2GuardInstance))
|
||||
{
|
||||
Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
|
||||
final Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
|
||||
for (L2Object target : objs)
|
||||
{
|
||||
L2Character obj = null;
|
||||
@@ -2384,12 +2384,12 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
|
||||
private void aggroReconsider()
|
||||
{
|
||||
L2Attackable actor = getActiveChar();
|
||||
L2Character MostHate = actor.getMostHated();
|
||||
final L2Attackable actor = getActiveChar();
|
||||
final L2Character MostHate = actor.getMostHated();
|
||||
if (actor.getHateList() != null)
|
||||
{
|
||||
|
||||
int rand = Rnd.get(actor.getHateList().size());
|
||||
final int rand = Rnd.get(actor.getHateList().size());
|
||||
int count = 0;
|
||||
for (L2Character obj : actor.getHateList())
|
||||
{
|
||||
@@ -2428,7 +2428,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
|
||||
if (!(actor instanceof L2GuardInstance))
|
||||
{
|
||||
Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
|
||||
final Collection<L2Object> objs = actor.getKnownList().getKnownObjects().values();
|
||||
for (L2Object target : objs)
|
||||
{
|
||||
L2Character obj = null;
|
||||
@@ -2551,7 +2551,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
@Override
|
||||
protected void onEvtAttacked(L2Character attacker)
|
||||
{
|
||||
L2Attackable me = getActiveChar();
|
||||
final L2Attackable me = getActiveChar();
|
||||
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
|
@@ -746,7 +746,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
|
||||
if (_actor instanceof L2Npc)
|
||||
{
|
||||
L2Npc npc = (L2Npc) _actor;
|
||||
final L2Npc npc = (L2Npc) _actor;
|
||||
WalkingManager.getInstance().onArrived(npc); // Walking Manager support
|
||||
|
||||
// Notify to scripts
|
||||
@@ -962,11 +962,11 @@ public class L2CharacterAI extends AbstractAI
|
||||
@Override
|
||||
protected void onEvtAfraid(L2Character effector, boolean start)
|
||||
{
|
||||
double radians = Math.toRadians(start ? Util.calculateAngleFrom(effector, _actor) : Util.convertHeadingToDegree(_actor.getHeading()));
|
||||
final double radians = Math.toRadians(start ? Util.calculateAngleFrom(effector, _actor) : Util.convertHeadingToDegree(_actor.getHeading()));
|
||||
|
||||
int posX = (int) (_actor.getX() + (FEAR_RANGE * Math.cos(radians)));
|
||||
int posY = (int) (_actor.getY() + (FEAR_RANGE * Math.sin(radians)));
|
||||
int posZ = _actor.getZ();
|
||||
final int posX = (int) (_actor.getX() + (FEAR_RANGE * Math.cos(radians)));
|
||||
final int posY = (int) (_actor.getY() + (FEAR_RANGE * Math.sin(radians)));
|
||||
final int posZ = _actor.getZ();
|
||||
|
||||
if (!_actor.isPet())
|
||||
{
|
||||
@@ -1016,13 +1016,13 @@ public class L2CharacterAI extends AbstractAI
|
||||
int x = _actor.getX();
|
||||
int y = _actor.getY();
|
||||
|
||||
double dx = worldPosition.getX() - x;
|
||||
double dy = worldPosition.getY() - y;
|
||||
final double dx = worldPosition.getX() - x;
|
||||
final double dy = worldPosition.getY() - y;
|
||||
|
||||
double dist = Math.sqrt((dx * dx) + (dy * dy));
|
||||
|
||||
double sin = dy / dist;
|
||||
double cos = dx / dist;
|
||||
final double sin = dy / dist;
|
||||
final double cos = dx / dist;
|
||||
|
||||
dist -= offset - 5;
|
||||
|
||||
@@ -1080,7 +1080,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
|
||||
if (target.isDoor())
|
||||
{
|
||||
L2DoorInstance dor = (L2DoorInstance) target;
|
||||
final L2DoorInstance dor = (L2DoorInstance) target;
|
||||
int xPoint = 0;
|
||||
int yPoint = 0;
|
||||
for (int i : dor.getTemplate().getNodeX())
|
||||
@@ -1229,7 +1229,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
// check if player is fakedeath
|
||||
if (target instanceof L2PcInstance)
|
||||
{
|
||||
L2PcInstance target2 = (L2PcInstance) target; // convert object to chara
|
||||
final L2PcInstance target2 = (L2PcInstance) target; // convert object to chara
|
||||
|
||||
if (target2.isFakeDeath())
|
||||
{
|
||||
@@ -1326,7 +1326,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
{
|
||||
continue;
|
||||
}
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
boolean hasLongRangeDamageSkill = false;
|
||||
|
||||
if (sk.isContinuous())
|
||||
@@ -1475,7 +1475,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
}
|
||||
else
|
||||
{
|
||||
L2Weapon weapon = target.getActiveWeaponItem();
|
||||
final L2Weapon weapon = target.getActiveWeaponItem();
|
||||
if ((weapon != null) && ((weapon.getItemType() == WeaponType.BOW) || (weapon.getItemType() == WeaponType.CROSSBOW)))
|
||||
{
|
||||
isArcher = true;
|
||||
@@ -1538,7 +1538,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
}
|
||||
if (target instanceof L2Attackable)
|
||||
{
|
||||
L2Npc actors = ((L2Npc) _actor);
|
||||
final L2Npc actors = ((L2Npc) _actor);
|
||||
|
||||
if (!actors.isChaos())
|
||||
{
|
||||
@@ -1567,7 +1567,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
}
|
||||
if (target instanceof L2Attackable)
|
||||
{
|
||||
L2Npc actors = ((L2Npc) _actor);
|
||||
final L2Npc actors = ((L2Npc) _actor);
|
||||
|
||||
if (!actors.isChaos())
|
||||
{
|
||||
@@ -1599,7 +1599,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
}
|
||||
if (target instanceof L2Attackable)
|
||||
{
|
||||
L2Npc actors = ((L2Npc) _actor);
|
||||
final L2Npc actors = ((L2Npc) _actor);
|
||||
|
||||
if (!actors.isChaos())
|
||||
{
|
||||
@@ -1629,7 +1629,7 @@ public class L2CharacterAI extends AbstractAI
|
||||
|
||||
if (target instanceof L2Attackable)
|
||||
{
|
||||
L2Npc actors = ((L2Npc) _actor);
|
||||
final L2Npc actors = ((L2Npc) _actor);
|
||||
if (!actors.isChaos())
|
||||
{
|
||||
continue;
|
||||
@@ -1662,8 +1662,8 @@ public class L2CharacterAI extends AbstractAI
|
||||
{
|
||||
continue;
|
||||
}
|
||||
L2Npc targets = ((L2Npc) target);
|
||||
L2Npc actors = ((L2Npc) _actor);
|
||||
final L2Npc targets = ((L2Npc) target);
|
||||
final L2Npc actors = ((L2Npc) _actor);
|
||||
if (targets.isInMyClan(actors))
|
||||
{
|
||||
count++;
|
||||
|
@@ -69,14 +69,14 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
|
||||
protected void thinkFollow()
|
||||
{
|
||||
L2Attackable me = (L2Attackable) _actor;
|
||||
final L2Attackable me = (L2Attackable) _actor;
|
||||
|
||||
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
|
||||
{
|
||||
int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
||||
int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
||||
int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
||||
int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
||||
final int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
||||
final int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
|
||||
final int randX = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
||||
final int randY = Rnd.nextInt(MobGroupTable.FOLLOW_RANGE);
|
||||
|
||||
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
@Override
|
||||
protected void thinkCast()
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
if ((getAttackTarget() == null) || getAttackTarget().isAlikeDead())
|
||||
{
|
||||
setAttackTarget(findNextRndTarget());
|
||||
@@ -176,7 +176,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
|
||||
protected void thinkAttackGroup()
|
||||
{
|
||||
L2Character target = getForcedTarget();
|
||||
final L2Character target = getForcedTarget();
|
||||
if ((target == null) || target.isAlikeDead())
|
||||
{
|
||||
// try to get next group target
|
||||
@@ -191,12 +191,12 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
|
||||
_actor.setTarget(target);
|
||||
// as a response, we put the target in a forced attack mode
|
||||
L2ControllableMobInstance theTarget = (L2ControllableMobInstance) target;
|
||||
L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
|
||||
final L2ControllableMobInstance theTarget = (L2ControllableMobInstance) target;
|
||||
final L2ControllableMobAI ctrlAi = (L2ControllableMobAI) theTarget.getAI();
|
||||
ctrlAi.forceAttack(_actor);
|
||||
|
||||
double dist2 = _actor.calculateDistance(target, false, true);
|
||||
int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
|
||||
final double dist2 = _actor.calculateDistance(target, false, true);
|
||||
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
|
||||
int max_range = range;
|
||||
|
||||
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
|
||||
@@ -204,7 +204,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
// check distant skills
|
||||
for (Skill sk : _actor.getAllSkills())
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
|
||||
{
|
||||
@@ -235,8 +235,8 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
}
|
||||
|
||||
_actor.setTarget(getForcedTarget());
|
||||
double dist2 = _actor.calculateDistance(getForcedTarget(), false, true);
|
||||
int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
|
||||
final double dist2 = _actor.calculateDistance(getForcedTarget(), false, true);
|
||||
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
|
||||
int max_range = range;
|
||||
|
||||
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
|
||||
@@ -244,7 +244,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
// check distant skills
|
||||
for (Skill sk : _actor.getAllSkills())
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
|
||||
{
|
||||
@@ -274,7 +274,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
if (getAttackTarget() != null)
|
||||
{
|
||||
// stop hating
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
npc.stopHating(getAttackTarget());
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
// notify aggression
|
||||
if (((L2Npc) _actor).getTemplate().getClans() != null)
|
||||
{
|
||||
Collection<L2Object> objs = _actor.getKnownList().getKnownObjects().values();
|
||||
final Collection<L2Object> objs = _actor.getKnownList().getKnownObjects().values();
|
||||
for (L2Object obj : objs)
|
||||
{
|
||||
if (!(obj instanceof L2Npc))
|
||||
@@ -293,7 +293,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Npc npc = (L2Npc) obj;
|
||||
final L2Npc npc = (L2Npc) obj;
|
||||
|
||||
if (!npc.isInMyClan((L2Npc) _actor))
|
||||
{
|
||||
@@ -308,8 +308,8 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
}
|
||||
|
||||
_actor.setTarget(getAttackTarget());
|
||||
double dist2 = _actor.calculateDistance(getAttackTarget(), false, true);
|
||||
int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
|
||||
final double dist2 = _actor.calculateDistance(getAttackTarget(), false, true);
|
||||
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
|
||||
int max_range = range;
|
||||
|
||||
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
|
||||
@@ -317,7 +317,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
// check distant skills
|
||||
for (Skill sk : _actor.getAllSkills())
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
|
||||
{
|
||||
@@ -359,7 +359,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
|
||||
{
|
||||
for (Skill sk : _actor.getAllSkills())
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() < _actor.getStat().getMpConsume(sk)))
|
||||
{
|
||||
|
@@ -160,7 +160,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
// Get the owner if the target is a summon
|
||||
if (target instanceof L2Summon)
|
||||
{
|
||||
L2PcInstance owner = ((L2Summon) target).getOwner();
|
||||
final L2PcInstance owner = ((L2Summon) target).getOwner();
|
||||
if (_actor.isInsideRadius(owner, 1000, true, false))
|
||||
{
|
||||
target = owner;
|
||||
@@ -201,7 +201,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
// Check if actor is not dead
|
||||
if (!_actor.isAlikeDead())
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
|
||||
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
|
||||
if (!npc.getKnownList().getKnownPlayers().isEmpty())
|
||||
@@ -269,7 +269,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
*/
|
||||
private void thinkActive()
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
|
||||
// Update every 1s the _globalAggro counter to come close to 0
|
||||
if (_globalAggro != 0)
|
||||
@@ -297,7 +297,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
if (autoAttackCondition(target)) // check aggression
|
||||
{
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
int hating = npc.getHating(target);
|
||||
final int hating = npc.getHating(target);
|
||||
|
||||
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
|
||||
if (hating == 0)
|
||||
@@ -323,7 +323,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
if (hated != null)
|
||||
{
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
int aggro = npc.getHating(hated);
|
||||
final int aggro = npc.getHating(hated);
|
||||
|
||||
if ((aggro + _globalAggro) > 0)
|
||||
{
|
||||
@@ -386,14 +386,14 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
L2Character attackTarget = getAttackTarget();
|
||||
final L2Character attackTarget = getAttackTarget();
|
||||
// Check if target is dead or if timeout is expired to stop this attack
|
||||
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks()))
|
||||
{
|
||||
// Stop hating this target after the attack timeout or if target is dead
|
||||
if (attackTarget != null)
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
npc.stopHating(attackTarget);
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
|
||||
private final void factionNotifyAndSupport()
|
||||
{
|
||||
L2Character target = getAttackTarget();
|
||||
final L2Character target = getAttackTarget();
|
||||
// Call all L2Object of its Faction inside the Faction Range
|
||||
if ((((L2Npc) _actor).getTemplate().getClans() == null) || (target == null))
|
||||
{
|
||||
@@ -457,7 +457,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
int chance = 5;
|
||||
final int chance = 5;
|
||||
if (chance >= Rnd.get(100))
|
||||
{
|
||||
continue;
|
||||
@@ -467,7 +467,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
break;
|
||||
}
|
||||
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
_actor.setTarget(cha);
|
||||
clientStopMoving(null);
|
||||
_actor.doCast(sk);
|
||||
@@ -479,7 +479,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Npc npc = (L2Npc) cha;
|
||||
final L2Npc npc = (L2Npc) cha;
|
||||
|
||||
if (!npc.isInMyClan((L2Npc) _actor))
|
||||
{
|
||||
@@ -516,7 +516,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
int chance = 4;
|
||||
final int chance = 4;
|
||||
if (chance >= Rnd.get(100))
|
||||
{
|
||||
continue;
|
||||
@@ -526,7 +526,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
break;
|
||||
}
|
||||
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
_actor.setTarget(npc);
|
||||
clientStopMoving(null);
|
||||
_actor.doCast(sk);
|
||||
@@ -600,12 +600,12 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
// check for long ranged skills and heal/buff skills
|
||||
for (Skill sk : skills)
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
|
||||
{
|
||||
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
|
||||
{
|
||||
boolean useSkillSelf = true;
|
||||
@@ -643,11 +643,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
else
|
||||
{
|
||||
double dx = _actor.getX() - attackTarget.getX();
|
||||
double dy = _actor.getY() - attackTarget.getY();
|
||||
double dz = _actor.getZ() - attackTarget.getZ();
|
||||
double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
|
||||
double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
|
||||
final double dx = _actor.getX() - attackTarget.getX();
|
||||
final double dy = _actor.getY() - attackTarget.getY();
|
||||
final double dz = _actor.getZ() - attackTarget.getZ();
|
||||
final double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
|
||||
final double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
|
||||
|
||||
// Check if the L2SiegeGuardInstance isn't too far from it's home location
|
||||
if ((((dx * dx) + (dy * dy)) > 10000) && (((homeX * homeX) + (homeY * homeY)) > 3240000) // 1800 * 1800
|
||||
@@ -693,7 +693,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
// Temporary hack for preventing guards jumping off towers,
|
||||
// before replacing this with effective geodata checks and AI modification
|
||||
double dz = _actor.getZ() - attackTarget.getZ();
|
||||
final double dz = _actor.getZ() - attackTarget.getZ();
|
||||
if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
|
||||
{
|
||||
if (_selfAnalysis.isMage)
|
||||
@@ -746,11 +746,11 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
for (Skill sk : skills)
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
|
||||
{
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
|
||||
{
|
||||
boolean useSkillSelf = true;
|
||||
@@ -876,7 +876,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2Attackable me = (L2Attackable) _actor;
|
||||
final L2Attackable me = (L2Attackable) _actor;
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
@@ -915,8 +915,8 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
sGuard = (L2DefenderInstance) _actor;
|
||||
}
|
||||
double homeX = target.getX() - sGuard.getSpawn().getX();
|
||||
double homeY = target.getY() - sGuard.getSpawn().getY();
|
||||
final double homeX = target.getX() - sGuard.getSpawn().getX();
|
||||
final double homeY = target.getY() - sGuard.getSpawn().getY();
|
||||
|
||||
// Check if the L2SiegeGuardInstance is not too far from its home location
|
||||
if (((homeX * homeX) + (homeY * homeY)) < 3240000)
|
||||
@@ -933,7 +933,7 @@ public class L2FortSiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
L2Character mostHated = me.getMostHated();
|
||||
final L2Character mostHated = me.getMostHated();
|
||||
if (mostHated == null)
|
||||
{
|
||||
_globalAggro = -25;
|
||||
|
@@ -134,7 +134,7 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
{
|
||||
// run interrupted or next intention
|
||||
|
||||
IntentionCommand nextIntention = _nextIntention;
|
||||
final IntentionCommand nextIntention = _nextIntention;
|
||||
if (nextIntention != null)
|
||||
{
|
||||
if (nextIntention._crtlIntention != AI_INTENTION_CAST) // previous state shouldn't be casting
|
||||
@@ -230,7 +230,7 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
|
||||
private void thinkAttack()
|
||||
{
|
||||
L2Character target = getAttackTarget();
|
||||
final L2Character target = getAttackTarget();
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
@@ -251,7 +251,7 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
|
||||
private void thinkCast()
|
||||
{
|
||||
L2Character target = getCastTarget();
|
||||
final L2Character target = getCastTarget();
|
||||
if ((_skill.getTargetType() == L2TargetType.GROUND) && (_actor instanceof L2PcInstance))
|
||||
{
|
||||
if (maybeMoveToPosition(((L2PcInstance) _actor).getCurrentSkillWorldPosition(), _actor.getMagicalAttackRange(_skill)))
|
||||
@@ -293,7 +293,7 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2Object target = getTarget();
|
||||
final L2Object target = getTarget();
|
||||
if (checkTargetLost(target))
|
||||
{
|
||||
return;
|
||||
@@ -312,7 +312,7 @@ public class L2PlayerAI extends L2PlayableAI
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2Object target = getTarget();
|
||||
final L2Object target = getTarget();
|
||||
if (checkTargetLost(target))
|
||||
{
|
||||
return;
|
||||
|
@@ -149,7 +149,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
// Get the owner if the target is a summon
|
||||
if (target instanceof L2Summon)
|
||||
{
|
||||
L2PcInstance owner = ((L2Summon) target).getOwner();
|
||||
final L2PcInstance owner = ((L2Summon) target).getOwner();
|
||||
if (_actor.isInsideRadius(owner, 1000, true, false))
|
||||
{
|
||||
target = owner;
|
||||
@@ -190,7 +190,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
// Check if actor is not dead
|
||||
if (!_actor.isAlikeDead())
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
|
||||
// If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE
|
||||
if (!npc.getKnownList().getKnownPlayers().isEmpty())
|
||||
@@ -258,7 +258,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
*/
|
||||
private void thinkActive()
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
|
||||
// Update every 1s the _globalAggro counter to come close to 0
|
||||
if (_globalAggro != 0)
|
||||
@@ -286,7 +286,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
if (autoAttackCondition(target)) // check aggression
|
||||
{
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
int hating = npc.getHating(target);
|
||||
final int hating = npc.getHating(target);
|
||||
|
||||
// Add the attacker to the L2Attackable _aggroList with 0 damage and 1 hate
|
||||
if (hating == 0)
|
||||
@@ -312,7 +312,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
if (hated != null)
|
||||
{
|
||||
// Get the hate level of the L2Attackable against this L2Character target contained in _aggroList
|
||||
int aggro = npc.getHating(hated);
|
||||
final int aggro = npc.getHating(hated);
|
||||
|
||||
if ((aggro + _globalAggro) > 0)
|
||||
{
|
||||
@@ -365,14 +365,14 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
}
|
||||
|
||||
L2Character attackTarget = getAttackTarget();
|
||||
final L2Character attackTarget = getAttackTarget();
|
||||
// Check if target is dead or if timeout is expired to stop this attack
|
||||
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks()))
|
||||
{
|
||||
// Stop hating this target after the attack timeout or if target is dead
|
||||
if (attackTarget != null)
|
||||
{
|
||||
L2Attackable npc = (L2Attackable) _actor;
|
||||
final L2Attackable npc = (L2Attackable) _actor;
|
||||
npc.stopHating(attackTarget);
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
|
||||
private final void factionNotifyAndSupport()
|
||||
{
|
||||
L2Character target = getAttackTarget();
|
||||
final L2Character target = getAttackTarget();
|
||||
// Call all L2Object of its Faction inside the Faction Range
|
||||
if ((((L2Npc) _actor).getTemplate().getClans() == null) || (target == null))
|
||||
{
|
||||
@@ -436,7 +436,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
int chance = 5;
|
||||
final int chance = 5;
|
||||
if (chance >= Rnd.get(100))
|
||||
{
|
||||
continue;
|
||||
@@ -446,7 +446,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
break;
|
||||
}
|
||||
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
_actor.setTarget(cha);
|
||||
clientStopMoving(null);
|
||||
_actor.doCast(sk);
|
||||
@@ -458,7 +458,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
L2Npc npc = (L2Npc) cha;
|
||||
final L2Npc npc = (L2Npc) cha;
|
||||
|
||||
if (!npc.isInMyClan((L2Npc) _actor))
|
||||
{
|
||||
@@ -495,7 +495,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
continue;
|
||||
}
|
||||
|
||||
int chance = 4;
|
||||
final int chance = 4;
|
||||
if (chance >= Rnd.get(100))
|
||||
{
|
||||
continue;
|
||||
@@ -505,7 +505,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
break;
|
||||
}
|
||||
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
_actor.setTarget(npc);
|
||||
clientStopMoving(null);
|
||||
_actor.doCast(sk);
|
||||
@@ -523,7 +523,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
Collection<Skill> skills = null;
|
||||
double dist_2 = 0;
|
||||
int range = 0;
|
||||
L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
|
||||
final L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
|
||||
L2Character attackTarget = getAttackTarget();
|
||||
|
||||
try
|
||||
@@ -573,12 +573,12 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
// check for long ranged skills and heal/buff skills
|
||||
for (Skill sk : skills)
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
|
||||
{
|
||||
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
|
||||
{
|
||||
boolean useSkillSelf = true;
|
||||
@@ -616,11 +616,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
}
|
||||
else
|
||||
{
|
||||
double dx = _actor.getX() - attackTarget.getX();
|
||||
double dy = _actor.getY() - attackTarget.getY();
|
||||
double dz = _actor.getZ() - attackTarget.getZ();
|
||||
double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
|
||||
double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
|
||||
final double dx = _actor.getX() - attackTarget.getX();
|
||||
final double dy = _actor.getY() - attackTarget.getY();
|
||||
final double dz = _actor.getZ() - attackTarget.getZ();
|
||||
final double homeX = attackTarget.getX() - sGuard.getSpawn().getX();
|
||||
final double homeY = attackTarget.getY() - sGuard.getSpawn().getY();
|
||||
|
||||
// Check if the L2SiegeGuardInstance isn't too far from it's home location
|
||||
if ((((dx * dx) + (dy * dy)) > 10000) && (((homeX * homeX) + (homeY * homeY)) > 3240000) // 1800 * 1800
|
||||
@@ -666,7 +666,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
// Temporary hack for preventing guards jumping off towers,
|
||||
// before replacing this with effective geodata checks and AI modification
|
||||
double dz = _actor.getZ() - attackTarget.getZ();
|
||||
final double dz = _actor.getZ() - attackTarget.getZ();
|
||||
if ((dz * dz) < (170 * 170)) // normally 130 if guard z coordinates correct
|
||||
{
|
||||
if (_selfAnalysis.isMage)
|
||||
@@ -715,11 +715,11 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
for (Skill sk : skills)
|
||||
{
|
||||
int castRange = sk.getCastRange();
|
||||
final int castRange = sk.getCastRange();
|
||||
|
||||
if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
|
||||
{
|
||||
L2Object OldTarget = _actor.getTarget();
|
||||
final L2Object OldTarget = _actor.getTarget();
|
||||
if ((sk.isContinuous() && !sk.isDebuff()) || (sk.hasEffectType(L2EffectType.HEAL)))
|
||||
{
|
||||
boolean useSkillSelf = true;
|
||||
@@ -848,7 +848,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
{
|
||||
return;
|
||||
}
|
||||
L2Attackable me = (L2Attackable) _actor;
|
||||
final L2Attackable me = (L2Attackable) _actor;
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
@@ -878,9 +878,9 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
_actor.setRunning();
|
||||
}
|
||||
|
||||
L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
|
||||
double homeX = target.getX() - sGuard.getSpawn().getX();
|
||||
double homeY = target.getY() - sGuard.getSpawn().getY();
|
||||
final L2DefenderInstance sGuard = (L2DefenderInstance) _actor;
|
||||
final double homeX = target.getX() - sGuard.getSpawn().getX();
|
||||
final double homeY = target.getY() - sGuard.getSpawn().getY();
|
||||
|
||||
// Check if the L2SiegeGuardInstance is not too far from its home location
|
||||
if (((homeX * homeX) + (homeY * homeY)) < 3240000)
|
||||
@@ -897,7 +897,7 @@ public class L2SiegeGuardAI extends L2CharacterAI implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
L2Character mostHated = me.getMostHated();
|
||||
final L2Character mostHated = me.getMostHated();
|
||||
if (mostHated == null)
|
||||
{
|
||||
_globalAggro = -25;
|
||||
|
@@ -72,7 +72,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
|
||||
@Override
|
||||
protected void onIntentionActive()
|
||||
{
|
||||
L2Summon summon = (L2Summon) _actor;
|
||||
final L2Summon summon = (L2Summon) _actor;
|
||||
if (_startFollow)
|
||||
{
|
||||
setIntention(AI_INTENTION_FOLLOW, summon.getOwner());
|
||||
@@ -116,13 +116,13 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
|
||||
|
||||
private void thinkCast()
|
||||
{
|
||||
L2Summon summon = (L2Summon) _actor;
|
||||
final L2Summon summon = (L2Summon) _actor;
|
||||
if (checkTargetLost(getCastTarget()))
|
||||
{
|
||||
setCastTarget(null);
|
||||
return;
|
||||
}
|
||||
boolean val = _startFollow;
|
||||
final boolean val = _startFollow;
|
||||
if (maybeMoveToPawn(getCastTarget(), _actor.getMagicalAttackRange(_skill)))
|
||||
{
|
||||
return;
|
||||
|
Reference in New Issue
Block a user