DayZ 1.24
Loading...
Searching...
No Matches
BloodType.c
Go to the documentation of this file.
2{
3 static const int NUM_OF_BLOOD_TYPES = 8;
4
5
6 static int GenerateBloodType()
7 {
9 int probability[NUM_OF_BLOOD_TYPES] = {42, 10, 25, 5, 9, 3, 2, 2};
10
11 int probability_sum = 0;
12
13 for (int i = 0; i < NUM_OF_BLOOD_TYPES; i++)
15
16 //TIMERDEPRECATED - randomized blodtype for new character
18
19 int tmp = 0;
20 int index;
21
22 for (i = 0; i < NUM_OF_BLOOD_TYPES; i++)
23 {
24 tmp += probability[i];
25
27 {
28 index = i;
29 break;
30 }
31 }
32
33 return types[index];
34 }
35
37 {
38 bool result = false;
39 switch (bloodtype)
40 {
43 break;
44
47 break;
48
51 break;
52
55 break;
56
59 break;
60
63 break;
64
67 break;
68
71 break;
72
73 default:
74 Debug.Log("Incorrect blood type");
75 break;
76 }
77 if (result)
78 return true;
79 else
80 return false;
81 }
82 static string GetBloodTypeName(int bloodtype, out string type, out bool positive)
83 {
84 string bloodTypeName;
85 switch (bloodtype)
86 {
88 bloodTypeName = "0+";
89 type = "0";
90 positive = true;
91 break;
92
94 bloodTypeName = "0-";
95 type = "0";
96 positive = false;
97 break;
98
100 bloodTypeName = "A+";
101 type = "A";
102 positive = true;
103 break;
104
105 case LIQUID_BLOOD_A_N:
106 bloodTypeName = "A-";
107 type = "A";
108 positive = false;
109 break;
110
111 case LIQUID_BLOOD_B_P:
112 bloodTypeName = "B+";
113 type = "B";
114 positive = true;
115 break;
116
117 case LIQUID_BLOOD_B_N:
118 bloodTypeName = "B-";
119 type = "B";
120 positive = false;
121 break;
122
124 bloodTypeName = "AB+";
125 type = "AB";
126 positive = true;
127 break;
128
130 bloodTypeName = "AB-";
131 type = "AB";
132 positive = false;
133 break;
134
135 default:
136 bloodTypeName = "";
137 break;
138 }
139
140 return bloodTypeName;
141 }
142
143};
static bool MatchBloodCompatibility(int bloodtypetarget, int bloodtype)
Definition BloodType.c:36
static string GetBloodTypeName(int bloodtype, out string type, out bool positive)
Definition BloodType.c:82
static int GenerateBloodType()
Definition BloodType.c:6
static const int NUM_OF_BLOOD_TYPES
Definition BloodType.c:3
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Definition EnMath.c:7
const int LIQUID_BLOOD_AB_P
Definition constants.c:500
const int LIQUID_BLOOD_0_P
Definition constants.c:494
const int LIQUID_BLOOD_B_P
Definition constants.c:498
const int LIQUID_BLOOD_A_N
Definition constants.c:497
const int LIQUID_BLOOD_0_N
Definition constants.c:495
const int LIQUID_BLOOD_B_N
Definition constants.c:499
const int LIQUID_BLOOD_A_P
Definition constants.c:496
const int LIQUID_BLOOD_AB_N
Definition constants.c:501
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].