mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 19:59:56 +00:00
Fix Combat Policy Stubborn chances not working
This commit is contained in:
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;
|
||||
|
||||
Reference in new issue
Block a user