Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Difficulty_2_SpawnMonsterFromGate()

static void Terraria.GameContent.Events.DD2Event.Difficulty_2_SpawnMonsterFromGate ( Vector2 gateBottom)
inlinestaticprivate

Definition at line 1208 of file DD2Event.cs.

1209 {
1210 int x = (int)gateBottom.X;
1211 int y = (int)gateBottom.Y;
1212 int num = 50;
1213 int num2 = 5;
1214 if (NPC.waveNumber > 1)
1215 {
1216 num2 = 8;
1217 }
1218 if (NPC.waveNumber > 3)
1219 {
1220 num2 = 10;
1221 }
1222 if (NPC.waveNumber > 5)
1223 {
1224 num2 = 12;
1225 }
1226 int num3 = 5;
1227 if (NPC.waveNumber > 4)
1228 {
1229 num3 = 7;
1230 }
1231 int num4 = 2;
1232 int num5 = 8;
1233 if (NPC.waveNumber > 3)
1234 {
1235 num5 = 12;
1236 }
1237 int num6 = 3;
1238 if (NPC.waveNumber > 5)
1239 {
1240 num6 = 5;
1241 }
1242 for (int i = 1; i < Main.CurrentFrameFlags.ActivePlayersCount; i++)
1243 {
1244 num = (int)((double)num * 1.3);
1245 num2 = (int)((double)num2 * 1.3);
1246 num5 = (int)((double)num * 1.3);
1247 num6 = (int)((double)num * 1.35);
1248 }
1249 int num7 = 200;
1250 int num8 = 200;
1251 switch (NPC.waveNumber)
1252 {
1253 case 1:
1254 if (Main.rand.Next(20) == 0 && NPC.CountNPCS(562) < num2)
1255 {
1256 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 562);
1257 }
1258 else if (NPC.CountNPCS(553) < num)
1259 {
1260 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1261 }
1262 break;
1263 case 2:
1264 if (Main.rand.Next(3) == 0 && NPC.CountNPCS(572) < num5)
1265 {
1266 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 572);
1267 }
1268 else if (Main.rand.Next(8) == 0 && NPC.CountNPCS(562) < num2)
1269 {
1270 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 562);
1271 }
1272 else if (NPC.CountNPCS(553) < num)
1273 {
1274 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1275 }
1276 break;
1277 case 3:
1278 if (Main.rand.Next(7) == 0 && NPC.CountNPCS(572) < num5)
1279 {
1280 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 572);
1281 }
1282 else if (Main.rand.Next(10) == 0 && NPC.CountNPCS(559) < num3)
1283 {
1284 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 559);
1285 }
1286 else if (Main.rand.Next(8) == 0 && NPC.CountNPCS(562) < num2)
1287 {
1288 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 562);
1289 }
1290 else if (NPC.CountNPCS(553) + NPC.CountNPCS(556) < num)
1291 {
1292 if (Main.rand.Next(4) == 0)
1293 {
1294 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 556);
1295 }
1296 num8 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1297 }
1298 break;
1299 case 4:
1300 if (Main.rand.Next(10) == 0 && NPC.CountNPCS(570) < num6)
1301 {
1302 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 570);
1303 }
1304 else if (Main.rand.Next(12) == 0 && NPC.CountNPCS(559) < num3)
1305 {
1306 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 559);
1307 }
1308 else if (Main.rand.Next(6) == 0 && NPC.CountNPCS(562) < num2)
1309 {
1310 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 562);
1311 }
1312 else if (Main.rand.Next(3) == 0 && NPC.CountNPCS(572) < num5)
1313 {
1314 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 572);
1315 }
1316 else if (NPC.CountNPCS(553) < num)
1317 {
1318 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1319 }
1320 break;
1321 case 5:
1322 if (Main.rand.Next(7) == 0 && NPC.CountNPCS(570) < num6)
1323 {
1324 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 570);
1325 }
1326 else if (Main.rand.Next(10) == 0 && NPC.CountNPCS(559) < num3)
1327 {
1328 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 559);
1329 }
1330 else if (Main.rand.Next(4) == 0 && NPC.CountNPCS(572) + NPC.CountNPCS(574) < num5)
1331 {
1332 num7 = ((Main.rand.Next(2) != 0) ? NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 574) : NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 572));
1333 }
1334 else if (NPC.CountNPCS(553) + NPC.CountNPCS(556) < num)
1335 {
1336 if (Main.rand.Next(3) == 0)
1337 {
1338 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 556);
1339 }
1340 num8 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1341 }
1342 break;
1343 case 6:
1344 if (Main.rand.Next(7) == 0 && NPC.CountNPCS(570) < num6)
1345 {
1346 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 570);
1347 }
1348 else if (Main.rand.Next(17) == 0 && NPC.CountNPCS(568) < num4)
1349 {
1350 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 568);
1351 }
1352 else if (Main.rand.Next(5) == 0 && NPC.CountNPCS(572) + NPC.CountNPCS(574) < num5)
1353 {
1354 num7 = ((Main.rand.Next(2) == 0) ? NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 574) : NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 572));
1355 }
1356 else if (Main.rand.Next(9) == 0 && NPC.CountNPCS(559) < num3)
1357 {
1358 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 559);
1359 }
1360 else if (Main.rand.Next(3) == 0 && NPC.CountNPCS(562) < num2)
1361 {
1362 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 562);
1363 }
1364 else if (NPC.CountNPCS(553) + NPC.CountNPCS(556) < num)
1365 {
1366 if (Main.rand.Next(3) != 0)
1367 {
1368 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 556);
1369 }
1370 num8 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1371 }
1372 break;
1373 case 7:
1374 {
1376 if ((float)currentKillCount > (float)requiredKillCount * 0.1f && !NPC.AnyNPCs(576))
1377 {
1378 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 576);
1379 }
1380 else if (Main.rand.Next(7) == 0 && NPC.CountNPCS(570) < num6)
1381 {
1382 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 570);
1383 }
1384 else if (Main.rand.Next(17) == 0 && NPC.CountNPCS(568) < num4)
1385 {
1386 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 568);
1387 }
1388 else if (Main.rand.Next(7) == 0 && NPC.CountNPCS(572) + NPC.CountNPCS(574) < num5)
1389 {
1390 num7 = ((Main.rand.Next(3) == 0) ? NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 574) : NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 572));
1391 }
1392 else if (Main.rand.Next(11) == 0 && NPC.CountNPCS(559) < num3)
1393 {
1394 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 559);
1395 }
1396 else if (NPC.CountNPCS(553) + NPC.CountNPCS(556) < num)
1397 {
1398 if (Main.rand.Next(2) == 0)
1399 {
1400 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 556);
1401 }
1402 num8 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1403 }
1404 break;
1405 }
1406 default:
1407 num7 = NPC.NewNPC(GetSpawnSource_OldOnesArmy(), x, y, 553);
1408 break;
1409 }
1410 if (Main.netMode == 2 && num7 < 200)
1411 {
1412 NetMessage.SendData(23, -1, -1, null, num7);
1413 }
1414 if (Main.netMode == 2 && num8 < 200)
1415 {
1416 NetMessage.SendData(23, -1, -1, null, num8);
1417 }
1418 }
static void GetInvasionStatus(out int currentWave, out int requiredKillCount, out int currentKillCount, bool currentlyInCheckProgress=false)
Definition DD2Event.cs:485
static IEntitySource GetSpawnSource_OldOnesArmy()
Definition DD2Event.cs:1786

References Terraria.Main.CurrentFrameFlags.ActivePlayersCount, Terraria.NPC.AnyNPCs(), Terraria.NPC.CountNPCS(), Terraria.GameContent.Events.DD2Event.GetInvasionStatus(), Terraria.GameContent.Events.DD2Event.GetSpawnSource_OldOnesArmy(), Terraria.Main.netMode, Terraria.NPC.NewNPC(), Terraria.Main.rand, Terraria.NetMessage.SendData(), and Terraria.NPC.waveNumber.

Referenced by Terraria.GameContent.Events.DD2Event.SpawnMonsterFromGate().