new Regen
This commit is contained in:
@@ -889,9 +889,11 @@ public class PlayerCombatStats {
|
||||
|
||||
|
||||
public void regenerate(){
|
||||
healthRegen(this.owner);
|
||||
manaRegen(this.owner);
|
||||
staminaRegen(this.owner);
|
||||
if(!this.owner.effects.containsKey("Stunned")) {
|
||||
healthRegen(this.owner);
|
||||
manaRegen(this.owner);
|
||||
staminaRegen(this.owner);
|
||||
}
|
||||
staminaConsume(this.owner);
|
||||
this.owner.syncClient();
|
||||
}
|
||||
@@ -949,7 +951,7 @@ public class PlayerCombatStats {
|
||||
|
||||
public static void staminaRegen(PlayerCharacter pc){
|
||||
//cannot regen is moving, swimming or flying
|
||||
if(pc.isFlying() && pc.isSwimming() && pc.isMoving()) {
|
||||
if(pc.isFlying() || pc.isSwimming() || pc.isMoving()) {
|
||||
pc.timestamps.put("LASTSTAMINAREGEN",System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
@@ -975,7 +977,7 @@ public class PlayerCombatStats {
|
||||
worked = pc.stamina.compareAndSet(current, mod);
|
||||
}
|
||||
|
||||
pc.timestamps.put("LASTSTAMINACONSUME",System.currentTimeMillis());
|
||||
pc.timestamps.put("LASTSTAMINAREGEN",System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public static void staminaConsume(PlayerCharacter pc){
|
||||
@@ -991,14 +993,15 @@ public class PlayerCombatStats {
|
||||
}
|
||||
float stateMultiplier = 1.0f;
|
||||
if(pc.isSwimming() || pc.isFlying())
|
||||
stateMultiplier = 1.5f;
|
||||
stateMultiplier = 2.5f;
|
||||
|
||||
if(!pc.timestamps.containsKey("LASTSTAMINACONSUME"))
|
||||
pc.timestamps.put("LASTSTAMINACONSUME",System.currentTimeMillis());
|
||||
|
||||
long deltaTime = System.currentTimeMillis() - pc.timestamps.get("LASTSTAMINACONSUME");
|
||||
float current = pc.stamina.get();
|
||||
float mod = current - ((deltaTime *0.001f) * 0.6f * stateMultiplier);
|
||||
float consumed = ((deltaTime * 0.001f) * 0.6f * stateMultiplier);
|
||||
float mod = current - consumed;
|
||||
boolean worked = false;
|
||||
if(mod <= 0)
|
||||
mod = 0;
|
||||
|
||||
Reference in New Issue
Block a user