mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-20 02:54:46 +00:00
Restore stamina drain on taking health damage via ResolutionCalculations
This commit is contained in:
parent
a50612dd99
commit
d768b3d62c
|
|
@ -36,6 +36,7 @@ class PlayerControl(player : Player) extends Actor
|
|||
def JammableObject = player
|
||||
def DamageableObject = player
|
||||
|
||||
private [this] val log = org.log4s.getLogger(player.Name)
|
||||
private [this] val damageLog = org.log4s.getLogger(Damageable.LogChannel)
|
||||
|
||||
// A collection of timers for each slot to trigger stamina drain on an interval
|
||||
|
|
|
|||
|
|
@ -154,6 +154,8 @@ object ResolutionCalculations {
|
|||
player.Armor = result._1
|
||||
b = result._2
|
||||
|
||||
|
||||
val originalHealth = player.Health
|
||||
// Then bleed through to health if armour ran out
|
||||
result = SubtractWithRemainder(player.Health, b)
|
||||
player.Health = result._1
|
||||
|
|
@ -163,6 +165,12 @@ object ResolutionCalculations {
|
|||
result = SubtractWithRemainder(player.Health, a)
|
||||
player.Health = result._1
|
||||
a = result._2
|
||||
|
||||
// If any health damage was applied also drain an amount of stamina equal to half the health damage
|
||||
if(player.Health < originalHealth) {
|
||||
val delta = originalHealth - player.Health
|
||||
player.Stamina = player.Stamina - math.floor(delta / 2).toInt
|
||||
}
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue