public override void OnPlayerMasteryGain(DBTPlayer dbtPlayer, float gain, float currentMastery) { if (currentMastery >= 0.5f && !dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.ASSJ1)) { dbtPlayer.Acquire(TransformationDefinitionManager.Instance.ASSJ1); } if (currentMastery >= 0.75f && !dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.USSJ1)) { dbtPlayer.Acquire(TransformationDefinitionManager.Instance.USSJ1); } }
public override void Update(GameTime gameTime) { DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>(); foreach (Tab tab in _tabButtons.Values) { if (_tabsForTransformations[tab] != LastActiveTransformationTab) { tab.Panel.Left.Set(-Main.screenWidth, 0); tab.Panel.Top.Set(-Main.screenHeight, 0); } else { tab.Panel.Left.Set(0, 0); tab.Panel.Top.Set(_panelsYOffset, 0); } } foreach (KeyValuePair <UIHoverImageButton, Tab> kvp in _tabButtons) { if (dbtPlayer.HasAcquiredTransformation(_tabsForTransformations[kvp.Value])) { kvp.Value.TabButton.SetImage(null); } else { kvp.Value.TabButton.SetImage(_tabsForTransformations[kvp.Value].TransformationIcon); } } // Imported from old transformations menu foreach (KeyValuePair <TransformationDefinition, UIImagePair> kvp in _transformationImagePairs) { bool unlockable = kvp.Key.CanUnlock(dbtPlayer); bool visible = kvp.Key.DoesDisplayInCharacterMenu(dbtPlayer); if (!visible) { kvp.Value.button.Width = StyleDimension.Empty; kvp.Value.button.Height = StyleDimension.Empty; kvp.Value.button.SetVisibility(0f, 0f); } kvp.Value.unknownImage.ImageScale = visible && unlockable ? 0f : 1f; kvp.Value.unknownImageGray.ImageScale = visible && unlockable && dbtPlayer.HasAcquiredTransformation(kvp.Key) ? 0f : 1f; kvp.Value.lockedImage.ImageScale = visible && unlockable ? 0f : 1f; } }
private static void TrySelectingTransformation(TransformationDefinition def, UIMouseEvent evt, UIElement listeningElement) { DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>(); if (dbtPlayer.HasAcquiredTransformation(def) && def.DoesDisplayInCharacterMenu(dbtPlayer)) { // TODO Add sounds. //SoundHelper.PlayVanillaSound(SoundID.MenuTick); if (!dbtPlayer.SelectedTransformations.Contains(def)) { dbtPlayer.SelectTransformation(def); Main.NewText($"Selected {def.DisplayName}, Mastery: {Math.Round(def.GetMaxMastery(dbtPlayer) * def.GetCurrentMastery(dbtPlayer), 2)}%"); } else { Main.NewText($"{def.DisplayName} Mastery: {Math.Round(100f * def.GetCurrentMastery(dbtPlayer), 2)}%"); } } /*else if (def.SelectionRequirementsFailed.Invoke(player, def)) * { * SoundHelper.PlayVanillaSound(SoundID.MenuClose); * * if (def.FailureText == null) return; * Main.NewText(def.FailureText); * }*/ }
public override float GetUnmasteredKiDrain(DBTPlayer dbtPlayer) { if (dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ3)) { return(base.GetUnmasteredKiDrain(dbtPlayer) + (35f / Constants.TICKS_PER_SECOND));; } else { if (dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ2) && !dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ3)) { return(base.GetUnmasteredKiDrain(dbtPlayer) + (15f / Constants.TICKS_PER_SECOND)); } } return(base.GetUnmasteredKiDrain(dbtPlayer)); }
public override int GetDefenseAdditive(DBTPlayer dbtPlayer) { if (dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ3)) { return(BaseDefenseAdditive + 17); } else { if (dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ2) && !dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ3)) { return(BaseDefenseAdditive + 7); } } return(BaseDefenseAdditive); }
public override float GetSpeedMultiplier(DBTPlayer dbtPlayer) { if (dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ3)) { return(BaseSpeedMultiplier + 0.7f); } else { if (dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ2) && !dbtPlayer.HasAcquiredTransformation(TransformationDefinitionManager.Instance.SSJ3)) { return(BaseSpeedMultiplier + 0.4f); } } return(BaseSpeedMultiplier); }
public float GetCurrentMastery(DBTPlayer dbtPlayer) { if (dbtPlayer.HasAcquiredTransformation(this)) { return(dbtPlayer.AcquiredTransformations[this].CurrentMastery); } return(0f); }
private void DefaultSetup(DBTPlayer dbtPlayer) { if (!CheckPrePlayerConditions()) { dbtPlayer.AcquiredTransformations.Remove(this); return; } if (!dbtPlayer.HasAcquiredTransformation(this)) { dbtPlayer.Acquire(this); } }
private static void TrySelectingTransformation(TransformationDefinition def, UIMouseEvent evt, UIElement listeningElement) { DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>(); if (def.CheckPrePlayerConditions() && dbtPlayer.HasAcquiredTransformation(def) && def.BaseConditions(dbtPlayer)) { // TODO Add sounds. //SoundHelper.PlayVanillaSound(SoundID.MenuTick); if (!dbtPlayer.SelectedTransformations.Contains(def)) { dbtPlayer.SelectTransformation(def); Main.NewText($"Selected {def.DisplayName}, Mastery: {Math.Round(def.GetMaxMastery(dbtPlayer) * def.GetCurrentMastery(dbtPlayer), 2)}%"); } else { Main.NewText($"{def.DisplayName} Mastery: {Math.Round(100f * def.GetCurrentMastery(dbtPlayer), 2)}%"); } } }
public override void Update(GameTime gameTime) { base.Update(gameTime); DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>(); foreach (KeyValuePair <TransformationDefinition, UIImagePair> kvp in _transformationImagePairs) { TransformationDefinition definition = kvp.Key; bool canAcquire = definition.CheckPrePlayerConditions() && definition.BaseConditions(dbtPlayer); bool currentlyUnlockable = kvp.Key.CanUnlock(dbtPlayer); bool visible = kvp.Key.DoesDisplayInCharacterMenu(dbtPlayer); bool unlocked = dbtPlayer.HasAcquiredTransformation(kvp.Key); if (!canAcquire || !visible) { kvp.Value.button.Width = StyleDimension.Empty; kvp.Value.button.Height = StyleDimension.Empty; kvp.Value.button.SetVisibility(0f, 0f); } if (canAcquire) { kvp.Value.unknownImage.ImageScale = !visible ? 0f : (!currentlyUnlockable ? 0f : (unlocked ? 0f : 1f)); kvp.Value.unknownImageGray.ImageScale = !visible ? 0f : currentlyUnlockable && dbtPlayer.HasAcquiredTransformation(kvp.Key) ? 0f : 1f; kvp.Value.lockedImage.ImageScale = !visible ? 0f : unlocked || currentlyUnlockable ? 0f : 1f; } } // Disabled as it crashes with SpriteBatch. /*for (int i = 0; i < _polyLinesToDraw.Count; i++) * if (_polyLinesToDraw[i].Length > 1) * Main.spriteBatch.DrawPolyLine(_polyLinesToDraw[i], Color.White);*/ }