"Partial Life Regen"
This commit is contained in:
1 parent
5298eabafd
commit
2c70d9dac8
8 files changed
+38
-21
No files matched your search
@@ -132,6 +132,7 @@ namespace CalamityMod.CalPlayer
|
||||
/// <summary> If set to true, completely disables ALL life regeneration effects. Used by Omega Blue armor. </summary>
|
||||
public bool noLifeRegen = false;
|
||||
public float ammoCost = 1f;
|
||||
public float partialLifeRegen = 0f;
|
||||
public float healingPotionMultiplier = 1f;
|
||||
/// <summary>
|
||||
/// Tracks whether or not the player is currently holding Gael's Greatsword.<br/>
|
||||
@@ -311,6 +312,7 @@ namespace CalamityMod.CalPlayer
|
||||
#endregion
|
||||
|
||||
#region Timer and Counter
|
||||
public float partialLifeRegenCounter = 0f;
|
||||
public int gaelSwipes = 0;
|
||||
public int arsenalCooldown = 0;
|
||||
public int killModeCooldown = 0;
|
||||
@@ -2513,6 +2515,7 @@ namespace CalamityMod.CalPlayer
|
||||
lunicCorpsLegs = false;
|
||||
|
||||
ammoCost = 1f;
|
||||
partialLifeRegen = 0f;
|
||||
healingPotionMultiplier = 1f;
|
||||
|
||||
avertorBonus = false;
|
||||
@@ -3048,6 +3051,7 @@ namespace CalamityMod.CalPlayer
|
||||
if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0)
|
||||
consecutiveCaughtFish = 0;
|
||||
heldGaelsLastFrame = false;
|
||||
partialLifeRegenCounter = 0f;
|
||||
gaelSwipes = 0;
|
||||
whitewaterHeal = 0;
|
||||
luxorHit = false;
|
||||
@@ -3282,6 +3286,7 @@ namespace CalamityMod.CalPlayer
|
||||
healCounter = 300;
|
||||
danceOfLightCharge = 0;
|
||||
ammoCost = 1f;
|
||||
partialLifeRegen = 0f;
|
||||
healingPotionMultiplier = 1f;
|
||||
avertorBonus = false;
|
||||
divineBless = false;
|
||||
|
||||
@@ -428,6 +428,20 @@ namespace CalamityMod.CalPlayer
|
||||
//This method runs BEFORE UpdateBadLifeRegen. Put most effects here. Ran at the end of PostUpdateEquips
|
||||
public void GeneralLifeRegen()
|
||||
{
|
||||
// Apply partial life regeneration
|
||||
// Regenerator applies partial life regen as a part of its damage conversion straight up, so it will avoid this function
|
||||
if (regenerator)
|
||||
partialLifeRegenCounter = 0f;
|
||||
else
|
||||
{
|
||||
partialLifeRegenCounter += partialLifeRegen;
|
||||
if (partialLifeRegenCounter >= 1f || partialLifeRegenCounter <= -1f)
|
||||
{
|
||||
int flooredRegenAdded = (int)MathF.Floor(partialLifeRegenCounter);
|
||||
Player.lifeRegen += flooredRegenAdded;
|
||||
partialLifeRegenCounter -= flooredRegenAdded;
|
||||
}
|
||||
}
|
||||
|
||||
float lifeRatio = (Player.statLife) / (float)Player.statLifeMax2;
|
||||
|
||||
@@ -692,13 +706,13 @@ namespace CalamityMod.CalPlayer
|
||||
// Regenerator trades all positive regen for damage, and caps your health gain at 50%
|
||||
if (regenerator)
|
||||
{
|
||||
int finalRegen = Player.lifeRegen + (int)Math.Round(regen * (Player.statLifeMax2 / 400f * 0.85f + 0.15f));
|
||||
finalRegen = (int)Math.Max(finalRegen, 0);
|
||||
float finalRegen = Player.lifeRegen + partialLifeRegen + MathF.Round(regen * (Player.statLifeMax2 / 400f * 0.85f + 0.15f));
|
||||
finalRegen = MathF.Max(finalRegen, 0f);
|
||||
|
||||
// Rapid Healing increments RegenCount directly so it needs to be manually added
|
||||
// It also works while debuffs are active so the same logic applies here
|
||||
if (Player.palladiumRegen)
|
||||
finalRegen += 4;
|
||||
finalRegen += 4f;
|
||||
|
||||
regeneratorDamage = finalRegen * Regenerator.RegenToDamageRatio;
|
||||
Player.GetDamage<GenericDamageClass>() += regeneratorDamage;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Items.Weapons.Summon
|
||||
@@ -13,6 +14,9 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Summon";
|
||||
|
||||
public static float PartialRegenBoostPerBuffDroid = 0.5f;
|
||||
public static int DefenseBoostPerBuffDroid = 3;
|
||||
public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(PartialRegenBoostPerBuffDroid.ToRegenPerSecond(), DefenseBoostPerBuffDroid);
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 28;
|
||||
@@ -68,15 +72,13 @@ namespace CalamityMod.Items.Weapons.Summon
|
||||
buffingDrones = 0;
|
||||
}
|
||||
|
||||
public override void UpdateLifeRegen()
|
||||
// This needs to be a fair bit earlier for partial life regen to work
|
||||
public override void PostUpdateBuffs()
|
||||
{
|
||||
if (buffingDrones > 0)
|
||||
{
|
||||
// 1 life regen per drone.
|
||||
Player.lifeRegen += (int)(buffingDrones);
|
||||
|
||||
// 3 defense per drone.
|
||||
Player.statDefense += buffingDrones * 3;
|
||||
Player.Calamity().partialLifeRegen += buffingDrones * WulfrumController.PartialRegenBoostPerBuffDroid;
|
||||
Player.statDefense += buffingDrones * WulfrumController.DefenseBoostPerBuffDroid;
|
||||
|
||||
buffingDrones = 0;
|
||||
}
|
||||
|
||||
@@ -1316,7 +1316,7 @@ ProfanedSoulArtifact: {
|
||||
[ADREN]
|
||||
Once depleted, the rocks are flung outward and will regenerate 5 seconds after being hit
|
||||
Taking damage resets the timer
|
||||
The healer guardian restores 15 health every few seconds
|
||||
The healer guardian restores 10 health every few seconds
|
||||
Purity
|
||||
'''
|
||||
ShieldAdren: Halved Adrenaline loss if all damage is absorbed
|
||||
|
||||
@@ -932,7 +932,7 @@ WulfrumController: {
|
||||
Summons a wulfrum droid to fight for you
|
||||
Hold <right> while holding the remote to switch all of your drones between regular and supercharge mode
|
||||
Supercharged droids will stop attacking and focus wulfrum energy onto you
|
||||
Supercharged droids provide +0.5 HP/s life regen and 3 defense per droid
|
||||
Supercharged droids provide +{0} HP/s life regen and {1} defense per droid
|
||||
Can also be used to heal other players by keeping your mouse cursor close enough to them
|
||||
'''
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ AddedTooltip: {
|
||||
FairyBoots:
|
||||
'''
|
||||
Fairies can spawn at any time on the surface and spawn far more frequently
|
||||
Nearby fairies grant +2 HP/s life regen, 6 defense and 10% movement speed
|
||||
Nearby fairies grant +1 HP/s life regen, 6 defense and 10% movement speed
|
||||
Fairies are immune to damage and will no longer flee
|
||||
'''
|
||||
FleshKnucklesLine: Max life increased by 25
|
||||
|
||||
@@ -11,9 +11,10 @@ namespace CalamityMod.Prefixes
|
||||
public new string LocalizationCategory => "Prefixes.Accessory";
|
||||
public override PrefixCategory Category => PrefixCategory.Accessory;
|
||||
|
||||
public static float GetPartialLifeRegenAmount = 0.5f;
|
||||
public override void ApplyAccessoryEffects(Player player)
|
||||
{
|
||||
player.lifeRegen += GetLifeRegenAmount();
|
||||
player.Calamity().partialLifeRegen += GetPartialLifeRegenAmount;
|
||||
}
|
||||
|
||||
public override void ModifyValue(ref float valueMult)
|
||||
@@ -24,17 +25,11 @@ namespace CalamityMod.Prefixes
|
||||
public LocalizedText LifeRegenTooltip => CalamityUtils.GetText($"{LocalizationCategory}.LifeRegenTooltip");
|
||||
public override IEnumerable<TooltipLine> GetTooltipLines(Item item)
|
||||
{
|
||||
var perSecHP = (GetLifeRegenAmount() / 2.0f).ToString("0.#");
|
||||
yield return new TooltipLine(Mod, "CalamityMod:PrefixLifeRegenBoost", LifeRegenTooltip.Format(perSecHP))
|
||||
yield return new TooltipLine(Mod, "CalamityMod:PrefixLifeRegenBoost", LifeRegenTooltip.Format(GetPartialLifeRegenAmount.ToRegenPerSecond()))
|
||||
{
|
||||
IsModifier = true
|
||||
};
|
||||
}
|
||||
|
||||
public static int GetLifeRegenAmount()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public class Dauntless : ModPrefix, ILocalizedModType
|
||||
|
||||
@@ -91,7 +91,8 @@ namespace CalamityMod
|
||||
public static string ToMphps(this float velocity) => Round(velocity * 60f * 216000f / 42240f, "N2");
|
||||
public static string ToTiles(this float pixel) => Round(pixel / 16f);
|
||||
|
||||
public static string ToRegenPerSecond(this int regen) => Round(regen * 0.5f, "N2");
|
||||
public static string ToRegenPerSecond(this float partialRegen) => Round(partialRegen * 0.5f, "N2");
|
||||
public static string ToRegenPerSecond(this int regen, float partialRegen = 0f) => Round((regen + partialRegen) * 0.5f, "N2");
|
||||
public static string ToJumpSpeedPercent(this float boost) => Round(boost * 20f, "N2");
|
||||
public static string ToStealth(this float stealth) => Round(stealth * 100f, "N0");
|
||||
|
||||
|
||||
Reference in new issue
Block a user