divine ret & blazing core starting

This commit is contained in:
Altixal committed 2024-09-28 21:04:17 +07:00
1 parent b73fa70706
commit 4893d7d3fa
12 files changed
+207 -312

No files matched your search

+1 -1
View File
@@ -80,7 +80,7 @@ namespace CalamityMod.Items.Accessories
spinningPoint *= 1.5f;
dmgAmt = (int)player.GetBestClassDamage().ApplyTo(dmgAmt);
dmgAmt = player.ApplyArmorAccDamageBonusesTo(dmgAmt);
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, vector2, projectileType, dmgAmt, 0f, Main.myPlayer);
Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, vector2, projectileType, dmgAmt, 0f, Main.myPlayer, player.Calamity().blazingCoreSuccessfulParry);
}
}
offset += 10f;
+8 -43
View File
@@ -1,5 +1,4 @@
using System;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Materials;
using CalamityMod.Projectiles.Magic;
using CalamityMod.Rarities;
using Microsoft.Xna.Framework;
@@ -37,54 +36,20 @@ namespace CalamityMod.Items.Weapons.Magic
Item.UseSound = SoundID.Item73;
Item.autoReuse = true;
Item.shootSpeed = 19f;
Item.shootSpeed = 25f;
Item.shoot = ModContent.ProjectileType<DivineRetributionSpear>();
}
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
float spearSpeed = Item.shootSpeed;
Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true);
float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X;
float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y;
if (player.gravDir == -1f)
// 5 projectiles total
for (int i = -2; i < 3; i++)
{
mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y;
}
float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f))
{
mouseXDist = (float)player.direction;
}
else
{
mouseDistance = spearSpeed / mouseDistance;
}
int numProjectiles = 5;
for (int i = 0; i < numProjectiles; i++)
{
realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(51) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - /* - */ player.position.X), player.MountedCenter.Y + 600f); //-
realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-50, 51); //200
realPlayerPos.Y += (float)(100 * i); //-=
mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; //+ -
mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; //+ -
if (mouseYDist < 0f)
{
mouseYDist *= -1f;
}
if (mouseYDist < 20f)
{
mouseYDist = 20f;
}
mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist));
mouseDistance = spearSpeed / mouseDistance;
mouseXDist *= mouseDistance;
mouseYDist *= mouseDistance;
float speedX6 = mouseXDist + (float)Main.rand.Next(-60, 61) * 0.02f;
float speedY7 = mouseYDist + (float)Main.rand.Next(-60, 61) * 0.02f;
float ai1 = Main.rand.NextFloat() + 0.5f;
Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX6, -speedY7, type, damage, knockback, player.whoAmI, 0.0f, ai1);
Vector2 newPos = new Vector2(Main.MouseWorld.X + Main.rand.NextFloat(8f, 64f) * i, player.MountedCenter.Y + Main.rand.NextFloat(640f, 800f));
Vector2 newVel = (Main.MouseWorld + Main.rand.NextVector2CircularEdge(4f, 4f) - newPos).SafeNormalize(Vector2.Zero) * velocity.Length() * Main.rand.NextFloat(1f, 1.25f);
float velScale = 1f + Main.rand.NextFloat(0.02f, 0.08f) * i;
Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, velScale);
}
return false;
}
@@ -720,13 +720,13 @@ Hellkite: {
HolyCollider: {
DisplayName: Holy Collider
Tooltip:
'''
Swings a massive holy sword that can be charged for higher damage
Charged swings create four holy flares that float around the point of impact
Flares can be stuck by the blade and will gain increased liftime from uncharged hits
Charged swings can empower flares, turning them into massive fireballs on hit and launching them to your cursor
Holding <right> while swinging will do repeated uncharged slashes that create spreads of flame on hit
'''
'''
Swings a massive holy sword that can be charged for higher damage
Charged swings create four holy flares that float around the point of impact
Flares can be stuck by the blade and will gain increased liftime from uncharged hits
Charged swings can empower flares, turning them into massive fireballs on hit and launching them to your cursor
Holding <right> while swinging will do repeated uncharged slashes that create spreads of flame on hit
'''
}
IllustriousKnives: {
@@ -69,7 +69,6 @@ FoveanatorLaser.DisplayName: Nebulous Laser
FrostMist.DisplayName: Frost Mist
GooglyEye.DisplayName: Googly Eye
GreatSandBlast.DisplayName: Great Sand Blast
HealOrbProv.DisplayName: Heal
HellfireExplosion.DisplayName: Brimstone Hellfire Explosion
HiveBombGoliath.DisplayName: Hive Bomb
HolyAura.DisplayName: Holy Aura
-73
View File
@@ -1,73 +0,0 @@
using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Boss
{
public class HealOrbProv : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Boss";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 4;
Projectile.height = 4;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.tileCollide = false;
Projectile.timeLeft = 300;
Projectile.extraUpdates = 3;
}
public override void AI()
{
int playerTracker = (int)Projectile.ai[0];
Vector2 projDirection = Projectile.Center;
float playerDistX = Main.player[playerTracker].Center.X - projDirection.X;
float playerDistY = Main.player[playerTracker].Center.Y - projDirection.Y;
float playerDistance = (float)Math.Sqrt((double)(playerDistX * playerDistX + playerDistY * playerDistY));
if (playerDistance < 50f && Projectile.position.X < Main.player[playerTracker].position.X + (float)Main.player[playerTracker].width && Projectile.position.X + (float)Projectile.width > Main.player[playerTracker].position.X && Projectile.position.Y < Main.player[playerTracker].position.Y + (float)Main.player[playerTracker].height && Projectile.position.Y + (float)Projectile.height > Main.player[playerTracker].position.Y)
{
if (Projectile.owner == Main.myPlayer)
{
int healAmount = (int)Projectile.ai[1];
Main.player[playerTracker].HealEffect(healAmount, false);
Main.player[playerTracker].statLife += healAmount;
if (Main.player[playerTracker].statLife > Main.player[playerTracker].statLifeMax2)
{
Main.player[playerTracker].statLife = Main.player[playerTracker].statLifeMax2;
}
// TODO -- but why
if (Main.player[playerTracker].statLife < 0)
{
Main.player[playerTracker].KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProvidenceAntiHealing").Format(Main.player[playerTracker].name)), 1000.0, 0, false);
}
NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, playerTracker, (float)healAmount, 0f, 0f, 0, 0, 0);
}
Projectile.Kill();
}
playerDistance = 2.5f / playerDistance;
playerDistX *= playerDistance;
playerDistY *= playerDistance;
Projectile.velocity.X = (Projectile.velocity.X * 15f + playerDistX) / 16f;
Projectile.velocity.Y = (Projectile.velocity.Y * 15f + playerDistY) / 16f;
for (int i = 0; i < 1; i++)
{
float shortXVel = Projectile.velocity.X * 0.2f * (float)i;
float shortYVel = -(Projectile.velocity.Y * 0.2f) * (float)i;
int holyFire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 1f);
Main.dust[holyFire].noGravity = true;
Main.dust[holyFire].velocity *= 0f;
Dust expr_154F9_cp_0 = Main.dust[holyFire];
expr_154F9_cp_0.position.X -= shortXVel;
Dust expr_15518_cp_0 = Main.dust[holyFire];
expr_15518_cp_0.position.Y -= shortYVel;
}
return;
}
}
}
+1 -4
View File
@@ -77,17 +77,14 @@ namespace CalamityMod.Projectiles.Boss
Projectile.localAI[1] += (Projectile.velocity.Length() / 20);
Color col = ProvUtils.GetProjectileColor(255);
float vel = MathHelper.Clamp(Projectile.velocity.Length() / 5, 0, 1.5f);
GlowOrbParticle p = new GlowOrbParticle(Projectile.Center, Projectile.velocity + new Vector2(Main.rand.NextFloat(vel * 2), 0).RotatedByRandom(MathHelper.TwoPi), false, 4, 1f, col);
GeneralParticleHandler.SpawnParticle(p);
}
public override bool PreDraw(ref Color lightColor)
{
float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f)));
float lerpMult = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
+2 -1
View File
@@ -56,7 +56,8 @@ namespace CalamityMod.Projectiles.Boss
int playerTracker = Player.FindClosest(Projectile.Center, 1, 1);
if (Projectile.ai[1] == 0f)
// Natural damage is removed from GFB
if (Projectile.ai[1] == 0f && !Main.zenithWorld)
Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType<Providence>());
Projectile.ai[1] += 1f;
+3 -5
View File
@@ -78,8 +78,6 @@ namespace CalamityMod.Projectiles.Boss
}
Color col = new Color(54, 209, 54);
Particle spark = new GlowSparkParticle(Projectile.Center, -Projectile.velocity * 0.8f, false, 5, 0.06f, col * 0.85f, new Vector2(1, 0.3f), true, false, 1.5f);
GeneralParticleHandler.SpawnParticle(spark);
}
@@ -94,7 +92,7 @@ namespace CalamityMod.Projectiles.Boss
Vector2 projDirection = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Vector2 halfTextureSize = drawTexture.Size() / 2f;
Color halfBrightGreen = brightGreen * 0.5f;
float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs((float)Math.Sin(Projectile.localAI[1] / 10f)));
float timeLeftColorScale = MathHelper.Lerp(0.5f, 1.5f, Math.Abs(MathF.Sin(Projectile.localAI[1] / 10f)));
Projectile.rotation += MathHelper.ToRadians(timeLeftColorScale * 2f);
Vector2 timeLeftDrawEffect = new Vector2(0.5f, 1f) * timeLeftColorScale;
Vector2 timeLeftDrawEffect2 = new Vector2(0.5f, 1f) * timeLeftColorScale;
@@ -107,9 +105,9 @@ namespace CalamityMod.Projectiles.Boss
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, (float)Math.PI / 2f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, (float)Math.PI / 2f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, MathHelper.PiOver2 - Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, halfBrightGreen, 0f - Projectile.rotation, halfTextureSize, timeLeftDrawEffect2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(drawTexture, position3, null, brightGreen, MathHelper.PiOver4 + Projectile.rotation, halfTextureSize, timeLeftDrawEffect * 0.6f, spriteEffects, 0);
+85 -48
View File
@@ -1,8 +1,11 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.ID;
using Terraria.ModLoader;
@@ -11,67 +14,109 @@ namespace CalamityMod.Projectiles.Magic
public class DivineRetributionSpear : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public Player Owner => Main.player[Projectile.owner];
public ref float VelocityScale => ref Projectile.ai[0];
public ref float Time => ref Projectile.ai[1];
public static float HomingSpeed => 20f;
public static float HomingTime => 15f;
public static float ReturnTime => 75f;
public override void SetStaticDefaults()
{
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 7;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 30;
Projectile.height = 30;
Projectile.width = Projectile.height = 30;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Magic;
Projectile.extraUpdates = 1;
Projectile.penetrate = 1;
Projectile.timeLeft = 420;
Projectile.timeLeft = 210;
}
public override void AI()
{
float aiVelocityMult = 25f * Projectile.ai[1]; //100
float scaleFactor = 5f * Projectile.ai[1]; //5
float homingRange = 1000f;
Projectile.rotation = Projectile.velocity.ToRotation();
if (Projectile.velocity.X < 0f)
Time++;
Projectile.Opacity = Utils.GetLerpValue(0f, 18f, Projectile.timeLeft, true);
Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.7f * Projectile.Opacity);
if (Time % 2f == 1f)
{
Projectile.spriteDirection = -1;
Projectile.rotation = (float)Math.Atan2((double)-(double)Projectile.velocity.Y, (double)-(double)Projectile.velocity.X);
}
else
{
Projectile.spriteDirection = 1;
Projectile.rotation = Projectile.velocity.ToRotation();
Vector2 dustOffset = (Vector2.UnitY * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.05f) * 16f).RotatedBy(Projectile.velocity.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.Center + dustOffset, ModContent.DustType<LightDust>());
dust.noGravity = true;
dust.noLightEmittence = true;
dust.color = Color.Gold;
dust.scale = Main.rand.NextFloat(0.4f, 0.6f);
}
Lighting.AddLight(Projectile.Center, 0.7f, 0.3f, 0f);
if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead)
NPC potentialTarget = Projectile.Center.ClosestNPCAt(Time >= ReturnTime ? 480f : 320f);
if (potentialTarget != null && Time >= HomingTime)
{
if (Projectile.Distance(Main.player[Projectile.owner].Center) > homingRange)
Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * HomingSpeed * VelocityScale;
Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f;
Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f);
return;
}
else if (Owner.active && !Owner.dead && Time >= ReturnTime)
{
Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * HomingSpeed * VelocityScale * (1.2f - Utils.GetLerpValue(800f, 160f, Vector2.Distance(Projectile.Center, Owner.MountedCenter), true));
Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f;
Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f);
}
if (!Owner.active || Owner.dead || (Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 240f && Time >= ReturnTime))
{
Projectile.timeLeft--;
if (!Owner.active || Owner.dead || Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 80f)
{
Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY);
Projectile.velocity = (Projectile.velocity * (aiVelocityMult - 1f) + moveDirection * scaleFactor) / aiVelocityMult;
return;
}
CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 9f, 20f);
}
else
{
if (Projectile.timeLeft > 30)
{
Projectile.timeLeft = 30;
if (Projectile.timeLeft > 30)
Projectile.timeLeft = 30;
}
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
Texture2D spear = TextureAssets.Projectile[Type].Value;
Vector2 drawPos = Projectile.Center - Main.screenPosition;
Color baseColor = Color.Gold * Projectile.Opacity;
Color glowColor = new Color(255, 255, 150) * Projectile.Opacity;
float squish = MathHelper.Clamp(Projectile.velocity.Length() * 0.04f, 0, 0.2f);
Vector2 scale = new Vector2(1f + squish, 1f - squish);
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
if (CalamityClientConfig.Instance.Afterimages)
{
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float completionRatio = i / (float)Projectile.oldPos.Length;
Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition;
Color trailColor = Color.Lerp(glowColor, Color.Black, completionRatio) * 0.35f;
Vector2 trailScale = scale * MathHelper.Lerp(1f, 0.15f, completionRatio);
Main.EntitySpriteDraw(spear, trailPos, null, trailColor, Projectile.oldRot[i], spear.Size() * 0.5f, trailScale, SpriteEffects.None);
}
}
for (int i = 0; i < 8; i++)
{
Vector2 offset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f;
Main.EntitySpriteDraw(spear, drawPos + offset, null, Color.Lerp(baseColor, glowColor, 0.8f) * 0.5f, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None);
}
Main.spriteBatch.ExitShaderRegion();
Main.EntitySpriteDraw(spear, drawPos, null, baseColor, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None);
return false;
}
@@ -81,28 +126,20 @@ namespace CalamityMod.Projectiles.Magic
public override void OnKill(int timeLeft)
{
Projectile.position = Projectile.Center;
Projectile.width = Projectile.height = 96;
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
Projectile.ExpandHitboxBy(96);
Projectile.maxPenetrate = -1;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Damage();
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
for (int i = 0; i < 6; i++)
for (int i = 0; i < 9; i++)
{
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0);
}
for (int j = 0; j < 10; j++)
{
int divinity = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0);
Main.dust[divinity].noGravity = true;
Main.dust[divinity].velocity *= 3f;
divinity = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0, 0);
Main.dust[divinity].velocity *= 2f;
Main.dust[divinity].noGravity = true;
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), Main.rand.NextVector2CircularEdge(5f, 5f));
dust.noGravity = true;
dust.noLightEmittence = true;
dust.color = Color.Gold;
dust.scale = Main.rand.NextFloat(0.8f, 1.4f);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 552 B

