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