Reworked Life Jelly

Using a healing potion will spawn an aura that provides life regeneration to all player inside for 5 seconds
This commit is contained in:
Xyk authored and Cameron Ewell committed 2023-08-06 22:34:28 -04:00
1 parent 157012a606
commit 180b52c044
14 files changed
+302 -8

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.StatBuffs
{
public class PinkJellyRegen : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = false;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().PinkJellyRegen = true;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+24 -1
View File
@@ -58,6 +58,7 @@ using CalamityMod.Projectiles.Ranged;
using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Summon;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Projectiles.Typless;
using CalamityMod.UI;
using CalamityMod.World;
using Microsoft.Xna.Framework;
@@ -83,6 +84,8 @@ namespace CalamityMod.CalPlayer
#region No Category
public static bool areThereAnyDamnBosses = false;
public static bool areThereAnyDamnEvents = false;
public bool potionSick = false;
public int timePotionSick;
public bool drawBossHPBar = true;
public float stealthUIAlpha = 1f;
public float SulphWaterUIOpacity = 1f;
@@ -493,6 +496,7 @@ namespace CalamityMod.CalPlayer
public bool toxicHeart = false;
public bool abaddon = false;
public bool aeroStone = false;
public bool lifejelly = false;
public bool community = false;
public bool shatteredCommunity = false;
public bool fleshTotem = false;
@@ -825,6 +829,7 @@ namespace CalamityMod.CalPlayer
public bool flaskBrimstone = false;
public bool fabsolVodka = false;
public bool mushy = false;
public bool PinkJellyRegen = false;
public bool shellBoost = false;
public bool cFreeze = false;
public bool shine = false;
@@ -1563,6 +1568,7 @@ namespace CalamityMod.CalPlayer
toxicHeart = false;
abaddon = false;
aeroStone = false;
lifejelly = false;
community = false;
shatteredCommunity = false;
stressPills = false;
@@ -1829,6 +1835,7 @@ namespace CalamityMod.CalPlayer
shine = false;
anechoicCoating = false;
mushy = false;
PinkJellyRegen = false;
shellBoost = false;
cFreeze = false;
tRegen = false;
@@ -2264,6 +2271,7 @@ namespace CalamityMod.CalPlayer
shine = false;
anechoicCoating = false;
mushy = false;
PinkJellyRegen = false;
enraged = false;
shellBoost = false;
cFreeze = false;
@@ -3197,6 +3205,11 @@ namespace CalamityMod.CalPlayer
if (Player.accRunSpeed < accRunSpeedMin)
Player.accRunSpeed = accRunSpeedMin;
//Life Jelly regen aura spawn when using a healing potion
if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && lifejelly)
Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType<PinkJellyAura>(), 0, 0, Player.whoAmI);
if (snowman)
{
if (Player.whoAmI == Main.myPlayer && !snowmanNoseless)
@@ -3360,8 +3373,18 @@ namespace CalamityMod.CalPlayer
{
if (Player.whoAmI == Main.myPlayer && CalamityConfig.Instance.VanillaCooldownDisplay)
{
if (Player.whoAmI == Main.myPlayer && Player.potionDelay != 0)
potionSick = true;
else
potionSick = false;
if (!potionSick)
timePotionSick = 0;
else
timePotionSick++;
// Add a cooldown display for potion sickness if the player has the vanilla counter ticking
if (Player.potionDelay > 0 && !Player.HasCooldown(PotionSickness.ID))
if (potionSick && !Player.HasCooldown(PotionSickness.ID))
Player.AddCooldown(PotionSickness.ID, Player.potionDelay, false);
if (cooldowns.TryGetValue(PotionSickness.ID, out CooldownInstance cd))
+9
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using CalamityMod.CalPlayer.DrawLayers;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Ranged;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
@@ -517,6 +518,14 @@ namespace CalamityMod.CalPlayer
fullBright = true;
}
}
if (calamityPlayer.PinkJellyRegen)
{
if (Main.rand.NextBool(24) && drawInfo.shadow == 0f)
{
Particle Plus = new HealingPlus(Player.Center, Main.rand.NextFloat(0.5f, 1.2f), Color.HotPink, Color.LightPink, 1f, Main.rand.Next(10, 15));
GeneralParticleHandler.SpawnParticle(Plus);
}
}
if (calamityPlayer.bloodfinBoost)
{
if (Main.rand.NextBool(6) && drawInfo.shadow == 0f)
+3
View File
@@ -660,6 +660,9 @@ namespace CalamityMod.CalPlayer
if (sRegen)
Player.lifeRegen += 2;
if (PinkJellyRegen)
Player.lifeRegen += 4;
if (hallowedRegen)
Player.lifeRegen += 3;
+3 -5
View File
@@ -2,6 +2,7 @@
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using CalamityMod.CalPlayer;
namespace CalamityMod.Items.Accessories
{
@@ -19,11 +20,8 @@ namespace CalamityMod.Items.Accessories
public override void UpdateAccessory(Player player, bool hideVisual)
{
player.statLifeMax2 += 20;
if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0)
{
player.lifeRegen += 4;
}
CalamityPlayer modPlayer = player.Calamity();
modPlayer.lifejelly = true;
}
}
}
+1
View File
@@ -36,6 +36,7 @@ using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.IO;
using Terraria.Utilities;
using CalamityMod.Projectiles.Typless;
namespace CalamityMod.Items
{
@@ -1470,4 +1470,9 @@ WitherBlossomsBuff: {
WulfrumDroidBuff: {
DisplayName: Wulfrum Droid
Description: The wulfrum droid will protect you
}
PinkJellyRegen: {
DisplayName: Pink Jelly Regen
Description: You feel refreshed by the power of goo, life regen increased by 4
}
@@ -987,8 +987,8 @@ LifeJelly: {
DisplayName: Life Jelly
Tooltip:
'''
+20 max life
Standing still boosts life regen
Using a healing potion will spawn an aura that provides life
regeneration to all player inside for 5 seconds
'''
}
+58
View File
@@ -0,0 +1,58 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using System;
using static Terraria.ModLoader.PlayerDrawLayer;
namespace CalamityMod.Particles
{
public class HealingPlus : Particle
{
public override string Texture => "CalamityMod/Particles/HealingPlus";
public override bool UseAdditiveBlend => true;
public override bool UseCustomDraw => true;
public override bool SetLifetime => true;
public Player Owner;
public Color StartColor;
public Color EndColor;
public Vector2 OverridePosition;
public float Opacity;
public HealingPlus(Vector2 position, float scale, Color colorStart, Color colorEnd, float opacity, int lifetime)
{
Position = position;
Scale = scale;
Velocity.X = 0;
Velocity.Y = Main.rand.NextFloat(-2f, -5f);
Rotation = 0;
StartColor = colorStart;
EndColor = colorEnd;
Color = colorStart;
Opacity = opacity;
Lifetime = lifetime;
}
public override void Update()
{
Color = Color.Lerp(StartColor, EndColor, LifetimeCompletion);
Lighting.AddLight(Position, Color.ToVector3() * 0.2f);
Opacity -= 0.05f;
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
Vector2 Size = new Vector2 (Scale);
Vector2 origin = new Vector2(tex.Width, tex.Height);
Vector2 PositionAdjust = new Vector2(-16, -40);
spriteBatch.Draw(tex, Position - Main.screenPosition - PositionAdjust, null, Color, Rotation, origin, Size, SpriteEffects.None, 0);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+53
View File
@@ -0,0 +1,53 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using static CalamityMod.CalamityUtils;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Particles
{
public class StaticPulseRing : Particle
{
public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge";
public override bool UseAdditiveBlend => true;
public override bool SetLifetime => true;
public override bool UseCustomDraw => true;
private float OriginalScale;
private float FinalScale;
private Vector2 Squish;
private Color BaseColor;
//Basically DirectionalPulseRing, but doesn't move or change opacity
public StaticPulseRing(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime)
{
Position = position;
Velocity = velocity;
BaseColor = color;
OriginalScale = originalScale;
FinalScale = finalScale;
Scale = originalScale;
Lifetime = lifeTime;
Squish = squish;
Rotation = rotation;
}
public override void Update()
{
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress);
Color = BaseColor;
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
Velocity *= 0;
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0);
}
}
}
+123
View File
@@ -0,0 +1,123 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatBuffs;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typless
{
public class PinkJellyAura : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typless";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Player Owner => Main.player[Projectile.owner];
private static float Radius = 160f;
public int ShinkGrow = 0;
public int Framecounter = 0;
public int PulseOnce = 1;
public int PulseOnce2 = 1;
public int PulseOnce3 = 1;
public override void SetDefaults()
{
//These shouldn't matter because its circular
Projectile.width = 336;
Projectile.height = 336;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Default;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 2710;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void AI()
{
Framecounter++;
for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++)
{
Player player = Main.player[playerIndex];
float targetDist = Vector2.Distance(player.Center, Projectile.Center);
if (targetDist < 155f)
{
player.AddBuff(ModContent.BuffType<PinkJellyRegen>(), 300);
}
}
if (ShinkGrow == 0)
{
if (PulseOnce == 1)
{
Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 0f, 2f, 10);
GeneralParticleHandler.SpawnParticle(pulse);
SoundEngine.PlaySound(SoundID.NPCDeath28 with { Volume = 0.8f }, Projectile.Center);
PulseOnce = 0;
}
if (Framecounter == 10)
{
ShinkGrow = 1;
}
}
if (ShinkGrow == 1)
{
if (PulseOnce2 == 1)
{
Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 2f, 2f, 2700);
GeneralParticleHandler.SpawnParticle(pulse2);
PulseOnce2 = 0;
}
for (int i = 0; i < 2; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 242);
dust.scale = Main.rand.NextFloat(2.2f, 3.3f);
dust.noGravity = true;
}
for (int i = 0; i < 1; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(150f, 150f), 242);
dust.scale = Main.rand.NextFloat(0.8f, 1.3f);
dust.noGravity = true;
}
if (Framecounter == 2710)
{
ShinkGrow = 2;
}
}
if (ShinkGrow == 2)
{
if (PulseOnce3 == 1)
{
Particle pulse3 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 2f, 0f, 10);
GeneralParticleHandler.SpawnParticle(pulse3);
PulseOnce3 = 0;
}
}
}
public override bool? CanCutTiles()
{
return false;
}
public override bool? CanHitNPC(NPC target)
{
return false;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox);
}
}
+1
View File
@@ -0,0 +1 @@
Mods.CalamityMod.Projectiles.Typless.PinkJellyAura.DisplayName: Pink Jelly Aura