diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs index 7a4991b567..c3a430b548 100644 --- a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs @@ -189,6 +189,20 @@ namespace CalamityMod.Projectiles.BaseProjectiles List oldProjectilePos = new List { }; internal int ExistsTime = 20; + public bool inStartup => timer < StartupTime; + + public bool inCooldown => timer > CooldownStartFrame; + + public bool inSwing => !(inStartup || inCooldown); + + public int CooldownStartFrame => swingTime + StartupTime; + + public int CooldownTimer => timer - CooldownStartFrame; + + public float StartupCompletion => timer / (float)StartupTime; + public float SwingCompletion => swingTimer / (float)swingTime; + public float CooldownCompletion => CooldownTimer / (float)CooldownTime; + #endregion #region Overridable Methods @@ -206,13 +220,14 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual void Defaults() { } /// - /// Returns the offset from the centerpoint in radians. Automatically will be inverted if AlternateSwings is enabled. + /// Returns the swing offset from the center angle in radians. Automatically will be inverted if AlternateSwings is enabled. /// /// public virtual float SwingFunction() { return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 2, swingWidth / 2, swingTimer / (float)swingTime)); } + /// /// The function for the width of the trail /// @@ -441,6 +456,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles { modifiers.HitDirectionOverride = ((Main.player[Projectile.owner].DirectionTo(target.Center)).X >= 0 ? 1 : -1); } + + public override bool? CanDamage() + { + return inSwing; + } #endregion #region Helper Methods @@ -470,6 +490,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0); } } + #endregion } diff --git a/Projectiles/Magic/SanguineFlareProj.cs b/Projectiles/Magic/SanguineFlareProj.cs index 4fe2d272c0..10b527637a 100644 --- a/Projectiles/Magic/SanguineFlareProj.cs +++ b/Projectiles/Magic/SanguineFlareProj.cs @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Magic { //Photoviscerator drawcode, edited slightly float colorInterpolation = (float)Math.Cos(Projectile.timeLeft / 32f + dmgMult / 20f + i / (float)Projectile.oldPos.Length * MathHelper.Pi) * 0.5f + 0.5f; - Color color = Color.Lerp(Color.Red, Color.DarkRed, colorInterpolation) * 0.8f; + Color color = Color.Lerp(Color.Red, Color.DarkRed, colorInterpolation) * 0.8f * ((dmgMult-1)/4f); color.A = 0; Vector2 drawPosition = Projectile.oldPos[i]+Projectile.Size /2f + lightTexture.Size() * 0.5f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY) + new Vector2(-32.5f, -32.5f); //Last vector is to offset the circle so that it is displayed where the hitbox actually is, instead of a bit down and to the right. Color outerColor = color; @@ -171,8 +171,8 @@ namespace CalamityMod.Projectiles.Magic Vector2 innerScale = new Vector2(1f) * Projectile.scale * intensity * 0.7f; outerColor *= intensity; innerColor *= intensity; - Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * dmgMult * 0.25f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * dmgMult * 0.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, outerColor, 0f, lightTexture.Size() * 0.5f, outerScale * 1.25f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(lightTexture, drawPosition, null, innerColor, 0f, lightTexture.Size() * 0.5f, innerScale * 1.25f, SpriteEffects.None, 0); } } diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index 3117c4212a..75553ac8b6 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -56,12 +56,23 @@ namespace CalamityMod.Projectiles.Melee public override void AdditionalAI() { - Projectile.scale = baseScale * Math.Min(MathHelper.SmoothStep(1, 2, swingTimer / (float)swingTime), MathHelper.SmoothStep(2, 1, swingTimer / (float)swingTime)); + if (inStartup) + { + Projectile.scale = baseScale * MathHelper.Lerp(0.5f, 1, 1 - MathF.Pow(1 - StartupCompletion, 2f)); + } else if (inCooldown) + { + Projectile.scale = baseScale * MathHelper.Lerp(1,0.5f,MathF.Pow(CooldownCompletion,2)); + } else + Projectile.scale = baseScale * Math.Min(MathHelper.SmoothStep(1, 2, SwingCompletion), MathHelper.SmoothStep(2, 1, SwingCompletion)); } public override float SwingFunction() { - return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth / 4 * 3, swingWidth / 4, swingTimer / (float)swingTime)); + if (inStartup) + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * 0.5f, -swingWidth * 0.75f, 1-MathF.Pow(1-StartupCompletion,2f))); + if (inCooldown) + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.25f, swingWidth * 0.33f, CooldownCompletion)); + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth *0.75f, swingWidth *0.25f, SwingCompletion)); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)