From 3587f8a538270305561291fdfdb261a7aa3dd877 Mon Sep 17 00:00:00 2001
From: Memes <114233643+Mr-Memes@users.noreply.github.com>
Date: Mon, 27 Nov 2023 18:52:28 +0100
Subject: [PATCH] Bad ideas fixed @ BaseMinionProjectile.cs (No Changelog).
---
.../BaseProjectiles/BaseMinionProjectile.cs | 14 ++++++++++----
Projectiles/Summon/BelladonnaSpirit.cs | 4 ++--
Projectiles/Summon/CalamarisLamentMinion.cs | 2 +-
Projectiles/Summon/MutatedTruffleMinion.cs | 2 +-
4 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs
index 06d75c4595..06aebb26f5 100644
--- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs
+++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs
@@ -44,9 +44,15 @@ namespace CalamityMod.Projectiles.BaseProjectiles
/// is set to this value.
/// Defaults to 1200f (75 tiles).
///
- public virtual float MaxEnemyDistanceDetection => 1200f;
- private const float MinEnemyDistanceDetection = 960f;
- private float AdaptiveEnemyDistanceDetection => Target == null ? MinEnemyDistanceDetection : MaxEnemyDistanceDetection;
+ public virtual float EnemyDistanceDetection => 1200f;
+
+ ///
+ /// The min distance in which the minion can detect an enemy before it goes to its correspondent enemy distance detection.
+ /// Defaults to 960f (60 tiles), the radius of a 1080p monitor at max zoom.
+ ///
+ public virtual float MinEnemyDistanceDetection => 960f;
+
+ private float AdaptiveEnemyDistanceDetection => Target == null ? MinEnemyDistanceDetection : EnemyDistanceDetection;
///
/// The amount of local I-Frames this minion has.
@@ -103,7 +109,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
ProjectileID.Sets.MinionTargettingFeature[Type] = true;
ProjectileID.Sets.TrailingMode[Type] = TrailingMode;
ProjectileID.Sets.TrailCacheLength[Type] = TrailCacheLength;
- ProjectileID.Sets.DrawScreenCheckFluff[Type] = (int)MaxEnemyDistanceDetection;
+ ProjectileID.Sets.DrawScreenCheckFluff[Type] = (int)EnemyDistanceDetection;
}
public override void SetDefaults()
diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs
index d4693f2afe..ef34e10b5d 100644
--- a/Projectiles/Summon/BelladonnaSpirit.cs
+++ b/Projectiles/Summon/BelladonnaSpirit.cs
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon
public void FollowPlayer()
{
// If the minion starts to get far, force the minion to go to you.
- if (Projectile.WithinRange(Owner.Center, MaxEnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, 300f))
+ if (Projectile.WithinRange(Owner.Center, EnemyDistanceDetection) && !Projectile.WithinRange(Owner.Center, 300f))
Projectile.velocity = (Owner.Center - Projectile.Center) / 30f;
// The minion will change directions to you if it's going away from you, meaning it'll just hover around you.
@@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Summon
Projectile.velocity = (Projectile.velocity * 37f + Projectile.SafeDirectionTo(Owner.Center) * 17f) / 40f;
// Teleport to the owner if sufficiently far away.
- if (!Projectile.WithinRange(Owner.Center, MaxEnemyDistanceDetection))
+ if (!Projectile.WithinRange(Owner.Center, EnemyDistanceDetection))
{
Projectile.position = Owner.Center;
Projectile.velocity *= 0.3f;
diff --git a/Projectiles/Summon/CalamarisLamentMinion.cs b/Projectiles/Summon/CalamarisLamentMinion.cs
index 0c96eefb66..5ace23037d 100644
--- a/Projectiles/Summon/CalamarisLamentMinion.cs
+++ b/Projectiles/Summon/CalamarisLamentMinion.cs
@@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon
public override ref bool AssociatedMinionBool => ref ModdedOwner.CalamarisLament;
// Increased to be able to target DoG reliably.
- public override float MaxEnemyDistanceDetection => CalamarisLament.EnemyDistanceDetection;
+ public override float EnemyDistanceDetection => CalamarisLament.EnemyDistanceDetection;
// It's an Abyss-origin summon, it deserves having visibility in Abyss areas.
public override bool PreventTargettingUntilTargetHit => false;
diff --git a/Projectiles/Summon/MutatedTruffleMinion.cs b/Projectiles/Summon/MutatedTruffleMinion.cs
index 261475ce60..6b7a38f393 100644
--- a/Projectiles/Summon/MutatedTruffleMinion.cs
+++ b/Projectiles/Summon/MutatedTruffleMinion.cs
@@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Summon
public override int AssociatedBuffTypeID => ModContent.BuffType();
public override ref bool AssociatedMinionBool => ref ModdedOwner.MutatedTruffleBool;
public override float MinionSlots => 3f;
- public override float MaxEnemyDistanceDetection => MutatedTruffle.EnemyDistanceDetection;
+ public override float EnemyDistanceDetection => MutatedTruffle.EnemyDistanceDetection;
public enum AIState { Idle, Dashing, Toothball, Vortex }
public AIState State { get => (AIState)Projectile.ai[0]; set => Projectile.ai[0] = (int)value; }