Browse Source

endless player guard combat cycle

lakebane
FatBoy-DOTC 5 days ago
parent
commit
c90b94d1ec
  1. 12
      src/engine/mobileAI/MobAI.java
  2. 9
      src/engine/objects/AbstractCharacter.java

12
src/engine/mobileAI/MobAI.java

@ -20,6 +20,7 @@ import engine.mobileAI.utilities.MovementUtilities; @@ -20,6 +20,7 @@ import engine.mobileAI.utilities.MovementUtilities;
import engine.net.DispatchMessage;
import engine.net.client.msg.PerformActionMsg;
import engine.net.client.msg.PowerProjectileMsg;
import engine.net.client.msg.UpdateStateMsg;
import engine.objects.*;
import engine.powers.ActionsBase;
import engine.powers.PowersBase;
@ -914,8 +915,10 @@ public class MobAI { @@ -914,8 +915,10 @@ public class MobAI {
if (mob.getCombatTarget() == null)
return;
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) == false && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
if(!mob.isCombat())
enterCombat(mob);
if (mob.getCombatTarget().getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && !MovementUtilities.inRangeDropAggro(mob, (PlayerCharacter) mob.getCombatTarget()) && mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal()) {
mob.setCombatTarget(null);
return;
}
@ -1418,4 +1421,11 @@ public class MobAI { @@ -1418,4 +1421,11 @@ public class MobAI {
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: RecoverHealth" + " " + e.getMessage());
}
}
public static void enterCombat(Mob mob){
mob.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(mob);
DispatchMessage.sendToAllInRange(mob, rwss);
}
}

9
src/engine/objects/AbstractCharacter.java

@ -1101,7 +1101,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1101,7 +1101,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
public final void setCombatTarget(final AbstractWorldObject value) {
if(this.getObjectTypeMask() == 2050) {//MOB?
if (this.getObjectTypeMask() == 2050) {//MOB?
if (value == null) {
if (this.isCombat()) {
this.setCombat(false);
@ -1109,13 +1109,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1109,13 +1109,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss);
}
}else {
if (!this.isCombat()) {
this.setCombat(true);
UpdateStateMsg rwss = new UpdateStateMsg();
rwss.setPlayer(this);
DispatchMessage.sendToAllInRange(this, rwss);
}
}
}
this.combatTarget = value;

Loading…
Cancel
Save