Ejemplo n.º 1
0
        public override void Update(Player player, ref int buffIndex)
        {
            MyPlayer modPlayer = MyPlayer.ModPlayer(player);

            KiDrainAdd(player);
            if (Transformations.IsAnyKaioken(player) || Transformations.IsSSJG(player))
            {
                Lighting.AddLight(player.Center + player.velocity * 8f, 0.2f, 0f, 0f);
            }
            else if (Transformations.IsLSSJ1(player) || Transformations.IsLSSJ2(player))
            {
                Lighting.AddLight(player.Center + player.velocity * 8f, 0f, 0.2f, 0f);
            }
            else if (Transformations.IsSSJ1(player) || Transformations.IsSSJ2(player) || Transformations.IsSSJ2(player) || Transformations.IsASSJ(player) || Transformations.IsUSSJ(player))
            {
                Lighting.AddLight(player.Center + player.velocity * 8f, 0.2f, 0.2f, 0f);
            }
            else if (Transformations.IsSpectrum(player))
            {
                var rainbow = Main.DiscoColor;
                Lighting.AddLight(player.Center + player.velocity * 8f, rainbow.R / 512f, rainbow.G / 512f, rainbow.B / 512f);
            }

            //give bonus base defense
            player.statDefense += BaseDefenceBonus;

            // if the player is in any ki-draining state, handles ki drain and power down when ki is depleted
            if (Transformations.IsAnythingOtherThanKaioken(player))
            {
                // player ran out of ki, so make sure they fall out of any forms they might be in.
                if (modPlayer.IsKiDepleted())
                {
                    if (Transformations.IsSuperKaioken(player))
                    {
                        modPlayer.KaiokenLevel = 0;
                    }
                    Transformations.EndTransformations(player, true, false);
                }
                else
                {
                    modPlayer.AddKi((KiDrainRate + modPlayer.KiDrainAddition) * -1, false, true);
                    KiDrainAddTimer++;
                    if (KiDrainAddTimer > 600)
                    {
                        modPlayer.KiDrainAddition += 1;
                        KiDrainAddTimer            = 0;
                    }
                    Lighting.AddLight(player.Center, 1f, 1f, 0f);
                }
            }
            else
            {
                // the player isn't in a ki draining state anymore, reset KiDrainAddition
                modPlayer.KiDrainAddition = 0;
            }

            player.moveSpeed       *= GetModifiedSpeedMultiplier(modPlayer);
            player.maxRunSpeed     *= GetModifiedSpeedMultiplier(modPlayer);
            player.runAcceleration *= GetModifiedSpeedMultiplier(modPlayer);
            if (player.jumpSpeedBoost < 1f)
            {
                player.jumpSpeedBoost = 1f;
            }
            player.jumpSpeedBoost *= GetModifiedSpeedMultiplier(modPlayer);

            // set player damage  mults
            player.meleeDamage  *= GetHalvedDamageBonus();
            player.rangedDamage *= GetHalvedDamageBonus();
            player.magicDamage  *= GetHalvedDamageBonus();
            player.minionDamage *= GetHalvedDamageBonus();
            player.thrownDamage *= GetHalvedDamageBonus();
            modPlayer.KiDamage  *= DamageMulti;

            // cross mod support stuff
            if (DBZMOD.instance.thoriumLoaded)
            {
                ThoriumEffects(player);
            }
            if (DBZMOD.instance.tremorLoaded)
            {
                TremorEffects(player);
            }
            if (DBZMOD.instance.enigmaLoaded)
            {
                EnigmaEffects(player);
            }
            if (DBZMOD.instance.battlerodsLoaded)
            {
                BattleRodEffects(player);
            }
            if (DBZMOD.instance.expandedSentriesLoaded)
            {
                ExpandedSentriesEffects(player);
            }
        }
