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

◆ AI_144_DD2Pet()

void Terraria.Projectile.AI_144_DD2Pet ( )
inlineprivate

Definition at line 77260 of file Projectile.cs.

77261 {
77262 //IL_0625: Unknown result type (might be due to invalid IL or missing references)
77263 //IL_062a: Unknown result type (might be due to invalid IL or missing references)
77264 //IL_062c: Unknown result type (might be due to invalid IL or missing references)
77265 //IL_0631: Unknown result type (might be due to invalid IL or missing references)
77266 //IL_0634: Unknown result type (might be due to invalid IL or missing references)
77267 //IL_0639: Unknown result type (might be due to invalid IL or missing references)
77268 //IL_065b: Unknown result type (might be due to invalid IL or missing references)
77269 //IL_065e: Unknown result type (might be due to invalid IL or missing references)
77270 //IL_0663: Unknown result type (might be due to invalid IL or missing references)
77271 //IL_0668: Unknown result type (might be due to invalid IL or missing references)
77272 //IL_064a: Unknown result type (might be due to invalid IL or missing references)
77273 //IL_064f: Unknown result type (might be due to invalid IL or missing references)
77274 //IL_0651: Unknown result type (might be due to invalid IL or missing references)
77275 //IL_00eb: Unknown result type (might be due to invalid IL or missing references)
77276 //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
77277 //IL_00ff: Unknown result type (might be due to invalid IL or missing references)
77278 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
77279 //IL_0106: Unknown result type (might be due to invalid IL or missing references)
77280 //IL_0683: Unknown result type (might be due to invalid IL or missing references)
77281 //IL_0685: Unknown result type (might be due to invalid IL or missing references)
77282 //IL_066f: Unknown result type (might be due to invalid IL or missing references)
77283 //IL_0679: Unknown result type (might be due to invalid IL or missing references)
77284 //IL_067e: Unknown result type (might be due to invalid IL or missing references)
77285 //IL_01f7: Unknown result type (might be due to invalid IL or missing references)
77286 //IL_01fc: Unknown result type (might be due to invalid IL or missing references)
77287 //IL_0202: Unknown result type (might be due to invalid IL or missing references)
77288 //IL_0208: Unknown result type (might be due to invalid IL or missing references)
77289 //IL_020e: Unknown result type (might be due to invalid IL or missing references)
77290 //IL_0218: Unknown result type (might be due to invalid IL or missing references)
77291 //IL_021d: Unknown result type (might be due to invalid IL or missing references)
77292 //IL_023a: Unknown result type (might be due to invalid IL or missing references)
77293 //IL_0240: Unknown result type (might be due to invalid IL or missing references)
77294 //IL_025d: Unknown result type (might be due to invalid IL or missing references)
77295 //IL_0263: Unknown result type (might be due to invalid IL or missing references)
77296 //IL_0269: Unknown result type (might be due to invalid IL or missing references)
77297 //IL_0273: Unknown result type (might be due to invalid IL or missing references)
77298 //IL_0278: Unknown result type (might be due to invalid IL or missing references)
77299 //IL_0295: Unknown result type (might be due to invalid IL or missing references)
77300 //IL_029b: Unknown result type (might be due to invalid IL or missing references)
77301 //IL_011a: Unknown result type (might be due to invalid IL or missing references)
77302 //IL_011f: Unknown result type (might be due to invalid IL or missing references)
77303 //IL_0121: Unknown result type (might be due to invalid IL or missing references)
77304 //IL_013b: Unknown result type (might be due to invalid IL or missing references)
77305 //IL_0141: Unknown result type (might be due to invalid IL or missing references)
77306 //IL_04bc: Unknown result type (might be due to invalid IL or missing references)
77307 //IL_04c1: Unknown result type (might be due to invalid IL or missing references)
77308 //IL_04c5: Unknown result type (might be due to invalid IL or missing references)
77309 //IL_04ca: Unknown result type (might be due to invalid IL or missing references)
77310 //IL_04d1: Unknown result type (might be due to invalid IL or missing references)
77311 //IL_04d6: Unknown result type (might be due to invalid IL or missing references)
77312 //IL_04db: Unknown result type (might be due to invalid IL or missing references)
77313 //IL_04e2: Unknown result type (might be due to invalid IL or missing references)
77314 //IL_04e7: Unknown result type (might be due to invalid IL or missing references)
77315 //IL_04ec: Unknown result type (might be due to invalid IL or missing references)
77316 //IL_06ac: Unknown result type (might be due to invalid IL or missing references)
77317 //IL_06b0: Unknown result type (might be due to invalid IL or missing references)
77318 //IL_06b5: Unknown result type (might be due to invalid IL or missing references)
77319 //IL_06a2: Unknown result type (might be due to invalid IL or missing references)
77320 //IL_06a4: Unknown result type (might be due to invalid IL or missing references)
77321 //IL_019b: Unknown result type (might be due to invalid IL or missing references)
77322 //IL_01a5: Unknown result type (might be due to invalid IL or missing references)
77323 //IL_01aa: Unknown result type (might be due to invalid IL or missing references)
77324 //IL_0506: Unknown result type (might be due to invalid IL or missing references)
77325 //IL_050c: Unknown result type (might be due to invalid IL or missing references)
77326 //IL_0511: Unknown result type (might be due to invalid IL or missing references)
77327 //IL_0550: Unknown result type (might be due to invalid IL or missing references)
77328 //IL_0556: Unknown result type (might be due to invalid IL or missing references)
77329 //IL_042b: Unknown result type (might be due to invalid IL or missing references)
77330 //IL_0431: Unknown result type (might be due to invalid IL or missing references)
77331 //IL_0436: Unknown result type (might be due to invalid IL or missing references)
77332 //IL_0475: Unknown result type (might be due to invalid IL or missing references)
77333 //IL_047b: Unknown result type (might be due to invalid IL or missing references)
77334 //IL_0489: Unknown result type (might be due to invalid IL or missing references)
77335 //IL_0493: Unknown result type (might be due to invalid IL or missing references)
77336 //IL_0498: Unknown result type (might be due to invalid IL or missing references)
77337 Player player = Main.player[owner];
77338 float num = 4f;
77339 int num4 = 6;
77340 int num5 = 4;
77341 int num6 = Main.projFrames[type];
77342 int num7 = 0;
77343 float num8 = 0.08f;
77344 bool flag = false;
77345 float num9 = 0.1f;
77346 Vector2 vector = default(Vector2);
77347 ((Vector2)(ref vector))._002Ector((float)(player.direction * 30), -20f);
77348 if (player.dead)
77349 {
77350 Kill();
77351 return;
77352 }
77353 bool flag2 = true;
77354 switch (type)
77355 {
77356 case 702:
77357 {
77358 if (player.petFlagDD2Ghost)
77359 {
77360 timeLeft = 2;
77361 }
77362 vector.Y += (float)Math.Cos(localAI[0] * ((float)Math.PI / 60f)) * 2f;
77363 num5 = 4;
77364 num4 = 10;
77365 flag2 = false;
77366 num = 6f;
77367 Vector2 vector3 = Utils.RotatedBy(new Vector2((float)((spriteDirection == -1) ? (-6) : (-2)), -26f), rotation);
77368 if (Main.rand.Next(24) == 0)
77369 {
77370 Dust dust2 = Dust.NewDustDirect(base.Center + vector3, 4, 4, 135, 0f, 0f, 100);
77371 if (Main.rand.Next(3) != 0)
77372 {
77373 dust2.noGravity = true;
77374 dust2.velocity.Y -= 3f;
77375 dust2.noLight = true;
77376 }
77377 else if (Main.rand.Next(2) != 0)
77378 {
77379 dust2.noLight = true;
77380 }
77381 dust2.velocity *= 0.5f;
77382 dust2.velocity.Y -= 0.9f;
77383 dust2.scale += 0.1f + Main.rand.NextFloat() * 0.6f;
77384 }
77385 DelegateMethods.v3_1 = new Vector3(0.3f, 0.5f, 1f);
77386 Utils.PlotTileLine(base.Center, base.Center + velocity * 6f, 20f, DelegateMethods.CastLightOpen);
77387 Utils.PlotTileLine(base.Left, base.Right, 20f, DelegateMethods.CastLightOpen);
77388 Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 40f, DelegateMethods.CastLightOpen);
77389 Utils.PlotTileLine(player.Left, player.Right, 40f, DelegateMethods.CastLightOpen);
77390 break;
77391 }
77392 case 703:
77393 if (player.petFlagDD2Gato)
77394 {
77395 timeLeft = 2;
77396 }
77397 vector.Y += (float)Math.Cos(localAI[0] * ((float)Math.PI / 30f)) * 2f;
77398 num4 = 4;
77399 num5 = 2;
77400 num = 3f;
77401 num6 = 4;
77402 break;
77403 case 701:
77404 if (player.petFlagDD2Dragon)
77405 {
77406 timeLeft = 2;
77407 }
77408 break;
77409 case 764:
77410 {
77411 num9 = 0.025f;
77412 num8 = 0.04f;
77413 flag = true;
77414 localAI[0] += 1f;
77415 if (localAI[0] > 120f)
77416 {
77417 localAI[0] = 0f;
77418 }
77419 localAI[1] += velocity.X * 0.01f;
77420 localAI[1] += 1f / 120f;
77421 if (localAI[1] < (float)Math.PI * -2f)
77422 {
77423 localAI[1] += (float)Math.PI * 2f;
77424 }
77425 if (localAI[1] > (float)Math.PI * 2f)
77426 {
77427 localAI[1] -= (float)Math.PI * 2f;
77428 }
77429 if (((Vector2)(ref velocity)).Length() < 4f)
77430 {
77431 localAI[1] *= 0.9f;
77432 if (((Vector2)(ref velocity)).Length() > 0.1f && Main.rand.Next(30) == 0)
77433 {
77434 Dust dust3 = Dust.NewDustDirect(position - velocity, width, height, 292, velocity.X * 0.5f, velocity.Y * 0.5f, 150);
77435 dust3.velocity *= 0.3f;
77436 dust3.noLightEmittence = true;
77437 }
77438 }
77439 else
77440 {
77441 Vector2 vector2 = default(Vector2);
77442 ((Vector2)(ref vector2))._002Ector((float)Main.screenWidth, (float)Main.screenHeight);
77443 Rectangle hitbox = base.Hitbox;
77444 ((Rectangle)(ref hitbox)).Intersects(Utils.CenteredRectangle(Main.screenPosition + vector2 / 2f, vector2 + new Vector2(400f)));
77445 if (Main.rand.Next(15) == 0)
77446 {
77447 Dust.NewDustDirect(position - velocity, width, height, 292, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 0.9f).noLightEmittence = true;
77448 }
77449 }
77450 float num10 = localAI[0] / 120f * 2f;
77451 if (num10 > 1f)
77452 {
77453 num10 = 2f - num10;
77454 }
77455 Opacity = MathHelper.Lerp(0.4f, 0.75f, num10);
77456 vector.Y += (float)Math.Cos(localAI[0] / 120f * ((float)Math.PI * 2f)) * 2f;
77457 if (player.petFlagUpbeatStar)
77458 {
77459 timeLeft = 2;
77460 }
77461 break;
77462 }
77463 }
77464 if (flag2 && (player.suspiciouslookingTentacle || player.petFlagDD2Ghost))
77465 {
77466 vector.X += -player.direction * 64;
77467 }
77468 direction = (spriteDirection = player.direction);
77469 Vector2 vector4 = player.MountedCenter + vector;
77470 float num11 = Vector2.Distance(base.Center, vector4);
77471 if (num11 > 1000f)
77472 {
77473 base.Center = player.Center + vector;
77474 }
77475 Vector2 vector5 = vector4 - base.Center;
77476 if (num11 < num)
77477 {
77478 velocity *= 0.25f;
77479 }
77480 if (vector5 != Vector2.Zero)
77481 {
77482 if (((Vector2)(ref vector5)).Length() < num * 0.5f)
77483 {
77484 velocity = vector5;
77485 }
77486 else
77487 {
77488 velocity = vector5 * num9;
77489 }
77490 }
77491 if (((Vector2)(ref velocity)).Length() > 6f)
77492 {
77493 float num2 = velocity.X * num8 + velocity.Y * (float)spriteDirection * 0.02f;
77494 if (Math.Abs(rotation - num2) >= (float)Math.PI)
77495 {
77496 if (num2 < rotation)
77497 {
77498 rotation -= (float)Math.PI * 2f;
77499 }
77500 else
77501 {
77502 rotation += (float)Math.PI * 2f;
77503 }
77504 }
77505 float num3 = 12f;
77506 rotation = (rotation * (num3 - 1f) + num2) / num3;
77507 if (++frameCounter >= num5)
77508 {
77509 frameCounter = 0;
77510 if (++frame >= num6)
77511 {
77512 frame = num7;
77513 }
77514 }
77515 }
77516 else
77517 {
77518 if (rotation > (float)Math.PI)
77519 {
77520 rotation -= (float)Math.PI * 2f;
77521 }
77522 if (rotation > -0.005f && rotation < 0.005f)
77523 {
77524 rotation = 0f;
77525 }
77526 else
77527 {
77528 rotation *= 0.96f;
77529 }
77530 if (++frameCounter >= num4)
77531 {
77532 frameCounter = 0;
77533 if (++frame >= num6)
77534 {
77535 frame = num7;
77536 }
77537 }
77538 }
77539 if (!flag)
77540 {
77541 localAI[0] += 1f;
77542 if (localAI[0] > 120f)
77543 {
77544 localAI[0] = 0f;
77545 }
77546 }
77547 }
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
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[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
int frame
The frame number in the spritesheet that this projectile will be drawn with. Assign in M:Terraria....
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...
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.

References Terraria.DelegateMethods.CastLightOpen(), Terraria.Entity.Center, Terraria.Utils.CenteredRectangle(), Terraria.Player.dead, Terraria.Entity.direction, Terraria.Entity.Left, Terraria.Dust.NewDustDirect(), Terraria.Player.petFlagDD2Dragon, Terraria.Player.petFlagDD2Gato, Terraria.Player.petFlagDD2Ghost, Terraria.Player.petFlagUpbeatStar, Terraria.Main.player, Terraria.Utils.PlotTileLine(), Terraria.Main.projFrames, Terraria.Main.rand, Terraria.Entity.Right, Terraria.Utils.RotatedBy(), Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.screenWidth, Terraria.Player.suspiciouslookingTentacle, and Terraria.Entity.velocity.

+ Here is the call graph for this function: