Beispiel #1
0
        public ModContentPromptLogic(Widget widget, Manifest mod, ModContent content, Action continueLoading)
        {
            var panel = widget.Get("CONTENT_PROMPT_PANEL");

            var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");
            var headerLines = !string.IsNullOrEmpty(content.InstallPromptMessage) ? content.InstallPromptMessage.Replace("\\n", "\n").Split('\n') : new string[0];
            var headerHeight = 0;
            foreach (var l in headerLines)
            {
                var line = (LabelWidget)headerTemplate.Clone();
                line.GetText = () => l;
                line.Bounds.Y += headerHeight;
                panel.AddChild(line);

                headerHeight += headerTemplate.Bounds.Height;
            }

            panel.Bounds.Height += headerHeight;
            panel.Bounds.Y -= headerHeight / 2;

            var advancedButton = panel.Get<ButtonWidget>("ADVANCED_BUTTON");
            advancedButton.Bounds.Y += headerHeight;
            advancedButton.OnClick = () =>
            {
                Ui.OpenWindow("CONTENT_PANEL", new WidgetArgs
                {
                    { "mod", mod },
                    { "content", content },
                    { "onCancel", Ui.CloseWindow }
                });
            };

            var quickButton = panel.Get<ButtonWidget>("QUICK_BUTTON");
            quickButton.IsVisible = () => !string.IsNullOrEmpty(content.QuickDownload);
            quickButton.Bounds.Y += headerHeight;
            quickButton.OnClick = () =>
            {
                var modFileSystem = new FileSystem.FileSystem(Game.Mods);
                modFileSystem.LoadFromManifest(mod);
                var downloadYaml = MiniYaml.Load(modFileSystem, content.Downloads, null);
                modFileSystem.UnmountAll();

                var download = downloadYaml.FirstOrDefault(n => n.Key == content.QuickDownload);
                if (download == null)
                    throw new InvalidOperationException("Mod QuickDownload `{0}` definition not found.".F(content.QuickDownload));

                Ui.OpenWindow("PACKAGE_DOWNLOAD_PANEL", new WidgetArgs
                {
                    { "download", new ModContent.ModDownload(download.Value) },
                    { "onSuccess", continueLoading }
                });
            };

            var backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.Bounds.Y += headerHeight;
            backButton.OnClick = Ui.CloseWindow;
            Game.RunAfterTick(Ui.ResetTooltips);
        }
Beispiel #2
0
        public ModContentLogic(Widget widget, Manifest mod, ModContent content, Action onCancel)
        {
            this.content = content;

            var panel = widget.Get("CONTENT_PANEL");

            var modFileSystem = new FileSystem.FileSystem(Game.Mods);
            modFileSystem.LoadFromManifest(mod);

            var sourceYaml = MiniYaml.Load(modFileSystem, content.Sources, null);
            foreach (var s in sourceYaml)
                sources.Add(s.Key, new ModContent.ModSource(s.Value));

            var downloadYaml = MiniYaml.Load(modFileSystem, content.Downloads, null);
            foreach (var d in downloadYaml)
                downloads.Add(d.Key, new ModContent.ModDownload(d.Value));

            modFileSystem.UnmountAll();

            scrollPanel = panel.Get<ScrollPanelWidget>("PACKAGES");
            template = scrollPanel.Get<ContainerWidget>("PACKAGE_TEMPLATE");

            var headerTemplate = panel.Get<LabelWidget>("HEADER_TEMPLATE");
            var headerLines = !string.IsNullOrEmpty(content.HeaderMessage) ? content.HeaderMessage.Replace("\\n", "\n").Split('\n') : new string[0];
            var headerHeight = 0;
            foreach (var l in headerLines)
            {
                var line = (LabelWidget)headerTemplate.Clone();
                line.GetText = () => l;
                line.Bounds.Y += headerHeight;
                panel.AddChild(line);

                headerHeight += headerTemplate.Bounds.Height;
            }

            panel.Bounds.Height += headerHeight;
            panel.Bounds.Y -= headerHeight / 2;
            scrollPanel.Bounds.Y += headerHeight;

            var discButton = panel.Get<ButtonWidget>("CHECK_DISC_BUTTON");
            discButton.Bounds.Y += headerHeight;
            discButton.IsVisible = () => discAvailable;

            discButton.OnClick = () => Ui.OpenWindow("DISC_INSTALL_PANEL", new WidgetArgs
            {
                { "afterInstall", () => { } },
                { "sources", sources },
                { "content", content }
            });

            var backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
            backButton.Bounds.Y += headerHeight;
            backButton.OnClick = () => { Ui.CloseWindow(); onCancel(); };

            PopulateContentList();
            Game.RunAfterTick(Ui.ResetTooltips);
        }
Beispiel #3
0
        public InstallFromDiscLogic(Widget widget, ModContent content, Dictionary<string, ModContent.ModSource> sources, Action afterInstall)
        {
            this.content = content;
            this.sources = sources;

            Log.AddChannel("install", "install.log");

            // this.afterInstall = afterInstall;
            panel = widget.Get("DISC_INSTALL_PANEL");

            titleLabel = panel.Get<LabelWidget>("TITLE");

            primaryButton = panel.Get<ButtonWidget>("PRIMARY_BUTTON");
            secondaryButton = panel.Get<ButtonWidget>("SECONDARY_BUTTON");

            // Progress view
            progressContainer = panel.Get("PROGRESS");
            progressContainer.IsVisible = () => visible == Mode.Progress;
            progressBar = panel.Get<ProgressBarWidget>("PROGRESS_BAR");
            progressLabel = panel.Get<LabelWidget>("PROGRESS_MESSAGE");
            progressLabel.IsVisible = () => visible == Mode.Progress;

            // Message view
            messageContainer = panel.Get("MESSAGE");
            messageContainer.IsVisible = () => visible == Mode.Message;
            messageLabel = messageContainer.Get<LabelWidget>("MESSAGE_MESSAGE");

            // List view
            listContainer = panel.Get("LIST");
            listContainer.IsVisible = () => visible == Mode.List;

            listPanel = listContainer.Get<ScrollPanelWidget>("LIST_PANEL");
            listHeaderTemplate = listPanel.Get("LIST_HEADER_TEMPLATE");
            listTemplate = listPanel.Get<LabelWidget>("LIST_TEMPLATE");
            listPanel.RemoveChildren();

            listLabel = listContainer.Get<LabelWidget>("LIST_MESSAGE");

            DetectContentDisks();
        }
