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; } } }
public override void ProcessTriggers(TriggersSet triggersSet) { UpdateSynchronizedControls(triggersSet); SyncTriggerSet(); if (flyToggle.JustPressed) { if (flightUnlocked) { isFlying = !isFlying; if (!isFlying) { FlightSystem.AddKatchinFeetBuff(player); } } } _mProgressionSystem.Update(player); // dropping the fist wireup here. Fingers crossed. if (player.HeldItem.Name.Equals("Fist")) { _mFistSystem.Update(triggersSet, player, mod); } if (armorBonus.JustPressed) { if (demonBonus && !player.HasBuff(mod.BuffType("ArmorCooldown"))) { player.AddBuff(mod.BuffType("DemonBonus"), 300); demonBonusActive = true; for (int i = 0; i < 3; i++) { Dust tDust = Dust.NewDustDirect(player.position - (Vector2.UnitY * 0.7f) - (Vector2.UnitX * 1.0f), 50, 50, 15, 0f, 0f, 5, default(Color), 2.0f); } } } // handle ki charging if (ConfigModel.isChargeToggled) { if (energyCharge.JustPressed) { isCharging = !isCharging; } } else { if (energyCharge.Current && !isCharging) { isCharging = true; } if (!energyCharge.Current && isCharging) { isCharging = false; } } TransformationDefinition transformation = GetCurrentTransformation(); // most of the forms have a default light value, but charging isn't a buff. Let there be light if (isCharging && transformation == null) { Lighting.AddLight(player.Center, 1.2f, 1.2f, 1.2f); } // calls to handle transformation or kaioken powerups per frame HandleTransformations(); HandleKaioken(); if (speedToggle.JustPressed) { float oldSpeedMult = bonusSpeedMultiplier; bonusSpeedMultiplier = GetNextSpeedMultiplier(); CombatText.NewText(player.Hitbox, new Color(255, 255, 255), string.Format("Speed bonus {0}!", (bonusSpeedMultiplier == 0f) ? "off" : ((int)Math.Ceiling(bonusSpeedMultiplier * 100f)) + "%"), false, false); } if (transMenu.JustPressed) { TransformationMenu.menuVisible = !TransformationMenu.menuVisible; } /*if (ProgressionMenuKey.JustPressed) * { * ProgressionMenu.ToggleVisibility(); * }*/ // power down handling if (IsCompletelyPoweringDown() && IsPlayerTransformed()) { var playerWasSuperKaioken = IsTransformedInto(TransformationDefinitionManager.SuperKaiokenDefinition); EndTransformations(); // TODO Make this dynamic. if (playerWasSuperKaioken) { DoTransform(TransformationDefinitionManager.SSJ1Definition); } kaiokenLevel = 0; SoundHelper.PlayCustomSound("Sounds/PowerDown", player, .3f); } if (wishActive) { WishMenu.menuVisible = true; } if (quickKi.JustPressed) { player.FindAndConsumeKiPotion(); } // freeform instant transmission requires book 2. if (isInstantTransmission2Unlocked) { HandleInstantTransmissionFreeform(); } }