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

2
src/engine/loot/LootManager.java

@ -112,7 +112,7 @@ public class LootManager {
break; break;
case "EQUIP": case "EQUIP":
if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier) || !fromDeath) { 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; break;
} }
MobLoot equipToAdd = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true); MobLoot equipToAdd = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);

Loading…
Cancel
Save