changed some colors and added trail effects
No files matched your search
@@ -1,39 +1,49 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.Graphics;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
{
|
||||
public class MagicBullet : ModProjectile
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Ranged/BloodClotFriendly";
|
||||
public VertexStrip TrailDrawer;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Bullet");
|
||||
ProjectileID.Sets.MinionShot[Projectile.type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 4;
|
||||
Projectile.height = 4;
|
||||
Projectile.width = 6;
|
||||
Projectile.height = 6;
|
||||
Projectile.extraUpdates = 7;
|
||||
Projectile.light = 0.5f;
|
||||
Projectile.alpha = 255;
|
||||
Projectile.extraUpdates = 7;
|
||||
Projectile.scale = 1.18f;
|
||||
Projectile.friendly = true;
|
||||
Projectile.minion = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
AIType = ProjectileID.BulletHighVelocity;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.DamageType = DamageClass.Summon;
|
||||
Projectile.alpha = 255;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if (Projectile.ai[0]++ > 2f)
|
||||
Projectile.alpha = 0;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (!target.betsysCurse)
|
||||
@@ -56,11 +66,21 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
target.AddBuff(ModContent.BuffType<WhisperingDeath>(), 180);
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
return new Color(189, 51, 164, Projectile.alpha);
|
||||
}
|
||||
public override Color? GetAlpha(Color lightColor) => Color.White;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor) => Projectile.timeLeft < 600;
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle frame = texture.Frame(1, 1, 0, 0);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
|
||||
|
||||
// Draw the bullet.
|
||||
Main.spriteBatch.Draw(texture, drawPosition, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0);
|
||||
|
||||
// Draw Afterimages
|
||||
CalamityUtils.DrawAfterimagesFromEdge(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor);// , ModContent.Request<Texture2D>("CalamityMod/Projectiles/Summon/Umbrella/MagicBulletTrail").Value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 171 B |
|
After Width: | Height: | Size: 204 B |
@@ -1,7 +1,11 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -14,14 +18,16 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
public float PivotPointY = 0f;
|
||||
private int counter = 0;
|
||||
private const int projSize = 60;
|
||||
private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi;
|
||||
public static readonly SoundStyle StylishSound = new("CalamityMod/Sounds/Custom/Stylish");
|
||||
|
||||
public VertexStrip TrailDrawer;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Hammer");
|
||||
ProjectileID.Sets.MinionShot[Projectile.type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -134,12 +140,12 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
playerVec.Normalize();
|
||||
playerVec *= playerHomeSpeed;
|
||||
Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Center = returnPos;
|
||||
Projectile.rotation = Projectile.ai[0] + MathHelper.PiOver4;
|
||||
Projectile.rotation = Projectile.ai[0] + drawOffset;
|
||||
}
|
||||
if (Projectile.scale != 1f)
|
||||
{
|
||||
@@ -150,6 +156,9 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
|
||||
private void MoveToEnemy(int targetIndex)
|
||||
{
|
||||
if (Behavior == 0f)
|
||||
Behavior = 1f;
|
||||
|
||||
// Target distance calculations
|
||||
NPC npc = Main.npc[targetIndex];
|
||||
Vector2 targetVec = npc.Center - Projectile.Center;
|
||||
@@ -157,49 +166,49 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
|
||||
float moveSpeed = 40f;
|
||||
// If more than 60 pixels away, move toward the target
|
||||
if (targetDist > 60f && Behavior == 0f)
|
||||
if (targetDist > 60f && Behavior == 1f)
|
||||
{
|
||||
targetVec.Normalize();
|
||||
targetVec *= moveSpeed;
|
||||
Projectile.velocity = (Projectile.velocity * 1f + targetVec) / 2f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Behavior == 0f)
|
||||
if (Behavior == 1f)
|
||||
{
|
||||
if (Projectile.scale == 1f)
|
||||
{
|
||||
Projectile.scale = 3f;
|
||||
Projectile.ExpandHitboxBy(Projectile.scale);
|
||||
}
|
||||
Projectile.rotation = MathHelper.PiOver4 + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 1f : -6f);
|
||||
Projectile.ai[1] = MathHelper.PiOver4 + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 5f : -1f);
|
||||
Projectile.rotation = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f);
|
||||
Projectile.ai[1] = drawOffset + MathHelper.ToRadians(20f) * (targetVec.X > 0 ? 3f : -3f);
|
||||
PivotPointX = Projectile.Bottom.X;
|
||||
PivotPointY = Projectile.Bottom.Y;
|
||||
Behavior = 1f;
|
||||
Behavior = 2f;
|
||||
}
|
||||
if (Behavior == 1f)
|
||||
if (Behavior == 2f)
|
||||
{
|
||||
Behavior = targetVec.X > 0 ? 2f : 3f;
|
||||
Behavior = targetVec.X > 0 ? 3f : 4f;
|
||||
}
|
||||
if (Behavior == 2f || Behavior == 3f)
|
||||
if (Behavior == 3f || Behavior == 4f)
|
||||
{
|
||||
float swingTime = 20f;
|
||||
Projectile.ai[1] += MathHelper.ToRadians(200f / swingTime) * (Behavior == 2f ? 1f : -1f);
|
||||
Projectile.ai[1] += MathHelper.ToRadians(200f / swingTime) * (Behavior == 3f ? 1f : -1f);
|
||||
counter++;
|
||||
float outwardPosition = 50f;
|
||||
Vector2 pivot = new Vector2(PivotPointX, PivotPointY);
|
||||
Projectile.Center = pivot + Projectile.ai[1].ToRotationVector2() * outwardPosition;
|
||||
Projectile.rotation = Projectile.ai[1] + MathHelper.PiOver4;
|
||||
Projectile.rotation = Projectile.ai[1] + drawOffset;
|
||||
if (counter > swingTime)
|
||||
{
|
||||
Projectile.ai[1] = MathHelper.PiOver4;
|
||||
counter = 0;
|
||||
Behavior = 4f;
|
||||
Behavior = 5f;
|
||||
}
|
||||
}
|
||||
if (Behavior == 4f)
|
||||
if (Behavior == 5f)
|
||||
MoveBackToPlayer();
|
||||
}
|
||||
}
|
||||
@@ -222,7 +231,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
playerVec.Normalize();
|
||||
playerVec *= playerHomeSpeed;
|
||||
Projectile.velocity = (Projectile.velocity * 1f + playerVec) / 2f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -237,7 +246,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if ((Behavior == 2f || Behavior == 3f) && Main.rand.NextBool(10))
|
||||
if ((Behavior == 3f || Behavior == 4f) && Main.rand.NextBool(10))
|
||||
{
|
||||
Rectangle location = new Rectangle((int)target.position.X, (int)target.position.Y, target.width, target.height);
|
||||
CombatText.NewText(location, new Color(239, 113, 152), "Stylish!", true);
|
||||
@@ -267,13 +276,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(255, 56, 0, Projectile.alpha);
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha);
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
@@ -284,5 +287,38 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Color TrailColorFunction(float completionRatio)
|
||||
{
|
||||
float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f;
|
||||
return new Color(255, 56, 0) * opacity;
|
||||
}
|
||||
|
||||
public float TrailWidthFunction(float completionRatio) => 2f;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
|
||||
SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
bool shouldDrawTrail = Behavior != 0f;
|
||||
if (shouldDrawTrail)
|
||||
{
|
||||
// Draw the afterimage trail.
|
||||
TrailDrawer ??= new();
|
||||
GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f));
|
||||
GameShaders.Misc["EmpressBlade"].Apply(null);
|
||||
TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true);
|
||||
TrailDrawer.DrawTrail();
|
||||
Main.pixelShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
// Draw the hammer.
|
||||
Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 367 B |
@@ -1,6 +1,7 @@
|
||||
using CalamityMod.Buffs.Summon;
|
||||
using CalamityMod.CalPlayer;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
@@ -60,19 +61,20 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
|
||||
if (Projectile.ai[0] == 1f)
|
||||
{
|
||||
List<int> Projectiles = new List<int>()
|
||||
List<Tuple<int, float>> Projectiles = new List<Tuple<int, float>>()
|
||||
{
|
||||
ModContent.ProjectileType<MagicRifle>(),
|
||||
ModContent.ProjectileType<MagicUmbrella>(),
|
||||
ModContent.ProjectileType<MagicHammer>(),
|
||||
new Tuple<int, float>(ModContent.ProjectileType<MagicRifle>(), 1f),
|
||||
new Tuple<int, float>(ModContent.ProjectileType<MagicUmbrella>(), 1f),
|
||||
new Tuple<int, float>(ModContent.ProjectileType<MagicHammer>(), 3f),
|
||||
};
|
||||
float angleVariance = MathHelper.TwoPi / Projectiles.Count;
|
||||
float angle = 0f;
|
||||
foreach (int projType in Projectiles)
|
||||
for (int i = 0; i < Projectiles.Count; i++)
|
||||
{
|
||||
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, angle);
|
||||
int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, Projectiles[i].Item1,(int)(Projectile.damage * Projectiles[i].Item2),
|
||||
Projectile.knockBack * Projectiles[i].Item2, Projectile.owner, angle);
|
||||
if (Main.projectile.IndexInRange(p))
|
||||
Main.projectile[p].originalDamage = Projectile.originalDamage;
|
||||
Main.projectile[p].originalDamage = (int)(Projectile.originalDamage * Projectiles[i].Item2);
|
||||
angle += angleVariance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
|
||||
namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
{
|
||||
@@ -11,13 +11,12 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Rifle");
|
||||
ProjectileID.Sets.MinionShot[Projectile.type] = true;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 30;
|
||||
Projectile.height = 30;
|
||||
Projectile.width = 50;
|
||||
Projectile.height = 50;
|
||||
Projectile.netImportant = true;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
@@ -91,6 +90,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.spriteDirection = Projectile.direction = 0;
|
||||
Projectile.rotation = Projectile.ai[0] + MathHelper.PiOver4;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(148, 0, 211, Projectile.alpha);
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha);
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 327 B |
@@ -1,8 +1,11 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Terraria;
|
||||
using Terraria.Graphics;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
@@ -11,12 +14,14 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
public class MagicUmbrella : ModProjectile
|
||||
{
|
||||
public float Behavior = 0f;
|
||||
private const float drawOffset = -MathHelper.PiOver4 + MathHelper.Pi;
|
||||
public VertexStrip TrailDrawer;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Umbrella");
|
||||
ProjectileID.Sets.MinionShot[Projectile.type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 40;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 4;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -48,7 +53,6 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.rotation += 0.075f;
|
||||
Projectile.alpha -= 50;
|
||||
|
||||
if (Main.player[Projectile.owner].Calamity().magicHat)
|
||||
@@ -64,10 +68,10 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
DelegateMethods.CastLightOpen(point.X, point.Y);
|
||||
|
||||
blackListedTargets.Clear();
|
||||
AI_156_Think(blackListedTargets);
|
||||
DecideWhatToDo(blackListedTargets);
|
||||
}
|
||||
|
||||
private void AI_156_Think(List<int> blacklist)
|
||||
private void DecideWhatToDo(List<int> blacklist)
|
||||
{
|
||||
int num = 40;
|
||||
int num2 = num - 1;
|
||||
@@ -186,8 +190,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
vector7 = vector7.RotatedBy(num19);
|
||||
float scaleFactor2 = (center2 - vector6).Length() / 2f;
|
||||
Vector2 vector9 = Projectile.Center = Vector2.Lerp(vector6, center2, 0.5f) + vector7 * scaleFactor2;
|
||||
float num22 = MathHelper.WrapAngle(num19 + num21 + 0f);
|
||||
Projectile.rotation = num22 + (float)Math.PI / 2f + MathHelper.PiOver4;
|
||||
float num22 = MathHelper.WrapAngle(num19 + num21);
|
||||
Projectile.rotation = num22 + drawOffset;
|
||||
Vector2 vector10 = Projectile.velocity = num22.ToRotationVector2() * 10f;
|
||||
Projectile.position -= Projectile.velocity;
|
||||
}
|
||||
@@ -201,8 +205,8 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
Vector2 value2 = npc.Center + value;
|
||||
float lerpValue3 = Utils.GetLerpValue(0.4f, 0.6f, lerpValue2, clamped: true);
|
||||
float lerpValue4 = Utils.GetLerpValue(0.6f, 1f, lerpValue2, clamped: true);
|
||||
float targetAngle = v.SafeNormalize(Vector2.Zero).ToRotation() + (float)Math.PI / 2f;
|
||||
Projectile.rotation = Projectile.rotation.AngleTowards(targetAngle, (float)Math.PI / 5f) + MathHelper.PiOver4;
|
||||
float targetAngle = v.SafeNormalize(Vector2.Zero).ToRotation() + drawOffset;
|
||||
Projectile.rotation = Projectile.rotation.AngleTowards(targetAngle, (float)Math.PI / 5f + drawOffset);
|
||||
Projectile.Center = Vector2.Lerp(vector11, npc.Center, lerpValue3);
|
||||
if (lerpValue4 > 0f)
|
||||
Projectile.Center = Vector2.Lerp(npc.Center, value2, lerpValue4);
|
||||
@@ -294,21 +298,16 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
playerVec.Normalize();
|
||||
playerVec *= playerHomeSpeed;
|
||||
Projectile.velocity = (Projectile.velocity * 10f + playerVec) / 11f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + drawOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.Center = returnPos;
|
||||
Projectile.rotation = Projectile.ai[0] + MathHelper.PiOver4;
|
||||
Projectile.rotation = Projectile.ai[0] + drawOffset;
|
||||
}
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(75, 255, 255, Projectile.alpha);
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
||||
return false;
|
||||
}
|
||||
public override Color? GetAlpha(Color lightColor) => new Color(255, 255, 255, Projectile.alpha);
|
||||
|
||||
public override void Kill(int timeLeft)
|
||||
{
|
||||
@@ -319,5 +318,38 @@ namespace CalamityMod.Projectiles.Summon.Umbrella
|
||||
Main.dust[dust].noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Color TrailColorFunction(float completionRatio)
|
||||
{
|
||||
float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f;
|
||||
return new Color(75, 255, 255) * opacity;
|
||||
}
|
||||
|
||||
public float TrailWidthFunction(float completionRatio) => 2f;
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame);
|
||||
Vector2 origin = frame.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
|
||||
SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
bool shouldDrawTrail = Behavior > 0f;
|
||||
if (shouldDrawTrail)
|
||||
{
|
||||
// Draw the afterimage trail.
|
||||
TrailDrawer ??= new();
|
||||
GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f));
|
||||
GameShaders.Misc["EmpressBlade"].Apply(null);
|
||||
TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true);
|
||||
TrailDrawer.DrawTrail();
|
||||
Main.pixelShader.CurrentTechnique.Passes[0].Apply();
|
||||
}
|
||||
|
||||
// Draw the umbrella.
|
||||
Main.spriteBatch.Draw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 333 B |