예제 #1
0
        public override void Update(Player player, ref int buffIndex)
        {
            DBTPlayer dbtPlayer = player.GetModPlayer <DBTPlayer>();

            if (dbtPlayer == null)
            {
                return;
            }

            if (!dbtPlayer.IsTransformed(this) && dbtPlayer.player.HasBuff(Type))
            {
                player.ClearBuff(Type);
                return;
            }

            TransformationTimer++;
            bool isFormMastered = dbtPlayer.HasMastered(Definition);

            float kiDrain          = -(isFormMastered ? Definition.GetMasteredKiDrain(dbtPlayer) : Definition.GetUnmasteredKiDrain(dbtPlayer));
            float healthDrain      = -(isFormMastered ? Definition.GetMasteredHealthDrain(dbtPlayer) : Definition.GetUnmasteredHealthDrain(dbtPlayer));
            float overloadIncrease = (isFormMastered ? Definition.GetMasteredOverloadGrowthRate(dbtPlayer) : Definition.GetUnmasteredOverloadGrowthRate(dbtPlayer));

            if (kiDrain != 0f)
            {
                if (!isFormMastered)
                {
                    kiDrain *= KiDrainMultiplier;
                }

                kiDrain *= dbtPlayer.KiDrainMultiplier;
                dbtPlayer.ModifyKi(kiDrain);

                if (TransformationTimer % Definition.Drain.transformationStepDelay == 0 && KiDrainMultiplier < Definition.Drain.maxTransformationKiDrainMultiplier)
                {
                    KiDrainMultiplier += Definition.Drain.kiMultiplierPerStep;
                }
            }

            if (healthDrain != 0f)
            {
                if (!isFormMastered)
                {
                    healthDrain *= HealthDrainMultiplier;
                }

                healthDrain *= dbtPlayer.HealthDrainMultiplier;

                dbtPlayer.player.statLife     -= (int)healthDrain;
                dbtPlayer.player.lifeRegenTime = 0;

                if (TransformationTimer % Definition.Drain.transformationStepDelay == 0 && HealthDrainMultiplier < Definition.Drain.maxTransformationHealthDrainMultiplier)
                {
                    HealthDrainMultiplier += Definition.Drain.healthMultiplierPerStep;
                }
            }

            if (overloadIncrease != 0f)
            {
                overloadIncrease   *= dbtPlayer.OverloadIncreaseMultiplier;
                dbtPlayer.Overload += overloadIncrease;
            }

            float
                damageMultiplier       = Definition.GetDamageMultiplier(dbtPlayer),
                halvedDamageMultiplier = damageMultiplier / 2;

            player.allDamage            *= damageMultiplier;
            dbtPlayer.KiDamageMultiplier = damageMultiplier;

            player.statDefense += Definition.GetDefenseAdditive(dbtPlayer);

            float speedMultiplier = Definition.GetSpeedMultiplier(dbtPlayer);

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

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

            player.jumpSpeedBoost *= speedMultiplier;
        }