summaryrefslogtreecommitdiffstats
path: root/Client/Module/ISIS/ISIS_Wound.sqf
blob: 36387181326634a59ea8f74111aa9939fef6c721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Private ["_damage","_damages","_isStuned","_lastWound","_type","_unit"];

_unit = _this select 0;
_type = _this select 1;
_damages = _this select 2;

if (vehicle _unit == _unit) then {
	_isStuned = _unit getVariable "stunned";
	_lastWound = _unit getVariable "lastWound";
	if (isNil "_isStuned") then {_isStuned = false};
	if (isNil "_lastWound") then {_lastWound = round(time)};
	if (_isStuned) exitWith {
		if (time - _lastWound > 3) then {_damages} else {false}
	};

	_unit setVariable ["lastWound",round time];
	_damage = true;

	switch (_type) do {
		case "head_hit": {
			if (_damages > 0.4 && _damages < 1) then {
				if (random 100 > 40) then {_unit setVariable ['stunned',true,true];_isStuned = true};
			};
			if (_damages >= 1 && _damages < 5) then {
				if (random 100 > 40) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false};
			};
		};
		case "body": {
			if (_damages > 0.65 && _damages < 1) then {
				if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true};
			};
			if (_damages >= 1 && _damages < 20) then {
				if (random 100 > 40) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false};
			};
		};
		case "hands": {
			if (_damages > 0.76 && _damages < 1) then {
				if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true};
			};
			if (_damages >= 1 && _damages < 20) then {
				if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false};
			};
		};
		case "legs": {
			if (_damages > 0.68 && _damages < 1) then {
				if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true};
			};
			if (_damages >= 1 && _damages < 20) then {
				if (random 100 > 50) then {_unit setVariable ['stunned',true,true];_isStuned = true;_damage = false};
			};
		};
		case "": {
			_damage = false;
		};
	};

	if (_isStuned) then {[_unit] Spawn ISIS_Wounded};

	if (_damage) then {_damages} else {false};
} else {
	_damages
};