Caustic Edge visual improvements and other things.

This commit is contained in:
mountaindrew10 committed 2024-03-15 16:05:47 -05:00
1 parent 832800c2cb
commit 24f0702d17
2 files changed
+118 -27

No files matched your search

+11 -5
View File
@@ -11,6 +11,7 @@ namespace CalamityMod.Items.Weapons.Melee
public class TrueCausticEdge : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public override void SetDefaults()
{
Item.width = 64;
@@ -21,13 +22,13 @@ namespace CalamityMod.Items.Weapons.Melee
Item.useStyle = ItemUseStyleID.Swing;
Item.useTime = 28;
Item.useTurn = true;
Item.knockBack = 5.75f;
Item.knockBack = 6f;
Item.UseSound = SoundID.Item1;
Item.autoReuse = true;
Item.value = CalamityGlobalItem.Rarity4BuyPrice;
Item.rare = ItemRarityID.LightRed;
Item.shoot = ModContent.ProjectileType<TrueCausticEdgeProjectile>();
Item.shootSpeed = 16f;
Item.shootSpeed = 12f;
}
public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => damage = (int)(damage * 0.75);
@@ -36,13 +37,18 @@ namespace CalamityMod.Items.Weapons.Melee
{
if (Main.rand.NextBool(3))
{
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.GreenFairy);
int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom;
int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(1.8f, 2.4f));
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0f;
if (dustType == DustID.Venom)
Main.dust[dust].fadeIn = 1.5f;
}
}
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 150);
public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 180);
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(BuffID.Venom, 150);
public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) => target.AddBuff(BuffID.Venom, 180);
public override void AddRecipes()
{
+107 -22
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -9,6 +10,13 @@ namespace CalamityMod.Projectiles.Melee
public class TrueCausticEdgeProjectile : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
private const float ColorAlternateTime = 30f;
private const int TimeLeft = 600;
private const int MaxAlpha = 128;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
@@ -17,25 +25,87 @@ namespace CalamityMod.Projectiles.Melee
public override void SetDefaults()
{
Projectile.width = 20;
Projectile.height = 20;
Projectile.aiStyle = ProjAIStyleID.Beam;
Projectile.width = 16;
Projectile.height = 16;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 3;
Projectile.timeLeft = 600;
Projectile.timeLeft = TimeLeft;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.alpha = MaxAlpha;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0f);
Projectile.ai[2] += 1f;
if (Projectile.ai[2] >= ColorAlternateTime)
Projectile.ai[2] = -ColorAlternateTime;
Vector3 colorOne = new Vector3(0.9f, 0f, 0.9f);
Vector3 colorTwo = new Vector3(0.6f, 1.2f, 0f);
Vector3 lightColor = Vector3.Lerp(colorOne, colorTwo, Math.Abs(Projectile.ai[2]) / ColorAlternateTime);
Lighting.AddLight(Projectile.Center, lightColor.X, lightColor.Y, lightColor.Z);
if (Projectile.localAI[1] > 7f)
{
float dustScale = 1.25f * Projectile.scale;
int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom;
int dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= -0.25f;
if (dustType == DustID.Venom)
Main.dust[dust].fadeIn = 1.5f;
dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom;
dust = Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= -0.25f;
Main.dust[dust].position -= Projectile.velocity * 0.5f;
if (dustType == DustID.Venom)
Main.dust[dust].fadeIn = 1.5f;
}
if (Projectile.localAI[1] < 15f)
{
Projectile.localAI[1] += 1f;
}
else
{
if (Projectile.localAI[0] == 0f)
{
Projectile.scale -= 0.02f;
Projectile.alpha += 15;
if (Projectile.alpha >= MaxAlpha - 5)
{
Projectile.alpha = MaxAlpha;
Projectile.localAI[0] = 1f;
}
}
else if (Projectile.localAI[0] == 1f)
{
Projectile.scale += 0.02f;
Projectile.alpha -= 15;
if (Projectile.alpha <= 0)
{
Projectile.alpha = 0;
Projectile.localAI[0] = 0f;
}
}
}
if (Projectile.ai[1] == 0f)
{
Projectile.ai[1] = 1f;
SoundEngine.PlaySound(SoundID.Item8, Projectile.Center);
}
Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4;
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.timeLeft > 595)
if (Projectile.timeLeft > TimeLeft - 5)
return false;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
@@ -44,7 +114,10 @@ namespace CalamityMod.Projectiles.Melee
public override Color? GetAlpha(Color lightColor)
{
return new Color(0, 100, 0, 0);
Vector3 colorOne = new Vector3(100f, 0f, 100f);
Vector3 colorTwo = new Vector3(67f, 133f, 0f);
Vector3 newLightColor = Vector3.Lerp(colorOne, colorTwo, Math.Abs(Projectile.ai[2]) / ColorAlternateTime);
return new Color((int)newLightColor.X, (int)newLightColor.Y, (int)newLightColor.Z, 0);
}
public override bool OnTileCollide(Vector2 oldVelocity)
@@ -57,36 +130,48 @@ namespace CalamityMod.Projectiles.Melee
else
{
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = -oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = -oldVelocity.Y;
}
Projectile.velocity *= 0.5f;
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
}
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 90);
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Venom, 60);
Projectile.velocity *= 0.5f;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
int inc;
for (int i = 4; i < 31; i = inc + 1)
for (int i = 4; i < 31; i++)
{
float oldXVel = Projectile.oldVelocity.X * (30f / (float)i);
float oldYVel = Projectile.oldVelocity.Y * (30f / (float)i);
int causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, DustID.JungleSpore, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f);
Main.dust[causticDust].noGravity = true;
Dust dust = Main.dust[causticDust];
dust.velocity *= 0.5f;
causticDust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel, Projectile.oldPosition.Y - oldYVel), 8, 8, DustID.JungleSpore, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f);
dust = Main.dust[causticDust];
dust.velocity *= 0.05f;
inc = i;
float dustScale = 1.8f * Projectile.scale;
int dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom;
int dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
//Main.dust[dust].velocity *= 0.5f;
if (dustType == DustID.Venom)
Main.dust[dust].fadeIn = 1.5f;
dustScale = 1.4f * Projectile.scale;
dustType = Main.rand.NextBool() ? DustID.GreenFairy : DustID.Venom;
dust = Dust.NewDust(new Vector2(Projectile.oldPosition.X - oldXVel * 0.5f, Projectile.oldPosition.Y - oldYVel * 0.5f), 8, 8, dustType, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, dustScale);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 0.1f;
if (dustType == DustID.Venom)
Main.dust[dust].fadeIn = 1.5f;
}
}
}