Merge branch 'fix-npc-protect-prayers' into 'master'

Improve NPC usage of protection prayers.

See merge request 2009scape/2009scape!255
This commit is contained in:
Ceikry
2021-09-13 15:44:46 +00:00
2 changed files with 3 additions and 3 deletions
@@ -515,7 +515,7 @@ public abstract class Entity extends Node {
Entity victim = state.getVictim(); Entity victim = state.getVictim();
CombatStyle type = state.getStyle(); CombatStyle type = state.getStyle();
if (state.getArmourEffect() != ArmourSet.VERAC && !entity.isIgnoreProtection(type) && victim.hasProtectionPrayer(type)) { if (state.getArmourEffect() != ArmourSet.VERAC && !entity.isIgnoreProtection(type) && victim.hasProtectionPrayer(type)) {
return hit *= entity instanceof Player ? 0.6 : 0; return hit *= (entity instanceof Player && victim instanceof Player) ? 0.6 : 0;
} }
return hit; return hit;
} }
@@ -653,7 +653,7 @@ public class NPC extends Entity {
@Override @Override
public boolean hasProtectionPrayer(CombatStyle style) { public boolean hasProtectionPrayer(CombatStyle style) {
return false; return getProperties().getProtectStyle() == style;
} }
/** /**
@@ -995,4 +995,4 @@ public class NPC extends Entity {
this.neverWalks = neverWalks; this.neverWalks = neverWalks;
} }
} }