Merge pull request #61 from sp1ky/master

Power regeneration rate increase as power decreases
This commit is contained in:
Olof Larsson 2011-12-16 02:41:05 -08:00
commit 0bbb7ddfdd
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 powerPlayerMin = -10.0;
public static double powerPerMinute = 0.2; // Default health rate... it takes 5 min to heal one power 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 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 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 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 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 now = System.currentTimeMillis();
long millisPassed = now - this.lastPowerUpdateTime; long millisPassed = now - this.lastPowerUpdateTime;
this.lastPowerUpdateTime = now; 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() protected void losePowerFromBeingOffline()