Addition of level difference for homunculus kill count.

This commit is contained in:
MobiusDevelopment
2021-06-06 22:44:48 +00:00
parent 78089b71fd
commit 30812bf429
2 changed files with 6 additions and 2 deletions

View File

@@ -33,6 +33,8 @@ import ai.AbstractNpcAI;
*/
public class HomunculusKillCount extends AbstractNpcAI
{
private static final int LEVEL_DIFFERENCE = 5;
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
public void onAttackableKill(OnAttackableKill event)
@@ -41,7 +43,7 @@ public class HomunculusKillCount extends AbstractNpcAI
if ((creature != null) && creature.isMonster())
{
final PlayerInstance player = event.getAttacker().getActingPlayer();
if (player != null)
if ((player != null) && (Math.abs(player.getLevel() - creature.getLevel()) <= LEVEL_DIFFERENCE))
{
final int killedMobs = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
if (killedMobs < 500)

View File

@@ -33,6 +33,8 @@ import ai.AbstractNpcAI;
*/
public class HomunculusKillCount extends AbstractNpcAI
{
private static final int LEVEL_DIFFERENCE = 5;
@RegisterEvent(EventType.ON_ATTACKABLE_KILL)
@RegisterType(ListenerRegisterType.GLOBAL_MONSTERS)
public void onAttackableKill(OnAttackableKill event)
@@ -41,7 +43,7 @@ public class HomunculusKillCount extends AbstractNpcAI
if ((creature != null) && creature.isMonster())
{
final PlayerInstance player = event.getAttacker().getActingPlayer();
if (player != null)
if ((player != null) && (Math.abs(player.getLevel() - creature.getLevel()) <= LEVEL_DIFFERENCE))
{
final int killedMobs = player.getVariables().getInt(PlayerVariables.HOMUNCULUS_KILLED_MOBS, 0);
if (killedMobs < 500)