DayZ 1.24
Loading...
Searching...
No Matches
Shock.c
Go to the documentation of this file.
2{
3 private const float UNCONSCIOUS_LIMIT = 50;
4 private const float SHOCK_INCREMENT_PER_SEC = 1;
5
6 override void Init()
7 {
8 m_ID = eModifiers.MDF_SHOCK;
11 //DisableActivateCheck();
13 }
14
16 {
17 return true;
18 }
19
21 {
22 return false;
23 }
24
26 {
27 }
28
30 {
31 }
32
34 {
35 if (player.m_IsDrowning)
36 return 0;
37 if (player.IsUnconscious())
38 return CfgGameplayHandler.GetShockRefillSpeedUnconscious() * player.m_UnconRefillModifier;
39 if (player.GetBrokenLegs() != eBrokenLegs.BROKEN_LEGS || (player.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || player.m_MovementState.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE))
41 if (player.GetBrokenLegs() == eBrokenLegs.BROKEN_LEGS && (player.IsSwimming() || player.IsClimbingLadder()))
43 return 0; //Block shock regen when standing with broken legs
44 }
45
46 override void OnTick(PlayerBase player, float deltaT)
47 {
48 //Print("m_UnconRefillModifier" + player.m_UnconRefillModifier);
49 if (GetGame().GetTime() > player.m_LastShockHitTime + PlayerConstants.SHOCK_REFILL_COOLDOWN_AFTER_HIT && player.GetPulseType() == EPulseType.REGULAR)
50 {
51 if (!player.IsUnconscious())
52 player.m_UnconRefillModifier = 1;//reset this UnconRefillModifier some time after the player has been hit(we want the UnconRefillModifier to only apply to uncon induced by a projectile)
53
54 if (player.GetHealth01("", "Shock") == 1) //no need to continue if the shock is full
55 return;
56
58 player.m_UnconRefillModifier = 1;
59
60 player.AddHealth("", "Shock", deltaT * GetRefillSpeed(player));
61 }
62 }
63
65 {
66
67 }
68};
eBrokenLegs
Definition EBrokenLegs.c:2
EPulseType
Definition EPulseType.c:2
int m_ID
ID of effect, given by SEffectManager when registered (automatically done when playing through it)
Definition Effect.c:49
void DisableDeactivateCheck()
float m_TickIntervalActive
float m_TickIntervalInactive
float GetTime()
static float GetShockRefillSpeedUnconscious()
static bool GetAllowRefillSpeedModifier()
static float GetShockRefillSpeedConscious()
static const float SHOCK_REFILL_COOLDOWN_AFTER_HIT
override void OnDeactivate(PlayerBase player)
Definition Shock.c:29
const float UNCONSCIOUS_LIMIT
Definition Shock.c:3
override bool ActivateCondition(PlayerBase player)
Definition Shock.c:15
const float SHOCK_INCREMENT_PER_SEC
Definition Shock.c:4
float GetRefillSpeed(PlayerBase player)
Definition Shock.c:33
override bool DeactivateCondition(PlayerBase player)
Definition Shock.c:20
override void Init()
Definition Shock.c:6
override void OnTick(PlayerBase player, float deltaT)
Definition Shock.c:46
override void OnReconnect(PlayerBase player)
Definition Shock.c:64
override void OnActivate(PlayerBase player)
Definition Shock.c:25
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
eModifiers
Definition eModifiers.c:2
proto native CGame GetGame()