Fix Combat Policy Stubborn chances not working

This commit is contained in:
Kam committed 2024-03-13 21:43:10 -04:00
1 parent ce6bb47162
commit 9f124f721c
2 files changed
+2 -2

No files matched your search

@@ -136,7 +136,7 @@ public class CombatHandler {
public boolean shouldChangeTarget(double chance) {
// Assuming randomNum is a random number between 0 and 100
double randomNum = Math.random() * 100; // Generates a random number between 0 and 100
return randomNum <= chance;
return randomNum < chance;
}
public boolean shouldSwitchTactically(EntityLivingBase originalTarget, EntityLivingBase newTarget, boolean reverse) {
@@ -567,7 +567,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
}
break;
case Stubborn:
if (closerTargetFound && combatHandler.shouldChangeTarget((double) ai.tacticalChance / 100)) {
if (closerTargetFound && combatHandler.shouldChangeTarget(ai.tacticalChance)) {
setAttackTarget(attackingEntity);
}
break;