Browse Source

recovering rates

lakebane
FatBoy-DOTC 6 days ago
parent
commit
734b67be6d
  1. 39
      src/engine/objects/PlayerCombatStats.java

39
src/engine/objects/PlayerCombatStats.java

@ -908,7 +908,9 @@ public class PlayerCombatStats { @@ -908,7 +908,9 @@ public class PlayerCombatStats {
long deltaTime = System.currentTimeMillis() - pc.timestamps.get("LASTHEALTHREGEN");
float current = pc.health.get();
float onePercent = pc.healthMax * 0.01f;
float mod = current + ((deltaTime * 0.001f) * onePercent * stateMultiplier);
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);
@ -934,7 +936,8 @@ public class PlayerCombatStats { @@ -934,7 +936,8 @@ public class PlayerCombatStats {
long deltaTime = System.currentTimeMillis() - pc.timestamps.get("LASTMANAREGEN");
float current = pc.mana.get();
float onePercent = pc.manaMax * 0.01f;
float mod = current + ((deltaTime * 0.001f) * onePercent * stateMultiplier);
float properDelay = (deltaTime / getRecoveryType(pc).mana) * 0.001f;
float mod = current + (properDelay * onePercent * stateMultiplier);
if(pc.bonuses != null)
mod *= 1 + pc.bonuses.getFloatPercentAll(Enum.ModType.ManaRecoverRate, Enum.SourceType.None);
@ -965,7 +968,8 @@ public class PlayerCombatStats { @@ -965,7 +968,8 @@ public class PlayerCombatStats {
long deltaTime = System.currentTimeMillis() - pc.timestamps.get("LASTSTAMINAREGEN");
float current = pc.stamina.get();
float mod = current + ((deltaTime * 0.001f) * stateMultiplier);
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);
@ -1029,4 +1033,33 @@ public class PlayerCombatStats { @@ -1029,4 +1033,33 @@ public class PlayerCombatStats {
}
}
private enum recoveryType{
RESTING(3.0f,1.25f,0.5f),
IDLING(15.0f,6.0f,5.0f),
WALKING(20.0f,8.0f,0.0f),
RUNNING(0.0f,0.0f,0.0f);
public float health;
public float mana;
public float stamina;
recoveryType(float health,float mana, float stamina){
this.health = health;
this.mana = mana;
this.stamina = stamina;
}
}
public static recoveryType getRecoveryType(PlayerCharacter pc){
if(pc.sit)
return recoveryType.RESTING;
else if(!pc.isMoving())
return recoveryType.IDLING;
else
if(pc.walkMode)
return recoveryType.WALKING;
else
return recoveryType.RUNNING;
}
}

Loading…
Cancel
Save