mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-07-13 15:34:42 +00:00
Restore stamina drain on taking health damage via ResolutionCalculations
This commit is contained in:
parent
a50612dd99
commit
d768b3d62c
2 changed files with 9 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ class PlayerControl(player : Player) extends Actor
|
||||||
def JammableObject = player
|
def JammableObject = player
|
||||||
def DamageableObject = player
|
def DamageableObject = player
|
||||||
|
|
||||||
|
private [this] val log = org.log4s.getLogger(player.Name)
|
||||||
private [this] val damageLog = org.log4s.getLogger(Damageable.LogChannel)
|
private [this] val damageLog = org.log4s.getLogger(Damageable.LogChannel)
|
||||||
|
|
||||||
// A collection of timers for each slot to trigger stamina drain on an interval
|
// A collection of timers for each slot to trigger stamina drain on an interval
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,8 @@ object ResolutionCalculations {
|
||||||
player.Armor = result._1
|
player.Armor = result._1
|
||||||
b = result._2
|
b = result._2
|
||||||
|
|
||||||
|
|
||||||
|
val originalHealth = player.Health
|
||||||
// Then bleed through to health if armour ran out
|
// Then bleed through to health if armour ran out
|
||||||
result = SubtractWithRemainder(player.Health, b)
|
result = SubtractWithRemainder(player.Health, b)
|
||||||
player.Health = result._1
|
player.Health = result._1
|
||||||
|
|
@ -163,6 +165,12 @@ object ResolutionCalculations {
|
||||||
result = SubtractWithRemainder(player.Health, a)
|
result = SubtractWithRemainder(player.Health, a)
|
||||||
player.Health = result._1
|
player.Health = result._1
|
||||||
a = result._2
|
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 _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue