public override bool UseItem(Player player)
 {
     CalamityMod.CalamityPlayer CalamityPlayer = player.GetModPlayer <CalamityMod.CalamityPlayer>(Calamity);
     CalamityPlayer.stress = 10000;
     player.AddBuff(ModLoader.GetMod("CalamityMod").BuffType("HeartAttack"), 18000, true);
     return(true);
 }
Example #2
0
        public override bool UseItem(Player player)
        {
            CalamityMod.CalamityPlayer CalamityPlayer = player.GetModPlayer <CalamityMod.CalamityPlayer>(Calamity);
            for (int h = 0; h < 1; h++)
            {
                Vector2 vel = new Vector2(0, -1);
                vel *= 0f;
                Projectile.NewProjectile(player.Center.X, player.Center.Y, vel.X, vel.Y, mod.ProjectileType("Drainer"), 0, 0, player.whoAmI);
            }
            player.Hurt(PlayerDeathReason.LegacyEmpty(), 2, 0, false, false, false, -1);
            CalamityPlayer.stress += 2500;
            player.statLife        = (player.statLife - player.statLifeMax2 / 4);
            PlayerDeathReason damageSource = PlayerDeathReason.ByOther(13);

            if (Main.rand.Next(2) == 0)
            {
                damageSource = PlayerDeathReason.ByOther(player.Male ? 14 : 15);
            }
            if (player.statLife <= 0)
            {
                player.KillMe(damageSource, 1.0, 0, false);
            }
            player.lifeRegenCount = 0;
            player.lifeRegenTime  = 0;
            return(true);
        }
Example #3
0
 private void RnAReset(Player player)
 {
     CalamityMod.CalamityPlayer CalamityPlayer = player.GetModPlayer <CalamityMod.CalamityPlayer>(Calamity);
     CalamityPlayer.stress     = 0;
     CalamityPlayer.adrenaline = 0;
 }
