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

◆ SpawnStardustMark_StardustTower()

void Terraria.NPC.SpawnStardustMark_StardustTower ( )
inlineprivate

Definition at line 44155 of file NPC.cs.

44156 {
44157 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
44158 //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
44159 //IL_00cc: Unknown result type (might be due to invalid IL or missing references)
44160 //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
44161 //IL_00fb: Unknown result type (might be due to invalid IL or missing references)
44162 //IL_0100: Unknown result type (might be due to invalid IL or missing references)
44163 //IL_0234: Unknown result type (might be due to invalid IL or missing references)
44164 //IL_0239: Unknown result type (might be due to invalid IL or missing references)
44165 //IL_0243: Unknown result type (might be due to invalid IL or missing references)
44166 //IL_0249: Unknown result type (might be due to invalid IL or missing references)
44167 //IL_024b: Unknown result type (might be due to invalid IL or missing references)
44168 //IL_0252: Unknown result type (might be due to invalid IL or missing references)
44169 //IL_0257: Unknown result type (might be due to invalid IL or missing references)
44170 //IL_026d: Unknown result type (might be due to invalid IL or missing references)
44171 //IL_0274: Unknown result type (might be due to invalid IL or missing references)
44172 //IL_027b: Unknown result type (might be due to invalid IL or missing references)
44173 //IL_0282: Unknown result type (might be due to invalid IL or missing references)
44174 //IL_02c7: Unknown result type (might be due to invalid IL or missing references)
44175 //IL_02c9: Unknown result type (might be due to invalid IL or missing references)
44176 //IL_02cb: Unknown result type (might be due to invalid IL or missing references)
44177 //IL_0260: Unknown result type (might be due to invalid IL or missing references)
44178 //IL_0265: Unknown result type (might be due to invalid IL or missing references)
44179 //IL_02ec: Unknown result type (might be due to invalid IL or missing references)
44180 //IL_02ee: Unknown result type (might be due to invalid IL or missing references)
44181 //IL_02f0: Unknown result type (might be due to invalid IL or missing references)
44182 List<int> list = new List<int>();
44183 if (CountNPCS(405) + CountNPCS(406) < 2)
44184 {
44185 list.Add(405);
44186 }
44187 if (CountNPCS(402) < 2)
44188 {
44189 list.Add(402);
44190 }
44191 if (CountNPCS(407) < 1)
44192 {
44193 list.Add(407);
44194 }
44195 if (list.Count > 0)
44196 {
44197 int num = Utils.SelectRandom(Main.rand, list.ToArray());
44198 ai[1] = 30 * Main.rand.Next(5, 16);
44199 int num5 = Main.rand.Next(3, 6);
44200 int num6 = Main.rand.Next(0, 4);
44201 int num7 = 0;
44204 list2.Add(Tuple.Create<Vector2, int, int>(base.Top - Vector2.UnitY * 120f, num5, 0));
44205 int num8 = 0;
44206 int num9 = list2.Count;
44207 while (list2.Count > 0)
44208 {
44209 Vector2 item = list2[0].Item1;
44210 int num10 = 1;
44211 int num11 = 1;
44212 if (num8 > 0 && num6 > 0 && (Main.rand.Next(3) != 0 || num8 == 1))
44213 {
44214 num11 = Main.rand.Next(Math.Max(1, list2[0].Item2));
44215 num10++;
44216 num6--;
44217 }
44218 for (int i = 0; i < num10; i++)
44219 {
44220 int num12 = list2[0].Item3;
44221 if (num8 == 0)
44222 {
44223 num12 = Utils.SelectRandom<int>(Main.rand, -1, 1);
44224 }
44225 else if (i == 1)
44226 {
44227 num12 *= -1;
44228 }
44229 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();
44230 float num3 = 100f + 50f * Main.rand.NextFloat();
44231 int num4 = list2[0].Item2;
44232 if (i != 0)
44233 {
44234 num4 = num11;
44235 }
44236 if (num8 == 0)
44237 {
44238 num2 = (0.5f - Main.rand.NextFloat()) * ((float)Math.PI / 4f);
44239 num3 = 100f + 100f * Main.rand.NextFloat();
44240 }
44241 Vector2 vector = (-Vector2.UnitY).RotatedBy(num2) * num3;
44242 if (num4 - 1 < 0)
44243 {
44244 vector = Vector2.Zero;
44245 }
44246 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);
44247 list3.Add(item + vector);
44248 if (num8 < num5 && list2[0].Item2 > 0)
44249 {
44250 list2.Add(Tuple.Create<Vector2, int, int>(item + vector, num4 - 1, num12));
44251 }
44252 }
44253 list2.Remove(list2[0]);
44254 if (--num9 == 0)
44255 {
44256 num9 = list2.Count;
44257 num8++;
44258 }
44259 }
44260 Main.projectile[num7].localAI[0] = num;
44261 }
44262 else
44263 {
44264 ai[1] = 30f;
44265 }
44266 }
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
float[] ai
An array with 4 slots used for any sort of data storage, which is occasionally synced from the server...
Definition NPC.cs:997
IEntitySource GetSpawnSource_ForProjectile()
Definition NPC.cs:107558

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

Referenced by Terraria.NPC.VanillaAI_Inner().

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