コード例 #1
0
        public override void OnHitNPCWithProj(Terraria.Projectile proj, Terraria.NPC target, int damage, float knockback, bool crit)
        {
            if (QueensStinger)
            {
                if (proj.type != 181)
                {
                    if (Terraria.Main.rand.NextBool(10))
                    {
                        Terraria.Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ProjectileID.Bee, 3, 2, player.whoAmI);
                    }
                }
            }

            if (EmeraldEmpoweredGem)
            {
                target.AddBuff(39, 40);
            }

            if (MidasCrown)
            {
                target.AddBuff(BuffID.Midas, 900);
            }

            if (FrostProjectile)
            {
                if (Terraria.Main.rand.NextBool(2))
                {
                    target.AddBuff(BuffID.Frostburn, 120);
                }
            }


            if (SpiritCultistBonus && proj.magic && !target.boss)
            {
                if (target.FindBuffIndex(ModContent.BuffType <LiftedSpiritsDebuff>()) < 1)
                {
                    target.velocity.Y -= 20;
                }

                target.AddBuff(ModContent.BuffType <LiftedSpiritsDebuff>(), 210);
            }
            if (PhanticRangedBonus && proj.ranged && Terraria.Main.rand.NextFloat() < 0.15f && proj.type != ModContent.ProjectileType <PhanticSoul>())
            {
                float   rot      = Terraria.Main.rand.NextFloat(MathHelper.TwoPi);
                Vector2 position = target.Center + Vector2.One.RotatedBy(rot) * 180;
                Vector2 velocity = Vector2.One.RotatedBy(rot) * -1 * 12f;
                Terraria.Projectile.NewProjectile(position, velocity, ModContent.ProjectileType <PhanticSoul>(), 30, player.HeldItem.knockBack, player.whoAmI, 0, 0);
            }
        }