mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-06 13:40:21 +00:00
Stamina drain on health damage
This commit is contained in:
parent
404e2579ef
commit
e4902a317c
1 changed files with 10 additions and 1 deletions
|
|
@ -127,7 +127,16 @@ class Player(private val core : Avatar) extends PlanetSideServerObject
|
|||
def Health : Int = health
|
||||
|
||||
def Health_=(assignHealth : Int) : Int = {
|
||||
health = math.min(math.max(0, assignHealth), MaxHealth)
|
||||
val newHealth = math.min(math.max(0, assignHealth), MaxHealth)
|
||||
val delta = health - newHealth
|
||||
|
||||
health = newHealth
|
||||
|
||||
if (delta > 0) // If Health has decreased drain stamina too at half the amount of Health damage
|
||||
{
|
||||
Stamina -= math.floor(delta / 2).toInt
|
||||
}
|
||||
|
||||
Health
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue