DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
BloodType.c
См. документацию.
2{
3 static const int NUM_OF_BLOOD_TYPES = 8;
4
5
6
7 static int GenerateBloodType()
8 {
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
49 if ( bloodtypetarget == LIQUID_BLOOD_0_N ) result = true;
50 break;
51
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
65 if ( bloodtypetarget == LIQUID_BLOOD_B_N || bloodtypetarget == LIQUID_BLOOD_0_N ) result = true;
66 break;
67
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
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
131 bloodTypeName = "AB+";
132 type = "AB";
133 positive = true;
134 break;
135
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};
static bool MatchBloodCompatibility(int bloodtypetarget, int bloodtype)
Определения BloodType.c:39
static string GetBloodTypeName(int bloodtype, out string type, out bool positive)
Определения BloodType.c:89
static int GenerateBloodType()
Определения BloodType.c:7
static const int NUM_OF_BLOOD_TYPES
Определения BloodType.c:3
Определения BloodType.c:2
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.
Определения Debug.c:122
Определения Debug.c:2
Определения EnMath.c:7
const int LIQUID_BLOOD_AB_P
Определения constants.c:535
const int LIQUID_BLOOD_0_P
Определения constants.c:529
const int LIQUID_BLOOD_B_P
Определения constants.c:533
const int LIQUID_BLOOD_A_N
Определения constants.c:532
const int LIQUID_BLOOD_0_N
Определения constants.c:530
const int LIQUID_BLOOD_B_N
Определения constants.c:534
const int LIQUID_BLOOD_A_P
Определения constants.c:531
const int LIQUID_BLOOD_AB_N
Определения constants.c:536
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].