mob chance to cast set at 50%

This commit is contained in:
2023-05-24 20:27:58 -05:00
parent b6c9eed229
commit 56d6efc4e4
+3 -4
View File
@@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static engine.math.FastMath.sqr; import static engine.math.FastMath.sqr;
public class MobileFSM { public class MobileFSM {
public static int AI_POWER_CHANCE = 30; // set 1 -100 to determine mobs chance to cast a spell
private static void AttackTarget(Mob mob, AbstractWorldObject target) { private static void AttackTarget(Mob mob, AbstractWorldObject target) {
if (mob == null) if (mob == null)
return; return;
@@ -223,11 +222,11 @@ public class MobileFSM {
// mobile in the proper state to cast. // mobile in the proper state to cast.
if (mob == null) if (mob == null)
return false; return false;
if(ThreadLocalRandom.current().nextInt(100) > AI_POWER_CHANCE){
return false;
}
if (mob.mobPowers.isEmpty()) if (mob.mobPowers.isEmpty())
return false; return false;
if(ThreadLocalRandom.current().nextInt(100) > 50)
return false;
if (mob.nextCastTime == 0) if (mob.nextCastTime == 0)
mob.nextCastTime = System.currentTimeMillis(); mob.nextCastTime = System.currentTimeMillis();
return mob.nextCastTime <= System.currentTimeMillis(); return mob.nextCastTime <= System.currentTimeMillis();