Esempio n. 1
0
        public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
        {
            TremorUtils.DrawNPCGlowMask(spriteBatch, npc, mod.GetTexture("NovaPillar/NovaPillar_GlowMask"));
            float num88 = NovaHandler.ShieldStrength / (float)NPC.ShieldStrengthTowerMax;

            if (NovaHandler.ShieldStrength > 0)
            {
                Main.spriteBatch.End();
                Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone);

                var   center = npc.Center - Main.screenPosition;
                float num89  = 0f;
                if (npc.ai[3] > 0f && npc.ai[3] <= 30f)
                {
                    num89 = 1f - npc.ai[3] / 30f;
                }
                Filters.Scene["Tremor:Nova"].GetShader().UseIntensity(1f + num89).UseProgress(0f);
                DrawData drawData = new DrawData(TextureManager.Load("Images/Misc/Perlin"), center - new Vector2(0, 10), new Rectangle(0, 0, 600, 600), Color.White * (num88 * 0.8f + 0.2f), npc.rotation, new Vector2(300f, 300f), npc.scale * (1f + num89 * 0.05f), SpriteEffects.None, 0);
                GameShaders.Misc["ForceField"].UseColor(new Vector3(1f + num89 * 0.5f));
                GameShaders.Misc["ForceField"].Apply(drawData);
                drawData.Draw(Main.spriteBatch);
                Main.spriteBatch.End();
                Main.spriteBatch.Begin();
                return;
            }
            if (npc.ai[3] > 0f)
            {
                Main.spriteBatch.End();
                Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone);
                var   center = npc.Center - Main.screenPosition;
                float num90  = npc.ai[3] / 120f;
                float num91  = Math.Min(npc.ai[3] / 30f, 1f);
                Filters.Scene["Tremor:Nova"].GetShader().UseIntensity(Math.Min(5f, 15f * num90) + 1f).UseProgress(num90);
                DrawData drawData = new DrawData(TextureManager.Load("Images/Misc/Perlin"), center - new Vector2(0, 10), new Rectangle(0, 0, 600, 600), new Color(new Vector4(1f - (float)Math.Sqrt(num91))), npc.rotation, new Vector2(300f, 300f), npc.scale * (1f + num91), SpriteEffects.None, 0);
                GameShaders.Misc["ForceField"].UseColor(new Vector3(2f));
                GameShaders.Misc["ForceField"].Apply(drawData);
                drawData.Draw(Main.spriteBatch);
                Main.spriteBatch.End();
                Main.spriteBatch.Begin();
                return;
            }
            Filters.Scene["Tremor:Nova"].GetShader().UseIntensity(0f).UseProgress(0f);
        }
Esempio n. 2
0
 private void ShootOneLaser(Motherboard boss)
 {
     // this code is still poop
     try
     {
         int ai0 = _lastSignalDrone == -1 ? boss.npc.whoAmI : _signalDrones[_lastSignalDrone];
         ++_lastSignalDrone;
         var zapSound = new LegacySoundStyle(SoundID.Trackable, TremorUtils.GetIdForSoundName($"dd2_lightning_aura_zap_{Main.rand.Next(4)}"));
         Main.PlayTrackedSound(zapSound.WithPitchVariance(Main.rand.NextFloat() * .5f).WithVolume(Main.soundVolume * 1.5f));
         int newProj = Projectile.NewProjectile(boss.npc.Center.X, boss.npc.Center.Y, 0, 0,
                                                boss.mod.ProjectileType("projMotherboardLaser"),
                                                LaserDamage, LaserKb, 0, ai0, _signalDrones[_lastSignalDrone]);
         if (_lastSignalDrone == 0)
         {
             Main.projectile[newProj].localAI[1] = 1;
         }
     }
     catch
     {
         // POOP I TELL YOU
     }
 }
Esempio n. 3
0
 public override void PostDraw(SpriteBatch spriteBatch, Color drawColor)
 {
     TremorUtils.DrawNPCGlowMask(spriteBatch, npc, mod.GetTexture("NovaPillar/NPCs/NovaFlier_GlowMask"));
 }
        private void PlayCollidingSound()
        {
            var zapSound = new LegacySoundStyle(SoundID.Trackable, TremorUtils.GetIdForSoundName($"dd2_sky_dragons_fury_circle_{Main.rand.Next(3)}"));

            Main.PlayTrackedSound(zapSound.WithPitchVariance(Main.rand.NextFloat()).WithVolume(Main.soundVolume * 1.5f));
        }
