Regenator Rework
This commit is contained in:
1 parent
9721e623e6
commit
92d658e843
8 files changed
+181
-10
No files matched your search
@@ -681,6 +681,7 @@ namespace CalamityMod.CalPlayer
|
||||
public bool gladiatorSword = false;
|
||||
public bool unstableGraniteCore = false;
|
||||
public bool regenator = false;
|
||||
public float regenatorDamage = 0;
|
||||
public bool theBee = false;
|
||||
public bool arcFlashRing = false;
|
||||
public bool arcFlashRingVisual = false;
|
||||
|
||||
@@ -2269,6 +2269,21 @@ namespace CalamityMod.CalPlayer
|
||||
if (RageEnabled)
|
||||
rageCombatFrames = BalancingConstants.RageCombatDelayTime;
|
||||
|
||||
// Regenator has been CANCLED on TWITTER.COM!!!! (Just keeping this here since it's a neat effect and I'll probably yoink it for something else later)
|
||||
if (regenator && false)
|
||||
{
|
||||
// Projectile damage and count is based on source damage of the hit
|
||||
float hitPower = (hurtInfo.SourceDamage / (Player.statLifeMax2 * 0.5f));
|
||||
int projCount = (int)MathHelper.Clamp((15 * hitPower), 2, 15) * 2; // they come out in pairs of 2
|
||||
int projBonusDamage = (int)(hurtInfo.SourceDamage * 0.5f);
|
||||
int projDamage = (int)Player.GetBestClassDamage().ApplyTo(20 + projBonusDamage);
|
||||
for (int i = 0; i < projCount; i++)
|
||||
{
|
||||
Vector2 vel = (MathHelper.TwoPi * i / projCount).ToRotationVector2() * (i % 2 == 0 ? 0.75f : 1f) * 10;
|
||||
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, vel.RotatedBy(-0.2f * (i % 2 == 0 ? -1 : 1)), ModContent.ProjectileType<RetaliationProjectile>(), projDamage, 0f, Player.whoAmI, 0, (i % 2 == 0 ? -1 : 1), -5);
|
||||
}
|
||||
}
|
||||
|
||||
// Hide of Astrum Deus' melee boost
|
||||
if (hideOfDeus)
|
||||
{
|
||||
|
||||
@@ -651,11 +651,6 @@ namespace CalamityMod.CalPlayer
|
||||
Player.lifeRegen += lesserEffect ? 1 : regenBoost;
|
||||
}
|
||||
|
||||
if (regenator)
|
||||
{
|
||||
Player.lifeRegenTime += 3;
|
||||
Player.lifeRegen += 12;
|
||||
}
|
||||
if (handWarmer && eskimoSet)
|
||||
{
|
||||
Player.lifeRegen += 2;
|
||||
@@ -782,9 +777,9 @@ namespace CalamityMod.CalPlayer
|
||||
if (Player.statLife < actualMaxLife)
|
||||
{
|
||||
// The soft cap doesn't apply if the player is not moving and not using a weapon while having any of the following:
|
||||
// Shiny Stone, Cosmic Freeze buff from the Cosmic Discharge, Demonshade Armor, or The Camper.
|
||||
// Shiny Stone, Cosmic Freeze buff from the Cosmic Discharge, Demonshade Armor, Regenator, or The Camper.
|
||||
int baseLifeRegenBoost = 4;
|
||||
bool noLifeRegenCap = (Player.shinyStone || cFreeze || shadeRegen || camper) &&
|
||||
bool noLifeRegenCap = (Player.shinyStone || cFreeze || shadeRegen || camper || regenator) &&
|
||||
Player.StandingStill() && Player.itemAnimation == 0;
|
||||
|
||||
if (!noLifeRegenCap)
|
||||
@@ -819,6 +814,14 @@ namespace CalamityMod.CalPlayer
|
||||
}
|
||||
}
|
||||
|
||||
if (regenator) // Gives special regen of it's own, but disables all regular life regen
|
||||
{
|
||||
if (Player.miscCounter % 7 == 0 && Player.statLife < (int)(Player.statLifeMax2 * 0.5f))
|
||||
Player.HealPlayer(1, HealTextType.None);
|
||||
}
|
||||
else
|
||||
regenatorDamage = 0;
|
||||
|
||||
if (toxicHeart) // Since it needs to know your life regen, it must be placed here
|
||||
{
|
||||
float minLifeRegen = -20; // Fastest rate
|
||||
|
||||
@@ -2,19 +2,23 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria.Localization;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
public class Regenator : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Accessories";
|
||||
public float regenatorDamageBoost = 0;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 34;
|
||||
Item.height = 56;
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.defense = 4; // This should have less defense due to the regen it provides
|
||||
Item.accessory = true;
|
||||
}
|
||||
|
||||
@@ -22,6 +26,23 @@ namespace CalamityMod.Items.Accessories
|
||||
{
|
||||
CalamityPlayer modPlayer = player.Calamity();
|
||||
modPlayer.regenator = true;
|
||||
player.longInvince = true; // Gives better iframes because god help you if you end up getting hit twice
|
||||
|
||||
|
||||
modPlayer.regenatorDamage = (player.lifeRegenCount * 1.75f) * 0.01f;
|
||||
regenatorDamageBoost = MathHelper.Lerp(regenatorDamageBoost, modPlayer.regenatorDamage, 0.1f);
|
||||
|
||||
player.GetDamage<GenericDamageClass>() += regenatorDamageBoost;
|
||||
|
||||
player.nebulaLevelLife = 0;
|
||||
|
||||
if (player.lifeRegenCount > 0)
|
||||
player.lifeRegenCount = 0;
|
||||
|
||||
// Boost life regen time quite a bit.
|
||||
// This is so that in events and such where small hits are common, your damage boost isn't completley negated
|
||||
if (player.lifeRegenTime < 3600)
|
||||
player.lifeRegenTime += 10;
|
||||
|
||||
//Hard-lock the player's health to 50%.
|
||||
//No lifesteal, no regen, no healing pots
|
||||
@@ -35,5 +56,10 @@ namespace CalamityMod.Items.Accessories
|
||||
player.lifeRegenCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> list)
|
||||
{
|
||||
list.FindAndReplace("[DAMAGE]", Math.Round(regenatorDamageBoost, 3).ToPercent().ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1398,8 +1398,11 @@ Regenator: {
|
||||
DisplayName: Regenator
|
||||
Tooltip:
|
||||
'''
|
||||
+6 HP/s life regen and massively accelerated natural life regen
|
||||
However, your health cannot exceed 50% of its maximum
|
||||
Your health cannot exceed 50% of its maximum
|
||||
Increases length of invincibility after taking damage
|
||||
Provides powerful special life regen to heal you for 8.5 HP/s
|
||||
All normal life regen is negated and converted into damage
|
||||
Current damage boost: [DAMAGE]%
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ ReaverOrb.DisplayName: Reaver Orb
|
||||
ReaverThornBase.DisplayName: Thorn
|
||||
RedLabSeeker.DisplayName: Seeking Mechanism
|
||||
RelicGuard.DisplayName: Relic Guard
|
||||
RetaliationProjectile.DisplayName: Retaliation Shard
|
||||
RiftReelerBobber.DisplayName: Chaotic Bobber
|
||||
SandCloakVeil.DisplayName: Dust Veil
|
||||
SandExplosion.DisplayName: Sand
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
@@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Graphics.Metaballs;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
public class RetaliationProjectile : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Typeless";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public float radius = 25f;
|
||||
public int time = 0;
|
||||
public bool homing = false;
|
||||
public NPC targeted;
|
||||
public Color mainColor = Color.White;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = AverageDamageClass.Instance;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1; // They only hit once, this is a visual thing
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.ArmorPenetration = 25;
|
||||
|
||||
Projectile.scale = 0.08f; // Normally you NEVER put scale in here, but since this doesnt use normal sprite drawing it's fine
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
float fadeOut = Utils.GetLerpValue(0, 50, Projectile.timeLeft, true);
|
||||
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
Color.DarkRed,
|
||||
Color.Crimson,
|
||||
};
|
||||
float rate = (Main.GlobalTimeWrappedHourly * 20);
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
mainColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
|
||||
|
||||
if (time % 2 == 0) // The trail
|
||||
{
|
||||
Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/SmallBloom", false, 11, 0.11f, mainColor, new Vector2(Utils.Remap(Projectile.velocity.Length(), 0, 5, 1, 0.6f, true), 1f), true, false, 0, false, false, Utils.Remap(Projectile.velocity.Length(), 0, 5, 0, 0.9f, true));
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
|
||||
if (Main.rand.NextBool(14))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Projectile.velocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.2f, 1f), 0, default, Main.rand.NextFloat(0.8f, 1.15f));
|
||||
dust.noGravity = true;
|
||||
dust.color = mainColor;
|
||||
}
|
||||
|
||||
if ((time > 65 || homing) && Projectile.numHits == 0) // Homing before they hit a target
|
||||
{
|
||||
homing = true;
|
||||
if (targeted == null || !targeted.CanBeChasedBy(Projectile, false) || !targeted.active || targeted.life <= 0)
|
||||
{
|
||||
targeted = Projectile.Center.ClosestNPCAt(2500);
|
||||
}
|
||||
|
||||
if (targeted != null)
|
||||
{
|
||||
CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.18f, 25, 0.98f, accelerate: true);
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.timeLeft++;
|
||||
}
|
||||
}
|
||||
else // The rotate effect on spawn and on death
|
||||
{
|
||||
if (Projectile.numHits > 0)
|
||||
{
|
||||
Projectile.scale = fadeOut * 0.08f;
|
||||
if (Projectile.timeLeft % 40 == 0)
|
||||
Projectile.ai[1] *= -1;
|
||||
}
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy((0.03f + (1 - fadeOut) * 0.05f) * Projectile.ai[1]) * (Projectile.numHits == 0 ? 0.98f : 1);
|
||||
Projectile.extraUpdates = 2;
|
||||
}
|
||||
if (targeted == null && homing && Projectile.numHits == 0 && Projectile.velocity.Length() < 7)
|
||||
Projectile.velocity *= 1.007f;
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2;
|
||||
time++;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Projectile.timeLeft = Main.rand.Next(50, 75 + 1);
|
||||
|
||||
SoundStyle sound = new("CalamityMod/Sounds/NPCHit/PerfHiveHit", 3);
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = Main.rand.NextFloat(-0.1f, 0.2f), MaxInstances = 15 }, Projectile.Center);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/Particles/BigHeart").Value;
|
||||
Vector2 squash = new Vector2(Utils.Remap(Projectile.velocity.Length(), 1, 7, 1, 0.5f), Utils.Remap(Projectile.velocity.Length(), 1, 7, 1, 3.2f));
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8, null, mainColor with { A = 0 }, Projectile.rotation, tex.Size() * 0.5f, squash * Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => homing && Projectile.numHits == 0 ? CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox) : false;
|
||||
public override bool? CanCutTiles() => false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user