Power regeneration rate increase as power decreases

This commit is contained in:
sp1ky 2011-11-28 23:07:29 +00:00
parent 3d929138a5
commit 486fce400f
2 changed files with 10 additions and 2 deletions

View File

@ -34,6 +34,8 @@ public class Conf
public static double powerPlayerMin = -10.0;
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power
public static double powerPerDeath = 4.0; // A death makes you lose 4 power
public static boolean scaleNegativePower = false; // Power regeneration rate increase as power decreases
public static double scaleNegativeDivisor = 40.0; // Divisor for inverse power regeneration curve
public static boolean powerRegenOffline = false; // does player power regenerate even while they're offline?
public static double powerOfflineLossPerDay = 0.0; // players will lose this much power per day offline
public static double powerOfflineLossLimit = 0.0; // players will no longer lose power from being offline once their power drops to this amount or less

View File

@ -377,9 +377,15 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
long now = System.currentTimeMillis();
long millisPassed = now - this.lastPowerUpdateTime;
this.lastPowerUpdateTime = now;
int millisPerMinute = 60*1000;
double powerPerMinute = Conf.powerPerMinute;
if(Conf.scaleNegativePower && this.power < 0)
{
powerPerMinute += (Math.sqrt(Math.abs(this.power)) * Math.abs(this.power)) / Conf.scaleNegativeDivisor;
}
this.alterPower(millisPassed * powerPerMinute / millisPerMinute);
int millisPerMinute = 60*1000;
this.alterPower(millisPassed * Conf.powerPerMinute / millisPerMinute);
}
protected void losePowerFromBeingOffline()