public void DoApoco(NPC npc, Projectile projectile, Player player, Item item, ref int damage, ref float knockback, ref bool crit, int bitBoldedEffects = 7, bool always = false)
        {
            bool effectSound     = (bitBoldedEffects & (1 << 1 - 1)) != 0;
            bool effectText      = (bitBoldedEffects & (1 << 2 - 1)) != 0;
            bool effectShockwave = (bitBoldedEffects & (1 << 3 - 1)) != 0;

            SGAPlayer moddedplayer = player.GetModPlayer <SGAPlayer>();
            int       chance       = -1;

            if (projectile != null)
            {
                if (projectile.melee)
                {
                    chance = 0;
                }
                if (projectile.ranged)
                {
                    chance = 1;
                }
                if (projectile.magic)
                {
                    chance = 2;
                }
                if (projectile.thrown || projectile.Throwing().thrown)
                {
                    chance = 3;
                }
            }
            if (item != null)
            {
                if (item.melee)
                {
                    chance = 0;
                }
                if (item.ranged)
                {
                    chance = 1;
                }
                if (item.magic)
                {
                    chance = 2;
                }
                if (item.thrown || item.Throwing().thrown)
                {
                    chance = 3;
                }
            }
            if (npc != null && (always || chance > -1))
            {
                double chanceboost = 0;
                if (projectile != null)
                {
                    chanceboost += projectile.GetGlobalProjectile <SGAprojectile>().extraApocoChance;
                }

                if (always || (crit && Main.rand.Next(0, 100) < (moddedplayer.apocalypticalChance[chance] + chanceboost)))
                {
                    if (moddedplayer.HoE && projectile != null)
                    {
                        float ammount = damage;
                        if (moddedplayer.lifestealentropy > 0)
                        {
                            projectile.vampireHeal((int)((ammount * moddedplayer.apocalypticalStrength)), npc.Center);
                            moddedplayer.lifestealentropy -= ammount;
                        }
                    }

                    if (moddedplayer.ninjaSash > 2)
                    {
                        for (int i = 0; i < Main.maxProjectiles; i += 1)
                        {
                            Projectile proj = Main.projectile[i];
                            if (proj.active && proj.owner == player.whoAmI)
                            {
                                if (proj.Throwing().thrown || proj.thrown)
                                {
                                    proj.SGAProj().Embue(projectile);
                                }
                            }
                        }
                    }

                    if (moddedplayer.SybariteGem)
                    {
                        float mul     = moddedplayer.apocalypticalStrength * (((float)damage * 3f) / (float)npc.lifeMax);
                        int   ammount = (int)((float)npc.value * mul);


                        Vector2 pos = new Vector2((int)npc.position.X, (int)npc.position.Y);
                        pos += new Vector2(Main.rand.Next(npc.width), Main.rand.Next(npc.height));
                        SGAUtils.SpawnCoins(pos, ammount, 10f + Math.Min(3f * mul, 20f));
                    }

                    if (moddedplayer.dualityshades)
                    {
                        int ammo = 0;
                        for (int i = 0; i < 4; i += 1)
                        {
                            if (moddedplayer.ammoinboxes[i] > 0)
                            {
                                int  ammox = moddedplayer.ammoinboxes[i];
                                Item itemx = new Item();
                                itemx.SetDefaults(ammox);
                                if (itemx.ammo == AmmoID.Bullet)
                                {
                                    ammo = ammox;
                                    break;
                                }
                            }
                        }
                        if (ammo > 0)
                        {
                            Item itemy = new Item();
                            itemy.SetDefaults(ammo);
                            int shootype = itemy.shoot;

                            for (int i = 128; i < 260; i += 128)
                            {
                                Vector2 anglez = new Vector2(Main.rand.Next(-8000, 8000), Main.rand.Next(-8000, 8000));
                                anglez.Normalize();

                                Main.PlaySound(SoundID.Item, (int)((npc.Center.X) + (anglez.X * i)), (int)((npc.Center.Y) + (anglez.Y * i)), 25, 0.5f, Main.rand.NextFloat(-0.9f, -0.25f));

                                int thisoned = Projectile.NewProjectile(npc.Center + (anglez * i), anglez * -16f, shootype, (int)(damage * 1.50f * moddedplayer.apocalypticalStrength), 0f, Main.myPlayer);
                                Main.projectile[thisoned].ranged = false;


                                for (float gg = 4f; gg > 0.25f; gg -= 0.15f)
                                {
                                    int  dustIndex = Dust.NewDust(npc.Center + new Vector2(-8, -8) + (anglez * i), 16, 16, DustID.AncientLight, -anglez.X * gg, -anglez.Y * gg, 150, Color.Purple, 3f);
                                    Dust dust      = Main.dust[dustIndex];
                                    dust.noGravity = true;
                                }

                                player.ConsumeItemRespectInfiniteAmmoTypes(ammo);
                            }
                        }
                    }

                    if (moddedplayer.RadSuit)
                    {
                        //IrradiatedAmmount = Math.Max(IrradiatedAmmount, 25);

                        IrradiatedExplosion(npc, (int)(damage * 1f * moddedplayer.apocalypticalStrength));

                        SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_DarkMageHealImpact, (int)npc.Center.X, (int)npc.Center.Y);
                        if (sound != null)
                        {
                            sound.Pitch += 0.525f;
                        }

                        int proj;

                        if (projectile != null)
                        {
                            proj = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType <RadioactivePool>(), (int)(damage * 0.5f * moddedplayer.apocalypticalStrength), projectile.knockBack, projectile.owner);
                        }
                        else
                        {
                            proj = Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <RadioactivePool>(), (int)(damage * 0.5f * moddedplayer.apocalypticalStrength), knockback, player.whoAmI);
                        }

                        Main.projectile[proj].width    += 80;
                        Main.projectile[proj].height   += 80;
                        Main.projectile[proj].timeLeft += (int)(30 * moddedplayer.apocalypticalStrength);
                        Main.projectile[proj].Center   -= new Vector2(40, 40);
                        Main.projectile[proj].netUpdate = true;
                    }

                    if (moddedplayer.CalamityRune)
                    {
                        Main.PlaySound(SoundID.Item45, npc.Center);
                        int boom = Projectile.NewProjectile(npc.Center.X, npc.Center.Y, 0f, 0f, mod.ProjectileType("BoulderBlast"), (int)((damage * 2) * moddedplayer.apocalypticalStrength), knockback * 2f, player.whoAmI, 0f, 0f);
                        Main.projectile[boom].usesLocalNPCImmunity = true;
                        Main.projectile[boom].localNPCHitCooldown  = -1;
                        Main.projectile[boom].netUpdate            = true;
                        IdgProjectile.AddOnHitBuff(boom, BuffID.Daybreak, (int)(60f * moddedplayer.apocalypticalStrength));
                        IdgProjectile.AddOnHitBuff(boom, mod.BuffType("EverlastingSuffering"), (int)(400f * moddedplayer.apocalypticalStrength));
                    }

                    damage = (int)(damage * (3f + (moddedplayer.apocalypticalStrength - 1f)));

                    if (moddedplayer.magatsuSet && npc.HasBuff(ModContent.BuffType <Watched>()))
                    {
                        Projectile.NewProjectile(npc.Center, Vector2.Zero, ModContent.ProjectileType <Items.Armors.Magatsu.ExplosionDarkSectorEye>(), 0, 0);

                        Point location;

                        if (projectile != null)
                        {
                            location = new Point((int)projectile.Center.X, (int)projectile.Center.Y);
                        }
                        else
                        {
                            location = new Point((int)npc.Center.X, (int)npc.Center.Y);
                        }

                        SoundEffectInstance sound = Main.PlaySound(SoundID.DD2_WyvernScream, (int)location.X, (int)location.Y);
                        if (sound != null)
                        {
                            sound.Pitch = 0.925f;
                        }

                        foreach (NPC enemy in Main.npc.Where(testby => testby.active && !testby.dontTakeDamage && !testby.friendly && testby != npc && (testby.Center - npc.Center).LengthSquared() < 400 * 400))
                        {
                            int damazz = Main.DamageVar(damage);
                            enemy.StrikeNPC(damazz, 16, -enemy.spriteDirection, true);

                            if (Main.netMode != 0)
                            {
                                NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, damazz, 16f, (float)1, 0, 0, 0);
                            }
                        }
                    }

                    if (effectText)
                    {
                        CombatText.NewText(new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height), Color.DarkRed, "Apocalyptical!", true, false);
                    }
                    if (SGAConfigClient.Instance.EpicApocalypticals)
                    {
                        if (effectShockwave)
                        {
                            RippleBoom.MakeShockwave(npc.Center, 8f, 1f, 10f, 60, 1f);
                            if (SGAmod.ScreenShake < 32)
                            {
                                SGAmod.AddScreenShake(24f, 1200, player.Center);
                            }
                        }
                        if (effectSound)
                        {
                            Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/crit_hit").WithVolume(.7f).WithPitchVariance(.25f), npc.Center);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public bool DoingIntro()
        {
            introstate = 0;
            if (intro < 1200)
            {
                if (intro >= 950)
                {
                    introstate = 1;
                }
                if (intro < 200)
                {
                    npc.velocity.Y -= 0.5f;
                }
                if (intro == 100)
                {
                    Idglib.Chat("Draken: ...", 0, 200, 0);
                }
                if (intro == 200)
                {
                    Idglib.Chat("Draken: I...", 0, 200, 0);
                }
                if (intro == 400)
                {
                    Idglib.Chat("Draken: Trusted you...", 0, 200, 0);
                }
                if (intro == 600)
                {
                    Idglib.Chat("Draken: How could...", 0, 200, 0);
                }
                if (intro == 700)
                {
                    Idglib.Chat("Draken: You do this?", 0, 200, 0);
                }
                if (intro == 800)
                {
                    Idglib.Chat("Draken: how Could...!", 0, 200, 0);
                }
                if (intro == 950)
                {
                    Idglib.Chat("True Draken: YOU?!!", 200, 0, 0);
                    RippleBoom.MakeShockwave(npc.Center, 8f, 2f, 20f, 100, 3f, true);
                    Main.PlaySound(15, (int)npc.Center.X, (int)npc.Center.Y, 2, 1f, -0.5f);
                    npc.velocity.Y = 0;
                }
                if (npc.ai[1] < 1)
                {
                    if (intro == 1100)
                    {
                        Idglib.Chat("True Draken: Justice shall fall down on you!", 200, 0, 0);
                    }
                    if (intro == 1199)
                    {
                        Idglib.Chat("True Draken: Repent!", 200, 0, 0);
                    }
                }

                if (npc.ai[1] == 1)
                {
                    npc.ai[0] = 2200;
                    if (intro == 1000)
                    {
                        Idglib.Chat("True Draken: What do you hope to gain?", 200, 0, 0);
                    }
                    if (intro == 1150)
                    {
                        Idglib.Chat("True Draken: Tell me what?!", 200, 0, 0);
                    }
                }
                if (npc.ai[1] == 2)
                {
                    npc.ai[0] = -999;
                    if (intro == 1000)
                    {
                        Idglib.Chat("True Draken: I won't let you...", 200, 0, 0);
                    }
                    if (intro == 1150)
                    {
                        Idglib.Chat("True Draken: I WON'T LET YOU!!", 200, 0, 0);
                    }
                }

                if (intro > 700 && intro < 950)
                {
                    npc.velocity.Y -= (intro - 700f) / 1000f;
                }
                npc.velocity /= 1.5f;
                return(true);
            }
            introstate = 2;
            return(false);
        }