Exemple #1
0
        public override bool CanUseItem(Player player)
        {
            OrchidModPlayer modPlayer = player.GetModPlayer <OrchidModPlayer>();

            if (modPlayer.dancerPoise < this.poiseCost)
            {
                return(false);
            }
            else
            {
                Vector2 heading = Main.MouseWorld - player.Center;
                heading.Normalize();
                heading *= new Vector2(this.dashVelocity, this.dashVelocity).Length();
                float speedXAlt = this.horizontal ? heading.X : 0f;
                float speedYAlt = this.vertical ? heading.Y : 0f;

                modPlayer.dancerVelocity        = new Vector2(speedXAlt, speedYAlt);
                modPlayer.dancerWeaponDamage    = item.damage;
                modPlayer.dancerWeaponKnockback = item.knockBack;
                modPlayer.dancerWeaponType      = this.dancerItemType;
                modPlayer.dancerDashTimer       = this.dashTimer;
                OrchidModDancerHelper.removeDancerPoise(this.poiseChance, this.poiseCost, player, modPlayer, mod);
            }
            return(base.CanUseItem(player));
        }
        public static void ModifyHitByNPCDancer(NPC npc, ref int damage, ref bool crit, Player player, OrchidModPlayer modPlayer, Mod mod)
        {
            if (modPlayer.dancerWeaponType != OrchidModDancerItemType.NULL)
            {
                if (!(npc.boss || npc.type == NPCID.TargetDummy) && npc.knockBackResist > 0f)
                {
                    npc.velocity.X = player.velocity.X * modPlayer.dancerWeaponKnockback * npc.knockBackResist / 5;
                    npc.velocity.Y = player.velocity.Y * modPlayer.dancerWeaponKnockback * npc.knockBackResist / 5;
                }
                npc.StrikeNPCNoInteraction(modPlayer.dancerWeaponDamage, 0f, 0);

                switch (modPlayer.dancerWeaponType)
                {
                case OrchidModDancerItemType.IMPACT:
                    player.velocity = modPlayer.dancerVelocity * -0.5f;
                    OrchidModDancerHelper.clearDancerEffects(player, modPlayer, mod);
                    break;

                case OrchidModDancerItemType.PHASE:
                    break;

                case OrchidModDancerItemType.MOMENTUM:
                    player.velocity = modPlayer.dancerVelocity * -1f;
                    break;

                default:
                    break;
                }

                damage = 0;
                modPlayer.dancerInvincibility = 10;
            }
        }
        public static void ResetEffectsDancer(Player player, OrchidModPlayer modPlayer, Mod mod)
        {
            modPlayer.dancerDamage         = 1.0f;
            modPlayer.dancerCrit           = 0;
            modPlayer.dancerPoiseMax       = 20;
            modPlayer.dancerPoiseConsume   = 0;
            modPlayer.dancerInvincibility -= modPlayer.dancerInvincibility > 0 ? 1 : 0;

            if (modPlayer.dancerDashTimer > 0)
            {
                modPlayer.dancerDashTimer--;
                if (modPlayer.dancerDashTimer == 0)
                {
                    player.velocity *= 0f;
                    OrchidModDancerHelper.clearDancerEffects(player, modPlayer, mod);
                }
            }
        }