DayZ 1.24
Loading...
Searching...
No Matches
ShockDamage.c
Go to the documentation of this file.
2{
3 const int UNCONSIOUSS_COOLDOWN_TIME = 60;//in s
4 override void Init()
5 {
7 m_ID = eModifiers.MDF_SHOCK_DAMAGE;
10 }
11
13 {
14
15 }
16
18 {
19
20 }
21
23 {
24 if (!player.IsUnconscious() && player.GetHealth("", "Blood") <= PlayerConstants.SHOCK_DAMAGE_BLOOD_THRESHOLD_HIGH && GetGame().GetTime() > (player.m_UnconsciousEndTime + UNCONSIOUSS_COOLDOWN_TIME))
25 return true;
26 else
27 return false;
28 }
29
31 {
33 }
34 // ------------------------------------------------------------------------------
35
36 override void OnTick(PlayerBase player, float deltaT)
37 {
38 float blood = player.GetHealth("", "Blood");
40 value = Math.Clamp(value, 0, 1);
42 float damage = -dmg * deltaT;
43 player.AddHealth("", "Shock", damage);
44 //PrintString(damage.ToString());
45 }
46};
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
bool m_TrackActivatedTime
float m_TickIntervalActive
float m_TickIntervalInactive
const int DEFAULT_TICK_TIME_INACTIVE
float GetTime()
Definition EnMath.c:7
static const float SHOCK_DAMAGE_BLOOD_THRESHOLD_LOW
static const float SHOCK_DAMAGE_BLOOD_THRESHOLD_HIGH
static const float SHOCK_DAMAGE_HIGH
static const float SHOCK_DAMAGE_LOW
override bool ActivateCondition(PlayerBase player)
Definition ShockDamage.c:22
override void OnTick(PlayerBase player, float deltaT)
Definition ShockDamage.c:36
override void Init()
Definition ShockDamage.c:4
override void OnReconnect(PlayerBase player)
Definition ShockDamage.c:17
override void OnActivate(PlayerBase player)
Definition ShockDamage.c:12
override bool DeactivateCondition(PlayerBase player)
Definition ShockDamage.c:30
const int UNCONSIOUSS_COOLDOWN_TIME
Definition ShockDamage.c:3
eModifiers
Definition eModifiers.c:2
proto native CGame GetGame()
static proto float Lerp(float a, float b, float time)
Linearly interpolates between 'a' and 'b' given 'time'.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...