Merge pull request #2424 from acemod/medical-tweaks

Medical tweaks
This commit is contained in:
Glowbal 2015-09-14 23:20:50 +02:00
commit 4b6082d836
6 changed files with 30 additions and 10 deletions

View File

@ -159,7 +159,7 @@ GVAR(lastHeartBeatSound) = ACE_time;
_heartRate = 60 + 40 * _pain;
};
if (_heartRate <= 0) exitwith {};
_interval = 60 / (_heartRate min 50);
_interval = 60 / (_heartRate min 40);
if ((ACE_player getVariable ["ACE_isUnconscious", false])) then {
if (GVAR(painEffectType) == 1) then {
@ -173,7 +173,7 @@ GVAR(lastHeartBeatSound) = ACE_time;
// Pain effect, no pain effect in zeus camera
if (isNull curatorCamera) then {
_strength = (_pain - (ACE_player getvariable [QGVAR(painSuppress), 0])) max 0;
_strength = ((_pain - (ACE_player getvariable [QGVAR(painSuppress), 0])) max 0) min 1;
_strength = _strength * (ACE_player getVariable [QGVAR(painCoefficient), GVAR(painCoefficient)]);
if (GVAR(painEffectType) == 1) then {
GVAR(effectPainCC) ppEffectEnable false;

View File

@ -14,7 +14,15 @@
*/
#include "script_component.hpp"
private ["_damageThreshold", "_damageBodyPart"];
#define INCREASE_CHANCE_HEAD 0.05
#define INCREASE_CHANCE_TORSO 0.03
#define INCREASE_CHANGE_LIMB 0.01
#define CHANGE_FATAL_HEAD 0.7
#define CHANGE_FATAL_TORSO 0.6
#define CHANGE_FATAL_LIMB 0.1
private ["_damageThreshold", "_damageBodyPart", "_chanceFatal"];
params ["_unit", "_part", ["_withDamage", 0]];
if (!alive _unit) exitwith {true};
@ -28,17 +36,22 @@ if ([_unit] call EFUNC(common,IsPlayer)) then {
} else {
_damageThreshold =_unit getvariable[QGVAR(unitDamageThreshold), [GVAR(AIDamageThreshold), GVAR(AIDamageThreshold), GVAR(AIDamageThreshold) * 1.7]];
};
_damageThreshold params ["_thresholdHead", "_thresholdTorso", "_thresholdLimbs"];
_damageBodyPart = ((_unit getvariable [QGVAR(bodyPartStatus),[0, 0, 0, 0, 0, 0]]) select _part) + _withDamage;
// Check if damage to body part is higher as damage head
if (_part == 0) exitwith {
(_damageBodyPart >= (_damageThreshold select 0) && {(random(1) > 0.2)});
_chanceFatal = CHANGE_FATAL_HEAD + ((INCREASE_CHANCE_HEAD * (_damageBodyPart - _thresholdHead)) * 10);
(_damageBodyPart >= _thresholdHead && {(_chanceFatal >= random(1))});
};
// Check if damage to body part is higher as damage torso
if (_part == 1) exitwith {
(_damageBodyPart >= (_damageThreshold select 1) && {(random(1) > 0.35)});
_chanceFatal = CHANGE_FATAL_TORSO + ((INCREASE_CHANCE_TORSO * (_damageBodyPart - _thresholdTorso)) * 10);
(_damageBodyPart >= _thresholdTorso && {(_chanceFatal >= random(1))});
};
// Check if damage to body part is higher as damage limbs
(_damageBodyPart >= (_damageThreshold select 2) && {(random(1) > 0.95)});
// We use a slightly lower decrease for limbs, as we want any injuries done to those to be less likely to be fatal compared to head shots or torso.
_chanceFatal = CHANGE_FATAL_LIMB + ((INCREASE_CHANGE_LIMB * (_damageBodyPart - _thresholdLimbs)) * 10);
(_damageBodyPart >= _thresholdLimbs && {(_chanceFatal >= random(1))});

View File

@ -20,7 +20,7 @@
#include "script_component.hpp"
private ["_typeOfProjectile", "_part", "_damageBodyParts", "_hitPoints"];
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_newDamage"];
params ["_unit", "_selectionName", "_amountOfDamage", "_sourceOfDamage", "_typeOfProjectile", "_hitPointNumber", "_newDamage"];
_part = [_selectionName] call FUNC(selectionNameToNumber);
if (_part < 0) exitwith {};

View File

@ -36,7 +36,7 @@ TRACE_4("ACE_DEBUG: HandleDamage BASIC",_unit, _damageBodyParts,_cache_params,_c
if (alive _unit && {!(_unit getvariable ["ACE_isUnconscious", false])}) then {
// If it reaches this, we can assume that the hit did not kill this unit, as this function is called 3 frames after the damage has been passed.
if ([_unit, _part, if (_part > 1) then {_newDamage * 1.3} else {_newDamage * 2}] call FUNC(determineIfFatal)) then {
[_unit, true, 0.5+random(3)] call FUNC(setUnconscious);
[_unit, true, 0.5+random(10)] call FUNC(setUnconscious);
};
};
_pain = _unit getVariable [QGVAR(pain), 0];

View File

@ -76,7 +76,7 @@ if (diag_frameno > (_unit getVariable [QGVAR(frameNo_damageCaching), -3]) + 2) t
private ["_args", "_params"];
params ["_args", "_idPFH"];
_args params ["_unit", "_frameno"];
if (diag_frameno > _frameno + 2) then {
if (diag_frameno >= _frameno + 2) then {
_unit setDamage 0;
if (GVAR(level) < 2 || {!([_unit] call FUNC(hasMedicalEnabled))}) then {

View File

@ -25,7 +25,14 @@ _part = [_selectionName] call FUNC(selectionNameToNumber);
if (_part < 0) exitwith {false};
if ((_damageBodyParts select _part) > 0) then {
_damageBodyParts set [_part, ((_damageBodyParts select _part) - BANDAGEHEAL) max 0];
_damageOnPart = (_damageBodyParts select _part);
// Temp quick fix to change in behaviour of basic medical bandaging
if (_damageOnPart - BANDAGEHEAL > 0) then {
_damageOnPart = _damageOnPart - (_damageOnPart * BANDAGEHEAL);
} else {
_damageOnPart = _damageOnPart - BANDAGEHEAL;
};
_damageBodyParts set [_part, _damageOnPart max 0];
_target setvariable [QGVAR(bodyPartStatus), _damageBodyParts, true];
TRACE_2("ACE_DEBUG: Treatment BASIC Bandage Broadcast value here",_unit, _target getvariable QGVAR(bodyPartStatus));
};