Beispiel #4
0
        string FindSourcePath(ModContent.ModSource source, IEnumerable<string> volumes)
        {
            if (source.Type == ModContent.SourceType.Install)
            {
                if (source.RegistryKey == null)
                    return null;

                if (Platform.CurrentPlatform != PlatformType.Windows)
                    return null;

                var path = Microsoft.Win32.Registry.GetValue(source.RegistryKey, source.RegistryValue, null) as string;
                if (path == null)
                    return null;

                return IsValidSourcePath(path, source) ? path : null;
            }

            if (source.Type == ModContent.SourceType.Disc)
                foreach (var volume in volumes)
                    if (IsValidSourcePath(volume, source))
                        return volume;

            return null;
        }
Beispiel #5
0
        bool IsValidSourcePath(string path, ModContent.ModSource source)
        {
            try
            {
                foreach (var kv in source.IDFiles)
                {
                    var filePath = Path.Combine(path, kv.Key);
                    if (!File.Exists(filePath))
                        return false;

                    using (var fileStream = File.OpenRead(filePath))
                    using (var csp = SHA1.Create())
                    {
                        var hash = new string(csp.ComputeHash(fileStream).SelectMany(a => a.ToString("x2")).ToArray());
                        if (hash != kv.Value)
                            return false;
                    }
                }
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }
        public override void AI()
        {
            //the important part
            int ai1 = (int)projectile.ai[1];

            if (ai1 > -1 && ai1 < Main.maxProjectiles && Main.projectile[ai1].active && Main.projectile[ai1].type == ModContent.ProjectileType <SparklingDevi>())
            {
                if (projectile.timeLeft > 15)
                {
                    Vector2 offset = new Vector2(0, -275).RotatedBy(Math.PI / 4 * Main.projectile[ai1].spriteDirection);
                    projectile.Center   = Main.projectile[ai1].Center + offset;
                    projectile.rotation = (float)Math.PI / 4 * Main.projectile[ai1].spriteDirection - (float)Math.PI / 4;
                }
                else //swinging down
                {
                    projectile.rotation -= (float)Math.PI / 15 * Main.projectile[ai1].spriteDirection * 0.75f;
                    Vector2 offset = new Vector2(0, -275).RotatedBy(projectile.rotation + (float)Math.PI / 4);
                    projectile.Center = Main.projectile[ai1].Center + offset;
                }

                projectile.spriteDirection = -Main.projectile[ai1].spriteDirection;

                projectile.localAI[1] = Main.projectile[ai1].velocity.ToRotation();

                if (projectile.localAI[0] == 0)
                {
                    projectile.localAI[0] = 1;
                    MakeDust();
                    Main.PlaySound(SoundID.Item92, projectile.Center);
                }
            }
            else
            {
                projectile.Kill();
                return;
            }
        }
Beispiel #7
0
        public static void StructureGen(int xPosO, int yPosO, bool mirrored)
        {
            //Steam Heart

            /**
             * 0 = Do Nothing
             * 1 = Steam Rock
             * 2 = Steam Brick
             * 3 = Lava
             * 4 = Steam Ore
             * 9 = Kill tile
             * */


            for (int i = 0; i < _structureArray.GetLength(1); i++)
            {
                for (int j = 0; j < _structureArray.GetLength(0); j++)
                {
                    if (mirrored)
                    {
                        if (TileCheckSafe((int)(xPosO + _structureArray.GetLength(1) - i), (int)(yPosO + j)))
                        {
                            if (_structureArray[j, i] == 1)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j, ModContent.TileType <Tiles.SteamRock>(), true, true);
                            }
                            if (_structureArray[j, i] == 2)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j, 56, true, true);
                            }
                            if (_structureArray[j, i] == 3)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                Main.tile[xPosO + _structureArray.GetLength(1) - i, yPosO + j].lava(true);
                                Main.tile[xPosO + _structureArray.GetLength(1) - i, yPosO + j].liquid = 255;
                            }
                            if (_structureArray[j, i] == 4)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j, ModContent.TileType <SteamOreBlock>(), true, true);
                            }
                            if (_structureArray[j, i] == 9)
                            {
                                WorldGen.KillTile(xPosO + _structureArray.GetLength(1) - i, yPosO + j);
                            }
                        }
                    }
                    else
                    {
                        if (TileCheckSafe((int)(xPosO + i), (int)(yPosO + j)))
                        {
                            if (_structureArray[j, i] == 1)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + i, yPosO + j, ModContent.TileType <Tiles.SteamRock>(), true, true);
                            }
                            if (_structureArray[j, i] == 2)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + i, yPosO + j, 56, true, true);
                            }
                            if (_structureArray[j, i] == 3)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                Main.tile[xPosO + i, yPosO + j].lava(true);
                                Main.tile[xPosO + i, yPosO + j].liquid = 255;
                            }
                            if (_structureArray[j, i] == 4)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                                WorldGen.PlaceTile(xPosO + i, yPosO + j, ModContent.TileType <SteamOreBlock>(), true, true);
                            }
                            if (_structureArray[j, i] == 9)
                            {
                                WorldGen.KillTile(xPosO + i, yPosO + j);
                            }
                        }
                    }
                }
            }
        }
Beispiel #8
0
 public override void NPCLoot()
 {
     if (Main.rand.Next(30) == 1)
     {
         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType <FieryPendant>());
     }
     if (Main.rand.Next(25) == 1)
     {
         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType <Items.Accessory.FieryTrident>());
     }
 }
Beispiel #9
0
        private static void SaveExtraChests(BinaryWriter writer)
        {
            short numberOfChest = 0;

            for (int i = 1000; i < maxChest; i++)
            {
                Chest chest = Main.chest[i];
                if (chest != null)
                {
                    bool flag = false;
                    for (int j = chest.x; j <= chest.x + 1; j++)
                    {
                        for (int k = chest.y; k <= chest.y + 1; k++)
                        {
                            if (j < 0 || k < 0 || j >= Main.maxTilesX || k >= Main.maxTilesY)
                            {
                                flag = true;
                                break;
                            }

                            Tile tile = Main.tile[j, k];
                            if (!tile.active() || !Main.tileContainer[tile.type] && tile.type != ModContent.TileType <MysteryTile>())
                            {
                                flag = true;
                                break;
                            }
                        }
                    }

                    if (flag)
                    {
                        Main.chest[i] = null;
                    }
                    else
                    {
                        numberOfChest += 1;
                    }
                }
            }

            writer.Write(numberOfChest);
            writer.Write((short)40);
            for (int i = 1000; i < maxChest; i++)
            {
                Chest chest = Main.chest[i];
                if (chest != null)
                {
                    writer.Write(chest.x);
                    writer.Write(chest.y);
                    writer.Write(chest.name);
                    for (int l = 0; l < 40; l++)
                    {
                        Item item = chest.item[l];
                        if (item == null || item.modItem != null)
                        {
                            writer.Write((short)0);
                        }
                        else
                        {
                            if (item.stack > item.maxStack)
                            {
                                item.stack = item.maxStack;
                            }

                            if (item.stack < 0)
                            {
                                item.stack = 1;
                            }

                            writer.Write((short)item.stack);
                            if (item.stack > 0)
                            {
                                writer.Write(item.netID);
                                writer.Write(item.prefix);
                            }
                        }
                    }
                }
            }

            Console.Write($"Number of chest in this world {1000 + numberOfChest}");
        }
Beispiel #10
0
 public override bool PreKill(int timeLeft)
 {
     Projectile.NewProjectile(projectile.Center.X + 60, projectile.Center.Y + 60, Vector2.Zero.X, Vector2.Zero.Y, ModContent.ProjectileType <TerrorPlosion>(), 30, 0);
     return(true);
 }
Beispiel #11
0
        public override void Kill(int timeLeft)
        {
            Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 14f, 0f, ModContent.ProjectileType <SunBlast>(), projectile.damage, 0f, projectile.owner, 0f, 0f);
            Projectile.NewProjectile(projectile.position.X, projectile.position.Y, -14f, 0f, ModContent.ProjectileType <SunBlast>(), projectile.damage, 0f, projectile.owner, 0f, 0f);
            Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, 14f, ModContent.ProjectileType <SunBlast>(), projectile.damage, 0f, projectile.owner, 0f, 0f);
            Projectile.NewProjectile(projectile.position.X, projectile.position.Y, 0f, -14f, ModContent.ProjectileType <SunBlast>(), projectile.damage, 0f, projectile.owner, 0f, 0f);

            Main.PlaySound(2, (int)projectile.position.X, (int)projectile.position.Y, 14);
            projectile.position.X = projectile.position.X + (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y + (float)(projectile.height / 2);
            projectile.width      = 50;
            projectile.height     = 50;
            projectile.position.X = projectile.position.X - (float)(projectile.width / 2);
            projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2);

            for (int num621 = 0; num621 < 20; num621++)
            {
                int num622 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f);
                Main.dust[num622].velocity *= 3f;
                if (Main.rand.Next(2) == 0)
                {
                    Main.dust[num622].scale  = 0.5f;
                    Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
                }
            }
            for (int num623 = 0; num623 < 35; num623++)
            {
                int num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 3f);
                Main.dust[num624].noGravity = true;
                Main.dust[num624].velocity *= 5f;
                num624 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 244, 0f, 0f, 100, default(Color), 2f);
                Main.dust[num624].velocity *= 2f;
            }

            for (int num625 = 0; num625 < 3; num625++)
            {
                float scaleFactor10 = 0.33f;
                if (num625 == 1)
                {
                    scaleFactor10 = 0.66f;
                }
                else if (num625 == 2)
                {
                    scaleFactor10 = 1f;
                }

                int num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity   *= scaleFactor10;
                Main.gore[num626].velocity.X += 1f;
                Main.gore[num626].velocity.Y += 1f;
                num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity   *= scaleFactor10;
                Main.gore[num626].velocity.X -= 1f;
                Main.gore[num626].velocity.Y += 1f;
                num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity   *= scaleFactor10;
                Main.gore[num626].velocity.X += 1f;
                Main.gore[num626].velocity.Y -= 1f;
                num626 = Gore.NewGore(new Vector2(projectile.position.X + (float)(projectile.width / 2) - 24f, projectile.position.Y + (float)(projectile.height / 2) - 24f), default(Vector2), Main.rand.Next(61, 64), 1f);
                Main.gore[num626].velocity   *= scaleFactor10;
                Main.gore[num626].velocity.X -= 1f;
                Main.gore[num626].velocity.Y -= 1f;
            }
        }
Beispiel #12
0
 public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
 {
     target.AddBuff(ModContent.BuffType <Buffs.Masomode.CurseoftheMoon>(), 600);
     target.immune[projectile.owner] = 1;
 }
        public override bool UseItem(Player player)
        {
            Color color = new Color(175, 75, 255);

            if (player.ZoneUndergroundDesert)
            {
                if (player.altFunctionUse == 2)
                {
                    Main.NewText("A strong spirit stirs...", color);
                }
                else
                {
                    NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <SpiritChampion>());
                }
            }
            else if (player.ZoneUnderworldHeight)
            {
                if (player.altFunctionUse == 2)
                {
                    Main.NewText("The core of the planet rumbles...", color);
                }
                else
                {
                    NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <EarthChampion>());
                }
            }
            else if (player.Center.Y >= Main.worldSurface * 16) //is underground
            {
                if (player.ZoneSnow)
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("A verdant wind is blowing...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <NatureChampion>());
                    }
                }
                else
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("The stones tremble around you...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <TerraChampion>());
                    }
                }
            }
            else //above ground
            {
                if (player.ZoneSkyHeight)
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("The stars are aligning...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <CosmosChampion>());
                    }
                }
                else if (player.ZoneBeach)
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("Metallic groans echo from the depths...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <WillChampion>());
                    }
                }
                else if (player.ZoneHoly && Main.dayTime)
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("A wave of warmth passes over you...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <LifeChampion>());
                    }
                }
                else if ((player.ZoneCorrupt || player.ZoneCrimson) && !Main.dayTime) //night
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("The darkness of the night feels deeper...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <ShadowChampion>());
                    }
                }
                else if (!player.ZoneHoly && !player.ZoneCorrupt && !player.ZoneCrimson &&
                         !player.ZoneDesert && !player.ZoneSnow && !player.ZoneJungle && Main.dayTime) //purity day
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("You are surrounded by the rustling of trees...", color);
                    }
                    else
                    {
                        NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <TimberChampion>());
                    }
                }
                else //nothing to summon
                {
                    if (player.altFunctionUse == 2)
                    {
                        Main.NewText("Nothing seems to answer the call...", color);
                    }
                }
            }

            return(true);
        }
Beispiel #14
0
 private void PrismiteGem(GenerationProgress progress)
 {
     progress.Message = "STPG: Generating Prismite Gems...";
     for (int i = 0; (float)i < (float)((Main.maxTilesX - 200) * Main.maxTilesY) * 0.2f / 7000f; i++)
     {
         WorldGen.TileRunner(WorldGen.genRand.Next(100, Main.maxTilesX - 100), WorldGen.genRand.Next((int)((float)Main.maxTilesY * 0.35f), Main.maxTilesY - 300), WorldGen.genRand.Next(3, 6), WorldGen.genRand.Next(3, 6), ModContent.TileType <Tiles.PrismiteGemTile>());
     }
 }
        public static void PalmEffect(Player player)
        {
            FargoSoulsPlayer modPlayer = player.GetModPlayer <FargoSoulsPlayer>();

            modPlayer.PalmEnchantActive = true;

            if (player.GetToggleValue("Palm") && player.whoAmI == Main.myPlayer && modPlayer.DoubleTap)
            {
                Vector2 mouse = Main.MouseWorld;

                if (player.ownedProjectileCounts[ModContent.ProjectileType <PalmTreeSentry>()] > 0)
                {
                    for (int i = 0; i < Main.maxProjectiles; i++)
                    {
                        Projectile proj = Main.projectile[i];

                        if (proj.type == ModContent.ProjectileType <PalmTreeSentry>() && proj.owner == player.whoAmI)
                        {
                            proj.Kill();
                        }
                    }
                }

                FargoSoulsUtil.NewSummonProjectile(player.GetSource_Misc(""), mouse - 10 * Vector2.UnitY, Vector2.Zero, ModContent.ProjectileType <PalmTreeSentry>(), modPlayer.WoodForce ? 45 : 15, 0f, player.whoAmI);
            }
        }
Beispiel #16
0
 public override void SetDefaults()
 {
     dustType = ModContent.DustType <Dusts.VoidDust>();
     AddMapEntry(new Color(10, 10, 20));
     soundType = 21;
 }
        public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
        {
            Player      player    = Main.player[projectile.owner];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (modPlayer.CactusEnchant)
            {
                Needles = true;
            }

            //bees ignore defense
            if (modPlayer.BeeEnchant && !modPlayer.TerrariaSoul && projectile.type == ProjectileID.GiantBee)
            {
                damage = (int)(damage + npc.defense * .5);
            }

            if (modPlayer.SpiderEnchant && projectile.minion && Main.rand.Next(101) <= modPlayer.SummonCrit)
            {
                /*if (modPlayer.LifeForce || modPlayer.WizardEnchant)
                 * {
                 *  damage = (int)(damage * 1.5f);
                 * }*/

                crit = true;
            }

            if (projectile.GetGlobalProjectile <FargoGlobalProjectile>().TungstenProjectile&& crit)
            {
                damage = (int)(damage * 1.075f);
            }

            if (Chilled)
            {
                damage = (int)(damage * 1.2f);
            }

            if (modPlayer.NecroEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.NecroGuardian) && npc.boss && player.ownedProjectileCounts[ModContent.ProjectileType <NecroGrave>()] < 5)
            {
                necroDamage += damage;

                if (necroDamage > npc.lifeMax / 10)
                {
                    necroDamage = 0;

                    Projectile.NewProjectile(npc.Center, new Vector2(0, -3), ModContent.ProjectileType <NecroGrave>(), 0, 0, player.whoAmI, npc.lifeMax / 40);
                }
            }
        }
Beispiel #18
0
 public override bool IsArmorSet(Item head, Item body, Item legs)
 {
     return(body.type == ModContent.ItemType <ArkaniumChestplate>() && legs.type == ModContent.ItemType <ArkaniumGreaves>());
 }
Beispiel #19
0
 public override void KillMultiTile(int i, int j, int frameX, int frameY)
 {
     Item.NewItem(i * 16, j * 16, 32, 48, ModContent.ItemType <Items.Placeable.Furniture.AdvPaintings.AdvPainting18>());
 }
Beispiel #20
0
        public override void UpdateArmorSet(Player player)
        {
            player.setBonus = "30% increased melee damage and 20% increased melee speed" +
                              "\nYou release Swords when struck";
            player.meleeDamage += 0.30f;
            player.meleeSpeed  += 0.20f;

            Dust    dust;
            Vector2 position = Main.LocalPlayer.Center;

            dust           = Main.dust[Dust.NewDust(player.position, (int)player.width, (int)player.height, ModContent.DustType <ArkEnergy>(), 0f, 0f, 0, new Color(255, 255, 255), 0.5f)];
            dust.fadeIn    = 0.4f;
            dust.noGravity = true;

            EternalPlayer.ArkaniumArmor = true;
        }
 public override void OnHitPlayer(Player target, int damage, bool crit)
 {
     target.AddBuff(BuffID.OnFire, 600);
     target.AddBuff(ModContent.BuffType <LivingWasteland>(), 600);
 }
Beispiel #22
0
 public override void KillMultiTile(int i, int j, int frameX, int frameY)
 {
     Item.NewItem(i * 16, j * 16, 32, 32, ModContent.ItemType <Items.Crafting.HerbStationItem>());
 }
Beispiel #23
0
        public override void AI()
        {
            projectile.timeLeft = 9999;
            projectile.hostile  = false;
            projectile.friendly = true;
            Player owner = Main.player[projectile.owner];

            if (!owner.active || owner.dead || owner.ghost)
            {
                projectile.Kill();
                return;
            }
            if (owner.HeldItem.type != ModContent.ItemType <DaCapoItem>())
            {
                projectile.Kill();
                return;
            }
            //projectile.rotation = projectile.velocity.ToRotation();
            owner.itemTime      = 2;
            owner.itemAnimation = 2;
            owner.direction     = Math.Sign(projectile.velocity.X + 0.01f);
            owner.heldProj      = projectile.whoAmI;
            //int dir = owner.direction;
            //owner.itemRotation = (float)Math.Atan2(projectile.rotation.ToRotationVector2().Y * dir, projectile.rotation.ToRotationVector2().X * dir);
            projectile.Center = owner.Center;
            if (owner.mount.Active)
            {
                projectile.Center = owner.MountedCenter;
            }


            if (projectile.ai[0] == 0)
            {
                int   dir = owner.direction;
                float rot = projectile.ai[1] / 16 * MathHelper.Pi;
                if (owner.direction < 0)
                {
                    rot = MathHelper.Pi / 4 * 5 + (rot - MathHelper.Pi);
                }
                else
                {
                    rot = -MathHelper.Pi / 4 - (rot - MathHelper.Pi);
                }
                owner.itemRotation = (float)Math.Atan2(rot.ToRotationVector2().Y *dir, rot.ToRotationVector2().X *dir);

                projectile.ai[1]++;
                projectile.Opacity = projectile.ai[1] / 16;
                if (projectile.alpha >= 16)
                {
                    projectile.alpha = 0;
                    projectile.ai[0] = 1;
                    projectile.ai[1] = 0;
                }
            }
            else if (projectile.ai[0] == 1)
            {
                int   dir = owner.direction;
                float rot;
                if (owner.direction < 0)
                {
                    rot = MathHelper.Pi / 4 * 5;
                }
                else
                {
                    rot = -MathHelper.Pi / 4;
                }
                owner.itemRotation = (float)Math.Atan2(rot.ToRotationVector2().Y *dir, rot.ToRotationVector2().X *dir);
                projectile.ai[1]++;
                projectile.Opacity = 1 - projectile.ai[1] / 30;
                if (projectile.ai[1] >= 30)
                {
                    projectile.alpha = 255;
                    projectile.Kill();
                }
            }
        }
Beispiel #24
0
 public override bool IsArmorSet(Item head, Item body, Item legs)
 => body.type == ModContent.ItemType <BloodCourtChestplate>() && legs.type == ModContent.ItemType <BloodCourtLeggings>();
Beispiel #25
0
 public override bool UseItem(Player player)
 {
     NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType <GiantSandSifterHead>());
     return(true);
 }
Beispiel #26
0
        public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
        {
            Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(4));

            speedX = perturbedSpeed.X;
            speedY = perturbedSpeed.Y;
            if (Main.rand.Next(3) == 0)
            {
                Projectile.NewProjectile(position.X, position.Y, speedX * 1.4f, speedY * 1.4f, ModContent.ProjectileType <TrueBuckshot2>(), damage + 15, knockBack + 2.0f, player.whoAmI);
            }
            else
            {
                Projectile.NewProjectile(position.X, position.Y - 3f, speedX * 1.2f, speedY * 1.2f, type, damage * 2, knockBack * 2, player.whoAmI);
                Projectile.NewProjectile(position.X - 15f * player.direction, position.Y + 5f, speedX, speedY, type, damage / 2, knockBack / 2, player.whoAmI);
            }
            return(false);
        }
Beispiel #27
0
 public override void KillMultiTile(int i, int j, int frameX, int frameY)
 {
     Item.NewItem(i * 16, j * 16, 64, 32, ModContent.ItemType <PhantowaxBedItem>());
 }
Beispiel #28
0
 public override void NPCLoot()
 {
     if (Main.rand.Next(2) == 1)
     {
         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ModContent.ItemType <RawFish>(), 1);
     }
     if (Main.rand.Next(2) == 1)
     {
         Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, ItemID.Rockfish, 1);
     }
 }
Beispiel #29
0
        public override void AI()
        {
            int dustType = proType == 0 ? ModContent.DustType <Dusts.DiscordLight>() : proType == 1 ? ModContent.DustType <Dusts.AkumaDustLight>() : ModContent.DustType <Dusts.YamataDustLight>();

            if (projectile.ai[1] != 0)
            {
                projectile.extraUpdates         = 1;
                projectile.usesLocalNPCImmunity = true;
                projectile.localNPCHitCooldown  = 5;
            }
            else
            {
                projectile.penetrate = 1;
            }

            int dustID = Dust.NewDust(new Vector2(projectile.Center.X - 1, projectile.Center.Y - 1) - projectile.velocity, 2, 2, dustType, 0f, 0f, 100, Color.White, 1.2f);

            Main.dust[dustID].velocity *= 0f;
            Main.dust[dustID].noLight   = false;
            Main.dust[dustID].noGravity = true;

            if (originalVelocity == Vector2.Zero)
            {
                originalVelocity = projectile.velocity;
            }
            if (proType != 0)
            {
                if (offsetLeft)
                {
                    vectorOffset -= 0.08f;
                    if (vectorOffset <= -0.5f)
                    {
                        vectorOffset = -0.5f;
                        offsetLeft   = false;
                    }
                }
                else
                {
                    vectorOffset += 0.08f;
                    if (vectorOffset >= 0.5f)
                    {
                        vectorOffset = 0.5f;
                        offsetLeft   = true;
                    }
                }
                float velRot = BaseUtility.RotationTo(projectile.Center, projectile.Center + originalVelocity);
                projectile.velocity = BaseUtility.RotateVector(default, new Vector2(projectile.velocity.Length(), 0f), velRot + (vectorOffset * 0.5f));
        public override bool PreAI(NPC npc)
        {
            if (TimeFrozen)
            {
                npc.position     = npc.oldPosition;
                npc.frameCounter = 0;
                return(false);
            }

            if (!FirstTick)
            {
                switch (npc.type)
                {
                case NPCID.TheDestroyer:
                case NPCID.TheDestroyerBody:
                case NPCID.TheDestroyerTail:
                    npc.buffImmune[ModContent.BuffType <TimeFrozen>()] = false;
                    npc.buffImmune[BuffID.Chilled] = false;
                    break;

                case NPCID.WallofFlesh:
                case NPCID.WallofFleshEye:
                case NPCID.MoonLordCore:
                case NPCID.MoonLordHand:
                case NPCID.MoonLordHead:
                case NPCID.MoonLordLeechBlob:
                case NPCID.TargetDummy:
                case NPCID.GolemFistLeft:
                case NPCID.GolemFistRight:
                case NPCID.GolemHead:
                case NPCID.DungeonGuardian:
                case NPCID.DukeFishron:
                    SpecialEnchantImmune = true;
                    break;

                case NPCID.Squirrel:
                case NPCID.SquirrelRed:
                    if (!npc.SpawnedFromStatue)
                    {
                        int p = Player.FindClosest(npc.position, npc.width, npc.height);
                        if ((p == -1 || npc.Distance(Main.player[p].Center) > 800) && Main.rand.Next(5) == 0)
                        {
                            npc.Transform(ModContent.NPCType <TophatSquirrelCritter>());
                        }
                    }
                    break;

                default:
                    break;
                }

                //critters
                if (npc.damage == 0 && !npc.townNPC && npc.lifeMax == 5)
                {
                    Player player = Main.player[Main.myPlayer];

                    if (npc.releaseOwner == player.whoAmI && player.GetModPlayer <FargoPlayer>().WoodEnchant)
                    {
                        ExplosiveCritter = true;
                    }
                }

                FirstTick = true;
            }

            if (Lethargic && ++LethargicCounter > 3)
            {
                LethargicCounter = 0;
                return(false);
            }

            if (ExplosiveCritter)
            {
                critterCounter--;

                if (critterCounter <= 0)
                {
                    Player      player    = Main.player[npc.releaseOwner];
                    FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

                    int damage = 25;

                    if (modPlayer.WoodForce || modPlayer.WizardEnchant)
                    {
                        damage *= 5;
                    }

                    Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <ExplosionSmall>(), modPlayer.HighestDamageTypeScaling(damage), 4, npc.releaseOwner);
                    //gold critters make coin value go up of hit enemy, millions of other effects eeech
                }
            }

            if (frostCD > 0)
            {
                frostCD--;

                if (frostCD == 0)
                {
                    frostCount = 0;
                }
            }

            return(true);
        }
Beispiel #31
0
        void InstallFromDisc(string path, ModContent.ModSource modSource)
        {
            var message = "";
            ShowProgressbar("Installing Content", () => message);
            ShowDisabledCancel();

            new Task(() =>
            {
                var extracted = new List<string>();

                try
                {
                    foreach (var i in modSource.Install)
                    {
                        switch (i.Key)
                        {
                            case "copy":
                            {
                                var sourceDir = Path.Combine(path, i.Value.Value);
                                foreach (var node in i.Value.Nodes)
                                {
                                    var sourcePath = Path.Combine(sourceDir, node.Value.Value);
                                    var targetPath = Platform.ResolvePath(node.Key);
                                    if (File.Exists(targetPath))
                                    {
                                        Log.Write("install", "Ignoring installed file " + targetPath);
                                        continue;
                                    }

                                    Log.Write("install", "Copying {0} -> {1}".F(sourcePath, targetPath));
                                    extracted.Add(targetPath);
                                    Directory.CreateDirectory(Path.GetDirectoryName(targetPath));

                                    using (var source = File.OpenRead(sourcePath))
                                    using (var target = File.OpenWrite(targetPath))
                                    {
                                        var displayFilename = Path.GetFileName(targetPath);
                                        var length = source.Length;

                                        Action<long> onProgress = null;
                                        if (length < ShowPercentageThreshold)
                                            message = "Copying " + displayFilename;
                                        else
                                            onProgress = b => message = "Copying " + displayFilename + " ({0}%)".F(100 * b / length);

                                        CopyStream(source, target, length, onProgress);
                                    }
                                }

                                break;
                            }

                            case "extract-raw":
                            {
                                ExtractFromPackage(ExtractionType.Raw, path, i.Value, extracted, m => message = m);
                                break;
                            }

                            case "extract-blast":
                            {
                                ExtractFromPackage(ExtractionType.Blast, path, i.Value, extracted, m => message = m);
                                break;
                            }

                            case "extract-mscab":
                            {
                                ExtractFromMSCab(path, i.Value, extracted, m => message = m);
                                break;
                            }

                            case "extract-iscab":
                            {
                                ExtractFromISCab(path, i.Value, extracted, m => message = m);
                                break;
                            }

                            case "delete":
                            {
                                var sourcePath = Path.Combine(path, i.Value.Value);

                                // Try as an absolute path
                                if (!File.Exists(sourcePath))
                                    sourcePath = Platform.ResolvePath(i.Value.Value);

                                Log.Write("debug", "Deleting {0}", sourcePath);
                                File.Delete(sourcePath);
                                break;
                            }

                            default:
                                Log.Write("debug", "Unknown installation command {0} - ignoring", i.Key);
                                break;
                        }
                    }

                    Game.RunAfterTick(Ui.CloseWindow);
                }
                catch (Exception e)
                {
                    Log.Write("install", e.ToString());

                    foreach (var f in extracted)
                    {
                        Log.Write("install", "Deleting " + f);
                        File.Delete(f);
                    }

                    Game.RunAfterTick(() =>
                    {
                        ShowMessage("Installation Failed", "Refer to install.log in the logs directory for details.");
                        ShowBackRetry(() => InstallFromDisc(path, modSource));
                    });
                }
            }).Start();
        }
        public override void NPCLoot(NPC npc)
        {
            Player      player    = Main.player[npc.lastInteraction];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (modPlayer.PlatinumEnchant && !npc.boss && firstLoot)
            {
                int chance = 5;
                int bonus  = 2;

                if (modPlayer.WillForce || modPlayer.WizardEnchant)
                {
                    bonus = 5;
                }

                if (Main.rand.Next(chance) == 0)
                {
                    firstLoot = false;
                    for (int i = 1; i < bonus; i++)
                    {
                        npc.NPCLoot();
                    }

                    int num1 = 36;
                    for (int index1 = 0; index1 < num1; ++index1)
                    {
                        Vector2 vector2_1 = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, (float)npc.height) * 0.75f).RotatedBy((double)(index1 - (num1 / 2 - 1)) * 6.28318548202515 / (double)num1, new Vector2()) + npc.Center;
                        Vector2 vector2_2 = vector2_1 - npc.Center;
                        int     index2    = Dust.NewDust(vector2_1 + vector2_2, 0, 0, DustID.PlatinumCoin, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f);
                        Main.dust[index2].noGravity = true;
                        Main.dust[index2].noLight   = true;
                        Main.dust[index2].velocity  = vector2_2;
                    }
                }
            }

            firstLoot = false;

            //patreon gang
            if (SoulConfig.Instance.PatreonOrb && npc.type == NPCID.Golem && Main.rand.Next(10) == 0)
            {
                Item.NewItem(npc.Hitbox, ModContent.ItemType <Patreon.Daawnz.ComputationOrb>());
            }

            if (SoulConfig.Instance.PatreonDoor && npc.type == NPCID.Squid && Main.rand.Next(50) == 0)
            {
                Item.NewItem(npc.Hitbox, ModContent.ItemType <Patreon.Sam.SquidwardDoor>());
            }

            if (SoulConfig.Instance.PatreonKingSlime && npc.type == NPCID.KingSlime && FargoSoulsWorld.MasochistMode && Main.rand.Next(100) == 0)
            {
                Item.NewItem(npc.Hitbox, ModContent.ItemType <Patreon.Catsounds.MedallionoftheFallenKing>());
            }

            if (SoulConfig.Instance.PatreonPlant && npc.type == NPCID.Dryad && Main.bloodMoon && player.ZoneJungle)
            {
                Item.NewItem(npc.Hitbox, ModContent.ItemType <Patreon.LaBonez.PiranhaPlantVoodooDoll>());
            }

            //boss drops
            if (Main.rand.Next(FargoSoulsWorld.MasochistMode ? 3 : 10) == 0)
            {
                switch (npc.type)
                {
                case NPCID.KingSlime:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <SlimeKingsSlasher>());
                    break;

                case NPCID.EyeofCthulhu:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <LeashOfCthulhu>());
                    break;

                case NPCID.EaterofWorldsHead:
                case NPCID.EaterofWorldsBody:
                case NPCID.EaterofWorldsTail:
                    bool dropItems = true;
                    for (int i = 0; i < 200; i++)
                    {
                        if (Main.npc[i].active && i != npc.whoAmI && (Main.npc[i].type == NPCID.EaterofWorldsHead || Main.npc[i].type == NPCID.EaterofWorldsBody || Main.npc[i].type == NPCID.EaterofWorldsTail))
                        {
                            dropItems = false;
                            break;
                        }
                    }
                    if (dropItems)
                    {
                        Item.NewItem(npc.Hitbox, ModContent.ItemType <EaterStaff>());
                    }
                    break;

                case NPCID.BrainofCthulhu:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <BrainStaff>());
                    break;

                case NPCID.QueenBee:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <TheSmallSting>());
                    break;

                case NPCID.SkeletronHead:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <BoneZone>());
                    break;

                case NPCID.WallofFlesh:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <FleshHand>());
                    break;

                case NPCID.TheDestroyer:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <DestroyerGun>());
                    break;

                case NPCID.SkeletronPrime:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <RefractorBlaster>());
                    break;

                case NPCID.Retinazer:
                    if (!EModeGlobalNPC.BossIsAlive(ref EModeGlobalNPC.spazBoss, NPCID.Spazmatism))
                    {
                        Item.NewItem(npc.Hitbox, ModContent.ItemType <TwinRangs>());
                    }
                    break;

                case NPCID.Spazmatism:
                    if (!EModeGlobalNPC.BossIsAlive(ref EModeGlobalNPC.retiBoss, NPCID.Retinazer))
                    {
                        Item.NewItem(npc.Hitbox, ModContent.ItemType <TwinRangs>());
                    }
                    break;

                case NPCID.Plantera:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <Dicer>());
                    break;

                case NPCID.Golem:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <RockSlide>());
                    break;

                case NPCID.DukeFishron:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <FishStick>());
                    break;

                case NPCID.DD2Betsy:
                    Item.NewItem(npc.Hitbox, ModContent.ItemType <DragonBreath>());
                    break;
                }
            }

            if (npc.type == NPCID.BigMimicJungle)
            {
                switch (Main.rand.Next(3))
                {
                case 0: Item.NewItem(npc.Hitbox, ModContent.ItemType <Vineslinger>()); break;

                case 1: Item.NewItem(npc.Hitbox, ModContent.ItemType <Mahoguny>()); break;

                case 2: Item.NewItem(npc.Hitbox, ModContent.ItemType <OvergrownKey>()); break;
                }
            }

            if (Fargowiltas.Instance.CalamityLoaded && Revengeance && FargoSoulsWorld.MasochistMode && Main.bloodMoon && Main.moonPhase == 0 && Main.raining && Main.rand.Next(10) == 0)
            {
                Mod calamity = ModLoader.GetMod("CalamityMod");

                if (npc.type == calamity.NPCType("DevourerofGodsHeadS"))
                {
                    Item.NewItem(npc.Hitbox, calamity.ItemType("CosmicPlushie"));
                }
            }
        }
 public override void AI()
 {
     projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(45);
     Dust dust = Dust.NewDustPerfect(projectile.Center, ModContent.DustType <TropidiumGlow>(), null, 0, Color.White, 1f);
 }
        public override bool CheckDead(NPC npc)
        {
            Player      player    = Main.player[Main.myPlayer];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (TimeFrozen)
            {
                npc.life = 1;
                return(false);
            }

            /*if (npc.boss && BossIsAlive(ref mutantBoss, ModContent.NPCType<MutantBoss.MutantBoss>()) && npc.type != ModContent.NPCType<MutantBoss.MutantBoss>())
             * {
             *  npc.active = false;
             *  Main.PlaySound(npc.DeathSound, npc.Center);
             *  return false;
             * }*/

            if (Needles && npc.lifeMax > 1 && Main.rand.Next(2) == 0 && npc.type != ModContent.NPCType <SuperDummy>())
            {
                int dmg        = 15;
                int numNeedles = 8;

                if (modPlayer.LifeForce || modPlayer.WizardEnchant)
                {
                    dmg        = 50;
                    numNeedles = 16;
                }

                Projectile[] projs = FargoGlobalProjectile.XWay(numNeedles, npc.Center, ModContent.ProjectileType <CactusNeedle>(), 5, modPlayer.HighestDamageTypeScaling(dmg), 5f);

                for (int i = 0; i < projs.Length; i++)
                {
                    if (projs[i] == null)
                    {
                        continue;
                    }
                    Projectile p = projs[i];
                    p.GetGlobalProjectile <FargoGlobalProjectile>().CanSplit = false;
                }
            }

            return(true);
        }
 public override bool PreKill(int timeLeft)
 {
     for (int i = 0; i < 50; i++)
     {
         Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, ModContent.DustType <TropidiumSteam>(), 0, 0, 0, Color.White, 1.3f);
         dust.noGravity = true;
         dust.velocity *= 1.1f;
     }
     Main.PlaySound(SoundID.Item10, projectile.position);
     return(true);
 }
        public override bool PreNPCLoot(NPC npc)
        {
            Player      player    = Main.player[npc.lastInteraction];
            FargoPlayer modPlayer = player.GetModPlayer <FargoPlayer>();

            if (modPlayer.NecroEnchant && SoulConfig.Instance.GetValue(SoulConfig.Instance.NecroGuardian) && !npc.boss && modPlayer.NecroCD == 0 && player.ownedProjectileCounts[ModContent.ProjectileType <NecroGrave>()] < 5)
            {
                Projectile.NewProjectile(npc.Center, new Vector2(0, -3), ModContent.ProjectileType <NecroGrave>(), 0, 0, player.whoAmI, npc.lifeMax / 4);

                if (modPlayer.ShadowForce || modPlayer.WizardEnchant)
                {
                    modPlayer.NecroCD = 15;
                }
                else
                {
                    modPlayer.NecroCD = 30;
                }
            }

            if (firstIconLoot)
            {
                firstIconLoot = false;

                if ((modPlayer.MasochistSoul || npc.life <= 2000) && !npc.boss && modPlayer.SinisterIconDrops)
                {
                    if (!modPlayer.MasochistSoul && npc.value > 1)
                    {
                        npc.value = 1;
                    }

                    npc.NPCLoot();
                }
            }

            return(true);
        }