hate value fix

This commit is contained in:
2023-08-29 21:01:00 -05:00
parent db5b988275
commit 69fdddfc71
8 changed files with 17 additions and 68 deletions
-24
View File
@@ -117,7 +117,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
protected boolean movingUp = false;
private float desiredAltitude = 0;
private long takeOffTime = 0;
private float hateValue = 0;
private long lastHateUpdate = 0;
private byte aoecntr = 0;
public final ConcurrentHashMap<Mob, Integer> siegeMinionMap = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
@@ -1767,29 +1766,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
this.inBuildingID = inBuildingID;
}
public float getHateValue() {
if (this.hateValue <= 0) {
this.hateValue = 0;
return hateValue;
}
if (this.lastHateUpdate == 0) {
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
long duration = System.currentTimeMillis() - this.lastHateUpdate;
//convert duration to seconds and multiply Hate Delimiter.
float modAmount = duration / 1000 * MBServerStatics.PLAYER_HATE_DELIMITER;
this.hateValue -= modAmount;
this.lastHateUpdate = System.currentTimeMillis();
return this.hateValue;
}
public void setHateValue(float hateValue) {
this.lastHateUpdate = System.currentTimeMillis();
this.hateValue = hateValue;
}
public int getInFloorID() {
return inFloorID;
}
+1 -26
View File
@@ -45,7 +45,7 @@ public class Mob extends AbstractIntelligenceAgent {
private static int staticID = 0;
//mob specific
public final ConcurrentHashMap<Integer, Boolean> playerAgroMap = new ConcurrentHashMap<>();
public final ConcurrentHashMap<Integer, Float> playerAgroMap = new ConcurrentHashMap<>(); //key = Player value = hate value
public final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
public long nextCastTime = 0;
@@ -589,28 +589,6 @@ public class Mob extends AbstractIntelligenceAgent {
return skill.getModifiedAmount();
}
public static void HandleAssistedAggro(PlayerCharacter source, PlayerCharacter target) {
HashSet<AbstractWorldObject> mobsInRange = WorldGrid.getObjectsInRangePartial(source, MobAIThread.AI_DROP_AGGRO_RANGE, MBServerStatics.MASK_MOB);
for (AbstractWorldObject awo : mobsInRange) {
Mob mob = (Mob) awo;
//Mob is not attacking anyone, skip.
if (mob.getCombatTarget() == null)
continue;
//Mob not attacking target's target, let's not be failmu and skip this target.
if (mob.getCombatTarget() != target)
continue;
//target is mob's combat target, LETS GO.
if (source.getHateValue() > target.getHateValue())
mob.setCombatTarget(source);
}
}
public static void submitUpgradeJob(Mob mob) {
if (mob.getUpgradeDateTime() == null) {
@@ -1792,9 +1770,6 @@ public class Mob extends AbstractIntelligenceAgent {
if (player.getObjectUUID() == this.getCombatTarget().getObjectUUID())
return;
if (this.getCombatTarget().getObjectType() == GameObjectType.PlayerCharacter)
if (ac.getHateValue() > ((PlayerCharacter) this.getCombatTarget()).getHateValue())
this.setCombatTarget(player);
}
public void setRank(int newRank) {