Ejemplo n.º 2
0
        public static void Update(Player player)
        {
            // this might seem weird but the server isn't allowed to control the flight system.
            if (Main.netMode == NetmodeID.Server)
            {
                return;
            }

            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            //check for ki or death lol
            if ((modPlayer.IsKiDepleted() || player.dead || player.mount.Type != -1 || player.ropeCount != 0) && modPlayer.isFlying)
            {
                modPlayer.isFlying = false;
                AddKatchinFeetBuff(player);
            }

            if (modPlayer.isFlying)
            {
                // cancel platform collision
                player.DryCollision(true, true);

                //prepare vals
                player.fullRotationOrigin = new Vector2(11, 22);
                Vector2 mRotationDir = Vector2.Zero;

                int flightDustType = 261;

                //Input checks
                float boostSpeed = (BURST_SPEED)*(modPlayer.isCharging ? 1 : 0);

                // handle ki drain
                float totalFlightUsage = Math.Max(1f, FLIGHT_KI_DRAIN * modPlayer.flightKiConsumptionMultiplier);
                float flightCostMult   = modPlayer.flightUpgraded ? 0.25f : (modPlayer.flightDampeningUnlocked ? 0.5f : 1f);
                totalFlightUsage *= flightCostMult;
                modPlayer.AddKi((totalFlightUsage * (1f + boostSpeed)) * -1, false, false);
                float flightSpeedMult = (1f + boostSpeed);
                flightSpeedMult *= modPlayer.flightUpgraded ? 1.25f : (modPlayer.flightDampeningUnlocked ? 1f : 0.75f);
                float flightSpeed = FLIGHT_SPEED * flightSpeedMult;

                float totalHorizontalFlightSpeed = flightSpeed + (player.moveSpeed / 3) + modPlayer.flightSpeedAdd;
                float totalVerticalFlightSpeed   = flightSpeed + (Player.jumpSpeed / 2) + modPlayer.flightSpeedAdd;

                if (modPlayer.isUpHeld)
                {
                    // for some reason flying up is way, way faster than flying down.
                    player.velocity.Y -= (totalVerticalFlightSpeed / 3.8f);
                    mRotationDir       = Vector2.UnitY;
                }
                else if (modPlayer.isDownHeld)
                {
                    player.maxFallSpeed = 20f;
                    player.velocity.Y  += totalVerticalFlightSpeed / 3.6f;
                    mRotationDir        = -Vector2.UnitY;
                }

                if (modPlayer.isRightHeld)
                {
                    player.velocity.X += totalHorizontalFlightSpeed;
                    mRotationDir      += Vector2.UnitX;
                }
                else if (modPlayer.isLeftHeld)
                {
                    player.velocity.X -= totalHorizontalFlightSpeed;
                    mRotationDir      -= Vector2.UnitX;
                }

                // TODO Add in TransformationAppearance class.
                if (modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.SSJ1Definition) && !modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.SSJGDefinition))
                {
                    flightDustType = 170;
                }
                else if (modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.LSSJDefinition))
                {
                    flightDustType = 107;
                }
                else if (modPlayer.IsTransformedInto(DBZMOD.Instance.TransformationDefinitionManager.SSJGDefinition))
                {
                    flightDustType = 174;
                }
                else if (DBZMOD.Instance.TransformationDefinitionManager.IsKaioken(modPlayer.ActiveTransformations))
                {
                    flightDustType = 182;
                }
                else
                {
                    flightDustType = 267;
                }

                if (player.velocity.Length() > 0.5f)
                {
                    SpawnFlightDust(player, boostSpeed, flightDustType, 0f);
                }

                //calculate velocity
                player.velocity.X = MathHelper.Lerp(player.velocity.X, 0, 0.1f);
                player.velocity.Y = MathHelper.Lerp(player.velocity.Y, 0, 0.1f);
                // keep the player suspended at worst.
                player.velocity = player.velocity - (player.gravity * Vector2.UnitY);

                // handles keeping legs from moving when the player is in flight/moving fast/channeling.
                if (player.velocity.X > 0)
                {
                    player.legFrameCounter = -player.velocity.X;
                }
                else
                {
                    player.legFrameCounter = player.velocity.X;
                }

                //calculate rotation
                float radRot = GetPlayerFlightRotation(mRotationDir, player);

                player.fullRotation = MathHelper.Lerp(player.fullRotation, radRot, 0.1f);
            }

            // altered to only fire once, the moment you exit flight, to avoid overburden of sync packets when moving normally.
            if (!modPlayer.isFlying)
            {
                player.fullRotation = MathHelper.Lerp(player.fullRotation, 0, 0.1f);
            }
        }
