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

◆ Shimmer()

void Terraria.Projectile.Shimmer ( )
inlineprivate

Definition at line 18715 of file Projectile.cs.

18716 {
18717 if (hostile || (aiStyle == 99 && ai[0] == -1f) || (aiStyle == 15 && (ai[0] == 2f || ai[0] == 4f)))
18718 {
18719 return;
18720 }
18721 if (type == 502)
18722 {
18723 velocity.Y -= 0.4f;
18724 timeLeft -= 5;
18725 }
18726 else if (type == 469 || type == 181)
18727 {
18728 velocity.Y -= 0.2f;
18729 if (type == 469 && velocity.Y < 0f)
18730 {
18731 Kill();
18732 }
18733 }
18734 else if (type == 819 || type == 117 || type == 474 || type == 225 || type == 103 || type == 2 || type == 82 || type == 120 || type == 172 || type == 41 || type == 91 || type == 278 || type == 5 || type == 639 || type == 631 || type == 495 || type == 4 || type == 282 || type == 1 || type == 81)
18735 {
18736 velocity.Y -= 0.4f;
18737 }
18738 else if (aiStyle == 1 || aiStyle == 16 || aiStyle == 40)
18739 {
18740 int num = (int)(base.Center.X / 16f);
18741 int num2 = (int)(position.Y / 16f);
18742 if (WorldGen.InWorld(num, num2) && Main.tile[num, num2] != null && Main.tile[num, num2].liquid == byte.MaxValue && Main.tile[num, num2].shimmer() && WorldGen.InWorld(num, num2 - 1) && Main.tile[num, num2 - 1] != null && Main.tile[num, num2 - 1].liquid > 0 && Main.tile[num, num2 - 1].shimmer())
18743 {
18744 Kill();
18745 }
18746 else if (velocity.Y > 0f)
18747 {
18748 velocity.Y *= -1f;
18749 netUpdate = true;
18750 if (timeLeft > 600)
18751 {
18752 timeLeft = 600;
18753 }
18754 timeLeft -= 60;
18755 shimmerWet = false;
18756 wet = false;
18757 }
18758 }
18759 else if (aiStyle == 5 || aiStyle == 8 || aiStyle == 21 || aiStyle == 28 || aiStyle == 29 || aiStyle == 33 || aiStyle == 36 || aiStyle == 47 || aiStyle == 93 || aiStyle == 115 || aiStyle == 151 || aiStyle == 152)
18760 {
18761 int num3 = (int)(base.Center.X / 16f);
18762 int num4 = (int)(position.Y / 16f);
18763 if (WorldGen.InWorld(num3, num4) && Main.tile[num3, num4] != null && Main.tile[num3, num4].liquid == byte.MaxValue && Main.tile[num3, num4].shimmer() && WorldGen.InWorld(num3, num4 - 1) && Main.tile[num3, num4 - 1] != null && Main.tile[num3, num4 - 1].liquid > 0 && Main.tile[num3, num4 - 1].shimmer())
18764 {
18765 Kill();
18766 }
18767 else if (velocity.Y > 0f)
18768 {
18769 velocity.Y *= -1f;
18770 netUpdate = true;
18771 shimmerWet = false;
18772 wet = false;
18773 }
18774 }
18775 else if (aiStyle == 15)
18776 {
18777 if (velocity.Y > 0f)
18778 {
18779 velocity.Y *= -1f;
18780 netUpdate = true;
18781 }
18782 velocity.Y -= 0.4f;
18783 if (velocity.Y < -8f)
18784 {
18785 velocity.Y = -8f;
18786 }
18787 }
18788 else if (aiStyle == 99)
18789 {
18790 if (velocity.Y > 0f)
18791 {
18792 velocity.Y *= -1f;
18793 netUpdate = true;
18794 shimmerWet = false;
18795 wet = false;
18796 }
18797 if (velocity.Y > -8f)
18798 {
18799 velocity.Y = -8f;
18800 }
18801 }
18802 else if (aiStyle == 7 || aiStyle == 9 || aiStyle == 13 || aiStyle == 35 || aiStyle == 53 || aiStyle == 130 || aiStyle == 134 || aiStyle == 137 || aiStyle == 138 || aiStyle == 149 || aiStyle == 160)
18803 {
18804 Kill();
18805 }
18806 else if (aiStyle == 2)
18807 {
18808 velocity.Y -= 0.7f;
18809 if (type == 936 && !NPC.unlockedSlimeRainbowSpawn && velocity.Y < 0f)
18810 {
18811 if (timeLeft > 5)
18812 {
18813 timeLeft = 5;
18814 }
18815 if (Main.netMode != 1)
18816 {
18817 NPC.unlockedSlimeRainbowSpawn = true;
18818 NetMessage.SendData(7);
18819 int num5 = NPC.NewNPC(GetNPCSource_FromThis(), (int)base.Center.X + 4, (int)base.Center.Y, 681);
18820 NPC obj = Main.npc[num5];
18821 obj.velocity = velocity;
18822 obj.netUpdate = true;
18823 WorldGen.CheckAchievement_RealEstateAndTownSlimes();
18824 }
18825 }
18826 else
18827 {
18828 timeLeft -= 20;
18829 }
18830 }
18831 else if (aiStyle == 14 || aiStyle == 16)
18832 {
18833 if (timeLeft > 3000)
18834 {
18835 timeLeft -= 60;
18836 }
18837 velocity.Y -= 0.5f;
18838 }
18839 else if (aiStyle == 25 || aiStyle == 17)
18840 {
18841 if (velocity.Y > 10f)
18842 {
18843 velocity.Y *= 0.97f;
18844 }
18845 velocity.Y -= 0.7f;
18846 if (velocity.Y < -10f)
18847 {
18848 velocity.Y = -10f;
18849 }
18850 }
18851 }
bool shimmerWet
Definition Entity.cs:32
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
IEntitySource GetNPCSource_FromThis()

References Terraria.Projectile.ai, Terraria.Projectile.aiStyle, Terraria.WorldGen.CheckAchievement_RealEstateAndTownSlimes(), Terraria.Projectile.GetNPCSource_FromThis(), Terraria.Projectile.hostile, Terraria.WorldGen.InWorld(), Terraria.Projectile.Kill(), Terraria.Main.netMode, Terraria.Projectile.netUpdate, Terraria.NPC.NewNPC(), Terraria.Main.npc, System.obj, Terraria.Entity.position, Terraria.NetMessage.SendData(), Terraria.Entity.shimmerWet, Terraria.Main.tile, Terraria.Projectile.timeLeft, Terraria.Projectile.type, Terraria.NPC.unlockedSlimeRainbowSpawn, Terraria.Entity.velocity, Terraria.Entity.wet, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Projectile.Update().