Windchill and more Elumphant progress
This commit is contained in:
1 parent
6dcc693b50
commit
9f6cc4d282
11 files changed
+415
-49
No files matched your search
@@ -5,7 +5,10 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
@@ -19,6 +22,7 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
public static DebuffData debuffData = new DebuffData()
|
||||
{
|
||||
EnemyLostRegen = 20,
|
||||
NPCLifeRegenMethod = WindChilledNPCLifeRegen,
|
||||
ColdDebuffScaling = 1
|
||||
};
|
||||
public override void SetStaticDefaults()
|
||||
@@ -29,63 +33,81 @@ namespace CalamityMod.Buffs.DamageOverTime
|
||||
BuffID.Sets.LongerExpertDebuff[Type] = true;
|
||||
BuffDatasets.DebuffDataset[Type] = debuffData;
|
||||
}
|
||||
public static void WindChilledNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage)
|
||||
{
|
||||
var cnpc = npc.Calamity();
|
||||
|
||||
int baseDoTValue = (int)(cnpc.windChilledMult * debuffData.EnemyLostRegen);
|
||||
cnpc.ApplyDPSDebuff(baseDoTValue, Math.Max((int)(baseDoTValue * debuffData.MultiplierDamageTickSize), debuffData.MinimumDamageTickSize), ref npc.lifeRegen, ref damage);
|
||||
}
|
||||
|
||||
public override void Update(Player player, ref int buffIndex)
|
||||
{
|
||||
player.Calamity().windchilled = true;
|
||||
player.Calamity().windChilled = true;
|
||||
}
|
||||
|
||||
public override void Update(NPC npc, ref int buffIndex)
|
||||
{
|
||||
npc.Calamity().windchilled = true;
|
||||
npc.Calamity().windChilled = true;
|
||||
}
|
||||
|
||||
internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false)
|
||||
{
|
||||
Player Player = drawInfo.drawPlayer;
|
||||
Player player = drawInfo.drawPlayer;
|
||||
|
||||
if (Main.rand.NextBool(5))
|
||||
float widthMult = 1;
|
||||
float hightMult = 1;
|
||||
Color color = Elumphant.color1;
|
||||
Color color2 = Elumphant.color2;
|
||||
float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi);
|
||||
if (Main.rand.NextBool(16))
|
||||
{
|
||||
Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f);
|
||||
SnowflakeSparkle snowflake = new SnowflakeSparkle(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.4f, 15, 2f, 1.9f);
|
||||
GeneralParticleHandler.SpawnParticle(snowflake);
|
||||
bool start = !Main.rand.NextBool(4);
|
||||
Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + player.velocity * 0.85f;
|
||||
Vector2 particlePos = player.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult);
|
||||
Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color,
|
||||
new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult)));
|
||||
GeneralParticleHandler.SpawnParticle(mist, true, Enums.GeneralDrawLayer.AfterPlayers);
|
||||
}
|
||||
if (Main.rand.NextBool(40))
|
||||
if (Main.rand.NextBool(11))
|
||||
{
|
||||
Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f);
|
||||
MediumMistParticle mist = new MediumMistParticle(Player.Calamity().RandomDebuffVisualSpot, Vect, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f);
|
||||
GeneralParticleHandler.SpawnParticle(mist);
|
||||
Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1);
|
||||
Dust dust2 = Dust.NewDustPerfect(player.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType<SquashDustPixelated>(),
|
||||
Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult));
|
||||
dust2.noGravity = false;
|
||||
dust2.color = Main.rand.NextBool() ? color : color2;
|
||||
dust2.customData = new Vector2(0.7f, 1.4f);
|
||||
dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult);
|
||||
}
|
||||
Vector2 dustCorner = Player.position - 2f * Vector2.One;
|
||||
Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f));
|
||||
Dust dust = Dust.NewDustDirect(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 20 : 113, dustVel.X, dustVel.Y);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1f, 0.3f);
|
||||
dust.alpha = 10;
|
||||
}
|
||||
|
||||
internal static void DrawEffects(NPC npc, ref Color drawColor)
|
||||
{
|
||||
Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2));
|
||||
if (Main.rand.NextBool(5))
|
||||
float maxSizeMult = 10f;
|
||||
float widthMult = MathF.Pow(Utils.Remap(npc.width, 10, 500, 1f, maxSizeMult, false), 0.8f);
|
||||
float hightMult = MathF.Pow(Utils.Remap(npc.height, 10, 500, 1f, maxSizeMult, false), 0.8f);
|
||||
Color color = Elumphant.color1;
|
||||
Color color2 = Elumphant.color2;
|
||||
float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi);
|
||||
if (Main.rand.NextBool(16))
|
||||
{
|
||||
Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f);
|
||||
SnowflakeSparkle snowflake = new SnowflakeSparkle(npcSize, Vect, Main.rand.NextBool() ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, 0.8f, 15, 2f, 1.9f);
|
||||
GeneralParticleHandler.SpawnParticle(snowflake);
|
||||
bool start = !Main.rand.NextBool(4);
|
||||
Vector2 particleVel = Vector2.UnitY * Main.rand.NextFloat(-1.25f, 1.25f) * Math.Max(hightMult, widthMult) * (Main.rand.NextBool(5) ? 1.5f : 1) + npc.velocity * 0.85f;
|
||||
Vector2 particlePos = npc.Center + Main.rand.NextVector2Circular(3 * widthMult + 8, 3 * widthMult + 8) * Math.Max(hightMult, widthMult);
|
||||
Particle mist = new CustomPulsingSpark(particlePos, particleVel, "CalamityMod/Particles/ThinSparkle", "CalamityMod/Particles/BloomCircle", false, 65, Main.rand.NextFloat(0.95f, 1.35f) * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color,
|
||||
new Vector2(0.6f, 1.2f), true, true, Main.rand.Next(4, 7 + 1), colorFadeSpeed: 0.85f, noShrink: true, extraRotation: -particleVel.ToRotation(), shrinkSpeed: 0.1f, sineRate: Main.rand.NextFloat(0.25f, 0.55f), sineIntensity: (int)(Main.rand.Next(12, 19 + 1) * Math.Max(hightMult, widthMult)));
|
||||
GeneralParticleHandler.SpawnParticle(mist, true, Main.rand.NextBool() ? Enums.GeneralDrawLayer.AfterNPCs : Enums.GeneralDrawLayer.BeforeNPCs);
|
||||
}
|
||||
if (Main.rand.NextBool(40))
|
||||
if (Main.rand.NextBool(11))
|
||||
{
|
||||
Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f);
|
||||
MediumMistParticle mist = new MediumMistParticle(npcSize, Vect, new Color(172, 238, 255), new Color(145, 170, 188), Main.rand.NextFloat(0.5f, 1.5f), 245 - Main.rand.Next(50), 0.02f);
|
||||
GeneralParticleHandler.SpawnParticle(mist);
|
||||
Vector2 dustVel = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(0.2f, 1.1f) * Math.Max(hightMult, widthMult) * 2 * (Main.rand.NextBool(5) ? 2f : 1);
|
||||
Dust dust2 = Dust.NewDustPerfect(npc.Center + dustVel * Main.rand.NextFloat(3, 4), ModContent.DustType<SquashDustPixelated>(),
|
||||
Vector2.Zero, 0, default, Main.rand.NextFloat(0.2f, 0.45f) * Math.Max(hightMult, widthMult));
|
||||
dust2.noGravity = false;
|
||||
dust2.color = Main.rand.NextBool() ? color : color2;
|
||||
dust2.customData = new Vector2(0.7f, 1.4f);
|
||||
dust2.fadeIn = 0.1f * Math.Max(hightMult, widthMult);
|
||||
}
|
||||
|
||||
Vector2 dustCorner = npc.position - 2f * Vector2.One;
|
||||
Vector2 dustVel = npc.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f));
|
||||
Dust dust = Dust.NewDustDirect(dustCorner, npc.width + 4, npc.height + 4, Main.rand.NextBool(4) ? 20 : 113, dustVel.X, dustVel.Y);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1f, 0.3f);
|
||||
dust.alpha = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 488 B After Width: | Height: | Size: 3.1 KiB |
@@ -398,9 +398,9 @@ WeakBrimstoneFlames: {
|
||||
}
|
||||
|
||||
WindChilled: {
|
||||
DisplayName: Wind Chilled
|
||||
Description: Should have worn a coat
|
||||
ItemTooltipPlayer:
|
||||
DisplayName: Wind Chilled
|
||||
Description: Should have worn a coat
|
||||
ItemTooltipPlayer:
|
||||
'''
|
||||
Cold - 2 DPS
|
||||
Reduced movement speed
|
||||
@@ -409,7 +409,7 @@ WindChilled: {
|
||||
'''
|
||||
Cold - 10 DPS
|
||||
1.5x damage if the enemy is inflicted with a Water debuff
|
||||
Enhances Water debuff damage
|
||||
Enhances Water debuff damage
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -394,6 +394,7 @@ namespace CalamityMod.NPCs
|
||||
public bool banishingFire = false;
|
||||
public bool wither = false;
|
||||
public bool windChilled = false;
|
||||
public float windChilledMult = 1;
|
||||
/// <summary>
|
||||
/// If greater than 0, this enemy will appear to disintegrate into ash when killed.<br/>
|
||||
/// Used by Rancor's laser beam.
|
||||
@@ -903,11 +904,11 @@ namespace CalamityMod.NPCs
|
||||
}
|
||||
if (npc.HasBuff(ModContent.BuffType<WindChilled>()))
|
||||
{
|
||||
ActiveWaterDebuffMultiplier += 1;
|
||||
ActiveWaterDebuffMultiplier += 0.5f;
|
||||
}
|
||||
if (npc.buffType.Any(i => BuffDatasets.DebuffDataset[i] is not null && BuffDatasets.DebuffDataset[i].WaterDebuffScaling > 0) || npc.wet || npc.honeyWet || npc.dripping)
|
||||
{
|
||||
|
||||
windChilledMult = 1.5f;
|
||||
}
|
||||
if (VulnerableToHeat.HasValue)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CustomColorChangeSpark : Particle
|
||||
{
|
||||
public Color InitialColor;
|
||||
public Color EndColor;
|
||||
public bool AffectedByGravity;
|
||||
public bool FadeIn = false;
|
||||
public float FadeInScale = 0f;
|
||||
public bool GlowCenter = false;
|
||||
public float GlowCenterScale = 1;
|
||||
public float GlowOpacity = 1;
|
||||
public string NewTexture;
|
||||
public float ExtraRotation;
|
||||
public Vector2 Stretch = new Vector2(0.5f, 1.6f);
|
||||
public float ShrinkSpeed = 0;
|
||||
public bool FlipHorizontal = false;
|
||||
public bool NoShrink = false;
|
||||
public float Spin = 0;
|
||||
public float ColorFadeSpeed = 0;
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public bool AltVisual = true;
|
||||
public override bool UseAdditiveBlend => AltVisual;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public CustomColorChangeSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color startColor, Color endColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3)
|
||||
{
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
NewTexture = texture;
|
||||
ExtraRotation = extraRotation;
|
||||
AffectedByGravity = affectedByGravity;
|
||||
AffectedByLight = affectedByLight;
|
||||
Scale = scale;
|
||||
Stretch = stretch;
|
||||
FadeInScale = scale;
|
||||
Lifetime = lifetime;
|
||||
Color = InitialColor = startColor;
|
||||
EndColor = endColor;
|
||||
ShrinkSpeed = shrinkSpeed;
|
||||
|
||||
AltVisual = useAddativeBlend;
|
||||
GlowCenter = glowCenter;
|
||||
GlowCenterScale = glowCenterScale;
|
||||
GlowOpacity = glowOpacity;
|
||||
FlipHorizontal = flipHorizontal;
|
||||
NoShrink = noShrink;
|
||||
|
||||
FadeIn = fadeIn;
|
||||
|
||||
if (FadeIn)
|
||||
Scale = 0f;
|
||||
Spin = spin;
|
||||
ColorFadeSpeed = colorFadeSpeed;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (!FadeIn)
|
||||
{
|
||||
if (!NoShrink)
|
||||
Scale *= 0.95f;
|
||||
Color = Color.Lerp(InitialColor, EndColor, LifetimeCompletion);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((float)Time / (float)Lifetime < 0.5f)
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f);
|
||||
}
|
||||
}
|
||||
Velocity *= 0.95f;
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += 0.25f;
|
||||
}
|
||||
ExtraRotation += Spin;
|
||||
Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation;
|
||||
|
||||
Stretch.X *= (1 - 0.2f * ShrinkSpeed);
|
||||
Stretch.Y *= (1 + 0.2f * ShrinkSpeed);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 scale = Stretch * Scale;
|
||||
Texture2D texture = ModContent.Request<Texture2D>(NewTexture).Value;
|
||||
|
||||
float scaleMult = 1;
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
DateTime day = DateTime.Now;
|
||||
if (day.DayOfWeek == DayOfWeek.Tuesday)
|
||||
{
|
||||
Texture2D joke = ModContent.Request<Texture2D>("CalamityMod/Particles/MammothParticle").Value;
|
||||
scaleMult = (MathHelper.Lerp(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f));
|
||||
texture = joke;
|
||||
AltVisual = true;
|
||||
}
|
||||
}
|
||||
|
||||
Color col = Color;
|
||||
|
||||
if (AffectedByLight)
|
||||
{
|
||||
col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color);
|
||||
}
|
||||
|
||||
if (Pixelate)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) =>
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, col * fadeOut, Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, col * fadeOut, Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CustomPulsingSpark : Particle
|
||||
{
|
||||
public Color InitialColor;
|
||||
public Color BackColor;
|
||||
public bool AffectedByGravity;
|
||||
public bool FadeIn = false;
|
||||
public float FadeInScale = 0f;
|
||||
public bool GlowCenter = false;
|
||||
public float GlowCenterScale = 1;
|
||||
public float GlowOpacity = 1;
|
||||
public Texture2D NewTexture;
|
||||
public Texture2D NewTextureBack;
|
||||
public float ExtraRotation;
|
||||
public Vector2 Stretch = new Vector2(0.5f, 1.6f);
|
||||
public float ShrinkSpeed = 0;
|
||||
public bool FlipHorizontal = false;
|
||||
public bool NoShrink = false;
|
||||
public float Spin = 0;
|
||||
public float ColorFadeSpeed = 0;
|
||||
public int PulseRate;
|
||||
public int randTimeAdd = 0;
|
||||
|
||||
public float SineRate = 0;
|
||||
public float SineIntensity = 0;
|
||||
public float Sine = 0;
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public bool AltVisual = true;
|
||||
public override bool UseAdditiveBlend => AltVisual;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public CustomPulsingSpark(Vector2 relativePosition, Vector2 velocity, string frontTexture, string backTexture, bool affectedByGravity, int lifetime, float scale, Color color, Color backColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, int pulseRate = 10, float sineRate = 1, float sineIntensity = 0, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3)
|
||||
{
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
NewTexture ??= ModContent.Request<Texture2D>(frontTexture).Value;
|
||||
NewTextureBack ??= ModContent.Request<Texture2D>(backTexture).Value;
|
||||
ExtraRotation = extraRotation;
|
||||
AffectedByGravity = affectedByGravity;
|
||||
AffectedByLight = affectedByLight;
|
||||
Scale = scale;
|
||||
Stretch = stretch;
|
||||
FadeInScale = scale;
|
||||
Lifetime = lifetime;
|
||||
Color = InitialColor = color;
|
||||
BackColor = backColor;
|
||||
ShrinkSpeed = shrinkSpeed;
|
||||
PulseRate = pulseRate;
|
||||
|
||||
AltVisual = useAddativeBlend;
|
||||
GlowCenter = glowCenter;
|
||||
GlowCenterScale = glowCenterScale;
|
||||
GlowOpacity = glowOpacity;
|
||||
FlipHorizontal = flipHorizontal;
|
||||
NoShrink = noShrink;
|
||||
|
||||
FadeIn = fadeIn;
|
||||
randTimeAdd = Main.rand.Next(0, 200 + 1);
|
||||
SineRate = sineRate;
|
||||
SineIntensity = sineIntensity;
|
||||
|
||||
if (FadeIn)
|
||||
Scale = 0f;
|
||||
Spin = spin;
|
||||
ColorFadeSpeed = colorFadeSpeed;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (!FadeIn)
|
||||
{
|
||||
if (!NoShrink)
|
||||
Scale *= 0.95f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((float)Time / (float)Lifetime < 0.5f)
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f);
|
||||
}
|
||||
}
|
||||
Velocity *= 0.95f;
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += 0.25f;
|
||||
}
|
||||
ExtraRotation += Spin;
|
||||
Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation;
|
||||
|
||||
Sine = (float)Math.Sin(((Time + randTimeAdd) * SineRate) / MathHelper.Pi) * SineIntensity;
|
||||
|
||||
Stretch.X *= (1 - 0.2f * ShrinkSpeed);
|
||||
Stretch.Y *= (1 + 0.2f * ShrinkSpeed);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
float pulseScale = 1 + Utils.Remap(Time % PulseRate, 0, PulseRate, 0, 0.85f);
|
||||
Vector2 adjustedSquash = new Vector2(Math.Max(Stretch.X - 0.4f, 0.1f), Math.Max(Stretch.Y + 0.4f, 0.1f));
|
||||
Vector2 scale = adjustedSquash * Scale * pulseScale;
|
||||
|
||||
float scaleMult = 1;
|
||||
Color col = Color;
|
||||
Color backCol = BackColor;
|
||||
|
||||
Vector2 drawPos = Position + Vector2.UnitX * Sine;
|
||||
if (AffectedByLight)
|
||||
{
|
||||
col = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(Color);
|
||||
backCol = Lighting.GetColor((drawPos / 16).ToPoint()).MultiplyRGB(BackColor);
|
||||
}
|
||||
|
||||
if (Pixelate)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) =>
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f));
|
||||
spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, col * fadeOut, Rotation, NewTexture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(NewTexture, drawPos - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, NewTexture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
scaleMult = (MathHelper.Lerp(NewTexture.Size().X / NewTextureBack.Size().X, NewTexture.Size().Y / NewTextureBack.Size().Y, 0.5f));
|
||||
spriteBatch.Draw(NewTextureBack, drawPos - Main.screenPosition, null, backCol * fadeOut * 0.7f, Rotation, NewTextureBack.Size() * 0.5f, scale * scaleMult * 1.45f, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -5,6 +5,7 @@ using CalamityMod.Dusts;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
@@ -12,6 +13,7 @@ using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
@@ -48,6 +50,10 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
public bool mammothOops = false;
|
||||
public float hopSize = 0;
|
||||
public int hopTimer = 0;
|
||||
public bool attackedThisFrame = false;
|
||||
public int attackDirection = 1;
|
||||
public float mistShootTimer = 0;
|
||||
public float maxTrunkRot => -MathHelper.PiOver2 * 1.1f;
|
||||
public int attackTime => (int)(FrozenCube.baseAttackSpeed);
|
||||
public int cooldownTime => (int)(FrozenCube.baseAttackCooldown / GetPower(0.5f));
|
||||
|
||||
@@ -97,6 +103,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
if (Projectile.spriteDirection != newDirection)
|
||||
{
|
||||
trunkRotation *= -1;
|
||||
Projectile.rotation *= -1;
|
||||
}
|
||||
Projectile.spriteDirection = newDirection;
|
||||
}
|
||||
@@ -124,13 +131,13 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
mammothOops = false;
|
||||
else if (mammothOops)
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp(0, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true));
|
||||
else if (hopTimer > 0)
|
||||
trunkRotation = trunkRotation.AngleLerp(maxTrunkRot * Projectile.spriteDirection, Utils.GetLerpValue(0, hopTimerMax, hopTimer, true));
|
||||
|
||||
Main.NewText(hopSize);
|
||||
Vector2 offsetY = -Vector2.UnitY * (Owner.height / 2 + Projectile.height / 2.5f) * (1 + 0.4f * sine2 * fallLerp + 5 * CalamityUtils.EaseInOutExp(fallLerp, 2f, 2f)) * hop;
|
||||
Vector2 offsetX = Vector2.UnitX * ((3 * Projectile.spriteDirection) + 17 * sine3 * fallLerp);
|
||||
goalPosition = Owner.MountedCenter + offsetX + offsetY;
|
||||
|
||||
|
||||
if (dashing)
|
||||
{
|
||||
Projectile.frame = 2;
|
||||
@@ -140,8 +147,9 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
}
|
||||
else
|
||||
{
|
||||
int direction = Owner.ItemAnimationActive ? (Math.Sign(Projectile.Center.DirectionTo(Owner.ClampedMouseWorld()).X)) : (Owner.direction);
|
||||
if (fallTimer == 0)
|
||||
SetDirection(Owner.direction);
|
||||
SetDirection(direction);
|
||||
Projectile.Center = goalPosition;
|
||||
|
||||
if (targeted == null)
|
||||
@@ -153,15 +161,34 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
SoundStyle attack = new("CalamityMod/Sounds/Item/ElumphantSound");
|
||||
SoundEngine.PlaySound(attack with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center);
|
||||
|
||||
Projectile.soundDelay = 0;
|
||||
Projectile.frameCounter = 1;
|
||||
}
|
||||
SetDirection(Math.Sign(Projectile.Center.DirectionTo(targeted.Center).X));
|
||||
horizontalSquash = 0.5f;
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, Projectile.Center.DirectionTo(targeted.Center).ToRotation() - MathHelper.PiOver2, 0.07f);
|
||||
if (attackTimer == cooldownTime + attackTime)
|
||||
Projectile.frame = 0;
|
||||
float angleSweep = MathF.Sin(attackTimer * 0.085f) * attackDirection;
|
||||
float goalAngle = Projectile.Center.DirectionTo(targeted.Center).ToRotation() - MathHelper.PiOver2;
|
||||
Projectile.rotation = Projectile.rotation.AngleLerp((goalAngle + MathHelper.PiOver2 * Projectile.spriteDirection) * fallLerp, 0.07f);
|
||||
trunkRotation = trunkRotation.AngleLerp(goalAngle - Projectile.rotation - MathHelper.PiOver4 * angleSweep, 0.12f);
|
||||
|
||||
if (mistShootTimer == 0)
|
||||
{
|
||||
Vector2 shootVel = (trunkRotation + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2();
|
||||
int damage = (int)Owner.GetTotalDamage<GenericDamageClass>().ApplyTo(FrozenCube.mistBaseDamage);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + shootVel * 5, shootVel * 10, ModContent.ProjectileType<PristineSecondary>(), damage, 0, Owner.whoAmI);
|
||||
}
|
||||
mistShootTimer += 0.5f * GetPower(0.5f);
|
||||
if (mistShootTimer >= 5)
|
||||
mistShootTimer = 0;
|
||||
|
||||
|
||||
attackedThisFrame = true;
|
||||
if (attackTimer == cooldownTime + attackTime)
|
||||
{
|
||||
attackDirection *= -1;
|
||||
Projectile.frame = 0;
|
||||
}
|
||||
}
|
||||
else // Idle
|
||||
{
|
||||
@@ -186,7 +213,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
SoundStyle cry = new("CalamityMod/Sounds/Item/ElumphantCry");
|
||||
SoundEngine.PlaySound(cry with { Pitch = Main.rand.NextFloat(-0.2f, 0.2f) }, Projectile.Center, _ => new ProjectileAudioTracker(Projectile).IsActiveAndInGame());
|
||||
}
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, -MathHelper.PiOver2 * 1.1f * Projectile.spriteDirection, 0.025f);
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, maxTrunkRot * Projectile.spriteDirection, 0.025f);
|
||||
}
|
||||
else
|
||||
trunkRotation = Utils.AngleLerp(trunkRotation, 0, 0.11f);
|
||||
@@ -210,7 +237,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
Projectile.soundDelay += 2; // Naturally decreases by 1, so to make it count up, increases it by 2
|
||||
}
|
||||
|
||||
if (hopTimer == 0)
|
||||
if (hopTimer == 0 && !attackedThisFrame)
|
||||
{
|
||||
if (mammothFlip)
|
||||
{
|
||||
@@ -243,10 +270,33 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
float rotation = MathHelper.WrapAngle(Projectile.rotation + MathHelper.Pi);
|
||||
if (mammothFlip && rotation < MathHelper.PiOver2 && rotation > -MathHelper.PiOver2 && landPower > 0.2f)
|
||||
{
|
||||
SoundStyle bonk = new("CalamityMod/Sounds/Item/Bonk");
|
||||
SoundEngine.PlaySound(bonk with { Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center);
|
||||
|
||||
int halfDusts = 7;
|
||||
Owner.SetScreenshake(2);
|
||||
Projectile.frame = 1;
|
||||
SetRandBlink();
|
||||
for (int i = -halfDusts; i <= halfDusts; i++)
|
||||
{
|
||||
Vector2 dustVel = Vector2.UnitX.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.6f, 1.8f);
|
||||
Vector2 dustPos = Owner.MountedCenter - (Vector2.UnitY * Owner.height / 2) + dustVel * 1.5f;
|
||||
Dust dust2 = Dust.NewDustPerfect(dustPos, ModContent.DustType<SquashDustPixelated>(),
|
||||
dustVel * (i * 0.4f), 0, default, Main.rand.NextFloat(0.2f, 0.45f) * 3);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool() ? color1 : color2;
|
||||
dust2.customData = new Vector2(0.6f, 1.5f);
|
||||
dust2.fadeIn = -0.4f;
|
||||
if (i == -1)
|
||||
i = 1;
|
||||
}
|
||||
|
||||
trunkRotation = maxTrunkRot * Projectile.spriteDirection;
|
||||
SoundStyle ahh = new("CalamityMod/Sounds/Item/ElumphantSound");
|
||||
SoundEngine.PlaySound(ahh with { Pitch = Main.rand.NextFloat(0.4f, 0.6f) }, Projectile.Center);
|
||||
verticalSquash = 1.5f * landPower;
|
||||
SoundEngine.PlaySound(ahh with { Pitch = Main.rand.NextFloat(0.4f, 0.6f), volume = 0.6f }, Projectile.Center);
|
||||
CombatText.NewText(Projectile.Hitbox, usedColor, "!");
|
||||
|
||||
verticalSquash = 1.5f * landPower;
|
||||
mammothOops = true;
|
||||
}
|
||||
else
|
||||
@@ -268,6 +318,8 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
squashTimerX += 0.1f + horizontalSquash;
|
||||
squashTimerY += 0.1f + verticalSquash;
|
||||
|
||||
attackedThisFrame = false;
|
||||
|
||||
if (!Owner.Calamity().frozenCube)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user