This commit is contained in:
Xyk authored and Cameron Ewell committed 2024-09-13 17:22:35 -04:00
1 parent 8900b4d710
commit a5dd5f6d5f
19 files changed
+474 -424

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class LightDust : ModDust
{
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
}
public override bool Update(Dust dust)
{
dust.rotation += MathF.Sign(dust.velocity.X);
dust.velocity *= 0.98f;
dust.scale += 0.02f;
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
if (!dust.noLightEmittence)
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
return true;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D rechargeTexture2 = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicCircle").Value;
if (!dust.noLight)
{
Texture2D rechargeTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle").Value;
// Glow Orb
Main.EntitySpriteDraw(rechargeTexture, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, rechargeTexture.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(rechargeTexture, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, rechargeTexture.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0);
}
Main.EntitySpriteDraw(rechargeTexture2, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, rechargeTexture2.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0);
return false;
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+1 -1
View File
@@ -56,7 +56,7 @@ namespace CalamityMod.Graphics.Metaballs
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles;
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles;
public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f);
+1 -1
View File
@@ -10,7 +10,7 @@ namespace CalamityMod.Items.Weapons.Melee
public class FallenPaladinsHammer : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public static float Speed = 28.8f;
public static float Speed = 27f;
public override void SetDefaults()
{
+2 -3
View File
@@ -14,15 +14,14 @@ namespace CalamityMod.Items.Weapons.Melee
public class GalaxySmasher : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public static int BaseDamage = 1300;
public static float Speed = 30f;
public static float Speed = 35f;
public override void SetDefaults()
{
Item.width = 86;
Item.height = 72;
Item.DamageType = DamageClass.MeleeNoSpeed;
Item.damage = BaseDamage;
Item.damage = 1300;
Item.knockBack = 14f;
Item.useAnimation = 40;
Item.useTime = 40;
+1 -1
View File
@@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee
Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice;
Item.rare = ItemRarityID.LightPurple;
Item.shoot = ModContent.ProjectileType<PwnagehammerProj>();
Item.shootSpeed = 29.4f;
Item.shootSpeed = 22f;
}
+1 -1
View File
@@ -9,7 +9,7 @@ namespace CalamityMod.Items.Weapons.Melee
public class StellarContempt : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
public static float Speed = 25f;
public static float Speed = 30f;
public override void SetDefaults()
{
Binary file not shown.

After

Width:  |  Height:  |  Size: 1004 KiB

+2
View File
@@ -38,6 +38,8 @@ namespace CalamityMod.Projectiles.Melee
Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type];
if (Projectile.frame >= 8)
Projectile.Kill();
Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2 * 1.5f;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
+39 -50
View File
@@ -1,5 +1,6 @@
using System;
using System.IO;
using CalamityMod.NPCs.Cryogen;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
@@ -15,6 +16,7 @@ namespace CalamityMod.Projectiles.Melee
public static readonly SoundStyle SlamHamSound = new("CalamityMod/Sounds/Item/FallenPaladinsHammerBigImpact") { Volume = 0.6f };
public static readonly SoundStyle Kunk = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f };
public float speed = 0f;
public NPC targeted;
public override void SetStaticDefaults()
{
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
@@ -23,8 +25,8 @@ namespace CalamityMod.Projectiles.Melee
}
public override void SetDefaults()
{
Projectile.width = 40;
Projectile.height = 40;
Projectile.width = 62;
Projectile.height = 62;
Projectile.aiStyle = 0;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
@@ -32,41 +34,44 @@ namespace CalamityMod.Projectiles.Melee
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 48, 48, 56);
}
public override void AI()
{
Projectile.ai[0] += 1f;
if (Projectile.ai[0] < 42f)
{
Projectile.velocity *= 0.95f;
Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0];
Projectile.rotation += (1f * Utils.GetLerpValue(30, 0, Projectile.ai[0]) * Projectile.direction);
}
else if (Projectile.ai[0] > 42f)
else if (Projectile.ai[0] >= 42f)
{
Projectile.extraUpdates = 1;
if (Projectile.ai[1] < 0f)
{
CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f);
if (Projectile.ai[0] > 80f)
Projectile.Kill();
return;
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 * 0.5f;
Projectile.extraUpdates = 4;
NPC target = Main.npc[(int)Projectile.ai[1]];
if (!target.CanBeChasedBy(Projectile, false) || !target.active)
Projectile.Kill();
else
targeted = Main.npc[(int)Projectile.ai[1]];
if (!targeted.CanBeChasedBy(Projectile, false) || !targeted.active || targeted == null)
targeted = Projectile.Center.ClosestNPCAt(2000);
if (targeted != null)
{
float velConst = 7f;
velConst--;
Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst);
Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0];
Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX);
if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25))
Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f);
else
Projectile.velocity *= 0.9f;
}
else
Projectile.Kill();
}
if (Projectile.ai[0] == 42f && targeted != null)
{
for (int i = 0; i < 20; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, ((targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX) * 15).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.5f, 1.2f);
dust.color = Main.rand.NextBool() ? Color.IndianRed : Color.Red;
}
}
@@ -74,16 +79,9 @@ namespace CalamityMod.Projectiles.Melee
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 267, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 0, new Color(255, 245, 198), 1f);
dust.noGravity = true;
dust.color = Color.DarkRed;
}
}
@@ -98,7 +96,8 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Projectile.localAI[0] = target.whoAmI;
if (target == targeted)
Projectile.Kill();
}
public override bool PreKill(int timeLeft)
@@ -112,27 +111,17 @@ namespace CalamityMod.Projectiles.Melee
SoundEngine.PlaySound(SlamHamSound, Projectile.Center);
Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 5;
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType<FallenBlast>(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.001f, ModContent.ProjectileType<FallenBlast>(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f);
return false;
}
public override bool PreDraw(ref Color lightColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height);
Vector2 origin = sourceRectangle.Size() / 2f;
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/FallenPaladinsHammer").Value;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.DarkRed with { A = 0 } * 0.5f, 1, texture, true, true);
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X);
Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY);
Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0);
}
Projectile.DrawProjectileWithBackglow(Color.Red with { A = 0 }, Color.Lerp(Color.Red, Color.White, 0.5f), 5f, texture);
return false;
}
}
+22 -23
View File
@@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Melee
public static readonly SoundStyle RedHamSound = new("CalamityMod/Sounds/Item/FallenPaladinsHammerClone") { Volume = 0.6f };
public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().PHAThammer;
public int returnhammer = 0;
public int time = 0;
public override void SetStaticDefaults()
{
@@ -49,8 +50,13 @@ namespace CalamityMod.Projectiles.Melee
if (returnhammer == 0)
{
Projectile.velocity.X *= 0.9711f;
Projectile.velocity.Y += 0.426f;
int falloffTime = 15;
if (time > falloffTime)
Projectile.velocity.X *= 0.967f;
if (Projectile.velocity.Y < 15 && time > falloffTime)
Projectile.velocity.Y += 0.426f;
if (Projectile.velocity.Y < 5)
Projectile.velocity.Y *= 0.98f;
}
if (returnhammer == 1)
@@ -64,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee
if (returnhammer == 2)
{
float returnSpeed = FallenPaladinsHammer.Speed;
float returnSpeed = FallenPaladinsHammer.Speed * 0.7f;
float acceleration = 1.1f;
Player owner = Main.player[Projectile.owner];
Vector2 playerCenter = owner.Center;
@@ -108,15 +114,15 @@ namespace CalamityMod.Projectiles.Melee
if (EmpoweredHammer == 3)
{
SoundEngine.PlaySound(RedHamSound, Projectile.Center);
for (int i = 0; i < 30; i++)
for (int i = 0; i < 20; i++)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 218);
Dust fire = Dust.NewDustPerfect(Projectile.Center, 90);
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer;
fire.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f;
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
@@ -131,15 +137,15 @@ namespace CalamityMod.Projectiles.Melee
else
{
SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center);
for (int i = 0; i < 30; i++)
for (int i = 0; i < 20; i++)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 218);
Dust fire = Dust.NewDustPerfect(Projectile.Center, 90);
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.1f);
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.5f, 1.5f) * EmpoweredHammer;
fire.scale = Main.rand.NextFloat(0.7f, 1.2f) + EmpoweredHammer * 0.4f;
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
@@ -157,17 +163,11 @@ namespace CalamityMod.Projectiles.Melee
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(205, 38, 38), 2f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.RedTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(205, 38, 38), 2f);
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 267, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 0, default, 0.7f);
dust.noGravity = true;
dust.color = Color.DarkRed;
}
time++;
}
// On hit play GONG and spawn dust.
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
@@ -201,12 +201,11 @@ namespace CalamityMod.Projectiles.Melee
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.9f);
if (Projectile.damage < 1)
Projectile.damage = 1;
float minMult = 0.7f;
int hitsToMinMult = 10;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
+10 -27
View File
@@ -1,5 +1,6 @@
using System;
using System.IO;
using CalamityMod.Graphics.Metaballs;
using CalamityMod.Particles;
using CalamityMod.Projectiles.DraedonsArsenal;
using Microsoft.Xna.Framework;
@@ -38,8 +39,6 @@ namespace CalamityMod.Projectiles.Melee
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
}
public override void AI()
{
Projectile.scale = 2.78f;
@@ -80,15 +79,6 @@ namespace CalamityMod.Projectiles.Melee
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 272, new Vector2(Projectile.velocity.X * 0.4f + velOffset.X, Projectile.velocity.Y * 0.4f + velOffset.Y), 100, default, 0.9f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, 226, new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y), 100, default, 0.9f);
dust.noGravity = true;
}
}
public override bool? CanHitNPC(NPC target)
@@ -97,28 +87,21 @@ namespace CalamityMod.Projectiles.Melee
return false;
return null;
}
public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Projectile.localAI[0] = target.whoAmI;
float damageInterpolant = Utils.GetLerpValue(950f, 2000f, hit.Damage, true);
float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant);
impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f);
Vector2 splatterDirection = Projectile.velocity;
for (int i = 0; i < 20; i++)
/*
for (int i = 0; i < 51; i++)
{
int sparkLifetime = Main.rand.Next(55, 70);
float sparkScale = Main.rand.NextFloat(0.7f, Main.rand.NextFloat(3.3f, 5.5f)) + damageInterpolant * 0.85f;
Color sparkColor = Color.Lerp(Color.Fuchsia, Color.Aqua, Main.rand.NextFloat(0.7f));
sparkColor = Color.Lerp(sparkColor, Color.Fuchsia, Main.rand.NextFloat());
Vector2 spawnPosition = target.Center + Main.rand.NextVector2Circular(60f, 60f);
StreamGougeMetaball.SpawnParticle(spawnPosition, Main.rand.NextVector2Circular(3f, 3f), 60f);
Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.7f) * Main.rand.NextFloat(1f, 1.2f);
sparkVelocity.Y -= 7f;
SparkParticle spark = new SparkParticle(Projectile.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor);
GeneralParticleHandler.SpawnParticle(spark);
float scale = MathHelper.Lerp(144f, 294f, CalamityUtils.Convert01To010(i / 49f));
spawnPosition = target.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(-40f, 90f, i / 49f);
Vector2 particleVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.23f) * Main.rand.NextFloat(8.5f, 15f);
StreamGougeMetaball.SpawnParticle(spawnPosition, particleVelocity, scale);
}
*/
}
public override bool PreKill(int timeLeft)
+153 -76
View File
@@ -1,9 +1,14 @@
using System;
using System.Collections.Generic;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Graphics.Metaballs;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using CalamityMod.Projectiles.Ranged;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
@@ -25,17 +30,19 @@ namespace CalamityMod.Projectiles.Melee
public float EchoHammerPrep = 0f;
public float WaitTimer = 0f;
public int InPulse = 0;
public int time = 0;
public Color usedColor = Color.Aqua;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 14;
ProjectileID.Sets.TrailingMode[Projectile.type] = 1;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20;
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
}
public override void SetDefaults()
{
Projectile.width = 62;
Projectile.height = 62;
Projectile.width = 86;
Projectile.height = 72;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.tileCollide = false;
@@ -50,44 +57,46 @@ namespace CalamityMod.Projectiles.Melee
{
//returnhammer determines if the hammer is slowing down after hitting an enemy, or homing in on the player.
Player player = Main.player[Projectile.owner];
Projectile.direction = Projectile.spriteDirection = Projectile.velocity.X > 0f ? 1 : -1;
Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction;
float targetDist = Vector2.Distance(player.Center, Projectile.Center);
Projectile.rotation += MathHelper.ToRadians(rotatehammer * 2) * Projectile.direction;
List<Color> eColors = new List<Color>()
{
Color.Aqua,
Color.Magenta,
};
float rate = (Main.GlobalTimeWrappedHourly * 12);
int colorIndex = (int)(rate / 2 % eColors.Count);
Color currentColor = eColors[colorIndex];
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
if (EmpoweredHammer >= 8)
EmpoweredHammer = 0;
if (returnhammer == 0)
{
Projectile.velocity.X *= 0.988f;
Projectile.velocity.Y += 0.326f;
int falloffTime = 10;
if (time > falloffTime)
Projectile.velocity.X *= 0.967f;
if (Projectile.velocity.Y < 25 && time > falloffTime)
Projectile.velocity.Y += 0.426f;
if (Projectile.velocity.Y < 5)
Projectile.velocity.Y *= 0.98f;
}
if (returnhammer == 1) //Hammer slows after the inital hit
{
if (EmpoweredHammer == 7)
{
++WaitTimer;
if (WaitTimer == 20f)
{
Projectile.velocity *= 0f;
EmpoweredHammer = 0;
returnhammer = 3;
}
}
else
{
Projectile.velocity.Y *= 0.926f;
Projectile.velocity.X *= 0.811f;
if (Projectile.velocity.X > -1.05f && Projectile.velocity.X < 1.05f & Projectile.velocity.Y > -1.05f && Projectile.velocity.Y < 1.05f)
returnhammer = 2;
}
Projectile.velocity.Y *= 0.926f;
Projectile.velocity.X *= 0.811f;
if (Projectile.velocity.X > -1.05f && Projectile.velocity.X < 1.05f & Projectile.velocity.Y > -1.05f && Projectile.velocity.Y < 1.05f)
returnhammer = 2;
}
if (returnhammer == 2) // Projectile returns to player
{
++PulseCooldown;
Projectile.extraUpdates = 2;
float returnSpeed = StellarContempt.Speed;
float returnSpeed = StellarContempt.Speed * 0.7f;
float acceleration = 1.1f;
Player owner = Main.player[Projectile.owner];
Vector2 playerCenter = owner.Center;
@@ -127,53 +136,85 @@ namespace CalamityMod.Projectiles.Melee
{
if (Projectile.Hitbox.Intersects(player.Hitbox))
{
EmpoweredHammer++;
SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center);
for (int i = 0; i < 30; i++)
Main.NewText(EmpoweredHammer);
if (EmpoweredHammer >= 6)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 181);
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
if (WaitTimer == 0)
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10;
++WaitTimer;
if (WaitTimer == 20f)
{
Projectile.velocity *= 0.001f;
EmpoweredHammer = 0;
WaitTimer = 0;
returnhammer = 3;
rotatehammer = 0;
}
}
else
{
EmpoweredHammer++;
SoundEngine.PlaySound(SoundID.DD2_BetsysWrathShot with { Volume = 0.4f }, Projectile.Center);
for (int i = 0; i < 30; i++)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 181);
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer;
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer;
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
}
Projectile.Kill();
}
Projectile.Kill();
}
}
}
if (returnhammer == 3) //Hammer prepares to spawn echo hammer, VibroIntensity
if (returnhammer == 3) //Hammer prepares to spawn echo hammer
{
if (InPulse == 0)
{
SoundEngine.PlaySound(RedHamSound, Projectile.Center);
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.95f, 120);
GeneralParticleHandler.SpawnParticle(pulse);
InPulse = 1;
}
rotatehammer -= 0.25f;
if (EchoHammerPrep >= 17f)
rotatehammer += 0.12f;
Projectile.Center += new Vector2(0, -3).RotatedBy(Projectile.rotation * 0.1f);
if (EchoHammerPrep >= 8f && InPulse < 2)
{
if (InPulse == 1)
if (time % 12 == 0)
{
Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.Orchid, new Vector2(1f, 1f), 0f, 4.9f, 0f, 25);
Particle pulse2 = new CustomPulse(Projectile.Center, Vector2.Zero, usedColor * 0.4f, "CalamityMod/Particles/HighResHollowCircleHardEdge", new Vector2(1f * Utils.GetLerpValue(4, 12, EchoHammerPrep), 1f * Utils.GetLerpValue(30, 8, EchoHammerPrep, true)), 0f, 2f, 0f, (int)(40 * Utils.GetLerpValue(35, 8, EchoHammerPrep, true)));
GeneralParticleHandler.SpawnParticle(pulse2);
InPulse = 2;
}
}
if (EchoHammerPrep >= 20)
{
InPulse = 2;
}
if (EchoHammerPrep <= 24f)
{
EchoHammerPrep += 0.2f;
Projectile.scale += 0.017f;
Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.7f, 0.9f), Main.rand.NextVector2CircularEdge(2f, 2f) * Main.rand.NextFloat(135f, 335f), Main.rand.NextFloat(20f, 20f), Color.Aqua, Color.Fuchsia, Main.rand.Next(10, 20), Projectile.Center);
GeneralParticleHandler.SpawnParticle(streak);
float fade = Utils.GetLerpValue(30, 0, EchoHammerPrep, true);
float numberOfDusts = 3f;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f);
velOffset *= Main.rand.NextFloat(45, 65) * fade;
Particle energy = new SparkParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, 14, Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, usedColor);
GeneralParticleHandler.SpawnParticle(energy);
Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f));
dust.noGravity = true;
dust.color = usedColor;
dust.velocity += Projectile.velocity;
}
}
else
{
@@ -184,22 +225,28 @@ namespace CalamityMod.Projectiles.Melee
}
}
//Spawn dust as the hammer travels.
if (Main.rand.NextBool())
if (targetDist < 1400)
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 272, Projectile.velocity * 0.4f + velOffset, 100, default, 0.7f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 226, Projectile.velocity * 0.5f + velOffset, 100, default, 0.7f);
dust.noGravity = true;
if (Main.rand.NextBool(3))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, -Projectile.velocity * 0.2f + velOffset, 100, default, 0.7f);
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.Magenta : Color.Aqua;
}
Vector2 linePos = Projectile.Center + (MathHelper.Pi + Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 25f;
Particle spark = new CustomSpark(linePos, (MathHelper.Pi + Projectile.rotation * Math.Sign(Projectile.velocity.X)).ToRotationVector2().RotatedByRandom(0.4f) * Main.rand.NextFloat(2f, 14f), "CalamityMod/Particles/BloomRing", false, Main.rand.Next(7, 16), Main.rand.NextFloat(0.25f, 0.5f), usedColor * 0.35f, new Vector2(1f, 1f), true, false, Main.rand.NextFloat(-10, 10));
GeneralParticleHandler.SpawnParticle(spark);
for (int i = 0; i < (InPulse > 0 ? 3 : 2); i++)
{
Vector2 offset = new Vector2(0, -30).RotatedBy(-MathHelper.PiOver4 * 0.5f).RotatedBy(Projectile.rotation);
Vector2 velOffset = new Vector2(0, -5).RotatedBy(-MathHelper.PiOver4).RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.4f, 1f);
Vector2 spawnPosition = Projectile.Center + offset + Main.rand.NextVector2Circular(6, 6);
StreamGougeMetaball.SpawnParticle(spawnPosition, velOffset * (InPulse > 0 ? 3 : 0.2f), 40f * Main.rand.NextFloat(0.9f, 1.3f) * (InPulse > 0 ? 3 : 1));
}
}
time++;
}
// On hit play GONG and spawn dust.
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
@@ -241,27 +288,57 @@ namespace CalamityMod.Projectiles.Melee
returnhammer = 1;
}
if (PulseCooldown >= 15)
float numberOfDusts = MathHelper.Clamp(30 - Projectile.numHits * 3, 6, 30);
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(0.5f, 0.5f), Main.rand.NextFloat(12f, 25f), 0.2f, 1.4f + (EmpoweredHammer * 0.1f), 14);
GeneralParticleHandler.SpawnParticle(pulse);
PulseCooldown = 0;
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(4.8f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f));
Vector2 velOffset = new Vector2(7f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f));
if (i % 3 == 0)
{
StreamGougeMetaball.SpawnParticle(Projectile.Center + offset, velOffset * Main.rand.NextFloat(1f, 1.2f), 60f * Main.rand.NextFloat(0.9f, 1.3f));
}
else
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType<LightDust>());
dust.noGravity = true;
dust.velocity = velOffset * Main.rand.NextFloat(0.45f, 1);
dust.scale = Main.rand.NextFloat(0.8f, 1.7f);
dust.color = Main.rand.NextBool(3) ? Color.Aqua : Color.Magenta;
}
}
SoundEngine.PlaySound(SoundID.Item14 with { Volume = 0.22f }, Projectile.Center);
Projectile.ai[1] = target.whoAmI;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.9f);
if (Projectile.damage < 1)
Projectile.damage = 1;
float minMult = 0.7f;
int hitsToMinMult = 10;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 3);
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Melee/GalaxySmasher").Value;
Asset<Texture2D> p = ModContent.Request<Texture2D>("CalamityMod/Particles/FlameExplosion2");
Asset<Texture2D> p2 = ModContent.Request<Texture2D>("CalamityMod/Particles/CircularSmearSmokey");
Asset<Texture2D> p3 = ModContent.Request<Texture2D>("CalamityMod/Particles/SmallBloom");
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.5f, 3, texture, true, true);
Vector2 generalDrawPos = Projectile.Center - Main.screenPosition;
float fade = Utils.GetLerpValue(2, 15, Projectile.velocity.Length(), true);
Main.EntitySpriteDraw(p3.Value, generalDrawPos, null, Color.Black * fade, Projectile.rotation, p3.Size() * 0.5f, 0.6f, SpriteEffects.None);
for (int i = 0; i < 3; i++)
Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.Indigo * 0.95f * fade, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f) + i * 0.2f, p.Size() * 0.5f, 0.05f + i * 0.004f, SpriteEffects.None);
//Projectile.DrawProjectileWithBackglow(Color.Transparent with { A = 0 }, Color.White, 5f, texture);
Main.EntitySpriteDraw(texture, generalDrawPos, null, lightColor, Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, Projectile.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, usedColor with { A = 0 } * 0.65f * fade, Projectile.rotation * Main.rand.NextFloat(1.4f, 1.45f), p2.Size() * 0.5f, 0.9f * Main.rand.NextFloat(0.9f, 1.1f), SpriteEffects.None);
return false;
}
}
+12 -23
View File
@@ -1,4 +1,5 @@
using CalamityMod.Particles;
using CalamityMod.Graphics.Metaballs;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
@@ -37,30 +38,18 @@ namespace CalamityMod.Projectiles.Melee
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
SoundEngine.PlaySound(HitSound, Projectile.Center);
float damageInterpolant = Utils.GetLerpValue(950f, 2000f, hit.Damage, true);
float impactAngularVelocity = MathHelper.Lerp(0.08f, 0.2f, damageInterpolant);
float impactParticleScale = MathHelper.Lerp(0.6f, 1f, damageInterpolant);
impactAngularVelocity *= Main.rand.NextBool().ToDirectionInt() * Main.rand.NextFloat(0.75f, 1.25f);
Color impactColor = Color.Lerp(Color.Fuchsia, Color.Aqua, Main.rand.NextFloat(0.5f));
Vector2 impactPoint = Vector2.Lerp(Projectile.Center, target.Center, 0.65f);
Vector2 bloodSpawnPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height) * 0.04f;
Vector2 splatterDirection = (Projectile.Center - bloodSpawnPosition).SafeNormalize(Vector2.UnitY);
for (int i = 0; i < 3; i++)
/*
for (int i = 0; i < 8; i++)
{
int sparkLifetime = Main.rand.Next(9, 12);
float sparkScale = Main.rand.NextFloat(0.8f, 1f) + damageInterpolant * 0.85f;
Color sparkColor = Color.Lerp(Color.Fuchsia, Color.Aqua, Main.rand.NextFloat(0.7f));
sparkColor = Color.Lerp(sparkColor, Color.Fuchsia, Main.rand.NextFloat());
Vector2 sparkVelocity = splatterDirection.RotatedByRandom(0.6f) * Main.rand.NextFloat(12f, 25f);
sparkVelocity.Y -= 6f;
SparkParticle spark = new SparkParticle(impactPoint, sparkVelocity, true, sparkLifetime, sparkScale, sparkColor);
GeneralParticleHandler.SpawnParticle(spark);
Vector2 spawnPosition = target.Center + Main.rand.NextVector2Circular(10f, 10f);
StreamGougeMetaball.SpawnParticle(spawnPosition, Main.rand.NextVector2Circular(3f, 3f), 60f);
float scale = MathHelper.Lerp(24f, 64f, CalamityUtils.Convert01To010(i / 8f));
spawnPosition = target.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * MathHelper.Lerp(-40f, 90f, i / 8f);
Vector2 particleVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.23f) * Main.rand.NextFloat(2.5f, 9f);
StreamGougeMetaball.SpawnParticle(spawnPosition, particleVelocity, scale);
}
//Create an impact point particle.
ImpactParticle impactParticle = new ImpactParticle(impactPoint, impactAngularVelocity, 20, impactParticleScale, impactColor);
GeneralParticleHandler.SpawnParticle(impactParticle);
*/
}
}
}
+29 -43
View File
@@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Melee
public static readonly SoundStyle Kunk = new("CalamityMod/Sounds/Item/TF2PanHit") { Volume = 1.1f };
public int Explodamage = 0;
public float speed = 0f;
public NPC targeted;
public override void SetStaticDefaults()
{
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
@@ -30,55 +31,53 @@ namespace CalamityMod.Projectiles.Melee
Projectile.aiStyle = 0;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.penetrate = 1;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(255, 248, 124, 255);
return new Color(255, 248, 124, 255) with { A = 0 };
}
public override void AI()
{
speed = Projectile.velocity.Length();
Projectile.ai[0] += 1f;
if (Projectile.ai[0] > 55f)
{
CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f);
}
if (Projectile.ai[0] < 42f)
{
Projectile.velocity.Y *= 0.9575f;
Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0];
Projectile.velocity.X *= 0.98f;
Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0] * Projectile.direction;
}
else if (Projectile.ai[0] < 44f)
else if (Projectile.ai[0] >= 42f)
{
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 * 0.5f;
Projectile.extraUpdates = 2;
if (Projectile.ai[1] < 0f)
{
Projectile.Kill();
return;
}
NPC target = Main.npc[(int)Projectile.ai[1]];
if (!target.CanBeChasedBy(Projectile, false) || !target.active)
Projectile.Kill();
else
targeted = Main.npc[(int)Projectile.ai[1]];
if (!targeted.CanBeChasedBy(Projectile, false) || !targeted.active || targeted == null)
targeted = Projectile.Center.ClosestNPCAt(2000);
if (targeted != null)
{
float velConst = 24f;
Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst);
Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0];
Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX);
if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25))
Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f);
else
Projectile.velocity *= 0.9f;
}
else
Projectile.Kill();
}
if (Main.rand.NextBool())
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
dust.noGravity = true;
}
@@ -86,7 +85,7 @@ namespace CalamityMod.Projectiles.Melee
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(Projectile.position + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
dust.noGravity = true;
}
}
@@ -97,29 +96,27 @@ namespace CalamityMod.Projectiles.Melee
return false;
return null;
}
public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Projectile.localAI[0] = target.whoAmI;
if (target == targeted)
Projectile.Kill();
}
public override bool PreKill(int timeLeft)
{
Player player = Main.player[Projectile.owner];
float numberOfDusts = 32f;
float numberOfDusts = 45f;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(15f, 0).RotatedBy(rot);
Vector2 velOffset = new Vector2(12.5f, 0).RotatedBy(rot);
int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, DustID.Sandnado, velOffset.X, velOffset.Y);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity = velOffset;
Main.dust[dust].scale = 3f;
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, DustID.Sandnado, velOffset);
dust.noGravity = true;
dust.velocity = velOffset * (i % 2 == 0 ? 0.9f : i % 3 == 0 ? 0.8f : 1f);
dust.scale = 3f;
}
if (Main.zenithWorld)
@@ -135,20 +132,9 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width, texture.Height);
Vector2 origin = sourceRectangle.Size() / 2f;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Gold with { A = 0 } * 0.5f, 1, texture, true, true);
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X);
Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY);
Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0);
}
return false;
}
}
@@ -29,7 +29,13 @@ namespace CalamityMod.Projectiles.Melee
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.85f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
}
}
+15 -16
View File
@@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Melee
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f };
public static readonly SoundStyle UseSoundFunny = new("CalamityMod/Sounds/Item/CalamityBell") { Volume = 1.5f };
public static int HighBong = 0;
public int time = 0;
public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer;
public override void SetStaticDefaults()
@@ -25,12 +26,13 @@ namespace CalamityMod.Projectiles.Melee
public override void SetDefaults()
{
Projectile.width = Projectile.height = 40;
Projectile.width = Projectile.height = 66;
Projectile.friendly = true;
Projectile.timeLeft = 3600;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.extraUpdates = 1;
}
public override void AI()
@@ -40,25 +42,22 @@ namespace CalamityMod.Projectiles.Melee
if (EmpoweredHammer >= 5)
EmpoweredHammer = 0;
Projectile.velocity.X *= 0.9511f;
Projectile.velocity.Y += 0.502f;
int falloffTime = 10;
if (time > falloffTime)
Projectile.velocity.X *= 0.9711f;
if (Projectile.velocity.Y < 15 && time > falloffTime)
Projectile.velocity.Y += 0.426f;
if (Projectile.velocity.Y < 5)
Projectile.velocity.Y *= 0.98f;
if (Main.rand.NextBool())
if (Main.rand.NextBool(3))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 1.5f);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.GoldFlame, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100, new Color(255, 245, 198), 2f);
dust.noGravity = true;
}
time++;
}
public override bool PreKill(int timeLeft)
@@ -71,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(9f, 0).RotatedBy(rot);
Vector2 velOffset = new Vector2(6f, 0).RotatedBy(rot);
Dust dust = Dust.NewDustPerfect(Projectile.position + offset, 269, new Vector2(velOffset.X, velOffset.Y));
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 269, new Vector2(velOffset.X, velOffset.Y));
dust.noGravity = true;
dust.velocity = velOffset;
dust.scale = 2.5f;
@@ -104,7 +103,7 @@ namespace CalamityMod.Projectiles.Melee
if (EmpoweredHammer >= 3)
{
Projectile.ai[1] = target.whoAmI;
int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(0, -15f), ModContent.ProjectileType<PwnagehammerEcho>(), Projectile.damage * 2, Projectile.knockBack * 1.5f, Projectile.owner, 0f, Projectile.ai[1]);
int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(Projectile.velocity.SafeNormalize(Vector2.UnitX).X * 5, -15f), ModContent.ProjectileType<PwnagehammerEcho>(), Projectile.damage * 2, Projectile.knockBack * 1.5f, Projectile.owner, 0f, Projectile.ai[1]);
Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X);
Main.projectile[hammer].netUpdate = true;
EmpoweredHammer = 0;
+83 -91
View File
@@ -1,9 +1,12 @@
using System;
using System.IO;
using CalamityMod.Dusts;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.Audio;
using Terraria.Graphics.Renderers;
using Terraria.ID;
using Terraria.ModLoader;
@@ -17,6 +20,7 @@ namespace CalamityMod.Projectiles.Melee
public float rotatehammer = 35f;
public int ColorAlpha = 225;
public float speed = 0f;
public NPC targeted;
public override void SetStaticDefaults()
{
@@ -25,29 +29,21 @@ namespace CalamityMod.Projectiles.Melee
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
// This is all copied straight from PwnagehammerEcho with some minor edits.
public override void SetDefaults()
{
Projectile.width = 74;
Projectile.height = 76;
Projectile.height = 74;
Projectile.aiStyle = 0;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.penetrate = 1;
Projectile.penetrate = -1;
Projectile.tileCollide = false;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(64, 224, 208, ColorAlpha);
}
public override void AI()
{
Projectile.scale = 1.8f;
ColorAlpha -= 4;
rotatehammer--;
Projectile.rotation += MathHelper.ToRadians(rotatehammer) * Projectile.direction;
@@ -57,48 +53,54 @@ namespace CalamityMod.Projectiles.Melee
Projectile.velocity *= 0.95f;
Projectile.rotation += MathHelper.ToRadians(Projectile.ai[0] * 0.5f) * Projectile.localAI[0];
}
else if (Projectile.ai[0] > 42f)
else if (Projectile.ai[0] >= 42f)
{
Projectile.extraUpdates = 1;
if (Projectile.ai[1] < 0f)
{
CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 2000f, speed, 12f);
if (Projectile.ai[0] > 80f)
Projectile.Kill();
return;
}
Projectile.extraUpdates = 5;
NPC target = Main.npc[(int)Projectile.ai[1]];
if (!target.CanBeChasedBy(Projectile, false) || !target.active)
targeted = Main.npc[(int)Projectile.ai[1]];
if (!targeted.CanBeChasedBy(Projectile, false) || !targeted.active || targeted == null)
targeted = Projectile.Center.ClosestNPCAt(2000);
if (targeted != null)
{
Projectile.Kill();
float speedMult = 0.7f;
Vector2 moveTotarget = (targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX);
if (Projectile.velocity.Length() < MathHelper.Clamp(25 - Projectile.ai[0] * 0.1f, 10, 25) * speedMult)
Projectile.velocity += moveTotarget * (0.35f + Projectile.ai[0] * 0.03f) * speedMult;
else
Projectile.velocity *= 0.9f;
}
else
Projectile.Kill();
if (Main.rand.NextBool(6))
{
float velConst = 7f;
velConst--;
Projectile.velocity = new Vector2((target.Center.X - Projectile.Center.X) / velConst, (target.Center.Y - Projectile.Center.Y) / velConst);
Projectile.rotation += MathHelper.ToRadians(48f) * Projectile.localAI[0];
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, ModContent.DustType<LightDust>(), new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(1.5f, 1.9f);
dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
}
if (Projectile.ai[0] == 42f && targeted != null)
{
for (int i = 0; i < 20; i++)
{
Dust dust = Dust.NewDustPerfect(Projectile.Center, 278, ((targeted.Center - Projectile.Center).SafeNormalize(Vector2.UnitX) * 25).RotatedByRandom(0.6f) * Main.rand.NextFloat(0.2f, 1f));
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(0.8f, 1.9f);
dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
}
if (Main.rand.NextBool())
for (int i = 0; i < 2; i++)
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.Terragrim, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100);
Vector2 offset = new Vector2(0, -30).RotatedBy(-MathHelper.PiOver4 * 0.5f).RotatedBy(Projectile.rotation);
Vector2 velOffset = new Vector2(0, -5).RotatedBy(-MathHelper.PiOver4).RotatedBy(Projectile.rotation) * Main.rand.NextFloat(0.5f, 1f);
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset + Main.rand.NextVector2Circular(6, 6), Main.rand.NextBool(3) ? 278 : ModContent.DustType<LightDust>(), velOffset);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(2.2f, 3.6f);
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(7, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(3, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.Vortex, new Vector2(Projectile.velocity.X * 0.5f + velOffset.X, Projectile.velocity.Y * 0.5f + velOffset.Y), 100);
dust.noGravity = true;
dust.scale = Main.rand.NextFloat(2.2f, 3.6f);
dust.scale = Main.rand.NextFloat(0.9f, 1.3f);
dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
}
@@ -109,12 +111,10 @@ namespace CalamityMod.Projectiles.Melee
return null;
}
public override bool CanHitPvp(Player target) => Projectile.ai[0] > 42f;
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
Projectile.localAI[0] = target.whoAmI;
if (target == targeted)
Projectile.Kill();
}
public override bool PreKill(int timeLeft)
@@ -134,48 +134,52 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
float intensity = Main.rand.NextFloat(0.2f, 1f);
Vector2 offset = new Vector2(30f, 5.8f).RotatedBy(rot);
Vector2 velOffset = new Vector2(20.8f, 10.5f).RotatedBy(rot);
int dust = Dust.NewDust(Projectile.position + offset, Projectile.width, Projectile.height, DustID.Vortex, velOffset.X, velOffset.Y);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity = velOffset;
Main.dust[dust].scale = 3.8f;
Vector2 velOffset = new Vector2(40.8f, 10.5f).RotatedBy(rot);
if (i % 2 == 0)
{
Particle orb = new CustomSpark(Projectile.Center + offset, velOffset * intensity * 0.7f, "CalamityMod/Particles/Sparkle", false, (int)(40 * intensity), intensity, Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise, new Vector2(1f, 2f), true, true);
GeneralParticleHandler.SpawnParticle(orb);
}
else
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType<LightDust>(), velOffset);
dust.noGravity = true;
dust.velocity = velOffset * intensity;
dust.scale = Main.rand.NextFloat(2.1f, 2.8f) * intensity;
dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
}
for (int i = 0; i < 88; ++i)
for (int i = 0; i < 40; ++i)
{
// Pick a random type of dust.
int dustID;
switch (Main.rand.Next(6))
{
case 0:
dustID = 229;
break;
case 1:
case 2:
dustID = 156;
break;
default:
dustID = 156;
break;
}
int dustID = ModContent.DustType<LightDust>();
// Choose a random speed and angle for the dust.
float dustSpeed = Main.rand.NextFloat(6.0f, 29.0f);
float angleRandom = 0.09f;
float dustSpeed = 45;
float intensity = Main.rand.NextFloat(0.5f, 1.5f);
Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation());
dustVel = dustVel.RotatedBy(-angleRandom);
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
dustVel = dustVel.RotatedByRandom((1.5f - intensity) * 0.4f) * intensity;
// Pick a size for the dust particle.
float scale = Main.rand.NextFloat(2.2f, 4.8f);
float scale = Main.rand.NextFloat(2.8f, 3.5f) - intensity;
// Actually spawn the dust.
int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale);
Main.dust[idx].noGravity = true;
Main.dust[idx].position = Projectile.Center;
Dust idx = Dust.NewDustPerfect(Projectile.Center, dustID, dustVel, 0, default, scale);
idx.noGravity = true;
idx.position = Projectile.Center;
idx.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
Particle pulse3 = new GlowSparkParticle(Projectile.Center + Projectile.velocity, Projectile.velocity * 2, false, 12, 0.17f, Color.Turquoise, new Vector2(2.5f, 0.7f), true, true, 0.85f);
GeneralParticleHandler.SpawnParticle(pulse3);
Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Turquoise, "CalamityMod/Particles/BloomRing", new Vector2(0.7f, 1), Projectile.velocity.ToRotation(), 0f, 3f, 25);
GeneralParticleHandler.SpawnParticle(bolt2);
Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PaleTurquoise, "CalamityMod/Particles/BloomRing", new Vector2(0.4f, 1), Projectile.velocity.ToRotation(), 0f, 4f, 25);
GeneralParticleHandler.SpawnParticle(bolt3);
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType<StellarContemptBlast>(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f);
return false;
@@ -183,23 +187,11 @@ namespace CalamityMod.Projectiles.Melee
public override bool PreDraw(ref Color lightColor)
{
SpriteEffects spriteEffects = SpriteEffects.None;
if (Projectile.spriteDirection == -1)
spriteEffects = SpriteEffects.FlipHorizontally;
Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
Rectangle sourceRectangle = new Rectangle(0, 0, texture.Width + 12, texture.Height + 12);
Vector2 origin = sourceRectangle.Size() / 2f;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], Color.Turquoise with { A = 0 } * 0.5f, 1, texture, true, true);
for (int i = 0; i < Projectile.oldPos.Length; i++)
{
float rot = MathHelper.ToRadians(22.5f) * Math.Sign(Projectile.velocity.X);
Vector2 drawPos = Projectile.oldPos[i] - Main.screenPosition + origin + new Vector2(0f, Projectile.gfxOffY);
Color color = Projectile.GetAlpha(lightColor) * ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length);
Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(), color, Projectile.rotation - i * rot, origin, Projectile.scale, spriteEffects, 0);
}
return false;
Projectile.DrawProjectileWithBackglow(Color.Turquoise with { A = 0 }, Color.White, 12f * Utils.GetLerpValue(0, 42, Projectile.ai[0], true) , texture);
return true;
}
}
}
+52 -67
View File
@@ -1,5 +1,6 @@
using System;
using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using CalamityMod.Items.Weapons.Melee;
using CalamityMod.Particles;
using Microsoft.Xna.Framework;
@@ -18,12 +19,11 @@ namespace CalamityMod.Projectiles.Melee
public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/PwnagehammerSound") { Volume = 0.35f };
public static readonly SoundStyle RedHamSound = new("CalamityMod/Sounds/Item/StellarContemptClone") { Volume = 0.6f };
public static readonly SoundStyle UseSoundFunny = new("CalamityMod/Sounds/Item/CalamityBell") { Volume = 1.5f };
public ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().StellarHammer;
public int returnhammer = 0;
public int DustOnce = 1;
public float rotatehammer = 8f;
public int time = 0;
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 11;
@@ -56,53 +56,19 @@ namespace CalamityMod.Projectiles.Melee
if (returnhammer == 0)
{
Projectile.velocity.X *= 0.981f;
Projectile.velocity.Y += 0.226f;
int falloffTime = 15;
if (time > falloffTime)
Projectile.velocity.X *= 0.967f;
if (Projectile.velocity.Y < 15 && time > falloffTime)
Projectile.velocity.Y += 0.426f;
if (Projectile.velocity.Y < 5)
Projectile.velocity.Y *= 0.98f;
}
if (returnhammer == 1)
{
if (EmpoweredHammer == 4)
{
if (DustOnce == 1)
{
for (int i = 0; i < 20; ++i)
{
// Pick a random type of dust.
int dustID;
switch (Main.rand.Next(6))
{
case 0:
dustID = 229;
break;
case 1:
case 2:
dustID = 156;
break;
default:
dustID = 156;
break;
}
// Choose a random speed and angle for the dust.
float dustSpeed = Main.rand.NextFloat(3.0f, 19.0f);
float angleRandom = 0.09f;
Vector2 dustVel = new Vector2(0.0f, dustSpeed * -1f);
dustVel = dustVel.RotatedBy(-angleRandom);
dustVel = dustVel.RotatedByRandom(2.0f * angleRandom);
// Pick a size for the dust particle.
float scale = Main.rand.NextFloat(1.7f, 3.8f);
// Actually spawn the dust.
int idx = Dust.NewDust(Projectile.Center, 1, 1, dustID, dustVel.X, dustVel.Y, 0, default, scale);
Main.dust[idx].noGravity = true;
Main.dust[idx].position = Projectile.Center;
}
DustOnce = 0;
}
Projectile.velocity.X *= 0.281f;
Projectile.velocity.Y -= 0.8f;
rotatehammer++;
@@ -125,7 +91,7 @@ namespace CalamityMod.Projectiles.Melee
if (returnhammer == 2)
{
Projectile.extraUpdates = 2;
float returnSpeed = StellarContempt.Speed;
float returnSpeed = StellarContempt.Speed * 0.7f;
float acceleration = 1.1f;
Player owner = Main.player[Projectile.owner];
Vector2 playerCenter = owner.Center;
@@ -172,10 +138,11 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i < 30; i++)
{
Dust fire = Dust.NewDustPerfect(Projectile.Center, 156);
Dust fire = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<LightDust>());
fire.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedByRandom(0.8f) * new Vector2(4f, 1.25f) * Main.rand.NextFloat(0.9f, 1f);
fire.velocity = fire.velocity.RotatedBy(Projectile.rotation - MathHelper.PiOver2);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
fire.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
fire.noGravity = true;
fire.scale = Main.rand.NextFloat(0.2f, 0.6f) * EmpoweredHammer;
@@ -183,6 +150,7 @@ namespace CalamityMod.Projectiles.Melee
fire = Dust.CloneDust(fire);
fire.velocity = Main.rand.NextVector2Circular(3f, 3f);
fire.velocity += Projectile.velocity * (EmpoweredHammer * 0.04f);
fire.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
Projectile.Kill();
@@ -193,10 +161,23 @@ namespace CalamityMod.Projectiles.Melee
{
if (Projectile.velocity.Y < 0f)
{
Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.9f, 1.5f), Main.rand.NextVector2CircularEdge(2f, 2f) * Main.rand.NextFloat(85f, 335f), Main.rand.NextFloat(30f, 44f), Color.PaleTurquoise, Color.Turquoise, Main.rand.Next(15, 30), Projectile.Center);
GeneralParticleHandler.SpawnParticle(streak);
float fade = Utils.GetLerpValue(3, -10, Projectile.velocity.Y, true);
float numberOfDusts = 2f;
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 250f, 0.04f);
velOffset *= Main.rand.NextFloat(25, 45) * fade;
Particle energy = new SparkParticle(Projectile.Center + velOffset * 2.5f, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, false, 14, Main.rand.NextFloat(1.1f, 1.25f) - 0.5f * fade, Color.Turquoise);
GeneralParticleHandler.SpawnParticle(energy);
Dust dust = Dust.NewDustPerfect(Projectile.Center + velOffset * 2.5f, 278, -velOffset * Main.rand.NextFloat(0.08f, 0.12f) * 1.5f, 0, default, Main.rand.NextFloat(0.4f, 0.6f));
dust.noGravity = true;
dust.color = Color.Turquoise;
dust.velocity += Projectile.velocity;
}
Projectile.velocity.Y += 0.6f;
Projectile.scale += 0.03f;
}
else
{
@@ -211,21 +192,15 @@ namespace CalamityMod.Projectiles.Melee
}
// Spawn dust as the hammer travels.
if (Main.rand.NextBool())
if (Main.rand.NextBool(3))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.UltraBrightTorch, new Vector2(Projectile.velocity.X * 0.3f + velOffset.X, Projectile.velocity.Y * 0.3f + velOffset.Y), 100);
dust.noGravity = true;
}
if (Main.rand.NextBool(6))
{
Vector2 offset = new Vector2(12, 0).RotatedByRandom(MathHelper.ToRadians(360f));
Vector2 velOffset = new Vector2(4, 0).RotatedBy(offset.ToRotation());
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, DustID.UltraBrightTorch, new Vector2(Projectile.velocity.X * 0.2f + velOffset.X, Projectile.velocity.Y * 0.2f + velOffset.Y), 100);
Dust dust = Dust.NewDustPerfect(new Vector2(Projectile.Center.X, Projectile.Center.Y) + offset, ModContent.DustType<LightDust>(), new Vector2(Projectile.velocity.X * 0.3f + velOffset.X, Projectile.velocity.Y * 0.3f + velOffset.Y));
dust.noGravity = true;
dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
time++;
}
// On hit play GONG and spawn dust.
@@ -250,17 +225,27 @@ namespace CalamityMod.Projectiles.Melee
returnhammer = 1;
}
float numberOfDusts = 40f;
float numberOfDusts = MathHelper.Clamp(40 - Projectile.numHits * 5, 6, 40);
float rotFactor = 360f / numberOfDusts;
for (int i = 0; i < numberOfDusts; i++)
{
float rot = MathHelper.ToRadians(i * rotFactor);
Vector2 offset = new Vector2(4.8f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f));
Vector2 velOffset = new Vector2(4f, 0).RotatedBy(rot * Main.rand.NextFloat(1.1f, 4.1f));
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 229, new Vector2(velOffset.X, velOffset.Y));
dust.noGravity = true;
dust.velocity = velOffset;
dust.scale = Main.rand.NextFloat(1.5f, 3.2f);
if (i % 3 == 0)
{
Particle orb = new CustomSpark(Projectile.Center + offset, velOffset * Main.rand.NextFloat(1f, 1.5f), "CalamityMod/Particles/Sparkle", false, 25, Main.rand.NextFloat(0.55f, 0.75f), Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise, new Vector2(1f, 2f), true, true);
GeneralParticleHandler.SpawnParticle(orb);
}
else
{
Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType<LightDust>(), new Vector2(velOffset.X, velOffset.Y));
dust.noGravity = true;
dust.velocity = velOffset * Main.rand.NextFloat(0.75f, 1);
dust.scale = Main.rand.NextFloat(0.9f, 1.6f);
dust.color = Main.rand.NextBool(3) ? Color.PaleTurquoise : Color.Turquoise;
}
}
SoundEngine.PlaySound(SoundID.Item14 with { Volume = 0.22f }, Projectile.Center);
@@ -269,10 +254,10 @@ namespace CalamityMod.Projectiles.Melee
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.9f);
if (Projectile.damage < 1)
Projectile.damage = 1;
float minMult = 0.7f;
int hitsToMinMult = 10;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
private void SpawnFlares(Vector2 targetPos, int width, int height)