Пример #1
0
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            ModPlayerFists mpf = ModPlayerFists.Get(player);

            mpf.comboCounterMaxBonus -= 2;
            if (player.controlUp && player.itemAnimation == 0 &&
                mpf.ComboCounter < 10 &&
                (player.HeldItem.melee || player.HeldItem.useStyle == ModPlayerFists.useStyle))
            {
                chargeTick++;
                if (chargeTick > chargeTime)
                {
                    chargeTick = chargeTimeConBonus;
                    mpf.ModifyComboCounter(1);
                    Main.PlaySound(SoundID.Item34.WithVolume(0.5f));
                }

                double  angle = Main.rand.NextFloat() * Math.PI * 2;
                Vector2 velo  = new Vector2((float)(10.0 * Math.Sin(angle)), (float)(10.0 * Math.Cos(angle)));
                Dust    d     = Dust.NewDustPerfect(player.Center, Main.rand.Next(2) == 0 ? 88 : 262, velo);
                d.position -= d.velocity * 5f;
                d.noGravity = true;
                d.scale     = 0.55f;
                d.velocity += player.velocity;
            }
            else
            {
                chargeTick = 0;
            }
        }
Пример #2
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;
                }
            }
        }