From edce2f7c760d7d106450da67edba13bb84a49026 Mon Sep 17 00:00:00 2001
From: Xhack <72313282+energykid@users.noreply.github.com>
Date: Tue, 21 May 2024 13:54:40 -0400
Subject: [PATCH] Updated code in accordance with change requests + retooled
and re-added Wind Blade cyclone
---
.../Mods.CalamityMod.Projectiles.Melee.hjson | 3 +-
.../BaseCustomUseStyleProjectile.cs | 47 +++++++++++++
Projectiles/Melee/WindBladeHoldout.cs | 30 ++++++++
Projectiles/Melee/WindBolt.cs | 69 +++++++++++++++++++
en-US.hjson | 1 +
5 files changed, 149 insertions(+), 1 deletion(-)
create mode 100644 en-US.hjson
diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson
index f49ed13e17..79a1e7d286 100644
--- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson
+++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson
@@ -76,7 +76,6 @@ CosmicSpiritBomb3.DisplayName: Cosmic Bomb
CrescentMoonFlail.DisplayName: Crescent Moon
CrescentMoonProj.DisplayName: Crescent Moon
CrystylCrusherRay.DisplayName: Crystyl Crusher Ray
-Cyclone.DisplayName: Cyclone
DarkBall.DisplayName: Dark Ball
DarkBeam.DisplayName: Dark Beam
DarkIceZero.DisplayName: Dark Ice
@@ -311,8 +310,10 @@ Waterfall.DisplayName: Waterfall Beam
WhiteBoltAura.DisplayName: White Aura
WhiteOrb.DisplayName: White Orb
Whiterain.DisplayName: White Rain
+WindBolt.DisplayName: Wind Bolt
WulfrumScrew.DisplayName: Wulfrum Screw
WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
YateveoBloomProj.DisplayName: Yateveo Bloom
YinYoDark.DisplayName: Dark Shard
YinYoLight.DisplayName: Light Shard
+Cyclone.DisplayName: Cyclone
diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs
index 09eb794278..e662a81fae 100644
--- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs
+++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs
@@ -22,6 +22,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles
{
Projectile.friendly = true;
Projectile.tileCollide = false;
+<<<<<<< Updated upstream
+=======
+ Projectile.penetrate = -1;
+>>>>>>> Stashed changes
}
public override void OnSpawn(IEntitySource source)
@@ -35,6 +39,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles
///
public Vector2 Offset = Vector2.Zero;
+<<<<<<< Updated upstream
+=======
+ public float RestrikeDelay = 0;
+
+>>>>>>> Stashed changes
///
/// The Player that is using the projectile.
///
@@ -91,29 +100,41 @@ namespace CalamityMod.Projectiles.BaseProjectiles
/// The origin of the sprite when drawn on your character.
///
///
+<<<<<<< Updated upstream
public virtual Vector2 SpriteOrigin()
{
return Projectile.Size / 2;
}
+=======
+ public virtual Vector2 SpriteOrigin => Projectile.Size / 2;
+>>>>>>> Stashed changes
///
/// Helper method for getting the rotation of the sprite plus RotationOffset, without having to make your own local variable every time.
///
///
+<<<<<<< Updated upstream
public float FinalRotation()
{
return Projectile.rotation + RotationOffset;
}
+=======
+ public float FinalRotation => Projectile.rotation + RotationOffset;
+>>>>>>> Stashed changes
///
/// Rotation offset for the hitbox that doesn't affect the sprite.
/// Useful for if you have, for instance, a sword sprite at a 45 degree angle, and need that to reflect on the hitbox.
///
///
+<<<<<<< Updated upstream
public virtual float HitboxRotationOffset()
{
return 0f;
}
+=======
+ public virtual float HitboxRotationOffset => 0f;
+>>>>>>> Stashed changes
///
/// Whether or not the projectile can hit enemies at the current frame.
@@ -161,7 +182,13 @@ namespace CalamityMod.Projectiles.BaseProjectiles
public override void AI()
{
+<<<<<<< Updated upstream
Projectile.penetrate = 100;
+=======
+ Owner.Calamity().mouseWorldListener = true;
+
+ RestrikeDelay--;
+>>>>>>> Stashed changes
if (Owner.ItemAnimationActive)
{
@@ -211,6 +238,18 @@ namespace CalamityMod.Projectiles.BaseProjectiles
}
}
+<<<<<<< Updated upstream
+=======
+ public override bool? CanHitNPC(NPC target)
+ {
+ bool bb = (target.immune[0] <= 0) && !target.friendly && !target.dontTakeDamage && RestrikeDelay <= 0;
+
+ if (bb) RestrikeDelay = 1;
+
+ return bb;
+ }
+
+>>>>>>> Stashed changes
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
modifiers.HitDirectionOverride = Owner.direction;
@@ -224,7 +263,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles
public override void ModifyDamageHitbox(ref Rectangle hitbox)
{
+<<<<<<< Updated upstream
Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation() + HitboxRotationOffset());
+=======
+ Vector2 cen = Projectile.Center + new Vector2(HitboxOutset, 0).RotatedBy(FinalRotation + HitboxRotationOffset);
+>>>>>>> Stashed changes
hitbox = new Rectangle((int)cen.X - (int)(HitboxSize.X / 2), (int)cen.Y - (int)(HitboxSize.Y / 2), (int)HitboxSize.X, (int)HitboxSize.Y);
@@ -240,7 +283,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
+<<<<<<< Updated upstream
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin().X, SpriteOrigin().Y) : SpriteOrigin(), Projectile.scale, FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
+=======
+ Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
+>>>>>>> Stashed changes
}
return false;
}
diff --git a/Projectiles/Melee/WindBladeHoldout.cs b/Projectiles/Melee/WindBladeHoldout.cs
index d55bf66300..3b3127734f 100644
--- a/Projectiles/Melee/WindBladeHoldout.cs
+++ b/Projectiles/Melee/WindBladeHoldout.cs
@@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Melee
public override Vector2 HitboxSize => new Vector2(70, 70);
+<<<<<<< Updated upstream
public override float HitboxRotationOffset()
{
return MathHelper.ToRadians(-45);
@@ -31,6 +32,11 @@ namespace CalamityMod.Projectiles.Melee
{
return new(0, 80);
}
+=======
+ public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
+
+ public override Vector2 SpriteOrigin => new(0, 80);
+>>>>>>> Stashed changes
public override void OnSpawn(IEntitySource source)
{
@@ -41,9 +47,13 @@ namespace CalamityMod.Projectiles.Melee
public override void UseStyle()
{
+<<<<<<< Updated upstream
Vector2 mousePos = Main.MouseWorld;
// i don't know how cal handles Main.MouseWorld in netcode. todo: someone fix this up in multiplayer pls
// - ennway
+=======
+ Vector2 mousePos = Owner.Calamity().mouseWorld;
+>>>>>>> Stashed changes
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
else Owner.direction = 1;
@@ -75,7 +85,11 @@ namespace CalamityMod.Projectiles.Melee
}
if ((int)AnimationProgress > (int)(Owner.itemAnimationMax / 1.5f))
{
+<<<<<<< Updated upstream
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Owner.Center + (new Vector2(Main.rand.Next(30, 100), 0).RotatedBy(FinalRotation() + MathHelper.ToRadians(-45))), new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation() + MathHelper.ToRadians(-45)), Color.LightSkyBlue, 40, 1f, 0.4f, MathHelper.ToRadians(Main.rand.NextFloat(-10f, 10f)), true));
+=======
+ GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Owner.Center + (new Vector2(Main.rand.Next(30, 100), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)), Color.LightSkyBlue, 40, 1f, 0.4f, MathHelper.ToRadians(Main.rand.NextFloat(-10f, 10f)), true));
+>>>>>>> Stashed changes
}
float time = (AnimationProgress) - (Owner.itemAnimationMax / 3);
@@ -89,18 +103,34 @@ namespace CalamityMod.Projectiles.Melee
}
else if (NumberOfAnimations % 4 == 3)
{
+<<<<<<< Updated upstream
+=======
+ float ProjectileSpeed = 10;
+ int ProjectileDamage = 10;
+ float ProjectileKnockback = Projectile.knockBack;
+
+>>>>>>> Stashed changes
CanHit = true;
if ((int)AnimationProgress == 1)
{
SoundEngine.PlaySound(SoundID.DD2_SkyDragonsFurySwing, Owner.Center);
SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing.WithPitchOffset(-0.4f), Owner.Center);
+<<<<<<< Updated upstream
+=======
+
+ Projectile.NewProjectile(new EntitySource_ItemUse(Owner, Owner.HeldItem), Projectile.Hitbox.Center.ToVector2(), new Vector2(ProjectileSpeed, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)), ModContent.ProjectileType(), ProjectileDamage, ProjectileKnockback, Owner.whoAmI);
+>>>>>>> Stashed changes
}
RotationOffset = 0f;
if (AnimationProgress < Owner.itemAnimationMax / 3)
{
Projectile.scale = MathHelper.Lerp(Projectile.scale, 1.5f, 0.4f);
+<<<<<<< Updated upstream
float rot = FinalRotation() + MathHelper.ToRadians(-45);
+=======
+ float rot = FinalRotation + MathHelper.ToRadians(-45);
+>>>>>>> Stashed changes
GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Owner.Center + new Vector2(105 * Projectile.scale, 0).RotatedBy(rot), new Vector2(5, 0).RotatedBy(rot + MathHelper.ToRadians(Main.rand.NextFloat(-20, 20))), Color.LightSkyBlue, 30, 2f, 0.3f, MathHelper.ToRadians(Main.rand.NextFloat(-10f, 10f)), true));
GeneralParticleHandler.SpawnParticle(new LineParticle(Owner.Center + new Vector2(0, 20).RotatedBy(rot) + new Vector2(45 * Projectile.scale, 0).RotatedBy(rot), new Vector2(5, 0).RotatedBy(rot), false, 30, 1f, Color.LightSkyBlue));
diff --git a/Projectiles/Melee/WindBolt.cs b/Projectiles/Melee/WindBolt.cs
index fa7973d544..e0b442246b 100644
--- a/Projectiles/Melee/WindBolt.cs
+++ b/Projectiles/Melee/WindBolt.cs
@@ -1,10 +1,22 @@
using System;
using CalamityMod.CalPlayer;
using Microsoft.Xna.Framework;
+<<<<<<< Updated upstream
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
+=======
+using Microsoft.Xna.Framework.Graphics;
+using ReLogic.Content;
+using Terraria;
+using Terraria.Audio;
+using Terraria.GameContent.UI;
+using Terraria.ID;
+using Terraria.ModLoader;
+using Terraria.Utilities.Terraria.Utilities;
+using XPT.Core.Audio.MP3Sharp.Decoding.Decoders.LayerIII;
+>>>>>>> Stashed changes
namespace CalamityMod.Projectiles.Melee
{
@@ -12,6 +24,10 @@ namespace CalamityMod.Projectiles.Melee
{
public new string LocalizationCategory => "Projectiles.Melee";
public int dustvortex = 0;
+<<<<<<< Updated upstream
+=======
+ public float scFactor = 0f;
+>>>>>>> Stashed changes
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
@@ -27,15 +43,27 @@ namespace CalamityMod.Projectiles.Melee
Projectile.DamageType = DamageClass.Melee;
Projectile.timeLeft = 300;
Projectile.extraUpdates = 2;
+<<<<<<< Updated upstream
Projectile.penetrate = 2;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
+=======
+ Projectile.penetrate = -1;
+ Projectile.ignoreWater = true;
+ Projectile.usesLocalNPCImmunity = true;
+ Projectile.localNPCHitCooldown = 50;
+>>>>>>> Stashed changes
Projectile.tileCollide = false;
}
public override void AI()
{
+<<<<<<< Updated upstream
+=======
+ Projectile.velocity *= 0.95f;
+
+>>>>>>> Stashed changes
Projectile.ai[0]++;
Projectile.ai[1]++;
@@ -43,18 +71,32 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.ai[0] >= 12)
Projectile.tileCollide = true;
+<<<<<<< Updated upstream
Projectile.rotation += MathHelper.ToRadians(15f);
Projectile.alpha -= 5;
if (Projectile.alpha < 50)
+=======
+ Projectile.rotation += MathHelper.ToRadians(1f);
+ Projectile.alpha -= 5;
+>>>>>>> Stashed changes
{
Projectile.alpha = 50;
if (Projectile.ai[1] >= 15)
{
+<<<<<<< Updated upstream
for (int i = 1; i <= 6; i++)
{
Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustvortex));
int d = Dust.NewDust(Projectile.Center, Projectile.width / 2, Projectile.height / 2, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f);
+=======
+ scFactor = MathHelper.Lerp(scFactor, 1f, 0.1f);
+ for (int i = 1; i <= 6; i++)
+ {
+ Vector2 dustpos = new Vector2(48f, 48f).RotatedBy(MathHelper.ToRadians(dustvortex + Main.rand.Next(30)));
+ Vector2 dustspeed = new Vector2(-5f, -5f).RotatedBy(MathHelper.ToRadians(dustvortex + Main.rand.Next(30)));
+ int d = Dust.NewDust(Projectile.Center + dustpos, Projectile.width / 2, Projectile.height / 2, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 50), 1.3f);
+>>>>>>> Stashed changes
Main.dust[d].noGravity = true;
Main.dust[d].velocity = dustspeed;
dustvortex += 60;
@@ -72,6 +114,7 @@ namespace CalamityMod.Projectiles.Melee
float npcCenterX = npc.position.X + (float)(npc.width / 2);
float npcCenterY = npc.position.Y + (float)(npc.height / 2);
float npcDistance = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcCenterX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcCenterY);
+<<<<<<< Updated upstream
if (npcDistance < 600f)
{
if (npc.position.X < projX)
@@ -91,13 +134,34 @@ namespace CalamityMod.Projectiles.Melee
npc.velocity.Y -= 0.05f;
}
}
+=======
+ if (npcDistance < 300f)
+ {
+ float factor = MathHelper.Lerp(1f,0f,CalamityUtils.SineBumpEasing(npcDistance / 300, 1));
+
+ npc.velocity += npc.DirectionTo(Projectile.Center) * factor * 0.25f;
+ }
+ if (npcDistance < 40) npc.velocity *= 0.75f;
+>>>>>>> Stashed changes
}
}
}
public override bool PreDraw(ref Color lightColor)
{
+<<<<<<< Updated upstream
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor);
+=======
+ Asset tex = ModContent.Request(Texture);
+
+ for (int i = 5; i >= 0; i--)
+ {
+ float c = Math.Max(i, 1);
+
+ Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), new Color(1f / c, 1f / c, 1f / c, 1f / c), -Projectile.rotation * c, tex.Size() / 2, (float)MathHelper.Lerp(1f, i, scFactor), SpriteEffects.None);
+ }
+
+>>>>>>> Stashed changes
return false;
}
@@ -107,8 +171,13 @@ namespace CalamityMod.Projectiles.Melee
for (int i = 0; i <= 360; i += 3)
{
+<<<<<<< Updated upstream
Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(i));
int d = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f);
+=======
+ Vector2 dustspeed = new Vector2(12f, 12f).RotatedBy(MathHelper.ToRadians(i));
+ int d = Dust.NewDust(Projectile.Center + (dustspeed * 2), Projectile.width, Projectile.height, DustID.Smoke, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f);
+>>>>>>> Stashed changes
Main.dust[d].noGravity = true;
Main.dust[d].position = Projectile.Center;
Main.dust[d].velocity = dustspeed;
diff --git a/en-US.hjson b/en-US.hjson
new file mode 100644
index 0000000000..a84ffb8057
--- /dev/null
+++ b/en-US.hjson
@@ -0,0 +1 @@
+Mods.CalamityMod.Projectiles.WindBladeHoldout.DisplayName: Wind Blade Holdout