예제 #1
0
 ///<summary>pronounced "fit"</summary>
 public static void PHit(Projectile proj, Player targ, int damg)
 {
     if (!proj.tileCollide)
     {
         targ.velocity = lerp(new Vector2(), targ.velocity, 0.85f);
         targ.AddBuff(BuffType <WaterDebuff>(), 450);
     }
     else
     {
         Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 704, 1f);
         Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 705, 1f);
         Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 705, 1f);
         for (int i = 0; i < 19; i++)
         {
             Dust a = Dust.NewDustDirect(proj.Center, 0, 0, Dust.dustWater());
             a.velocity.Y -= 1f;
             a.velocity   *= 3;
         }
         Main.PlaySound(2, proj.Center, 107);
         Rectangle HB = proj.Hitbox;
         HB.Inflate(HB.Width * 3, HB.Height * 3);
         proj.Hitbox      = HB;
         proj.timeLeft    = 2;
         proj.tileCollide = false;
         proj.penetrate   = -1;
         proj.damage      = (int)(proj.damage / 1.5f);
         proj.hostile     = true;
     }
 }
예제 #2
0
 public static void PNPC(Projectile proj, NPC targ, int damg, bool crit)
 {
     if (!proj.tileCollide)
     {
         targ.velocity = lerp(new Vector2(), targ.velocity, 1 - constrain(targ.knockBackResist * 1.25f, 0.1f, 1f));
         targ.AddBuff(BuffType <WaterDebuff>(), targ.boss?10:60);
     }
     else
     {
         Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 704, 1f);
         Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 705, 1f);
         Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 705, 1f);
         for (int i = 0; i < 19; i++)
         {
             Dust a = Dust.NewDustDirect(proj.Center, 0, 0, Dust.dustWater());
             a.velocity.Y -= 2.5f;
             a.velocity   *= 3;
         }
         Main.PlaySound(2, proj.Center, 107);
         Rectangle HB = proj.Hitbox;
         HB.Inflate(HB.Width * 3, HB.Height * 3);
         proj.Hitbox      = HB;
         proj.timeLeft    = 2;
         proj.tileCollide = false;
         proj.penetrate   = -1;
         proj.damage      = (int)(proj.damage / 1.5f);
         proj.hostile     = true;
     }
 }