Ejemplo n.º 3
0
        public static void Update(Player player)
        {
            // this might seem weird but the server isn't allowed to control the flight system.
            if (Main.netMode == NetmodeID.Server)
            {
                return;
            }

            MyPlayer modPlayer = MyPlayer.ModPlayer(player);

            //check for ki or death lol
            if ((modPlayer.IsKiDepleted() || player.dead || player.mount.Type != -1 || player.ropeCount != 0) && modPlayer.IsFlying)
            {
                modPlayer.IsFlying = false;
                AddKatchinFeetBuff(player);
            }

            if (modPlayer.IsFlying)
            {
                // cancel platform collision
                player.DryCollision(true, true);

                //prepare vals
                player.fullRotationOrigin = new Vector2(11, 22);
                Vector2 m_rotationDir = Vector2.Zero;

                int FlightDustType = 261;

                //Input checks
                float boostSpeed                 = (BURST_SPEED)*(modPlayer.IsCharging ? 1 : 0);
                int   totalFlightUsage           = Math.Max(1, FLIGHT_KI_DRAIN - modPlayer.FlightUsageAdd);
                float totalHorizontalFlightSpeed = FLIGHT_SPEED + boostSpeed + (player.moveSpeed / 3) + modPlayer.FlightSpeedAdd;
                float totalVerticalFlightSpeed   = FLIGHT_SPEED + boostSpeed + (Player.jumpSpeed / 2) + modPlayer.FlightSpeedAdd;

                if (modPlayer.IsUpHeld)
                {
                    // for some reason flying up is way, way faster than flying down.
                    player.velocity.Y -= (totalVerticalFlightSpeed / 3.8f);
                    m_rotationDir      = Vector2.UnitY;
                }
                else if (modPlayer.IsDownHeld)
                {
                    player.maxFallSpeed = 20f;
                    player.velocity.Y  += totalVerticalFlightSpeed / 3.6f;
                    m_rotationDir       = -Vector2.UnitY;
                }

                if (modPlayer.IsRightHeld)
                {
                    player.velocity.X += totalHorizontalFlightSpeed;
                    m_rotationDir     += Vector2.UnitX;
                }
                else if (modPlayer.IsLeftHeld)
                {
                    player.velocity.X -= totalHorizontalFlightSpeed;
                    m_rotationDir     -= Vector2.UnitX;
                }

                if (player.velocity.Length() > 0.5f)
                {
                    SpawnFlightDust(player, boostSpeed, FlightDustType, 0f);
                }

                if (Transformations.IsSSJ(player) && !Transformations.IsSSJG(player))
                {
                    FlightDustType = 170;
                }
                else if (Transformations.IsLSSJ(player))
                {
                    FlightDustType = 107;
                }
                else if (Transformations.IsSSJG(player))
                {
                    FlightDustType = 174;
                }
                else if (Transformations.IsAnyKaioken(player))
                {
                    FlightDustType = 182;
                }
                else
                {
                    FlightDustType = 267;
                }

                //calculate velocity
                player.velocity.X = MathHelper.Lerp(player.velocity.X, 0, 0.1f);
                player.velocity.Y = MathHelper.Lerp(player.velocity.Y, 0, 0.1f);
                // keep the player suspended at worst.
                player.velocity = player.velocity - (player.gravity * Vector2.UnitY);

                // handles keeping legs from moving when the player is in flight/moving fast/channeling.
                if (player.velocity.X > 0)
                {
                    player.legFrameCounter = -player.velocity.X;
                }
                else
                {
                    player.legFrameCounter = player.velocity.X;
                }

                //calculate rotation
                float radRot = GetPlayerFlightRotation(m_rotationDir, player);

                player.fullRotation = MathHelper.Lerp(player.fullRotation, radRot, 0.1f);

                //drain ki
                if (!modPlayer.flightUpgraded)
                {
                    if (DBZMOD.IsTickRateElapsed(2))
                    {
                        modPlayer.AddKi((totalFlightUsage + (totalFlightUsage * (int)boostSpeed)) * -1, false, false);
                    }
                }
                else
                {
                    if (DBZMOD.IsTickRateElapsed(4))
                    {
                        modPlayer.AddKi(-1, false, false);
                    }
                }
            }

            // altered to only fire once, the moment you exit flight, to avoid overburden of sync packets when moving normally.
            if (!modPlayer.IsFlying)
            {
                player.fullRotation = MathHelper.Lerp(player.fullRotation, 0, 0.1f);
            }
        }