Browse Source

Merge remote-tracking branch 'origin/magicbox1.5' into configupdate2

master
MagicBot 1 year ago
parent
commit
f73aed9d48
  1. 18
      src/engine/ai/MobileFSM.java

18
src/engine/ai/MobileFSM.java

@ -233,6 +233,7 @@ public class MobileFSM {
// Method picks a random spell from a mobile's list of powers // Method picks a random spell from a mobile's list of powers
// and casts it on the current target (or itself). Validation // and casts it on the current target (or itself). Validation
// (including empty lists) is done previously within canCast(); // (including empty lists) is done previously within canCast();
ArrayList<Integer> powerTokens; ArrayList<Integer> powerTokens;
ArrayList<Integer> purgeTokens; ArrayList<Integer> purgeTokens;
PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget(); PlayerCharacter target = (PlayerCharacter) mob.getCombatTarget();
@ -259,6 +260,21 @@ public class MobileFSM {
int powerToken = powerTokens.get(ThreadLocalRandom.current().nextInt(powerTokens.size())); int 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
if(mobPower.requiresHitRoll) {
if (CombatUtilities.triggerDefense(mob, mob.getCombatTarget())) {
return false;
}
if (CombatUtilities.triggerDodge(mob, mob.getCombatTarget())) {
return false;
}
if (CombatUtilities.triggerBlock(mob, mob.getCombatTarget())) {
return false;
}
if (CombatUtilities.triggerParry(mob, mob.getCombatTarget())) {
return false;
}
}
// Cast the spell // Cast the spell
if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) { if (CombatUtilities.inRange2D(mob, mob.getCombatTarget(), mobPower.getRange())) {
PowersManager.useMobPower(mob, (AbstractCharacter) mob.getCombatTarget(), mobPower, powerRank); PowersManager.useMobPower(mob, (AbstractCharacter) mob.getCombatTarget(), mobPower, powerRank);
@ -505,7 +521,7 @@ public class MobileFSM {
} }
if (mob.isPlayerGuard() && !mob.despawned) { if (mob.isPlayerGuard() && !mob.despawned) {
City current = ZoneManager.getCityAtLocation(mob.getLoc()); City current = ZoneManager.getCityAtLocation(mob.getLoc());
if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false || mob.playerAgroMap.isEmpty()) { if (current == null || current.equals(mob.getGuild().getOwnedCity()) == false) {
PowersBase recall = PowersManager.getPowerByToken(-1994153779); PowersBase recall = PowersManager.getPowerByToken(-1994153779);
PowersManager.useMobPower(mob, mob, recall, 40); PowersManager.useMobPower(mob, mob, recall, 40);
mob.setCombatTarget(null); mob.setCombatTarget(null);

Loading…
Cancel
Save