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

◆ Collision_WaterCollision()

bool Terraria.NPC.Collision_WaterCollision ( bool lava)
inlineprivate

Definition at line 89780 of file NPC.cs.

89781 {
89782 bool flag = false;
89783 if (type == 72 || aiStyle == 21 || aiStyle == 67 || type == 376 || type == 579 || type == 541 || (aiStyle == 7 && ai[0] == 25f))
89784 {
89785 flag = false;
89786 wetCount = 0;
89787 lava = false;
89788 }
89789 else
89790 {
89791 flag = Collision.WetCollision(position, width, height);
89792 if (Collision.honey)
89793 {
89794 honeyWet = true;
89795 }
89796 if (Collision.shimmer)
89797 {
89798 shimmerWet = true;
89799 AddBuff(353, 100);
89800 }
89801 }
89802 if (aiStyle == 116)
89803 {
89804 wetCount = 10;
89805 }
89806 if (flag)
89807 {
89808 if (onFire && !lavaWet && Main.netMode != 1)
89809 {
89810 for (int i = 0; i < maxBuffs; i++)
89811 {
89812 if (buffType[i] == 24)
89813 {
89814 DelBuff(i);
89815 }
89816 }
89817 }
89818 if (!wet && wetCount == 0)
89819 {
89820 wetCount = 10;
89821 if (!lava)
89822 {
89823 if (shimmerWet)
89824 {
89825 if (type != 617 && type != 616 && type != 625)
89826 {
89827 for (int j = 0; j < 30; j++)
89828 {
89829 int num = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
89830 Main.dust[num].velocity.Y -= 4f;
89831 Main.dust[num].velocity.X *= 2.5f;
89832 Main.dust[num].scale = 0.8f;
89833 Main.dust[num].noGravity = true;
89834 switch (Main.rand.Next(6))
89835 {
89836 case 0:
89837 Main.dust[num].color = new Color(255, 255, 210);
89838 break;
89839 case 1:
89840 Main.dust[num].color = new Color(190, 245, 255);
89841 break;
89842 case 2:
89843 Main.dust[num].color = new Color(255, 150, 255);
89844 break;
89845 default:
89846 Main.dust[num].color = new Color(190, 175, 255);
89847 break;
89848 }
89849 }
89850 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89851 {
89852 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 4);
89853 }
89854 }
89855 }
89856 else if (honeyWet)
89857 {
89858 for (int k = 0; k < 10; k++)
89859 {
89860 int num2 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
89861 Main.dust[num2].velocity.Y -= 1f;
89862 Main.dust[num2].velocity.X *= 2.5f;
89863 Main.dust[num2].scale = 1.3f;
89864 Main.dust[num2].alpha = 100;
89865 Main.dust[num2].noGravity = true;
89866 }
89867 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
89868 {
89869 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
89870 }
89871 }
89872 else if (type != 617 && type != 616 && type != 625)
89873 {
89874 for (int l = 0; l < 30; l++)
89875 {
89876 int num3 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
89877 Main.dust[num3].velocity.Y -= 4f;
89878 Main.dust[num3].velocity.X *= 2.5f;
89879 Main.dust[num3].scale *= 0.8f;
89880 Main.dust[num3].alpha = 100;
89881 Main.dust[num3].noGravity = true;
89882 }
89883 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89884 {
89885 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
89886 }
89887 }
89888 }
89889 else
89890 {
89891 for (int m = 0; m < 10; m++)
89892 {
89893 int num4 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
89894 Main.dust[num4].velocity.Y -= 1.5f;
89895 Main.dust[num4].velocity.X *= 2.5f;
89896 Main.dust[num4].scale = 1.3f;
89897 Main.dust[num4].alpha = 100;
89898 Main.dust[num4].noGravity = true;
89899 }
89900 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
89901 {
89902 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
89903 }
89904 }
89905 }
89906 wet = true;
89907 }
89908 else if (wet)
89909 {
89910 velocity.X *= 0.5f;
89911 wet = false;
89912 if (type == 620 && GetTargetData().Center.Y < base.Center.Y)
89913 {
89914 velocity.Y -= 8f;
89915 }
89916 if (wetCount == 0)
89917 {
89918 wetCount = 10;
89919 if (!lavaWet)
89920 {
89921 if (shimmerWet)
89922 {
89923 if (type != 617 && type != 616 && type != 625)
89924 {
89925 for (int n = 0; n < 30; n++)
89926 {
89927 int num5 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 308);
89928 Main.dust[num5].velocity.Y -= 4f;
89929 Main.dust[num5].velocity.X *= 2.5f;
89930 Main.dust[num5].scale = 0.8f;
89931 Main.dust[num5].noGravity = true;
89932 switch (Main.rand.Next(6))
89933 {
89934 case 0:
89935 Main.dust[num5].color = new Color(255, 255, 210);
89936 break;
89937 case 1:
89938 Main.dust[num5].color = new Color(190, 245, 255);
89939 break;
89940 case 2:
89941 Main.dust[num5].color = new Color(255, 150, 255);
89942 break;
89943 default:
89944 Main.dust[num5].color = new Color(190, 175, 255);
89945 break;
89946 }
89947 }
89948 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89949 {
89950 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 5);
89951 }
89952 }
89953 }
89954 else if (honeyWet)
89955 {
89956 for (int num6 = 0; num6 < 10; num6++)
89957 {
89958 int num7 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 152);
89959 Main.dust[num7].velocity.Y -= 1f;
89960 Main.dust[num7].velocity.X *= 2.5f;
89961 Main.dust[num7].scale = 1.3f;
89962 Main.dust[num7].alpha = 100;
89963 Main.dust[num7].noGravity = true;
89964 }
89965 if (aiStyle != 1 && type != 1 && type != 16 && type != 147 && type != 300 && type != 59 && aiStyle != 39 && !noGravity)
89966 {
89967 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
89968 }
89969 }
89970 else if (type != 617 && type != 616 && type != 625)
89971 {
89972 for (int num8 = 0; num8 < 30; num8++)
89973 {
89974 int num9 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, Dust.dustWater());
89975 Main.dust[num9].velocity.Y -= 4f;
89976 Main.dust[num9].velocity.X *= 2.5f;
89977 Main.dust[num9].scale *= 0.8f;
89978 Main.dust[num9].alpha = 100;
89979 Main.dust[num9].noGravity = true;
89980 }
89981 if ((type != 376 && type != 579 && aiStyle != 1 && type != 1 && type != 16 && type != 59 && type != 300 && aiStyle != 39 && aiStyle != 68 && type != 362 && type != 364 && type != 361 && type != 445 && !noGravity) || type == 615)
89982 {
89983 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y, 0);
89984 }
89985 }
89986 }
89987 else
89988 {
89989 for (int num10 = 0; num10 < 10; num10++)
89990 {
89991 int num11 = Dust.NewDust(new Vector2(position.X - 6f, position.Y + (float)(height / 2) - 8f), width + 12, 24, 35);
89992 Main.dust[num11].velocity.Y -= 1.5f;
89993 Main.dust[num11].velocity.X *= 2.5f;
89994 Main.dust[num11].scale = 1.3f;
89995 Main.dust[num11].alpha = 100;
89996 Main.dust[num11].noGravity = true;
89997 }
89998 if (aiStyle != 1 && type != 1 && type != 16 && type != 59 && type != 300 && aiStyle != 39 && !noGravity)
89999 {
90000 SoundEngine.PlaySound(19, (int)position.X, (int)position.Y);
90001 }
90002 }
90003 }
90004 }
90005 return lava;
90006 }
static void PlaySound(int type, Vector2 position, int style=1)
bool honeyWet
Definition Entity.cs:34
Vector2 Center
Definition Entity.cs:43
bool shimmerWet
Definition Entity.cs:32
Vector2 position
Definition Entity.cs:14
byte wetCount
Definition Entity.cs:36
static readonly int maxBuffs
Definition NPC.cs:211
int aiStyle
Definition NPC.cs:453
NPCAimedTarget GetTargetData(bool ignorePlayerTankPets=true)
Definition NPC.cs:864
bool noGravity
Definition NPC.cs:503
float[] ai
Definition NPC.cs:447
bool onFire
Definition NPC.cs:225
int type
Definition NPC.cs:445
void DelBuff(int buffIndex)
Definition NPC.cs:86824
int[] buffType
Definition NPC.cs:213
void AddBuff(int type, int time, bool quiet=false)
Definition NPC.cs:86746

References Microsoft.Xna.Framework.Graphics.Color, Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.Collision.honey, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.rand, Terraria.Collision.shimmer, System.type, Microsoft.Xna.Framework.Graphics.Vector2, and Terraria.Collision.WetCollision().