@@ -476,7 +476,7 @@ function DetectAndApplySkill(interval = 1) {
476476 foreach (idx, menuProps in g_lst_MenuProps) {
477477 if (menuProps. entIndex == entindex && Time () >= g_tbl_MenuSkillInfo. scannerLastSkillTime + g_tbl_MenuSkillInfo. scannerSkillCD ) {
478478 if (g_tbl_MenuSkillInfo. scannerRandomScanCounter > 0 ) {
479- local rand = RandIntUniformDistribution (0 , g_marine_Total_Unshuffled. len () - 5 + g_tbl_MenuSkillInfo. scannerRandomScanCounter );
479+ local rand = RandomHQUniformIntDistribution (0 , g_marine_Total_Unshuffled. len () - 5 + g_tbl_MenuSkillInfo. scannerRandomScanCounter );
480480 foreach (idx, prop in g_lst_MenuProps) {
481481 if (prop. scannerIsRevealed || prop. entIndex == g_marine_Scanner. entindex ()) {
482482 continue;
@@ -849,6 +849,12 @@ function WriteMatchResultToFile(winner) {
849849 StringToFile (" Challenge_Traitor_Result_" + GetLocalTime (). tostring () + " .txt" , g_str_GameResult);
850850}
851851
852+ function GetLocalTime () {
853+ local localTime = {};
854+ LocalTime (localTime);
855+ return localTime. dayofyear * 86400 + localTime. hour * 3600 + localTime. minute * 60 + localTime. second ;
856+ }
857+
852858function ShowSpeciallRolesList () {
853859 local hPlayer = null ;
854860 while (hPlayer = Entities. FindByClassname (hPlayer, " player" )) {
@@ -907,8 +913,6 @@ function OnMissionStart() {
907913}
908914
909915function OnGameplayStart () {
910- PrepareRNG (); // 准备随机数
911-
912916 SetConVars (); // 设置cvar
913917 SetTechMap (); // 设置技术地图标识,暂时没有作用
914918 SetImmuneTimeAndFlags (); // 设置出生保护,记录当前地图
@@ -1029,7 +1033,7 @@ function InitializeExtraHealthAndShield() {
10291033
10301034function DeterminRoleCount () {
10311035 // 确定各种数量
1032- local tempRandom = RandIntUniformDistribution (0 , 1 )
1036+ local tempRandom = RandomHQUniformIntDistribution (0 , 1 )
10331037 switch (g_int_MarineCount) {
10341038 case 0 :
10351039 case 1 :
@@ -1052,15 +1056,15 @@ function DeterminRoleCount() {
10521056
10531057 LocalizedClientPrint (null , 3 , TextColor (160 , 32 , 240 ) + " %s1" , " #challenge_traitors_not_enough_players" );
10541058 if (DEBUG) {
1055- g_int_TraitorCount = 0 ; // RandIntUniformDistribution (0, 1);
1059+ g_int_TraitorCount = 0 ; // RandomHQUniformIntDistribution (0, 1);
10561060 // tempRandom;
10571061 g_bool_ClhallengeEnable = true ;
10581062 LocalizedClientPrint (null , 3 , TextColor (255 , 0 , 0 ) + " You are now in DEBUG mode" );
10591063 } // Debug only
10601064 break ;
10611065 case 3 :
10621066 g_int_TraitorCount = 1 ;
1063- g_bool_HasTraitorLeader = (RandIntUniformDistribution (0 , 2 ) == 0 );
1067+ g_bool_HasTraitorLeader = (RandomHQUniformIntDistribution (0 , 2 ) == 0 );
10641068 g_int_TraitorLeaderExtraHealth = 60 ;
10651069 break ; // 1
10661070 case 4 :
@@ -1080,13 +1084,13 @@ function DeterminRoleCount() {
10801084 break ; // 2
10811085 case 7 :
10821086 g_int_TraitorCount = 2 ;
1083- g_bool_HasIafLeader = (RandIntUniformDistribution (0 , 2 ) == 0 );
1084- g_bool_HasScanner = (RandIntUniformDistribution (0 , 20 ) == 0 );
1085- g_bool_HasBiochemist = (RandIntUniformDistribution (0 , 14 ) == 0 );
1087+ g_bool_HasIafLeader = (RandomHQUniformIntDistribution (0 , 2 ) == 0 );
1088+ g_bool_HasScanner = (RandomHQUniformIntDistribution (0 , 20 ) == 0 );
1089+ g_bool_HasBiochemist = (RandomHQUniformIntDistribution (0 , 14 ) == 0 );
10861090 g_bool_HasInfector = g_bool_HasBiochemist;
10871091 g_bool_HasSilencer = g_bool_HasScanner;
1088- g_bool_HasTraitorLeader = g_bool_HasIafLeader || (RandIntUniformDistribution (0 , 3 ) == 0 );
1089- switch (RandIntUniformDistribution (0 , 6 )) {
1092+ g_bool_HasTraitorLeader = g_bool_HasIafLeader || (RandomHQUniformIntDistribution (0 , 3 ) == 0 );
1093+ switch (RandomHQUniformIntDistribution (0 , 6 )) {
10901094 case 0 :
10911095 // g_bool_HasInfector = true;
10921096 break ;
@@ -1097,21 +1101,21 @@ function DeterminRoleCount() {
10971101 g_bool_HasSilencer = true ;
10981102 break ;
10991103 }
1100- g_bool_HasShield = (RandIntUniformDistribution (0 , 12 ) == 0 );
1101- g_bool_HasSniper = (RandIntUniformDistribution (0 , 12 ) == 0 );
1102- g_bool_HasDemo = (RandIntUniformDistribution (0 , 12 ) == 0 );
1103- g_bool_HasDeserter = (RandIntUniformDistribution (0 , 8 ) == 0 );
1104+ g_bool_HasShield = (RandomHQUniformIntDistribution (0 , 12 ) == 0 );
1105+ g_bool_HasSniper = (RandomHQUniformIntDistribution (0 , 12 ) == 0 );
1106+ g_bool_HasDemo = (RandomHQUniformIntDistribution (0 , 12 ) == 0 );
1107+ g_bool_HasDeserter = (RandomHQUniformIntDistribution (0 , 8 ) == 0 );
11041108 break ; // 2
11051109 case 8 :
11061110 g_int_TraitorCount = 2 ;
1107- g_bool_HasScanner = (RandIntUniformDistribution (0 , 10 ) == 0 );
1108- g_bool_HasBiochemist = (RandIntUniformDistribution (0 , 7 ) == 0 );
1109- g_bool_HasIafLeader = (RandIntUniformDistribution (0 , 1 ) == 0 );
1111+ g_bool_HasScanner = (RandomHQUniformIntDistribution (0 , 10 ) == 0 );
1112+ g_bool_HasBiochemist = (RandomHQUniformIntDistribution (0 , 7 ) == 0 );
1113+ g_bool_HasIafLeader = (RandomHQUniformIntDistribution (0 , 1 ) == 0 );
11101114 g_bool_HasInfector = g_bool_HasBiochemist;
11111115 g_bool_HasSilencer = g_bool_HasScanner;
11121116 g_bool_HasTraitorLeader = true ;
11131117 g_int_TraitorLeaderExtraHealth = 250 ;
1114- switch (RandIntUniformDistribution (0 , 5 )) {
1118+ switch (RandomHQUniformIntDistribution (0 , 5 )) {
11151119 case 0 :
11161120 // g_bool_HasInfector = true;
11171121 break ;
@@ -1122,10 +1126,10 @@ function DeterminRoleCount() {
11221126 g_bool_HasSilencer = true ;
11231127 break ;
11241128 }
1125- g_bool_HasShield = (RandIntUniformDistribution (0 , 8 ) == 0 );
1126- g_bool_HasSniper = (RandIntUniformDistribution (0 , 12 ) == 0 );
1127- g_bool_HasDemo = (RandIntUniformDistribution (0 , 8 ) == 0 );
1128- g_bool_HasDeserter = (RandIntUniformDistribution (0 , 6 ) == 0 );
1129+ g_bool_HasShield = (RandomHQUniformIntDistribution (0 , 8 ) == 0 );
1130+ g_bool_HasSniper = (RandomHQUniformIntDistribution (0 , 12 ) == 0 );
1131+ g_bool_HasDemo = (RandomHQUniformIntDistribution (0 , 8 ) == 0 );
1132+ g_bool_HasDeserter = (RandomHQUniformIntDistribution (0 , 6 ) == 0 );
11291133 break ; // 2
11301134 case 9 :
11311135 g_int_TraitorCount = 3 ;
@@ -1155,37 +1159,37 @@ function DeterminRoleCount() {
11551159 if (g_int_MarineCount >= 9 && g_int_MarineCount < 12 ) {
11561160 g_bool_HasScanner = true ;
11571161 g_bool_HasBiochemist = true ;
1158- g_bool_HasIafLeader = (RandIntUniformDistribution (0 , 14 - g_int_MarineCount) == 0 );
1159- g_bool_HasShield = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1160- if ((RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 )) {
1161- g_bool_HasSniper = (RandIntUniformDistribution (0 , 1 ) == 0 );
1162+ g_bool_HasIafLeader = (RandomHQUniformIntDistribution (0 , 14 - g_int_MarineCount) == 0 );
1163+ g_bool_HasShield = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
1164+ if ((RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 )) {
1165+ g_bool_HasSniper = (RandomHQUniformIntDistribution (0 , 1 ) == 0 );
11621166 g_bool_HasDemo = ! g_bool_HasSniper;
11631167 }
1164- g_bool_HasDeserter = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1168+ g_bool_HasDeserter = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
11651169
11661170 g_bool_HasInfector = true ;
1167- g_bool_HasSilencer = (RandIntUniformDistribution (0 , 3 ) != 0 );
1171+ g_bool_HasSilencer = (RandomHQUniformIntDistribution (0 , 3 ) != 0 );
11681172 g_bool_HasMimic = ! g_bool_HasSilencer;
11691173 g_bool_HasTraitorLeader = g_bool_HasIafLeader;
1170- if ((RandIntUniformDistribution (0 , 12 - g_int_MarineCount) == 0 )) {
1171- g_bool_HasBoomer = (RandIntUniformDistribution (0 , 1 ) == 0 );
1174+ if ((RandomHQUniformIntDistribution (0 , 12 - g_int_MarineCount) == 0 )) {
1175+ g_bool_HasBoomer = (RandomHQUniformIntDistribution (0 , 1 ) == 0 );
11721176 g_bool_HasInfector = ! g_bool_HasBoomer;
11731177 }
11741178 }
11751179 if (g_int_MarineCount >= 12 && g_int_MarineCount < 16 ) {
11761180 g_bool_HasScanner = true ;
11771181 g_bool_HasBiochemist = true ;
11781182 g_bool_HasIafLeader = true ;
1179- g_bool_HasShield = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1180- g_bool_HasSniper = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1181- g_bool_HasDemo = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1183+ g_bool_HasShield = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
1184+ g_bool_HasSniper = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
1185+ g_bool_HasDemo = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
11821186 g_bool_HasDeserter = true ;
11831187
11841188 g_bool_HasInfector = true ;
11851189 g_bool_HasSilencer = true ;
11861190 g_bool_HasTraitorLeader = true ;
1187- g_bool_HasMimic = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1188- g_bool_HasBoomer = (RandIntUniformDistribution (0 , 16 - g_int_MarineCount) == 0 );
1191+ g_bool_HasMimic = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
1192+ g_bool_HasBoomer = (RandomHQUniformIntDistribution (0 , 16 - g_int_MarineCount) == 0 );
11891193 g_bool_HasInfector = ! g_bool_HasBoomer;
11901194 }
11911195 if (g_int_MarineCount >= 16 ) {
@@ -1207,21 +1211,6 @@ function DeterminRoleCount() {
12071211 g_int_IafAliveCount = g_int_MarineCount - g_int_TraitorCount;
12081212}
12091213
1210- function PrepareRNG () {
1211- RngSetSeed (GetLocalTime ()); // 设置随机数种子
1212- local i = 0 ;
1213- for (; i < 200 ; i++ ) {
1214- RandIntUniformDistribution (0 , 1 ); // 丢弃前50个随机数
1215- }
1216- RngSetSeed (GetLocalTime () * 1000 + (Time () * 1000 ). tointeger () % 1000 ); // 重新设置随机数种子
1217- }
1218-
1219- function GetLocalTime () {
1220- local localTime = {};
1221- LocalTime (localTime);
1222- return localTime. dayofyear * 86400 + localTime. hour * 3600 + localTime. minute * 60 + localTime. second ;
1223- }
1224-
12251214function DelayFunctionCall (function_name, function_params, delay) {
12261215 if (! this [" self" ])
12271216 return ;
@@ -2253,17 +2242,17 @@ function SetConVars(interval = 1) {
22532242 Convars. SetValue (" asw_marine_ff_absorption" , 0 );
22542243 Convars. SetValue (" rd_aim_marines" , 1 );
22552244 Convars. SetValue (" rd_hp_regen" , 1 );
2256- Convars. SetValue (" rm_health_regen_amount" , RandFloatNormalDistribution (3 , 0.5 ));
2257- Convars. SetValue (" rm_health_regen_interval" , RandFloatNormalDistribution (10 , 0.4 ));
2245+ Convars. SetValue (" rm_health_regen_amount" , RandomHQNormalDistribution (3 , 0.5 ));
2246+ Convars. SetValue (" rm_health_regen_interval" , RandomHQNormalDistribution (10 , 0.4 ));
22582247 Convars. SetValue (" rd_weapons_show_hidden" , 1 );
2259- Convars. SetValue (" rd_jumpjet_knockdown_marines" , RandIntUniformDistribution (0 , 10 ) >= 8 ? 0 : 1 );
2248+ Convars. SetValue (" rd_jumpjet_knockdown_marines" , RandomHQUniformIntDistribution (0 , 10 ) >= 8 ? 0 : 1 );
22602249 Convars. SetValue (" rd_marine_ignite_immediately" , 1 );
22612250 Convars. SetValue (" asw_marine_time_until_ignite" , 0 );
2262- Convars. SetValue (" asw_marine_burn_time_easy" , RandFloatNormalDistribution (45 , 5 ));
2263- Convars. SetValue (" asw_marine_burn_time_normal" , RandFloatNormalDistribution (45 , 5 ));
2264- Convars. SetValue (" asw_marine_burn_time_hard" , RandFloatNormalDistribution (45 , 5 ));
2265- Convars. SetValue (" asw_marine_burn_time_insane" , RandFloatNormalDistribution (45 , 5 ));
2266- Convars. SetValue (" asw_blink_charge_time" , RandFloatNormalDistribution (100 , 25 ));
2251+ Convars. SetValue (" asw_marine_burn_time_easy" , RandomHQNormalDistribution (45 , 5 ));
2252+ Convars. SetValue (" asw_marine_burn_time_normal" , RandomHQNormalDistribution (45 , 5 ));
2253+ Convars. SetValue (" asw_marine_burn_time_hard" , RandomHQNormalDistribution (45 , 5 ));
2254+ Convars. SetValue (" asw_marine_burn_time_insane" , RandomHQNormalDistribution (45 , 5 ));
2255+ Convars. SetValue (" asw_blink_charge_time" , RandomHQNormalDistribution (100 , 25 ));
22672256 Convars. SetValue (" asw_minigun_spin_down_rate" , 100 );
22682257 Convars. SetValue (" asw_minigun_spin_rate_threshold" , 1 );
22692258 Convars. SetValue (" asw_minigun_spin_up_rate" , 50 );
@@ -2272,20 +2261,20 @@ function SetConVars(interval = 1) {
22722261 Convars. SetValue (" rd_techreq" , 0 );
22732262 Convars. SetValue (" rd_hackall" , 1 );
22742263 Convars. SetValue (" rd_biomass_ignite_from_explosions" , 1 );
2275- Convars. SetValue (" rd_spawn_medkits" , RandFloatNormalDistribution (61 , 2 ). tointeger ());
2276- Convars. SetValue (" asw_fist_passive_damage_scale" , RandFloatNormalDistribution (4500 , 500 ));
2264+ Convars. SetValue (" rd_spawn_medkits" , RandomHQNormalDistribution (61 , 2 ). tointeger ());
2265+ Convars. SetValue (" asw_fist_passive_damage_scale" , RandomHQNormalDistribution (4500 , 500 ));
22772266 Convars. SetValue (" rd_stuck_bot_teleport" , 1 );
2278- Convars. SetValue (" rd_damage_buff_scale" , RandFloatNormalDistribution (1.2 , 0.02 ));
2267+ Convars. SetValue (" rd_damage_buff_scale" , RandomHQNormalDistribution (1.2 , 0.02 ));
22792268
2280- Convars. SetValue (" asw_cluster_grenade_fuse" , RandFloatNormalDistribution (4 , 0.7 ));
2281- local child_fuse_max = RandFloatNormalDistribution (2.4 , 0.3 );
2282- local child_fuse_min = child_fuse_max / RandFloatUniformDistribution (1.5 , 3.0 );
2269+ Convars. SetValue (" asw_cluster_grenade_fuse" , RandomHQNormalDistribution (4 , 0.7 ));
2270+ local child_fuse_max = RandomHQNormalDistribution (2.4 , 0.3 );
2271+ local child_fuse_min = child_fuse_max / RandomHQUniformFloatDistribution (1.5 , 3.0 );
22832272 Convars. SetValue (" asw_cluster_grenade_child_fuse_max" , child_fuse_max);
22842273 Convars. SetValue (" asw_cluster_grenade_child_fuse_min" , child_fuse_min);
2285- Convars. SetValue (" asw_cluster_grenade_radius_check_scale" , RandFloatNormalDistribution (0.55 , 0.017 ));
2274+ Convars. SetValue (" asw_cluster_grenade_radius_check_scale" , RandomHQNormalDistribution (0.55 , 0.017 ));
22862275
2287- Convars. SetValue (" rd_marine_passive_armor_layers_amount" , RandFloatNormalDistribution (14 , 1.5 ). tointeger ());
2288- Convars. SetValue (" rd_marine_passive_armor_layer_protection_value" , RandFloatNormalDistribution (0.04 , 0.0005 ));
2276+ Convars. SetValue (" rd_marine_passive_armor_layers_amount" , RandomHQNormalDistribution (14 , 1.5 ). tointeger ());
2277+ Convars. SetValue (" rd_marine_passive_armor_layer_protection_value" , RandomHQNormalDistribution (0.04 , 0.0005 ));
22892278
22902279 Convars. SetValue (" asw_sentry_friendly_fire_scale" , 0.2 );
22912280 Convars. SetValue (" asw_sentry_friendly_target" , g_enum_CurrentMap == MAP. RED_6 ? 0 : 1 );
@@ -2295,15 +2284,15 @@ function SetConVars(interval = 1) {
22952284 // Convars.SetValue("autoaim_max_dist", 0);
22962285
22972286 Convars. SetValue (" asw_ammo_count_sniper_rifle" , 1 );
2298- Convars. SetValue (" asw_skill_accuracy_sniper_rifle_dmg_step" , RandFloatNormalDistribution (5 , 1 ). tointeger ());
2299- Convars. SetValue (" rd_sniper_dmg_base" , RandFloatUniformDistribution (100 , 150 ));
2300- Convars. SetValue (" rd_sniper_rifle_dmg_zoomed_bonus" , RandFloatUniformDistribution (500 , 700 ));
2287+ Convars. SetValue (" asw_skill_accuracy_sniper_rifle_dmg_step" , RandomHQNormalDistribution (5 , 1 ). tointeger ());
2288+ Convars. SetValue (" rd_sniper_dmg_base" , RandomHQUniformFloatDistribution (100 , 150 ));
2289+ Convars. SetValue (" rd_sniper_rifle_dmg_zoomed_bonus" , RandomHQUniformFloatDistribution (500 , 700 ));
23012290
2302- Convars. SetValue (" asw_ammo_count_devastator" , RandIntUniformDistribution (10 , 25 ));
2291+ Convars. SetValue (" asw_ammo_count_devastator" , RandomHQUniformIntDistribution (10 , 25 ));
23032292
2304- Convars. SetValue (" rd_railgun_dmg_base" , RandIntUniformDistribution (100 , 250 ));
2293+ Convars. SetValue (" rd_railgun_dmg_base" , RandomHQUniformIntDistribution (100 , 250 ));
23052294
2306- Convars. SetValue (" rd_pistols_min_delay" , RandFloatUniformDistribution (0.116 , 0.126 ));
2295+ Convars. SetValue (" rd_pistols_min_delay" , RandomHQUniformFloatDistribution (0.116 , 0.126 ));
23072296
23082297 local hPlayer = null ;
23092298 local playerCount = 0 ;
0 commit comments