public override void NPCLoot(NPC npc)
        {
            if (npc.type == NPCID.QueenBee && Main.rand.Next(3) == 0)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("BeeBattlerod"));
            }

            if (npc.type == NPCID.DukeFishron && Main.rand.Next(5) == 0)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("FishronBattlerod"));
            }

            if (npc.wet && !npc.lavaWet && !npc.honeyWet && isHooked != 0 && Main.rand.Next(50) == 0)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("RustyHook"));
            }

            for (int i = 0; i < Main.projectile.Length; i++)
            {
                if (Main.projectile[i].active && Main.projectile[i].modProjectile != null)
                {
                    Bobber b = Main.projectile[i].modProjectile as Bobber;
                    if (b != null && b.getStuckEntity() is NPC && b.getStuckEntity().whoAmI == npc.whoAmI)
                    {
                        FishPlayer p = Main.player[b.projectile.owner].GetModPlayer <FishPlayer>(mod);
                        if (Main.rand.Next(10000) < p.cratePercent)
                        {
                            int itmID = ItemID.WoodenCrate;
                            if (Main.rand.Next(6) == 0)
                            {
                                itmID = ItemID.IronCrate;
                            }
                            else if (Main.rand.Next(24) == 0)
                            {
                                itmID = ItemID.GoldenCrate;
                            }
                            if (itmID == ItemID.WoodenCrate)
                            {
                                p.replaceWithRodCrate(p.player.inventory[p.player.selectedItem], -1, ref itmID);
                            }
                            Item.NewItem(npc.Center, Vector2.Zero, itmID);
                        }
                    }
                }
            }
            base.NPCLoot(npc);
        }
Exemplo n.º 2
0
        public override void NPCLoot(NPC npc)
        {
            if (npc.type == NPCID.DD2Betsy)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("BetsyScales"), Main.rand.Next(3, 7));
            }
            if (npc.type == NPCID.GoblinSummoner)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("Shadowflame"), Main.rand.Next(1, 4));
            }
            if (npc.type == NPCID.QueenBee && Main.rand.Next(3) == 0)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("BeeBattlerod"));
            }

            if (npc.type == NPCID.DukeFishron && Main.rand.Next(5) == 0)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("FishronBattlerod"));
            }

            if (npc.type == NPCID.SnowFlinx && (!Main.hardMode || Main.rand.Next(8) == 0))
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("FlinxFur"));
            }

            if (Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)].ZoneGlowshroom && ((!Main.hardMode && Main.rand.Next(3) == 0) || Main.rand.Next(15) == 0))
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("FungalSpores"), Main.rand.Next(1, 6));
            }

            if (npc.wet && !npc.lavaWet && !npc.honeyWet && isHooked != 0 && Main.rand.Next(50) == 0)
            {
                Item.NewItem(npc.Center, Vector2.Zero, mod.ItemType("RustyHook"));
            }

            for (int i = 0; i < Main.projectile.Length; i++)
            {
                if (Main.projectile[i].active && Main.projectile[i].modProjectile != null)
                {
                    Bobber b = Main.projectile[i].modProjectile as Bobber;
                    if (b != null && b.getStuckEntity() is NPC && b.getStuckEntity().whoAmI == npc.whoAmI)
                    {
                        FishPlayer p = Main.player[b.projectile.owner].GetModPlayer <FishPlayer>(mod);
                        if (Main.rand.Next(10000) < p.cratePercent)
                        {
                            int itmID = ItemID.WoodenCrate;
                            if (Main.rand.Next(6) == 0)
                            {
                                itmID = ItemID.IronCrate;
                            }
                            else if (Main.rand.Next(24) == 0)
                            {
                                itmID = ItemID.GoldenCrate;
                            }
                            if (itmID == ItemID.WoodenCrate)
                            {
                                p.replaceWithRodCrate(p.player.inventory[p.player.selectedItem], -1, ref itmID);
                            }
                            Item.NewItem(npc.Center, Vector2.Zero, itmID);
                        }
                    }
                }
            }
            base.NPCLoot(npc);
        }