forked from MagicBane/Server
Contract support added to mobile ai when gathering powers.
This commit is contained in:
@@ -323,13 +323,17 @@ public class MobAI {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty())
|
||||
// Mobile has no powers defined.
|
||||
|
||||
if (PowersManager.getPowersForRune(mob.getMobBaseID()).isEmpty() &&
|
||||
PowersManager.getPowersForRune(mob.contractUUID).isEmpty())
|
||||
return false;
|
||||
|
||||
if (!mob.canSee((PlayerCharacter) mob.getCombatTarget())) {
|
||||
mob.setCombatTarget(null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mob.nextCastTime == 0)
|
||||
mob.nextCastTime = System.currentTimeMillis();
|
||||
|
||||
@@ -360,6 +364,17 @@ public class MobAI {
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||
purgeEntries = new ArrayList<>();
|
||||
|
||||
// Fallback to contract is nothing in mobbase. This is to support player guards.
|
||||
|
||||
if (powerEntries.isEmpty()) {
|
||||
|
||||
if (mob.contract != null)
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
||||
}
|
||||
|
||||
// If player has this effect on them currently then remove
|
||||
// this token from our list.
|
||||
|
||||
@@ -444,6 +459,17 @@ public class MobAI {
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.getMobBaseID()));
|
||||
purgeEntries = new ArrayList<>();
|
||||
|
||||
// Fallback to contract is nothing in mobbase. This is to support player guards.
|
||||
|
||||
if (powerEntries.isEmpty()) {
|
||||
|
||||
if (mob.contract != null)
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.contractUUID));
|
||||
|
||||
if (mob.agentType.equals(Enum.AIAgentType.GUARDMINION))
|
||||
powerEntries = new ArrayList<>(PowersManager.getPowersForRune(mob.guardCaptain.contractUUID));
|
||||
}
|
||||
|
||||
// If player has this effect on them currently then remove
|
||||
// this token from our list.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user