Example #1
0
        public override void AI()
        {
            foreach (Player player in Main.player.Where(player => Vector2.Distance(player.Center, projectile.Center) <= 100))
            {
                AbilityHandler mp = player.GetHandler();

                if (AbilityHelper.CheckDash(player, projectile.Hitbox))
                {
                    WorldGen.KillTile((int)projectile.Center.X / 16, (int)projectile.Center.Y / 16);
                    mp.ActiveAbility?.Deactivate();

                    if (player.velocity.Length() != 0)
                    {
                        player.velocity = Vector2.Normalize(player.velocity) * -1f;
                    }
                    Main.PlaySound(SoundID.Shatter, projectile.Center);
                }
            }
            projectile.timeLeft = 2;

            if (Main.tile[(int)projectile.Center.X / 16, (int)projectile.Center.Y / 16].type != TileType <Tiles.Overgrow.OvergrowGate>())
            {
                projectile.timeLeft = 0;
            }
        }
        public override void AI()
        {
            foreach (Player player in Main.player.Where(player => Vector2.Distance(player.Center, projectile.Center) <= 100))
            {
                AbilityHandler mp = player.GetModPlayer <AbilityHandler>();

                if (AbilityHelper.CheckDash(player, projectile.Hitbox))
                {
                    mp.dash.Active = false;

                    if (player.velocity.Length() != 0)
                    {
                        player.velocity           = Vector2.Normalize(player.velocity) * -18f;
                        player.wingTime           = player.wingTimeMax;
                        player.rocketTime         = player.rocketTimeMax;
                        player.jumpAgainCloud     = true;
                        player.jumpAgainBlizzard  = true;
                        player.jumpAgainSandstorm = true;
                        player.jumpAgainFart      = true;
                        player.jumpAgainSail      = true;
                    }

                    Main.PlaySound(SoundID.Shatter, projectile.Center);
                    for (int k = 0; k <= 30; k++)
                    {
                        int dus = Dust.NewDust(projectile.position, 48, 32, mod.DustType("Glass"), Main.rand.Next(-16, 15), Main.rand.Next(-16, 15), 0, default, 1.3f);
 public override void Collision(Player player)
 {
     if (AbilityHelper.CheckDash(player, projectile.Hitbox))
     {
         WorldGen.KillTile(ParentX, ParentY);
         Main.PlaySound(SoundID.Tink, projectile.Center);
     }
 }
Example #4
0
        public override void Collision(Player player)
        {
            if (AbilityHelper.CheckDash(player, projectile.Hitbox))
            {
                WorldGen.KillTile((int)projectile.position.X / 16, (int)projectile.position.Y / 16);

                for (int k = 0; k <= 10; k++)
                {
                    Dust.NewDustPerfect(projectile.Center, DustType <Dusts.Glass2>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(2), 0, default, 1.3f);
Example #5
0
        public override void Collision(Player player)
        {
            if (AbilityHelper.CheckDash(player, projectile.Hitbox))
            {
                WorldGen.KillTile(ParentX, ParentY);
                NetMessage.SendTileRange(player.whoAmI, (int)(projectile.position.X / 16f), (int)(projectile.position.Y / 16f), 2, 3, TileChangeType.None);

                Main.PlaySound(SoundID.Tink, projectile.Center);
            }
        }
        public override void AI()
        {
            foreach (Player player in Main.player.Where(player => Vector2.Distance(player.Center, projectile.Center) <= 100))
            {
                AbilityHandler mp = player.GetModPlayer <AbilityHandler>();

                if (AbilityHelper.CheckDash(player, projectile.Hitbox))
                {
                    WorldGen.KillTile((int)projectile.position.X / 16, (int)projectile.position.Y / 16);

                    for (int k = 0; k <= 20; k++)
                    {
                        Dust.NewDust(projectile.position, 32, 32, ModContent.DustType <Dusts.Glass2>(), 0, 0, 0, default, 1.3f);
Example #7
0
        public override void Collision(Player player)
        {
            if (AbilityHelper.CheckDash(player, projectile.Hitbox))
            {
                if (Main.myPlayer == player.whoAmI)
                {
                    WorldGen.KillTile((int)(projectile.position.X / 16f), (int)(projectile.position.Y / 16f));
                    NetMessage.SendTileRange(player.whoAmI, (int)(projectile.position.X / 16f), (int)(projectile.position.Y / 16f), 2, 3, TileChangeType.None);
                }
                else
                {
                    Main.PlaySound(SoundID.Shatter, projectile.Center);
                }

                for (int k = 0; k <= 10; k++)
                {
                    Dust.NewDustPerfect(projectile.Center, DustType <Dusts.GlassGravity>(), Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(2), 0, default, 1.3f);
Example #8
0
        public override void Collision(Player player)
        {
            if (player.GetModPlayer <StarlightPlayer>().inTutorial&& player.Hitbox.Intersects(projectile.Hitbox))
            {
                if (AbilityHelper.CheckDash(player, projectile.Hitbox))
                {
                    player.GetModPlayer <StarlightPlayer>().inTutorial = false;
                    Main.PlaySound(SoundID.Shatter, player.Center);

                    for (int k = 0; k < 50; k++)
                    {
                        Dust.NewDustPerfect(player.Center + Vector2.One.RotatedByRandom(6.28f) * Main.rand.NextFloat(20), DustType <Dusts.GlassGravity>());
                    }
                }
                else
                {
                    player.velocity.X = -1;
                }
            }
        }
        public override void AI()
        {
            npc.TargetClosest(true);
            Player         player = Main.player[npc.target];
            AbilityHandler mp     = player.GetModPlayer <AbilityHandler>();

            if (AbilityHelper.CheckDash(player, npc.Hitbox))
            {
                if (shielded)
                {
                    shielded          = false;
                    npc.velocity     += player.velocity * 0.5f;
                    mp.dash.Active    = false;
                    player.velocity  *= (player.velocity.X == 0) ? -0.4f : -0.2f;
                    player.immune     = true;
                    player.immuneTime = 10;

                    Main.PlaySound(SoundID.Shatter, npc.Center);
                    for (int k = 0; k <= 20; k++)
                    {
                        Dust.NewDust(npc.position, 48, 32, mod.DustType("Glass2"), Main.rand.Next(-3, 2), -3, 0, default, 1.7f);
Example #10
0
        public override void AI()
        {
            npc.TargetClosest(true);
            Player         player = Main.player[npc.target];
            AbilityHandler mp     = player.GetHandler();

            if (AbilityHelper.CheckDash(player, npc.Hitbox) && Shield == 1)
            {
                Shield        = 0;
                npc.velocity += player.velocity * 0.5f;

                mp.ActiveAbility?.Deactivate();
                player.velocity = Vector2.Normalize(player.velocity) * -10f;

                player.immune     = true;
                player.immuneTime = 10;

                Main.PlaySound(SoundID.Shatter, npc.Center);

                for (int k = 0; k <= 20; k++)
                {
                    Dust.NewDust(npc.position, 48, 32, DustType <Dusts.GlassGravity>(), Main.rand.Next(-3, 2), -3, 0, default, 1.7f);
        public override void Collision(Player player)
        {
            AbilityHandler mp = player.GetHandler();

            if (AbilityHelper.CheckDash(player, projectile.Hitbox))
            {
                mp.ActiveAbility?.Deactivate();

                if (player.velocity.Length() != 0)
                {
                    player.velocity           = Vector2.Normalize(player.velocity) * -18f;
                    player.wingTime           = player.wingTimeMax;
                    player.rocketTime         = player.rocketTimeMax;
                    player.jumpAgainCloud     = true;
                    player.jumpAgainBlizzard  = true;
                    player.jumpAgainSandstorm = true;
                    player.jumpAgainFart      = true;
                    player.jumpAgainSail      = true;
                }

                Main.PlaySound(SoundID.Shatter, projectile.Center);
                for (int k = 0; k <= 30; k++)
                {
                    int dus = Dust.NewDust(projectile.position, 48, 32, mod.DustType("Glass"), Main.rand.Next(-16, 15), Main.rand.Next(-16, 15), 0, default, 1.3f);
Example #12
0
        public override void AI()
        {
            /*
             * AI slots:
             * 0: Timer
             * 1: Phase
             */

            //Ticks the timer
            npc.ai[0]++;

            switch (npc.ai[1])
            {
            //on spawn effects
            case 0:
                int count = 2 + Main.player.Count(p => Vector2.Distance(p.Center, npc.Center) <= 1000) * 2;     //counts players in the fight
                if (count > 6)
                {
                    count = 6;                  //caps at 6
                }
                for (int k = 0; k < count; k++) //spawns an appropriate amount of crystals for the players
                {
                    int index = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType <VitricBossCrystal>(), 0, 0, 0, 0, k);
                    Main.npc[index].velocity = new Vector2(-1, 0).RotatedBy((k / ((float)count - 1)) * 3.14f) * 2;
                }
                ChangePhase(1);
                break;

            //First phase
            case 1:

                //Attacks
                if (npc.ai[0] >= 120)
                {
                    Main.NewText("foo!");
                    npc.ai[0] = 0;
                }

                //vulnerability check
                bool vulnerable = !Main.npc.Any(n => n.active && n.type == ModContent.NPCType <VitricBossCrystal>());

                //Dash + vulnerability detection
                if (Main.player.Any(p => AbilityHelper.CheckDash(p, npc.Hitbox)) && vulnerable)
                {
                    ChangePhase(2);
                }

                //Animation
                if (vulnerable)
                {
                    SetFrameX(1);
                    Animate(5, 3);
                }
                else
                {
                    Animate(5, 3);
                }

                break;

            //First => Second phase transition
            case 2:
                Main.PlaySound(SoundID.Shatter);

                for (int k = 0; k <= 100; k++)     //reforming glass shards
                {
                    Dust dus = Dust.NewDustPerfect(npc.Center + Vector2.One.RotatedBy(k) * 50,
                                                   ModContent.DustType <Dusts.Glass>(), Vector2.One.RotatedBy(k + Main.rand.NextFloat(-2, 2)) * Main.rand.Next(10, 20), 0, default, k / 40f);
                    dus.customData = npc.Center;
                }
                npc.scale = 0;
                SetFrameX(2);
                ChangePhase(3, true);

                music = mod.GetSoundSlot(SoundType.Music, "VortexIsACunt");

                break;
        public override void AI()
        {
            /*
             * AI slots:
             * 0: vulnerability
             * 1: timer
             * 2: phase
             * 3: index
             */

            //The boss NPC that this crystal is tied to
            NPC parent;

            //Finds the active sentinel, NPC kills itself if zero or >1 is found.
            if (Main.npc.Count(n => n.active && n.type == ModContent.NPCType <VitricBoss>()) != 1)
            {
                npc.Kill(); return;
            }
            else
            {
                parent = Main.npc.FirstOrDefault(n => n.active && n.type == ModContent.NPCType <VitricBoss>());
            }

            //Harmlessness
            if (npc.ai[0] == 1)
            {
                npc.damage = 0;
            }
            else
            {
                npc.damage = 20;
            }

            //Damage Detection
            foreach (Player player in Main.player)
            {
                if (AbilityHelper.CheckDash(player, npc.Hitbox))
                {
                    npc.life--;
                    npc.frame.Y += npc.height;
                    npc.ai[0]    = 0;

                    for (int k = 0; k <= 20; k++)
                    {
                        Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType <Dusts.Glass2>());
                    }

                    Main.PlaySound(SoundID.Shatter, npc.Center);

                    player.GetModPlayer <AbilityHandler>().dash.Active = false;
                    player.velocity *= -0.2f;
                }
            }

            //Timer
            npc.ai[1]++;

            //Behaviors
            switch (npc.ai[2])
            {
            //OnSpawn
            case 0:
                npc.scale = 0;
                npc.alpha = 255;
                npc.ai[2] = 1;
                break;

            //First Phase
            case 1:
                npc.rotation += (6.28f * 2) / 51f;
                npc.scale    += 1 / 51f;
                npc.alpha    -= 5;

                if (npc.ai[1] > 51)
                {
                    npc.ai[2] = 2; npc.ai[1] = 0; npc.velocity *= 0;
                }
                break;

            //Attacks
            case 2:
                if (npc.ai[1] >= 120)
                {
                    npc.ai[1] = 0;
                    npc.ai[2] = 3;
                }
                break;

            //Lineup
            case 3:
                Vector2 target = parent.Center + new Vector2((npc.ai[3] + 1) * 150, -100);
                if (Vector2.Distance(npc.Center, target) >= 20)
                {
                    npc.velocity = Vector2.Normalize(npc.Center - target) * -4;
                }
                else
                {
                    npc.ai[2] = 4; npc.velocity *= 0;
                }
                break;

            //Fall
            case 4:
                npc.velocity.Y += 0.5f;
                if (Main.tile[(int)npc.Center.X / 16, (int)npc.Center.Y / 16 + 1].collisionType == 1)
                {
                    npc.ai[2] = 5; npc.ai[1] = 0; npc.velocity *= 0;
                }
                break;

            //Stuck
            case 5:
                npc.ai[0] = 1;
                if (npc.ai[1] >= 360)
                {
                    npc.ai[0] = 0; npc.ai[1] = 0; npc.ai[2] = 6;
                }
                break;

            //Return
            case 6:
                npc.velocity.Y = -1;
                if (npc.ai[1] >= 60)
                {
                    npc.ai[1]     = 0;
                    npc.ai[2]     = 2;
                    npc.velocity *= 0;
                    npc.position  = parent.Center +
                                    new Vector2(-1, 0).RotatedBy((npc.ai[3] / ((float)Main.npc.Count(n => n.active && n.type == ModContent.NPCType <VitricBossCrystal>()) - 1)) * 3.14f) * 100 -
                                    npc.Hitbox.Size() / 2;
                }
                break;
            }
        }