Browse Source

mob no longer cast spells with effect already on target

master
FatBoy-DOTC 2 years ago
parent
commit
028c49ac84
  1. 26
      src/engine/ai/MobileFSM.java
  2. 4
      src/engine/ai/utilities/CombatUtilities.java

26
src/engine/ai/MobileFSM.java

@ -23,6 +23,9 @@ import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.PowerProjectileMsg; import engine.net.client.msg.PowerProjectileMsg;
import engine.net.client.msg.UpdateStateMsg; import engine.net.client.msg.UpdateStateMsg;
import engine.objects.*; import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.EffectsBase;
import engine.powers.PowerPrereq;
import engine.powers.PowersBase; import engine.powers.PowersBase;
import engine.server.MBServerStatics; import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -1647,10 +1650,22 @@ public class MobileFSM {
MobCallForHelp(mob); MobCallForHelp(mob);
} }
PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget(); PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget();
int random = ThreadLocalRandom.current().nextInt(mob.mobPowers.size() * 2); HashMap<Integer,Integer> eligiblePowers = mob.mobPowers;
for(Map.Entry<Integer,Integer> power : mob.mobPowers.entrySet()) {
ConcurrentHashMap<String, Effect> effects = target.getEffects();
PowersBase pwr= PowersManager.getPowerByToken(power.getKey());
for(ActionsBase act : pwr.getActions()){
String des = act.stackType;
if(target.getEffects().containsKey(des)){
eligiblePowers.remove(power.getKey());
}
}
}
int random = ThreadLocalRandom.current().nextInt(eligiblePowers.size() + 1);
int powerToken = 0; int powerToken = 0;
int powerRank = 0; int powerRank = 0;
Map<Integer, Integer> entries = mob.mobPowers; Map<Integer, Integer> entries = eligiblePowers;
int count = -1; int count = -1;
for (Map.Entry<Integer, Integer> entry : entries.entrySet()) { for (Map.Entry<Integer, Integer> entry : entries.entrySet()) {
count += 1; count += 1;
@ -1669,10 +1684,11 @@ public class MobileFSM {
msg.setUnknown04(2); msg.setUnknown04(2);
PowersManager.finishUseMobPower(msg, mob, 0, 0); PowersManager.finishUseMobPower(msg, mob, 0, 0);
//default minimum seconds between cast = 10 //default minimum seconds between cast = 10
if(mobPower.getCooldown() < 10000){ long cooldown = mobPower.getCooldown();
mob.nextCastTime = System.currentTimeMillis() + 10000; if(cooldown < 10000){
mob.nextCastTime = System.currentTimeMillis() + 10000 + cooldown;
} else { } else {
mob.nextCastTime = System.currentTimeMillis() + (mobPower.getCooldown()); mob.nextCastTime = System.currentTimeMillis() + cooldown;
} }
return true; return true;
} }

4
src/engine/ai/utilities/CombatUtilities.java

@ -398,6 +398,10 @@ public class CombatUtilities {
min = agent.getEquip().get(1).getItemBase().getMinDamage() + agent.getEquip().get(2).getItemBase().getMinDamage(); min = agent.getEquip().get(1).getItemBase().getMinDamage() + agent.getEquip().get(2).getItemBase().getMinDamage();
max = agent.getEquip().get(1).getItemBase().getMaxDamage() + agent.getEquip().get(2).getItemBase().getMaxDamage(); max = agent.getEquip().get(1).getItemBase().getMaxDamage() + agent.getEquip().get(2).getItemBase().getMaxDamage();
} }
if(agent.getLevel() > 80){
min = agent.getMobBase().getMinDmg();
max = agent.getMobBase().getDamageMax();
}
range = max - min; range = max - min;
damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2; damage = min + ((ThreadLocalRandom.current().nextFloat() * range) + (ThreadLocalRandom.current().nextFloat() * range)) / 2;
if (AbstractWorldObject.IsAbstractCharacter(target)) if (AbstractWorldObject.IsAbstractCharacter(target))

Loading…
Cancel
Save