Esempio n. 5
0
        public override void AI(Motherboard boss)
        {
            boss.Move();
            boss.npc.TargetClosest(true);

            // this was never actually executed
            // not sure what is meant to do, or where it is supposed to go
            // for (int i = 0; i < _clampers.Count; i++)
            //	Main.npc[_clampers[i]].ai[2] = 1;

            // following
            if (boss.npc.ai[1] == 0f)
            {
                // runs only SP/server side
                if (Main.netMode != 1)
                {
                    // increment the something timer
                    boss.npc.localAI[1] += 1f;

                    // if the timer is due, plus some random amount of ticks
                    if (boss.npc.localAI[1] >= 120 + Main.rand.Next(200))
                    {
                        boss.npc.localAI[1] = 0f;
                        boss.npc.TargetClosest(true);

                        // attempt to find coords somewhere around the target (max 100 tries)
                        // break as soon as we find a place around the player that we can move to
                        for (int attempts = 0; attempts < 100; attempts++)
                        {
                            Player target = Main.player[boss.npc.target];
                            int    coordX = (int)target.Center.X / 16 + Main.rand.Next(-50, 51);
                            int    coordY = (int)target.Center.Y / 16 + Main.rand.Next(-50, 51);

                            if (!WorldGen.SolidTile(coordX, coordY) &&
                                Collision.CanHit(new Vector2(coordX, coordY).ToWorldCoordinates(), 1, 1,
                                                 target.position,
                                                 target.width,
                                                 target.height))
                            {
                                boss.npc.teleportTime = 1f;
                                boss.npc.ai[1]        = 1f;
                                boss.npc.ai[2]        = coordX;
                                boss.npc.ai[3]        = coordY;
                                boss.npc.netUpdate    = true;
                                break;
                            }
                        }

                        return;
                    }
                }
            }
            // disappearing
            else if (boss.npc.ai[1] == 1f)
            {
                ChangeAlpha(boss, 3);

                // finished disappearing
                if (boss.npc.alpha >= 255)
                {
                    boss.npc.teleportTime = 0f;
                    boss.npc.position.X   = boss.npc.ai[2] * 16f - boss.npc.width / 2;
                    boss.npc.position.Y   = boss.npc.ai[3] * 16f - boss.npc.height / 2;
                    boss.npc.ai[1]        = 2f;
                    // Motherboard screech
                    var screech = new LegacySoundStyle(SoundID.Trackable, TremorUtils.GetIdForSoundName($"dd2_lightning_bug_death_{Main.rand.Next(3)}"));
                    Main.PlayTrackedSound(screech.WithPitchVariance(Main.rand.NextFloat()));
                    //Main.PlaySound(SoundID.DD2_LightningBugDeath.WithPitchVariance(Main.rand.NextFloat()).WithVolume(Main.soundVolume * 2.5f), boss.npc.position);
                    Main.PlaySound(SoundID.Item78.WithVolume(Main.soundVolume * 1.15f), boss.npc.position);                     // tp
                    return;
                }
            }
            // appearing
            else if (boss.npc.ai[1] == 2f)
            {
                ChangeAlpha(boss, -3);

                // finished appearing
                if (boss.npc.alpha <= 0)
                {
                    boss.npc.ai[1] = 0f;
                    return;
                }
            }

            // not finished appearing, disappearing, or didn't find a new place to move to....?
            CheckClampers(boss);
            SecondShoot(boss);
        }
Esempio n. 6
0
        private void PlayZapSound()
        {
            var zapSound = new LegacySoundStyle(SoundID.Trackable, TremorUtils.GetIdForSoundName($"dd2_lightning_bug_zap_{Main.rand.Next(3)}"));

            Main.PlayTrackedSound(zapSound.WithPitchVariance(Main.rand.NextFloat() * .5f).WithVolume(Main.soundVolume * 0.5f));
        }