recovering rates
This commit is contained in:
@@ -901,16 +901,14 @@ public class PlayerCombatStats {
|
||||
if(!pc.timestamps.containsKey("LASTHEALTHREGEN"))
|
||||
pc.timestamps.put("LASTHEALTHREGEN",System.currentTimeMillis());
|
||||
|
||||
float stateMultiplier = 1.0f;
|
||||
if(pc.isSit())
|
||||
stateMultiplier = 2.0f;
|
||||
double current = pc.health.get();
|
||||
if (Double.isNaN(current))
|
||||
current = 0.0;
|
||||
|
||||
long deltaTime = System.currentTimeMillis() - pc.timestamps.get("LASTHEALTHREGEN");
|
||||
float current = pc.health.get();
|
||||
float onePercent = pc.healthMax * 0.01f;
|
||||
double recovered = pc.healthMax * (0.01f / getRecoveryType(pc).health);
|
||||
|
||||
double mod = current + recovered;
|
||||
|
||||
float properDelay = (deltaTime / getRecoveryType(pc).health) * 0.001f;
|
||||
float mod = current + (properDelay * onePercent * stateMultiplier);
|
||||
if(pc.bonuses != null)
|
||||
mod *= 1 + pc.bonuses.getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None);
|
||||
|
||||
@@ -919,7 +917,7 @@ public class PlayerCombatStats {
|
||||
mod = pc.healthMax;
|
||||
|
||||
while (!worked) {
|
||||
worked = pc.health.compareAndSet(current, mod);
|
||||
worked = pc.health.compareAndSet((float) current, (float) mod);
|
||||
}
|
||||
|
||||
pc.timestamps.put("LASTHEALTHREGEN",System.currentTimeMillis());
|
||||
@@ -929,15 +927,19 @@ public class PlayerCombatStats {
|
||||
if(!pc.timestamps.containsKey("LASTMANAREGEN"))
|
||||
pc.timestamps.put("LASTMANAREGEN",System.currentTimeMillis());
|
||||
|
||||
float stateMultiplier = 1.0f;
|
||||
if(pc.isSit())
|
||||
stateMultiplier = 2.0f;
|
||||
if(pc.isCasting){
|
||||
pc.timestamps.put("LASTMANAREGEN",System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
|
||||
long deltaTime = System.currentTimeMillis() - pc.timestamps.get("LASTMANAREGEN");
|
||||
float current = pc.mana.get();
|
||||
float onePercent = pc.manaMax * 0.01f;
|
||||
float properDelay = (deltaTime / getRecoveryType(pc).mana) * 0.001f;
|
||||
float mod = current + (properDelay * onePercent * stateMultiplier);
|
||||
double current = pc.mana.get();
|
||||
if (Double.isNaN(current)) {
|
||||
current = 0.0;
|
||||
}
|
||||
|
||||
double recovered = pc.manaMax * (0.01f / getRecoveryType(pc).mana);
|
||||
|
||||
double mod = current + recovered;
|
||||
if(pc.bonuses != null)
|
||||
mod *= 1 + pc.bonuses.getFloatPercentAll(Enum.ModType.ManaRecoverRate, Enum.SourceType.None);
|
||||
|
||||
@@ -946,7 +948,7 @@ public class PlayerCombatStats {
|
||||
mod = pc.manaMax;
|
||||
|
||||
while (!worked) {
|
||||
worked = pc.mana.compareAndSet(current, mod);
|
||||
worked = pc.mana.compareAndSet((float) current, (float) mod);
|
||||
}
|
||||
|
||||
pc.timestamps.put("LASTMANAREGEN",System.currentTimeMillis());
|
||||
@@ -970,6 +972,7 @@ public class PlayerCombatStats {
|
||||
float current = pc.stamina.get();
|
||||
float properDelay = (deltaTime / getRecoveryType(pc).stamina) * 0.001f;
|
||||
float mod = current + (properDelay * stateMultiplier);
|
||||
|
||||
if(pc.bonuses != null)
|
||||
mod *= 1 + pc.bonuses.getFloatPercentAll(Enum.ModType.StaminaRecoverRate, Enum.SourceType.None);
|
||||
|
||||
@@ -1053,7 +1056,7 @@ public class PlayerCombatStats {
|
||||
public static recoveryType getRecoveryType(PlayerCharacter pc){
|
||||
if(pc.sit)
|
||||
return recoveryType.RESTING;
|
||||
else if(!pc.isMoving())
|
||||
else if(!pc.isMoving() && !pc.isFlying())
|
||||
return recoveryType.IDLING;
|
||||
else
|
||||
if(pc.walkMode)
|
||||
|
||||
Reference in New Issue
Block a user