Example #4
0
        public override void AI()
        {
            Player player = Main.player[(int)Player.FindClosest(npc.position, npc.width, npc.height)];

            Main.dayTime      = false;
            Main.monolithType = 3;
            Main.time         = 0.0;
            counter4++;
            if (npc.life < npc.lifeMax && counter4 >= 2)
            {
                npc.life++;
                counter4 = 0;
            }
            if (npc.velocity.X < 0)
            {
                npc.rotation        = 1.25f;
                npc.spriteDirection = -1;
            }
            else
            {
                npc.rotation        = -1.25f;
                npc.spriteDirection = 1;
            }
            if (introduction >= 300)
            {
                counter5++;
                if (counter5 == 1)
                {
                    Vector2 delta     = player.Center - npc.Center;
                    float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                    if (magnitude > 0)
                    {
                        delta *= (5f / magnitude);
                    }
                    else
                    {
                        delta = new Vector2(0f, 5f);
                    }
                    delta       *= 2f;
                    npc.velocity = delta;
                }
                if (counter5 == 60)
                {
                    Vector2 delta     = player.Center - npc.Center;
                    float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                    if (magnitude > 0)
                    {
                        delta *= (5f / magnitude);
                    }
                    else
                    {
                        delta = new Vector2(0f, 5f);
                    }
                    delta       *= 2f;
                    npc.velocity = delta;
                }
                if (counter5 == 120)
                {
                    Vector2 delta     = player.Center - npc.Center;
                    float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                    if (magnitude > 0)
                    {
                        delta *= (5f / magnitude);
                    }
                    else
                    {
                        delta = new Vector2(0f, 5f);
                    }
                    delta       *= 2f;
                    npc.velocity = delta;
                }
                if (counter5 == 600)
                {
                    counter5 = 0;
                }
            }
            float TPX      = npc.position.X + npc.width * 0.5f - player.Center.X;
            float TPY      = npc.position.Y + npc.height * 0.5f - player.Center.Y;
            float distance = (float)Math.Sqrt(TPX * TPX + TPY * TPY);

            if (player.name == "Bill")
            {
                if (introduction < 1)
                {
                    Main.NewText("What? Are you my namesake? Well, I don't want to fight you.", 10, 255, 10);
                    Main.NewText("Here, catch my present! Bye!", 10, 255, 10);
                    player.QuickSpawnItem(mod.ItemType("BillCipherBag"));
                }
                npc.boss      = false;
                npc.velocity  = new Vector2(0, -10);
                npc.velocity *= 3f;
            }
            if (distance > 2500f && introduction >= 300)
            {
                Main.NewText("Don't think that you can hide from me, mortal!", 10, 255, 10);
                switch (Main.rand.Next(2))
                {
                case 0:
                    npc.Center = player.Center - new Vector2(350, 100);
                    break;

                case 1:
                    npc.Center = player.Center - new Vector2(-350, -100);
                    break;
                }
            }
            if (ModLoader.GetLoadedMods().Contains("ThoriumMod"))
            {
                player.buffImmune[ModLoader.GetMod("ThoriumMod").BuffType("AbyssalShell")] = true;
                npc.buffImmune[ModLoader.GetMod("ThoriumMod").BuffType("AParalyzed")]      = true;
                npc.buffImmune[ModLoader.GetMod("ThoriumMod").BuffType("Paralyzed")]       = true;
            }
            npc.buffImmune[mod.BuffType("ArmorDestruction")] = true;
            npc.buffImmune[mod.BuffType("Twilight")]         = true;
            npc.buffImmune[mod.BuffType("Electrocute")]      = true;
            npc.buffImmune[mod.BuffType("Patience")]         = true;
            if (ModLoader.GetLoadedMods().Contains("CalamityMod"))
            {
                npc.buffImmune[ModLoader.GetMod("CalamityMod").BuffType("SilvaStun")] = true;
                npc.buffImmune[ModLoader.GetMod("CalamityMod").BuffType("ExoFreeze")] = true;
            }
            int damage1 = 200;
            int damage2 = 150;
            int damage3 = 250;

            if (introduction < 300)
            {
                npc.dontTakeDamage = true;
            }
            if (npc.life > npc.lifeMax / 2 && !player.dead && !npc.GetGlobalNPC <ModGlobalNPC>(mod).intermission1)
            {
                introduction++;

                if (introduction > 300)
                {
                    npc.dontTakeDamage = false;
                    if (counter2 >= 10)
                    {
                        counter2 = 0;
                        Vector2 delta     = player.Center - npc.Center;
                        float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                        if (magnitude > 0)
                        {
                            delta *= (5f / magnitude);
                        }
                        else
                        {
                            delta = new Vector2(0f, 5f);
                        }
                        delta *= 4f;
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta.X, delta.Y, mod.ProjectileType("DeadlyLaser"), 500, 0, Main.myPlayer);
                    }
                    if (counter >= 20)
                    {
                        counter = 0;
                        Vector2 delta     = player.Center - npc.Center;
                        float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                        if (magnitude > 0)
                        {
                            delta *= 5f / magnitude;
                        }
                        else
                        {
                            delta = new Vector2(0f, 5f);
                        }
                        delta *= 1.8f;
                        Vector2 delta2 = delta.RotatedByRandom(MathHelper.ToRadians(15));
                        Vector2 delta3 = delta.RotatedByRandom(MathHelper.ToRadians(15));
                        Vector2 delta4 = delta.RotatedByRandom(MathHelper.ToRadians(35));
                        Vector2 delta5 = delta.RotatedByRandom(MathHelper.ToRadians(35));
                        Vector2 delta6 = delta.RotatedByRandom(MathHelper.ToRadians(50));
                        Vector2 delta7 = delta.RotatedByRandom(MathHelper.ToRadians(50));
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta.X, delta.Y, 100, damage1, 0, Main.myPlayer);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta2.X, delta2.Y, 100, damage1, 0, Main.myPlayer);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta3.X, delta3.Y, 100, damage1, 0, Main.myPlayer);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta4.X, delta3.Y, 100, damage1, 0, Main.myPlayer);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta5.X, delta3.Y, 100, damage1, 0, Main.myPlayer);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta6.X, delta3.Y, 100, damage1, 0, Main.myPlayer);
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta7.X, delta3.Y, 100, damage1, 0, Main.myPlayer);
                    }
                    counter++;
                    counter2++;
                }
            }
            if (npc.life < npc.lifeMax / 2 && npc.life > npc.lifeMax * 0.15f && !player.dead && !npc.GetGlobalNPC <ModGlobalNPC>(mod).intermission2)
            {
                player.AddBuff((mod.BuffType("Madness")), 2);
                if (ModLoader.GetLoadedMods().Contains("CalamityMod"))
                {
                    if (CalamityModRevengeance)
                    {
                        counter3++;
                        if (counter3 <= 900)
                        {
                            player.gravDir = -1f;
                        }
                        if (counter3 > 900 && counter3 <= 1800)
                        {
                            player.gravDir = 1f;
                        }
                        if (counter3 > 1800)
                        {
                            counter3 = 0;
                        }
                    }
                }
                if (counter >= 15)
                {
                    counter = 0;
                    Vector2 delta     = player.Center - npc.Center;
                    float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                    if (magnitude > 0)
                    {
                        delta *= (5f / magnitude);
                    }
                    else
                    {
                        delta = new Vector2(0f, 5f);
                    }
                    delta *= 2f;
                    Vector2 delta2 = delta.RotatedByRandom(MathHelper.ToRadians(20));
                    Vector2 delta3 = delta.RotatedByRandom(MathHelper.ToRadians(20));
                    Vector2 delta4 = delta.RotatedByRandom(MathHelper.ToRadians(15));
                    Vector2 delta5 = delta.RotatedByRandom(MathHelper.ToRadians(15));
                    Vector2 delta6 = delta.RotatedByRandom(MathHelper.ToRadians(10));
                    Vector2 delta7 = delta.RotatedByRandom(MathHelper.ToRadians(10));
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta.X, delta.Y, mod.ProjectileType("DeadlyLaser"), 500, 0, Main.myPlayer);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta2.X, delta2.Y, 100, damage2, 0, Main.myPlayer);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta3.X, delta3.Y, 100, damage2, 0, Main.myPlayer);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta4.X, delta4.Y, 100, damage2, 0, Main.myPlayer);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta5.X, delta5.Y, 100, damage2, 0, Main.myPlayer);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta6.X, delta7.Y, mod.ProjectileType("DeadlyLaser"), 500, 0, Main.myPlayer);
                    Projectile.NewProjectile(npc.Center.X, npc.Center.Y, delta6.X, delta7.Y, mod.ProjectileType("DeadlyLaser"), 500, 0, Main.myPlayer);
                }
                counter++;
            }
            if (npc.life < npc.lifeMax * 0.15f && !player.dead)
            {
                player.AddBuff((mod.BuffType("Madness")), 2);
                if (ModLoader.GetLoadedMods().Contains("CalamityMod"))
                {
                    if (CalamityModRevengeance)
                    {
                        counter3++;
                        if (counter3 <= 900)
                        {
                            player.gravDir = -1f;
                        }
                        if (counter3 > 900 && counter3 <= 1800)
                        {
                            player.gravDir = 1f;
                        }
                        if (counter3 > 1800)
                        {
                            counter3 = 0;
                        }
                    }
                }
                if (counter2 >= 20)
                {
                    for (int i = 0; i < 10; i++)
                    {
                        int  dustType  = Main.rand.Next(51, 54);
                        int  dustIndex = Dust.NewDust(npc.position, npc.width, npc.height, dustType);
                        Dust dust      = Main.dust[dustIndex];
                        dust.velocity.X = dust.velocity.X + Main.rand.Next(-50, 51) * 0.01f;
                        dust.velocity.Y = dust.velocity.Y + Main.rand.Next(-50, 51) * 0.01f;
                        dust.scale     *= 0.8f;
                        dust.noGravity  = true;
                    }
                }
                if (counter2 >= 40)
                {
                    Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 62);
                    counter2 = 0;
                    Vector2 delta     = player.Center - npc.Center;
                    float   magnitude = (float)Math.Sqrt(delta.X * delta.X + delta.Y * delta.Y);
                    if (magnitude > 0)
                    {
                        delta *= (5f / magnitude);
                    }
                    else
                    {
                        delta = new Vector2(0f, 5f);
                    }
                    delta *= 6f;
                    float numberProjectiles = 15;
                    float rotation          = MathHelper.ToRadians(2);
                    delta += Vector2.Normalize(new Vector2(delta.X, delta.Y)) * 45f;
                    for (int i = 0; i < numberProjectiles; i++)
                    {
                        Vector2 perturbedSpeed = new Vector2(delta.X, delta.Y).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numberProjectiles - 1))) * .2f;
                        Projectile.NewProjectile(npc.Center.X, npc.Center.Y, perturbedSpeed.X, perturbedSpeed.Y, mod.ProjectileType("Vaporizer"), damage3, 0, player.whoAmI);
                    }
                }
                counter2++;
            }
            if (ModLoader.GetLoadedMods().Contains("CalamityMod"))
            {
                if (CalamityModRevengeance)
                {
                    CalamityMod.CalamityPlayer CalamityPlayer = player.GetModPlayer <CalamityMod.CalamityPlayer>(Calamity);
                    CalamityPlayer.stress     = 0;
                    CalamityPlayer.adrenaline = 0;
                }
            }
            if (((AlchemistNPCPlayer)player.GetModPlayer(mod, "AlchemistNPCPlayer")).CursedMirror == true)
            {
                npc.reflectingProjectiles = true;
            }
            if (((AlchemistNPCPlayer)player.GetModPlayer(mod, "AlchemistNPCPlayer")).CursedMirror == false)
            {
                npc.reflectingProjectiles = false;
            }
        }