Sync with L2jServer HighFive Oct 10th 2015.
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
package handlers.effecthandlers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
@@ -64,29 +64,15 @@ public final class RandomizeHate extends AbstractEffect
|
||||
return;
|
||||
}
|
||||
|
||||
L2Attackable effectedMob = (L2Attackable) info.getEffected();
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
for (L2Character cha : info.getEffected().getKnownList().getKnownCharacters())
|
||||
{
|
||||
if ((cha != null) && (cha != effectedMob) && (cha != info.getEffector()))
|
||||
{
|
||||
// Aggro cannot be transfered to a mob of the same faction.
|
||||
if (cha.isAttackable() && ((L2Attackable) cha).isInMyClan(effectedMob))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
targetList.add(cha);
|
||||
}
|
||||
}
|
||||
// if there is no target, exit function
|
||||
if (targetList.isEmpty())
|
||||
final L2Attackable effectedMob = (L2Attackable) info.getEffected();
|
||||
final List<L2Character> aggroList = effectedMob.getAggroList().keySet().stream().filter(c -> c != info.getEffector()).collect(Collectors.toList());
|
||||
if (aggroList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Choosing randomly a new target
|
||||
final L2Character target = targetList.get(Rnd.get(targetList.size()));
|
||||
final L2Character target = aggroList.get(Rnd.get(aggroList.size()));
|
||||
final int hate = effectedMob.getHating(info.getEffector());
|
||||
effectedMob.stopHating(info.getEffector());
|
||||
effectedMob.addDamageHate(target, 0, hate);
|
||||
|
Reference in New Issue
Block a user