コード例 #1
0
        public void CheckPlayerForTransformationStateDebuffApplication()
        {
            if (!DebugHelper.IsDebugModeOn())
            {
                TransformationDefinition transformation = GetCurrentTransformation();

                bool isKaioken = TransformationDefinitionManager.IsKaioken(transformation);

                // this way, we can apply exhaustion debuffs correctly.
                if (wasKaioken && !isKaioken)
                {
                    bool wasSSJKK = PreviousTransformations.Contains(TransformationDefinitionManager.SuperKaiokenDefinition);
                    AddKaiokenExhaustion(wasSSJKK ? 2 : 1);
                    kaiokenLevel = 0; // make triple sure the Kaio level gets reset.
                }

                bool exhaustsPlayer = false;
                isTransformed = IsPlayerTransformed();

                for (int i = 0; i < PreviousTransformations.Count; i++)
                {
                    if (PreviousTransformations[i].ExhaustsPlayer)
                    {
                        exhaustsPlayer = true;
                        break;
                    }
                }

                if (exhaustsPlayer && !isTransformed)
                {
                    AddTransformationExhaustion();
                }

                wasKaioken = isKaioken;
            }
        }
コード例 #2
0
ファイル: MyPlayer.Hooks.cs プロジェクト: minionmn/DBZMOD
        public override void PostUpdate()
        {
            hitStunManager.Update();

            if (kiLantern)
            {
                player.AddBuff(mod.BuffType("KiLanternBuff"), 2);
            }
            else
            {
                player.ClearBuff(mod.BuffType("KiLanternBuff"));
            }

            if (isTransforming)
            {
                ssjAuraBeamTimer++;
            }

            if (IsPlayerTransformed())
            {
                lightningFrameTimer += 2;
            }

            if (lightningFrameTimer >= 15)
            {
                lightningFrameTimer = 0;
            }

            //if (!player.IsPlayerTransformed())
            //{
            //    kiDrainAddition = 0;
            //}

            if (TransformationDefinitionManager.IsKaioken(ActiveTransformations))
            {
                kaiokenTimer += 1.5f;
            }

            #region Mastery Messages

            // TODO Reduce CPU time by only handling the current transformation.
            if (player.whoAmI == Main.LocalPlayer.whoAmI && PlayerTransformations.Count > 0 && ActiveTransformations.Count > 0)
            {
                for (int i = 0; i < ActiveTransformations.Count; i++)
                {
                    HandleMasteryEvents(ActiveTransformations[i]);
                }
            }

            #endregion

            if (adamantiteBonus)
            {
                kiDamage += 7;
            }

            if (PlayerTrait != null && PlayerTrait.BuffName != null)
            {
                if (PlayerTrait.CanSee(this))
                {
                    player.AddBuff(PlayerTrait.GetBuffType(mod), 3);
                    player.ClearBuff(mod.BuffType <UnknownTraitBuff>());
                }
                else
                {
                    player.AddBuff(mod.BuffType <UnknownTraitBuff>(), 3);
                }
            }

            if (IsLegendary() && !LSSJAchieved && NPC.downedBoss1)
            {
                player.AddBuff(mod.BuffType("UnknownLegendary"), 3);
            }
            else if (IsLegendary() && LSSJAchieved)
            {
                player.AddBuff(mod.BuffType("LegendaryTrait"), 3);
                player.ClearBuff(mod.BuffType("UnknownLegendary"));
            }

            if (kiRegen >= 1)
            {
                kiRegenTimer++;
            }

            if (kiRegenTimer > 2)
            {
                AddKi(kiRegen, false, false);
                kiRegenTimer = 0;
            }

            if (demonBonusActive)
            {
                demonBonusTimer++;
                if (demonBonusTimer > 300)
                {
                    demonBonusActive = false;
                    demonBonusTimer  = 0;
                    player.AddBuff(mod.BuffType("ArmorCooldown"), 3600);
                }
            }

            if (player.dead && IsPlayerTransformed())
            {
                EndTransformations();
                isTransforming = false;
            }

            if (rageCurrent > 5)
            {
                rageCurrent = 5;
            }

            HandleOverloadCounters();

            overallFormUnlockChance = formUnlockChance - rageCurrent;

            if (overallFormUnlockChance < 2)
            {
                overallFormUnlockChance = 2;
            }

            if (!player.HasBuff(mod.BuffType("ZenkaiBuff")) && zenkaiCharmActive)
            {
                player.AddBuff(mod.BuffType("ZenkaiCooldown"), 7200);
            }

            if (isDashing)
            {
                player.invis = true;
            }

            HandleBlackFusionMultiplier();

            // neuters flight if the player gets immobilized. Note the lack of Katchin Feet buff.
            if (IsPlayerImmobilized() && isFlying)
            {
                isFlying = false;
            }

            HandleMouseOctantAndSyncTracking();

            // flight system moved to PostUpdate so that it can benefit from not being client sided!
            FlightSystem.Update(player);

            // charge activate and charge effects moved to post update so that they can also benefit from not being client sided.
            HandleChargeEffects();

            // aura frame effects moved out of draw pass to avoid being tied to frame rate!

            currentAura = this.GetAuraEffectOnPlayer();

            // save the charging aura for last, and only add it to the draw layer if no other auras are firing
            if (isCharging)
            {
                if (!wasCharging)
                {
                    var chargeAuraEffects = AuraAnimations.createChargeAura;
                    HandleAuraStartupSound(chargeAuraEffects, true);
                }
            }

            if (currentAura != previousAura)
            {
                auraSoundInfo = SoundHelper.KillTrackedSound(auraSoundInfo);
                HandleAuraStartupSound(currentAura, false);
                // reset aura frame and audio timers to 0, this is important
                auraSoundTimer = 0;
                auraFrameTimer = 0;
            }

            IncrementAuraFrameTimers(currentAura);
            HandleAuraLoopSound(currentAura);

            wasCharging  = isCharging;
            previousAura = currentAura;

            CheckPlayerForTransformationStateDebuffApplication();

            ThrottleKi();

            // fires at the end of all the things and makes sure the user is synced to the server with current values, also handles initial state.
            CheckSyncState();

            // Handles nerfing player defense when in Kaioken States
            HandleKaiokenDefenseDebuff();

            // if the player is in mid-transformation, totally neuter horizontal velocity
            // also handle the frame counter advancement here.
            if (isTransformationAnimationPlaying)
            {
                player.velocity = new Vector2(0, player.velocity.Y);

                transformationFrameTimer++;
            }
            else
            {
                transformationFrameTimer = 0;
            }

            KiBar.visible = true;

            if (player.IsCarryingAllDragonBalls() && !wishActive)
            {
                int soundTimer = 0;
                soundTimer++;
                if (soundTimer > 300)
                {
                    Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/DBReady"));
                    soundTimer = 0;
                }
            }
        }