예제 #1
0
        public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
        {
            ModPlayerFists mpf = player.GetModPlayer <ModPlayerFists>();

            if (player.controlUp && (player.oldVelocity.Y == 0 || mpf.jumpAgainUppercut))
            {
                target.velocity.Y -= (target.noGravity?6.5f:11.4f) * Max(target.knockBackResist, 0.1f);
            }
            mpf.jumpAgainUppercut = true;
            EpikGlobalNPC EGN = target.GetGlobalNPC <EpikGlobalNPC>();

            if (EGN.jaded)
            {
                target.life = 0;
                target.checkDead();
                Main.PlaySound(SoundID.Shatter, (int)target.Center.X, (int)target.Center.Y, pitchOffset: -0.15f);
                Rectangle r = ModPlayerFists.UseItemGraphicbox(player, 1, 8);
                for (int i = 9; i-- > 0;)
                {
                    Vector2 pos = target.TopLeft + new Vector2(Main.rand.Next(target.width), Main.rand.Next(target.height));
                    Vector2 vel = pos - r.Center();
                    vel.Normalize();
                    vel *= 8;
                    int p = Projectile.NewProjectile(
                        r.Center(), vel.RotatedByRandom(0.5f),
                        ProjectileID.CrystalStorm,
                        damage / 6,
                        knockBack / 9,
                        player.whoAmI);
                    Main.projectile[p].penetrate += 2;
                    Main.projectile[p].extraUpdates++;
                    Main.projectile[p].timeLeft /= 2;
                    Main.projectile[p].GetGlobalProjectile <EpikGlobalProjectile>().jade = true;
                }
            }
            if (mpf.ComboEffectAbs == comboEffect)
            {
                bool flag = target.noGravity;
                ModPlayerFists.provideImmunity(player, player.itemAnimation);
                Point origin = target.Center.ToTileCoordinates();
                if (!flag && !WorldUtils.Find(origin, Searches.Chain(new Searches.Down(4), new Conditions.IsSolid()), out Point _))
                {
                    flag = true;
                }
                if (flag)
                {
                    player.velocity    = target.velocity;
                    player.velocity.X -= player.direction * 8f + player.direction * player.HeldItem.knockBack * 0.1f;
                    player.velocity.Y -= player.gravDir * 0.125f * player.itemAnimationMax;
                    player.fallStart   = (int)(player.position.Y / 16f);
                }
                else
                {
                    player.velocity  = new Vector2(-player.direction * (2f + player.HeldItem.knockBack * 0.5f) + target.velocity.X * 0.5f, target.velocity.Y * 1.5f * target.knockBackResist);
                    player.fallStart = (int)(player.position.Y / 16f);
                }
                //ManagePlayerComboMovement.Invoke(mpf,new object[]{target});
                mpf.dashSpeed             = 0f;
                mpf.dashMaxSpeedThreshold = 0f;
                mpf.dashMaxFriction       = 0f;
                mpf.dashMinFriction       = 0f;
                mpf.dashEffect            = 0;
                player.dash          = 0;
                player.attackCD      = player.itemAnimationMax;
                player.itemAnimation = 1;
                switch (target.type)
                {
                case 139:
                case 315:
                case 325:
                case 329:
                case 439:
                case 533:
                case 423:
                case 478:
                case 471:
                    target.buffImmune[BuffID.MoonLeech] = false;
                    break;

                default:
                    break;
                }
                float combomult = 20f - player.GetModPlayer <ModPlayerFists>().comboCounterMaxBonus;
                combomult /= Math.Max(0.5f, 2 - item.scale);
                if (target.life > 0 && target.life < (mpf.ComboCounter + item.tileBoost) * combomult && !target.immortal && !target.buffImmune[BuffID.MoonLeech])
                {
                    EGN.jaded       = true;
                    EGN.freezeFrame = target.frame;
                    mpf.ModifyComboCounter(-mpf.ComboCounter);
                    target.velocity.X += knockBack * player.direction;
                }
            }
        }