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

◆ GetSwingStats()

Tuple< Vector2, float > Terraria.NPC.GetSwingStats ( int swingMax,
int swingCurrent,
int aimDir,
int itemWidth,
int itemHeight )
inline

Definition at line 58864 of file NPC.cs.

58865 {
58867 if ((double)swingCurrent < (double)swingMax * 0.333)
58868 {
58869 float num = 10f;
58870 if (itemWidth > 32)
58871 {
58872 num = 14f;
58873 }
58874 if (itemWidth >= 52)
58875 {
58876 num = 24f;
58877 }
58878 if (itemWidth >= 64)
58879 {
58880 num = 28f;
58881 }
58882 if (itemWidth >= 92)
58883 {
58884 num = 38f;
58885 }
58886 zero.X = base.Center.X + ((float)itemWidth * 0.5f - num) * (float)aimDir;
58887 zero.Y = position.Y + 24f;
58888 }
58889 else if ((double)swingCurrent < (double)swingMax * 0.666)
58890 {
58891 float num2 = 10f;
58892 if (itemWidth > 32)
58893 {
58894 num2 = 18f;
58895 }
58896 if (itemWidth >= 52)
58897 {
58898 num2 = 24f;
58899 }
58900 if (itemWidth >= 64)
58901 {
58902 num2 = 28f;
58903 }
58904 if (itemWidth >= 92)
58905 {
58906 num2 = 38f;
58907 }
58908 zero.X = base.Center.X + ((float)itemWidth * 0.5f - num2) * (float)aimDir;
58909 num2 = 10f;
58910 if (itemHeight > 32)
58911 {
58912 num2 = 8f;
58913 }
58914 if (itemHeight > 52)
58915 {
58916 num2 = 12f;
58917 }
58918 if (itemHeight > 64)
58919 {
58920 num2 = 14f;
58921 }
58922 zero.Y = position.Y + num2;
58923 }
58924 else
58925 {
58926 float num3 = 6f;
58927 if (itemWidth > 32)
58928 {
58929 num3 = 14f;
58930 }
58931 if (itemWidth >= 48)
58932 {
58933 num3 = 18f;
58934 }
58935 if (itemWidth >= 52)
58936 {
58937 num3 = 24f;
58938 }
58939 if (itemWidth >= 64)
58940 {
58941 num3 = 28f;
58942 }
58943 if (itemWidth >= 92)
58944 {
58945 num3 = 38f;
58946 }
58947 zero.X = base.Center.X - ((float)itemWidth * 0.5f - num3) * (float)aimDir;
58948 num3 = 10f;
58949 if (itemHeight > 32)
58950 {
58951 num3 = 10f;
58952 }
58953 if (itemHeight > 52)
58954 {
58955 num3 = 12f;
58956 }
58957 if (itemHeight > 64)
58958 {
58959 num3 = 14f;
58960 }
58961 zero.Y = position.Y + num3;
58962 }
58963 float item = ((float)swingCurrent / (float)swingMax - 0.5f) * (float)(-aimDir) * 3.5f - (float)aimDir * 0.3f;
58964 return Tuple.Create(zero, item);
58965 }

References System.item, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.NPC.AI_007_TownEntities().