Esempio n. 1
0
        /// <summary>
        ///     Return the aura effect currently active on the player.
        /// </summary>
        /// <param name="modPlayer">The player being checked</param>
        public static AuraAnimationInfo GetAuraEffectOnPlayer(this MyPlayer modPlayer)
        {
            TransformationDefinition transformation = modPlayer.GetCurrentTransformation();

            if (modPlayer.ActiveTransformations.Count == 0)
            {
                return(null);
            }

            if (modPlayer.player.dead)
            {
                return(null);
            }

            if (transformation != null)
            {
                return(transformation.Appearance.auraAnimation);
            }

            if (modPlayer.isCharging)
            {
                return(AuraAnimations.createChargeAura);
            }

            return(null);
        }
Esempio n. 2
0
        public override void Update(Player player, ref int buffIndex)
        {
            if (player.whoAmI != Main.LocalPlayer.whoAmI)
            {
                return;
            }

            MyPlayer modPlayer = MyPlayer.ModPlayer(player);

            modPlayer.player.lifeRegen -= (int)TransformationDefinition.GetHealthDrainRate(modPlayer);
            modPlayer.kiDrainMulti      = TransformationDefinition.GetKiSkillDrainMultiplier(modPlayer);

            Vector2 lightPosition = player.Center + player.velocity * 8f;
            float   lightingR = 0f, lightingB = 0f, lightingG = 0f;

            TransformationDefinition.GetPlayerLightModifier(modPlayer, ref lightingR, ref lightingG, ref lightingB);

            if (lightingR > 0f || lightingG > 0f || lightingB > 0f)
            {
                Lighting.AddLight(lightPosition, lightingR, lightingG, lightingB);
            }

            // Give bonus base defense
            player.statDefense += TransformationDefinition.GetDefenseBonus(player.GetModPlayer <MyPlayer>());

            // handle ki drain mastery
            bool isMastered = modPlayer.PlayerTransformations.ContainsKey(TransformationDefinition) &&
                              modPlayer.PlayerTransformations[TransformationDefinition].Mastery >= 1.0;

            float actualKiDrain = isMastered ? TransformationDefinition.GetKiDrainRateMastery(modPlayer) : TransformationDefinition.GetKiDrainRate(modPlayer);

            float kiDrainMultiplier = 1f;

            if (!isMastered)
            {
                if (kiDrainMultiplier < 3f)
                {
                    _kiDrainAddTimer++;
                    if (_kiDrainAddTimer >= 300)
                    {
                        kiDrainMultiplier += 0.5f;
                        _kiDrainAddTimer   = 0;
                    }
                }
            }

            /*else // Mastered forms do not drain more over time.
             * {
             *  if (kiDrainMultiplier < 3f)
             *  {
             *      _kiDrainAddTimer++;
             *      if (_kiDrainAddTimer >= 600)
             *      {
             *          kiDrainMultiplier += 1f;
             *          _kiDrainAddTimer = 0;
             *      }
             *  }
             * }*/

            float projectedKiDrain = actualKiDrain * kiDrainMultiplier;

            TransformationDefinition transformation = modPlayer.GetCurrentTransformation();

            // if the player is in any ki-draining state, handles ki drain and power down when ki is depleted
            if (!DBZMOD.Instance.TransformationDefinitionManager.IsKaioken(transformation))
            {
                // player can't support ten frames (arbitrary) of their current form, make them fall out of any forms they might be in.
                if (modPlayer.IsKiDepleted(projectedKiDrain * MINIMUM_TRANSFORMATION_FRAMES_FOR_KI_COST_UPKEEP))
                {
                    if (transformation == DBZMOD.Instance.TransformationDefinitionManager.SuperKaiokenDefinition)
                    {
                        modPlayer.kaiokenLevel = 0;
                    }

                    modPlayer.EndTransformations();
                }
                else
                {
                    modPlayer.AddKi((projectedKiDrain) * -1, false, true);
                    Lighting.AddLight(player.Center, 1f, 1f, 0f);
                }
            }
            //else
            //{
            //    // the player isn't in a ki draining state anymore, reset KiDrainAddition
            //    modPlayer.kiDrainAddition = 0;
            //}

            float speedMultiplier = TransformationDefinition.GetSpeedMultiplier(modPlayer);

            player.moveSpeed       *= speedMultiplier;
            player.maxRunSpeed     *= speedMultiplier;
            player.runAcceleration *= speedMultiplier;

            if (player.jumpSpeedBoost < 1f)
            {
                player.jumpSpeedBoost = 1f;
            }

            player.jumpSpeedBoost *= speedMultiplier;

            // Set player damage mults
            float
                damageMultiplier       = TransformationDefinition.GetDamageMultiplier(modPlayer),
                halvedDamageMultiplier = GetHalvedDamageBonus(damageMultiplier);

            player.meleeDamage  *= halvedDamageMultiplier;
            player.rangedDamage *= halvedDamageMultiplier;
            player.magicDamage  *= halvedDamageMultiplier;
            player.minionDamage *= halvedDamageMultiplier;
            player.thrownDamage *= halvedDamageMultiplier;
            modPlayer.kiDamage  *= damageMultiplier;

            // cross mod support stuff
            if (DBZMOD.Instance.thoriumLoaded)
            {
                ThoriumEffects(player, damageMultiplier);
            }
            if (DBZMOD.Instance.enigmaLoaded)
            {
                EnigmaEffects(player, damageMultiplier);
            }
            if (DBZMOD.Instance.battlerodsLoaded)
            {
                BattleRodEffects(player, damageMultiplier);
            }
            if (DBZMOD.Instance.expandedSentriesLoaded)
            {
                ExpandedSentriesEffects(player, damageMultiplier);
            }

            if (player.buffTime[buffIndex] == 0)
            {
                TransformationDefinition.OnTransformationBuffExpired(modPlayer, ref buffIndex);
            }
        }