Dayz Explorer
1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
bloodtype.c
Go to the documentation of this file.
1
class
BloodTypes
2
{
3
static
const
int
NUM_OF_BLOOD_TYPES = 8;
4
5
6
7
static
int
GenerateBloodType()
8
{
9
int
types[NUM_OF_BLOOD_TYPES] = {
LIQUID_BLOOD_0_P
,
LIQUID_BLOOD_0_N
,
LIQUID_BLOOD_A_P
,
LIQUID_BLOOD_A_N
,
LIQUID_BLOOD_B_P
,
LIQUID_BLOOD_B_N
,
LIQUID_BLOOD_AB_P
,
LIQUID_BLOOD_AB_N
};
10
int
probability[NUM_OF_BLOOD_TYPES] = {42,10,25,5,9,3,2,2};
11
12
int
probability_sum = 0;
13
14
for
(
int
i = 0; i < NUM_OF_BLOOD_TYPES; i++)
15
{
16
probability_sum += probability[i];
17
}
18
19
//TIMERDEPRECATED - randomized blodtype for new character
20
int
probability_randomized =
Math
.RandomInt(0,probability_sum);
21
22
int
tmp = 0;
23
int
index;
24
25
for
(i = 0; i < NUM_OF_BLOOD_TYPES; i++)
26
{
27
tmp += probability[i];
28
29
if
( tmp > probability_randomized )
30
{
31
index = i;
32
break
;
33
}
34
}
35
36
return
types[index];
37
}
38
39
static
bool
MatchBloodCompatibility(
int
bloodtypetarget,
int
bloodtype)
40
{
41
bool
result =
false
;
42
switch
( bloodtype )
43
{
44
case
LIQUID_BLOOD_0_P
:
45
if
( bloodtypetarget ==
LIQUID_BLOOD_0_P
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
) result =
true
;
46
break
;
47
48
case
LIQUID_BLOOD_0_N
:
49
if
( bloodtypetarget ==
LIQUID_BLOOD_0_N
) result =
true
;
50
break
;
51
52
case
LIQUID_BLOOD_A_P
:
53
if
( bloodtypetarget ==
LIQUID_BLOOD_A_P
|| bloodtypetarget ==
LIQUID_BLOOD_A_N
|| bloodtypetarget ==
LIQUID_BLOOD_0_P
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
) result =
true
;
54
break
;
55
56
case
LIQUID_BLOOD_A_N
:
57
if
( bloodtypetarget ==
LIQUID_BLOOD_A_N
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
) result =
true
;
58
break
;
59
60
case
LIQUID_BLOOD_B_P
:
61
if
( bloodtypetarget ==
LIQUID_BLOOD_B_P
|| bloodtypetarget ==
LIQUID_BLOOD_B_N
|| bloodtypetarget ==
LIQUID_BLOOD_0_P
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
) result =
true
;
62
break
;
63
64
case
LIQUID_BLOOD_B_N
:
65
if
( bloodtypetarget ==
LIQUID_BLOOD_B_N
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
) result =
true
;
66
break
;
67
68
case
LIQUID_BLOOD_AB_P
:
69
if
( bloodtypetarget ==
LIQUID_BLOOD_AB_P
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
|| bloodtypetarget ==
LIQUID_BLOOD_0_P
|| bloodtypetarget ==
LIQUID_BLOOD_A_N
|| bloodtypetarget ==
LIQUID_BLOOD_A_P
|| bloodtypetarget ==
LIQUID_BLOOD_B_N
|| bloodtypetarget ==
LIQUID_BLOOD_B_P
|| bloodtypetarget ==
LIQUID_BLOOD_AB_N
) result =
true
;
70
break
;
71
72
case
LIQUID_BLOOD_AB_N
:
73
if
( bloodtypetarget ==
LIQUID_BLOOD_AB_N
|| bloodtypetarget ==
LIQUID_BLOOD_0_N
|| bloodtypetarget ==
LIQUID_BLOOD_A_N
|| bloodtypetarget ==
LIQUID_BLOOD_B_N
) result =
true
;
74
break
;
75
76
default
:
77
Debug
.Log(
"Incorrect blood type"
);
78
break
;
79
}
80
if
( result )
81
{
82
return
true
;
83
}
84
else
85
{
86
return
false
;
87
}
88
}
89
static
string
GetBloodTypeName(
int
bloodtype, out
string
type, out
bool
positive )
90
{
91
string
bloodTypeName;
92
switch
( bloodtype )
93
{
94
case
LIQUID_BLOOD_0_P
:
95
bloodTypeName =
"0+"
;
96
type =
"0"
;
97
positive =
true
;
98
break
;
99
100
case
LIQUID_BLOOD_0_N
:
101
bloodTypeName =
"0-"
;
102
type =
"0"
;
103
positive =
false
;
104
break
;
105
106
case
LIQUID_BLOOD_A_P
:
107
bloodTypeName =
"A+"
;
108
type =
"A"
;
109
positive =
true
;
110
break
;
111
112
case
LIQUID_BLOOD_A_N
:
113
bloodTypeName =
"A-"
;
114
type =
"A"
;
115
positive =
false
;
116
break
;
117
118
case
LIQUID_BLOOD_B_P
:
119
bloodTypeName =
"B+"
;
120
type =
"B"
;
121
positive =
true
;
122
break
;
123
124
case
LIQUID_BLOOD_B_N
:
125
bloodTypeName =
"B-"
;
126
type =
"B"
;
127
positive =
false
;
128
break
;
129
130
case
LIQUID_BLOOD_AB_P
:
131
bloodTypeName =
"AB+"
;
132
type =
"AB"
;
133
positive =
true
;
134
break
;
135
136
case
LIQUID_BLOOD_AB_N
:
137
bloodTypeName =
"AB-"
;
138
type =
"AB"
;
139
positive =
false
;
140
break
;
141
142
default
:
143
bloodTypeName =
""
;
144
break
;
145
}
146
147
return
bloodTypeName;
148
}
149
150
};
LIQUID_BLOOD_A_N
const int LIQUID_BLOOD_A_N
Definition:
constants.c:498
LIQUID_BLOOD_A_P
const int LIQUID_BLOOD_A_P
Definition:
constants.c:497
LIQUID_BLOOD_AB_P
const int LIQUID_BLOOD_AB_P
Definition:
constants.c:501
LIQUID_BLOOD_B_N
const int LIQUID_BLOOD_B_N
Definition:
constants.c:500
BloodTypes
Definition:
bloodtype.c:1
LIQUID_BLOOD_B_P
const int LIQUID_BLOOD_B_P
Definition:
constants.c:499
LIQUID_BLOOD_0_P
const int LIQUID_BLOOD_0_P
Definition:
constants.c:495
Debug
Definition:
debug.c:13
LIQUID_BLOOD_0_N
const int LIQUID_BLOOD_0_N
Definition:
constants.c:496
LIQUID_BLOOD_AB_N
const int LIQUID_BLOOD_AB_N
Definition:
constants.c:502
Math
Definition:
enmath.c:6
DAYZ
scripts_v1.24.157551
scripts
world
static
bloodtype.c
Generated by
1.8.17