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

◆ ItemCheck_ApplyUseStyle()

void Terraria.Player.ItemCheck_ApplyUseStyle ( float mountOffset,
Item sItem,
Rectangle heldItemFrame )
inline

Definition at line 47744 of file Player.cs.

47745 {
47746 if (Main.dedServ)
47747 {
47748 return;
47749 }
47750 if (sItem.useStyle == 1)
47751 {
47752 if (sItem.type > -1 && Item.claw[sItem.type])
47753 {
47754 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
47755 {
47756 float num = 10f;
47757 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num) * (float)direction;
47758 itemLocation.Y = position.Y + 26f + mountOffset;
47759 }
47760 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
47761 {
47762 float num2 = 8f;
47763 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num2) * (float)direction;
47764 num2 = 24f;
47765 itemLocation.Y = position.Y + num2 + mountOffset;
47766 }
47767 else
47768 {
47769 float num3 = 6f;
47770 itemLocation.X = position.X + (float)width * 0.5f - ((float)heldItemFrame.Width * 0.5f - num3) * (float)direction;
47771 num3 = 20f;
47772 itemLocation.Y = position.Y + num3 + mountOffset;
47773 }
47774 itemRotation = ((float)itemAnimation / (float)itemAnimationMax - 0.5f) * (float)(-direction) * 3.5f - (float)direction * 0.3f;
47775 }
47776 else
47777 {
47779 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
47780 {
47781 float num4 = 10f;
47782 if (heldItemFrame.Width > 32)
47783 {
47784 num4 = 14f;
47785 }
47786 if (heldItemFrame.Width >= 52)
47787 {
47788 num4 = 24f;
47789 }
47790 if (heldItemFrame.Width >= 64)
47791 {
47792 num4 = 28f;
47793 }
47794 if (heldItemFrame.Width >= 92)
47795 {
47796 num4 = 38f;
47797 }
47798 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47799 {
47800 num4 += 8f;
47801 }
47802 if (sItem.type == 671)
47803 {
47804 num4 += 12f;
47805 }
47806 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num4) * (float)direction;
47807 itemLocation.Y = position.Y + 24f + mountOffset;
47808 zero = new Vector2(-4f, 1f);
47809 }
47810 else if ((double)itemAnimation < (double)itemAnimationMax * 0.666)
47811 {
47812 float num5 = 10f;
47813 if (heldItemFrame.Width > 32)
47814 {
47815 num5 = 18f;
47816 }
47817 if (heldItemFrame.Width >= 52)
47818 {
47819 num5 = 24f;
47820 }
47821 if (heldItemFrame.Width >= 64)
47822 {
47823 num5 = 28f;
47824 }
47825 if (heldItemFrame.Width >= 92)
47826 {
47827 num5 = 38f;
47828 }
47829 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47830 {
47831 num5 += 4f;
47832 }
47833 if (sItem.type == 671)
47834 {
47835 num5 += 6f;
47836 }
47837 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - num5) * (float)direction;
47838 num5 = 10f;
47839 if (heldItemFrame.Height > 32)
47840 {
47841 num5 = 8f;
47842 }
47843 if (heldItemFrame.Height > 52)
47844 {
47845 num5 = 12f;
47846 }
47847 if (heldItemFrame.Height > 64)
47848 {
47849 num5 = 14f;
47850 }
47851 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47852 {
47853 num5 += 4f;
47854 }
47855 if (sItem.type == 671)
47856 {
47857 num5 += 10f;
47858 }
47859 itemLocation.Y = position.Y + num5 + mountOffset;
47860 zero = new Vector2(-6f, -4f);
47861 }
47862 else
47863 {
47864 float num6 = 6f;
47865 if (heldItemFrame.Width > 32)
47866 {
47867 num6 = 14f;
47868 }
47869 if (heldItemFrame.Width >= 48)
47870 {
47871 num6 = 18f;
47872 }
47873 if (heldItemFrame.Width >= 52)
47874 {
47875 num6 = 24f;
47876 }
47877 if (heldItemFrame.Width >= 64)
47878 {
47879 num6 = 28f;
47880 }
47881 if (heldItemFrame.Width >= 92)
47882 {
47883 num6 = 38f;
47884 }
47885 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47886 {
47887 num6 += 4f;
47888 }
47889 if (sItem.type == 671)
47890 {
47891 num6 += 8f;
47892 }
47893 itemLocation.X = position.X + (float)width * 0.5f - ((float)heldItemFrame.Width * 0.5f - num6) * (float)direction;
47894 num6 = 10f;
47895 if (heldItemFrame.Height > 32)
47896 {
47897 num6 = 10f;
47898 }
47899 if (heldItemFrame.Height > 52)
47900 {
47901 num6 = 12f;
47902 }
47903 if (heldItemFrame.Height > 64)
47904 {
47905 num6 = 14f;
47906 }
47907 if (sItem.type == 2330 || sItem.type == 2320 || sItem.type == 2341)
47908 {
47909 num6 += 4f;
47910 }
47911 if (sItem.type == 671)
47912 {
47913 num6 += 8f;
47914 }
47915 itemLocation.Y = position.Y + num6 + mountOffset;
47916 zero = new Vector2(4f, -2f);
47917 }
47918 if (sItem.type > -1 && ItemID.Sets.UsesBetterMeleeItemLocation[sItem.type])
47919 {
47921 }
47922 itemRotation = ((float)itemAnimation / (float)itemAnimationMax - 0.5f) * (float)(-direction) * 3.5f - (float)direction * 0.3f;
47923 }
47924 if (gravDir == -1f)
47925 {
47927 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47928 }
47929 }
47930 else if (sItem.useStyle == 7)
47931 {
47932 itemRotation = (float)itemAnimation / (float)itemAnimationMax * (float)direction * 2f + -1.4f * (float)direction;
47933 if ((double)itemAnimation < (double)itemAnimationMax * 0.5)
47934 {
47935 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 12f * (float)direction) * (float)direction;
47936 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction * 4f + mountOffset;
47937 }
47938 else
47939 {
47940 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 16f * (float)direction) * (float)direction;
47941 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction + mountOffset;
47942 }
47943 if (gravDir == -1f)
47944 {
47946 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47947 }
47948 }
47949 else if (sItem.useStyle == 9)
47950 {
47951 float num7 = (float)itemAnimation / (float)itemAnimationMax;
47952 float t = 1f - num7;
47953 t = Utils.GetLerpValue(0f, 0.7f, t, clamped: true);
47954 itemRotation = t * (float)(-direction) * 2f + 0.7f * (float)direction;
47955 itemLocation = MountedCenter + new Vector2((float)(direction * 10) * ((float)itemAnimation / (float)itemAnimationMax), 0f);
47956 float num8 = 8f;
47957 float num9 = 7f;
47958 float num10 = (float)Math.PI * 2f / 5f;
47959 float num11 = (0f - num10) * 0.5f + (1f - t) * num10;
47960 num11 += (float)Math.PI / 10f;
47961 Vector2 vector = base.Center + new Vector2((float)direction * num8, 0f) + num11.ToRotationVector2() * num9 * new Vector2(direction, 1f);
47963 float num12 = num11 - (float)Math.PI / 2f;
47964 if (direction == -1)
47965 {
47966 num12 = 0f - num12;
47967 }
47968 SetCompositeArmFront(enabled: true, CompositeArmStretchAmount.Full, num12);
47969 itemLocation = GetFrontHandPosition(CompositeArmStretchAmount.Full, num12);
47971 itemLocation *= MathHelper.Lerp(1.5f, 1.2f, t);
47973 itemLocation.X += (float)direction * MathHelper.Lerp(8f, 2f, t);
47974 if (gravDir == -1f)
47975 {
47977 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
47978 }
47979 }
47980 else if (sItem.useStyle == 6)
47981 {
47982 float num13 = 1f - (float)itemAnimation / (float)itemAnimationMax;
47983 num13 *= 6f;
47984 if (num13 > 1f)
47985 {
47986 num13 = 1f;
47987 }
47988 itemRotation = (1f - num13) * (float)direction * 2f - 1.4f * (float)direction;
47989 if (num13 >= 0.5f)
47990 {
47991 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 12f * (float)direction) * (float)direction;
47992 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction * 4f + mountOffset;
47993 }
47994 else
47995 {
47996 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 16f * (float)direction) * (float)direction;
47997 itemLocation.Y = position.Y + 38f + itemRotation * (float)direction + mountOffset;
47998 }
47999 if (gravDir == -1f)
48000 {
48002 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48003 }
48004 }
48005 else if (sItem.useStyle == 2)
48006 {
48007 itemLocation = MountedCenter + new Vector2(10 * direction, -10f).RotatedBy(itemRotation + (float)Math.PI / 4f * (float)direction);
48008 float num14 = 1f - (float)itemAnimation / (float)itemAnimationMax;
48009 CompositeArmStretchAmount compositeArmStretchAmount = CompositeArmStretchAmount.Full;
48010 if (num14 > 0.25f && num14 <= 0.5f)
48011 {
48012 compositeArmStretchAmount = CompositeArmStretchAmount.ThreeQuarters;
48013 }
48014 if (num14 > 0.5f && num14 <= 0.75f)
48015 {
48016 compositeArmStretchAmount = CompositeArmStretchAmount.Quarter;
48017 }
48018 if (num14 > 0.75f && num14 <= 1f)
48019 {
48020 compositeArmStretchAmount = CompositeArmStretchAmount.None;
48021 }
48022 SetCompositeArmFront(enabled: true, compositeArmStretchAmount, -(float)Math.PI / 2f * (float)direction);
48023 SetCompositeArmBack(enabled: true, compositeArmStretchAmount, -(float)Math.PI / 2f * (float)direction);
48024 int num15 = 8;
48026 {
48027 case CompositeArmStretchAmount.Full:
48028 num15 = 8;
48029 break;
48030 case CompositeArmStretchAmount.ThreeQuarters:
48031 num15 = 6;
48032 break;
48033 case CompositeArmStretchAmount.Quarter:
48034 num15 = 4;
48035 break;
48036 case CompositeArmStretchAmount.None:
48037 num15 = 2;
48038 break;
48039 }
48040 itemLocation = MountedCenter + new Vector2((num15 + 10 - heldItemFrame.Width / 2) * direction, heldItemFrame.Height / 2 - 4);
48041 if (gravDir == -1f)
48042 {
48044 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48045 }
48046 }
48047 else if (sItem.useStyle == 11)
48048 {
48049 float num16 = 1f - (float)itemAnimation / (float)itemAnimationMax;
48050 num16 *= 2f;
48051 CompositeArmStretchAmount compositeArmStretchAmount2 = CompositeArmStretchAmount.Full;
48052 if (num16 > 0.25f && num16 <= 0.5f)
48053 {
48054 compositeArmStretchAmount2 = CompositeArmStretchAmount.ThreeQuarters;
48055 }
48056 if (num16 > 0.5f && num16 <= 0.75f)
48057 {
48058 compositeArmStretchAmount2 = CompositeArmStretchAmount.Quarter;
48059 }
48060 if (num16 > 0.75f && num16 <= 1.25f)
48061 {
48062 compositeArmStretchAmount2 = CompositeArmStretchAmount.None;
48063 }
48064 if (num16 > 1.25f && num16 <= 1.5f)
48065 {
48066 compositeArmStretchAmount2 = CompositeArmStretchAmount.Quarter;
48067 }
48068 if (num16 > 1.5f && num16 <= 1.75f)
48069 {
48070 compositeArmStretchAmount2 = CompositeArmStretchAmount.ThreeQuarters;
48071 }
48072 if (num16 > 1.75f && num16 <= 2f)
48073 {
48074 compositeArmStretchAmount2 = CompositeArmStretchAmount.Full;
48075 }
48076 SetCompositeArmFront(enabled: true, compositeArmStretchAmount2, -(float)Math.PI / 4f * (float)direction);
48077 SetCompositeArmBack(enabled: true, CompositeArmStretchAmount.Full, -(float)Math.PI / 16f);
48078 int num17 = 8;
48080 {
48081 case CompositeArmStretchAmount.Full:
48082 num17 = 8;
48083 break;
48084 case CompositeArmStretchAmount.ThreeQuarters:
48085 num17 = 6;
48086 break;
48087 case CompositeArmStretchAmount.Quarter:
48088 num17 = 4;
48089 break;
48090 case CompositeArmStretchAmount.None:
48091 num17 = 2;
48092 break;
48093 }
48094 itemLocation = MountedCenter + new Vector2((num17 + 22 - heldItemFrame.Width / 2) * direction, heldItemFrame.Height / 2 - 8);
48095 if (gravDir == -1f)
48096 {
48098 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48099 }
48100 }
48101 else if (sItem.useStyle == 3)
48102 {
48103 if ((double)itemAnimation > (double)itemAnimationMax * 0.666)
48104 {
48105 itemLocation.X = -1000f;
48106 itemLocation.Y = -1000f;
48107 itemRotation = -1.3f * (float)direction;
48108 }
48109 else
48110 {
48111 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 4f) * (float)direction;
48112 itemLocation.Y = position.Y + 24f + mountOffset;
48113 float num18 = (float)itemAnimation / (float)itemAnimationMax * (float)heldItemFrame.Width * (float)direction * GetAdjustedItemScale(sItem) * 1.2f - (float)(10 * direction);
48114 if (num18 > -4f && direction == -1)
48115 {
48116 num18 = -8f;
48117 }
48118 if (num18 < 4f && direction == 1)
48119 {
48120 num18 = 8f;
48121 }
48122 itemLocation.X -= num18;
48123 itemRotation = 0.8f * (float)direction;
48124 if (sItem.type == 946 || sItem.type == 4707)
48125 {
48126 itemLocation.X -= 6 * direction;
48127 }
48128 }
48129 if (gravDir == -1f)
48130 {
48132 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48133 }
48134 }
48135 else if (sItem.useStyle == 4)
48136 {
48137 int num19 = 0;
48138 int num20 = 0;
48139 if (sItem.type == 3601)
48140 {
48141 num19 = 10;
48142 }
48143 if (sItem.type == 5114)
48144 {
48145 num19 = 10;
48146 num20 = -2;
48147 }
48148 if (sItem.type == 5120)
48149 {
48150 num19 = 10;
48151 }
48152 itemRotation = 0f;
48153 itemLocation.X = position.X + (float)width * 0.5f + ((float)heldItemFrame.Width * 0.5f - 9f - itemRotation * 14f * (float)direction - 4f - (float)num19) * (float)direction;
48154 itemLocation.Y = position.Y + (float)heldItemFrame.Height * 0.5f + 4f + mountOffset + (float)num20;
48155 if (gravDir == -1f)
48156 {
48158 itemLocation.Y = position.Y + (float)height + (position.Y - itemLocation.Y);
48159 }
48160 }
48161 else if (sItem.useStyle == 5)
48162 {
48163 if (sItem.type == 3779)
48164 {
48165 itemRotation = 0f;
48166 itemLocation.X = base.Center.X + (float)(6 * direction);
48167 itemLocation.Y = MountedCenter.Y + 6f;
48168 }
48169 else if (sItem.type == 4262)
48170 {
48171 itemRotation = 0f;
48172 itemLocation.X = base.Center.X + (float)(-heldItemFrame.Width) * 0.5f + (float)(direction * -6);
48173 itemLocation.Y = MountedCenter.Y - 6f;
48174 if (Main.rand.Next(20) == 0)
48175 {
48176 int num21 = Main.rand.Next(570, 573);
48177 Vector2 vector2 = new Vector2(base.Center.X + (float)(direction * 30) - 6f, itemLocation.Y - 30f);
48178 Vector2 vector3 = new Vector2(Main.WindForVisuals * 2f + (float)direction * 0.3f, -0.5f);
48179 vector3.X *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
48180 vector3.Y *= 1f + (float)Main.rand.Next(-50, 51) * 0.01f;
48181 if (num21 == 572)
48182 {
48183 vector2.X -= 8f;
48184 }
48185 if (num21 == 571)
48186 {
48187 vector2.X -= 4f;
48188 }
48189 Gore.NewGore(vector2, vector3, num21, 0.8f);
48190 }
48191 }
48192 else if (Item.staff[sItem.type])
48193 {
48194 float num22 = 6f;
48195 if (sItem.type == 3476)
48196 {
48197 num22 = 14f;
48198 }
48200 itemLocation += (itemRotation.ToRotationVector2() * num22 * direction).Floor();
48201 }
48202 else
48203 {
48204 itemLocation.X = position.X + (float)width * 0.5f - (float)heldItemFrame.Width * 0.5f - (float)(direction * 2);
48205 itemLocation.Y = MountedCenter.Y - (float)heldItemFrame.Height * 0.5f;
48206 }
48207 if (sItem.type != 5065)
48208 {
48209 return;
48210 }
48211 _ = itemRotation;
48212 Vector2 vector4 = itemLocation + itemRotation.ToRotationVector2() * 38f * direction;
48213 Vector2 vector5 = itemRotation.ToRotationVector2() * 5f * direction;
48214 if (itemAnimation % 2 == 0)
48215 {
48216 Color newColor = Main.hslToRgb(0.92f, 1f, 0.5f);
48217 int num23 = Dust.NewDust(vector4, 0, 0, 267, 0f, 0f, 0, newColor);
48218 Main.dust[num23].position = vector4 - velocity + Main.rand.NextVector2Circular(10f, 10f);
48219 Main.dust[num23].noGravity = true;
48220 Main.dust[num23].scale = 0.3f;
48221 Main.dust[num23].fadeIn = Main.rand.NextFloat() * 1.2f;
48222 Main.dust[num23].velocity = Main.rand.NextVector2Circular(1f, 1f) + velocity;
48223 if (num23 != 6000)
48224 {
48225 Dust dust = Dust.CloneDust(num23);
48226 dust.scale /= 2f;
48227 dust.fadeIn *= 0.85f;
48228 dust.color = new Color(255, 255, 255, 255);
48229 }
48230 }
48231 if (itemAnimation % 4 == 0)
48232 {
48234 {
48235 PositionInWorld = vector4,
48236 MovementVector = vector5 * 0.1f + Main.rand.NextVector2Circular(2f, 2f) + velocity
48237 }, whoAmI);
48238 }
48239 }
48240 else if (sItem.useStyle == 13)
48241 {
48242 int useAnimation = itemAnimationMax;
48243 if (itemTimeMax != 0)
48244 {
48245 useAnimation = itemTimeMax;
48246 }
48247 if (useAnimation == 0)
48248 {
48249 useAnimation = sItem.useAnimation;
48250 }
48251 float num24 = 1f - (float)(itemAnimation % useAnimation) / (float)useAnimation;
48252 CompositeArmStretchAmount stretch = CompositeArmStretchAmount.Quarter;
48253 if (num24 > 0.33f && num24 <= 0.66f)
48254 {
48255 stretch = CompositeArmStretchAmount.ThreeQuarters;
48256 }
48257 if (num24 > 0.66f && num24 <= 1f)
48258 {
48259 stretch = CompositeArmStretchAmount.Full;
48260 }
48261 float rotation = itemRotation * Directions.Y - (float)Math.PI / 2f * (float)direction;
48262 SetCompositeArmFront(enabled: true, stretch, rotation);
48263 }
48264 else if (sItem.useStyle == 8)
48265 {
48266 Projectile projectile = null;
48267 if (ownedProjectileCounts[722] > 0)
48268 {
48269 for (int i = 0; i < 1000; i++)
48270 {
48271 Projectile projectile2 = Main.projectile[i];
48272 if (projectile2.active && projectile2.owner == whoAmI && projectile2.type == 722)
48273 {
48274 projectile = projectile2;
48275 break;
48276 }
48277 }
48278 }
48279 float num25 = 1f;
48280 if (projectile != null)
48281 {
48282 num25 = MathHelper.Lerp(0.6f, 1f, Utils.GetLerpValue(0f, 800f, Vector2.Distance(MountedCenter, projectile.Center), clamped: true));
48283 }
48284 num25 = 1f;
48285 if (itemAnimation >= sItem.useAnimation - 1 && itemAnimation <= sItem.useAnimation)
48286 {
48287 float num26 = new Vector2(10 * direction, 10f).ToRotation() + (float)Math.PI / 4f;
48289 if (direction == -1)
48290 {
48291 itemRotation += (float)Math.PI / 2f;
48292 }
48293 _ = 1f - (float)itemAnimation / (float)itemAnimationMax;
48294 CompositeArmStretchAmount stretch2 = CompositeArmStretchAmount.Full;
48295 CompositeArmStretchAmount stretch3 = CompositeArmStretchAmount.ThreeQuarters;
48296 float num27 = -(float)Math.PI / 10f;
48297 if (direction == -1)
48298 {
48299 num27 *= -1f;
48300 }
48301 float num28 = itemRotation - (float)Math.PI / 4f + (float)Math.PI;
48302 if (direction == 1)
48303 {
48304 num28 += (float)Math.PI / 2f;
48305 }
48306 float rotation2 = num28 + num27;
48307 float rotation3 = num28 - num27;
48308 Vector2 vector6 = (num28 + (float)Math.PI / 2f).ToRotationVector2() * -2f;
48309 itemLocation = (MountedCenter + vector6).Floor();
48312 }
48313 else if (itemAnimation > sItem.useAnimation)
48314 {
48315 float num29 = 0f - Utils.GetLerpValue(itemAnimationMax, itemAnimationMax * 5, itemAnimation, clamped: true);
48316 num29 *= num25;
48317 CompositeArmStretchAmount stretch4 = CompositeArmStretchAmount.Full;
48318 CompositeArmStretchAmount stretch5 = CompositeArmStretchAmount.ThreeQuarters;
48319 float num30 = -(float)Math.PI / 10f;
48320 num30 *= 0f - num29;
48321 itemRotation = (float)Math.PI / 2f * (float)(-direction) + (float)Math.PI + (float)Math.PI * num29 * (float)(-direction);
48322 float num31 = -(float)Math.PI / 5f * (float)direction;
48323 if (direction < 1)
48324 {
48325 num30 *= -1f;
48326 }
48327 float rotation4 = num31 + num30;
48328 float rotation5 = num31 - num30;
48329 Vector2 vector7 = new Vector2(10 * direction, num29 * -6f);
48330 itemLocation = (MountedCenter + vector7).Floor();
48333 }
48334 else
48335 {
48336 float num32 = 1f - (float)itemAnimation / (float)itemAnimationMax;
48337 CompositeArmStretchAmount stretch6 = CompositeArmStretchAmount.Full;
48338 CompositeArmStretchAmount stretch7 = CompositeArmStretchAmount.ThreeQuarters;
48339 if (num32 > 0.6f)
48340 {
48341 stretch7 = CompositeArmStretchAmount.Quarter;
48342 }
48343 float num33 = -(float)Math.PI / 10f;
48344 if (direction == -1)
48345 {
48346 num33 *= -1f;
48347 }
48348 num33 *= 1f - num32 * 2.2f;
48349 itemRotation = (num32 * (float)Math.PI * 1.6f + -(float)Math.PI / 2f) * num25 * (float)(-direction) + (float)Math.PI;
48350 float num34 = (num32 * (float)Math.PI * 0.6f + (float)Math.PI * 2f / 5f) * (float)(-direction) + (float)Math.PI - (float)Math.PI / 4f + (float)Math.PI;
48351 if (direction == 1)
48352 {
48353 num34 += (float)Math.PI / 2f;
48354 }
48355 float rotation6 = num34 + num33;
48356 float rotation7 = num34 - num33;
48357 Vector2 vector8 = (num34 + (float)Math.PI / 2f).ToRotationVector2() * (-5f * (1f - num32));
48358 itemLocation = (MountedCenter + vector8).Floor();
48361 }
48363 }
48364 else if (sItem.useStyle == 12)
48365 {
48366 itemRotation = 0f;
48367 itemLocation.X = MountedCenter.X - (float)(8 * direction);
48368 itemLocation.Y = position.Y + 40f + mountOffset;
48369 Vector2 vector9 = Main.OffsetsPlayerHeadgear[bodyFrame.Y / 56];
48371 float num35 = itemAnimationMax;
48372 if (num35 == 0f)
48373 {
48374 num35 = sItem.useAnimation;
48375 }
48376 float num36 = 1f - (float)itemAnimation / num35;
48377 num36 *= 2f;
48378 float num37 = (float)Math.Cos(num36 * (float)Math.PI) * 0.2f;
48379 CompositeArmStretchAmount compositeArmStretchAmount3 = CompositeArmStretchAmount.Full;
48380 if (num36 > 0.25f && num36 <= 0.5f)
48381 {
48382 compositeArmStretchAmount3 = CompositeArmStretchAmount.ThreeQuarters;
48383 }
48384 if (num36 > 0.5f && num36 <= 0.75f)
48385 {
48386 compositeArmStretchAmount3 = CompositeArmStretchAmount.Quarter;
48387 }
48388 if (num36 > 0.75f && num36 <= 1.25f)
48389 {
48390 compositeArmStretchAmount3 = CompositeArmStretchAmount.None;
48391 }
48392 if (num36 > 1.25f && num36 <= 1.5f)
48393 {
48394 compositeArmStretchAmount3 = CompositeArmStretchAmount.Quarter;
48395 }
48396 if (num36 > 1.5f && num36 <= 1.75f)
48397 {
48398 compositeArmStretchAmount3 = CompositeArmStretchAmount.ThreeQuarters;
48399 }
48400 if (num36 > 1.75f && num36 <= 2f)
48401 {
48402 compositeArmStretchAmount3 = CompositeArmStretchAmount.Full;
48403 }
48404 SetCompositeArmFront(enabled: true, compositeArmStretchAmount3, (-(float)Math.PI / 4f + num37) * (float)direction);
48405 CompositeArmStretchAmount stretch8 = CompositeArmStretchAmount.Quarter;
48406 SetCompositeArmBack(enabled: true, stretch8, (-(float)Math.PI / 4f - num37 * 0.5f) * (float)direction);
48408 if (sItem.type != 4715 || compositeArmStretchAmount3 != CompositeArmStretchAmount.ThreeQuarters)
48409 {
48410 return;
48411 }
48413 Dust dust2 = Dust.NewDustPerfect(vector10, 228, Main.rand.NextVector2CircularEdge(1f, 1f));
48414 dust2.noGravity = true;
48415 dust2.noLight = true;
48416 dust2.velocity *= 2f;
48417 float num38 = 0.5f;
48418 for (float num39 = 0f; num39 < 1f; num39 += 0.5f)
48419 {
48420 if (Main.rand.Next(3) == 0)
48421 {
48422 Dust dust3 = Dust.NewDustPerfect(vector10, 278, Vector2.UnitY.RotatedBy(num39 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * num38 - num38 * 0.5f + (float)Math.PI / 2f) * (2f + Main.rand.NextFloat() * 1f), 150, Color.Lerp(Color.White, Color.HotPink, Main.rand.NextFloat() * 0.5f + 0.5f), 0.45f);
48423 dust3.noGravity = true;
48424 dust3.velocity *= 0.5f;
48425 dust3.customData = this;
48426 dust3.position += dust3.velocity * 6f;
48427 }
48428 }
48429 for (float num40 = 0f; num40 < 1f; num40 += 0.5f)
48430 {
48431 if (Main.rand.Next(3) == 0)
48432 {
48433 Dust dust4 = Dust.NewDustPerfect(vector10, 278, Vector2.UnitY.RotatedBy(num40 * ((float)Math.PI * 2f) + Main.rand.NextFloat() * num38 - num38 * 0.5f + (float)Math.PI / 2f) * (0.5f + Main.rand.NextFloat() * 1f), 150, Color.Lerp(Color.White, Color.Gold, Main.rand.NextFloat() * 0.5f + 0.5f), 0.45f);
48434 dust4.noGravity = true;
48435 dust4.velocity *= 0.5f;
48436 dust4.customData = this;
48437 dust4.position += dust4.velocity * 6f;
48438 }
48439 }
48440 }
48441 else if (sItem.useStyle == 14 && !Main.dedServ)
48442 {
48443 itemRotation = 0f;
48444 itemLocation.X = base.Center.X + (float)(6 * direction);
48445 itemLocation.Y = position.Y + 40f + mountOffset - 8f;
48446 Vector2 vector11 = Main.OffsetsPlayerHeadgear[bodyFrame.Y / 56];
48448 CompositeArmStretchAmount stretch9 = CompositeArmStretchAmount.Full;
48449 SetCompositeArmBack(enabled: true, stretch9, (float)Math.PI * -3f / 4f * (float)direction);
48451 }
48452 }
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static double Cos(double d)
const double PI
Definition Math.cs:16
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static void RequestParticleSpawn(bool clientOnly, ParticleOrchestraType type, ParticleOrchestraSettings settings, int? overrideInvokingPlayerIndex=null)
static bool[] UsesBetterMeleeItemLocation
Definition ItemID.cs:61
int itemAnimationMax
Definition Player.cs:2567
float itemRotation
Definition Player.cs:1177
void SetCompositeArmBack(bool enabled, CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:3716
Vector2 GetFrontHandPosition(CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:47682
Vector2 MountedCenter
Definition Player.cs:2853
Vector2 Directions
Definition Player.cs:3326
void FlipItemLocationAndRotationForGravity()
Definition Player.cs:48454
float GetAdjustedItemScale(Item item)
Definition Player.cs:40623
void SetCompositeArmFront(bool enabled, CompositeArmStretchAmount stretch, float rotation)
Definition Player.cs:3707
Vector2 itemLocation
Definition Player.cs:1183
int[] ownedProjectileCounts
Definition Player.cs:2545
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Terraria.Entity.Center, Terraria.Item.claw, Terraria.Dust.CloneDust(), System.Math.Cos(), Terraria.Main.dedServ, Microsoft.Xna.Framework.Vector2.Distance(), Terraria.Main.dust, Terraria.Utils.GetLerpValue(), Microsoft.Xna.Framework.Color.Gold, Microsoft.Xna.Framework.Color.HotPink, Terraria.Main.hslToRgb(), Microsoft.Xna.Framework.Color.Lerp(), Microsoft.Xna.Framework.MathHelper.Lerp(), Terraria.Dust.NewDust(), Terraria.Dust.NewDustPerfect(), Terraria.Gore.NewGore(), Terraria.Main.OffsetsPlayerHeadgear, System.Math.PI, Terraria.Main.projectile, Terraria.Main.rand, Terraria.GameContent.Drawing.ParticleOrchestrator.RequestParticleSpawn(), Terraria.Item.staff, Microsoft.Xna.Framework.Vector2.UnitY, Terraria.ID.ItemID.Sets.UsesBetterMeleeItemLocation, Microsoft.Xna.Framework.Color.White, Terraria.Main.WindForVisuals, Microsoft.Xna.Framework.Vector2.Y, and Microsoft.Xna.Framework.Vector2.Zero.