Esempio n. 1
0
 public override bool PreAI(NPC npc)
 {
     if (!npc.noTileCollide && !npc.justHit && Main.netMode != NetmodeID.MultiplayerClient)
     {
         VitricSpike.CollideWithSpikes(npc, out int damage);
         if (damage > 0)
         {
             npc.StrikeNPC(damage, 0, 0, fromNet: true);
         }
     }
     return(base.PreAI(npc));
 }
        public override void PreUpdate()
        {
            if (PickupTarget != null)
            {
                if (PickupTimer == 0)
                {
                    oldPickupPos = player.Center;
                }

                PickupTimer++;

                player.immune        = true;
                player.immuneTime    = 5;
                player.immuneNoBlink = true;

                player.Center = Vector2.SmoothStep(oldPickupPos, PickupTarget.Center, PickupTimer / 30f);
                if (PickupTimer >= MaxPickupTimer)
                {
                    PickupTarget = null;
                }
            }
            else
            {
                PickupTimer = 0;
            }

            platformTimer--;

            if (DarkSlow)
            {
                player.velocity.X *= 0.8f;
            }
            DarkSlow = false;

            if (!player.immune)
            {
                VitricSpike.CollideWithSpikes(player, out int damage);
                if (damage > 0)
                {
                    player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was impaled by glass shards."), damage, 0);
                }
            }

            foreach (PlayerTicker ticker in spawners.Where(n => n.Active(player) && Timer % n.TickFrequency == 0))
            {
                ticker.Tick(player);
            }
        }
Esempio n. 3
0
        public override void PreUpdate()
        {
            if (PickupTarget != null)
            {
                PickupTimer++;

                player.immune        = true;
                player.immuneTime    = 5;
                player.immuneNoBlink = true;

                player.Center = PickupTarget.Center;
                if (PickupTimer >= MaxPickupTimer)
                {
                    PickupTarget = null;
                }
            }
            else
            {
                PickupTimer = 0;
            }

            platformTimer--;

            if (Main.netMode != NetmodeID.Server)
            {
                var staminaState    = UILoader.GetUIState <Stamina>();
                var infusionState   = UILoader.GetUIState <Infusion>();
                var codexState      = UILoader.GetUIState <Content.GUI.Codex>();
                var collectionState = UILoader.GetUIState <Collection>();

                AbilityHandler mp = player.GetHandler();

                staminaState.Visible  = false;
                infusionState.Visible = false;

                if (mp.AnyUnlocked)
                {
                    staminaState.Visible = true;
                }

                if (Main.playerInventory)
                {
                    if (player.chest == -1 && Main.npcShop == 0)
                    {
                        collectionState.Visible         = true;
                        Content.GUI.Codex.ButtonVisible = true;
                        if (mp.AnyUnlocked)
                        {
                            infusionState.Visible = true;
                        }
                    }
                    else
                    {
                        collectionState.Visible         = false;
                        Content.GUI.Codex.ButtonVisible = false;
                        if (mp.AnyUnlocked)
                        {
                            infusionState.Visible = false;
                        }
                    }
                }
                else
                {
                    collectionState.Visible         = false;
                    Collection.ActiveAbility        = null;
                    Content.GUI.Codex.ButtonVisible = false;
                    Content.GUI.Codex.Open          = false;
                    infusionState.Visible           = false;
                }
            }

            if (DarkSlow)
            {
                player.velocity.X *= 0.8f;
            }
            DarkSlow = false;

            if (!player.immune)
            {
                VitricSpike.CollideWithSpikes(player, out int damage);
                if (damage > 0)
                {
                    player.Hurt(PlayerDeathReason.ByCustomReason(player.name + " was impaled by glass shards."), damage, 0);
                }
            }
        }