Selaa lähdekoodia

Experimental: clearing of the known attackers on region shutdown and on full HP/MP (with some probability).

_DS_ 15 vuotta sitten
vanhempi
sitoutus
e1263a2d23

+ 11 - 2
L2_GameServer/java/com/l2jserver/gameserver/ai/L2AttackableAI.java

@@ -499,9 +499,18 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 				
 				return;
 			}
-			
 		}
-		
+
+		// Chance to forget attackers after some time
+		if (_actor.getCurrentHp() == _actor.getMaxHp()
+				&& _actor.getCurrentMp() == _actor.getMaxMp()
+				&& !_actor.getAttackByList().isEmpty()
+				&& Rnd.nextInt(500) == 0)
+		{
+			((L2Attackable)_actor).clearAggroList();
+			_actor.getAttackByList().clear();
+		}
+
 		// Check if the actor is a L2GuardInstance
 		if (_actor instanceof L2GuardInstance)
 		{

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/L2WorldRegion.java

@@ -227,6 +227,7 @@ public final class L2WorldRegion
         				mob.stopAllEffects();
 
         				mob.clearAggroList();
+        				mob.getAttackByList().clear();
         				mob.getKnownList().removeAllKnownObjects();
 
         				mob.getAI().setIntention(com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE);