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

◆ AI_019_Spears()

void Terraria.Projectile.AI_019_Spears ( )
inlineprivate

Definition at line 48474 of file Projectile.cs.

48475 {
48476 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
48477 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
48478 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
48479 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
48480 //IL_039c: Unknown result type (might be due to invalid IL or missing references)
48481 //IL_03a2: Unknown result type (might be due to invalid IL or missing references)
48482 //IL_03a9: Unknown result type (might be due to invalid IL or missing references)
48483 //IL_03ae: Unknown result type (might be due to invalid IL or missing references)
48484 //IL_03b3: Unknown result type (might be due to invalid IL or missing references)
48485 //IL_043b: Unknown result type (might be due to invalid IL or missing references)
48486 //IL_0472: Unknown result type (might be due to invalid IL or missing references)
48487 //IL_0478: Unknown result type (might be due to invalid IL or missing references)
48488 //IL_048f: Unknown result type (might be due to invalid IL or missing references)
48489 //IL_0499: Unknown result type (might be due to invalid IL or missing references)
48490 //IL_049e: Unknown result type (might be due to invalid IL or missing references)
48491 //IL_0753: Unknown result type (might be due to invalid IL or missing references)
48492 //IL_075e: Unknown result type (might be due to invalid IL or missing references)
48493 //IL_0525: Unknown result type (might be due to invalid IL or missing references)
48494 //IL_0530: Unknown result type (might be due to invalid IL or missing references)
48495 //IL_0848: Unknown result type (might be due to invalid IL or missing references)
48496 //IL_084d: Unknown result type (might be due to invalid IL or missing references)
48497 //IL_0859: Unknown result type (might be due to invalid IL or missing references)
48498 //IL_085e: Unknown result type (might be due to invalid IL or missing references)
48499 //IL_0864: Unknown result type (might be due to invalid IL or missing references)
48500 //IL_0869: Unknown result type (might be due to invalid IL or missing references)
48501 //IL_0875: Unknown result type (might be due to invalid IL or missing references)
48502 //IL_087a: Unknown result type (might be due to invalid IL or missing references)
48503 //IL_067b: Unknown result type (might be due to invalid IL or missing references)
48504 //IL_068d: Unknown result type (might be due to invalid IL or missing references)
48505 //IL_05c7: Unknown result type (might be due to invalid IL or missing references)
48506 //IL_05d1: Unknown result type (might be due to invalid IL or missing references)
48507 //IL_05d6: Unknown result type (might be due to invalid IL or missing references)
48508 //IL_05df: Unknown result type (might be due to invalid IL or missing references)
48509 //IL_05ea: Unknown result type (might be due to invalid IL or missing references)
48510 //IL_05f4: Unknown result type (might be due to invalid IL or missing references)
48511 //IL_05fb: Unknown result type (might be due to invalid IL or missing references)
48512 //IL_06af: Unknown result type (might be due to invalid IL or missing references)
48513 //IL_06ba: Unknown result type (might be due to invalid IL or missing references)
48514 //IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
48515 //IL_0ad2: Unknown result type (might be due to invalid IL or missing references)
48516 //IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
48517 //IL_0afd: Unknown result type (might be due to invalid IL or missing references)
48518 //IL_0b07: Unknown result type (might be due to invalid IL or missing references)
48519 //IL_0b0c: Unknown result type (might be due to invalid IL or missing references)
48520 //IL_0b12: Unknown result type (might be due to invalid IL or missing references)
48521 //IL_0b18: Unknown result type (might be due to invalid IL or missing references)
48522 //IL_0b22: Unknown result type (might be due to invalid IL or missing references)
48523 //IL_0b27: Unknown result type (might be due to invalid IL or missing references)
48524 //IL_0b4b: Unknown result type (might be due to invalid IL or missing references)
48525 //IL_0b51: Unknown result type (might be due to invalid IL or missing references)
48526 //IL_0b68: Unknown result type (might be due to invalid IL or missing references)
48527 //IL_0b72: Unknown result type (might be due to invalid IL or missing references)
48528 //IL_0b77: Unknown result type (might be due to invalid IL or missing references)
48529 //IL_0a57: Unknown result type (might be due to invalid IL or missing references)
48530 //IL_0a7b: Unknown result type (might be due to invalid IL or missing references)
48531 //IL_0a81: Unknown result type (might be due to invalid IL or missing references)
48532 //IL_0b9a: Unknown result type (might be due to invalid IL or missing references)
48533 //IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
48534 //IL_0bc7: Unknown result type (might be due to invalid IL or missing references)
48535 //IL_0bdb: Unknown result type (might be due to invalid IL or missing references)
48536 //IL_0be5: Unknown result type (might be due to invalid IL or missing references)
48537 //IL_0bea: Unknown result type (might be due to invalid IL or missing references)
48538 //IL_0da8: Unknown result type (might be due to invalid IL or missing references)
48539 //IL_0dae: Unknown result type (might be due to invalid IL or missing references)
48540 //IL_0db8: Unknown result type (might be due to invalid IL or missing references)
48541 //IL_0dbd: Unknown result type (might be due to invalid IL or missing references)
48542 //IL_0df9: Unknown result type (might be due to invalid IL or missing references)
48543 //IL_0dff: Unknown result type (might be due to invalid IL or missing references)
48544 //IL_0e36: Unknown result type (might be due to invalid IL or missing references)
48545 //IL_0e40: Unknown result type (might be due to invalid IL or missing references)
48546 //IL_0e45: Unknown result type (might be due to invalid IL or missing references)
48547 //IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
48548 //IL_0cab: Unknown result type (might be due to invalid IL or missing references)
48549 //IL_0cb1: Unknown result type (might be due to invalid IL or missing references)
48550 //IL_0cc8: Unknown result type (might be due to invalid IL or missing references)
48551 //IL_0cce: Unknown result type (might be due to invalid IL or missing references)
48552 //IL_0cd8: Unknown result type (might be due to invalid IL or missing references)
48553 //IL_0cdd: Unknown result type (might be due to invalid IL or missing references)
48554 //IL_0ce2: Unknown result type (might be due to invalid IL or missing references)
48555 //IL_0cf0: Unknown result type (might be due to invalid IL or missing references)
48556 //IL_0cfa: Unknown result type (might be due to invalid IL or missing references)
48557 //IL_0cff: Unknown result type (might be due to invalid IL or missing references)
48558 //IL_0c00: Unknown result type (might be due to invalid IL or missing references)
48559 //IL_0c27: Unknown result type (might be due to invalid IL or missing references)
48560 //IL_0c2d: Unknown result type (might be due to invalid IL or missing references)
48561 //IL_0e5b: Unknown result type (might be due to invalid IL or missing references)
48562 //IL_0d15: Unknown result type (might be due to invalid IL or missing references)
48563 //IL_0d39: Unknown result type (might be due to invalid IL or missing references)
48564 //IL_0d3f: Unknown result type (might be due to invalid IL or missing references)
48565 //IL_0d56: Unknown result type (might be due to invalid IL or missing references)
48566 //IL_0d5c: Unknown result type (might be due to invalid IL or missing references)
48567 //IL_0d66: Unknown result type (might be due to invalid IL or missing references)
48568 //IL_0d6b: Unknown result type (might be due to invalid IL or missing references)
48569 //IL_0d70: Unknown result type (might be due to invalid IL or missing references)
48570 //IL_0d7e: Unknown result type (might be due to invalid IL or missing references)
48571 //IL_0d88: Unknown result type (might be due to invalid IL or missing references)
48572 //IL_0d8d: Unknown result type (might be due to invalid IL or missing references)
48573 //IL_08f7: Unknown result type (might be due to invalid IL or missing references)
48574 //IL_0902: Unknown result type (might be due to invalid IL or missing references)
48575 //IL_0907: Unknown result type (might be due to invalid IL or missing references)
48576 //IL_0927: Unknown result type (might be due to invalid IL or missing references)
48577 //IL_092d: Unknown result type (might be due to invalid IL or missing references)
48578 //IL_0e86: Unknown result type (might be due to invalid IL or missing references)
48579 //IL_0e8c: Unknown result type (might be due to invalid IL or missing references)
48580 //IL_0e96: Unknown result type (might be due to invalid IL or missing references)
48581 //IL_0e9b: Unknown result type (might be due to invalid IL or missing references)
48582 //IL_0ea6: Unknown result type (might be due to invalid IL or missing references)
48583 //IL_0eab: Unknown result type (might be due to invalid IL or missing references)
48584 //IL_0ef1: Unknown result type (might be due to invalid IL or missing references)
48585 //IL_0ef7: Unknown result type (might be due to invalid IL or missing references)
48586 //IL_0f0e: Unknown result type (might be due to invalid IL or missing references)
48587 //IL_0f18: Unknown result type (might be due to invalid IL or missing references)
48588 //IL_0f1d: Unknown result type (might be due to invalid IL or missing references)
48589 //IL_0f2b: Unknown result type (might be due to invalid IL or missing references)
48590 //IL_0f31: Unknown result type (might be due to invalid IL or missing references)
48591 //IL_0f3b: Unknown result type (might be due to invalid IL or missing references)
48592 //IL_0f40: Unknown result type (might be due to invalid IL or missing references)
48593 //IL_0f45: Unknown result type (might be due to invalid IL or missing references)
48594 //IL_094c: Unknown result type (might be due to invalid IL or missing references)
48595 //IL_0957: Unknown result type (might be due to invalid IL or missing references)
48596 //IL_095c: Unknown result type (might be due to invalid IL or missing references)
48597 //IL_099b: Unknown result type (might be due to invalid IL or missing references)
48598 //IL_09a1: Unknown result type (might be due to invalid IL or missing references)
48599 //IL_09c6: Unknown result type (might be due to invalid IL or missing references)
48600 //IL_09d0: Unknown result type (might be due to invalid IL or missing references)
48601 //IL_09d5: Unknown result type (might be due to invalid IL or missing references)
48602 //IL_09db: Unknown result type (might be due to invalid IL or missing references)
48603 //IL_09e6: Unknown result type (might be due to invalid IL or missing references)
48604 //IL_09eb: Unknown result type (might be due to invalid IL or missing references)
48605 //IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
48606 //IL_0a11: Unknown result type (might be due to invalid IL or missing references)
48607 //IL_0a28: Unknown result type (might be due to invalid IL or missing references)
48608 //IL_0a32: Unknown result type (might be due to invalid IL or missing references)
48609 //IL_0a37: Unknown result type (might be due to invalid IL or missing references)
48610 Player player = Main.player[owner];
48611 Vector2 center = player.RotatedRelativePoint(player.MountedCenter);
48612 direction = player.direction;
48613 player.heldProj = whoAmI;
48614 player.MatchItemTimeToItemAnimation();
48615 base.Center = center;
48616 bool flag = Main.player[owner].itemAnimation < Main.player[owner].itemAnimationMax / 3;
48617 int itemAnimationMax = player.itemAnimationMax;
48618 int itemAnimation = player.itemAnimation;
48619 int num = Main.player[owner].itemAnimationMax / 3;
48620 float num12 = MathHelper.Min((float)itemAnimation, (float)num);
48621 float num19 = (float)itemAnimation - num12;
48622 float num20 = 0f;
48623 float num21 = 0f;
48624 float num22 = 0f;
48625 bool flag2 = false;
48627 switch (type)
48628 {
48629 case 46:
48630 num20 = 3f;
48631 num22 = 1.6f;
48632 num21 = 1.4f;
48633 break;
48634 case 105:
48635 num20 = 3f;
48636 num22 = 2.4f;
48637 num21 = 2.1f;
48638 break;
48639 case 367:
48640 num20 = 3f;
48641 num22 = 1.6f;
48642 num21 = 1.5f;
48643 break;
48644 case 368:
48645 num20 = 3f;
48646 num22 = 1.5f;
48647 num21 = 1.4f;
48648 break;
48649 case 222:
48650 num20 = 3f;
48651 num22 = 2.4f;
48652 num21 = 2.1f;
48653 break;
48654 case 342:
48655 num20 = 3f;
48656 num22 = 2.4f;
48657 num21 = 2.1f;
48658 break;
48659 case 47:
48660 num20 = 4f;
48661 num22 = 1.2f;
48662 num21 = 0.9f;
48663 break;
48664 case 153:
48665 num20 = 4f;
48666 num22 = 1.5f;
48667 num21 = 1.3f;
48668 break;
48669 case 49:
48670 num20 = 4f;
48671 num22 = 1.1f;
48672 num21 = 0.85f;
48673 break;
48674 case 730:
48675 num20 = 8f;
48676 num22 = 1.5f;
48677 num21 = 1.2f;
48678 break;
48679 case 877:
48680 case 878:
48681 case 879:
48682 alpha -= 40;
48683 if (alpha < 0)
48684 {
48685 alpha = 0;
48686 }
48687 num20 = 28f;
48688 num22 = 0.4f;
48689 num21 = 0.4f;
48690 flag2 = true;
48691 break;
48692 case 64:
48693 case 215:
48695 num20 = 3f;
48696 num22 = 1.9f;
48697 num21 = 1.7f;
48698 break;
48699 case 66:
48700 case 97:
48701 case 212:
48702 case 218:
48703 num20 = 3f;
48704 num22 = 2.1f;
48705 num21 = 1.9f;
48706 break;
48707 case 130:
48708 num20 = 3f;
48709 num22 = 1.3f;
48710 num21 = 1f;
48711 break;
48712 }
48713 float num23 = (float)(itemAnimationMax - num) - num19;
48714 float num24 = (float)num - num12;
48715 float num25 = num20 + num21 * num23 - num22 * num24;
48716 position += velocity * num25;
48717 switch (type)
48718 {
48719 case 47:
48720 if (Main.player[owner].wet && Main.rand.Next(2) == 0)
48721 {
48722 int num2 = Dust.NewDust(Main.player[owner].position, Main.player[owner].width, Main.player[owner].height, 15, 0f, 0f, 100, default(Color), 0.8f);
48723 Dust obj = Main.dust[num2];
48724 obj.velocity *= 0.1f;
48725 }
48726 break;
48727 case 130:
48728 if ((localAI[0] == 0f || localAI[0] == 4f || localAI[0] == 8f || localAI[0] == 12f || localAI[0] == 16f || localAI[0] == 20f || localAI[0] == 24f) && owner == Main.myPlayer)
48729 {
48730 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X, velocity.Y, 131, damage / 3, 0f, owner);
48731 }
48732 localAI[0] += 1f;
48733 break;
48734 case 730:
48735 if (localAI[0] == 0f && Main.myPlayer == owner)
48736 {
48737 localAI[0] = 1f;
48738 Vector2 vector = velocity * 4f;
48739 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, vector.X, vector.Y, 732, (int)((double)damage * 1.5), knockBack * 0.5f, owner);
48740 }
48741 break;
48742 case 342:
48743 if (flag && localAI[0] == 0f && Main.myPlayer == owner)
48744 {
48745 localAI[0] = 1f;
48746 if (Collision.CanHit(player.position, player.width, player.height, position, width, height))
48747 {
48748 NewProjectile(GetProjectileSource_FromThis(), base.Center.X, base.Center.Y, velocity.X * 2.4f, velocity.Y * 2.4f, 343, damage, knockBack * 0.85f, owner);
48749 }
48750 }
48751 break;
48752 case 222:
48753 if (flag && localAI[0] == 0f && Main.myPlayer == owner)
48754 {
48755 localAI[0] = 1f;
48757 }
48758 break;
48759 }
48760 if (flag2 && player.channel && player.itemAnimation < num)
48761 {
48762 player.SetDummyItemTime(num);
48763 }
48764 rotation = (float)Math.Atan2(velocity.Y, velocity.X) + (float)Math.PI / 2f + (float)Math.PI / 4f;
48765 if (spriteDirection == -1)
48766 {
48767 rotation -= (float)Math.PI / 2f;
48768 }
48770 if (type == 878 || type == 879)
48771 {
48772 float num3 = 6f;
48773 float num4 = 0.8f;
48774 float num5 = Vector2.Dot(velocity.SafeNormalize(Vector2.UnitX * (float)player.direction), player.velocity.SafeNormalize(Vector2.UnitX * (float)player.direction));
48775 float num6 = ((Vector2)(ref player.velocity)).Length();
48776 if (num6 > num3 && num5 > num4)
48777 {
48778 int num7 = 8;
48779 if (num6 > num3 + 1f)
48780 {
48781 num7 = 5;
48782 }
48783 if (num6 > num3 + 2f)
48784 {
48785 num7 = 2;
48786 }
48787 int num8 = 14;
48788 int num9 = 27;
48789 int num10 = 4;
48790 if (type == 879)
48791 {
48792 num8 = 43;
48793 num9 = 57;
48794 }
48795 if (Main.rand.Next(num7 + 3) == 0)
48796 {
48797 Dust.NewDust(base.Center - new Vector2((float)num10, (float)num10), num10 * 2, num10 * 2, num8, 0f, 0f, 150, default(Color), 1.4f);
48798 }
48799 if (Main.rand.Next(num7) == 0)
48800 {
48801 int num11 = Dust.NewDust(base.Center - new Vector2((float)num10, (float)num10), num10 * 2, num10 * 2, num9, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
48802 Main.dust[num11].noGravity = true;
48803 Dust obj2 = Main.dust[num11];
48804 obj2.velocity *= 0.25f;
48805 num11 = Dust.NewDust(base.Center - new Vector2((float)num10, (float)num10), num10 * 2, num10 * 2, num9, 0f, 0f, 150, default(Color), 1.4f);
48806 Dust obj3 = Main.dust[num11];
48807 obj3.velocity *= 0.25f;
48808 }
48809 }
48810 }
48811 if (type == 46)
48812 {
48813 if (Main.rand.Next(5) == 0)
48814 {
48815 Dust.NewDust(position, width, height, 14, 0f, 0f, 150, default(Color), 1.4f);
48816 }
48817 int num13 = Dust.NewDust(position, width, height, 27, velocity.X * 0.2f + (float)(direction * 3), velocity.Y * 0.2f, 100, default(Color), 1.2f);
48818 Main.dust[num13].noGravity = true;
48819 Dust obj4 = Main.dust[num13];
48820 obj4.velocity /= 2f;
48821 num13 = Dust.NewDust(position - velocity * 2f, width, height, 27, 0f, 0f, 150, default(Color), 1.4f);
48822 Dust obj5 = Main.dust[num13];
48823 obj5.velocity /= 5f;
48824 }
48825 if (type == 730)
48826 {
48827 if (Main.rand.Next(5) == 0)
48828 {
48829 Dust dust = Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.7f);
48830 dust.noGravity = true;
48831 dust.velocity *= 1.4f;
48832 }
48833 if (Main.rand.Next(5) == 0)
48834 {
48835 Dust.NewDustDirect(position, width, height, 226, 0f, 0f, 150, default(Color), 0.5f).velocity.Y -= 0.5f;
48836 }
48837 }
48838 else if (type == 105)
48839 {
48840 if (Main.rand.Next(3) == 0)
48841 {
48842 int num14 = Dust.NewDust(position, width, height, 57, velocity.X * 0.2f, velocity.Y * 0.2f, 200, default(Color), 1.2f);
48843 Dust obj6 = Main.dust[num14];
48844 obj6.velocity += velocity * 0.3f;
48845 Dust obj7 = Main.dust[num14];
48846 obj7.velocity *= 0.2f;
48847 }
48848 if (Main.rand.Next(4) == 0)
48849 {
48850 int num15 = Dust.NewDust(position, width, height, 43, 0f, 0f, 254, default(Color), 0.3f);
48851 Dust obj8 = Main.dust[num15];
48852 obj8.velocity += velocity * 0.5f;
48853 Dust obj9 = Main.dust[num15];
48854 obj9.velocity *= 0.5f;
48855 }
48856 }
48857 else if (type == 153)
48858 {
48859 int num16 = Dust.NewDust(position - velocity * 3f, width, height, 115, velocity.X * 0.4f, velocity.Y * 0.4f, 140);
48860 Main.dust[num16].noGravity = true;
48861 Main.dust[num16].fadeIn = 1.25f;
48862 Dust obj10 = Main.dust[num16];
48863 obj10.velocity *= 0.25f;
48864 }
48865 if (type == 342)
48866 {
48867 Lighting.AddLight(base.Center, 0.65f, 0.9f, 1f);
48868 if (timeLeft % 2 == 0)
48869 {
48870 int num17 = 10;
48871 int num18 = Dust.NewDust(position - velocity * 3f - new Vector2((float)num17, (float)num17), width + num17 * 2, height + num17 * 2, 135, velocity.X * 0.4f, velocity.Y * 0.4f, 50, default(Color), 1.2f);
48872 Dust obj11 = Main.dust[num18];
48873 obj11.velocity *= 0.5f;
48874 Dust obj12 = Main.dust[num18];
48875 obj12.velocity += velocity * 0.25f;
48876 }
48877 }
48878 ai[0] += 1f;
48879 bool flag3 = ai[0] >= (float)itemAnimationMax;
48880 if (flag2)
48881 {
48882 flag3 &= !player.channel;
48883 }
48884 if (flag3)
48885 {
48886 Kill();
48887 }
48888 }
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
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...
int damage
This will always be set in Projectile.NewProjectile based on the weapons damage and player stat modif...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
int alpha
How transparent to draw this projectile. 0 to 255. 255 is completely transparent. ExampleBulletsets...
IEntitySource GetProjectileSource_FromThis()
float[] localAI
Acts like F:Terraria.Projectile.ai, but does not sync to the server. Many vanilla T:Terraria....
float knockBack
This will always be set in Projectile.NewProjectile based on the weapons knockback and player stat mo...
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
bool AI_019_Spears_GetExtensionHitbox(out Rectangle extensionBox)
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...
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position and...

References Terraria.Lighting.AddLight(), Terraria.Collision.CanHit(), Terraria.Player.channel, Terraria.Entity.direction, Terraria.Main.dust, Terraria.Entity.height, Terraria.Player.itemAnimation, Terraria.Player.itemAnimationMax, Terraria.Player.MatchItemTimeToItemAnimation(), Terraria.Player.MountedCenter, Terraria.Main.myPlayer, Terraria.Dust.NewDust(), Terraria.Dust.NewDustDirect(), Terraria.Main.player, Terraria.Entity.position, Terraria.Main.rand, Terraria.Player.RotatedRelativePoint(), Terraria.Player.SetDummyItemTime(), Terraria.Entity.velocity, and Terraria.Entity.width.

+ Here is the call graph for this function: