Skip to content

Commit

Permalink
Circulation - Add Nitroglycerin Impacts to Cardiac Arrest Chance and …
Browse files Browse the repository at this point in the history
…Adjust H&T Factor Impact (#711)

**When merged this pull request will:**
- Adds negative impact to all cardiac arrest interventions when
nitroglycerin is present
- Moves H&T Factors to prevent patient getting stuck in cardiac arrest
loop with no cardiac arrest type

### IMPORTANT

- [Development Guidelines](https://ace3.acemod.org/wiki/development/)
are read, understood and applied.
- Title of this PR uses our standard template `Component -
Add|Fix|Improve|Change|Make|Remove {changes}`.

---------

Co-authored-by: Cplhardcore <135324281+Cplhardcore@users.noreply.github.com>
  • Loading branch information
mazinskihenry and Cplhardcore authored Jan 27, 2025
1 parent 4722916 commit 0a8f1cc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
15 changes: 13 additions & 2 deletions addons/circulation/functions/fnc_cprLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ private _randomAmi = random 4;
private _epiBoost = 1;
private _amiBoost = 0;
private _lidoBoost = 0;
private _nitroEffect = 1;
private _CPRcount = _patient getVariable [QGVAR(cprCount), 0];

private _fnc_advRhythm = {
Expand Down Expand Up @@ -62,7 +63,11 @@ private _fnc_advRhythm = {
};
};

if ((_patient getVariable [QGVAR(cardiacArrestType), 0] isEqualTo 0) && _ht) exitWith {
if !(_ht) then {
_patient setVariable [QGVAR(cardiacArrestType), 1, true];
};

if ((_patient getVariable [QGVAR(cardiacArrestType), 0] isEqualTo 0)) exitWith {
[QACEGVAR(medical,CPRSucceeded), _patient] call CBA_fnc_localEvent;
};

Expand Down Expand Up @@ -92,6 +97,10 @@ private _fnc_advRhythm = {
{
_lidoBoost = _lidoBoost + 8;
};
case "Nitroglycerin":
{
_nitroEffect = _nitroEffect + 1;
};
};
} forEach (_patient getVariable [QACEGVAR(medical,medications), []]);

Expand Down Expand Up @@ -122,7 +131,7 @@ switch (_reviveObject) do {
};

if (_reviveObject in ["AED", "AEDX"]) exitWith {
_chance = _chance + (_amiBoost + (1 max _lidoBoost) * _epiBoost);
_chance = _chance + (_amiBoost + (1 max _lidoBoost) * _epiBoost) / _nitroEffect;

private _patientState = _patient getVariable [QGVAR(cardiacArrestType), 0];

Expand Down Expand Up @@ -169,6 +178,8 @@ if !(GVAR(enable_CPR_Chances)) then {
_chance = _chance + _amiBoost;
};

_chance = _chance / _nitroEffect;

if (_random <= _chance) then {
if (GVAR(AdvRhythm)) then {
if (_patient getVariable [QGVAR(cardiacArrestType), 0] != 0) then {
Expand Down
6 changes: 6 additions & 0 deletions addons/circulation/functions/fnc_handleCardiacArrest.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ if (_initial) then {
_cardiacArrestType = 2;
};

private _nitroCount = ([_patient, "Nitroglycerin", false] call ACEFUNC(medical_status,getMedicationCount)) select 1;

if ((_nitroCount < 0.5) && ((random 3) < 1)) then {
_cardiacArrestType = 2;
};

_unit setVariable [QGVAR(cardiacArrestType), _cardiacArrestType, true];
} else {
_cardiacArrestType = _unit getVariable [QGVAR(cardiacArrestType), 0];
Expand Down

0 comments on commit 0a8f1cc

Please sign in to comment.