Adjusted Heavy Knockback and added a whitelist
This commit is contained in:
1 parent
3f22a29a5c
commit
a47390a778
94 files changed
+263
-89
No files matched your search
@@ -5267,6 +5267,9 @@ namespace CalamityMod.CalPlayer
|
||||
|
||||
if (titanHeartSet && StealthStrikeAvailable() && rogue)
|
||||
knockback *= TitanHeartMask.StealthStrikeKnockbackMult;
|
||||
|
||||
Player.GetKnockback<GenericDamageClass>() += 0.2f;
|
||||
//Player.GetKnockback<AverageDamageClass>().ApplyTo(1);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace CalamityMod.CalPlayer
|
||||
if (proj.IsMinionOrSentryRelated)
|
||||
center = proj.Center;
|
||||
Vector2 launchVel = Utils.DirectionTo(center, target.Center);
|
||||
target.MoveNPC(launchVel, proj.knockBack, true);
|
||||
target.MoveNPC(launchVel, proj.knockBack, true, Player);
|
||||
}
|
||||
|
||||
if (moscowMule || bloodyMary)
|
||||
|
||||
@@ -78,11 +78,11 @@ namespace CalamityMod.Items.Accessories
|
||||
|
||||
// If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries.
|
||||
// Otherwise, simply deal a large amount of damage to them if empowered.
|
||||
if (npc.CanBeMoved(true))
|
||||
if (npc.CanBeMoved())
|
||||
{
|
||||
// The NPC has to actually have its velocity changed, because TileCollisionHarmNPC only changes its position. Not confusing at all!
|
||||
Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f;
|
||||
npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true);
|
||||
npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true, player);
|
||||
|
||||
int scaledFallDamage = CalamityUtils.ScaleWithDifficulty(ShoveFallBaseDamage);
|
||||
var flungNPC = npc.GetGlobalNPC<CalamityTileCollisionHarmNPC>();
|
||||
|
||||
@@ -17,6 +17,7 @@ using Terraria.ModLoader.Utilities;
|
||||
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class CannonballJellyfish : ModNPC
|
||||
{
|
||||
public bool hasBeenHit = false;
|
||||
|
||||
@@ -15,6 +15,7 @@ using Terraria.ModLoader.Utilities;
|
||||
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class ChaoticPuffer : ModNPC
|
||||
{
|
||||
public bool puffedUp = false;
|
||||
|
||||
@@ -19,6 +19,7 @@ using Terraria.ModLoader.Utilities;
|
||||
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class ColossalSquid : ModNPC
|
||||
{
|
||||
public bool hasBeenHit = false;
|
||||
|
||||
@@ -26,6 +26,7 @@ using Terraria.ModLoader.Utilities;
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[LongDistanceNetSync]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class EidolonWyrmHead : ModNPC
|
||||
{
|
||||
private Vector2 patrolSpot = Vector2.Zero;
|
||||
|
||||
@@ -17,6 +17,7 @@ using Terraria.ModLoader.Utilities;
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[LongDistanceNetSync]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class GulperEelHead : ModNPC
|
||||
{
|
||||
private Vector2 patrolSpot = Vector2.Zero;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Terraria.ModLoader.Utilities;
|
||||
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class MirageJelly : ModNPC
|
||||
{
|
||||
private bool teleporting = false;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Terraria.ModLoader.Utilities;
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[LongDistanceNetSync]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class OarfishHead : ModNPC
|
||||
{
|
||||
private Vector2 patrolSpot = Vector2.Zero;
|
||||
|
||||
@@ -20,6 +20,7 @@ using Terraria.ModLoader.Utilities;
|
||||
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class ReaperShark : ModNPC
|
||||
{
|
||||
public static Asset<Texture2D> ManTexture;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Terraria.ModLoader.Utilities;
|
||||
|
||||
namespace CalamityMod.NPCs.Abyss
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class SlabCrab : ModNPC
|
||||
{
|
||||
enum AIState
|
||||
|
||||
@@ -6,6 +6,7 @@ using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class BloodwormFleeing : ModNPC
|
||||
{
|
||||
public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.BloodwormNormal.DisplayName");
|
||||
|
||||
@@ -10,6 +10,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class BloodwormNormal : ModNPC
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
|
||||
@@ -23,6 +23,7 @@ using Terraria.WorldBuilding;
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[AutoloadBossHead]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class CragmawMire : ModNPC
|
||||
{
|
||||
public enum CragmawAttackState
|
||||
|
||||
@@ -15,6 +15,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class FlakCrab : ModNPC
|
||||
{
|
||||
public Player Target => Main.player[NPC.target];
|
||||
|
||||
@@ -15,6 +15,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class GammaSlime : ModNPC
|
||||
{
|
||||
public float DustAngleMultiplier1;
|
||||
|
||||
@@ -21,6 +21,7 @@ using Terraria.WorldBuilding;
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[AutoloadBossHead]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class Mauler : ModNPC
|
||||
{
|
||||
// TODO -- Potentially add another attack in higher difficulty modes at some point?
|
||||
|
||||
@@ -19,6 +19,7 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[AutoloadBossHead]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class NuclearTerror : ModNPC
|
||||
{
|
||||
public enum SpecialAttackState
|
||||
|
||||
@@ -18,6 +18,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.AcidRain
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class SulphurousSkater : ModNPC
|
||||
{
|
||||
public bool Flying = false;
|
||||
|
||||
@@ -19,6 +19,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.Astral
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class AstralachneaWall : ModNPC
|
||||
{
|
||||
public static Asset<Texture2D> glowmask;
|
||||
|
||||
@@ -16,6 +16,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.Astral
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class SightseerSpitter : ModNPC
|
||||
{
|
||||
public static Asset<Texture2D> glowmask;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.AstrumAureus
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class AureusSpawn : ModNPC
|
||||
{
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
@@ -3182,7 +3182,7 @@ namespace CalamityMod.NPCs
|
||||
SoundEngine.PlaySound(fullPower with { Volume = 0.7f, Pitch = 0.7f }, npc.Center);
|
||||
warbannerBurnStacks++;
|
||||
}
|
||||
if (warbannerBurnIntensity > 2.5f && npc.CanBeMoved(true))
|
||||
if (warbannerBurnIntensity > 2.5f && npc.CanBeMoved())
|
||||
{
|
||||
npc.velocity *= 1f - 0.25f * Utils.GetLerpValue(2.5f, 3, warbannerBurnIntensity);
|
||||
if (npc.velocity.Length() > 5 && warbannerBurnIntensity > 2.85f) // Repel leaping enemies
|
||||
@@ -3358,7 +3358,7 @@ namespace CalamityMod.NPCs
|
||||
pearlAuraOwner = -1;
|
||||
}
|
||||
|
||||
if (demonSwordImpales > 0 && npc.CanBeMoved(true))
|
||||
if (demonSwordImpales > 0 && npc.CanBeMoved())
|
||||
{
|
||||
npc.velocity *= Utils.Remap(demonSwordImpales, 1, 5, 0.95f, 0.3f, true);
|
||||
if (impalePacketTimer > 30) // There's probably a better solution, but this is the best for now
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using CalamityMod.Balancing;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
public sealed class CalamityHeavyKnockbackWhitelist : GlobalNPC
|
||||
{
|
||||
// General rule of thumb I used for this is to not put it on anything that is a stationary entity (EX: Tesla Turrets, Antlions, Hive Cysts)
|
||||
// No putting it on any bosses, though boss minions are fair game when applicable (no stuff like Scal hearts obviously, sending them into the void would be bad)
|
||||
internal static HashSet<int> whitelistNPC;
|
||||
public override void Load()
|
||||
{
|
||||
whitelistNPC = new();
|
||||
}
|
||||
public override void Unload()
|
||||
{
|
||||
whitelistNPC?.Clear();
|
||||
whitelistNPC = null;
|
||||
}
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
// Add vanilla enemies to the whitelist
|
||||
whitelistNPC.Add(NPCID.AncientCultistSquidhead);
|
||||
whitelistNPC.Add(NPCID.DesertDjinn);
|
||||
whitelistNPC.Add(NPCID.DD2DrakinT2);
|
||||
whitelistNPC.Add(NPCID.DD2DrakinT3);
|
||||
whitelistNPC.Add(NPCID.DungeonGuardian);
|
||||
whitelistNPC.Add(NPCID.GrayGrunt);
|
||||
whitelistNPC.Add(NPCID.HeadlessHorseman);
|
||||
whitelistNPC.Add(NPCID.LihzahrdCrawler);
|
||||
whitelistNPC.Add(NPCID.MartianProbe);
|
||||
whitelistNPC.Add(NPCID.MartianWalker);
|
||||
whitelistNPC.Add(NPCID.Paladin);
|
||||
whitelistNPC.Add(NPCID.PirateCaptain);
|
||||
whitelistNPC.Add(NPCID.ShadowFlameApparition);
|
||||
whitelistNPC.Add(NPCID.ThePossessed);
|
||||
whitelistNPC.Add(NPCID.EyeballFlyingFish);
|
||||
whitelistNPC.Add(NPCID.Yeti);
|
||||
whitelistNPC.Add(NPCID.ZombieMerman);
|
||||
whitelistNPC.Add(NPCID.FungiBulb);
|
||||
whitelistNPC.Add(NPCID.GiantFungiBulb);
|
||||
whitelistNPC.Add(NPCID.ManEater);
|
||||
whitelistNPC.Add(NPCID.Snatcher);
|
||||
whitelistNPC.Add(NPCID.BloodEelHead);
|
||||
whitelistNPC.Add(NPCID.BoneSerpentHead);
|
||||
whitelistNPC.Add(NPCID.DevourerHead);
|
||||
whitelistNPC.Add(NPCID.DiggerHead);
|
||||
whitelistNPC.Add(NPCID.DuneSplicerHead);
|
||||
whitelistNPC.Add(NPCID.GiantWormHead);
|
||||
whitelistNPC.Add(NPCID.LeechHead);
|
||||
whitelistNPC.Add(NPCID.StardustWormHead);
|
||||
whitelistNPC.Add(NPCID.CultistDragonHead);
|
||||
whitelistNPC.Add(NPCID.AncientCultistSquidhead);
|
||||
whitelistNPC.Add(NPCID.TombCrawlerHead);
|
||||
whitelistNPC.Add(NPCID.TruffleWormDigger);
|
||||
whitelistNPC.Add(NPCID.SeekerHead);
|
||||
whitelistNPC.Add(NPCID.WyvernHead);
|
||||
whitelistNPC.Add(NPCID.Creeper); // Here because they gain KB immunity in multiplayer
|
||||
whitelistNPC.Add(NPCID.TheHungry); // Here because they gain KB immunity in multiplayer
|
||||
whitelistNPC.Add(NPCID.TheHungryII); // Here because they gain KB immunity in multiplayer
|
||||
whitelistNPC.Add(NPCID.DD2DarkMageT1);
|
||||
whitelistNPC.Add(NPCID.DD2DarkMageT3);
|
||||
whitelistNPC.Add(NPCID.DD2OgreT2);
|
||||
whitelistNPC.Add(NPCID.DD2OgreT3);
|
||||
whitelistNPC.Add(NPCID.MourningWood);
|
||||
whitelistNPC.Add(NPCID.Pumpking);
|
||||
whitelistNPC.Add(NPCID.Everscream);
|
||||
whitelistNPC.Add(NPCID.SantaNK1);
|
||||
whitelistNPC.Add(NPCID.IceQueen);
|
||||
whitelistNPC.Add(NPCID.MartianSaucerCore);
|
||||
whitelistNPC.Add(NPCID.Sharkron);
|
||||
whitelistNPC.Add(NPCID.Sharkron2);
|
||||
// Below are enemies Calamity gives KB immunity, but that aren't KB immune in vanilla
|
||||
whitelistNPC.Add(NPCID.Mothron);
|
||||
whitelistNPC.Add(NPCID.BigMimicCorruption);
|
||||
whitelistNPC.Add(NPCID.BigMimicCrimson);
|
||||
whitelistNPC.Add(NPCID.BigMimicHallow);
|
||||
whitelistNPC.Add(NPCID.BigMimicJungle);
|
||||
whitelistNPC.Add(NPCID.SolarCorite);
|
||||
whitelistNPC.Add(NPCID.CrimsonAxe);
|
||||
whitelistNPC.Add(NPCID.CursedHammer);
|
||||
whitelistNPC.Add(NPCID.EnchantedSword);
|
||||
whitelistNPC.Add(NPCID.GiantTortoise);
|
||||
whitelistNPC.Add(NPCID.IceTortoise);
|
||||
whitelistNPC.Add(NPCID.GoblinSummoner);
|
||||
whitelistNPC.Add(NPCID.Butcher);
|
||||
|
||||
var npcs = GetContent<ModNPC>();
|
||||
foreach (var npc in npcs)
|
||||
{
|
||||
try
|
||||
{
|
||||
var type = npc.GetType();
|
||||
var whitelisted = type.GetCustomAttribute<HeavyKnockbackWhitelistedAttribute>();
|
||||
if (whitelisted != null)
|
||||
{
|
||||
int npcType = npc.Type;
|
||||
whitelistNPC.Add(npcType);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CalamityMod.Log.Error($"Exception thrown while evaluating type \"{npc.FullName}\": {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.Crags
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class HeatSpirit : ModNPC
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
|
||||
@@ -13,6 +13,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.DraedonLabThings
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class Androomba : ModNPC
|
||||
{
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.DraedonLabThings
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class RepairUnitCritter : ModNPC
|
||||
{
|
||||
public enum BehaviorState
|
||||
|
||||
@@ -20,6 +20,7 @@ using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.GreatSandShark
|
||||
{
|
||||
[AutoloadBossHead]
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class GreatSandShark : ModNPC
|
||||
{
|
||||
private bool resetAI = false;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace CalamityMod.NPCs
|
||||
{
|
||||
/// <summary>
|
||||
/// This attribute puts an NPC into the heavy knockback whitelist
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
|
||||
public sealed class HeavyKnockbackWhitelistedAttribute : Attribute
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class AuroraSpirit : ModNPC
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
|
||||
@@ -8,6 +8,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class PlanterasFreeTentacle : ModNPC
|
||||
{
|
||||
public override string Texture => $"Terraria/Images/NPC_{NPCID.PlanterasTentacle}";
|
||||
|
||||
@@ -12,6 +12,7 @@ using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.Utilities;
|
||||
namespace CalamityMod.NPCs.NormalNPCs
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class ScornEater : ModNPC
|
||||
{
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.OldDuke
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class SulphurousSharkron : ModNPC
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
|
||||
@@ -14,6 +14,7 @@ using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.NPCs.PlaguebringerGoliath
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class PlagueHomingMissile : ModNPC
|
||||
{
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
@@ -12,6 +12,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.NPCs.Signus
|
||||
{
|
||||
[HeavyKnockbackWhitelisted]
|
||||
public class CosmicLantern : ModNPC
|
||||
{
|
||||
public static Asset<Texture2D> GlowTexture;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650)
|
||||
if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650)
|
||||
{
|
||||
Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX);
|
||||
target.velocity = moveDir;
|
||||
@@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1))
|
||||
if (target != null && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1))
|
||||
{
|
||||
if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 300)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = (Projectile.ai[2] == 5 ? 35 : 14);
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
|
||||
if (Projectile.ai[2] == 5)
|
||||
modifiers.SetCrit();
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
{
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 25;
|
||||
targeted.MoveNPC(launchVel, launchPower, true);
|
||||
targeted.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
time++;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 40;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target != null && target.CanBeMoved(true))
|
||||
if (target != null && target.CanBeMoved())
|
||||
{
|
||||
if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 500)
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 20;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
|
||||
@@ -52,6 +52,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Particle spark = new GlowSparkParticle(Projectile.Center, Projectile.velocity, false, 8, MathHelper.Clamp(0.06f - Projectile.numHits * 0.01f, 0f, 0.06f), Effects.ArsenalEffects.ArsenalGaussColor * 0.9f, new Vector2(1f, 0.5f), true, true, 0.9f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
@@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 6;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
float distMult = Utils.GetLerpValue(400, 10, Utils.Distance(target.Center, Projectile.Center), true);
|
||||
Vector2 launchVel = startVel;
|
||||
target.MoveNPC(launchVel, 10 + 35 * distMult, true);
|
||||
target.MoveNPC(launchVel, 10 + 35 * distMult, true, Owner);
|
||||
|
||||
if (Projectile.numHits == 0)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 12, true);
|
||||
target.MoveNPC(launchVel, 12, true, Owner);
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
target.AddBuff(ModContent.BuffType<StaticDischarge>(), 40);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 8, false);
|
||||
target.MoveNPC(launchVel, 8, false, Owner);
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
|
||||
@@ -60,11 +60,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
impactDust();
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 4;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
|
||||
@@ -128,11 +128,12 @@ namespace CalamityMod.Projectiles.DraedonsArsenal
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
impactDust();
|
||||
|
||||
Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
float launchPower = 12;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
|
||||
@@ -98,6 +98,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
if (frigidFlash)
|
||||
{
|
||||
target.AddBuff(BuffID.OnFire3, 30);
|
||||
@@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
modifiers.SourceDamage *= damageMult * (frigidFlash ? 0.5f : 1); // Frigidflash explosion are spawned at full power, so their damage is reduced here
|
||||
|
||||
// The vortex sucks in enemies
|
||||
target.MoveNPC(-pushVelocity, customKnockback, frigidFlash);
|
||||
target.MoveNPC(-pushVelocity, customKnockback, frigidFlash, Owner);
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
|
||||
Vector2 launchVel = (Owner.Center - target.Center).SafeNormalize(Vector2.UnitY) * -10 * (launched ? 0.5f : 1);
|
||||
target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true);
|
||||
target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true, Owner);
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true);
|
||||
target.MoveNPC(launchVel, 10 * (launched ? 0.5f : 1), true, Owner);
|
||||
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 40, true);
|
||||
target.MoveNPC(launchVel, 40, true, Owner);
|
||||
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.95f);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 20, true);
|
||||
target.MoveNPC(launchVel, 20, true, Owner);
|
||||
|
||||
if (Projectile.numHits > 0)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.9f);
|
||||
|
||||
@@ -266,11 +266,11 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
|
||||
// Might launches enemies
|
||||
if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Might && target.CanBeMoved(false))
|
||||
if (GetSoulEffects((int)Projectile.ai[0]) == SoulType.Might && target.CanBeMoved())
|
||||
{
|
||||
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
||||
Vector2 launchVel = Utils.DirectionTo(owner.Center, owner.Calamity().mouseWorld) - Vector2.UnitY * 5f;
|
||||
target.MoveNPC(launchVel, SHPC.MightKnockbackStrength, false);
|
||||
target.MoveNPC(launchVel, SHPC.MightKnockbackStrength, false, owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,13 +75,13 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
// Might launches enemies
|
||||
if (SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Might && target.CanBeMoved(false))
|
||||
if (SHPB.GetSoulEffects((int)Projectile.ai[0]) == SHPB.SoulType.Might && target.CanBeMoved())
|
||||
{
|
||||
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
||||
Player owner = Main.player[Projectile.owner];
|
||||
Vector2 launchVel = Utils.DirectionTo(owner.Center, owner.Calamity().mouseWorld) - Vector2.UnitY * 5f;
|
||||
|
||||
target.MoveNPC(launchVel, SHPC.MightKnockbackStrength, false);
|
||||
target.MoveNPC(launchVel, SHPC.MightKnockbackStrength, false, owner);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
target.AddBuff(ModContent.BuffType<Irradiated>(), 300);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 14f, true);
|
||||
target.MoveNPC(launchVel, 14f, true, Owner);
|
||||
|
||||
for (int i = 0; i < MathHelper.Clamp(15 - Projectile.numHits * 3, 2, 15); i++)
|
||||
{
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.7f }, Projectile.Center);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 7, true);
|
||||
target.MoveNPC(launchVel, 7, true, Owner);
|
||||
|
||||
for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++)
|
||||
{
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 40, true);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 40, true, Owner);
|
||||
|
||||
if (target.Calamity().demonSwordImpales != 0 || Projectile.numHits == 0)
|
||||
{
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 20, true);
|
||||
target.MoveNPC(launchVel, 20, true, Owner);
|
||||
}
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
armoredHits++;
|
||||
|
||||
Vector2 launchVel = (Projectile.ai[1] != 1 ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Utils.DirectionTo(Owner.Center, target.Center));
|
||||
target.MoveNPC(launchVel, 37, true);
|
||||
target.MoveNPC(launchVel, 37, true, Owner);
|
||||
|
||||
if (spawnBoom)
|
||||
{
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 23, true);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 23, true, Owner);
|
||||
|
||||
int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12);
|
||||
for (int i = 0; i < dustNum; i++)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Cooldowns;
|
||||
@@ -307,7 +307,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 17, true);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 17, true, Owner);
|
||||
|
||||
int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12);
|
||||
for (int i = 0; i < dustNum; i++)
|
||||
|
||||
@@ -293,7 +293,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
|
||||
// Regular knockback
|
||||
float launchPower = 60;
|
||||
target.MoveNPC(toMouse, launchPower * (canBeLaunched ? 0.5f : 0.25f), true);
|
||||
target.MoveNPC(toMouse, launchPower * (canBeLaunched ? 0.5f : 0.25f), true, Owner);
|
||||
if (canBeLaunched) // launches/executes enemies
|
||||
{
|
||||
if (jared)
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
armoredHits++;
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 8, true);
|
||||
target.MoveNPC(launchVel, 8, true, Owner);
|
||||
|
||||
if (spawnBoom)
|
||||
{
|
||||
|
||||
@@ -390,7 +390,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true);
|
||||
target.MoveNPC(launchVel, (chargedSwing ? 24 : 19), true, Owner);
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
|
||||
@@ -438,7 +438,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, (chargedSwing ? 35 : 23), true);
|
||||
target.MoveNPC(launchVel, (chargedSwing ? 35 : 23), true, Owner);
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 15, true);
|
||||
target.MoveNPC(launchVel, 15, true, Owner);
|
||||
|
||||
for (int i = 0; i < MathHelper.Clamp(6 - Projectile.numHits * 2, 2, 6); i++)
|
||||
{
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
target.AddBuff(BuffID.OnFire3, 180);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 12, true);
|
||||
CalamityUtils.MoveNPC(target, launchVel, 12, true, Owner);
|
||||
|
||||
int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12);
|
||||
for (int i = 0; i < dustNum; i++)
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Melee.Shortswords
|
||||
Particle boostRing = new CustomSpark(position, velocity, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, lifetime, scale, color, stretch, shrinkSpeed: shrink);
|
||||
GeneralParticleHandler.SpawnParticle(boostRing);
|
||||
|
||||
if (stabbedNPC.CanBeMoved(true))
|
||||
if (stabbedNPC.CanBeMoved())
|
||||
{
|
||||
stabbedNPC.velocity = -Owner.velocity;
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.65f, Pitch = 0.4f }, Projectile.Center);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 23, true);
|
||||
target.MoveNPC(launchVel, 23, true, Owner);
|
||||
|
||||
target.AddBuff(BuffID.Electrified, 230);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
SoundEngine.PlaySound(fire2 with { Volume = 0.55f, Pitch = 0.6f }, Projectile.Center);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 17, true);
|
||||
target.MoveNPC(launchVel, 17, true, Owner);
|
||||
|
||||
for (int i = 0; i < MathHelper.Clamp(10 - Projectile.numHits * 2, 2, 10); i++)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Projectile.Center);
|
||||
target.MoveNPC(launchVel, 5, false);
|
||||
target.MoveNPC(launchVel, 5, false, Owner);
|
||||
|
||||
Vector2 dustVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
for (int i = 0; i < 3; i++)
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
// Launch
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 6, true);
|
||||
target.MoveNPC(launchVel, 6, true, Owner);
|
||||
|
||||
MakeBlast(target.whoAmI, true);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 20, true);
|
||||
target.MoveNPC(launchVel, 20, true, Owner);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
Vector2 launchVel = Projectile.Center.DirectionTo(target.Center);
|
||||
float launchPower = 20;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 450, targetHitbox);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
Vector2 launchVel = Projectile.velocity;
|
||||
float launchPower = 60;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override bool? CanDamage() => Projectile.numHits < 1 ? null : false;
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
|
||||
@@ -343,7 +343,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Vector2 launchDir = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
float launchPower = ((hasReachedFullCharge ? 9 : 0) + charge * 1.5f) * finalHitMult;
|
||||
|
||||
target.MoveNPC(launchDir, launchPower, true);
|
||||
target.MoveNPC(launchDir, launchPower, true, Owner);
|
||||
|
||||
float extraPitch = (Owner.Calamity().rogueStealthMax > 0 ? (0.25f * (Owner.Calamity().rogueStealth / Owner.Calamity().rogueStealthMax)) : 0);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
float minMult = 0.35f;
|
||||
int hitsToMinMult = 15;
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
@@ -32,7 +33,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY;
|
||||
float launchPower = (Projectile.Calamity().stealthStrike ? 4f : 1) * 10;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if (hitTimer == 0)
|
||||
hitTimer = Projectile.localNPCHitCooldown;
|
||||
|
||||
if (target.CanBeMoved(true))
|
||||
if (target.CanBeMoved())
|
||||
target.velocity *= 0.05f;
|
||||
}
|
||||
public override bool? CanDamage() => canDamage ? null : false;
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target != null && target.active && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < maxPullDistance)
|
||||
if (target != null && target.active && target.CanBeMoved() && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < maxPullDistance)
|
||||
{
|
||||
if (target.whoAmI == stuckNPC)
|
||||
continue;
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target.CanBeMoved(true) && target.CanBeChasedBy(Projectile, false))
|
||||
if (target.CanBeMoved() && target.CanBeChasedBy(Projectile, false))
|
||||
{
|
||||
if (Vector2.Distance(target.Center, Projectile.Center) > 40 && Vector2.Distance(target.Center, Projectile.Center) < 600)
|
||||
{
|
||||
@@ -212,7 +212,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 30, true);
|
||||
target.MoveNPC(launchVel, 30, true, Owner);
|
||||
|
||||
target.AddBuff(ModContent.BuffType<MiracleBlight>(), 90);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target.CanBeMoved(true) && target.CanBeChasedBy(Projectile, false))
|
||||
if (target.CanBeMoved() && target.CanBeChasedBy(Projectile, false))
|
||||
{
|
||||
if (target != null && !CalamityPlayer.areThereAnyDamnBosses)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 60, true);
|
||||
target.MoveNPC(launchVel, 60, true, Owner);
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) // Add to regular plz
|
||||
|
||||
@@ -65,11 +65,12 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
target.AddBuff(BuffID.Wet, 300);
|
||||
target.AddBuff(ModContent.BuffType<RiptideDebuff>(), 300);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
target.MoveNPC(launchVel, 9, true);
|
||||
target.MoveNPC(launchVel, 9, true, Owner);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center);
|
||||
target.MoveNPC(launchVel, (MinionBuffMode ? 5f : 0.5f), false);
|
||||
target.MoveNPC(launchVel, (MinionBuffMode ? 5f : 0.5f), false, Owner);
|
||||
}
|
||||
public override bool MinionContactDamage() => !Reforming;
|
||||
}
|
||||
|
||||
@@ -64,16 +64,14 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
target.AddBuff((int)(Projectile.localAI[2]), (int)(Projectile.localAI[1]));
|
||||
}
|
||||
pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback;
|
||||
pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
float minMult = Projectile.ai[1];
|
||||
int hitsToMinMult = (int)Projectile.ai[2];
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
if (customKnockback != 0 && target.CanBeMoved(hasStongDisplacement))
|
||||
{
|
||||
target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1));
|
||||
}
|
||||
if (customKnockback != 0)
|
||||
target.MoveNPC(pushVelocity, customKnockback, hasStongDisplacement, Main.player[Projectile.owner]);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
|
||||
@@ -62,16 +62,14 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
target.AddBuff((int)(Projectile.localAI[1]), (int)(Projectile.localAI[2]));
|
||||
}
|
||||
pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center) * customKnockback;
|
||||
pushVelocity = Utils.DirectionTo(Projectile.Center, target.Center);
|
||||
float minMult = Projectile.ai[1];
|
||||
int hitsToMinMult = (int)Projectile.ai[2];
|
||||
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
if (customKnockback != 0 && target.CanBeMoved(hasStongDisplacement))
|
||||
{
|
||||
target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1));
|
||||
}
|
||||
if (customKnockback != 0)
|
||||
target.MoveNPC(pushVelocity, customKnockback, hasStongDisplacement, Main.player[Projectile.owner]);
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center) - Vector2.UnitY;
|
||||
float launchPower = 9;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox);
|
||||
public override bool? CanDamage()
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
// HADAL and VOID have knockback, GRAVEL has it's knockback on the explosion
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY;
|
||||
float launchPower = 7f;
|
||||
target.MoveNPC(launchVel, launchPower, false);
|
||||
target.MoveNPC(launchVel, launchPower, false, Owner);
|
||||
|
||||
if (visuals)
|
||||
{
|
||||
|
||||
@@ -57,9 +57,9 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
if (projHitbox.Intersects(targetHitbox))
|
||||
{
|
||||
NPC target = Main.npc[(int)Projectile.ai[0]];
|
||||
if (pushVelocity != Vector2.Zero && pushVelocity.X < 255f && !invalidTarget && target.CanBeMoved(hasStongDisplacement))
|
||||
if (pushVelocity != Vector2.Zero && pushVelocity.X < 255f && !invalidTarget)
|
||||
{
|
||||
target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1));
|
||||
target.MoveNPC(pushVelocity, pushVelocity.Length(), hasStongDisplacement, Main.player[Projectile.owner]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
target.AddBuff(ModContent.BuffType<Buffs.DamageOverTime.RiptideDebuff>(), 180);
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 20, true);
|
||||
target.MoveNPC(launchVel, 20, true, Owner);
|
||||
|
||||
for (int i = 0; i <= 17; i++)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
target.MoveNPC(launchVel, 15, true);
|
||||
target.MoveNPC(launchVel, 15, true, Owner);
|
||||
}
|
||||
|
||||
public override bool? CanCutTiles() => false;
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center) - Vector2.UnitY;
|
||||
float launchPower = 6;
|
||||
target.MoveNPC(launchVel, launchPower, true);
|
||||
target.MoveNPC(launchVel, launchPower, true, Owner);
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox);
|
||||
public override bool? CanDamage()
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
{
|
||||
target.AddBuff(BuffID.Wet, 180);
|
||||
Vector2 launchVel = Utils.DirectionTo(Owner.Center, target.Center) + Vector2.UnitY * -0.75f;
|
||||
target.MoveNPC(launchVel, 12, false);
|
||||
target.MoveNPC(launchVel, 12, false, Owner);
|
||||
}
|
||||
public override bool? CanCutTiles() => false;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
else
|
||||
modifiers.SourceDamage *= 0.2f;
|
||||
|
||||
target.MoveNPC(Utils.DirectionTo(Owner.Center, target.Center), (poweredTimer == 0 ? 7 : 3));
|
||||
target.MoveNPC(Utils.DirectionTo(Owner.Center, target.Center), (poweredTimer == 0 ? 7 : 3), false, Owner);
|
||||
|
||||
if (Projectile.numHits == 0 && poweredTimer == 0)
|
||||
{
|
||||
|
||||
+21
-11
@@ -1,12 +1,18 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using CalamityMod.Balancing;
|
||||
using CalamityMod.Balancing;
|
||||
using CalamityMod.CalPlayer;
|
||||
using CalamityMod.DataStructures;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Events;
|
||||
using CalamityMod.Items.Accessories;
|
||||
using CalamityMod.Items.Armor;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.NPCs.NormalNPCs;
|
||||
using CalamityMod.NPCs.OldDuke;
|
||||
@@ -16,17 +22,22 @@ using CalamityMod.NPCs.SunkenSea;
|
||||
using CalamityMod.NPCs.Yharon;
|
||||
using CalamityMod.Packets;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.Systems.Collections;
|
||||
using CalamityMod.World;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Chat;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent;
|
||||
using Terraria.ID;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
using static Terraria.ModLoader.ModContent;
|
||||
|
||||
namespace CalamityMod
|
||||
@@ -732,14 +743,11 @@ namespace CalamityMod
|
||||
/// </summary>
|
||||
/// <param name="target">The NPC attacked.</param>
|
||||
/// <returns>Whether or not the NPC can be moved around.</returns>
|
||||
public static bool CanBeMoved(this NPC target, bool ignoreKBImmune = false)
|
||||
public static bool CanBeMoved(this NPC target)
|
||||
{
|
||||
// Ideally we can replace [!CalamityPlayer.areThereAnyDamnBosses] with a check for problematic boss minions so that you can knock back regular ones in bossfights.
|
||||
// For now at least, when a boss is alive it will always fail to knockback enemies with 100% kb resist.
|
||||
if (CalamityPlayer.areThereAnyDamnBosses)
|
||||
ignoreKBImmune = false;
|
||||
bool isAPillar = target.type == NPCID.LunarTowerSolar || target.type == NPCID.LunarTowerVortex || target.type == NPCID.LunarTowerNebula || target.type == NPCID.LunarTowerStardust;
|
||||
if (!isAPillar && !target.boss && target.IsAnEnemy(true, true, false) && (ignoreKBImmune || target.knockBackResist > 0))
|
||||
bool whitelisted = CalamityHeavyKnockbackWhitelist.whitelistNPC.Contains(target.type);
|
||||
|
||||
if ((target.knockBackResist != 0 || whitelisted) && target.IsAnEnemy(true, true, false))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -748,13 +756,15 @@ namespace CalamityMod
|
||||
/// </summary>
|
||||
/// <param name="target">The NPC being moved.</param>
|
||||
/// <param name="ignoreKBImmune">Whether or not NPC's that normally have knockback immunity can be moved around.</param>
|
||||
public static void MoveNPC(this NPC target, Vector2 direction, float strength, bool ignoreKBImmune = false)
|
||||
public static void MoveNPC(this NPC target, Vector2 direction, float strength, bool heavyKnockback = false, Player attacker = null)
|
||||
{
|
||||
if (target.CanBeMoved(ignoreKBImmune))
|
||||
if (target.CanBeMoved())
|
||||
{
|
||||
Vector2 launchVel = direction.SafeNormalize(Vector2.UnitX) * strength;
|
||||
float knockbackMult = Utils.Remap(target.knockBackResist, 0, 1, 0.5f, 1f, false);
|
||||
target.velocity = launchVel * (knockbackMult > 1 ? (float)Math.Pow(knockbackMult, 10) : knockbackMult);
|
||||
float playerKnockbackMult = attacker != null ? (attacker.GetTotalKnockback<GenericDamageClass>().ApplyTo(1)) : 1;
|
||||
Main.NewText(attacker.GetKnockback<GenericDamageClass>().ApplyTo(1));
|
||||
float knockbackMult = playerKnockbackMult * (heavyKnockback ? Math.Max(target.knockBackResist, 1) : target.knockBackResist); // Heavy knockback ignores knockback resist (but not knockback weakness)
|
||||
target.velocity = launchVel * knockbackMult;
|
||||
target.SyncMotionToServer();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user