Esempio n. 1
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
     }
 }
        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. 3
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. 4
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));
        }