Goldie tweaks + Statigel slimes

This commit is contained in:
Altixal committed 2023-02-02 07:45:15 +07:00
1 parent 2ce070ad00
commit 30422bb210
5 files changed
+64 -29

No files matched your search

+2 -5
View File
@@ -1,5 +1,6 @@
using Terraria.DataStructures;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Typeless;
using CalamityMod.Tiles.Furniture.CraftingStations;
using Microsoft.Xna.Framework;
using Terraria;
@@ -55,13 +56,9 @@ namespace CalamityMod.Items.Weapons.Ranged
{
offset -= velocity;
}
int index = Projectile.NewProjectile(spawnSource, source + offset, velocity * 0.6f, ProjectileID.SlimeGun, damage / 4, 0f, player.whoAmI);
int index = Projectile.NewProjectile(spawnSource, source + offset, velocity * 0.6f, ModContent.ProjectileType<SlimeStream>(), damage / 4, 0f, player.whoAmI, i);
if (index.WithinBounds(Main.maxProjectiles))
{
Main.projectile[index].DamageType = DamageClass.Ranged;
Main.projectile[index].usesLocalNPCImmunity = true;
Main.projectile[index].localNPCHitCooldown = 10;
}
}
return true;
}
+3 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
@@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos
public override void AI()
{
CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 30f, 5, ProjectileID.SlimeGun, 0.75);
CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, 30f, 5, ModContent.ProjectileType<SlimeStream>(), 0.75);
if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks
Projectile.Kill();
}
+22 -17
View File
@@ -12,8 +12,9 @@ namespace CalamityMod.Projectiles.Pets
public Player Owner => Main.player[Projectile.owner];
public ref float MovementTimer => ref Projectile.ai[0];
public ref float ShineLevel => ref Projectile.ai[1];
public float MaxShineTime = 30f;
public ref float SparkleTimer => ref Projectile.ai[1];
public float MaxBloomTime = 30f;
public float MaxSparkleTime = 150f;
public static Color GoldColor = Color.Goldenrod;
public override void SetStaticDefaults()
@@ -43,10 +44,10 @@ namespace CalamityMod.Projectiles.Pets
Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Projectile.type];
Lighting.AddLight(Projectile.Center, GoldColor.ToVector3() * 0.9f);
if (ShineLevel < MaxShineTime)
ShineLevel++;
else if (ShineLevel > MaxShineTime)
ShineLevel--;
if (SparkleTimer < MaxBloomTime)
SparkleTimer++;
else if (SparkleTimer > MaxBloomTime)
SparkleTimer--;
if (Main.rand.NextBool(6))
Dust.QuickDust(Projectile.Center, GoldColor);
@@ -73,8 +74,8 @@ namespace CalamityMod.Projectiles.Pets
NetMessage.SendData(MessageID.SyncItem, -1, -1, null, itemIndex, 0f, 0f, 0f, 0, 0, 0);
}
//Big shine boost on collect
ShineLevel += 30f;
//Max sparkle on collect
SparkleTimer = MaxSparkleTime;
}
//Otherwise, start chasing
if (distanceToPotential < itemDist && itemDist < range)
@@ -100,7 +101,7 @@ namespace CalamityMod.Projectiles.Pets
else if (MovementTimer == -1f)
{
Vector2 restingSpot = Owner.Center + Vector2.UnitY * -80f;
Projectile.velocity = (restingSpot - Projectile.Center) / 10f;
Projectile.velocity = (restingSpot - Projectile.Center) / 15f;
Projectile.rotation = Projectile.velocity.X * 0.05f;
//Start spinning again when rested
@@ -114,6 +115,9 @@ namespace CalamityMod.Projectiles.Pets
Projectile.rotation = playerDist.ToRotation() - MathHelper.PiOver2;
Projectile.Center = Owner.Center + Vector2.UnitY.RotatedBy(MovementTimer) * -80f;
MovementTimer += MathHelper.ToRadians(4f);
if (Main.rand.NextBool(150) && SparkleTimer <= MaxBloomTime)
SparkleTimer = MaxSparkleTime * 0.6f; //Slight sparkle randomly
}
}
@@ -138,19 +142,20 @@ namespace CalamityMod.Projectiles.Pets
{
//Similar coin shining to Midas Prime coins. Thought it'd look pretty neat for a light pet.
Texture2D shineTex = ModContent.Request<Texture2D>("CalamityMod/Particles/Sparkle").Value;
float shinePercent = Utils.SmoothStep(MaxBloomTime, MaxSparkleTime, SparkleTimer);
float shineScale = (float)Math.Log10(shinePercent + 0.01) + 2f;
Texture2D bloomTex = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
float bloomPercent = Math.Clamp(SparkleTimer / MaxBloomTime, 0f, 5f); //Max of 500% when collecting coins
float bloomScale = Math.Clamp(bloomPercent, 0f, 2.5f);
float shinePercent = Math.Clamp(ShineLevel / MaxShineTime, 0f, 3f); //Max of 300% when collecting coins
Vector2 shineScale = new Vector2(1f, 3f - shinePercent * 2f);
Color shineColor = GoldColor;
if (shinePercent > 0f)
if (bloomPercent > 0f)
{
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, shineColor * shinePercent * 0.15f, Projectile.rotation, bloomTex.Size() / 2f, shineScale * Projectile.scale * 0.6f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * shinePercent * 0.6f, Projectile.rotation, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0);
Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, GoldColor * bloomPercent * 0.2f, Projectile.rotation, bloomTex.Size() / 2f, bloomPercent * Projectile.scale * 0.3f, SpriteEffects.None, 0);
Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, GoldColor * shinePercent, Projectile.rotation, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0);
Main.spriteBatch.End();
Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix);
+2 -5
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Weapons.Rogue;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
@@ -37,13 +38,9 @@ namespace CalamityMod.Projectiles.Rogue
if (Projectile.timeLeft % 8 == 0)
{
Vector2 velocity = new Vector2(Main.rand.NextFloat(-7f, 7f), Main.rand.NextFloat(-7f, 7f));
int slime = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ProjectileID.SlimeGun, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner);
int slime = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<SlimeStream>(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, Main.rand.Next(2), 1f);
if (slime.WithinBounds(Main.maxProjectiles))
{
Main.projectile[slime].DamageType = RogueDamageClass.Instance;
Main.projectile[slime].usesLocalNPCImmunity = true;
Main.projectile[slime].localNPCHitCooldown = 10;
}
}
}
}
+35
View File
@@ -0,0 +1,35 @@
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Typeless
{
public class SlimeStream : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Silme Stream");
}
public override void SetDefaults()
{
Projectile.width = Projectile.height = 10;
Projectile.friendly = true;
Projectile.timeLeft = 90;
Projectile.MaxUpdates = 3;
}
public override void AI()
{
Dust.QuickDust(Projectile.Center, Projectile.ai[0] > 0f ? Color.Magenta : Color.RoyalBlue);
if (Projectile.ai[1] > 0f && Projectile.timeLeft < 60)
CalamityUtils.HomeInOnNPC(Projectile, false, 320f, 12f, 20f);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) => target.AddBuff(BuffID.Slimed, 600);
}
}