예제 #3
0
        public static bool PColl(Projectile proj)
        {
            if (!proj.tileCollide)
            {
                return(true);
            }
            Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 704, 1f);
            Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 705, 1f);
            Gore.NewGore(proj.Center, -proj.oldVelocity * 0.2f, 705, 1f);
            for (int i = 0; i < 19; i++)
            {
                Dust a = Dust.NewDustDirect(proj.Center, 0, 0, Dust.dustWater());
                a.velocity.Y -= 2.5f;
                a.velocity   *= 3;
            }
            Main.PlaySound(2, proj.Center, 107);
            Rectangle HB = proj.Hitbox;

            HB.Inflate(HB.Width * 3, HB.Height * 3);
            proj.Hitbox      = HB;
            proj.timeLeft    = 2;
            proj.tileCollide = false;
            proj.penetrate   = -1;
            proj.damage      = (int)(proj.damage / 1.5f);
            proj.hostile     = true;
            return(false);
        }
        public override void AI()
        {
            int num13 = 6;

            if (projectile.timeLeft <= 3)
            {
                projectile.tileCollide = false;
                projectile.ai[1]       = 0f;
                projectile.alpha       = 255;
            }
            else
            {
                if (Math.Abs(projectile.velocity.X) >= 8f || Math.Abs(projectile.velocity.Y) >= 8f)
                {
                    for (int n = 0; n < 2; n++)
                    {
                        float num28 = 0f;
                        float num29 = 0f;

                        if (n == 1)
                        {
                            num28 = projectile.velocity.X * 0.5f;
                            num29 = projectile.velocity.Y * 0.5f;
                        }

                        int num30 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num28, projectile.position.Y + 3f + num29) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, num13, 0f, 0f, 100);

                        Main.dust[num30].scale    *= 2f + Main.rand.Next(10) * 0.1f;
                        Main.dust[num30].velocity *= 0.2f;
                        Main.dust[num30].noGravity = true;

                        if (Main.dust[num30].type == 152)
                        {
                            Main.dust[num30].scale    *= 0.5f;
                            Main.dust[num30].velocity += projectile.velocity * 0.1f;
                        }
                        else if (Main.dust[num30].type == 35)
                        {
                            Main.dust[num30].scale    *= 0.5f;
                            Main.dust[num30].velocity += projectile.velocity * 0.1f;
                        }
                        else if (Main.dust[num30].type == Dust.dustWater())
                        {
                            Main.dust[num30].scale    *= 0.65f;
                            Main.dust[num30].velocity += projectile.velocity * 0.1f;
                        }

                        num30 = Dust.NewDust(new Vector2(projectile.position.X + 3f + num28, projectile.position.Y + 3f + num29) - projectile.velocity * 0.5f, projectile.width - 8, projectile.height - 8, 31, 0f, 0f, 100, default, 0.5f);
예제 #5
0
 public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
 {
     for (int i = 0; i < 6; i++)
     {
         Vector2 offset = new Vector2(0, Main.rand.NextFloat(0, projectile.height / 2));
         offset = offset.RotatedByRandom(180);
         int a = Dust.NewDust(projectile.Center + offset, 0, 0, Main.rand.Next(new int[] { 29, 33, Dust.dustWater() }), Scale: 0.8f);
         Main.dust[a].velocity = projectile.velocity / 2;
     }
     return(false);
 }
예제 #6
0
        public static void UpdateItem(Item thisItem, int i)
        {
            if (Main.itemLockoutTime[i] > 0)
            {
                Main.itemLockoutTime[i]--;
                return;
            }

            if (!thisItem.active)
            {
                return;
            }
            if (thisItem.instanced)
            {
                if (Main.netMode == NetmodeID.Server)
                {
                    thisItem.active = false;
                    return;
                }
                thisItem.keepTime = 600;
            }
            if (Main.netMode == NetmodeID.SinglePlayer)
            {
                thisItem.owner = Main.myPlayer;
            }
            float num  = 0.1f;
            float num2 = 7f;

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                int num3 = (int)(thisItem.position.X + (float)(thisItem.width / 2)) / 16;
                int num4 = (int)(thisItem.position.Y + (float)(thisItem.height / 2)) / 16;
                if (num3 >= 0 && num4 >= 0 && num3 < Main.maxTilesX && num4 < Main.maxTilesY && Main.tile[num3, num4] == null)
                {
                    num = 0f;
                    thisItem.velocity.X = 0f;
                    thisItem.velocity.Y = 0f;
                }
            }
            if (thisItem.honeyWet)
            {
                num  = 0.05f;
                num2 = 3f;
            }
            else if (thisItem.wet)
            {
                num2 = 5f;
                num  = 0.08f;
            }
            if (thisItem.ownTime > 0)
            {
                thisItem.ownTime--;
            }
            else
            {
                thisItem.ownIgnore = -1;
            }
            if (thisItem.keepTime > 0)
            {
                thisItem.keepTime--;
            }
            if (thisItem.beingGrabbed)
            {
                thisItem.isBeingGrabbed = true;
            }
            else
            {
                thisItem.isBeingGrabbed = false;
            }
            Vector2 vector = thisItem.velocity * 0.5f;

            if (!thisItem.beingGrabbed)
            {
                bool flag = true;
                if (thisItem.type - 71 <= 3)
                {
                    flag = false;
                }
                if (ItemID.Sets.NebulaPickup[thisItem.type])
                {
                    flag = false;
                }
                if (thisItem.owner == Main.myPlayer && flag && (thisItem.createTile >= TileID.Dirt || thisItem.createWall > 0 || (thisItem.ammo > 0 && !thisItem.notAmmo) || thisItem.consumable || thisItem.type >= ItemID.EmptyBucket && thisItem.type <= ItemID.LavaBucket || thisItem.type == ItemID.HoneyBucket || thisItem.type == ItemID.Wire || thisItem.dye > 0 || thisItem.paint > 0 || thisItem.material) && thisItem.stack < thisItem.maxStack)
                {
                    for (int j = i + 1; j < 400; j++)
                    {
                        if (Main.item[j].active && thisItem.IsTheSameAs(Main.item[j]) && Main.item[j].stack > 0 && Main.item[j].owner == thisItem.owner && Math.Abs(thisItem.position.X + (float)(thisItem.width / 2) - (Main.item[j].position.X + (float)(Main.item[j].width / 2))) + Math.Abs(thisItem.position.Y + (float)(thisItem.height / 2) - (Main.item[j].position.Y + (float)(Main.item[j].height / 2))) < 30f)
                        {
                            thisItem.position = (thisItem.position + Main.item[j].position) / 2f;
                            thisItem.velocity = (thisItem.velocity + Main.item[j].velocity) / 2f;
                            int num5 = Main.item[j].stack;
                            if (num5 > thisItem.maxStack - thisItem.stack)
                            {
                                num5 = thisItem.maxStack - thisItem.stack;
                            }
                            Main.item[j].stack -= num5;
                            thisItem.stack     += num5;
                            if (Main.item[j].stack <= 0)
                            {
                                Main.item[j].SetDefaults(0, false);
                                Main.item[j].active = false;
                            }
                            if (Main.netMode != NetmodeID.SinglePlayer && thisItem.owner == Main.myPlayer)
                            {
                                NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                                NetMessage.SendData(MessageID.SyncItem, -1, -1, null, j, 0f, 0f, 0f, 0, 0, 0);
                            }
                        }
                    }
                }
                if (Main.netMode != NetmodeID.Server && Main.expertMode && thisItem.owner == Main.myPlayer && thisItem.type >= ItemID.CopperCoin && thisItem.type <= ItemID.PlatinumCoin)
                {
                    Rectangle rectangle = new Rectangle((int)thisItem.position.X, (int)thisItem.position.Y, thisItem.width, thisItem.height);
                    for (int k = 0; k < 200; k++)
                    {
                        if (Main.npc[k].active && Main.npc[k].lifeMax > 5 && !Main.npc[k].friendly && !Main.npc[k].immortal && !Main.npc[k].dontTakeDamage)
                        {
                            float num6 = (float)thisItem.stack;
                            float num7 = 1f;
                            if (thisItem.type == ItemID.SilverCoin)
                            {
                                num7 = 100f;
                            }
                            if (thisItem.type == ItemID.GoldCoin)
                            {
                                num7 = 10000f;
                            }
                            if (thisItem.type == ItemID.PlatinumCoin)
                            {
                                num7 = 1000000f;
                            }
                            num6 *= num7;
                            float extraValue = Main.npc[k].extraValue;
                            int   num8       = Main.npc[k].realLife;
                            if (num8 >= 0 && Main.npc[num8].active)
                            {
                                extraValue = Main.npc[num8].extraValue;
                            }
                            else
                            {
                                num8 = -1;
                            }
                            if (extraValue < num6)
                            {
                                Rectangle rectangle2 = new Rectangle((int)Main.npc[k].position.X, (int)Main.npc[k].position.Y, Main.npc[k].width, Main.npc[k].height);
                                if (rectangle.Intersects(rectangle2))
                                {
                                    float num9 = (float)Main.rand.Next(50, 76) * 0.01f;
                                    if (thisItem.type == ItemID.CopperCoin)
                                    {
                                        num9 += (float)Main.rand.Next(51) * 0.01f;
                                    }
                                    if (thisItem.type == ItemID.SilverCoin)
                                    {
                                        num9 += (float)Main.rand.Next(26) * 0.01f;
                                    }
                                    if (num9 > 1f)
                                    {
                                        num9 = 1f;
                                    }
                                    int num10 = (int)((float)thisItem.stack * num9);
                                    if (num10 < 1)
                                    {
                                        num10 = 1;
                                    }
                                    if (num10 > thisItem.stack)
                                    {
                                        num10 = thisItem.stack;
                                    }
                                    thisItem.stack -= num10;
                                    float num11 = (float)num10 * num7;
                                    int   num12 = k;
                                    if (num8 >= 0)
                                    {
                                        num12 = num8;
                                    }
                                    Main.npc[num12].extraValue += num11;
                                    if (Main.netMode == NetmodeID.SinglePlayer)
                                    {
                                        Main.npc[num12].moneyPing(thisItem.position);
                                    }
                                    else
                                    {
                                        NetMessage.SendData(MessageID.SyncExtraValue, -1, -1, null, num12, num11, thisItem.position.X, thisItem.position.Y, 0, 0, 0);
                                    }
                                    if (thisItem.stack <= 0)
                                    {
                                        thisItem.SetDefaults(0, false);
                                        thisItem.active = false;
                                    }
                                    NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                                }
                            }
                        }
                    }
                }
                ItemLoader.Update(thisItem, ref num, ref num2);
                if (ItemID.Sets.ItemNoGravity[thisItem.type])
                {
                    thisItem.velocity.X = thisItem.velocity.X * 0.95f;
                    if ((double)thisItem.velocity.X < 0.1 && (double)thisItem.velocity.X > -0.1)
                    {
                        thisItem.velocity.X = 0f;
                    }
                    thisItem.velocity.Y = thisItem.velocity.Y * 0.95f;
                    if ((double)thisItem.velocity.Y < 0.1 && (double)thisItem.velocity.Y > -0.1)
                    {
                        thisItem.velocity.Y = 0f;
                    }
                }
                else
                {
                    thisItem.velocity.Y = thisItem.velocity.Y + num;
                    if (thisItem.velocity.Y > num2)
                    {
                        thisItem.velocity.Y = num2;
                    }
                    thisItem.velocity.X = thisItem.velocity.X * 0.95f;
                    if ((double)thisItem.velocity.X < 0.1 && (double)thisItem.velocity.X > -0.1)
                    {
                        thisItem.velocity.X = 0f;
                    }
                }
                bool flag2 = Collision.LavaCollision(thisItem.position, thisItem.width, thisItem.height);
                if (flag2)
                {
                    thisItem.lavaWet = true;
                }
                bool flag3 = Collision.WetCollision(thisItem.position, thisItem.width, thisItem.height);
                if (Collision.honey)
                {
                    thisItem.honeyWet = true;
                }
                if (flag3)
                {
                    if (!thisItem.wet)
                    {
                        if (thisItem.wetCount == 0)
                        {
                            thisItem.wetCount = 20;
                            if (!flag2)
                            {
                                if (thisItem.honeyWet)
                                {
                                    for (int l = 0; l < 5; l++)
                                    {
                                        int  num13 = Dust.NewDust(new Vector2(thisItem.position.X - 6f, thisItem.position.Y + (float)(thisItem.height / 2) - 8f), thisItem.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f);
                                        Dust dust  = Main.dust[num13];
                                        dust.velocity.Y = dust.velocity.Y - 1f;
                                        Dust dust2 = Main.dust[num13];
                                        dust2.velocity.X           = dust2.velocity.X * 2.5f;
                                        Main.dust[num13].scale     = 1.3f;
                                        Main.dust[num13].alpha     = 100;
                                        Main.dust[num13].noGravity = true;
                                    }
                                    Main.PlaySound(SoundID.Splash, (int)thisItem.position.X, (int)thisItem.position.Y, 1, 1f, 0f);
                                }
                                else
                                {
                                    for (int m = 0; m < 10; m++)
                                    {
                                        int  num14 = Dust.NewDust(new Vector2(thisItem.position.X - 6f, thisItem.position.Y + (float)(thisItem.height / 2) - 8f), thisItem.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
                                        Dust dust3 = Main.dust[num14];
                                        dust3.velocity.Y = dust3.velocity.Y - 4f;
                                        Dust dust4 = Main.dust[num14];
                                        dust4.velocity.X           = dust4.velocity.X * 2.5f;
                                        Main.dust[num14].scale    *= 0.8f;
                                        Main.dust[num14].alpha     = 100;
                                        Main.dust[num14].noGravity = true;
                                    }
                                    Main.PlaySound(SoundID.Splash, (int)thisItem.position.X, (int)thisItem.position.Y, 1, 1f, 0f);
                                }
                            }
                            else
                            {
                                for (int n = 0; n < 5; n++)
                                {
                                    int  num15 = Dust.NewDust(new Vector2(thisItem.position.X - 6f, thisItem.position.Y + (float)(thisItem.height / 2) - 8f), thisItem.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f);
                                    Dust dust5 = Main.dust[num15];
                                    dust5.velocity.Y = dust5.velocity.Y - 1.5f;
                                    Dust dust6 = Main.dust[num15];
                                    dust6.velocity.X           = dust6.velocity.X * 2.5f;
                                    Main.dust[num15].scale     = 1.3f;
                                    Main.dust[num15].alpha     = 100;
                                    Main.dust[num15].noGravity = true;
                                }
                                Main.PlaySound(SoundID.Splash, (int)thisItem.position.X, (int)thisItem.position.Y, 1, 1f, 0f);
                            }
                        }
                        thisItem.wet = true;
                    }
                }
                else if (thisItem.wet)
                {
                    thisItem.wet = false;
                    byte wetCount = thisItem.wetCount;
                }
                if (!thisItem.wet)
                {
                    thisItem.lavaWet  = false;
                    thisItem.honeyWet = false;
                }
                if (thisItem.wetCount > 0)
                {
                    thisItem.wetCount -= 1;
                }
                if (thisItem.wet)
                {
                    if (thisItem.wet)
                    {
                        Vector2 velocity = thisItem.velocity;
                        thisItem.velocity = Collision.TileCollision(thisItem.position, thisItem.velocity, thisItem.width, thisItem.height, false, false, 1);
                        if (thisItem.velocity.X != velocity.X)
                        {
                            vector.X = thisItem.velocity.X;
                        }
                        if (thisItem.velocity.Y != velocity.Y)
                        {
                            vector.Y = thisItem.velocity.Y;
                        }
                    }
                }
                else
                {
                    thisItem.velocity = Collision.TileCollision(thisItem.position, thisItem.velocity, thisItem.width, thisItem.height, false, false, 1);
                }
                Vector4 vector2 = Collision.SlopeCollision(thisItem.position, thisItem.velocity, thisItem.width, thisItem.height, num, false);
                thisItem.position.X = vector2.X;
                thisItem.position.Y = vector2.Y;
                thisItem.velocity.X = vector2.Z;
                thisItem.velocity.Y = vector2.W;
                Collision.StepConveyorBelt(thisItem, 1f);
                if (thisItem.lavaWet)
                {
                    if (thisItem.type == ItemID.GuideVoodooDoll)
                    {
                        if (Main.netMode != NetmodeID.MultiplayerClient)
                        {
                            thisItem.active = false;
                            thisItem.type   = ItemID.None;
                            thisItem.stack  = 0;
                            for (int num16 = 0; num16 < 200; num16++)
                            {
                                if (Main.npc[num16].active && Main.npc[num16].type == NPCID.Guide)
                                {
                                    if (Main.netMode == NetmodeID.Server)
                                    {
                                        NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, num16, 9999f, 10f, -(float)Main.npc[num16].direction, 0, 0, 0);
                                    }
                                    Main.npc[num16].StrikeNPCNoInteraction(9999, 10f, -Main.npc[num16].direction, false, false, false);
                                    NPC.SpawnWOF(thisItem.position);
                                }
                            }
                            NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                        }
                    }
                    else if (thisItem.owner == Main.myPlayer && thisItem.type != ItemID.FireblossomSeeds && thisItem.type != ItemID.Fireblossom && thisItem.type != ItemID.Obsidian && thisItem.type != ItemID.Hellstone && thisItem.type != ItemID.HellstoneBar && thisItem.type != ItemID.LivingFireBlock && thisItem.rare == ItemRarityID.White || ItemLoader.CanBurnInLava(thisItem))
                    {
                        thisItem.active = false;
                        thisItem.type   = ItemID.None;
                        thisItem.stack  = 0;
                        if (Main.netMode != NetmodeID.SinglePlayer)
                        {
                            NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                        }
                    }
                }
                if (thisItem.type == ItemID.EnchantedNightcrawler)
                {
                    float num17 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num17 *= (Main.essScale + 0.5f) / 2f;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.3f * num17, 0.1f * num17, 0.25f * num17);
                }
                else if (thisItem.type == ItemID.SoulofLight || thisItem.type == ItemID.NebulaPickup2)
                {
                    float num18 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num18 *= Main.essScale;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.5f * num18, 0.1f * num18, 0.25f * num18);
                }
                else if (thisItem.type == ItemID.SoulofNight || thisItem.type == ItemID.NebulaPickup3)
                {
                    float num19 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num19 *= Main.essScale;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.25f * num19, 0.1f * num19, 0.5f * num19);
                }
                else if (thisItem.type == ItemID.SoulofFright || thisItem.type == ItemID.NebulaPickup1)
                {
                    float num20 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num20 *= Main.essScale;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.5f * num20, 0.3f * num20, 0.05f * num20);
                }
                else if (thisItem.type == ItemID.SoulofMight)
                {
                    float num21 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num21 *= Main.essScale;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.1f * num21, 0.1f * num21, 0.6f * num21);
                }
                else if (thisItem.type == ItemID.SoulofFlight)
                {
                    float num22 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num22 *= Main.essScale;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.1f * num22, 0.3f * num22, 0.5f * num22);
                }
                else if (thisItem.type == ItemID.SoulofSight)
                {
                    float num23 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num23 *= Main.essScale;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.1f * num23, 0.5f * num23, 0.2f * num23);
                }
                else if (thisItem.type == ItemID.Heart || thisItem.type == ItemID.CandyApple || thisItem.type == ItemID.CandyCane)
                {
                    float num24 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num24 *= Main.essScale * 0.5f;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.5f * num24, 0.1f * num24, 0.1f * num24);
                }
                else if (thisItem.type == ItemID.Star || thisItem.type == ItemID.SoulCake || thisItem.type == ItemID.SugarPlum)
                {
                    float num25 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num25 *= Main.essScale * 0.5f;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.1f * num25, 0.1f * num25, 0.5f * num25);
                }
                else if (thisItem.type == ItemID.CursedFlame)
                {
                    float num26 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num26 *= Main.essScale * 0.2f;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.5f * num26, 1f * num26, 0.1f * num26);
                }
                else if (thisItem.type == ItemID.Ichor)
                {
                    float num27 = (float)Main.rand.Next(90, 111) * 0.01f;
                    num27 *= Main.essScale * 0.2f;
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 1f * num27, 1f * num27, 0.1f * num27);
                }
                else if (thisItem.type == ItemID.FragmentVortex)
                {
                    Lighting.AddLight(thisItem.Center, new Vector3(0.2f, 0.4f, 0.5f) * Main.essScale);
                }
                else if (thisItem.type == ItemID.FragmentNebula)
                {
                    Lighting.AddLight(thisItem.Center, new Vector3(0.4f, 0.2f, 0.5f) * Main.essScale);
                }
                else if (thisItem.type == ItemID.FragmentSolar)
                {
                    Lighting.AddLight(thisItem.Center, new Vector3(0.5f, 0.4f, 0.2f) * Main.essScale);
                }
                else if (thisItem.type == ItemID.FragmentStardust)
                {
                    Lighting.AddLight(thisItem.Center, new Vector3(0.2f, 0.2f, 0.5f) * Main.essScale);
                }
                if (thisItem.type == ItemID.FallenStar && Main.dayTime)
                {
                    for (int num28 = 0; num28 < 10; num28++)
                    {
                        Dust.NewDust(thisItem.position, thisItem.width, thisItem.height, 15, thisItem.velocity.X, thisItem.velocity.Y, 150, default(Color), 1.2f);
                    }
                    for (int num29 = 0; num29 < 3; num29++)
                    {
                        Gore.NewGore(thisItem.position, new Vector2(thisItem.velocity.X, thisItem.velocity.Y), Main.rand.Next(16, 18), 1f);
                    }
                    thisItem.active = false;
                    thisItem.type   = ItemID.None;
                    thisItem.stack  = 0;
                    if (Main.netMode == NetmodeID.Server)
                    {
                        NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                    }
                }
                if (thisItem.type == ItemID.DD2EnergyCrystal && !DD2Event.Ongoing)
                {
                    int num30 = Main.rand.Next(18, 24);
                    for (int num31 = 0; num31 < num30; num31++)
                    {
                        int num32 = Dust.NewDust(thisItem.Center, 0, 0, 61, 0f, 0f, 0, default(Color), 1.7f);
                        Main.dust[num32].velocity *= 8f;
                        Dust dust7 = Main.dust[num32];
                        dust7.velocity.Y           = dust7.velocity.Y - 1f;
                        Main.dust[num32].position  = Vector2.Lerp(Main.dust[num32].position, thisItem.Center, 0.5f);
                        Main.dust[num32].noGravity = true;
                        Main.dust[num32].noLight   = true;
                    }
                    thisItem.active = false;
                    thisItem.type   = ItemID.None;
                    thisItem.stack  = 0;
                    if (Main.netMode == NetmodeID.Server)
                    {
                        NetMessage.SendData(MessageID.SyncItem, -1, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                    }
                }
            }
            else
            {
                thisItem.beingGrabbed = false;
            }
            if (thisItem.type == ItemID.PixieDust)
            {
                if (Main.rand.Next(6) == 0)
                {
                    int num33 = Dust.NewDust(thisItem.position, thisItem.width, thisItem.height, 55, 0f, 0f, 200, thisItem.color, 1f);
                    Main.dust[num33].velocity *= 0.3f;
                    Main.dust[num33].scale    *= 0.5f;
                }
            }
            else if (thisItem.type == ItemID.DD2EnergyCrystal)
            {
                Lighting.AddLight(thisItem.Center, 0.1f, 0.3f, 0.1f);
            }
            else if (thisItem.type == ItemID.AmethystGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.75f, 0f, 0.75f);
            }
            else if (thisItem.type == ItemID.SapphireGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0f, 0f, 0.75f);
            }
            else if (thisItem.type == ItemID.TopazGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.75f, 0.75f, 0f);
            }
            else if (thisItem.type == ItemID.EmeraldGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0f, 0.75f, 0f);
            }
            else if (thisItem.type == ItemID.RubyGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.75f, 0f, 0f);
            }
            else if (thisItem.type == ItemID.DiamondGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.75f, 0.75f, 0.75f);
            }
            else if (thisItem.type == ItemID.AmberGemsparkBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.75f, 0.375f, 0f);
            }
            else if (thisItem.type == ItemID.AmethystGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.6f, 0f, 0.6f);
            }
            else if (thisItem.type == ItemID.SapphireGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0f, 0f, 0.6f);
            }
            else if (thisItem.type == ItemID.TopazGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.6f, 0.6f, 0f);
            }
            else if (thisItem.type == ItemID.EmeraldGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0f, 0.6f, 0f);
            }
            else if (thisItem.type == ItemID.RubyGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.6f, 0f, 0f);
            }
            else if (thisItem.type == ItemID.DiamondGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.6f, 0.6f, 0.6f);
            }
            else if (thisItem.type == ItemID.AmberGemsparkWall)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.6f, 0.375f, 0f);
            }
            else if (thisItem.type == ItemID.Torch || thisItem.type == ItemID.Candle)
            {
                if (!thisItem.wet)
                {
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 1f, 0.95f, 0.8f);
                }
            }
            else if (thisItem.type == ItemID.LivingFireBlock)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.7f, 0.65f, 0.55f);
            }
            else if (thisItem.type == ItemID.CursedTorch)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.85f, 1f, 0.7f);
            }
            else if (thisItem.type == ItemID.IceTorch)
            {
                if (!thisItem.wet)
                {
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.7f, 0.85f, 1f);
                }
            }
            else if (thisItem.type == ItemID.IchorTorch)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 1.25f, 1.25f, 0.8f);
            }
            else if (thisItem.type == ItemID.RainbowTorch)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f);
            }
            else if (thisItem.type == ItemID.BoneTorch)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.95f, 0.65f, 1.3f);
            }
            else if (thisItem.type == ItemID.UltrabrightTorch)
            {
                float r = 0.75f;
                float g = 1.3499999f;
                float b = 1.5f;
                if (!thisItem.wet)
                {
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), r, g, b);
                }
            }
            else if (thisItem.type >= ItemID.BlueTorch && thisItem.type <= ItemID.YellowTorch)
            {
                if (!thisItem.wet)
                {
                    float r2    = 0f;
                    float g2    = 0f;
                    float b2    = 0f;
                    int   num34 = thisItem.type - 426;
                    if (num34 == 1)
                    {
                        r2 = 0.1f;
                        g2 = 0.2f;
                        b2 = 1.1f;
                    }
                    if (num34 == 2)
                    {
                        r2 = 1f;
                        g2 = 0.1f;
                        b2 = 0.1f;
                    }
                    if (num34 == 3)
                    {
                        r2 = 0f;
                        g2 = 1f;
                        b2 = 0.1f;
                    }
                    if (num34 == 4)
                    {
                        r2 = 0.9f;
                        g2 = 0f;
                        b2 = 0.9f;
                    }
                    if (num34 == 5)
                    {
                        r2 = 1.3f;
                        g2 = 1.3f;
                        b2 = 1.3f;
                    }
                    if (num34 == 6)
                    {
                        r2 = 0.9f;
                        g2 = 0.9f;
                        b2 = 0f;
                    }
                    Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), r2, g2, b2);
                }
            }
            else if (thisItem.type == ItemID.NebulaAxe || thisItem.type == ItemID.NebulaChainsaw || thisItem.type == ItemID.NebulaDrill || thisItem.type == ItemID.NebulaHammer || thisItem.type == ItemID.NebulaPickaxe || thisItem.type == ItemID.NebulaHelmet || thisItem.type == ItemID.NebulaBreastplate || thisItem.type == ItemID.NebulaLeggings || thisItem.type == ItemID.LunarHamaxeNebula)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.4f, 0.16f, 0.36f);
            }
            else if (thisItem.type == ItemID.VortexAxe || thisItem.type == ItemID.VortexChainsaw || thisItem.type == ItemID.VortexDrill || thisItem.type == ItemID.VortexHammer || thisItem.type == ItemID.VortexPickaxe || thisItem.type == ItemID.VortexHelmet || thisItem.type == ItemID.VortexBreastplate || thisItem.type == ItemID.VortexLeggings || thisItem.type == ItemID.LunarHamaxeVortex)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0f, 0.36f, 0.4f);
            }
            else if (thisItem.type == ItemID.SolarFlareAxe || thisItem.type == ItemID.SolarFlareChainsaw || thisItem.type == ItemID.SolarFlareDrill || thisItem.type == ItemID.SolarFlareHammer || thisItem.type == ItemID.SolarFlarePickaxe || thisItem.type == ItemID.SolarFlareHelmet || thisItem.type == ItemID.SolarFlareBreastplate || thisItem.type == ItemID.SolarFlareLeggings || thisItem.type == ItemID.LunarHamaxeSolar)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)(thisItem.width / 2)) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.5f, 0.25f, 0.05f);
            }
            else if (thisItem.type == ItemID.StardustAxe || thisItem.type == ItemID.StardustChainsaw || thisItem.type == ItemID.StardustDrill || thisItem.type == ItemID.StardustHammer || thisItem.type == ItemID.StardustPickaxe || thisItem.type == ItemID.StardustHelmet || thisItem.type == ItemID.StardustBreastplate || thisItem.type == ItemID.StardustLeggings || thisItem.type == ItemID.LunarHamaxeStardust)
            {
                Lighting.AddLight(thisItem.Center, 0.3f, 0.3f, 0.2f);
            }
            else if (thisItem.type == ItemID.FlamingArrow)
            {
                if (!thisItem.wet)
                {
                    Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 1f, 0.75f, 0.55f);
                }
            }
            else if (thisItem.type == ItemID.FrostburnArrow)
            {
                if (!thisItem.wet)
                {
                    Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.35f, 0.65f, 1f);
                }
            }
            else if (thisItem.type == ItemID.Glowstick)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.7f, 1f, 0.8f);
            }
            else if (thisItem.type == ItemID.StickyGlowstick)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.7f, 0.8f, 1f);
            }
            else if (thisItem.type == ItemID.BouncyGlowstick)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 1f, 0.6f, 0.85f);
            }
            else if (thisItem.type == ItemID.SpelunkerGlowstick)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 1.05f, 0.95f, 0.55f);
            }
            else if (thisItem.type == ItemID.JungleSpores)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.55f, 0.75f, 0.6f);
            }
            else if (thisItem.type == ItemID.GlowingMushroom)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.15f, 0.45f, 0.9f);
            }
            else if (thisItem.type == ItemID.FallenStar)
            {
                Lighting.AddLight((int)((thisItem.position.X + (float)thisItem.width) / 16f), (int)((thisItem.position.Y + (float)(thisItem.height / 2)) / 16f), 0.8f, 0.7f, 0.1f);
            }
            if (thisItem.type == ItemID.FallenStar)
            {
                if (Main.rand.Next(25) == 0)
                {
                    Dust.NewDust(thisItem.position, thisItem.width, thisItem.height, 58, thisItem.velocity.X * 0.5f, thisItem.velocity.Y * 0.5f, 150, default(Color), 1.2f);
                }
                if (Main.rand.Next(50) == 0)
                {
                    Gore.NewGore(thisItem.position, new Vector2(thisItem.velocity.X * 0.2f, thisItem.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
                }
            }
            if (thisItem.spawnTime < 2147483646)
            {
                if (thisItem.type == ItemID.Heart || thisItem.type == ItemID.Star || thisItem.type == ItemID.CandyCane || thisItem.type == ItemID.SugarPlum || thisItem.type == ItemID.CandyApple || thisItem.type == ItemID.SoulCake)
                {
                    thisItem.spawnTime += 4;
                }
                thisItem.spawnTime++;
            }
            ItemLoader.PostUpdate(thisItem);
            if (Main.netMode == NetmodeID.Server && thisItem.owner != Main.myPlayer)
            {
                thisItem.release++;
                if (thisItem.release >= 300)
                {
                    thisItem.release = 0;
                    NetMessage.SendData(MessageID.ResetItemOwner, thisItem.owner, -1, null, i, 0f, 0f, 0f, 0, 0, 0);
                }
            }
            if (thisItem.wet)
            {
                thisItem.position += vector;
            }
            else
            {
                thisItem.position += thisItem.velocity;
            }
            if (thisItem.noGrabDelay > 0)
            {
                thisItem.noGrabDelay--;
            }
        }
예제 #7
0
        public override void AI()
        {
            Player player = Main.player[projectile.owner];

            projectile.timeLeft = 60;
            if (player.HeldItem.fishingPole == 0 || player.CCed || player.noItems || player.pulley || player.dead || !player.active || !player.GetModPlayer <JoostPlayer>().fishingSapling)
            {
                projectile.Kill();
            }
            if (projectile.ai[1] > 0f && projectile.localAI[1] >= 0f)
            {
                projectile.localAI[1] = -1f;
                if (!projectile.lavaWet && !projectile.honeyWet)
                {
                    for (int i = 0; i < 100; i++)
                    {
                        int  num  = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f), projectile.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
                        Dust dust = Main.dust[num];
                        dust.velocity.Y = dust.velocity.Y - 4f;
                        Dust dust2 = Main.dust[num];
                        dust2.velocity.X         = dust2.velocity.X * 2.5f;
                        Main.dust[num].scale     = 0.8f;
                        Main.dust[num].alpha     = 100;
                        Main.dust[num].noGravity = true;
                    }
                    Main.PlaySound(19, (int)projectile.position.X, (int)projectile.position.Y, 0, 1f, 0f);
                }
            }
            if (projectile.ai[0] >= 1f)
            {
                if (projectile.ai[0] == 2f)
                {
                    projectile.ai[0] += 1f;
                    Main.PlaySound(SoundID.Item17, projectile.position);
                    if (!projectile.lavaWet && !projectile.honeyWet)
                    {
                        for (int j = 0; j < 100; j++)
                        {
                            int  num2  = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f), projectile.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
                            Dust dust3 = Main.dust[num2];
                            dust3.velocity.Y = dust3.velocity.Y - 4f;
                            Dust dust4 = Main.dust[num2];
                            dust4.velocity.X          = dust4.velocity.X * 2.5f;
                            Main.dust[num2].scale     = 0.8f;
                            Main.dust[num2].alpha     = 100;
                            Main.dust[num2].noGravity = true;
                        }
                        Main.PlaySound(19, (int)projectile.position.X, (int)projectile.position.Y, 0, 1f, 0f);
                    }
                }
                if (projectile.localAI[0] < 100f)
                {
                    projectile.localAI[0] += 1f;
                }
                projectile.tileCollide = false;
                float num3 = 15.9f;
                int   num4 = 10;
                float num5 = player.Center.X - projectile.Center.X;
                float num6 = player.Center.Y - projectile.Center.Y;
                float num7 = (float)Math.Sqrt((double)(num5 * num5 + num6 * num6));
                if (num7 > 3000f)
                {
                    projectile.Kill();
                }
                num7  = num3 / num7;
                num5 *= num7;
                num6 *= num7;
                projectile.velocity.X = (projectile.velocity.X * (float)(num4 - 1) + num5) / (float)num4;
                projectile.velocity.Y = (projectile.velocity.Y * (float)(num4 - 1) + num6) / (float)num4;
                if (Main.myPlayer == projectile.owner)
                {
                    Rectangle rectangle = new Rectangle((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height);
                    Rectangle value     = new Rectangle((int)player.position.X, (int)player.position.Y, player.width, player.height);
                    if (rectangle.Intersects(value))
                    {
                        if (projectile.ai[1] > 0f)
                        {
                            int  num8 = (int)projectile.ai[1];
                            Item item = new Item();
                            item.SetDefaults(num8, false);
                            if (num8 == 3196)
                            {
                                int num9     = player.FishingLevel();
                                int minValue = (num9 / 20 + 3) / 2;
                                int num10    = (num9 / 10 + 6) / 2;
                                if (Main.rand.Next(50) < num9)
                                {
                                    num10++;
                                }
                                if (Main.rand.Next(100) < num9)
                                {
                                    num10++;
                                }
                                if (Main.rand.Next(150) < num9)
                                {
                                    num10++;
                                }
                                if (Main.rand.Next(200) < num9)
                                {
                                    num10++;
                                }
                                int stack = Main.rand.Next(minValue, num10 + 1);
                                item.stack = stack;
                            }
                            if (num8 == 3197)
                            {
                                int num11     = player.FishingLevel();
                                int minValue2 = (num11 / 4 + 15) / 2;
                                int num12     = (num11 / 2 + 30) / 2;
                                if (Main.rand.Next(50) < num11)
                                {
                                    num12 += 4;
                                }
                                if (Main.rand.Next(100) < num11)
                                {
                                    num12 += 4;
                                }
                                if (Main.rand.Next(150) < num11)
                                {
                                    num12 += 4;
                                }
                                if (Main.rand.Next(200) < num11)
                                {
                                    num12 += 4;
                                }
                                int stack2 = Main.rand.Next(minValue2, num12 + 1);
                                item.stack = stack2;
                            }
                            ItemLoader.CaughtFishStack(item);
                            item.newAndShiny = true;
                            Item item2 = player.GetItem(projectile.owner, item, false, false);
                            if (item2.stack > 0)
                            {
                                int number = Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, num8, 1, false, 0, true, false);
                                if (Main.netMode == 1)
                                {
                                    NetMessage.SendData(21, -1, -1, null, number, 1f, 0f, 0f, 0, 0, 0);
                                }
                            }
                            else
                            {
                                item.position.X = projectile.Center.X - (float)(item.width / 2);
                                item.position.Y = projectile.Center.Y - (float)(item.height / 2);
                                item.active     = true;
                                ItemText.NewText(item, 0, false, false);
                            }
                        }
                        projectile.Kill();
                    }
                }
                projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
                return;
            }
            bool  flag  = false;
            float num13 = player.Center.X - projectile.Center.X;
            float num14 = player.Center.Y - projectile.Center.Y;

            projectile.rotation = (float)Math.Atan2((double)num14, (double)num13) + 1.57f;
            float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14));

            if (num15 > 900f)
            {
                projectile.ai[0] = 1f;
            }
            if (projectile.wet)
            {
                projectile.rotation   = 0f;
                projectile.velocity.X = projectile.velocity.X * 0.9f;
                int   num16 = (int)(projectile.Center.X + (float)((projectile.width / 2 + 8) * projectile.direction)) / 16;
                int   num17 = (int)(projectile.Center.Y / 16f);
                float num18 = projectile.position.Y / 16f;
                int   num19 = (int)((projectile.position.Y + (float)projectile.height) / 16f);
                if (Main.tile[num16, num17] == null)
                {
                    Main.tile[num16, num17] = new Tile();
                }
                if (Main.tile[num16, num19] == null)
                {
                    Main.tile[num16, num19] = new Tile();
                }
                if (projectile.velocity.Y > 0f)
                {
                    projectile.velocity.Y = projectile.velocity.Y * 0.5f;
                }
                num16 = (int)(projectile.Center.X / 16f);
                num17 = (int)(projectile.Center.Y / 16f);
                float num20 = projectile.position.Y + (float)projectile.height;
                if (Main.tile[num16, num17 - 1] == null)
                {
                    Main.tile[num16, num17 - 1] = new Tile();
                }
                if (Main.tile[num16, num17] == null)
                {
                    Main.tile[num16, num17] = new Tile();
                }
                if (Main.tile[num16, num17 + 1] == null)
                {
                    Main.tile[num16, num17 + 1] = new Tile();
                }
                if (Main.tile[num16, num17 - 1].liquid > 0)
                {
                    num20  = (float)(num17 * 16);
                    num20 -= (float)(Main.tile[num16, num17 - 1].liquid / 16);
                }
                else if (Main.tile[num16, num17].liquid > 0)
                {
                    num20  = (float)((num17 + 1) * 16);
                    num20 -= (float)(Main.tile[num16, num17].liquid / 16);
                }
                else if (Main.tile[num16, num17 + 1].liquid > 0)
                {
                    num20  = (float)((num17 + 2) * 16);
                    num20 -= (float)(Main.tile[num16, num17 + 1].liquid / 16);
                }
                if (projectile.Center.Y > num20)
                {
                    projectile.velocity.Y = projectile.velocity.Y - 0.1f;
                    if (projectile.velocity.Y < -8f)
                    {
                        projectile.velocity.Y = -8f;
                    }
                    if (projectile.Center.Y + projectile.velocity.Y < num20)
                    {
                        projectile.velocity.Y = num20 - projectile.Center.Y;
                    }
                }
                else
                {
                    projectile.velocity.Y = num20 - projectile.Center.Y;
                }
                if ((double)projectile.velocity.Y >= -0.01 && (double)projectile.velocity.Y <= 0.01)
                {
                    flag = true;
                }
            }
            else
            {
                if (projectile.velocity.Y == 0f)
                {
                    projectile.velocity.X = projectile.velocity.X * 0.95f;
                }
                projectile.velocity.X = projectile.velocity.X * 0.98f;
                projectile.velocity.Y = projectile.velocity.Y + 0.2f;
                if (projectile.velocity.Y > 15.9f)
                {
                    projectile.velocity.Y = 15.9f;
                }
            }
            if (Main.myPlayer == projectile.owner)
            {
                int num21 = player.FishingLevel();
                if (num21 < 0 && num21 == -1)
                {
                    player.displayedFishingInfo = Language.GetTextValue("GameUI.FishingWarning");
                }
            }
            if (projectile.ai[1] != 0f)
            {
                flag = true;
            }
            if (flag)
            {
                if (projectile.ai[1] == 0f && Main.myPlayer == projectile.owner)
                {
                    int num22 = player.FishingLevel();
                    if (num22 == -9000)
                    {
                        projectile.localAI[1] += 5f;
                        projectile.localAI[1] += (float)Main.rand.Next(1, 3);
                        if (projectile.localAI[1] > 660f)
                        {
                            projectile.localAI[1] = 0f;
                            projectile.FishingCheck();
                            return;
                        }
                    }
                    else
                    {
                        if (Main.rand.Next(300) < num22)
                        {
                            projectile.localAI[1] += (float)Main.rand.Next(1, 3);
                        }
                        projectile.localAI[1] += (float)(num22 / 30);
                        projectile.localAI[1] += (float)Main.rand.Next(1, 3);
                        if (Main.rand.Next(60) == 0)
                        {
                            projectile.localAI[1] += 60f;
                        }
                        if (projectile.localAI[1] > 660f)
                        {
                            projectile.localAI[1] = 0f;
                            projectile.FishingCheck();
                            return;
                        }
                    }
                }
                else if (projectile.ai[1] < 0f)
                {
                    if (projectile.velocity.Y == 0f || (projectile.honeyWet && (double)projectile.velocity.Y >= -0.01 && (double)projectile.velocity.Y <= 0.01))
                    {
                        projectile.velocity.Y = (float)Main.rand.Next(100, 500) * 0.015f;
                        projectile.velocity.X = (float)Main.rand.Next(-100, 101) * 0.015f;
                        projectile.wet        = false;
                        projectile.lavaWet    = false;
                        projectile.honeyWet   = false;
                    }
                    projectile.ai[1] += (float)Main.rand.Next(1, 5);
                    if (projectile.ai[1] >= 0f)
                    {
                        projectile.ai[1]      = 0f;
                        projectile.localAI[1] = 0f;
                        projectile.netUpdate  = true;
                    }
                }
            }
            AutoFish();
            return;
        }
        public void ApplyLiquidMovement(CustomEntity ent, bool lavaWet, bool honeyWet)
        {
            var core = ent.Core;

            if (honeyWet)
            {
                if (!core.wet)
                {
                    if (core.wetCount == 0)
                    {
                        core.wetCount = 20;

                        var dustPos = new Vector2(core.position.X - 6f, core.position.Y + (float)(core.height / 2) - 8f);

                        if (!lavaWet)
                        {
                            if (core.honeyWet)
                            {
                                for (int i = 0; i < 5; i++)
                                {
                                    int  idx  = Dust.NewDust(dustPos, core.width + 12, 24, 152, 0f, 0f, 0, default(Color), 1f);
                                    Dust dust = Main.dust[idx];

                                    dust.velocity.Y = dust.velocity.Y - 1f;
                                    dust.velocity.X = dust.velocity.X * 2.5f;
                                    dust.scale      = 1.3f;
                                    dust.alpha      = 100;
                                    dust.noGravity  = true;
                                }
                            }
                            else
                            {
                                for (int i = 0; i < 10; i++)
                                {
                                    int  idx  = Dust.NewDust(dustPos, core.width + 12, 24, Dust.dustWater(), 0f, 0f, 0, default(Color), 1f);
                                    Dust dust = Main.dust[idx];

                                    dust.velocity.Y = dust.velocity.Y - 4f;
                                    dust.velocity.X = dust.velocity.X * 2.5f;
                                    dust.scale     *= 0.8f;
                                    dust.alpha      = 100;
                                    dust.noGravity  = true;
                                }
                            }
                        }
                        else
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                int  idx  = Dust.NewDust(dustPos, core.width + 12, 24, 35, 0f, 0f, 0, default(Color), 1f);
                                Dust dust = Main.dust[idx];

                                dust.velocity.Y = dust.velocity.Y - 1.5f;
                                dust.velocity.X = dust.velocity.X * 2.5f;
                                dust.scale      = 1.3f;
                                dust.alpha      = 100;
                                dust.noGravity  = true;
                            }
                        }

                        Main.PlaySound(19, (int)core.position.X, (int)core.position.Y, 1, 1f, 0f);
                    }

                    core.wet = true;
                }
            }
            else if (core.wet)
            {
                core.wet = false;
            }

            // Update wet state
            if (!core.wet)
            {
                core.lavaWet  = false;
                core.honeyWet = false;
            }
            if (core.wetCount > 0)
            {
                core.wetCount -= 1;
            }
        }