Browse Source

LootManager cleanup + say message for mobs calling for help

master
FatBoy-DOTC 2 years ago
parent
commit
f75323e7e2
  1. 14
      src/engine/ai/MobileFSM.java
  2. 2
      src/engine/loot/LootManager.java

14
src/engine/ai/MobileFSM.java

@ -9,18 +9,17 @@ @@ -9,18 +9,17 @@
package engine.ai;
import engine.Enum;
import engine.Enum.DispatchChannel;
import engine.ai.utilities.CombatUtilities;
import engine.ai.utilities.MovementUtilities;
import engine.gameManager.BuildingManager;
import engine.gameManager.CombatManager;
import engine.gameManager.MovementManager;
import engine.gameManager.PowersManager;
import engine.gameManager.*;
import engine.math.Vector3fImmutable;
import engine.net.DispatchMessage;
import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.PowerProjectileMsg;
import engine.net.client.msg.UpdateStateMsg;
import engine.net.client.msg.chat.ChatSystemMsg;
import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.PowersBase;
@ -544,21 +543,27 @@ public class MobileFSM { @@ -544,21 +543,27 @@ public class MobileFSM {
return false;
}
public static void MobCallForHelp(Mob mob) {
boolean callGotResponse = false;
if (mob.nextCallForHelp == 0) {
mob.nextCallForHelp = System.currentTimeMillis();
}
if (mob.nextCallForHelp < System.currentTimeMillis()) {
return;
}
//mob sends call for help message
ChatManager.chatSayInfo(null, mob.getName() + " calls for help!");
Zone mobCamp = mob.getParentZone();
for (Mob helper : mobCamp.zoneMobSet) {
if (helper.BehaviourType.respondsToCallForHelp && helper.BehaviourType.BehaviourHelperType.equals(mob.BehaviourType)) {
helper.setCombatTarget(mob.getCombatTarget());
callGotResponse = true;
}
}
if(callGotResponse){
//wait 60 seconds to call for help again
mob.nextCallForHelp = System.currentTimeMillis() + 60000;
}
}
public static void run(Mob mob) {
if (mob == null) {
return;
@ -766,4 +771,5 @@ public class MobileFSM { @@ -766,4 +771,5 @@ public class MobileFSM {
aiAgent.setCombatTarget(null);
}
}
}

2
src/engine/loot/LootManager.java

@ -112,7 +112,7 @@ public class LootManager { @@ -112,7 +112,7 @@ public class LootManager {
break;
case "EQUIP":
if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier) || !fromDeath) {
//early exit, failed to hit minimum chance roll OR booty wasn't generated form mob's death
//early exit, failed to hit minimum chance roll OR booty wasn't generated from mob's death
break;
}
MobLoot equipToAdd = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);

Loading…
Cancel
Save