+53 -52
View File
@@ -1,8 +1,14 @@
using System;
using CalamityMod.Dusts;
using CalamityMod.Graphics.Primitives;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
@@ -11,8 +17,16 @@ namespace CalamityMod.Projectiles.Typeless
public class BlazingStarHeal : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Particles/Sparkle";
public override string Texture => "CalamityMod/Projectiles/StarProj";
public static Asset<Texture2D> Bloom;
public override void Load() => Bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 25;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
@@ -21,13 +35,17 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.alpha = 255;
Projectile.penetrate = 1;
Projectile.timeLeft = 200;
}
public override void AI()
{
if (Projectile.timeLeft == 200)
Projectile.rotation = Projectile.velocity.ToRotation();
Projectile.rotation += MathHelper.ToRadians(2f) * Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true);
if (Projectile.timeLeft % 4 == 0) //only once per 4 frames
Lighting.AddLight(Projectile.Center, 0f, 0.6f, 0f);
if (Projectile.timeLeft > 190)
@@ -57,67 +75,50 @@ namespace CalamityMod.Projectiles.Typeless
}
}
internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 16f;
internal Color ColorFunction(float completionRatio)
{
float hue = 0.35f + 0.1f * completionRatio * CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly * 0.25f) % 1f);
Color trailColor = Main.hslToRgb(hue, 0.6f, 0.5f);
return trailColor * Projectile.Opacity;
}
public override bool PreDraw(ref Color lightColor)
{
Texture2D starTexture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Color healGreen = new Color(54, 209, 54, 0);
Vector2 projPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color healGreenDraw = healGreen;
Vector2 colorSize = starTexture.Size() / 2f;
Color lesserHealGreen = healGreen * 0.5f;
float colorLerp = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f;
Vector2 scaledColorLerp1 = new Vector2(0.5f, 1f) * colorLerp;
Vector2 scaledColorLerp2 = new Vector2(0.5f, 1f) * colorLerp;
healGreenDraw *= colorLerp;
lesserHealGreen *= colorLerp;
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25);
Vector2 drawPos = projPos + Projectile.velocity.SafeNormalize(Vector2.Zero) * Utils.GetLerpValue(0.5f, 1f, Projectile.localAI[0] / 60f, clamped: true) * 0;
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
Texture2D sparkleTex = TextureAssets.Projectile[Type].Value;
Texture2D bloomTex = Bloom.Value;
float bloomScale = (float)sparkleTex.Height / (float)bloomTex.Height;
float sparkleScale = 0.7f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, (float)Math.PI / 2f, colorSize, scaledColorLerp1, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, 0f, colorSize, scaledColorLerp2, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, (float)Math.PI / 2f, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, 0f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, healGreenDraw, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4, colorSize, scaledColorLerp1 * 0.36f, spriteEffects, 0);
Main.EntitySpriteDraw(starTexture, drawPos, null, lesserHealGreen, MathHelper.PiOver4 * 3f, colorSize, scaledColorLerp2 * 0.36f, spriteEffects, 0);
Color color = ColorFunction(0f);
Vector2 drawPos = Projectile.Center - Main.screenPosition;
Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None);
Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), Projectile.rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None);
Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, Projectile.rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None);
Main.spriteBatch.ExitShaderRegion();
return false;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
Projectile.position.X = Projectile.position.X + (Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y + (Projectile.height / 2);
Projectile.width = 40;
Projectile.height = 40;
Projectile.position.X = Projectile.position.X - (Projectile.width / 2);
Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2);
for (int i = 0; i < 5; i++)
SoundEngine.PlaySound(SoundID.Item14 with { Pitch = -0.3f, Volume = 0.7f }, Projectile.Center);
SoundStyle fireHeal = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3);
SoundEngine.PlaySound(fireHeal with { Volume = 0.5f, Pitch = 0.3f }, Projectile.Center);
Particle pulse = new CustomPulse(Projectile.Center, Vector2.Zero, ColorFunction(0f), "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.032f, 18);
GeneralParticleHandler.SpawnParticle(pulse);
for (int i = 0; i < 15; i++)
{
int duster = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f);
Main.dust[duster].velocity *= 3f;
Main.dust[duster].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[duster].scale = 0.5f;
Main.dust[duster].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int j = 0; j < 8; j++)
{
int duster2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PlatinumCoin, 0f, 0f, 100, default, 3f);
Main.dust[duster2].noGravity = true;
Main.dust[duster2].velocity *= 5f;
duster2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GoldCoin, 0f, 0f, 100, default, 2f);
Main.dust[duster2].velocity *= 2f;
Main.dust[duster2].noGravity = true;
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), ((new Vector2(7, 7) * Projectile.scale).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.75f, 1.05f);
dust.color = ColorFunction(0f);
dust.noLightEmittence = true;
}
}
@@ -1,11 +1,15 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Graphics.Primitives;
using CalamityMod.NPCs.Providence;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.GameContent;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
@@ -14,7 +18,16 @@ namespace CalamityMod.Projectiles.Typeless
public class BlazingStarThatDoesNotHeal : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Typeless";
public override string Texture => "CalamityMod/Projectiles/StarProj";
public override string Texture => "CalamityMod/Particles/Sparkle";
public static Asset<Texture2D> Bloom;
public override void Load() => Bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 8;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
@@ -22,107 +35,64 @@ namespace CalamityMod.Projectiles.Typeless
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.alpha = 255;
Projectile.penetrate = 1;
Projectile.timeLeft = 200;
Projectile.timeLeft = 180;
}
public override void AI()
{
Projectile.rotation = Projectile.velocity.ToRotation();
if (Projectile.timeLeft % 4 == 0) //only once per 4 frames
Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f);
if (Projectile.ai[0] < 240f)
{
Projectile.ai[0] += 1f;
if (Projectile.velocity.Length() < 18f)
Projectile.velocity *= 1.015f;
}
if (Projectile.timeLeft < 160)
Projectile.timeLeft = 160;
}
if (Projectile.velocity.Length() < 16f)
Projectile.velocity *= 1.01f;
internal float WidthFunction(float completionRatio) => (1f - completionRatio) * Projectile.scale * 16f;
internal Color ColorFunction(float completionRatio)
{
float hue = 0.04f * (Projectile.ai[0] % 4f) + 0.1f * completionRatio * CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly * 0.25f) % 1f);
Color trailColor = Main.hslToRgb(hue, 0.8f, 0.6f);
return trailColor * Projectile.Opacity;
}
public override bool PreDraw(ref Color lightColor)
{
float lerpMult = Utils.GetLerpValue(15f, 30f, Projectile.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, Projectile.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 30f / 0.5f * (MathHelper.Pi * 2f) * 3f)) * 0.8f;
GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/FabstaffStreak"));
PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8);
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Vector2 drawPos = Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY);
Color baseColor = new Color(250, 100, 100, 255);
baseColor *= 0.5f;
baseColor.A = 0;
Color colorA = baseColor;
Color colorB = baseColor * 0.5f;
colorA *= lerpMult;
colorB *= lerpMult;
Vector2 origin = texture.Size() / 2f;
Vector2 scale = new Vector2(0.5f, 1.5f) * lerpMult;
Main.spriteBatch.EnterShaderRegion(BlendState.Additive);
Texture2D sparkleTex = TextureAssets.Projectile[Type].Value;
Texture2D bloomTex = Bloom.Value;
float bloomScale = (float)sparkleTex.Height / (float)bloomTex.Height;
float sparkleScale = 0.7f + CalamityUtils.Convert01To010((Main.GlobalTimeWrappedHourly % 2f) / 2f) * 0.2f;
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
float upRight = MathHelper.PiOver4;
float up = MathHelper.PiOver2;
float upLeft = 3f * MathHelper.PiOver4;
float left = MathHelper.Pi;
Main.EntitySpriteDraw(texture, drawPos, null, colorA, upLeft, origin, scale, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorA, upRight, origin, scale, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorB, upLeft, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorB, upRight, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorA, up, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorA, left, origin, scale * 0.6f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorB, up, origin, scale * 0.36f, spriteEffects, 0);
Main.EntitySpriteDraw(texture, drawPos, null, colorB, left, origin, scale * 0.36f, spriteEffects, 0);
Color color = ColorFunction(0f);
float rotation = Projectile.rotation + Main.GlobalTimeWrappedHourly * 8f;
Vector2 drawPos = Projectile.Center - Main.screenPosition;
Main.EntitySpriteDraw(bloomTex, drawPos, null, color * 0.5f, 0, bloomTex.Size() * 0.5f, 5f * bloomScale, SpriteEffects.None);
Main.EntitySpriteDraw(sparkleTex, drawPos, null, Color.Lerp(color, Color.White, 0.7f), rotation, sparkleTex.Size() * 0.5f, 2.2f * sparkleScale, SpriteEffects.None);
Main.EntitySpriteDraw(sparkleTex, drawPos, null, color, rotation + MathHelper.PiOver4, sparkleTex.Size() * 0.5f, 1.6f * sparkleScale, SpriteEffects.None);
Main.spriteBatch.ExitShaderRegion();
return false;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
Projectile.ExpandHitboxBy(50);
int dustType = (int)CalamityDusts.ProfanedFire;
for (int d = 0; d < 5; d++)
for (int i = 0; i < 15; i++)
{
int holy = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
Main.dust[holy].velocity *= 3f;
Main.dust[holy].noGravity = true;
if (Main.rand.NextBool())
{
Main.dust[holy].scale = 0.5f;
Main.dust[holy].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
}
}
for (int d = 0; d < 8; d++)
{
int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 3f);
Main.dust[fire].noGravity = true;
Main.dust[fire].velocity *= 5f;
fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 100, default, 2f);
Main.dust[fire].velocity *= 2f;
Main.dust[fire].noGravity = true;
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>(), ((new Vector2(7, 7) * Projectile.scale).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 1f)));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.75f, 1.05f);
dust.color = ColorFunction(0f);
dust.noLightEmittence = true;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 60 * 5);
Projectile.Kill();
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
// If the player is dodging, don't apply debuffs
if (target.creativeGodMode)
return;
target.AddBuff(ModContent.BuffType<HolyFlames>(), 60 * 5, false);
Projectile.Kill();
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<HolyFlames>(), 60 * 5);
}
}