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

◆ SpawnStardustMark_StardustWorm()

void Terraria.NPC.SpawnStardustMark_StardustWorm ( )
inlineprivate

Definition at line 44268 of file NPC.cs.

44269 {
44270 //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
44271 //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
44272 //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
44273 //IL_0205: Unknown result type (might be due to invalid IL or missing references)
44274 //IL_020a: Unknown result type (might be due to invalid IL or missing references)
44275 //IL_0214: Unknown result type (might be due to invalid IL or missing references)
44276 //IL_021a: Unknown result type (might be due to invalid IL or missing references)
44277 //IL_021c: Unknown result type (might be due to invalid IL or missing references)
44278 //IL_0223: Unknown result type (might be due to invalid IL or missing references)
44279 //IL_0228: Unknown result type (might be due to invalid IL or missing references)
44280 //IL_023e: Unknown result type (might be due to invalid IL or missing references)
44281 //IL_0245: Unknown result type (might be due to invalid IL or missing references)
44282 //IL_024c: Unknown result type (might be due to invalid IL or missing references)
44283 //IL_0253: Unknown result type (might be due to invalid IL or missing references)
44284 //IL_0298: Unknown result type (might be due to invalid IL or missing references)
44285 //IL_029a: Unknown result type (might be due to invalid IL or missing references)
44286 //IL_029c: Unknown result type (might be due to invalid IL or missing references)
44287 //IL_0231: Unknown result type (might be due to invalid IL or missing references)
44288 //IL_0236: Unknown result type (might be due to invalid IL or missing references)
44289 //IL_02bd: Unknown result type (might be due to invalid IL or missing references)
44290 //IL_02bf: Unknown result type (might be due to invalid IL or missing references)
44291 //IL_02c1: Unknown result type (might be due to invalid IL or missing references)
44292 List<int> list = new List<int>();
44293 if (CountNPCS(405) + CountNPCS(406) < 2)
44294 {
44295 list.Add(405);
44296 }
44297 if (CountNPCS(402) < 3)
44298 {
44299 list.Add(402);
44300 }
44301 if (CountNPCS(407) < 1)
44302 {
44303 list.Add(407);
44304 }
44305 if (list.Count <= 0)
44306 {
44307 return;
44308 }
44309 int num = Utils.SelectRandom(Main.rand, list.ToArray());
44310 int num5 = Main.rand.Next(3, 6);
44311 int num6 = Main.rand.Next(0, 4);
44312 int num7 = 0;
44315 list2.Add(Tuple.Create<Vector2, int, int>(base.Center, num5, 0));
44316 int num8 = 0;
44317 int num9 = list2.Count;
44318 while (list2.Count > 0)
44319 {
44320 Vector2 item = list2[0].Item1;
44321 int num10 = 1;
44322 int num11 = 1;
44323 if (num8 > 0 && num6 > 0 && (Main.rand.Next(3) != 0 || num8 == 1))
44324 {
44325 num11 = Main.rand.Next(Math.Max(1, list2[0].Item2));
44326 num10++;
44327 num6--;
44328 }
44329 for (int i = 0; i < num10; i++)
44330 {
44331 int num12 = list2[0].Item3;
44332 if (num8 == 0)
44333 {
44334 num12 = Utils.SelectRandom<int>(Main.rand, -1, 1);
44335 }
44336 else if (i == 1)
44337 {
44338 num12 *= -1;
44339 }
44340 float num2 = ((num8 % 2 == 0) ? 0f : ((float)Math.PI)) + (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f) + (float)num12 * ((float)Math.PI / 4f) * (float)(num8 % 2 == 0).ToDirectionInt();
44341 float num3 = 100f + 50f * Main.rand.NextFloat();
44342 int num4 = list2[0].Item2;
44343 if (i != 0)
44344 {
44345 num4 = num11;
44346 }
44347 if (num8 == 0)
44348 {
44349 num2 = (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f);
44350 num3 = 100f + 100f * Main.rand.NextFloat();
44351 }
44352 Vector2 vector = (-Vector2.UnitY).RotatedBy(num2) * num3;
44353 if (num4 - 1 < 0)
44354 {
44355 vector = Vector2.Zero;
44356 }
44357 num7 = Projectile.NewProjectile(GetSpawnSource_ForProjectile(), item.X, item.Y, vector.X, vector.Y, 540, 0, 0f, Main.myPlayer, (float)(-num8) * 10f, 0.5f + Main.rand.NextFloat() * 0.5f);
44358 list3.Add(item + vector);
44359 if (num8 < num5 && list2[0].Item2 > 0)
44360 {
44361 list2.Add(Tuple.Create<Vector2, int, int>(item + vector, num4 - 1, num12));
44362 }
44363 }
44364 list2.Remove(list2[0]);
44365 if (--num9 == 0)
44366 {
44367 num9 = list2.Count;
44368 num8++;
44369 }
44370 }
44371 Main.projectile[num7].localAI[0] = num;
44372 }
static int CountNPCS(int Type)
Returns the number of active NPC in the world of the given NPC type (F:Terraria.NPC....
Definition NPC.cs:106585
IEntitySource GetSpawnSource_ForProjectile()
Definition NPC.cs:107558

References Terraria.NPC.CountNPCS(), Terraria.NPC.GetSpawnSource_ForProjectile(), Terraria.Main.myPlayer, Terraria.Projectile.NewProjectile(), Terraria.Main.projectile, and Terraria.Main.rand.

Referenced by Terraria.NPC.AI_006_Worms().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: