Improve NPC usage of protection prayers.

- `NPC.hasProtectionPrayer` now accurately reflects protection prayers defined in `npc_configs.json`.
- NPC protection prayers now block 100% of the damage when attacked by a player in `Entity.getFormattedHit` instead of only blocking 40%.
This commit is contained in:
Avi Weinstock 2021-09-12 21:21:36 -04:00
parent 9882443afc
commit 1b4b1463c0
2 changed files with 3 additions and 3 deletions

View file

@ -515,7 +515,7 @@ public abstract class Entity extends Node {
Entity victim = state.getVictim();
CombatStyle type = state.getStyle();
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;
}

View file

@ -653,7 +653,7 @@ public class NPC extends Entity {
@Override
public boolean hasProtectionPrayer(CombatStyle style) {
return false;
return getProperties().getProtectStyle() == style;
}
/**
@ -995,4 +995,4 @@ public class NPC extends Entity {
this.neverWalks = neverWalks;
}
}
}