Browse Source

DD is last element in contract power list.

master
MagicBot 1 year ago
parent
commit
1cc8d2919a
  1. 24
      src/engine/mobileAI/MobAI.java

24
src/engine/mobileAI/MobAI.java

@ -476,41 +476,42 @@ public class MobAI {
return false; return false;
int powerToken = 0; int powerToken = 0;
int nukeRoll = ThreadLocalRandom.current().nextInt(1,100); int nukeRoll = ThreadLocalRandom.current().nextInt(1,100);
if( nukeRoll < 55){
if (nukeRoll < 55) {
//use direct damage spell //use direct damage spell
powerToken = powerTokens.get(0); powerToken = powerTokens.get(powerTokens.size() - 1);
} else{
} else {
//use random spell //use random spell
powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size())); powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size()));
} }
int powerRank = mob.mobPowers.get(powerToken); int powerRank = mob.mobPowers.get(powerToken);
PowersBase mobPower = PowersManager.getPowerByToken(powerToken); PowersBase mobPower = PowersManager.getPowerByToken(powerToken);
//check for hit-roll //check for hit-roll
if (mobPower.requiresHitRoll) { if (mobPower.requiresHitRoll)
if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget())) if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget()))
return false; return false;
}
// Cast the spell // Cast the spell
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) { if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
PerformActionMsg msg; PerformActionMsg msg;
if (!mobPower.isHarmful() || mobPower.targetSelf) { if (!mobPower.isHarmful() || mobPower.targetSelf) {
if(mobPower.category.equals("DISPEL")){
if (mobPower.category.equals("DISPEL")) {
PowersManager.useMobPower(mob, target, mobPower, powerRank); PowersManager.useMobPower(mob, target, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target); msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
}else { } else {
PowersManager.useMobPower(mob, mob, mobPower, powerRank); PowersManager.useMobPower(mob, mob, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob); msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, mob);
} }
} } else {
else {
PowersManager.useMobPower(mob, target, mobPower, powerRank); PowersManager.useMobPower(mob, target, mobPower, powerRank);
msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target); msg = PowersManager.createPowerMsg(mobPower, powerRank, mob, target);
} }
@ -519,6 +520,7 @@ public class MobAI {
PowersManager.finishUseMobPower(msg, mob, 0, 0); PowersManager.finishUseMobPower(msg, mob, 0, 0);
int randomCooldown = ThreadLocalRandom.current().nextInt(1,10); int randomCooldown = ThreadLocalRandom.current().nextInt(1,10);
mob.nextCastTime = System.currentTimeMillis() + (long) ((mobPower.getCooldown() + (MobAIThread.AI_POWER_DIVISOR * 1000))) + (randomCooldown * 1000); mob.nextCastTime = System.currentTimeMillis() + (long) ((mobPower.getCooldown() + (MobAIThread.AI_POWER_DIVISOR * 1000))) + (randomCooldown * 1000);
return true; return true;
} }

Loading…
Cancel
Save