lifesteal cooldown is now lifesteal pool indicator
This commit is contained in:
1 parent
1cbee1d40d
commit
5ca3a958bd
3 files changed
+57
-10
No files matched your search
@@ -4774,13 +4774,22 @@ namespace CalamityMod.CalPlayer
|
||||
{
|
||||
float baseRecoveryRate = Main.expertMode ? BalancingConstants.LifeStealRecoveryRate_Expert : BalancingConstants.LifeStealRecoveryRate_Classic;
|
||||
float lifeStealRecoveryRateReduction = Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : BalancingConstants.LifeStealRecoveryRateReduction_Classic;
|
||||
float lifeStealCap = Main.expertMode ? BalancingConstants.LifeStealCap_Expert: BalancingConstants.LifeStealCap_Classic;
|
||||
|
||||
float lifeStealRecoveryRate = baseRecoveryRate - lifeStealRecoveryRateReduction;
|
||||
if (Player.lifeSteal < -lifeStealRecoveryRate)
|
||||
|
||||
if (Player.lifeSteal < lifeStealCap)
|
||||
{
|
||||
int duration = (int)Math.Ceiling(Math.Abs(Player.lifeSteal) / lifeStealRecoveryRate);
|
||||
if (!Player.HasCooldown(LifeSteal.ID) || (cooldowns[LifeSteal.ID].duration < duration))
|
||||
Player.AddCooldown(LifeSteal.ID, duration);
|
||||
|
||||
if (Player.Calamity().cooldowns.TryGetValue(LifeSteal.ID, out var cooldown))
|
||||
{
|
||||
cooldown.timeLeft = (int)Math.Max(0,(lifeStealCap-Math.Abs(Player.lifeSteal)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Player.AddCooldown(LifeSteal.ID, (int)lifeStealCap)
|
||||
.timeLeft = (int)Math.Max(0, (lifeStealCap - Math.Abs(Player.lifeSteal)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (moonshine)
|
||||
|
||||
+43
-5
@@ -1,4 +1,9 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using CalamityMod.Balancing;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.Localization;
|
||||
|
||||
namespace CalamityMod.Cooldowns
|
||||
@@ -6,11 +11,44 @@ namespace CalamityMod.Cooldowns
|
||||
public class LifeSteal : CooldownHandler
|
||||
{
|
||||
public static new string ID => "LifeSteal";
|
||||
public override bool ShouldDisplay => instance.player.lifeSteal < 0f;
|
||||
|
||||
private float lifeStealCap => Main.expertMode ? BalancingConstants.LifeStealCap_Expert : BalancingConstants.LifeStealCap_Classic;
|
||||
public override bool ShouldDisplay => instance.player.lifeSteal < lifeStealCap;
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}");
|
||||
public override string Texture => "CalamityMod/Cooldowns/LifeSteal";
|
||||
public override Color OutlineColor => new Color(255, 142, 165);
|
||||
public override Color CooldownStartColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion);
|
||||
public override Color CooldownEndColor => Color.Lerp(new Color(255, 216, 216), new Color(255, 117, 117), instance.Completion);
|
||||
|
||||
public override bool CanTickDown => false;
|
||||
public override Color OutlineColor => instance.player!.lifeSteal < 0
|
||||
? new Color(255, 142, 165)
|
||||
: new Color(255, 142, 165);
|
||||
public override Color CooldownStartColor => instance.player!.lifeSteal < 0
|
||||
? new Color(145, 59, 59)
|
||||
: new Color(255, 181, 181);
|
||||
public override Color CooldownEndColor => CooldownStartColor;
|
||||
private Color TextColor => Color.White;
|
||||
private Color TextBorderColor => new Color(40, 0, 0);
|
||||
public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
|
||||
{
|
||||
base.DrawExpanded(spriteBatch, position, opacity, scale);
|
||||
var value = instance.player.lifeSteal;
|
||||
bool negate = value < 0;
|
||||
var valueToMeasure = Math.Abs(value);
|
||||
float Xoffset = valueToMeasure > 9 ? valueToMeasure > 99 ? -12.5f : -10f : -5;
|
||||
if (negate)
|
||||
Xoffset -= 8;
|
||||
CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (value).ToString("#"), position + new Vector2(Xoffset, 8) * scale, TextColor, TextBorderColor, scale);
|
||||
}
|
||||
|
||||
public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
|
||||
{
|
||||
base.DrawCompact(spriteBatch, position, opacity, scale);
|
||||
var value = instance.player.lifeSteal;
|
||||
bool negate = value < 0;
|
||||
var valueToMeasure = Math.Abs(value);
|
||||
float Xoffset = valueToMeasure > 9 ? valueToMeasure > 99 ? -12.5f : -10f : -5;
|
||||
if (negate)
|
||||
Xoffset -= 8;
|
||||
CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, (value).ToString("#"), position + new Vector2(Xoffset, 8) * scale, TextColor, TextBorderColor, scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ Cooldowns: {
|
||||
InkBomb: Ink Bomb Cooldown
|
||||
KillModeActive: Kill Mode Active
|
||||
KillModeCooldown: Kill Mode Cooldown
|
||||
LifeSteal: Life Steal Cooldown
|
||||
LifeSteal: Life Steal Remaining
|
||||
LionHeartShield: Energy Shell Cooldown
|
||||
M1GarandShots: Chambered Rounds
|
||||
MasterChefShieldDurability: MJOLNIR Shield Level
|
||||
|
||||
Reference in new issue
Block a user