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

◆ AI_169_Smolstars()

void Terraria.Projectile.AI_169_Smolstars ( )
inlineprivate

Definition at line 48269 of file Projectile.cs.

48270 {
48271 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
48272 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
48273 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
48274 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
48275 //IL_0119: Unknown result type (might be due to invalid IL or missing references)
48276 //IL_011b: Unknown result type (might be due to invalid IL or missing references)
48277 //IL_0120: Unknown result type (might be due to invalid IL or missing references)
48278 //IL_0125: Unknown result type (might be due to invalid IL or missing references)
48279 //IL_016a: Unknown result type (might be due to invalid IL or missing references)
48280 //IL_016c: Unknown result type (might be due to invalid IL or missing references)
48281 //IL_0163: Unknown result type (might be due to invalid IL or missing references)
48282 //IL_0397: Unknown result type (might be due to invalid IL or missing references)
48283 //IL_03a1: Unknown result type (might be due to invalid IL or missing references)
48284 //IL_03a6: Unknown result type (might be due to invalid IL or missing references)
48285 //IL_0182: Unknown result type (might be due to invalid IL or missing references)
48286 //IL_0195: Unknown result type (might be due to invalid IL or missing references)
48287 //IL_019a: Unknown result type (might be due to invalid IL or missing references)
48288 //IL_0095: Unknown result type (might be due to invalid IL or missing references)
48289 //IL_009f: Unknown result type (might be due to invalid IL or missing references)
48290 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
48291 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
48292 //IL_00b0: Unknown result type (might be due to invalid IL or missing references)
48293 //IL_00d0: Unknown result type (might be due to invalid IL or missing references)
48294 //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
48295 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
48296 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
48297 //IL_00df: Unknown result type (might be due to invalid IL or missing references)
48298 //IL_00e0: Unknown result type (might be due to invalid IL or missing references)
48299 //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
48300 //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
48301 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
48302 //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
48303 //IL_0100: Unknown result type (might be due to invalid IL or missing references)
48304 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
48305 //IL_0106: Unknown result type (might be due to invalid IL or missing references)
48306 //IL_0431: Unknown result type (might be due to invalid IL or missing references)
48307 //IL_01da: Unknown result type (might be due to invalid IL or missing references)
48308 //IL_01df: Unknown result type (might be due to invalid IL or missing references)
48309 //IL_01e4: Unknown result type (might be due to invalid IL or missing references)
48310 //IL_0469: Unknown result type (might be due to invalid IL or missing references)
48311 //IL_046f: Unknown result type (might be due to invalid IL or missing references)
48312 //IL_0474: Unknown result type (might be due to invalid IL or missing references)
48313 //IL_0479: Unknown result type (might be due to invalid IL or missing references)
48314 //IL_0483: Unknown result type (might be due to invalid IL or missing references)
48315 //IL_0485: Unknown result type (might be due to invalid IL or missing references)
48316 //IL_0286: Unknown result type (might be due to invalid IL or missing references)
48317 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
48318 //IL_02c4: Unknown result type (might be due to invalid IL or missing references)
48319 //IL_032d: Unknown result type (might be due to invalid IL or missing references)
48320 //IL_0341: Unknown result type (might be due to invalid IL or missing references)
48321 //IL_0346: Unknown result type (might be due to invalid IL or missing references)
48322 //IL_034b: Unknown result type (might be due to invalid IL or missing references)
48323 //IL_0204: Unknown result type (might be due to invalid IL or missing references)
48324 //IL_04b9: Unknown result type (might be due to invalid IL or missing references)
48325 //IL_04be: Unknown result type (might be due to invalid IL or missing references)
48326 //IL_04c3: Unknown result type (might be due to invalid IL or missing references)
48327 //IL_049b: Unknown result type (might be due to invalid IL or missing references)
48328 //IL_04ae: Unknown result type (might be due to invalid IL or missing references)
48329 //IL_04b3: Unknown result type (might be due to invalid IL or missing references)
48330 //IL_02f5: Unknown result type (might be due to invalid IL or missing references)
48331 //IL_02ff: Unknown result type (might be due to invalid IL or missing references)
48332 //IL_0304: Unknown result type (might be due to invalid IL or missing references)
48333 Player player = Main.player[owner];
48334 bool num9 = type == 864;
48335 Vector2 vector = player.Top + new Vector2(0f, -30f);
48336 if (num9)
48337 {
48338 if (player.dead)
48339 {
48340 player.smolstar = false;
48341 }
48342 if (player.smolstar)
48343 {
48344 timeLeft = 2;
48345 }
48346 if (ai[0] == 0f)
48347 {
48349 float num2 = (float)Math.PI * 2f / (float)totalIndexesInGroup;
48350 float num3 = (float)totalIndexesInGroup * 0.66f;
48351 Vector2 vector2 = new Vector2(30f, 6f) / 5f * (float)(totalIndexesInGroup - 1);
48352 Vector2 vector3 = Vector2.UnitY.RotatedBy(num2 * (float)index + Main.GlobalTimeWrappedHourly % num3 / num3 * ((float)Math.PI * 2f));
48353 vector += vector3 * vector2;
48354 vector.Y += player.gfxOffY;
48355 vector = vector.Floor();
48356 }
48357 }
48358 if (ai[0] == 0f)
48359 {
48360 Vector2 vector4 = vector - base.Center;
48361 float num4 = 10f;
48362 float lerpValue = Utils.GetLerpValue(200f, 600f, ((Vector2)(ref vector4)).Length(), clamped: true);
48363 num4 += lerpValue * 30f;
48364 if (((Vector2)(ref vector4)).Length() >= 3000f)
48365 {
48366 base.Center = vector;
48367 }
48368 velocity = vector4;
48369 if (((Vector2)(ref velocity)).Length() > num4)
48370 {
48371 velocity *= num4 / ((Vector2)(ref velocity)).Length();
48372 }
48373 int startAttackRange = 800;
48374 int attackTarget = -1;
48376 if (attackTarget != -1)
48377 {
48378 ai[0] = 60f;
48379 ai[1] = attackTarget;
48380 netUpdate = true;
48381 }
48382 float targetAngle = velocity.SafeNormalize(Vector2.UnitY).ToRotation() + (float)Math.PI / 2f;
48383 if (((Vector2)(ref vector4)).Length() < 40f)
48384 {
48385 targetAngle = Vector2.UnitY.ToRotation() + (float)Math.PI / 2f;
48386 }
48387 rotation = rotation.AngleLerp(targetAngle, 0.2f);
48388 return;
48389 }
48390 if (ai[0] == -1f)
48391 {
48392 if (ai[1] == 0f)
48393 {
48394 SoundEngine.PlaySound(0, (int)position.X, (int)position.Y);
48395 for (int i = 0; i < 2; i++)
48396 {
48397 Dust dust = Dust.NewDustDirect(position, width, height, 15, oldVelocity.X * 0.2f, oldVelocity.Y * 0.2f, 0, default(Color), 1.4f);
48398 if (Main.rand.Next(3) != 0)
48399 {
48400 dust.scale *= 1.3f;
48401 dust.velocity *= 1.1f;
48402 }
48403 dust.noGravity = true;
48404 dust.fadeIn = 0f;
48405 }
48406 velocity += Main.rand.NextVector2CircularEdge(4f, 4f);
48407 }
48408 ai[1] += 1f;
48409 rotation += velocity.X * 0.1f + velocity.Y * 0.05f;
48410 velocity *= 0.92f;
48411 if (ai[1] >= 9f)
48412 {
48413 ai[0] = 0f;
48414 ai[1] = 0f;
48415 }
48416 return;
48417 }
48418 NPC nPC = null;
48419 int num5 = (int)ai[1];
48420 if (Main.npc.IndexInRange(num5) && Main.npc[num5].CanBeChasedBy(this))
48421 {
48422 nPC = Main.npc[num5];
48423 }
48424 if (nPC == null)
48425 {
48426 ai[0] = -1f;
48427 ai[1] = 0f;
48428 netUpdate = true;
48429 }
48430 else if (player.Distance(nPC.Center) >= 900f)
48431 {
48432 ai[0] = 0f;
48433 ai[1] = 0f;
48434 netUpdate = true;
48435 }
48436 else
48437 {
48438 Vector2 vector5 = nPC.Center - base.Center;
48439 float num6 = 16f;
48440 velocity = vector5;
48441 if (((Vector2)(ref velocity)).Length() > num6)
48442 {
48443 velocity *= num6 / ((Vector2)(ref velocity)).Length();
48444 }
48445 float targetAngle2 = velocity.SafeNormalize(Vector2.UnitY).ToRotation() + (float)Math.PI / 2f;
48446 rotation = rotation.AngleLerp(targetAngle2, 0.4f);
48447 }
48448 float num7 = 0.1f;
48449 float num8 = width * 5;
48450 for (int j = 0; j < 1000; j++)
48451 {
48452 if (j != whoAmI && Main.projectile[j].active && Main.projectile[j].owner == owner && Main.projectile[j].type == type && Math.Abs(position.X - Main.projectile[j].position.X) + Math.Abs(position.Y - Main.projectile[j].position.Y) < num8)
48453 {
48454 if (position.X < Main.projectile[j].position.X)
48455 {
48456 velocity.X -= num7;
48457 }
48458 else
48459 {
48460 velocity.X += num7;
48461 }
48462 if (position.Y < Main.projectile[j].position.Y)
48463 {
48464 velocity.Y -= num7;
48465 }
48466 else
48467 {
48468 velocity.Y += num7;
48469 }
48470 }
48471 }
48472 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
Vector2 oldVelocity
Definition Entity.cs:37
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
void Minion_FindTargetInRange(int startAttackRange, ref int attackTarget, bool skipIfCannotHitWithOwnBody, Func< Entity, int, bool > customEliminationCheck=null)
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
void AI_GetMyGroupIndexAndFillBlackList(List< int > blackListedTargets, out int index, out int totalIndexesInGroup)

References Terraria.Player.dead, Terraria.Entity.Distance(), Terraria.Utils.GetLerpValue(), Terraria.Player.gfxOffY, Terraria.Main.GlobalTimeWrappedHourly, Terraria.Dust.NewDustDirect(), Terraria.Main.npc, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.projectile, Terraria.Main.rand, and Terraria.Player.smolstar.

+ Here is the call graph for this function: