コード例 #1
0
 public override void NPCLoot()
 {
     if (target != null && target.active)
     {
         if (target is NPC tar)
         {
             TarrHelper th = tar.GetGlobalNPC <TarrHelper>();
             th.isSnared = false;
             th.grasped  = false;
         }
         if (target is Player pl)
         {
             SnareBoolean sb = pl.GetModPlayer <SnareBoolean>();
             sb.isSnared = false;
             sb.grasped  = false;
         }
     }
     Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gore1"), 1f);
     for (int a = 0; a < 6; a++)
     {
         Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gore2"), 1f);
     }
     Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gore3"), 1f);
     Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gore3"), 1f);
     Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/Gore4"), 1f);
     Main.PlaySound(SoundLoader.customSoundType, npc.Center, mod.GetSoundSlot(SoundType.Custom, "Sounds/Custom/Tarr_Death"));
 }
コード例 #2
0
        public override void UpdateEquips(ref bool wallSpeedBuff, ref bool tileSpeedBuff, ref bool tileRangeBuff)
        {
            bool HasTablet()
            {
                foreach (Item i in player.inventory)
                {
                    if (i.type == ModContent.ItemType <Incinerator>())
                    {
                        return(true);
                    }
                }
                return(false);
            }

            godMode = HasTablet();
            if (godMode)
            {
                if (ModContent.GetInstance <ClientConfig>().tabletUI)
                {
                    CastledsContent.instance.TabletState.SetState(CastledsContent.instance.tabletUI);
                }
                for (int a = 0; a < BuffLoader.BuffCount; a++)
                {
                    if (Main.debuff[a])
                    {
                        player.buffImmune[a] = true;
                    }
                }
                player.statLife = player.statLifeMax2;
                player.statMana = player.statManaMax2;
                player.breath   = player.breathMax;
                player.wingTime = player.wingTimeMax;
            }
            else
            {
                CastledsContent.instance.TabletState.SetState(null);
            }
            if (magicCursor)
            {
                foreach (NPC n in Main.npc)
                {
                    if (n.active && !pTar)
                    {
                        IncNPC inc = n.GetGlobalNPC <IncNPC>();
                        if (inc.InRangeOfCursor(n) && Main.mouseLeft)
                        {
                            inc.manipulate = true;
                            nTar           = true;
                        }
                        if (inc.manipulate && Main.mouseLeft)
                        {
                            Vector2 position = new Vector2(Main.MouseWorld.X - (n.width / 2), Main.MouseWorld.Y - (n.height / 2));
                            n.velocity = new Vector2(0f, 0f);
                            n.position = position;
                            if (Main.mouseRight)
                            {
                                inc.Damaged(n);
                            }
                        }
                        if (!Main.mouseLeft && inc.manipulate)
                        {
                            nTar           = false;
                            inc.manipulate = false;
                        }
                    }
                }
                foreach (Player p in Main.player)
                {
                    if (p.active && !p.dead && !nTar)
                    {
                        IncPlayer inc = p.GetModPlayer <IncPlayer>();
                        if (inc.InRangeOfCursor(p) && Main.mouseLeft)
                        {
                            inc.manipulate = true;
                            pTar           = true;
                        }
                        if (inc.manipulate && Main.mouseLeft)
                        {
                            SnareBoolean sb       = p.GetModPlayer <SnareBoolean>();
                            Vector2      position = new Vector2(Main.MouseWorld.X - (p.width / 2), Main.MouseWorld.Y - (p.height / 2));
                            p.velocity = new Vector2(0f, 0f);
                            p.position = position;
                            if (Main.mouseRight)
                            {
                                inc.Damaged(p);
                            }
                        }
                        if (!Main.mouseLeft && inc.manipulate)
                        {
                            pTar           = false;
                            inc.manipulate = false;
                        }
                    }
                }
                foreach (Item i in Main.item)
                {
                    if (i.active)
                    {
                        IncItem inc = i.GetGlobalItem <IncItem>();
                        if (inc.InRangeOfCursor(i) && Main.mouseLeft)
                        {
                            inc.manipulate = true;
                        }
                        if (inc.manipulate && Main.mouseLeft)
                        {
                            Vector2 position = new Vector2(Main.MouseWorld.X - (i.width / 2), Main.MouseWorld.Y - (i.height / 2));
                            i.velocity = new Vector2(0f, 0f);
                            i.position = position;
                            if (Main.mouseRight && !inc.smiteImmune)
                            {
                                i.SetDefaults(ItemID.None);
                            }
                        }
                        if (!Main.mouseLeft && inc.manipulate)
                        {
                            inc.manipulate = false;
                        }
                    }
                }
            }
        }