public override void VerifyAndApplyBuffs(DoTariaPlayer dotariaPlayer) { if (dotariaPlayer.HasAbility(AbilityDefinitionManager.Instance.Necromastery) && !dotariaPlayer.player.HasBuff <NecromasteryBuff>()) { dotariaPlayer.player.AddBuff <NecromasteryBuff>(int.MaxValue); } }
public override void VerifyAndApplyBuffs(DoTariaPlayer dotariaPlayer) { if (dotariaPlayer.HasAbility(AbilityDefinitionManager.Instance.Quas) && !dotariaPlayer.player.HasBuff <QuasBuff>()) { dotariaPlayer.player.AddBuff <QuasBuff>(int.MaxValue); } if (dotariaPlayer.HasAbility(AbilityDefinitionManager.Instance.Wex) && !dotariaPlayer.player.HasBuff <WexBuff>()) { dotariaPlayer.player.AddBuff <WexBuff>(int.MaxValue); } if (dotariaPlayer.HasAbility(AbilityDefinitionManager.Instance.Exort) && !dotariaPlayer.player.HasBuff <ExortBuff>()) { dotariaPlayer.player.AddBuff <ExortBuff>(int.MaxValue); } }
public int GetMaxSouls(DoTariaPlayer dotariaPlayer, PlayerAbility playerAbility) { if (!dotariaPlayer.HasAbility(this)) { return(0); } return(4 + playerAbility.Level * 8 + (dotariaPlayer.HasAghanims() ? 10 : 0)); }
public override void Update(NPC npc, ref int buffIndex) { PresenceoftheDarkLordAbility ability = AbilityDefinitionManager.Instance.PresenceoftheDarkLord; IEnumerable <DoTariaPlayer> players = Main.player.Where(p => { if (p.name == "") { return(false); } DoTariaPlayer player = DoTariaPlayer.Get(p); bool hasPotDL = player.HasAbility(ability); if (hasPotDL) { return(Vector2.Distance(p.Center, npc.Center) <= ability.InternalGetCastRange(player)); } return(false); }).Select(p => DoTariaPlayer.Get(p)); PlayerAbility highestPlayerAbility = null; DoTariaPlayer highestLevelDoTariaPlayer = null; foreach (DoTariaPlayer dotariaPlayer in players) { if (highestPlayerAbility == null || dotariaPlayer.AcquiredAbilities[ability].Level > highestPlayerAbility.Level) { highestPlayerAbility = dotariaPlayer.AcquiredAbilities[ability]; highestLevelDoTariaPlayer = dotariaPlayer; } } if (highestPlayerAbility == null) { return; } npc.defense = npc.defDefense - (int)(npc.defDefense * ability.GetDefenseReduction(highestLevelDoTariaPlayer, highestPlayerAbility)); }
internal bool InternalCanLevelUp(DoTariaPlayer dotariaPlayer) => CanLevelUp(dotariaPlayer, dotariaPlayer.AcquiredAbilities[this]) && dotariaPlayer.Level >= InternalGetRequiredLevelForNextUpgrade(dotariaPlayer) && (!dotariaPlayer.HasAbility(this) || dotariaPlayer.AcquiredAbilities[this].Level < MaxLevel);
private void DrawDescription(SpriteBatch spriteBatch, AbilityDefinition ability) { DoTariaPlayer doTariaPlayer = DoTariaPlayer.Get(Main.LocalPlayer); PlayerAbility currentPlayerAbility; if (doTariaPlayer.HasAbility(ability)) { currentPlayerAbility = doTariaPlayer.GetPlayerAbility(ability); } else { currentPlayerAbility = new PlayerAbility(ability, 1, 0); } int panelWidth = 300, panelHeight = 34; Vector2 position = Main.MouseWorld + new Vector2(Main.cursorTextures[0].Width, Main.cursorTextures[0].Height * 2) - Main.screenPosition; StringBuilder description = new StringBuilder("Ability: "); if (ability.AbilityTargetType == AbilityTargetType.NoTarget && ability.AbilityType == AbilityType.Passive) { description.Append(ability.AbilityType); } else { description.Append(ability.AbilityTargetType.ToString().AddSpaceBeforeCapitals()); } description.AppendLine(); if (ability.AbilityTargetUnitType != AbilityTargetUnitType.None) { description.Append("Affects: "); if (!(ability.AbilityTargetUnitFaction == AbilityTargetFaction.Self || ability.AbilityTargetUnitFaction == (AbilityTargetFaction.Enemies & AbilityTargetFaction.Allies))) { description.Append(ability.AbilityTargetUnitFaction).Append(" "); } description.Append(ability.AbilityTargetUnitType.ToString().AddSpaceBeforeCapitals()).AppendLine(); } description.Append(ability.GetAbilityTooltip(doTariaPlayer, currentPlayerAbility)); DispelType dispelType = ability.GetDispelType(doTariaPlayer, currentPlayerAbility); if (dispelType != DispelType.None) { description.AppendLine().Append("Dispel type: ").Append(dispelType.ToString()).Append(" Dispel"); } description.AppendLine(); string finaliziedDescription = SpliceText(description.ToString(), 34); panelHeight += finaliziedDescription.Split('\n').Length * 26; spriteBatch.Draw(Main.magicPixel, position, new Rectangle(0, 0, panelWidth, panelHeight), Color.Black * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); spriteBatch.Draw(Main.magicPixel, position + new Vector2(2, 2), new Rectangle(0, 0, panelWidth - 4, 32), Color.Gray * 0.75f, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); spriteBatch.DrawString(Main.fontMouseText, ability.DisplayName, position + new Vector2(6, 8), Color.White); spriteBatch.DrawString(Main.fontMouseText, "Level: " + CurrentLevel, position + new Vector2(panelWidth - 56, 12), Color.White, 0, Vector2.Zero, 0.75f, SpriteEffects.None, 1f); spriteBatch.DrawString(Main.fontMouseText, finaliziedDescription, position + new Vector2(10, 40), Color.Gray, 0, Vector2.Zero, 0.85f, SpriteEffects.None, 1f); Texture2D manacostTexture = DoTariaMod.Instance.GetTexture("UserInterfaces/Abilities/ManacostIcon"); Texture2D cooldownTexture = DoTariaMod.Instance.GetTexture("UserInterfaces/Abilities/CooldownIcon"); Func <DoTariaPlayer, PlayerAbility, float> cooldownGetter = (player, playerAbility) => (float)Math.Round((double)playerAbility.Ability.InternalGetCooldown(player, playerAbility), 2); List <float> differentCooldowns = AbilitiesHelper.GetDifferentValues(cooldownGetter, doTariaPlayer, ability); if (!(differentCooldowns.Count == 1 && differentCooldowns[0] == 0f)) { spriteBatch.Draw(cooldownTexture, position + new Vector2(10, panelHeight - 22), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); spriteBatch.DrawString(Main.fontMouseText, AbilitiesHelper.GenerateCleanSlashedString(AbilitiesHelper.GetAllValues((player, pAbility) => (float)Math.Round((double)pAbility.Ability.InternalGetCooldown(player, pAbility), 2), doTariaPlayer, ability), differentCooldowns), position + new Vector2(30, panelHeight - 24), Color.Gray); } if (ability.AbilityType == AbilityType.Active) { spriteBatch.Draw(manacostTexture, position + new Vector2(panelWidth / 2, panelHeight - 22), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); spriteBatch.DrawString(Main.fontMouseText, AbilitiesHelper.GenerateCleanSlashedString((player, playerAbility) => (float)Math.Ceiling(playerAbility.Ability.InternalGetManaCost(player, playerAbility)), doTariaPlayer, ability), position + new Vector2(panelWidth / 2 + 20, panelHeight - 24), Color.Gray); } }
private bool CanUpgradeAbility(DoTariaPlayer dotariaPlayer, AbilityDefinition ability) => ability.CanUnlock(dotariaPlayer) && (!dotariaPlayer.HasAbility(ability) || ability.InternalCanLevelUp(dotariaPlayer));
public override void Update(GameTime gameTime) { base.Update(gameTime); _mainPanel.BackgroundColor = ModContent.GetInstance <DoTariaClientConfiguration>().AbilityPanelBackgroundColor; _mainPanel.BorderColor = ModContent.GetInstance <DoTariaClientConfiguration>().AbilityPanelBorderColor; DoTariaPlayer dotariaPlayer = DoTariaPlayer.Get(Main.LocalPlayer); foreach (KeyValuePair <UIAbilityButton, UIImage> kvp in _abilityNotLearnedMasks) { if (!_definitionsForAbilityButton.ContainsKey(kvp.Key) || _definitionsForAbilityButton[kvp.Key] == null || dotariaPlayer.HasAbility(_definitionsForAbilityButton[kvp.Key])) { kvp.Value.ImageScale = 0f; } else { kvp.Value.ImageScale = 1f; } } foreach (var button in _upgradeButtonsForAbilityButtons) { ChangeUpgradeButton(button.Value, false); } foreach (AbilityDefinition ability in dotariaPlayer.DisplayedAbilities) { UIAbilityButton upgradeButton = GetUpgradeButtonForAbility(ability); UIAbilityButton abilityButton = GetAbilityButtonForAbility(ability); abilityButton.Ability = ability; if (dotariaPlayer.AcquiredAbilities.Count > 0) { if (dotariaPlayer.AcquiredAbilities.ContainsKey(ability)) { float percent = (float)(dotariaPlayer.AcquiredAbilities[ability].Cooldown / (ability.GetCooldown(dotariaPlayer, dotariaPlayer.AcquiredAbilities[ability]) * DoTariaMath.TICKS_PER_SECOND)); abilityButton.Percent = percent; abilityButton.CurrentLevel = dotariaPlayer.AcquiredAbilities[ability].Level; abilityButton.Ability = ability; if (dotariaPlayer.AcquiredAbilities[ability].Cooldown > 0) { abilityButton.Seconds = dotariaPlayer.AcquiredAbilities[ability].Cooldown / DoTariaMath.TICKS_PER_SECOND + 1; } else { abilityButton.Seconds = 0; } abilityButton.SetVisibility(COOLDOWN_VISIBILITY, COOLDOWN_VISIBILITY); } else { abilityButton.SetVisibility(ACTIVE_VISIBILITY, INACTIVE_VISIBILITY); } } if (upgradeButton == null) { continue; } bool shouldDisplay = dotariaPlayer.HasSpareLevels && ability.CanUnlock(dotariaPlayer) && (!dotariaPlayer.HasAbility(ability) || ability.InternalCanLevelUp(dotariaPlayer)); ChangeUpgradeButton(upgradeButton, shouldDisplay); } }