diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 3afbc4ee95..d52ad84fac 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -148,9 +148,6 @@ namespace CalamityMod.Balancing // 40% resist to Cryophobia. NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 40% resist to SHPC. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 30% resist to Meowthrower. NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index ae1ce55ee6..590cc74fcd 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -62,17 +62,17 @@ // Dodge cooldowns (in frames) // TODO -- Some of these could be moved to the respective item files - internal static readonly int BeltDodgeCooldownMin = 900; + internal static readonly int BeltDodgeCooldownMin = 1200; internal static readonly int BeltDodgeCooldownMax = 5400; - internal static readonly int BrainDodgeCooldownMin = 900; + internal static readonly int BrainDodgeCooldownMin = 1200; internal static readonly int BrainDodgeCooldownMax = 5400; - internal static readonly int AmalgamDodgeCooldownMin = 900; + internal static readonly int AmalgamDodgeCooldownMin = 1200; internal static readonly int AmalgamDodgeCooldownMax = 5400; - internal static readonly int MirrorDodgeCooldownMin = 900; + internal static readonly int MirrorDodgeCooldownMin = 1200; internal static readonly int MirrorDodgeCooldownMax = 5400; - internal static readonly int DaedalusReflectCooldownMin = 900; + internal static readonly int DaedalusReflectCooldownMin = 1200; internal static readonly int DaedalusReflectCooldownMax = 5400; - internal static readonly int EvolutionReflectCooldownMin = 900; + internal static readonly int EvolutionReflectCooldownMin = 1200; internal static readonly int EvolutionReflectCooldownMax = 5400; #endregion diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 4d17ef4b27..c09847564f 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -102,6 +102,10 @@ namespace CalamityMod.Buffs { player.GetDamage() -= 0.2f; } + else if (type == BuffID.Werewolf) + { + player.GetAttackSpeed() -= 0.051f; + } } public override void Update(int type, NPC npc, ref int buffIndex) diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs new file mode 100644 index 0000000000..340845ce9e --- /dev/null +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -0,0 +1,74 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class HeavyBleeding : ModBuff + { + public override void SetStaticDefaults() + { + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffID.Sets.LongerExpertDebuff[Type] = true; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().heavybleeding = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().heavybleeding < npc.buffTime[buffIndex]) + npc.Calamity().heavybleeding = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + internal static void DrawEffects(PlayerDrawSet drawInfo) + { + Player player = drawInfo.drawPlayer; + var modPlayer = player.Calamity(); + + if (Main.rand.NextBool(3)) + { + Vector2 randVel = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); + Dust dust = Dust.NewDustPerfect(modPlayer.RandomDebuffVisualSpot, 5, randVel * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.6f, 0.9f)); + dust.noGravity = false; + Particle spark = new AltSparkParticle(modPlayer.RandomDebuffVisualSpot, randVel + new Vector2(0, -4), true, 12, Main.rand.NextFloat(0.25f, 0.6f), Color.DarkRed * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Main.rand.NextBool(8)) + { + Particle spark = new GlowOrbParticle(modPlayer.RandomDebuffVisualSpot, new Vector2(0, 4) * Main.rand.NextFloat(0.5f, 0.7f), true, 16, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Vector2 npcSize = npc.Center + new Vector2(Main.rand.NextFloat(-npc.width / 2, npc.width / 2), Main.rand.NextFloat(-npc.height / 2, npc.height / 2)); + Vector2 randVel = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1f); + if (Main.rand.NextBool(5)) + { + Particle spark = new AltSparkParticle(npcSize, randVel + new Vector2(0, -4), true, 12, Main.rand.NextFloat(0.25f, 0.6f), Color.DarkRed * 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + else + { + Dust dust = Dust.NewDustPerfect(npcSize, 5, randVel * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.2f, 0.6f)); + dust.noGravity = false; + } + if (Main.rand.NextBool(8)) + { + Particle spark = new GlowOrbParticle(npcSize, new Vector2(0, 4) * Main.rand.NextFloat(0.5f, 0.7f), true, 16, Main.rand.NextFloat(0.55f, 0.8f), Color.DarkRed * 0.8f, false, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } +} diff --git a/Buffs/DamageOverTime/HeavyBleeding.png b/Buffs/DamageOverTime/HeavyBleeding.png new file mode 100644 index 0000000000..b5e2e69651 Binary files /dev/null and b/Buffs/DamageOverTime/HeavyBleeding.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 9d3d49c77f..1ea5759d7d 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -77,20 +77,30 @@ namespace CalamityMod.CalPlayer #region Variables #region No Category + /// If true, there is a boss NPC active in the world. Primary bool for checking effects that only occur if a boss is alive. public static bool areThereAnyDamnBosses = false; + /// If true, there is an event actively occuring near the player. Solely used for preventing Silva Revive's cooldown from decreasing. public static bool areThereAnyDamnEvents = false; public float calamityBonusLuck = 0f; + /// Custom variable for tracking if the player has Potion Sickness. Used for adding Potion Sickness to the Cooldown Rack. public bool potionSick = false; + /// Custom variable for tracking how long the player has had Potion Sickness. Solely used for triggering the aura effects of Life Jelly and its upgrades. public int timePotionSick; public bool drawBossHPBar = true; public float stealthUIAlpha = 1f; public float SulphWaterUIOpacity = 1f; + /// Used to determine whether or not extra information should be displayed on the Boss Health Bar. public bool shouldDrawSmallText = true; + /// Used by The Evolution to store the type of the projectile that hit the player when its reflect is triggered. public int projTypeJustHitBy; + /// Unused variable, formerly used for displaying special SCal dialogue. public int sCalDeathCount = 0; + /// public int sCalKillCount = 0; public int actualMaxLife = 0; + /// Constant variable used for how long Chaos State is inflicted by Rod of Discord while a boss is alive. public static int chaosStateDuration = 900; + /// Constant variable used for how long Chaos State is inflicted by Normality Relocator while a boss is alive. public static int chaosStateDuration_NR = 1200; public bool killSpikyBalls = false; public float KameiTrailXScale = 0.1f; @@ -98,22 +108,38 @@ namespace CalamityMod.CalPlayer public Vector2[] OldPositions = new Vector2[4]; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; - public const float projectileMeleeWeaponMeleeSpeedMultiplier = 0f; + /// + /// How many stacks of Evil Smasher's boost the player has. This increases the weapon's damage, use speed, and knockback.
+ /// Getting hit decreases this by 1. Switching to a different item resets this to 0. + ///
public int evilSmasherBoost = 0; + /// Cooldown variable which prevents using Burning Sea during its "burn-out" mechanic. public int burningSeaBurnOut = 0; public int hellbornShots = 0; public int searedPanCounter = 0; public int searedPanTimer = 0; + /// Used to get around the hardcoded Potion Sickness duration to allow Hadal Stew's reduced duration. public int potionTimer = 0; public bool cirrusDress = false; + /// If set to true, prevents all player dashes. Used by Ball and Chain and Stygian Shield. public bool blockAllDashes = false; + /// Used by Flamsteed Ring to reset the player's hitbox size after dismounting. public bool resetHeightandWidth = false; + /// If set to true, completely disables ALL life regeneration effects. Used by Omega Blue armor. public bool noLifeRegen = false; public bool reducedDaybrokenDamage = false; public bool reducedNightwitherDamage = false; public float rangedAmmoCost = 1f; public float healingPotionMultiplier = 1f; + /// + /// Tracks whether or not the player is currently holding Gael's Greatsword.
+ /// Used to toggle the ability to use its unique Rage attack. + ///
public bool heldGaelsLastFrame = false; + /// + /// Tracks whether or not the player currently has Draedon's Heart equipped.
+ /// Used to reset Adrenaline when (un)equipped to prevent exploits. + ///
internal bool hadNanomachinesLastFrame = false; public bool combHair; public bool disableVoodooSpawns = false; @@ -121,19 +147,39 @@ namespace CalamityMod.CalPlayer public bool disableHiveCystSpawns = false; public bool disableNaturalScourgeSpawns = false; public bool disableAnahitaSpawns = false; + /// Used for toggling Calamity's blazing cursor effect. public bool blazingCursorDamage = false; + /// + ///
+ /// This variable is enabled if the accessory is in vanity, granting only the visuals. + ///
public bool blazingCursorVisuals = false; public float blazingMouseAuraFade = 0f; + /// + /// General variable used for controlling the strength of screenshake this player is experiencing. Measured in pixels of offset that can be applied to the screen.
+ /// When setting this, be sure to only set it if its current value is less than the value to set, to prevent overriding an ongoing stronger screenshake with a weaker one. + ///
public float GeneralScreenShakePower = 0f; + /// Set to true when this player receives the Brimstone Locus from speaking to the Brimstone Witch for the first time. public bool GivenBrimstoneLocus = false; public DoGCartSegment[] DoGCartSegments = new DoGCartSegment[DoGCartMount.SegmentCount]; public float SmoothenedMinecartRotation; + /// + /// Set to true when a weapon performs a lunge attack, such as Biome Blade's Pure Clarity attunement.
+ /// Massively increases the player's max fall speed, and prevents fall damage. + ///
public bool LungingDown = false; + /// + /// Variable set before the player is teleported to the Underworld for Wall of Flesh in Boss Rush.
+ /// Used to teleport them back to their previous position after Wall of Flesh is defeated. + ///
public Vector2? BossRushReturnPosition = null; public float moveSpeedBonus = 0f; public int momentumCapacitorTime = 0; + /// A multiplier on the player's movement speed applied while using Momentum Capacitor. public float momentumCapacitorBoost = 0f; + /// Cooldown variable for spawning Plague Tainted SMG's drones from left-click bullets. public int plagueTaintedSMGDroneCooldown = 0; #endregion @@ -151,6 +197,7 @@ namespace CalamityMod.CalPlayer public int CurrentlyViewedFactoryID = -1; public int CurrentlyViewedChargerID = -1; public int CurrentlyViewedHologramID = -1; + public int CurrentlyViewedCanvasID = -1; public string CurrentlyViewedHologramText; #endregion @@ -202,54 +249,93 @@ namespace CalamityMod.CalPlayer #region Timer and Counter public int gaelSwipes = 0; public int arsenalCooldown = 0; + /// + /// Tracks Dragoon Drizzlefish's "gel feed" mechanic in Get fixed boi.
+ /// Consuming Gel adds 1 to this counter, up to a maximum of 6, and using the weapon has a random chance to decrement the counter.
+ /// The weapon's damage is multiplied by the value in this counter. + ///
public int dragoonDrizzlefishGelBoost = 1; public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; public int DragonsBreathAudioCooldown2 = 0; public int PhotoAudioCooldown = 0; public int PhotoTimer = 90; + /// Cooldown variable used to add a delay between Anahita's Arpeggio uses. public int arpeggioCooldown = 0; + /// + /// If true, this player's Brittle Star Staff minions are in their orbiting mode.
+ /// While in this mode, they orbit around the player, do not break on hits, and increase defense. + ///
public bool brittleStarBuffMode = false; + /// If set to true, initiates the dash ability of Speed Blaster or Superradiant Slaughterer. public bool sBlasterDashActivated = false; public int saharaSlicersBolts = 0; public int oceanCrestTimer = 0; + /// Pwnagehammer's hit counter, used to track when to spawn its empowered hammer. public int Holyhammer = 0; + /// Fallen Paladin's Hammer's hit counter, used to track when to spawn its empowered hammer. public int PHAThammer = 0; + /// Stellar Contempt's hit counter, used to track when to spawn its empowered hammer. public int StellarHammer = 0; + /// Galaxy Smasher's hit counter, used to track when to spawn its empowered hammer. public int GalaxyHammer = 0; + /// Variable used to apply Ontological Despoiler's nerfs when continuously using a single firing mode. public bool despoilerNerf = false; public int amputatorBuff = 0; public int rOfResilienceCooldown = 0; public int rOfResilienceEffect = 0; public int rOfResilienceOrbitOffset = 0; + /// + /// Variable which tracks how many shots Norfleet has fired. Used to determine when to recharge.
+ /// Also used to trigger its "cheater" easter egg when attempting to fire more than 3 consecutive shots. + ///
public int NorfleetCounter = 0; public int hideOfDeusMeleeBoostTimer = 0; + /// + /// The player's alcohol level. Increased by 1 for each alcohol the player has drank, 2 for Everclear.
+ /// Is this value is greater than 3, the player is inflicted with Alcohol Poisoning. + ///
public int alcoholPoisonLevel = 0; - public int modStealthTimer; public int dashTimeMod; + /// + /// Timer variable which tracks how long the player has spent outside of Providence's border radius, in frames.
+ /// Used to scale the damage of the Holy Inferno debuff. + ///
public int hInfernoBoost = 0; public int packetTimer = 0; public int navyRodAuraTimer = 0; - public int brimLoreInfernoTimer = 0; + /// Timer variable used to time when Hydrothermic armor's set bonus inferno ring deals damage to targets. + public int hydrothermicInfernoTimer = 0; + /// Timer variable used to time when Tarragon armor's set bonus life aura deals damage to targets. public int tarraLifeAuraTimer = 0; public int bloodflareHeartTimer = 300; + /// Counter variable used to determine when to spawn Dragon Rage's fireballs. Fireballs are spawned after 10 hits. public int dragonRageHits = 0; + /// Cooldown variable for Dragon Rage's fireball spawning to prevent spamming projectiles when hitting multiple enemies simultaneously. public int dragonRageCooldown = 0; - public float modStealth = 1f; public float aquaticBoostMax = 10000f; + /// + /// Counter variable which controls Aquatic Emblem's stat boosts while underwater.
+ /// This counter starts at , and is decremented by 2 for every frame the player remains underwater, reaching maximum boosts when it hits 0. + ///
public float aquaticBoost = 0f; public int galileoCooldown = 0; - public int soundCooldown = 0; + /// Used to track Prideful Hunter's Planar Ripper's movement speed boost, along with its visual effects. public int planarSpeedBoost = 0; public int profanedSoulWeaponUsage = 0; public int profanedSoulWeaponType = 0; - public int hurtSoundTimer = 0; + /// Counter variable used to track how many hits have been landed with The Dance of Light, for the purposes of triggering its blinding flash attack. public int danceOfLightCharge = 0; + /// Cooldown variable used to prevent DoG from spamming combat text messages when hitting the player. public int dogTextCooldown = 0; public float auralisStealthCounter = 0f; public int auralisAuroraCounter = 0; public int auralisAuroraCooldown = 0; public int auralisAurora = 0; + /// + /// Counter variable used to track Necro armor's set bonus temporary revive.
+ /// When the player receives fatal damage, this value is set to 0, and then increments on each frame. + ///
public int necroReviveCounter = -1; public int hideOfDeusTimer = 0; public int murasamaHitCooldown = 0; @@ -278,6 +364,9 @@ namespace CalamityMod.CalPlayer #endregion #region Sound + /// General sound cooldown variable. Used by The Microwave and Gastric Belcher Staff. + public int soundCooldown = 0; + public int hurtSoundTimer = 0; public bool playRogueStealthSound = false; public int fullRageSoundCountdownTimer = 0; private const int FullRageSoundDelay = 300; // The "Rage full" sound cannot play for 5 seconds after Rage has filled. This stops it from jittering. @@ -305,25 +394,52 @@ namespace CalamityMod.CalPlayer #endregion #region Rogue + /// The player's current rogue stealth value.
+ /// Note that the player's displayed stealth value is 100x the internal value. For example, a value of 0.1f means having 10 stealth. + ///
public float rogueStealth = 0f; + /// + /// The player's maximum rogue stealth value, from armor and accessories.
+ /// Note that the player's displayed stealth value is 100x the internal value. For example, a value of 0.1f means having 10 max stealth. + ///
public float rogueStealthMax = 0f; + /// A multiplier to the player's stealth generation when standing still. public float stealthGenStandstill = 1f; + /// A multiplier to the player's stealth generation when moving. public float stealthGenMoving = 1f; public int flatStealthLossReduction = 0; public const float StealthAccelerationCap = 1.5f; public float stealthAcceleration = 1f; public bool stealthStrikeThisFrame = false; + /// + /// If true, stealth strikes only require 50% of the player's max stealth to perform.
+ /// Used by Dark Matter Sheath and Eclipse Mirror. + ///
public bool stealthStrikeHalfCost = false; + /// + /// If true, stealth strikes only require 75% of the player's max stealth to perform.
+ /// Used by Ruin Medallion. + ///
public bool stealthStrike75Cost = false; + /// + /// If true, stealth strikes only require 85% of the player's max stealth to perform.
+ /// Used by Coin of Deceit. + ///
public bool stealthStrike85Cost = false; + /// If true, this player is wearing a rogue or all-class armor set. This bool is required in order to use rogue stealth. public bool wearingRogueArmor = false; + /// The sum of the player's stealth generation boosts from accessory modifiers. public float accStealthGenBoost = 0f; // TODO -- Stealth needs to be its own damage class so that stealth bonuses only apply to stealth strikes - public float stealthDamage = 0f; // This is extra Rogue Damage that is only added for stealth strikes. + /// + /// The extra damage boost for rogue stealth strikes.
+ /// This is obtained from a formula derived from the player's current stealth, the weapon's use time, and the player's stealth generation boosts. + ///
+ public float stealthDamage = 0f; + /// An additional damage multiplier applied to rogue stealth strikes. Used by Filthy Glove and its upgrades, and Rotten Dogtooth. public double bonusStealthDamage = 0; public float rogueVelocity = 1f; - public float rogueAmmoCost = 1f; #endregion #region Mount @@ -333,6 +449,10 @@ namespace CalamityMod.CalPlayer public bool crysthamyr = false; public bool ExoChair = false; public AndromedaPlayerState andromedaState; + /// + /// Andromeda Cripple is inflicted on the player if they dismount Flamsteed Ring while a boss is alive.
+ /// This severely slows movement and prevents the weapon from being used for its duration. + ///
public int andromedaCripple; #endregion @@ -345,6 +465,7 @@ namespace CalamityMod.CalPlayer public bool plaguebringerBab = false; public bool rotomPet = false; public bool ladShark = false; + /// If greater than 0, causes this player to constantly spawn heart gores. public int ladHearts = 0; public bool sparks = false; public bool sirenPet = false; @@ -355,7 +476,6 @@ namespace CalamityMod.CalPlayer public bool bearPet = false; public bool kendra = false; public bool trashMan = false; - public int trashManChest = -1; public bool astrophage = false; public bool flakPet = false; public bool babyGhostBell = false; @@ -370,77 +490,106 @@ namespace CalamityMod.CalPlayer #endregion #region Rage + /// + /// If true, enables the Rage mechanic. This is normally Revengeance-exclusive, but can also be enabled by Shattered Community.
+ /// Rage is gained from staying close to enemies, or passively by using certain accessories.
+ /// When the bar is filled, Rage can be activated to provide a small damage boost over a longer duration. + ///
public bool RageEnabled => CalamityWorld.revenge || shatteredCommunity; public bool rageModeActive = false; + /// The player's current Rage level. Expressed as a percentage of maximum Rage. public float rage = 0f; public float rageMax = 100f; // 0 to 100% by default + /// + /// The duration which Rage Mode lasts.
+ /// Starts at 9 seconds, and is increased by 1 second for each upgrade, up to a maximum of 12 seconds. + ///
public int RageDuration = BalancingConstants.DefaultRageDuration; + /// Used by Shattered Community as a short cooldown for gaining Rage when taking damage. public int rageGainCooldown = 0; + /// + /// Counter variable used as a delay before the player starts losing Rage.
+ /// The player will start losing Rage if they do not generate Rage, hit an enemy, or take damage for 10 seconds. + ///
public int rageCombatFrames = 0; public float RageDamageBoost = BalancingConstants.DefaultRageDamageBoost; #endregion #region Adrenaline + /// + /// If true, enables the Adrenaline mechanic. This is normally Revengeance-exclusive, but can also be enabled by Draedon's Heart.
+ /// Adrenaline is gained by avoiding taking damage while a boss is alive.
+ /// When the bar is filled, Adrenaline can be activated to provide a large damage boost over a short duration. + ///
public bool AdrenalineEnabled => CalamityWorld.revenge || draedonsHeart; public bool adrenalineModeActive = false; public bool AdrenalineTrail = false; + /// The player's current Adrenaline level. Expressed as a percentage of maximum Adrenaline. public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default + /// Used as a short cooldown when the player takes damage before Adrenaline can begin charging again. public int adrenalinePauseTimer = 0; + /// Constant variable representing the duration which Adrenaline Mode lasts. public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); + /// Constant variable representing the duration it takes to fully charge Adrenaline. public int AdrenalineChargeTime = CalamityUtils.SecondsToFrames(30); + /// Constant variable representing the duration it takes for Adrenaline to empty if no boss is alive. public int AdrenalineFadeTime = CalamityUtils.SecondsToFrames(2); #endregion #region Defense Damage - // Ratio at which mitigated damage is converted into defense damage. - // This is a significant rework, so the ratio is much higher than the previous 0.1 / 10%. - // The net difference between incoming damage and final taken damage is what is multiplied by this ratio. - // - // Example: You have 200 defense and 25% DR and get hit for 576, on Expert. - // - // Incoming damage = 576 - // Defense reduction = 0.75 * 200 = 150 - // Damage after defense = 426 - // DR reduction = 0.25 * 426 = 106.5 - // Damage after DR = 319.5 (rounds down to 319) - // - // Net Difference = 576 - 319 = 257 - // Defense Damage = 257 * 0.3333 = 85.6581 (rounds up to 86) - // - // The player then loses 86 defense. - // DR is lost according to the ratio of defense lost versus total defense. - // In this case, that ratio is 86 / 200 = 0.43. - // The player loses 0.43 * 0.25 = 10.75% DR. + /// + /// Ratio at which mitigated damage is converted into defense damage.
+ /// The net difference between incoming damage and final taken damage is what is multiplied by this ratio.
+ /// + /// For example, if the player has 200 defense and 25% DR and gets hit for 576 damage, on Expert: + /// + /// Incoming damage = 576 + /// Defense reduction = 0.75 * 200 = 150 + /// Damage after defense = 426 + /// DR reduction = 0.25 * 426 = 106.5 + /// Damage after DR = 319.5 (rounds down to 319) + /// + /// Net Difference = 576 - 319 = 257 + /// Defense Damage = 257 * 0.3333 = 85.6581 (rounds up to 86) + /// + /// The player then loses 86 defense.
+ /// DR is lost according to the ratio of defense lost versus total defense.
+ /// In this case, that ratio is 86 / 200 = 0.43. The player loses 0.43 * 0.25 = 10.75% DR. + ///
public double defenseDamageRatio = BalancingConstants.DefaultDefenseDamageRatio; - // Current effect of defense damage, calculated as total defense damage lerped to zero over the recovery time. + /// Current effect of defense damage, calculated as total defense damage lerped to zero over the recovery time. public int CurrentDefenseDamage => (int)(totalDefenseDamage * ((float)defenseDamageRecoveryFrames / totalDefenseDamageRecoveryFrames)); - // Total defense damage inflicted. This number keeps increasing if the player is repeatedly hit during the recovery period. + /// Total defense damage inflicted. This number keeps increasing if the player is repeatedly hit during the recovery period. internal int totalDefenseDamage = 0; - // Defense damage from a single hit recovers in 60 frames, no matter how big the hit was. - // If you get hit AGAIN before you have fully recovered, 60 more frames are added to your recovery timer! + /// + /// Defense damage from a single hit recovers in 60 frames, no matter how big the hit was.
+ /// If you get hit AGAIN before you have fully recovered, 60 more frames are added to your recovery timer. + ///
internal const int DefenseDamageBaseRecoveryTime = 60; - - // The maximum possible recovery time is 15 seconds. This is to prevent annoyance where godmode defense damage never goes away. + /// + /// The maximum possible recovery time is 15 seconds.
+ /// This is to prevent annoyance where godmode defense damage never goes away. + ///
internal const int DefenseDamageMaxRecoveryTime = 900; - - // How many frames the player will continue to be recovering from defense damage. + /// How many frames the player will continue to be recovering from defense damage. internal int defenseDamageRecoveryFrames = 0; - // The total timer of defense damage recovery that the player is currently suffering from. + /// The total timer of defense damage recovery that the player is currently suffering from. internal int totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; - // Defense damage does not start recovering for a certain number of frames after iframes end. + /// The number of frames after immunity frames end before defense damage can start recovering. internal const int DefenseDamageRecoveryDelay = 10; - - // The current timer for how long the player must wait before defense damage begins recovering. + /// The current timer for how long the player must wait before defense damage begins recovering. internal int defenseDamageDelayFrames = 0; - // Temporary bool for whether the current instance of incoming damage to the player is one that inflicts defense damage. - // Bloodflare Core ignores this and makes every single instance of incoming damage apply defense damage. + /// + /// Temporary bool for whether the current instance of incoming damage to the player is one that inflicts defense damage.
+ /// Bloodflare Core ignores this and makes every single instance of incoming damage apply defense damage. + ///
public bool nextHitDealsDefenseDamage = false; #endregion @@ -465,7 +614,7 @@ namespace CalamityMod.CalPlayer internal float lunicCorpsShieldPartialRechargeProgress = 0f; internal bool playedLunicCorpsShieldSound = false; - //Profaned soul shield applies to psa and psc, with differing max hps for each + // Profaned soul shield applies to psa and psc, with differing max hps for each public int pSoulShieldDurability = 0; public bool pSoulShieldVisible = false; internal bool playedProfanedSoulShieldSound = false; @@ -478,30 +627,51 @@ namespace CalamityMod.CalPlayer #endregion #region Abyss + /// The amount of breath lost on each tick while in the Abyss. public float abyssBreathLossStat = 0; + /// The rate at which breath is lost while in the Abyss. public float abyssBreathLossRateStat = 0; + /// The rate at which health is decreased after running out of breath while in the Abyss. public int abyssLifeLostAtZeroBreathStat = 0; + /// The amount which defense is reduced while in the Abyss. public int abyssDefenseLossStat = 0; #endregion #region Permanent Buff - public bool spawnedPunchCard = false; // not exactly a buff, but is once per player permanent + /// If true, the player has spawned in Punch Card through its one-time chat easter egg. + public bool spawnedPunchCard = false; + /// If true, the player has consumed Celestial Onion. public bool extraAccessoryML = false; - public bool eCore = false; - public bool pHeart = false; + /// If true, the player has consumed Comet Shard. public bool cShard = false; - public bool mFruit = false; + /// If true, the player has consumed Ethereal Core. + public bool eCore = false; + /// If true, the player has consumed Phantom Heart. + public bool pHeart = false; + /// If true, the player has consumed Sanguine Tangerine. public bool sTangerine = false; + /// If true, the player has consumed Miracle Fruit. + public bool mFruit = false; + /// If true, the player has consumed Tainted Cloudberry. public bool tCloudberry = false; + /// If true, the player has consumed Sacred Strawberry. public bool sStrawberry = false; + /// If true, the player has consumed Nimble Bounder. public bool nimbleBounderBoost = false; public bool revJamDrop = false; + /// If true, the player has consumed Mushroom Plasma Root. public bool rageBoostOne = false; + /// If true, the player has consumed Infernal Blood. public bool rageBoostTwo = false; + /// If true, the player has consumed Red Lightning Container. public bool rageBoostThree = false; + /// If true, the player has consumed Electrolyte Gel Pack. public bool adrenalineBoostOne = false; + /// If true, the player has consumed Starlight Fuel Cell. public bool adrenalineBoostTwo = false; + /// If true, the player has consumed Ectoheart. public bool adrenalineBoostThree = false; + /// Used to heal the player to full health on respawn. public bool healToFull = false; #endregion @@ -516,6 +686,7 @@ namespace CalamityMod.CalPlayer public bool theBee = false; public bool arcFlashRing = false; public bool arcFlashRingVisual = false; + /// Used to prevent dodges from triggering The Bee's full health damage reduction cooldown. public bool shouldTriggerBeeCooldown = false; public int theBeeCooldown = 0; public bool alluringBait = false; @@ -529,6 +700,7 @@ namespace CalamityMod.CalPlayer public bool stressPills = false; public bool laudanum = false; public bool heartOfDarkness = false; + /// Used to buff the Profaned Guardian Relic drops while using Profaned Soul Crystal. public bool profanedSoulRelicBuff = false; public bool draedonsHeart = false; public bool vexation = false; @@ -546,16 +718,23 @@ namespace CalamityMod.CalPlayer public bool ascendantTrail = false; public bool frozenWingsCold = false; public bool flameWingsHeat = false; + /// Used to toggle dust spawned while swinging, through accessory visibility. public bool magmaStoneVisuals = true; public bool eGauntlet = false; - public bool eGauntletVisuals = true; // Used to control dust spawned when swinging - public int gloveLevel = 0; // Used to prevent glove stacking - public bool alreadyHasFrogLeg = false; // Used to prevent Frog Leg tinker stacking + /// + public bool eGauntletVisuals = true; + /// + /// Used to prevent melee speed stacking with Feral Claws and its upgrades.
+ /// Feral Claws = 1, Power Glove = 2, Mechanical Glove = 3, Fire Gauntlet = 4, Elemental Gauntlet = 5 + ///
+ public int gloveLevel = 0; + public bool alreadyHasFrogLeg = false; // Unused, intended to prevent Frog Leg tinker stacking public bool eTalisman = false; + /// Counter variable used for spawning Statis' Void Sash's scythes when dashing. public int statisTimer = 0; public bool nucleogenesis = false; public bool nuclearFuelRod = false; - public bool nCore = false; + public bool nebulousCore = false; public bool deepDiver = false; public bool abyssalDivingSuitPlates = false; public int abyssalDivingSuitPlateHits = 0; @@ -575,11 +754,18 @@ namespace CalamityMod.CalPlayer public bool honeyDewHalveDebuffs = false; public bool livingDewHalveDebuffs = false; public int jewelBonusDefense = 0; - public float pulseCounter = 0; // Toxic Heart - public float pulseRate = 1; // Toxic Heart + /// + /// Counter variable for spawning Toxic Heart's pulses.
+ /// Incremented on every frame by , and when it reaches 420, it is reset and a pulse is spawned. + ///
+ public float pulseCounter = 0; + /// + /// The rate at which is incremented, and thus how often Toxic Heart's pulses are spawned.
+ /// This value scales with how low the player's life regeneration is. + ///
+ public float pulseRate = 1; public bool aAmpoule = false; public bool rOoze = false; - public bool JustWasDebuffed = false; public bool fBarrier = false; public bool aBrain = false; public bool amalgam = false; @@ -600,7 +786,6 @@ namespace CalamityMod.CalPlayer public bool tracersElysian = false; public bool tracersSeraph = false; public bool frostFlare = false; - public bool uberBees = false; public bool evolution = false; public int evolutionLifeRegenCounter = 0; public bool nanotech = false; @@ -635,20 +820,27 @@ namespace CalamityMod.CalPlayer public bool crownJewel = false; public bool infectedJewel = false; public bool purity = false; + /// If true, reduces the damage of electricity debuffs by 50%. public bool eleResist = false; public int PurityHealSlowdownFrames = 0; public bool harpyRing = false; public bool angelTreads = false; - public bool harpyWingBoost = false; //harpy wings + harpy ring - public int harpyWingFeatherCooldown = 0; + /// Synergy effect while wearing Harpy Wings with Harpy Ring or Angel Treads, allowing attacks to be accompanied by feathers. + public bool harpyWingBoost = false; + /// Makes Flesh Knuckles and its upgrades increase the player's max health by 45. public bool fleshKnuckles = false; public bool ironBoots = false; public bool depthCharm = false; public bool anechoicPlating = false; + /// Used for increasing light level in the Abyss. public bool jellyfishNecklace = false; public bool fairyBoots = false; public bool flameWakerBoots = false; - public int bootLevel = 0; //Used to prevent Flame Waker and Hellfire Treads stacking + /// + /// Used to prevent heat debuff damage stacking with Flame Waker Boots and Hellfire Treads.
+ /// Flame Waker Boots = 1, Hellfire Treads = 2 + ///
+ public int bootLevel = 0; public bool hellfireTreads = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; @@ -678,7 +870,9 @@ namespace CalamityMod.CalPlayer public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; public bool manaOverloader = false; + /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; + /// Used for implementing its synergy with Snow armor. public bool handWarmer = false; public bool ursaSergeant = false; public bool ursaSergeantVisual = false; @@ -693,6 +887,7 @@ namespace CalamityMod.CalPlayer public bool blazingCoreEmpoweredParry = false; public bool voltaicJelly = false; public bool jellyChargedBattery = false; + /// General cooldown for accessories which spawn projectiles on minion hits. public float summonProjCooldown; public bool sandWaifu = false; public bool sandWaifuVanity = false; @@ -725,6 +920,7 @@ namespace CalamityMod.CalPlayer public bool sandCloak = false; public bool spectralVeil = false; public int spectralVeilImmunity = 0; + /// Check for if the player has Plagued Fuel Pack OR Blunder Booster equipped. public bool hasJetpack = false; public bool plaguedFuelPack = false; public bool blunderBooster = false; @@ -742,14 +938,22 @@ namespace CalamityMod.CalPlayer public int hallowedRuneCooldown = 0; public bool phantomicArtifact = false; public int phantomicBulwarkCooldown = 0; - public int phantomicHeartRegen = 0; // 0 = can spawn, 720 = regen applied, 600 = regen stops and 10 sec cd before it can spawn again + /// + /// Controls the state of Phantomic Artifact's Phantomic Regen boost.
+ /// When the heart is spawned, this variable is set to 1000. When the heart is touched, it is set to 720 and decrements every frame.
+ /// Life regeneration is increased while between 600 and 720, with a 10 second cooldown afterwards represented by being below 600. + ///
+ public int phantomicHeartRegen = 0; public bool silvaWings = false; public int silvaWingsLifeRegenTimer = 0; + /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Harpy Wings, Tattered Fairy Wings, and Festive Wings. public int wingProjectileCooldown = 0; public bool RustyMedallionDroplets = false; public bool MiniSwarmers = false; public bool noStupidNaturalARSpawns = false; + /// Used for animating Void Concentration Staff's draw layer. public int voidFrameCounter = 0; + /// public int voidFrame = 0; public bool rottenDogTooth = false; public bool angelicAlliance = false; @@ -758,14 +962,19 @@ namespace CalamityMod.CalPlayer public bool ChaosStone = false; public bool CryoStone = false; public bool CryoStoneVanity = false; + /// Used for spawning Quiver of Nihility's void fields. public bool voidField = false; public bool copyrightInfringementShield = false; #endregion #region Armor Set + public int ArmorSetBonusKeyHeldTimer; + /// Calamity's Silver armor set bonus; taking over 20 damage heals 10 health if you avoid damage for 2 seconds. public bool silverMedkit = false; public int silverMedkitTimer = 0; + /// Calamity's Gold armor set bonus; makes enemies drop Gold Coins. public bool goldArmorGoldDrops = false; + /// Calamity's Mining armor set bonus; gives a chance for extra items to drop when mining ores. public bool miningSet = false; public int miningSetCooldown = 0; public bool desertProwler = false; @@ -773,10 +982,14 @@ namespace CalamityMod.CalPlayer public bool forbiddenCirclet = false; public int forbiddenCooldown = 0; public int tornadoCooldown = 0; - public bool eskimoSet = false; //vanilla armor - public bool meteorSet = false; //vanilla armor, for space gun nerf - public bool necroSet = false; //vanilla armor - public bool frostSet = false; //vanilla armor + /// Calamity's Snow armor set bonus; reduces cold enemy damage and increases cold debuff damage. + public bool eskimoSet = false; + /// Calamity's Meteor armor set bonus; makes all magic guns cost 33% mana instead of Space Gun costing 0 mana. + public bool meteorSet = false; + /// Calamity's Necro armor set bonus; gives a temporary 10 second revive when the player is killed before actually dying. + public bool necroSet = false; + /// Calamity's Frost armor set bonus; gives a combined 20% damage boost split between melee and ranged based on distance from the closest enemy. + public bool frostSet = false; public bool victideSet = false; public bool victideSummoner = false; public bool sulphurSet = false; @@ -823,7 +1036,9 @@ namespace CalamityMod.CalPlayer public bool brimflameFrenzy = false; public bool lunicCorpsSet = false; public bool lunicCorpsLegs = false; + /// Demonshade Breastplate's life regeneration boost. public bool shadeRegen = false; + /// Demonshade Greaves' movement speed boost. public bool shadowSpeed = false; public bool dsSetBonus = false; public bool auricBoost = false; @@ -844,7 +1059,9 @@ namespace CalamityMod.CalPlayer public bool fathomSwarmerVisage = false; public bool fathomSwarmerBreastplate = false; public bool fathomSwarmerTail = false; + /// Used for animating Fathom Swarmer armor's tail layer. public int tailFrameUp = 0; + /// public int tailFrame = 0; public bool astralStarRain = false; public int astralStarRainCooldown = 0; @@ -870,27 +1087,39 @@ namespace CalamityMod.CalPlayer public int silvaMageCooldown = 0; public bool silvaSummon = false; public bool hasSilvaEffect = false; - public static int silvaReviveDuration = 300; + /// Constant variable representing the duration of Silva armor's revive, in frames. + public const int silvaReviveDuration = 300; public int silvaCountdown = silvaReviveDuration; public bool auricSet = false; public bool omegaBlueChestplate = false; public bool omegaBlueSet = false; public bool omegaBlueHentai = false; + /// Aerospec armor's summoner set bonus minion. public bool valkyrie = false; + /// Statigel armor's summoner set bonus minion. public bool slimeGod = false; public bool molluskSet = false; public bool fearmongerSet = false; public int fearmongerRegenFrames = 0; public bool daedalusCrystal = false; + /// Hydrothermic armor's summoner set bonus minion. public bool chaosSpirit = false; + /// Demonshade armor's set bonus minion. public bool redDevil = false; public bool GemTechSet = false; + /// Calamity's Cobalt armor set bonus; increases damage and crit chance based on how fast the player is moving. public bool CobaltSet = false; + /// Calamity's Mythril armor set bonus; hits spawn additional homing mythril flares. public bool MythrilSet = false; public int MythrilFlareSpawnCountdown = 0; + /// Calamity's Adamantite armor set bonus; adds half of DR to crit chance, and makes landing hits give a stacking defense boost. public bool AdamantiteSet = false; public int AdamantiteSetDecayDelay = 0; public int ChlorophyteHealDelay = 0; + /// + /// If true, the player is wearing a post-Moon Lord summoner armor set.
+ /// Currently unused. + ///
public bool WearingPostMLSummonerSet = false; private float adamantiteSetDefenseBoostInterpolant; @@ -934,12 +1163,14 @@ namespace CalamityMod.CalPlayer public bool weakBrimstoneFlames = false; public bool gsInferno = false; public bool astralInfection = false; + /// Plague debuff. public bool pFlames = false; public bool hFlames = false; public bool hInferno = false; public bool gState = false; public bool bBlood = false; public bool brainRot = false; + public bool heavybleeding = false; public bool laceration = false; public bool elementalMix = false; public bool icarusFolly = false; @@ -958,14 +1189,18 @@ namespace CalamityMod.CalPlayer public bool nightwither = false; public bool voidfrost = false; public bool eutrophication = false; - public bool iCantBreathe = false; //Frozen Lungs debuff + /// Frozen Lungs debuff. + public bool iCantBreathe = false; + /// Searing Lava debuff. public bool cragsLava = false; public bool vaporfied = false; public bool banishingFire = false; public bool wither = false; public bool ManaBurn = false; + /// Counter variable used to prevent the player from being inflicted with another immobilizing debuff for a short time after being inflicted with one. public int ImmobilityDebuffImmunityTimer = 0; + /// Constant variable representing the time in which players cannot be inflicted with another immobilizing debuff, in frames. public const int ImmobilityDebuffImmunityTimerMax = 300; public const int SulphSeaWaterSafetyTime = 720; @@ -980,8 +1215,11 @@ namespace CalamityMod.CalPlayer public bool corrEffigy = false; public bool crimEffigy = false; public bool decayEffigy = false; + /// Reaver Rage buff. public bool rRage = false; + /// Tarra Life buff. public bool tRegen = false; + /// Empyrean Wrath buff. public bool xWrath = false; public bool graxDefense = false; public bool encased = false; @@ -997,6 +1235,7 @@ namespace CalamityMod.CalPlayer public bool GreenJellyRegen = false; public bool AbsorberRegen = false; public bool cFreeze = false; + /// Used for increasing light level in the Abyss. public bool shine = false; public bool anechoicCoating = false; public bool enraged = false; @@ -1040,7 +1279,12 @@ namespace CalamityMod.CalPlayer public bool pinkCandle = false; public double pinkCandleHealFraction = 0D; public bool yellowCandle = false; + /// If true, the player has consumed Odd Mushroom. Controls drawing its rainbow fake clones of NPCs and projectiles. public bool trippy = false; + /// + /// Used to control the number and position of Odd Mushroom's fake clones. There are three levels of severity.
+ /// The first draws 4 clones in diagonals. The second draws 12 clones, 4 on diagonals and the other 8 surrounding them. The third draws 16 clones, arranged entirely around the player. + ///
public int trippyLevel = 1; public bool amidiasBlessing = false; public bool bloodfinBoost = false; @@ -1051,13 +1295,19 @@ namespace CalamityMod.CalPlayer public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; + /// + /// Counter variable for natural decay of Haste buffs from Chronomancer's Scythe.
+ /// If the player does not collect a clock powerup for 5 seconds, they will lose a stack of Haste. + ///
public int hasteCounter = 0; + /// How many stacks of the Haste buff the player has, from Chronomancer's Scythe. public int hasteLevel = 0; #endregion #region Minion public bool wDroid = false; public bool resButterfly = false; + /// Staff of the Mechworm. public bool mWorm = false; public bool IceClasperBool = false; public bool magicHat = false; @@ -1065,55 +1315,84 @@ namespace CalamityMod.CalPlayer public bool blackhawk = false; public bool cosmicViper = false; public bool CalamarisLament = false; + /// Entropy's Vigil. public bool cEyes = false; + /// Corroslime Staff. public bool cSlime = false; + /// Crimslime Staff. public bool cSlime2 = false; + /// Abandoned Slime Staff. public bool aSlime = false; public bool brittleStar = false; public bool aquaticStar = false; + /// Sun Spirit Staff. public bool SP = false; public bool dCreeper = false; public bool bClot = false; public bool eAxe = false; public bool endoCooper = false; + /// Vengeful Sun Staff. public bool SPG = false; public bool sirius = false; + /// Yharon's Kindle Staff. public bool aChicken = false; public bool cLamp = false; + /// Ethereal Subjugator. public bool pGuy = false; public bool sandnado = false; public bool PlantationSummon = false; public bool astralProbe = false; + /// Profaned Soul Artifact/Crystal guardians. public bool pSoulGuardians = false; - public bool cEnergy = false; + /// Counter variable used for healing the player by Profaned Soul Artifact's healer guardian. public int healCounter = 300; + /// Cosmic Immaterializer. + public bool cEnergy = false; public bool shellfish = false; + /// Enchanted Conch. public bool hCrab = false; + /// Heart of the Elements. public bool allWaifus = false; + /// Hearts of the Elements; however, the minion will not attack. public bool allWaifusVanity = false; + /// Silva armor's Silva Crystal. public bool sCrystal = false; + /// Elemental in a Bottle. public bool sWaifu = false; + /// Rare Elemental in a Bottle. public bool dWaifu = false; + /// Eye of the Storm. public bool cWaifu = false; + /// Rose Stone. public bool bWaifu = false; + /// Pearl of Enthrallment. public bool slWaifu = false; public bool fClump = false; + /// Demonshade armor's Red Devil. public bool rDevil = false; + /// Aerospec armor's Valkyrie. public bool aValkyrie = false; public bool apexShark = false; public bool gastricBelcher = false; public bool hauntedDishes = false; public bool stormjaw = false; + /// Statigel armor's Baby Paladin. public bool sGod = false; public bool victideSnail = false; + /// Hydrothermic armor's Vent. public bool cSpirit = false; + /// Reaver armor's Reaver Orb. public bool rOrb = false; + /// Daedalus armor's Daedalus Crystal. public bool dCrystal = false; public bool endoHydra = false; + /// Corvid Harbinger Staff. public bool powerfulRaven = false; + /// Dragonblood Disgorger. public bool dragonFamily = false; public bool providenceStabber = false; public bool saros = false; + /// Fuel Cell Bundle. public bool plaguebringerMK2 = false; public bool igneousExaltation = false; public bool GlacialEmbrace = false; @@ -1232,24 +1511,44 @@ namespace CalamityMod.CalPlayer #endregion #region Calamitas Enchant Effects + /// If true, the player is holding an item with the Indignant enchantment. public bool cursedSummonsEnchant = false; + /// If true, the player is holding an item with the Aflame enchantment. public bool flamingItemEnchant = false; + /// If true, the player is holding an item with the Oblatory enchantment. public bool lifeManaEnchant = false; + /// If true, the player is holding an item with the Resentful enchantment. public bool farProximityRewardEnchant = false; + /// If true, the player is holding an item with the Bloodthirsty enchantment. public bool closeProximityRewardEnchant = false; + /// If true, the player is holding an item with the Ephemeral enchantment. public bool dischargingItemEnchant = false; + /// If true, the player is holding an item with the Hellbound enchantment. public bool explosiveMinionsEnchant = false; + /// If true, the player is holding an item with the Tainted enchantment. public bool bladeArmEnchant = false; + /// If true, the player is holding an item with the Traitorous enchantment. public bool manaMonsterEnchant = false; + /// If true, the player is holding an item with the Withering enchantment. public bool witheringWeaponEnchant = false; public bool witheredDebuff = false; + /// + /// Counter variable which controls negative life regeneration from the Withered debuff.
+ /// Increments every frame a weapon with the Withering enchantment is held, and decrements vice versa. + ///
public int witheredWeaponHoldTime = 0; + /// + /// How much damage was dealt by a weapon with the Withering enchantment.
+ /// Used to determine what percentage of the hit to heal back. + ///
public int witheringDamageDone = 0; + /// If true, the player is holding an item with the Persecuted enchantment. public bool persecutedEnchant = false; public int persecutedEnchantSummonTimer = 0; + /// If true, the player is holding an item with the Lecherous enchantment. public bool lecherousOrbEnchant = false; public bool awaitingLecherousOrbSpawn = false; #endregion Calamitas Enchant Effects @@ -1304,19 +1603,19 @@ namespace CalamityMod.CalPlayer private Vector2 oldMouseWorld; /// - /// Set this to true if you need to recieve updates on right clicks from players and sync them in mp. - /// Automatically resets itself after sending an update - /// <\summary> + /// Set this to true if you need to receive updates on right clicks from players and sync them in multiplayer.
+ /// Automatically resets itself after sending an update. + ///
public bool rightClickListener = false; /// - /// Set this to true if you need to recieve updates on the position of the player's mouse and sync them in mp. - /// Automatically resets itself after sending an update - /// <\summary> + /// Set this to true if you need to receive updates on the position of the player's mouse and sync them in multiplayer.
+ /// Automatically resets itself after sending an update. + ///
public bool mouseWorldListener = false; /// - /// Set this to true if you need to recieve updates on the rotation of the mouse to the player. This sends updates less frequently than the more tight tolerance mouseWorldListener - /// Automatically resets itself after sending an update - /// <\summary> + /// Set this to true if you need to receive updates on the rotation of the mouse to the player. This sends updates less frequently the tighter the tolerance of mouseWorldListener.
+ /// Automatically resets itself after sending an update. + ///
public bool mouseRotationListener = false; public bool syncMouseControls = false; @@ -1631,7 +1930,6 @@ namespace CalamityMod.CalPlayer contactDamageReduction = 0D; projectileDamageReduction = 0D; rogueVelocity = 1f; - rogueAmmoCost = 1f; accStealthGenBoost = 0f; DashID = string.Empty; @@ -1712,7 +2010,7 @@ namespace CalamityMod.CalPlayer dodgeScarf = false; evasionScarf = false; - nCore = false; + nebulousCore = false; godSlayer = false; godSlayerDamage = false; @@ -1797,7 +2095,6 @@ namespace CalamityMod.CalPlayer aBrain = false; amalgam = false; frostFlare = false; - uberBees = false; evolution = false; nanotech = false; deadshotBrooch = false; @@ -1959,10 +2256,10 @@ namespace CalamityMod.CalPlayer miningSet = false; miningSetCooldown = 0; - eskimoSet = false; //vanilla armor - meteorSet = false; //vanilla armor, for Space Gun nerf - necroSet = false; //vanilla armor - frostSet = false; //vanilla armor + eskimoSet = false; + meteorSet = false; + necroSet = false; + frostSet = false; victideSet = false; victideSummoner = false; @@ -2056,6 +2353,7 @@ namespace CalamityMod.CalPlayer gState = false; bBlood = false; brainRot = false; + heavybleeding = false; laceration = false; elementalMix = false; icarusFolly = false; @@ -2398,7 +2696,7 @@ namespace CalamityMod.CalPlayer foreach (string cdID in removedCooldowns) cooldowns.Remove(cdID); - SyncCooldownDictionary(Main.netMode == NetmodeID.Server); + SyncCooldownDictionary(Main.dedServ); } } @@ -2505,6 +2803,7 @@ namespace CalamityMod.CalPlayer gState = false; bBlood = false; brainRot = false; + heavybleeding = false; laceration = false; elementalMix = false; icarusFolly = false; @@ -2541,7 +2840,6 @@ namespace CalamityMod.CalPlayer stealthDamage = 0f; bonusStealthDamage = 0; rogueVelocity = 1f; - rogueAmmoCost = 1f; #endregion #region UI @@ -2728,10 +3026,10 @@ namespace CalamityMod.CalPlayer forbiddenCirclet = false; forbiddenCooldown = 0; tornadoCooldown = 0; - eskimoSet = false; //vanilla armor - meteorSet = false; //vanilla armor, for Space Gun nerf - necroSet = false; //vanilla armor - frostSet = false; //vanilla armor + eskimoSet = false; + meteorSet = false; + necroSet = false; + frostSet = false; victideSet = false; aeroSet = false; sulphurSet = false; @@ -2780,6 +3078,7 @@ namespace CalamityMod.CalPlayer CurrentlyViewedFactoryID = -1; CurrentlyViewedChargerID = -1; CurrentlyViewedHologramID = -1; + CurrentlyViewedCanvasID = -1; CurrentlyViewedHologramText = string.Empty; #endregion @@ -2795,7 +3094,6 @@ namespace CalamityMod.CalPlayer persecutedEnchantSummonTimer = 0; momentumCapacitorTime = 0; momentumCapacitorBoost = 0f; - harpyWingFeatherCooldown = 0; silvaWingsLifeRegenTimer = 0; LungingDown = false; @@ -3002,183 +3300,31 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.Item34, Player.Center); } - // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. if (CalamityKeybinds.ArmorSetBonusHotKey.JustPressed) { - if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) - { - if (Player.whoAmI == Main.myPlayer) - { - if (brimflameFrenzy) - { - brimflameFrenzy = false; - Player.ClearBuff(BuffType()); - } - else - { - brimflameFrenzy = true; - Player.AddBuff(BuffType(), 10 * 60, true); - SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center); - for (int i = 0; i < 36; i++) - { - Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - brimDust.velocity *= 3f; - brimDust.scale *= 1.15f; - } - int dustAmt = 36; - for (int j = 0; j < dustAmt; j++) - { - Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; - Vector2 dustVelocity = dustRotation - Player.Center; - Dust brimDust2 = Dust.NewDustDirect(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); - brimDust2.noGravity = true; - brimDust2.noLight = true; - brimDust2.velocity = dustVelocity; - } - } - } - } - if (tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID) && !tarragonCloak) - { - if (Player.whoAmI == Main.myPlayer) - { - Player.AddBuff(BuffType(), 602, false); - } - } - if (bloodflareRanged && !Player.HasCooldown(BloodflareRangedSet.ID)) - { - if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(BloodflareRangedSet.ID, 1800); + PlayerLoader.ArmorSetBonusActivated(Player); - SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center); - for (int d = 0; d < 64; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); - dust.velocity *= 3f; - dust.scale *= 1.15f; - } - int dustAmt = 36; - for (int d = 0; d < dustAmt; d++) - { - Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; - source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; - Vector2 dustVel = source - Player.Center; - Dust phanto = Dust.NewDustDirect(source + dustVel, 0, 0, (int)CalamityDusts.Necroplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); - phanto.noGravity = true; - phanto.noLight = true; - phanto.velocity = dustVel; - } - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; + // Activate vanilla set bonuses + if (Player.setVortex && !Player.mount.Active) + Player.vortexStealthActive = !Player.vortexStealthActive; - int damage = (int)(Player.GetTotalDamage().ApplyTo(300f)); - - if (Player.whoAmI == Main.myPlayer) - { - var source = Player.GetSource_Misc("1"); - for (int i = 0; i < 16; i++) - { - float ai1 = Main.rand.NextFloat() + 0.5f; - Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); - int soul = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); - if (soul.WithinBounds(Main.maxProjectiles)) - Main.projectile[soul].DamageType = DamageClass.Generic; - } - } - } - if (omegaBlueSet && !Player.HasCooldown(OmegaBlue.ID)) + if (Player.setForbidden) { - if (Player.whoAmI == Main.myPlayer) - { - Player.AddBuff(BuffType(), 300, false); - } - Player.AddCooldown(OmegaBlue.ID, 1800); - SoundEngine.PlaySound(OmegaBlueHelmet.ActivationSound, Player.Center); - for (int i = 0; i < 66; i++) - { - Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 2.6f); - dust.noGravity = true; - dust.noLight = true; - dust.fadeIn = 1f; - dust.velocity *= 6.6f; - } - } - if (dsSetBonus) - { - SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center); - for (int i = 0; i < 36; i++) - { - Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); - brimDust.velocity *= 3f; - brimDust.scale *= 1.15f; - } - int dustAmt = 36; - for (int j = 0; j < dustAmt; j++) - { - Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; - Vector2 dustVelocity = dustRotation - Player.Center; - Dust brimDust2 = Dust.NewDustDirect(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); - brimDust2.noGravity = true; - brimDust2.noLight = true; - brimDust2.velocity = dustVelocity; - } - if (Player.whoAmI == Main.myPlayer) - { - Player.AddBuff(BuffType(), 600, false); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - foreach (NPC npc in Main.ActiveNPCs) - { - if (!npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f) - npc.AddBuff(BuffType(), 600, false); - } - } - } - if (plagueReaper && !Player.HasCooldown(PlagueBlackout.ID)) - { - SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); - Player.AddCooldown(PlagueBlackout.ID, 1800); - } - if (forbiddenCirclet && forbiddenCooldown <= 0) - { - forbiddenCooldown = 45; - int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); - if (Player.statMana < stormMana) - { - if (Player.manaFlower) - { - Player.QuickMana(); - } - } - if (Player.statMana >= stormMana && !Player.silence) - { - var source = Player.GetSource_Misc("1"); - Player.manaRegenDelay = (int)Player.maxRegenDelay; - Player.statMana -= stormMana; + Player.MinionRestTargetAim(); - // To compute Forbidden Circlet tornado damage, create a fake stat modifier on the spot which combines both classes. - StatModifier forbidden = Player.GetTotalDamage().CombineWith(Player.GetDamage()); - int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.tornadoBaseDmg); - - float kBack = Player.GetTotalKnockback().ApplyTo(ForbiddenCirclet.tornadoBaseKB); - - if (Player.whoAmI == Main.myPlayer) - { - int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); - if (mark.WithinBounds(Main.maxProjectiles)) - Main.projectile[mark].DamageType = DamageClass.Generic; - } - } + if (!Player.setForbiddenCooldownLocked) + Player.CommandForbiddenStorm(); } - if (prismaticSet && !Player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) - prismaticLasers = CalamityUtils.SecondsToFrames(35f); } + if (CalamityKeybinds.ArmorSetBonusHotKey.Current) + { + ArmorSetBonusKeyHeldTimer++; + PlayerLoader.ArmorSetBonusHeld(Player, ArmorSetBonusKeyHeldTimer); + } + else + ArmorSetBonusKeyHeldTimer = 0; + if (CalamityKeybinds.AccessoryParryHotKey.JustPressed) { if (blazingCore && blazingCoreParry == 0 && blazingCoreSuccessfulParry == 0) @@ -3371,6 +3517,178 @@ namespace CalamityMod.CalPlayer } } } + + public override void ArmorSetBonusActivated() + { + // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. + if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) + { + if (Player.whoAmI == Main.myPlayer) + { + if (brimflameFrenzy) + { + brimflameFrenzy = false; + Player.ClearBuff(BuffType()); + } + else + { + brimflameFrenzy = true; + Player.AddBuff(BuffType(), 10 * 60, true); + SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center); + for (int i = 0; i < 36; i++) + { + Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + brimDust.velocity *= 3f; + brimDust.scale *= 1.15f; + } + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVelocity = dustRotation - Player.Center; + Dust brimDust2 = Dust.NewDustDirect(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); + brimDust2.noGravity = true; + brimDust2.noLight = true; + brimDust2.velocity = dustVelocity; + } + } + } + } + if (tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID) && !tarragonCloak) + { + if (Player.whoAmI == Main.myPlayer) + { + Player.AddBuff(BuffType(), 602, false); + } + } + if (bloodflareRanged && !Player.HasCooldown(BloodflareRangedSet.ID)) + { + if (Player.whoAmI == Main.myPlayer) + Player.AddCooldown(BloodflareRangedSet.ID, 1800); + + SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center); + for (int d = 0; d < 64; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Necroplasm, 0f, 0f, 0, default, 1f); + dust.velocity *= 3f; + dust.scale *= 1.15f; + } + int dustAmt = 36; + for (int d = 0; d < dustAmt; d++) + { + Vector2 source = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + source = source.RotatedBy((double)((float)(d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVel = source - Player.Center; + Dust phanto = Dust.NewDustDirect(source + dustVel, 0, 0, (int)CalamityDusts.Necroplasm, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.4f); + phanto.noGravity = true; + phanto.noLight = true; + phanto.velocity = dustVel; + } + + if (Player.whoAmI == Main.myPlayer) + { + var source = Player.GetSource_Misc("1"); + int damage = (int)(Player.GetTotalDamage().ApplyTo(300f)); + for (int i = 0; i < 16; i++) + { + float ai1 = Main.rand.NextFloat() + 0.5f; + Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); + int soul = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileType(), damage, 0f, Player.whoAmI, 0f, ai1); + if (soul.WithinBounds(Main.maxProjectiles)) + Main.projectile[soul].DamageType = DamageClass.Generic; + } + } + } + if (omegaBlueSet && !Player.HasCooldown(OmegaBlue.ID)) + { + if (Player.whoAmI == Main.myPlayer) + { + Player.AddBuff(BuffType(), 300, false); + } + Player.AddCooldown(OmegaBlue.ID, 1800); + SoundEngine.PlaySound(OmegaBlueHelmet.ActivationSound, Player.Center); + for (int i = 0; i < 66; i++) + { + Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.PurificationPowder, 0, 0, 100, Color.Transparent, 2.6f); + dust.noGravity = true; + dust.noLight = true; + dust.fadeIn = 1f; + dust.velocity *= 6.6f; + } + } + if (dsSetBonus) + { + SoundEngine.PlaySound(DemonshadeHelm.ActivationSound, Player.Center); + for (int i = 0; i < 36; i++) + { + Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); + brimDust.velocity *= 3f; + brimDust.scale *= 1.15f; + } + int dustAmt = 36; + for (int j = 0; j < dustAmt; j++) + { + Vector2 dustRotation = Vector2.Normalize(Player.velocity) * new Vector2((float)Player.width / 2f, (float)Player.height) * 0.75f; + dustRotation = dustRotation.RotatedBy((double)((float)(j - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Player.Center; + Vector2 dustVelocity = dustRotation - Player.Center; + Dust brimDust2 = Dust.NewDustDirect(dustRotation + dustVelocity, 0, 0, (int)CalamityDusts.Brimstone, dustVelocity.X * 1.5f, dustVelocity.Y * 1.5f, 100, default, 1.4f); + brimDust2.noGravity = true; + brimDust2.noLight = true; + brimDust2.velocity = dustVelocity; + } + if (Player.whoAmI == Main.myPlayer) + { + Player.AddBuff(BuffType(), 600, false); + } + if (Main.netMode != NetmodeID.MultiplayerClient) + { + foreach (NPC npc in Main.ActiveNPCs) + { + if (!npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f) + npc.AddBuff(BuffType(), 600, false); + } + } + } + if (plagueReaper && !Player.HasCooldown(PlagueBlackout.ID)) + { + SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); + Player.AddCooldown(PlagueBlackout.ID, 1800); + } + if (forbiddenCirclet && forbiddenCooldown <= 0) + { + forbiddenCooldown = 45; + int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); + if (Player.statMana < stormMana) + { + if (Player.manaFlower) + { + Player.QuickMana(); + } + } + if (Player.statMana >= stormMana && !Player.silence) + { + var source = Player.GetSource_Misc("1"); + Player.manaRegenDelay = (int)Player.maxRegenDelay; + Player.statMana -= stormMana; + + // To compute Forbidden Circlet tornado damage, create a fake stat modifier on the spot which combines both classes. + StatModifier forbidden = Player.GetTotalDamage().CombineWith(Player.GetDamage()); + int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.tornadoBaseDmg); + + float kBack = Player.GetTotalKnockback().ApplyTo(ForbiddenCirclet.tornadoBaseKB); + + if (Player.whoAmI == Main.myPlayer) + { + int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); + if (mark.WithinBounds(Main.maxProjectiles)) + Main.projectile[mark].DamageType = DamageClass.Generic; + } + } + } + if (prismaticSet && !Player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) + prismaticLasers = CalamityUtils.SecondsToFrames(35f); + } #endregion #region TeleportMethods @@ -3415,7 +3733,7 @@ namespace CalamityMod.CalPlayer player.StopVanityActions(false); player.RemoveAllGrapplingHooks(); player.Teleport(pos, style); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) RemoteClient.CheckSection(player.whoAmI, player.Center); NetMessage.SendData(MessageID.TeleportEntity, -1, -1, null, 0, (float)player.whoAmI, pos.X, pos.Y, style, 0, 0); player.velocity = Vector2.Zero; @@ -3985,8 +4303,6 @@ namespace CalamityMod.CalPlayer { // Adding to StatModifier adds to the additive multiplier bool rogue = item.CountsAsClass(); - if (auricBoost) - knockback += ((1f - modStealth) * 0.5f); if (whiskey) knockback += Whiskey.KnockbackBoost; @@ -4051,7 +4367,7 @@ namespace CalamityMod.CalPlayer confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; confetti.scale *= (float)(1.0 + Main.rand.Next(-30, 31) * 0.01); } - if (Main.rand.NextBool(40) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(40) && !Main.dedServ) { int confettiGore = Main.rand.Next(276, 283); int confetti = Gore.NewGore(Player.GetSource_ItemUse(item), new Vector2(hitbox.X, hitbox.Y), Player.velocity, confettiGore, 1f); diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 666e0f86b8..9a742b531c 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -253,6 +253,9 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.gsInferno && drawInfo.shadow == 0f) GodSlayerInferno.DrawEffects(drawInfo); + if (calamityPlayer.heavybleeding && drawInfo.shadow == 0f) + HeavyBleeding.DrawEffects(drawInfo); + // Holy Flames, Holy Inferno and Banishing Fire share the same visual effects if (drawInfo.shadow == 0f && (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire)) HolyFlames.DrawEffects(drawInfo); @@ -261,6 +264,9 @@ namespace CalamityMod.CalPlayer else if (calamityPlayer.icarusFolly && drawInfo.shadow == 0f) IcarusFolly.DrawEffects(drawInfo); + if (calamityPlayer.laceration && drawInfo.shadow == 0f) + Laceration.DrawEffects(drawInfo); + if (calamityPlayer.miracleBlight && drawInfo.shadow == 0f) MiracleBlight.DrawEffects(drawInfo); @@ -366,7 +372,7 @@ namespace CalamityMod.CalPlayer } // Some extraneous and probably undocumented visual effect caused by the heart lad pet thing - if ((calamityPlayer.ladHearts > 0) && !Player.loveStruck && Main.netMode != NetmodeID.Server && drawInfo.shadow == 0f) + if ((calamityPlayer.ladHearts > 0) && !Player.loveStruck && !Main.dedServ && drawInfo.shadow == 0f) { if (Main.rand.NextBool(5)) { diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index b88f777f11..24dcdd8f01 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -16,6 +16,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.NPCs; using CalamityMod.NPCs.OldDuke; +using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -43,10 +44,36 @@ namespace CalamityMod.CalPlayer { int uncommonRate = Math.Clamp(240 / attempt.fishingLevel, 3, 240); // Iron/Mythril (originally 300) attempt.uncommon = Main.rand.NextBool(uncommonRate); + + // These roll result bools are individually stored for the rarifying visuals int rareRate = Math.Clamp(840 / attempt.fishingLevel, 4, 840); // Biome (originally 1050) - attempt.uncommon = Main.rand.NextBool(rareRate); + bool rareRoll = Main.rand.NextBool(rareRate); + attempt.rare = rareRoll; + int veryRareRate = Math.Clamp(1800 / attempt.fishingLevel, 5, 1800); // Golden/Titanium (originally 2250) - attempt.uncommon = Main.rand.NextBool(veryRareRate); + bool veryRareRoll = Main.rand.NextBool(veryRareRate); + attempt.veryrare = veryRareRoll; + + Vector2 basePos = new Vector2(attempt.X * 16f, attempt.Y * 16f); + if (rareRoll || veryRareRoll) + { + for (int i = 0; i < 8; i++) + { + Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f); + Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-12f, -9f)).RotatedByRandom(MathHelper.ToRadians(18f)); + float scale = Main.rand.NextFloat(0.5f, 1.5f); + CritSpark spark = new(position, velocity, Color.White, Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f), scale, 36, 0.2f, scale * 2f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + for (int i = 0; i < 6; i++) + { + Vector2 position = basePos + Vector2.UnitX * Main.rand.NextFloat(-16f, 16f); + Vector2 velocity = (Vector2.UnitY * Main.rand.NextFloat(-3f, -0.5f)).RotatedByRandom(MathHelper.ToRadians(12f)); + PearlParticle pearl = new(position, velocity, false, 24, Main.rand.NextFloat(0.5f, 1f), Main.hslToRgb(Main.rand.NextFloat(), 1f, (rareRoll || veryRareRoll) ? 0.75f : 1f)); + GeneralParticleHandler.SpawnParticle(pearl); + } } } } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 3f175fd86a..91eda97e51 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -251,7 +251,7 @@ namespace CalamityMod.CalPlayer } } - if (nCore && !Player.HasCooldown(Cooldowns.NebulousCore.ID)) + if (nebulousCore && !Player.HasCooldown(Cooldowns.NebulousCore.ID)) { SoundEngine.PlaySound(SoundID.Item67, Player.Center); @@ -430,6 +430,10 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrainRot" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); } + if (heavybleeding) + { + damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HeavyBleeding" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); + } if (laceration) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Laceration" + Main.rand.Next(1, 3 + 1)).Format(Player.name)); @@ -1542,15 +1546,27 @@ namespace CalamityMod.CalPlayer dust2.color = Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise; } } + + if (corrosiveSpine) + { + int cloudCount = 3; + for (int i = 0; i < cloudCount; i++) + { + float speed = 2f; + int damage = 40; + int cloud = Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); + if (cloud.WithinBounds(Main.maxProjectiles)) + Main.projectile[cloud].DamageType = DamageClass.Generic; + } + } } #endregion #region Free and Consumable Dodge Hooks public override bool FreeDodge(Player.HurtInfo info) { - // 22AUG2023: Ozzatron: god slayer damage resistance removed due to it being strong enough to godmode rev yharon // If the incoming damage is somehow less than 1 (TML doesn't allow this, but...), the hit is completely ignored. - if (info.Damage < 1 /* || (godSlayerDamage && info.Damage <= 80) */) + if (info.Damage < 1) return true; // Silva armor revive provides complete immunity. @@ -1687,16 +1703,16 @@ namespace CalamityMod.CalPlayer return true; // Mirror evades do not work if the global dodge cooldown is active. This cooldown can be triggered by either mirror. - if (!Player.HasCooldown(GlobalDodge.ID) && info.Damage >= dodgeDamageGateValue) + if (!Player.HasCooldown(GlobalDodge.ID) && actualDamageTaken >= dodgeDamageGateValue) { if (eclipseMirror) { - EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); + EclipseMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken); return true; } else if (abyssalMirror) { - AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, info.Damage); + AbyssMirrorDodge(dodgeDamageGateValuePercent, dodgeDamageGateValue, actualDamageTaken); return true; } } @@ -2245,8 +2261,6 @@ namespace CalamityMod.CalPlayer } #endregion - modStealth = 1f; - // Give Rage combat frames because being hurt counts as combat. if (RageEnabled) rageCombatFrames = BalancingConstants.RageCombatDelayTime; @@ -2521,7 +2535,7 @@ namespace CalamityMod.CalPlayer if (Player.wingsLogic == (int)VanillaWingID.BoneWings) { // Drop some bones for visual effects - if (Main.netMode != NetmodeID.Server && Player.wingTime > 0) + if (!Main.dedServ && Player.wingTime > 0) { var source = Player.GetSource_Accessory(FindAccessory(ItemID.BoneWings)); for (int i = 0; i < 6; i++) @@ -2857,7 +2871,7 @@ namespace CalamityMod.CalPlayer { NetMessage.SendPlayerDeath(Player.whoAmI, damageSource, (int)1000.0, 0, false, -1, -1); } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { ChatHelper.BroadcastChatMessage(deathText, new Color(225, 25, 25)); } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index b1ae96d3f6..e2c07cb591 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -99,13 +99,14 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(wDeath, 0); ApplyDoTDebuff(irradiated, 4, purity); - int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0); + int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0); ApplyDoTDebuff(sulphurPoison, sulphurDoT, purity); ApplyDoTDebuff(rTide, 6, purity); ApplyDoTDebuff(weakBrimstoneFlames, 7); ApplyDoTDebuff(bBlood, 8, purity); ApplyDoTDebuff(brainRot, 8, purity); - ApplyDoTDebuff(laceration, 12, purity); + ApplyDoTDebuff(heavybleeding, 30, purity); + ApplyDoTDebuff(laceration, 40, purity); ApplyDoTDebuff(vaporfied, 8, purity); int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1); ApplyDoTDebuff(staticDischarge, staticDoT, purity); @@ -166,6 +167,8 @@ namespace CalamityMod.CalPlayer increment *= 0.5f; if (sulphurSet && !ASPoisoning) increment *= 0.5f; + if (corrosiveSpine && !ASPoisoning) + increment *= 0.5f; if (ZoneAbyssLayer1 && !ASPoisoning) increment *= 0.33f; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ef562b99c3..c1821d50b0 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -883,7 +883,7 @@ namespace CalamityMod.CalPlayer private void MiscEffects() { // Update textures - if (Main.netMode != NetmodeID.Server && Player.whoAmI == Main.myPlayer) + if (!Main.dedServ && Player.whoAmI == Main.myPlayer) { Asset carpetAuric = ExtraTextureRefs.FlyingCarpetAuric; Asset carpetOriginal = ExtraTextureRefs.FlyingCarpetVanilla; @@ -1609,7 +1609,7 @@ namespace CalamityMod.CalPlayer // If any cooldowns were removed, send a cooldown removal packet that lists all cooldowns to remove. if (expiredCooldowns.Count > 0) - SyncCooldownRemoval(Main.netMode == NetmodeID.Server, expiredCooldowns); + SyncCooldownRemoval(Main.dedServ, expiredCooldowns); // Grant the player 5 seconds of immunity to immobilizing debuffs after an immobilizing debuff wears off. if (Player.stoned || Player.frozen || Player.webbed || gState) @@ -1725,8 +1725,6 @@ namespace CalamityMod.CalPlayer hideOfDeusTimer--; if (murasamaHitCooldown > 0) murasamaHitCooldown--; - if (harpyWingFeatherCooldown > 0) - harpyWingFeatherCooldown--; if (burningSeaBurnOut > 0) { burningSeaBurnOut--; @@ -2184,7 +2182,7 @@ namespace CalamityMod.CalPlayer } // Vortex Armor nerf - if (Player.vortexStealthActive) + if (Player.vortexStealthActive && Player.ActiveItem().type != ItemID.PsychoKnife) { Player.GetDamage() -= (1f - Player.stealth) * 0.4f; // Change 80 to 40 Player.GetCritChance() -= (int)((1f - Player.stealth) * 5f); // Change 20 to 15 @@ -2393,7 +2391,7 @@ namespace CalamityMod.CalPlayer #region Biome Effects public void DrawPollenInFloralParadise() { - if (!ZoneFloralParadise || !Main.rand.NextBool(7) || Main.netMode == NetmodeID.Server) + if (!ZoneFloralParadise || !Main.rand.NextBool(7) || Main.dedServ) return; for (int i = 0; i < 15; i++) @@ -2755,7 +2753,7 @@ namespace CalamityMod.CalPlayer Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; } else - aquaticBoost = aquaticBoostMax; modStealth = 1f; + aquaticBoost = aquaticBoostMax; if (Player.ActiveItem().type == ModContent.ItemType() && Player.StandingStill(0.1f)) { @@ -2763,7 +2761,7 @@ namespace CalamityMod.CalPlayer auralisStealthCounter++; bool usingScope = false; - if (!Main.gameMenu && Main.netMode != NetmodeID.Server) + if (!Main.gameMenu && !Main.dedServ) { if (Player.noThrow <= 0 && !Player.lastMouseInterface || !(Main.CurrentPan == Vector2.Zero)) { @@ -3532,7 +3530,7 @@ namespace CalamityMod.CalPlayer const int FramesPerHit = 30; // Constantly increment the timer every frame. - brimLoreInfernoTimer = (brimLoreInfernoTimer + 1) % FramesPerHit; + hydrothermicInfernoTimer = (hydrothermicInfernoTimer + 1) % FramesPerHit; // Only run this code for the client which is wearing the armor. // Brimstone flames is applied every single frame, but direct damage is only dealt twice per second. @@ -3552,7 +3550,7 @@ namespace CalamityMod.CalPlayer if (Vector2.Distance(Player.Center, npc.Center) <= range) { npc.AddBuff(ModContent.BuffType(), 120); - if (brimLoreInfernoTimer == 0) + if (hydrothermicInfernoTimer == 0) Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); } } @@ -4466,7 +4464,7 @@ namespace CalamityMod.CalPlayer #region Text Chat Messages private void HandleTextChatMessages() { - if (Player.whoAmI != Main.myPlayer || Main.netMode == NetmodeID.Server) + if (Player.whoAmI != Main.myPlayer || Main.dedServ) return; if (startMessageDisplayDelay >= 0) @@ -4633,7 +4631,7 @@ namespace CalamityMod.CalPlayer SyncAndroombaAIPacket.Send(npc.ModNPC(), phase: 1); } } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index b1d574f2ec..d022fd0e24 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -77,13 +77,13 @@ namespace CalamityMod.CalPlayer target.Calamity().IncreasedHeatEffects_Fireball = fireball; target.Calamity().IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; - target.Calamity().IncreasedHeatEffects_FlameWakerBoots = flameWakerBoots; - target.Calamity().IncreasedHeatEffects_HellfireTreads = hellfireTreads; + target.Calamity().IncreasedHeatEffects_FireBoots = bootLevel; target.Calamity().IncreasedHeatEffects_FlameWings = flameWingsHeat; target.Calamity().IncreasedSicknessEffects_ToxicHeart = toxicHeart; target.Calamity().IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; + target.Calamity().IncreasedSicknessAndWaterEffects_CorrosiveSpine = corrosiveSpine; switch (item.type) { @@ -193,12 +193,13 @@ namespace CalamityMod.CalPlayer cgn.IncreasedHeatEffects_Fireball = fireball; cgn.IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; - cgn.IncreasedHeatEffects_HellfireTreads = hellfireTreads; + cgn.IncreasedHeatEffects_FireBoots = bootLevel; cgn.IncreasedHeatEffects_FlameWings = flameWingsHeat; cgn.IncreasedSicknessEffects_ToxicHeart = toxicHeart; cgn.IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; + cgn.IncreasedSicknessAndWaterEffects_CorrosiveSpine = corrosiveSpine; switch (proj.type) { @@ -226,6 +227,11 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 60); break; + case ProjectileID.ButchersChainsaw: + case ProjectileID.MechanicalPiranha: + target.AddBuff(BuffType(), 180); + break; + case ProjectileID.LunarFlare: target.AddBuff(BuffType(), 180); break; @@ -309,7 +315,7 @@ namespace CalamityMod.CalPlayer if (!proj.npcProj && !proj.trap && proj.friendly) { - if ((plaguebringerCarapace || uberBees) && FriendlyBeesList.Includes(proj.type)) + if (plaguebringerCarapace && FriendlyBeesList.Includes(proj.type)) target.AddBuff(BuffType(), 300); // All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile @@ -1037,39 +1043,6 @@ namespace CalamityMod.CalPlayer titanCooldown = 15; } - if (corrosiveSpine && modProj.stealthStrikeHitCount < 3 && (Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()] + Player.ownedProjectileCounts[ProjectileType()]) < 3) - { - for (int i = 0; i < 3; i++) - { - if (Main.rand.NextBool()) - { - int type = -1; - switch (Main.rand.Next(15)) - { - case 0: - type = ProjectileType(); - break; - case 1: - type = ProjectileType(); - break; - case 2: - type = ProjectileType(); - break; - } - - if (type != -1) - { - int damage = (int)Player.GetTotalDamage().ApplyTo(22); - - float speed = Main.rand.NextFloat(5f, 11f); - int cloud = Projectile.NewProjectile(spawnSource, position, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, type, damage, proj.knockBack, Player.whoAmI); - if (cloud.WithinBounds(Main.maxProjectiles)) - Main.projectile[cloud].DamageType = DamageClass.Generic; - } - } - } - } - if (raiderTalisman && modProj.stealthStrike) { raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); @@ -1170,10 +1143,6 @@ namespace CalamityMod.CalPlayer { target.AddBuff(BuffType(), 120); } - if (corrosiveSpine) - { - target.AddBuff(BuffID.Poisoned, 240); - } } if (summon) { @@ -1228,6 +1197,10 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } + if (corrosiveSpine) + { + target.AddBuff(BuffType(), 120); + } if (alchFlask) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index 72a8847ebc..2abbd7d874 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -136,7 +136,7 @@ namespace CalamityMod public static void SyncWorld() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.WorldData); } @@ -245,6 +245,7 @@ namespace CalamityMod UpdateCodebreakerContainedStuff, UpdateCodebreakerDecryptCountdown, UnlockAbyssChests, + UpdateCanvasPainting, // Draedon Summoner CodebreakerSummonStuff, diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 3ca687018d..d408942aa2 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -337,7 +337,7 @@ namespace CalamityMod.Events // Flow: 2024/09/06 // Salute for the one who wrote 3 if conditional block after experiencing immeasurable torment with packet generations - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { AcidRainSyncPacket.Send(); AcidRainOldDukeSummonSyncPacket.Send(); diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index cc76cb9048..d3bf603ee5 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -541,7 +541,7 @@ namespace CalamityMod.Events if (HostileProjectileKillCounter == 1) CalamityUtils.KillAllHostileProjectiles(); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { BRHostileProjKillSyncPacket.Send(); } @@ -557,7 +557,7 @@ namespace CalamityMod.Events if (BossRushStage != 0) { BossRushStage = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { BossRushStagePacket.Send(); } @@ -656,7 +656,7 @@ namespace CalamityMod.Events CalamityUtils.KillAllHostileProjectiles(); CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { BossRushStagePacket.Send(); BossRushStartTimerPacket.Send(); @@ -745,7 +745,7 @@ namespace CalamityMod.Events } // Sync the stage and progress of Boss Rush whenever a relevant boss dies. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { BossRushStagePacket.Send(); BRHostileProjKillSyncPacket.Send(); @@ -776,7 +776,7 @@ namespace CalamityMod.Events public static void SyncStartTimer(int time) { StartTimer = time; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; BossRushStartTimerPacket.Send(); @@ -785,7 +785,7 @@ namespace CalamityMod.Events public static void SyncEndTimer(int time) { EndTimer = time; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; BossRushEndTimerPacket.Send(); diff --git a/FluidSimulation/FluidField.cs b/FluidSimulation/FluidField.cs index 03910f257f..eed9ca02fe 100644 --- a/FluidSimulation/FluidField.cs +++ b/FluidSimulation/FluidField.cs @@ -60,7 +60,7 @@ namespace CalamityMod.FluidSimulation { get { - if (Main.netMode != NetmodeID.Server && basicShader is null) + if (!Main.dedServ && basicShader is null) { basicShader = new BasicEffect(Main.instance.GraphicsDevice) { @@ -231,7 +231,7 @@ namespace CalamityMod.FluidSimulation { // Everything here involves heavy manipulation of render targets to work. Doing any of that on the server // would certainly result in a crash due to a lack of a graphics device. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; if (!ShouldUpdate) diff --git a/FluidSimulation/FluidFieldState.cs b/FluidSimulation/FluidFieldState.cs index e2825f3fd3..9dfa619573 100644 --- a/FluidSimulation/FluidFieldState.cs +++ b/FluidSimulation/FluidFieldState.cs @@ -26,7 +26,7 @@ namespace CalamityMod.FluidSimulation public FluidFieldState(int size, SurfaceFormat fieldContents = SurfaceFormat.Color) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Size = size; diff --git a/Graphics/Metaballs/GalaxyMetaball.cs b/Graphics/Metaballs/GalaxyMetaball.cs index 1a82913348..4d93ed1020 100644 --- a/Graphics/Metaballs/GalaxyMetaball.cs +++ b/Graphics/Metaballs/GalaxyMetaball.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Graphics.Metaballs public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Load the layer asset wrapper. diff --git a/Graphics/Metaballs/GruesomeMetaball.cs b/Graphics/Metaballs/GruesomeMetaball.cs index 3a67d24c7c..0c281d7e5f 100644 --- a/Graphics/Metaballs/GruesomeMetaball.cs +++ b/Graphics/Metaballs/GruesomeMetaball.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Graphics.Metaballs public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Load layer assets. diff --git a/Graphics/Metaballs/Metaball.cs b/Graphics/Metaballs/Metaball.cs index 0ad632f8ae..be9d5556bf 100644 --- a/Graphics/Metaballs/Metaball.cs +++ b/Graphics/Metaballs/Metaball.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Graphics.Metaballs MetaballManager.metaballs.Add(this); // Disallow render target creation on servers. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Generate render targets. diff --git a/Graphics/Metaballs/StreamGougeMetaball.cs b/Graphics/Metaballs/StreamGougeMetaball.cs index 0099af636c..0f31626192 100644 --- a/Graphics/Metaballs/StreamGougeMetaball.cs +++ b/Graphics/Metaballs/StreamGougeMetaball.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Graphics.Metaballs public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Load the layer asset wrapper. diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index 3316d1e63e..a4b0132ce1 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Graphics.Renderers #region Loading public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Main.QueueMainThreadAction(() => @@ -38,7 +38,7 @@ namespace CalamityMod.Graphics.Renderers public override void Unload() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Clear the cached renderers, so they can be readded on mod loading when initialized. diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index c4cb7b7d05..5708608818 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -89,6 +89,7 @@ namespace CalamityMod.ILEditing On_NPC.DoDeathEvents_CelebrateBossDeath += TripletsDefeatTextOverride; On_TileDrawing.DrawSingleTile += GlowMaskTileRender; On_Main.DoUpdate_HandleChat += SpawnPunchCard; + On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; // Mana Burn (Chaos Stone) and Chalice of the Blood God IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 8708e7a554..ad18abaeb4 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -11,11 +11,13 @@ using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Critters; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Dyes; using CalamityMod.Items.Placeables.FurniturePlagued; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.NPCs; +using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.Crabulon; @@ -24,10 +26,10 @@ using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.Ravager; using CalamityMod.Particles; using CalamityMod.Projectiles; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles; -using CalamityMod.Tiles.Abyss; using CalamityMod.Walls; using CalamityMod.Waterfalls; using CalamityMod.Waters; @@ -655,7 +657,7 @@ namespace CalamityMod.ILEditing modPlayer.chaliceBleedoutBuffer -= amountOfBleedToClear; // Display text indicating that healing was applied to the bleedout buffer. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { string text = $"(+{amountOfBleedToClear})"; Rectangle location = new Rectangle((int)player.position.X + 4, (int)player.position.Y - 3, player.width - 4, player.height - 4); @@ -850,7 +852,7 @@ namespace CalamityMod.ILEditing cursor.EmitDelegate(() => { - if (Main.netMode != NetmodeID.Server && BiomeTileCounterSystem.FloralParadiseTiles > 0) + if (!Main.dedServ && BiomeTileCounterSystem.FloralParadiseTiles > 0) DrawFog(Utils.GetLerpValue(0f, 250f, BiomeTileCounterSystem.FloralParadiseTiles, true)); }); @@ -1857,7 +1859,7 @@ namespace CalamityMod.ILEditing Main.npc[retinazerIndex].target = targetPlayerIndex; Main.npc[retinazerIndex].timeLeft *= 20; - if (Main.netMode == NetmodeID.Server && retinazerIndex < 200) + if (Main.dedServ && retinazerIndex < 200) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazerIndex); } @@ -1968,6 +1970,117 @@ namespace CalamityMod.ILEditing } #endregion + #region Allow Cannons to use jellyfish + public static void AllowCannonJellyfishUse(Terraria.On_Player.orig_PlaceThing_CannonBall orig, Player self) + { + // Check if the player is holding a jelly + if (self.HeldItem.type == ModContent.ItemType()) + { + // I have no comments here. + bool veryLongRangeCheck = self.position.X / 16f - (float)Player.tileRangeX - (float)self.HeldItem.tileBoost - (float)self.blockRange <= (float)Player.tileTargetX + && (self.position.X + (float)self.width) / 16f + (float)Player.tileRangeX + (float)self.HeldItem.tileBoost - 1f + (float)self.blockRange >= (float)Player.tileTargetX + && self.position.Y / 16f - (float)Player.tileRangeY - (float)self.HeldItem.tileBoost - (float)self.blockRange <= (float)Player.tileTargetY + && (self.position.Y + (float)self.height) / 16f + (float)Player.tileRangeY + (float)self.HeldItem.tileBoost - 2f + (float)self.blockRange >= (float)Player.tileTargetY; + + int targX = Player.tileTargetX; + int targY = Player.tileTargetY; + + Tile t = CalamityUtils.ParanoidTileRetrieval(targX, targY); + + // All vanilla cannon types (such as the Bunny Cannon) are a single tile ID, this lets us determine that this tile is the normal Cannon + int cannonType = t.TileFrameX / 72; + + // If the player's target tile is within range, is a normal Cannon, they are using an item, and their item time is zero, shoot the baby + if (t.TileType == TileID.Cannon && cannonType == 0 && self.ItemTimeIsZero && self.controlUseItem && veryLongRangeCheck) + { + self.cursorItemIconEnabled = true; + self.cursorItemIconID = ModContent.ItemType(); + self.HeldItem.makeNPC = -1; // Prevent it from spawning critters when used + + // Determines where all the action should happen and what the angle of the cannon is + int tileX = t.TileFrameX / 18; + int angle = 0; + while (tileX >= 4) + { + tileX -= 4; + } + tileX = targX - tileX; + int tileY; + for (tileY = t.TileFrameY / 18; tileY >= 3; tileY -= 3) + { + angle++; + } + tileY = targY - tileY; + + self.ApplyItemTime(self.HeldItem); + + float speedX = 0f; + float speedY = 0f; + + // Vanilla code for determining the velocity of shot cannonballs kept intact for consistency + if (angle == 0) + { + speedX = 10f; + speedY = 0f; + } + if (angle == 1) + { + speedX = 7.5f; + speedY = -2.5f; + } + if (angle == 2) + { + speedX = 5f; + speedY = -5f; + } + if (angle == 3) + { + speedX = 2.75f; + speedY = -6f; + } + if (angle == 4) + { + speedX = 0f; + speedY = -10f; + } + if (angle == 5) + { + speedX = -2.75f; + speedY = -6f; + } + if (angle == 6) + { + speedX = -5f; + speedY = -5f; + } + if (angle == 7) + { + speedX = -7.5f; + speedY = -2.5f; + } + if (angle == 8) + { + speedX = -10f; + speedY = 0f; + } + Vector2 spawnPosition = new Vector2((tileX + 2) * 16, (tileY + 2) * 16); + // Finally shoot the projectile + int jellyfishb = Projectile.NewProjectile(new EntitySource_TileInteraction(self, tileX, tileY), spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType(), self.HeldItem.damage, 8f, self.whoAmI); + Main.projectile[jellyfishb].originatedFromActivableTile = true; + // Shlorb + SoundEngine.PlaySound(SoundID.Item95, spawnPosition); + } + else + { + // Reset the item to be able to spawn critters again if any of the conditions aren't met + self.HeldItem.makeNPC = ModContent.NPCType(); + } + } + else + orig(self); + } + #endregion + #region Add Stohne to the Jungle public static void AddStohne(Terraria.GameContent.Biomes.On_JunglePass.orig_GenerateFinishingTouches orig, JunglePass self, GenerationProgress progress, int oldX, int oldY) { diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index 440cfaa92c..b2129bd402 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 29f496a0b1..51803181a3 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories public override void Load() { // All code below runs only if we're not loading on a server - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Add equip textures EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Head}", EquipType.Head, this); @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Accessories/AquaticHeart.cs b/Items/Accessories/AquaticHeart.cs index 0187c48cfc..5c5f1de826 100644 --- a/Items/Accessories/AquaticHeart.cs +++ b/Items/Accessories/AquaticHeart.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories public override void Load() { // All code below runs only if we're not loading on a server - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Add equip textures EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Head", EquipType.Head, this); @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Accessories/ArcFlashRing.cs b/Items/Accessories/ArcFlashRing.cs index 836b76e310..ab5618118d 100644 --- a/Items/Accessories/ArcFlashRing.cs +++ b/Items/Accessories/ArcFlashRing.cs @@ -1,7 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.ID; +using Terraria.GameContent; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,8 +13,8 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { - Item.width = 32; - Item.height = 34; + Item.width = 56; + Item.height = 64; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; @@ -27,5 +29,21 @@ namespace CalamityMod.Items.Accessories else modPlayer.arcFlashRingVisual = false; } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + texture: TextureAssets.Item[Type].Value, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.7f, + drawOffset: new(1f, 0f) + ); + return false; + } } } diff --git a/Items/Accessories/ArcFlashRing.png b/Items/Accessories/ArcFlashRing.png index f139949dbb..19487413b3 100644 Binary files a/Items/Accessories/ArcFlashRing.png and b/Items/Accessories/ArcFlashRing.png differ diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 384231f977..2a339cdff5 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -63,6 +63,8 @@ namespace CalamityMod.Items.Accessories player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Broken Armor player.buffImmune[ModContent.BuffType()] = true; // Counterpart to Burning Blood player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Bleeding + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; player.buffImmune[BuffID.Venom] = true; // "Stronger" Poisoned player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Poisoned player.buffImmune[BuffID.Webbed] = true; // "Stronger" Slow diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index 7c5896228e..deb11f3734 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -22,6 +23,10 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodPact = true; // This applies the +25% health boost. modPlayer.healingPotionMultiplier += 0.25f; + //Grants immunity to most Bleeding debuffs + player.buffImmune[BuffID.Bleeding] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/Accessories/BloodyWormScarf.png b/Items/Accessories/BloodyWormScarf.png index 1821a0087c..8d15037447 100644 Binary files a/Items/Accessories/BloodyWormScarf.png and b/Items/Accessories/BloodyWormScarf.png differ diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index edc3fe6b1c..622a89f0a2 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Rarities; @@ -51,6 +52,12 @@ namespace CalamityMod.Items.Accessories player.pStone = true; player.lifeRegen += 4; + //All of Blood Pact's immunities + Laceration + player.buffImmune[BuffID.Bleeding] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[ModContent.BuffType()] = true; + // This applies the +25% health boost and the bleedout buffer effect. // Health boost intentionally stacks with Blood Pact. // This accessory's bleedout buffer clearing effect intentionally stacks with Blood Pact's healing potion boost. diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index 6f99322f4d..f9bc1fde4a 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,29 +22,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.corrosiveSpine = true; player.moveSpeed += 0.05f; - player.Calamity().corrosiveSpine = true; - if (player.immune) - { - if (Main.rand.NextBool(15)) - { - var source = player.GetSource_Accessory(Item); - int cloudCount = Main.rand.Next(2, 5); - for (int i = 0; i < cloudCount; i++) - { - int type = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); - float speed = Main.rand.NextFloat(3f, 11f); - int damage = (int)player.GetTotalDamage().ApplyTo(80); - Projectile.NewProjectile(source, player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * speed, - type, damage, 0f, player.whoAmI); - } - } - } } } } diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index fc1e5de671..c422418d78 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 67ce61386b..56872a2ae0 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.OverrideHelmet[equipSlot] = true; diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 277820b7da..fe23201469 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.nCore = true; + modPlayer.nebulousCore = true; player.GetDamage() += 0.1f; // Spawn nebula stars diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 74efa4c071..96480eb4f3 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Face); ArmorIDs.Face.Sets.PreventHairDraw[equipSlot] = true; diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 85149a4964..bd3e7ab7ba 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -157,7 +157,7 @@ namespace CalamityMod.Items.Accessories */ public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransHead", EquipType.Head, this); @@ -174,7 +174,7 @@ namespace CalamityMod.Items.Accessories Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); ItemID.Sets.AnimatesAsSoul[Type] = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index eb6eb0c6b2..2a0664a95c 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -179,10 +179,6 @@ namespace CalamityMod.Items.Accessories TwoPlaces(60f * player.GetStandingStealthRegen()), TwoPlaces(60f * player.GetMovingStealthRegen()), Sign(rogueVelocity) + TwoPlaces(100f * rogueVelocity)); - - // Rogue consumable chance only if item is consumable - if (heldItem.consumable) - stats2 += this.GetLocalization("RogueConsumption").Format(100f * modPlayer.rogueAmmoCost); } // If tool, add tool range diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index 5e8b8ae18d..32ca98b5e7 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet", EquipType.Head, name: "WulfrumOldSetHead"); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body", EquipType.Body, this); @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs index 0d24c267b9..d5c29472b1 100644 --- a/Items/Accessories/Vanity/CrystalHeartVodka.cs +++ b/Items/Accessories/Vanity/CrystalHeartVodka.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Body", EquipType.Body, this); @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/Accessories/Vanity/GhostBracelet.cs b/Items/Accessories/Vanity/GhostBracelet.cs index b5087243a8..18bb48b9c6 100644 --- a/Items/Accessories/Vanity/GhostBracelet.cs +++ b/Items/Accessories/Vanity/GhostBracelet.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Body", EquipType.Body, this); @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/Accessories/Vanity/HapuFruit.cs b/Items/Accessories/Vanity/HapuFruit.cs index 30f2a7fefa..65b1948303 100644 --- a/Items/Accessories/Vanity/HapuFruit.cs +++ b/Items/Accessories/Vanity/HapuFruit.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Body", EquipType.Body, this); @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/Accessories/Vanity/OracleHeadphones.cs b/Items/Accessories/Vanity/OracleHeadphones.cs index b6997d3609..47645f8084 100644 --- a/Items/Accessories/Vanity/OracleHeadphones.cs +++ b/Items/Accessories/Vanity/OracleHeadphones.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Body", EquipType.Body, this); @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index f78f57563a..66fe6d0f3c 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/PopoNoseless_Head", EquipType.Head, name: "PopoNoseless"); @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Accessories/Vanity/PunchCard.cs b/Items/Accessories/Vanity/PunchCard.cs index 4fef249a0e..40ac2b7d48 100644 --- a/Items/Accessories/Vanity/PunchCard.cs +++ b/Items/Accessories/Vanity/PunchCard.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Accessories.Vanity public new string LocalizationCategory => "Items.Accessories"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Head", EquipType.Head, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Body", EquipType.Body, this); @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); diff --git a/Items/AlicornonaStick.cs b/Items/AlicornonaStick.cs index 4f30a42f0b..1a0dda3f93 100644 --- a/Items/AlicornonaStick.cs +++ b/Items/AlicornonaStick.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items { int damage = npc.SimpleStrikeNPC((int)(npc.lifeMax / 200), player.direction, true); SoundEngine.PlaySound(Projectiles.Summon.CnidarianJellyfishOnTheString.SlapSound with { Volume = 2, MaxInstances = 200 }, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { BloodShed(itemRect, npc, damage, player); } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadgear.cs index 874e6b6821..2caf137da0 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadgear.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Aerospec public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; } diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index 91ccc4cd61..caa5cbe2cc 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Auric public override void Load() { // All code below runs only if we're not loading on a server - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Add equip textures EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Auric/AuricTeslaBodyArmor_Back", EquipType.Back, this); diff --git a/Items/Armor/Brimflame/BrimflameRobes.cs b/Items/Armor/Brimflame/BrimflameRobes.cs index 5bf558ddb0..8e2ba2b87b 100644 --- a/Items/Armor/Brimflame/BrimflameRobes.cs +++ b/Items/Armor/Brimflame/BrimflameRobes.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Brimflame public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs index 4da0b51cd9..4436d3cea4 100644 --- a/Items/Armor/CirrusDress.cs +++ b/Items/Armor/CirrusDress.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/CirrusDress_Legs", EquipType.Legs, this); } @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesHands[equipSlot] = true; diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 99653f3213..9b81c403db 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Daedalus public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Daedalus/DaedalusBreastplate_Waist", EquipType.Waist, this); diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index a3a13900f7..2e854e84d2 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Items.Armor.Demonshade { int damage = (int)player.GetTotalDamage().ApplyTo(DevilDamage); - var devil = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 0f); + var devil = Projectile.NewProjectileDirect(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 2f, 0f); devil.originalDamage = DevilDamage; } } diff --git a/Items/Armor/DesertProwler/DesertProwlerSet.cs b/Items/Armor/DesertProwler/DesertProwlerSet.cs index d29bc40ab5..7d7bcd3c06 100644 --- a/Items/Armor/DesertProwler/DesertProwlerSet.cs +++ b/Items/Armor/DesertProwler/DesertProwlerSet.cs @@ -205,7 +205,7 @@ namespace CalamityMod.Items.Armor.DesertProwler public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index 1cb1f1d103..bf80cf38b8 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Empyrean public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/EmpyreanCloak_Neck", EquipType.Neck, this); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/EmpyreanCloak_Back", EquipType.Back, this); @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index cfed0d75cc..87b20de371 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Empyrean public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/MeldTransformation_Head", EquipType.Head, name: "MeldTransformation"); EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Empyrean/MeldTransformation_Body", EquipType.Body, name: "MeldTransformation"); @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; var equipSlotHead = EquipLoader.GetEquipSlot(Mod, "MeldTransformation", EquipType.Head); diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index f08a2fdb0b..be0e044c58 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index 322a0667f7..f5566fca6f 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; } diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index 34eb51bc23..bc1b1eaadc 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); @@ -138,14 +138,14 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs", EquipType.Legs, this); } public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; } @@ -366,7 +366,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect MountData.playerHeadOffset = 4; //Sprites - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureGlow = Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index cd1bde96a9..86e43aab19 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index 60b3e78e26..f431d2621b 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/OmegaBlue/OmegaBlueHelmet_HeadMadness", EquipType.Head, name: "OmegaBlueTransformation"); } @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; var equipSlotHead = EquipLoader.GetEquipSlot(Mod, "OmegaBlueTransformation", EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 444b81aa4e..54f1cbbf0a 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.OmegaBlue public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); diff --git a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs index 5dfb7ff7c5..dc7245ce1a 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer public new string LocalizationCategory => "Items.Armor.Hardmode"; public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Prismatic/PrismaticRegalia.cs b/Items/Armor/Prismatic/PrismaticRegalia.cs index 960e7b4a34..fbb6023108 100644 --- a/Items/Armor/Prismatic/PrismaticRegalia.cs +++ b/Items/Armor/Prismatic/PrismaticRegalia.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Prismatic public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 43de28e502..4b4f5a5f6d 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Reaver public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index cc726ffdc5..c9cc263a73 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/SnowRuffian/SnowRuffianChestplate_Back", EquipType.Back, this); @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index 20ea54216f..c05014c4cb 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/SnowRuffian/SnowRuffianWings", EquipType.Wings, this, equipTexture: new SnowRuffianWings()); } diff --git a/Items/Armor/Statigel/StatigelArmor.cs b/Items/Armor/Statigel/StatigelArmor.cs index 61dd19de8f..0ff1c28e1f 100644 --- a/Items/Armor/Statigel/StatigelArmor.cs +++ b/Items/Armor/Statigel/StatigelArmor.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Statigel public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index f52d439894..8a7129a95b 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.TitanHeart public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs index 4db1f50099..e34bb084e0 100644 --- a/Items/Armor/Vanity/AnahitaMask.cs +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/ApolloMask.cs b/Items/Armor/Vanity/ApolloMask.cs index 4fa5fab09d..a8a803c4a0 100644 --- a/Items/Armor/Vanity/ApolloMask.cs +++ b/Items/Armor/Vanity/ApolloMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; diff --git a/Items/Armor/Vanity/AquaticScourgeMask.cs b/Items/Armor/Vanity/AquaticScourgeMask.cs index be678d7788..6376110756 100644 --- a/Items/Armor/Vanity/AquaticScourgeMask.cs +++ b/Items/Armor/Vanity/AquaticScourgeMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/AresMask.cs b/Items/Armor/Vanity/AresMask.cs index aa5580989e..7a00162411 100644 --- a/Items/Armor/Vanity/AresMask.cs +++ b/Items/Armor/Vanity/AresMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/ArtemisMask.cs b/Items/Armor/Vanity/ArtemisMask.cs index b7566aee1f..25ed7aca01 100644 --- a/Items/Armor/Vanity/ArtemisMask.cs +++ b/Items/Armor/Vanity/ArtemisMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; diff --git a/Items/Armor/Vanity/AshenHorns.cs b/Items/Armor/Vanity/AshenHorns.cs index 7837db098a..3810a096c6 100644 --- a/Items/Armor/Vanity/AshenHorns.cs +++ b/Items/Armor/Vanity/AshenHorns.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; } diff --git a/Items/Armor/Vanity/AstrumAureusMask.cs b/Items/Armor/Vanity/AstrumAureusMask.cs index e1fef0a232..6302db15c8 100644 --- a/Items/Armor/Vanity/AstrumAureusMask.cs +++ b/Items/Armor/Vanity/AstrumAureusMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/AstrumDeusMask.cs b/Items/Armor/Vanity/AstrumDeusMask.cs index 02f8e896a6..b69d950e2d 100644 --- a/Items/Armor/Vanity/AstrumDeusMask.cs +++ b/Items/Armor/Vanity/AstrumDeusMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.cs b/Items/Armor/Vanity/BrimstoneWaifuMask.cs index 0b924dfe7e..eb0be7c6be 100644 --- a/Items/Armor/Vanity/BrimstoneWaifuMask.cs +++ b/Items/Armor/Vanity/BrimstoneWaifuMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/BumblefuckMask.cs b/Items/Armor/Vanity/BumblefuckMask.cs index daa49fa6a4..4b3cc4d5f2 100644 --- a/Items/Armor/Vanity/BumblefuckMask.cs +++ b/Items/Armor/Vanity/BumblefuckMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/CalamitasCloneMask.cs b/Items/Armor/Vanity/CalamitasCloneMask.cs index 70e99716a0..e7b9028f0f 100644 --- a/Items/Armor/Vanity/CalamitasCloneMask.cs +++ b/Items/Armor/Vanity/CalamitasCloneMask.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/CeaselessVoidMask.cs b/Items/Armor/Vanity/CeaselessVoidMask.cs index b904b2dc40..59eebc330a 100644 --- a/Items/Armor/Vanity/CeaselessVoidMask.cs +++ b/Items/Armor/Vanity/CeaselessVoidMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/CrabulonMask.cs b/Items/Armor/Vanity/CrabulonMask.cs index 9762528cb5..20104d4fbc 100644 --- a/Items/Armor/Vanity/CrabulonMask.cs +++ b/Items/Armor/Vanity/CrabulonMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/CryogenMask.cs b/Items/Armor/Vanity/CryogenMask.cs index f040947bf1..7b5ff08c9b 100644 --- a/Items/Armor/Vanity/CryogenMask.cs +++ b/Items/Armor/Vanity/CryogenMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/DesertScourgeMask.cs b/Items/Armor/Vanity/DesertScourgeMask.cs index 2f02591f1b..38f27aff27 100644 --- a/Items/Armor/Vanity/DesertScourgeMask.cs +++ b/Items/Armor/Vanity/DesertScourgeMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/DevourerofGodsMask.cs b/Items/Armor/Vanity/DevourerofGodsMask.cs index 66d8800593..a6d1ce5b97 100644 --- a/Items/Armor/Vanity/DevourerofGodsMask.cs +++ b/Items/Armor/Vanity/DevourerofGodsMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/DraedonMask.cs b/Items/Armor/Vanity/DraedonMask.cs index cdc742b38c..4600a31152 100644 --- a/Items/Armor/Vanity/DraedonMask.cs +++ b/Items/Armor/Vanity/DraedonMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/HiveMindMask.cs b/Items/Armor/Vanity/HiveMindMask.cs index 31ff5b076d..b8f888d5ed 100644 --- a/Items/Armor/Vanity/HiveMindMask.cs +++ b/Items/Armor/Vanity/HiveMindMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/HoodOfCalamity.cs b/Items/Armor/Vanity/HoodOfCalamity.cs index 8b98f05fdb..1a89bb31a8 100644 --- a/Items/Armor/Vanity/HoodOfCalamity.cs +++ b/Items/Armor/Vanity/HoodOfCalamity.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/OldDukeMask.cs b/Items/Armor/Vanity/OldDukeMask.cs index 03c00611bb..01d8b8168c 100644 --- a/Items/Armor/Vanity/OldDukeMask.cs +++ b/Items/Armor/Vanity/OldDukeMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/OldHunterSet.cs b/Items/Armor/Vanity/OldHunterSet.cs index 03471b531d..475720b465 100644 --- a/Items/Armor/Vanity/OldHunterSet.cs +++ b/Items/Armor/Vanity/OldHunterSet.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void Load() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/OldHunterShirt_Back", EquipType.Back, this); @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); diff --git a/Items/Armor/Vanity/PerforatorMask.cs b/Items/Armor/Vanity/PerforatorMask.cs index 03148413bf..7cdd7dfb70 100644 --- a/Items/Armor/Vanity/PerforatorMask.cs +++ b/Items/Armor/Vanity/PerforatorMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs index 148f99be3e..45f97fd825 100644 --- a/Items/Armor/Vanity/PlaguebringerGoliathMask.cs +++ b/Items/Armor/Vanity/PlaguebringerGoliathMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/PolterghastMask.cs b/Items/Armor/Vanity/PolterghastMask.cs index e0b4a533ff..2c6fdea8c3 100644 --- a/Items/Armor/Vanity/PolterghastMask.cs +++ b/Items/Armor/Vanity/PolterghastMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/ProfanedGuardianMask.cs b/Items/Armor/Vanity/ProfanedGuardianMask.cs index 02e6f1d34c..2f5efd9e07 100644 --- a/Items/Armor/Vanity/ProfanedGuardianMask.cs +++ b/Items/Armor/Vanity/ProfanedGuardianMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/ProvidenceMask.cs b/Items/Armor/Vanity/ProvidenceMask.cs index 289def74b9..4167a58cc0 100644 --- a/Items/Armor/Vanity/ProvidenceMask.cs +++ b/Items/Armor/Vanity/ProvidenceMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/RavagerMask.cs b/Items/Armor/Vanity/RavagerMask.cs index 6e7c7352a2..0aa28dcd63 100644 --- a/Items/Armor/Vanity/RavagerMask.cs +++ b/Items/Armor/Vanity/RavagerMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/RobesOfCalamity.cs b/Items/Armor/Vanity/RobesOfCalamity.cs index dad5b38905..cf7c73c7c3 100644 --- a/Items/Armor/Vanity/RobesOfCalamity.cs +++ b/Items/Armor/Vanity/RobesOfCalamity.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public new string LocalizationCategory => "Items.Armor.Vanity"; public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/RobesOfCalamity_Legs", EquipType.Legs, this); } diff --git a/Items/Armor/Vanity/SCalMask.cs b/Items/Armor/Vanity/SCalMask.cs index a83226b508..543959bb77 100644 --- a/Items/Armor/Vanity/SCalMask.cs +++ b/Items/Armor/Vanity/SCalMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/SCalRobes.cs b/Items/Armor/Vanity/SCalRobes.cs index fb1ccb4200..957153739f 100644 --- a/Items/Armor/Vanity/SCalRobes.cs +++ b/Items/Armor/Vanity/SCalRobes.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; diff --git a/Items/Armor/Vanity/SignusMask.cs b/Items/Armor/Vanity/SignusMask.cs index 6936aac06e..c67217c8e1 100644 --- a/Items/Armor/Vanity/SignusMask.cs +++ b/Items/Armor/Vanity/SignusMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/SlimeGodMask.cs b/Items/Armor/Vanity/SlimeGodMask.cs index 163b2e0864..2c9504bf3e 100644 --- a/Items/Armor/Vanity/SlimeGodMask.cs +++ b/Items/Armor/Vanity/SlimeGodMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/SlimeGodMask2.cs b/Items/Armor/Vanity/SlimeGodMask2.cs index 1c773f2cb4..3a4cbc553c 100644 --- a/Items/Armor/Vanity/SlimeGodMask2.cs +++ b/Items/Armor/Vanity/SlimeGodMask2.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/StormWeaverMask.cs b/Items/Armor/Vanity/StormWeaverMask.cs index c588118a60..d32c21b1d6 100644 --- a/Items/Armor/Vanity/StormWeaverMask.cs +++ b/Items/Armor/Vanity/StormWeaverMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Vanity/TheCommandersCap.cs b/Items/Armor/Vanity/TheCommandersCap.cs new file mode 100644 index 0000000000..5340bc723e --- /dev/null +++ b/Items/Armor/Vanity/TheCommandersCap.cs @@ -0,0 +1,62 @@ +using CalamityMod.NPCs.TownNPCs; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class TheCommandersCap : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void SetStaticDefaults() + { + + if (!Main.dedServ) + ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = false; + } + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateVanitySet(Player player) + { + if (!player.CCed && !(Main.gamePaused && !Main.gameMenu) && player.velocity.X != 0f && player.velocity.Y == 0f) + { + for (int k = 0; k < 2; k++) + { + int dust = Dust.NewDust(new Vector2(player.position.X, player.position.Y + (float)((player.gravDir == 1f) ? (player.height - 2) : (-4))), player.width, 6, DustID.Cloud, 0f, 0f, 100, default, 0.1f); + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].shader = GameShaders.Armor.GetSecondaryShader(player.ArmorSetDye(), player); + } + } + } + + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 5). + AddRecipeGroup("AnyGoldBar", 1). + AddIngredient(ItemID.BlueDye, 1). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/TheCommandersCap.png b/Items/Armor/Vanity/TheCommandersCap.png new file mode 100644 index 0000000000..6ee7aa6cd2 Binary files /dev/null and b/Items/Armor/Vanity/TheCommandersCap.png differ diff --git a/Items/Armor/Vanity/TheCommandersCap_Head.png b/Items/Armor/Vanity/TheCommandersCap_Head.png new file mode 100644 index 0000000000..08c903b44a Binary files /dev/null and b/Items/Armor/Vanity/TheCommandersCap_Head.png differ diff --git a/Items/Armor/Vanity/TheFormalFootwear.cs b/Items/Armor/Vanity/TheFormalFootwear.cs new file mode 100644 index 0000000000..33fa080b6c --- /dev/null +++ b/Items/Armor/Vanity/TheFormalFootwear.cs @@ -0,0 +1,31 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class TheFormalFootwear : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.vanity = true; + Item.rare = ItemRarityID.Blue; + Item.Calamity().donorItem = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Leather, 2). + AddRecipeGroup("AnyGoldBar", 1). + AddIngredient(ItemID.BlueDye, 1). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/TheFormalFootwear.png b/Items/Armor/Vanity/TheFormalFootwear.png new file mode 100644 index 0000000000..530ab340c0 Binary files /dev/null and b/Items/Armor/Vanity/TheFormalFootwear.png differ diff --git a/Items/Armor/Vanity/TheFormalFootwear_Legs.png b/Items/Armor/Vanity/TheFormalFootwear_Legs.png new file mode 100644 index 0000000000..503273f00b Binary files /dev/null and b/Items/Armor/Vanity/TheFormalFootwear_Legs.png differ diff --git a/Items/Armor/Vanity/TheGrandGarment.cs b/Items/Armor/Vanity/TheGrandGarment.cs new file mode 100644 index 0000000000..1f8758e0fc --- /dev/null +++ b/Items/Armor/Vanity/TheGrandGarment.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class TheGrandGarment : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void Load() + { + if (!Main.dedServ) + { + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Vanity/TheGrandGarment_Waist", EquipType.Waist, this); + } + } + + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 20; + Item.rare = ItemRarityID.Blue; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + + public override void EquipFrameEffects(Player player, EquipType type) + { + player.waist = (sbyte)EquipLoader.GetEquipSlot(Mod, Name, EquipType.Waist); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Leather, 2). + AddIngredient(ItemID.BlueDye, 1). + AddTile(TileID.Loom). + Register(); + } + } +} diff --git a/Items/Armor/Vanity/TheGrandGarment.png b/Items/Armor/Vanity/TheGrandGarment.png new file mode 100644 index 0000000000..2f3a1044e0 Binary files /dev/null and b/Items/Armor/Vanity/TheGrandGarment.png differ diff --git a/Items/Armor/Vanity/TheGrandGarment_Body.png b/Items/Armor/Vanity/TheGrandGarment_Body.png new file mode 100644 index 0000000000..6b7e6cd81c Binary files /dev/null and b/Items/Armor/Vanity/TheGrandGarment_Body.png differ diff --git a/Items/Armor/Vanity/TheGrandGarment_Waist.png b/Items/Armor/Vanity/TheGrandGarment_Waist.png new file mode 100644 index 0000000000..760f824c5b Binary files /dev/null and b/Items/Armor/Vanity/TheGrandGarment_Waist.png differ diff --git a/Items/Armor/Vanity/YharonMask.cs b/Items/Armor/Vanity/YharonMask.cs index 2a68372be7..8e4beefe10 100644 --- a/Items/Armor/Vanity/YharonMask.cs +++ b/Items/Armor/Vanity/YharonMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor.Vanity public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ArmorIDs.Head.Sets.DrawHead[Item.headSlot] = false; } diff --git a/Items/Armor/Victide/VictideBreastplate.cs b/Items/Armor/Victide/VictideBreastplate.cs index f8e6c751c8..43e1c6649b 100644 --- a/Items/Armor/Victide/VictideBreastplate.cs +++ b/Items/Armor/Victide/VictideBreastplate.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Victide public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { //register the faulds texture. This appears either when the leggings or the chestplate is equipped (both works) EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Victide/VictideFaulds_Waist", EquipType.Waist, name: "VictideFaulds"); @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; diff --git a/Items/Armor/Victide/VictideGreaves.cs b/Items/Armor/Victide/VictideGreaves.cs index a9a702b35b..6e96d6af32 100644 --- a/Items/Armor/Victide/VictideGreaves.cs +++ b/Items/Armor/Victide/VictideGreaves.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 0ed6f4412c..69987f14d2 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_FemaleHead", EquipType.Head, name: "WulfrumHatFemale"); } @@ -274,7 +274,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public new string LocalizationCategory => "Items.Armor.PreHardmode"; public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesArms[equipSlot] = true; @@ -318,7 +318,7 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.rare = ItemRarityID.Blue; Item.defense = 1; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; @@ -361,7 +361,7 @@ namespace CalamityMod.Items.Armor.Wulfrum public override void Kill(double damage, int hitDirection, bool pvp, PlayerDeathReason damageSource) { - if (WulfrumHat.PowerModeEngaged(Player, out var cd) && Main.netMode != NetmodeID.Server) + if (WulfrumHat.PowerModeEngaged(Player, out var cd) && !Main.dedServ) { SetBonusEndEffect(true); if (!Player.GetModPlayer().vanityEquipped) @@ -385,7 +385,7 @@ namespace CalamityMod.Items.Armor.Wulfrum if (cd.timeLeft < WulfrumHat.BastionCooldown) { cd.timeLeft = WulfrumHat.BastionCooldown - 1; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) SetBonusEndEffect(true); } } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 50d42de178..302c60bac9 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -46,15 +46,25 @@ namespace CalamityMod.Items public override bool InstancePerEntity => true; // TODO -- split out a separate GlobalItem for rogue behavior? + /// Tracks the stealth strike damage modifier for this item, derived from its prefix. internal float StealthStrikePrefixBonus; #region Chargeable Item Variables + /// + /// If set to true, this item will consume on use.
+ /// Be sure to also set and . + ///
public bool UsesCharge = false; + /// The current charge value of this item. public float Charge = 0f; + /// The maximum charge value of this item. Should only be set if is set to true. public float MaxCharge = 1f; + /// The charge consumed on each use of this item. Should only be set if is set to true. public float ChargePerUse = 0f; - // If left at the default value of -1, ChargePerUse is automatically used for alt fire. - // If you want a different amount of charge used for alt fire, then set a different value here. + /// + /// By default, the right-click use of an item will use to determine how much charge to consume.
+ /// Set to a value other than -1 to make the right-click use a different amount of charge. + ///
public float ChargePerAltUse = -1f; public float ChargeRatio { @@ -67,8 +77,14 @@ namespace CalamityMod.Items #endregion #region Enchantment Variables + /// If set to true, this item cannot receive enchantments from the Brimstone Witch. public bool CannotBeEnchanted = false; + /// Stores the current enchantment placed on this item. If set to null, this item has no enchantment. public Enchantment? AppliedEnchantment = null; + /// + /// Stores the "exhaustion" value of this item for the Ephemeral enchantment.
+ /// The ratio of this value to the maximum value is used as a lerp value for the damage multiplier. + ///
public float DischargeEnchantExhaustion = 0; public float DischargeExhaustionRatio { @@ -78,16 +94,39 @@ namespace CalamityMod.Items return float.IsNaN(ratio) || float.IsInfinity(ratio) ? 0f : MathHelper.Clamp(ratio, 0f, 1f); } } + /// Constant value storing the maximum value for the Ephemeral enchantment's "exhaustion" value. public const float DischargeEnchantExhaustionCap = 1600f; + /// The minimum damage multiplier for weapons with the Ephemeral enchantment. public const float DischargeEnchantMinDamageFactor = 0.77f; + /// The maximum damage multiplier for weapons with the Ephemeral enchantment. public const float DischargeEnchantMaxDamageFactor = 1.26f; #endregion // Miscellaneous stuff + /// + /// Set to true if this item can only be obtained in Revengeance Mode.
+ /// Adds "Revengeance" to the bottom of the item's tooltip. + ///
public bool revengeanceItem = false; + /// + /// Set to true if this item is dedicated to a Patreon donator.
+ /// Adds "- Donor Item -" to the bottom of the item's tooltip. + ///
public bool donorItem = false; + /// + /// Set to true if this item is dedicated to a Calamity developer.
+ /// Adds "- Dev Item -" to the bottom of the item's tooltip. + ///
public bool devItem = false; + /// + /// If true, this item can fire projectiles with point-blank damage.
+ /// Also adds a tooltip line to the bottom of the item's tooltip. + ///
public bool canFirePointBlankShots = false; + /// + /// If set to a value greater than 1, applies a multiplier to the item's grab range.
+ /// Used by coin items spawned from hitting ricoshot coins. + ///
public float grabRangeMultiplier = 1f; public static readonly Color ExhumedTooltipColor = new Color(198, 27, 64); @@ -519,9 +558,9 @@ namespace CalamityMod.Items } if (modPlayer.harpyWingBoost && (modPlayer.harpyRing || modPlayer.angelTreads)) { - if (Main.rand.NextBool(5) && modPlayer.harpyWingFeatherCooldown == 0 && !item.channel) + if (Main.rand.NextBool(5) && modPlayer.wingProjectileCooldown == 0 && !item.channel) { - modPlayer.harpyWingFeatherCooldown = 20; + modPlayer.wingProjectileCooldown = 20; if (player.whoAmI == Main.myPlayer) { float spreadX = velocity.X + Main.rand.NextFloat(-0.75f, 0.75f); @@ -616,6 +655,16 @@ namespace CalamityMod.Items #endregion #region Use Item Changes + public override void HoldItem(Item item, Player player) + { + // Clear Evil Smasher buffs if not holding Evil Smasher + if (player.Calamity().evilSmasherBoost > 0) + { + if (item.type != ModContent.ItemType()) + player.Calamity().evilSmasherBoost = 0; + } + } + public override bool? UseItem(Item item, Player player) { if (Main.zenithWorld && item.type == ItemID.RodOfHarmony) @@ -626,20 +675,6 @@ namespace CalamityMod.Items player.AddBuff(ModContent.BuffType(), 3600 * 60); } } - if (player.Calamity().evilSmasherBoost > 0) - { - if (item.type != ModContent.ItemType()) - player.Calamity().evilSmasherBoost = 0; - } - - if (player.HasBuff(BuffID.ParryDamageBuff)) - { - if (item.type != ItemID.DD2SquireDemonSword && item.type != ItemID.BouncingShield) - { - player.parryDamageBuff = false; - player.ClearBuff(BuffID.ParryDamageBuff); - } - } // Give 1 minute of Mushy buff when consuming Mushrooms with Fungal Symbiote equipped. if (item.type == ItemID.Mushroom && player.Calamity().fungalSymbiote) @@ -1334,32 +1369,11 @@ namespace CalamityMod.Items player.GetAttackSpeed() -= 0.1f; } - if (item.type == ItemID.CelestialStone) + if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell) { player.GetAttackSpeed() -= 0.1f; } - if (item.type == ItemID.CelestialShell) - { - player.GetAttackSpeed() -= 0.1f; - if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; - } - - //Moon Charm and Moon Shell melee speed removal - - if (item.type == ItemID.MoonCharm) - { - if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; - } - - if (item.type == ItemID.MoonShell) - { - if (!Main.dayTime) - player.GetAttackSpeed() -= 0.051f; - } - if (item.type == ItemID.TerrasparkBoots) player.buffImmune[BuffID.OnFire] = true; diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 43887cb1f2..3734546ed4 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -118,6 +118,7 @@ namespace CalamityMod.Items { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(88)) }, { ItemID.FrostStaff, Do(DamageExact(160), UseExact(37), ShootSpeedExact(20f)) }, // has 1 extra update { ItemID.Gatligator, Do(PointBlank, UseExact(6)) }, + { ItemID.GoldCoin, Do(DamageExact(75)) }, // For Coin Gun { ItemID.GoldShortsword, Do(AutoReuse, TrueMelee, DamageExact(17)) }, { ItemID.GolemFist, Do(DamageExact(150)) }, { ItemID.Gradient, Do(AutoReuse, DamageExact(39)) }, @@ -148,7 +149,7 @@ namespace CalamityMod.Items { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, { ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) }, { ItemID.LeadShortsword, Do(AutoReuse, TrueMelee, DamageExact(11)) }, - { ItemID.LightDisc, Do(DamageExact(128), ShootSpeedExact(18)) }, + { ItemID.LightDisc, Do(DamageExact(98), ShootSpeedExact(18)) }, { ItemID.LunarFlareBook, Do(DamageExact(120)) }, { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, { ItemID.MagicDagger, Do(DamageRatio(1.8f), UseRatio(1.88f), ShootSpeedExact(30)) }, // Uses ratios due to remix seed @@ -166,7 +167,7 @@ namespace CalamityMod.Items { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury { ItemID.MoonlordBullet, Do(DamageExact(19)) }, // Luminite Bullet - { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, //Lunar Portal Staff + { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, // Lunar Portal Staff { ItemID.Muramasa, Do(CritDelta(+10)) }, { ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) }, { ItemID.Musket, Do(PointBlank, DamageExact(22)) }, @@ -193,6 +194,7 @@ namespace CalamityMod.Items { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(20)) }, { ItemID.PiranhaGun, Do(DamageExact(48)) }, { ItemID.PlatinumBow, Do(PointBlank, DamageExact(12)) }, + { ItemID.PlatinumCoin, Do(DamageExact(150)) }, // For Coin Gun { ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageExact(18)) }, { ItemID.PoisonStaff, Do(DamageExact(57)) }, { ItemID.PossessedHatchet, Do(DamageExact(135)) }, @@ -298,6 +300,7 @@ namespace CalamityMod.Items { ItemID.HallowedPlateMail, Do(DefenseDelta(+3)) }, { ItemID.HeroShield, Do(DefenseDelta(+5)) }, // 15 total (plus increased max life) { ItemID.LavaSkull, Do(DefenseExact(4)) }, // Magma Skull + { ItemID.MoltenCharm, Do(DefenseExact(4)) }, //Magma Charm { ItemID.MoltenSkullRose, Do(DefenseExact(8)) }, { ItemID.ObsidianShield, Do(DefenseDelta(+4)) }, // 6 total { ItemID.ObsidianSkull, Do(DefenseDelta(+1)) }, // 2 total @@ -387,7 +390,7 @@ namespace CalamityMod.Items { ItemID.PlatinumHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, { ItemID.PlatinumPickaxe, Do(PickPower(55), UseTimeExact(9)) }, { ItemID.Pwnhammer, Do(HammerPower(80), UseTimeExact(11), TileBoostExact(+1)) }, - { ItemID.ReaverShark, Do(PickPower(100), UseTimeExact(16)) }, + { ItemID.ReaverShark, Do(PickPower(65), UseTimeExact(16)) }, { ItemID.RichMahoganyHammer, Do(HammerPower(25), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.Rockfish, Do(HammerPower(50), UseTimeExact(10), TileBoostExact(+0)) }, { ItemID.SawtoothShark, Do(TrueMeleeNoSpeed, AxePower(45), UseTimeExact(4), TileBoostExact(-1)) }, diff --git a/Items/Critters/BabyCannonballJellyfishItem.cs b/Items/Critters/BabyCannonballJellyfishItem.cs index 77afa58817..d36cc2a4b9 100644 --- a/Items/Critters/BabyCannonballJellyfishItem.cs +++ b/Items/Critters/BabyCannonballJellyfishItem.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Critters Item.DefaultToCapturedCritter(ModContent.NPCType()); Item.value = Item.sellPrice(silver: 10); Item.rare = ItemRarityID.Green; + Item.damage = 400; } } } diff --git a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs index 6d0c5df78e..654bed6a46 100644 --- a/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs +++ b/Items/Fishing/BrimstoneCragCatches/DragoonDrizzlefish.cs @@ -40,62 +40,50 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; - Item.useAmmo = AmmoID.Gel; // for GFB } public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override bool CanUseItem(Player player) { - if (!Main.zenithWorld) - { - return true; - } if (player.altFunctionUse == 2) { - if (Main.zenithWorld) - { - CalamityGlobalItem.HasEnoughAmmo(player, Item, 5); - return true; - } - else + if (!Main.zenithWorld || player.Calamity().dragoonDrizzlefishGelBoost >= 6) return false; + + Item gelFodder = new Item(); + gelFodder.useAmmo = AmmoID.Gel; + return player.HasAmmo(gelFodder); } - else - return true; + return true; } public override Vector2? HoldoutOrigin() => new Vector2(7, 7); public override bool AltFunctionUse(Player player) => Main.zenithWorld ? true : false; - public override bool CanConsumeAmmo(Item ammo, Player player) - { - if (Main.zenithWorld && player.altFunctionUse == 2 && player.Calamity().dragoonDrizzlefishGelBoost < 6) - return true; - else - return false; - } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (Main.zenithWorld && player.altFunctionUse == 2) + if (player.altFunctionUse == 2) { //GFB stuff - if (player.Calamity().dragoonDrizzlefishGelBoost < 6) - { - player.Calamity().dragoonDrizzlefishGelBoost++; - SoundStyle roar = Sunskater.DeathSound; - SoundEngine.PlaySound(roar with { Pitch = 0.3f }, player.Center); - SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 0.3f }, player.Center); - CombatText.NewText(player.Hitbox, Color.OrangeRed, ":)"); - for (int i = 0; i <= 11; i++) - { - Vector2 hVelocity = Main.rand.NextVector2Unit(); - hVelocity.X *= 0.66f; - hVelocity *= Main.rand.NextFloat(1f, 2f); + Item gelFodder = new Item(); + gelFodder.useAmmo = AmmoID.Gel; + player.PickAmmo(gelFodder, out _, out _, out _, out _, out _); - int heart = Gore.NewGore(player.GetSource_FromThis(), player.Center + Main.rand.NextVector2Circular(14, 14), hVelocity, 331, Main.rand.NextFloat(0.2f, 1.3f)); - Main.gore[heart].sticky = false; - Main.gore[heart].velocity *= 0.4f; - Main.gore[heart].velocity.Y -= 0.7f; - } + player.Calamity().dragoonDrizzlefishGelBoost++; + SoundEngine.PlaySound(Sunskater.DeathSound with { Pitch = 0.3f }, player.Center); + SoundEngine.PlaySound(SoundID.Item2 with { Pitch = 0.3f }, player.Center); + CombatText.NewText(player.Hitbox, Color.OrangeRed, ":)"); + for (int i = 0; i <= 11; i++) + { + Vector2 hVelocity = Main.rand.NextVector2Unit(); + hVelocity.X *= 0.66f; + hVelocity *= Main.rand.NextFloat(1f, 2f); + + int heart = Gore.NewGore(player.GetSource_FromThis(), player.Center + Main.rand.NextVector2Circular(14, 14), hVelocity, 331, Main.rand.NextFloat(0.2f, 1.3f)); + Main.gore[heart].sticky = false; + Main.gore[heart].velocity *= 0.4f; + Main.gore[heart].velocity.Y -= 0.7f; } } else diff --git a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs index a9813f17f9..10d3c10150 100644 --- a/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs +++ b/Items/Fishing/SunkenSeaCatches/SparklingEmpress.cs @@ -1,6 +1,8 @@ -using CalamityMod.Projectiles.Magic; +using System.Collections.Generic; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -9,32 +11,35 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches public class SparklingEmpress : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Fishing"; - public static int BaseDamage = 10; - - public override void SetStaticDefaults() - { - Item.staff[Type] = true; //so it doesn't look weird af when holding it - } - public override void SetDefaults() { Item.width = 44; Item.height = 44; - Item.damage = BaseDamage; + Item.damage = 11; Item.DamageType = DamageClass.Magic; - Item.mana = 5; - Item.useAnimation = Item.useTime = 20; + Item.mana = 3; + Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 5f; - Item.UseSound = SoundID.Item13; Item.useStyle = ItemUseStyleID.Shoot; - Item.channel = true; //Channel so that you can hold the weapon [Important] + Item.channel = true; Item.noMelee = true; + Item.noUseGraphic = true; + Item.autoReuse = true; Item.rare = ItemRarityID.Green; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; } + public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, Item.shoot, damage, knockback, player.whoAmI); + holdout.velocity = player.Calamity().mouseWorld - player.RotatedRelativePoint(player.MountedCenter); + return false; + } } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs index 359e74d374..fbb5893ba4 100644 --- a/Items/Mounts/AlicornMount.cs +++ b/Items/Mounts/AlicornMount.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/AlicornMountExtra"); MountData.textureWidth = MountData.backTexture.Width(); diff --git a/Items/Mounts/BUMBLEDOGE.cs b/Items/Mounts/BUMBLEDOGE.cs index e3cd53a261..1cbc9c4b3d 100644 --- a/Items/Mounts/BUMBLEDOGE.cs +++ b/Items/Mounts/BUMBLEDOGE.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Mounts MountData.dashingFrameCount = MountData.flyingFrameCount; MountData.dashingFrameDelay = 5; MountData.dashingFrameStart = MountData.flyingFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); diff --git a/Items/Mounts/Crysthamyr.cs b/Items/Mounts/Crysthamyr.cs index e050a1a7ed..0397aba337 100644 --- a/Items/Mounts/Crysthamyr.cs +++ b/Items/Mounts/Crysthamyr.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.runningFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/CrysthamyrExtra"); MountData.textureWidth = MountData.backTexture.Width(); diff --git a/Items/Mounts/DraedonGamerChairMount.cs b/Items/Mounts/DraedonGamerChairMount.cs index a0576fa082..adc03e7738 100644 --- a/Items/Mounts/DraedonGamerChairMount.cs +++ b/Items/Mounts/DraedonGamerChairMount.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = 5; MountData.swimFrameDelay = 5; MountData.swimFrameStart = 0; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Mounts/DraedonGamerChairMount_Glowmask"); MountData.textureWidth = MountData.frontTexture.Width(); diff --git a/Items/Mounts/ExoTank.cs b/Items/Mounts/ExoTank.cs index 59b2dad384..94d45b6660 100644 --- a/Items/Mounts/ExoTank.cs +++ b/Items/Mounts/ExoTank.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // back (back layer) -> backExtra (gun) -> front (launcher) -> frontExtra (front layer) MountData.backTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/ExoTank_BackGun"); diff --git a/Items/Mounts/Minecarts/DoGCartMount.cs b/Items/Mounts/Minecarts/DoGCartMount.cs index f5750c48d5..3132669334 100644 --- a/Items/Mounts/Minecarts/DoGCartMount.cs +++ b/Items/Mounts/Minecarts/DoGCartMount.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Mounts.Minecarts MountData.runSpeed = 22f; MountData.acceleration = 0.16f; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = 74; MountData.textureHeight = 114; diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 4a9ba4a65d..402c49a00d 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.backTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/OnyxExcavatorExtra"); MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/OnyxExcavatorExtra2"); diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/PhuppersChair.cs index b6addb58a1..ba514b1f01 100644 --- a/Items/Mounts/PhuppersChair.cs +++ b/Items/Mounts/PhuppersChair.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = 4; MountData.swimFrameDelay = 4; MountData.swimFrameStart = 0; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); diff --git a/Items/Mounts/RimehoundMount.cs b/Items/Mounts/RimehoundMount.cs index 87a2c63868..91459cf03f 100644 --- a/Items/Mounts/RimehoundMount.cs +++ b/Items/Mounts/RimehoundMount.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); diff --git a/Items/Mounts/SquishyBean.cs b/Items/Mounts/SquishyBean.cs index fd7088ef8d..f7b1b676ee 100644 --- a/Items/Mounts/SquishyBean.cs +++ b/Items/Mounts/SquishyBean.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.Mounts MountData.swimFrameCount = MountData.inAirFrameCount; MountData.swimFrameDelay = MountData.inAirFrameDelay; MountData.swimFrameStart = MountData.inAirFrameStart; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { MountData.textureWidth = MountData.backTexture.Width(); MountData.textureHeight = MountData.backTexture.Height(); diff --git a/Items/Placeables/Abyss/PlantyMush.cs b/Items/Placeables/Abyss/PlantyMush.cs index d2c9db45fa..e747501a43 100644 --- a/Items/Placeables/Abyss/PlantyMush.cs +++ b/Items/Placeables/Abyss/PlantyMush.cs @@ -15,8 +15,7 @@ namespace CalamityMod.Items.Placeables.Abyss public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(silver: 6); - Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(copper: 20); } public override void CaughtFishStack(ref int stack) diff --git a/Items/Placeables/Furniture/CalamityCanvas.cs b/Items/Placeables/Furniture/CalamityCanvas.cs new file mode 100644 index 0000000000..00fe2ad38e --- /dev/null +++ b/Items/Placeables/Furniture/CalamityCanvas.cs @@ -0,0 +1,19 @@ +using CalamityMod.Tiles.Furniture; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture +{ + public class CalamityCanvas : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 96; + Item.height = 64; + Item.value = Item.sellPrice(silver: 40); + } + } +} diff --git a/Items/Placeables/Furniture/CalamityCanvas.png b/Items/Placeables/Furniture/CalamityCanvas.png new file mode 100644 index 0000000000..9c2fd66190 Binary files /dev/null and b/Items/Placeables/Furniture/CalamityCanvas.png differ diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index 8b3cb03e78..3c508e23cf 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -63,11 +63,12 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Cooper", "CosmaticMango", "CrabBar", + "Dandy", "Dia", "enamoured", "ENNWAY", "Flowaria", - "Fluffi", + "Fluffy", "HaguriHat", "Heart Plus Up!", "Hugekraken", @@ -82,6 +83,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Piky", "PokerFace", "Poroboros", + "Raesh", "Shade", "SharZz", "Shayy", diff --git a/Items/Placeables/Furniture/ZenithThrone.cs b/Items/Placeables/Furniture/ZenithThrone.cs new file mode 100644 index 0000000000..4f09cfeb9d --- /dev/null +++ b/Items/Placeables/Furniture/ZenithThrone.cs @@ -0,0 +1,27 @@ +using CalamityMod.Rarities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture +{ + public class ZenithThrone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(gold: 10); + Item.rare = ModContent.RarityType(); + Item.Calamity().donorItem = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Zenith). + AddRecipeGroup(RecipeGroupID.IronBar, 10). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/Furniture/ZenithThrone.png b/Items/Placeables/Furniture/ZenithThrone.png new file mode 100644 index 0000000000..a348766a82 Binary files /dev/null and b/Items/Placeables/Furniture/ZenithThrone.png differ diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index 266eb72018..a51019706d 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Potions.Alcohol public static float DamageBoost = 0.04f; public static float KnockbackBoost = 0.2f; public static int CritBoost = 2; - public static float DefenseLossPercent = 5; + public static float DefenseLossPercent = 0.05f; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), KnockbackBoost.ToPercent(), CritBoost, DefenseLossPercent.ToPercent()); public override void SetStaticDefaults() diff --git a/Items/Potions/Food/Barberry.cs b/Items/Potions/Food/Barberry.cs new file mode 100644 index 0000000000..19716ffed1 --- /dev/null +++ b/Items/Potions/Food/Barberry.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Barberry : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(112, 1, 25), + new Color(136, 69, 137), + new Color(160, 32, 95) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(26, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} \ No newline at end of file diff --git a/Items/Potions/Food/Barberry.png b/Items/Potions/Food/Barberry.png new file mode 100644 index 0000000000..d66c541f27 Binary files /dev/null and b/Items/Potions/Food/Barberry.png differ diff --git a/Items/Potions/Food/Cometfruit.cs b/Items/Potions/Food/Cometfruit.cs new file mode 100644 index 0000000000..ddf1698412 --- /dev/null +++ b/Items/Potions/Food/Cometfruit.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Cometfruit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(153, 100, 184), + new Color(181, 141, 166), + new Color(147, 200, 221) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(32, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} \ No newline at end of file diff --git a/Items/Potions/Food/Cometfruit.png b/Items/Potions/Food/Cometfruit.png new file mode 100644 index 0000000000..2d3fe3895b Binary files /dev/null and b/Items/Potions/Food/Cometfruit.png differ diff --git a/Items/Potions/Food/Jackfruit.cs b/Items/Potions/Food/Jackfruit.cs new file mode 100644 index 0000000000..c586f0f319 --- /dev/null +++ b/Items/Potions/Food/Jackfruit.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Jackfruit : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(250, 216, 80), + new Color(201, 207, 79), + new Color(147, 176, 54) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(26, 36, BuffID.WellFed, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} \ No newline at end of file diff --git a/Items/Potions/Food/Jackfruit.png b/Items/Potions/Food/Jackfruit.png new file mode 100644 index 0000000000..17f48aab6d Binary files /dev/null and b/Items/Potions/Food/Jackfruit.png differ diff --git a/Items/Potions/Food/Lotus.cs b/Items/Potions/Food/Lotus.cs new file mode 100644 index 0000000000..e434603427 --- /dev/null +++ b/Items/Potions/Food/Lotus.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Lotus : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(198, 83, 236), + new Color(207, 81, 108), + new Color(233, 184, 87) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(26, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} \ No newline at end of file diff --git a/Items/Potions/Food/Lotus.png b/Items/Potions/Food/Lotus.png new file mode 100644 index 0000000000..9ddfcaaa7d Binary files /dev/null and b/Items/Potions/Food/Lotus.png differ diff --git a/Items/Potions/Food/Mangosteen.cs b/Items/Potions/Food/Mangosteen.cs new file mode 100644 index 0000000000..44de848075 --- /dev/null +++ b/Items/Potions/Food/Mangosteen.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Mangosteen : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(218, 238, 253), + new Color(178, 199, 214), + new Color(123, 99, 130) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(30, 32, BuffID.WellFed2, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} \ No newline at end of file diff --git a/Items/Potions/Food/Mangosteen.png b/Items/Potions/Food/Mangosteen.png new file mode 100644 index 0000000000..8d3852e144 Binary files /dev/null and b/Items/Potions/Food/Mangosteen.png differ diff --git a/Items/Potions/Food/Salak.cs b/Items/Potions/Food/Salak.cs new file mode 100644 index 0000000000..e9db4b7b65 --- /dev/null +++ b/Items/Potions/Food/Salak.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions.Food +{ + public class Salak : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 5; + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(int.MaxValue, 3)); + ItemID.Sets.FoodParticleColors[Type] = new Color[3] { + new Color(203, 134, 81), + new Color(162, 109, 68), + new Color(253, 242, 233) + }; + ItemID.Sets.IsFood[Type] = true; + } + + public override void SetDefaults() + { + Item.DefaultToFood(28, 26, BuffID.WellFed, CalamityUtils.MinutesToFrames(5)); + Item.value = Item.sellPrice(silver: 20); + Item.rare = ItemRarityID.Blue; + } + } +} \ No newline at end of file diff --git a/Items/Potions/Food/Salak.png b/Items/Potions/Food/Salak.png new file mode 100644 index 0000000000..6a52d1fe4d Binary files /dev/null and b/Items/Potions/Food/Salak.png differ diff --git a/Items/SummonItems/Abombination.cs b/Items/SummonItems/Abombination.cs index b847302ed2..5897c5788b 100644 --- a/Items/SummonItems/Abombination.cs +++ b/Items/SummonItems/Abombination.cs @@ -1,10 +1,13 @@ -using CalamityMod.Events; +using CalamityMod.CustomRecipes; +using System; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.PlaguebringerGoliath; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; namespace CalamityMod.Items.SummonItems { @@ -39,6 +42,8 @@ namespace CalamityMod.Items.SummonItems return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override bool? UseItem(Player player) { CalamityUtils.SpawnBossUsingItem(player, UseSound); @@ -50,7 +55,8 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(20). AddRecipeGroup("IronBar", 8). - AddIngredient(ItemID.Obsidian, 3). + AddIngredient(8). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/SummonItems/AstralChunk.cs b/Items/SummonItems/AstralChunk.cs index cf04dd2416..539b1854a8 100644 --- a/Items/SummonItems/AstralChunk.cs +++ b/Items/SummonItems/AstralChunk.cs @@ -1,15 +1,20 @@ -using CalamityMod.Events; +using CalamityMod.CustomRecipes; +using System; +using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.AstrumAureus; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; +using System.Collections.Generic; namespace CalamityMod.Items.SummonItems { public class AstralChunk : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/AstrumAureus/AstrumAureusSpawn"); public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 12; // Truffle Worm @@ -31,6 +36,8 @@ namespace CalamityMod.Items.SummonItems itemGroup = ContentSamples.CreativeHelper.ItemGroup.BossItem; } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override bool CanUseItem(Player player) { return player.Calamity().ZoneAstral && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; @@ -41,7 +48,7 @@ namespace CalamityMod.Items.SummonItems int posX = (int)(player.position.X + Main.rand.Next(-250, 251)); int posY = (int)(player.position.Y - 500f); int bossToSpawn = ModContent.NPCType(); - CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, SoundID.Roar); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, UseSound); return true; } @@ -50,7 +57,9 @@ namespace CalamityMod.Items.SummonItems CreateRecipe(). AddIngredient(30). AddIngredient(ItemID.FallenStar, 20). - AddTile(TileID.Anvils). + AddIngredient(8). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). + AddTile(TileID.MythrilAnvil). Register(); } } diff --git a/Items/SummonItems/CharredIdol.cs b/Items/SummonItems/CharredIdol.cs index 887b72d966..48063cc2bc 100644 --- a/Items/SummonItems/CharredIdol.cs +++ b/Items/SummonItems/CharredIdol.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.BrimstoneElemental; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.SummonItems public class CharredIdol : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn"); public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 10; // Mechanical Skull @@ -40,7 +42,7 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); + CalamityUtils.SpawnBossUsingItem(player, UseSound); return true; } diff --git a/Items/SummonItems/EidolonTablet.png b/Items/SummonItems/EidolonTablet.png index 4383b9ec72..dd558ecf48 100644 Binary files a/Items/SummonItems/EidolonTablet.png and b/Items/SummonItems/EidolonTablet.png differ diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index 9471bf4ee2..8168d6aae7 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Items.SummonItems Main.tile[i + xoffset, j + yoffset].TileType = (ushort)ModContent.TileType(); Main.tile[i + xoffset, j + yoffset].Get().HasTile = true; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i + xoffset, j + yoffset, 1, TileChangeType.None); } diff --git a/Items/SummonItems/ProfanedCore.cs b/Items/SummonItems/ProfanedCore.cs index 8aa95d0e74..c61306273d 100644 --- a/Items/SummonItems/ProfanedCore.cs +++ b/Items/SummonItems/ProfanedCore.cs @@ -1,5 +1,8 @@ using CalamityMod.Events; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; +using CalamityMod.Projectiles.Boss; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -33,15 +36,27 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !NPC.AnyNPCs(ModContent.NPCType()) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; + var Prov = CalamityGlobalNPC.holyBoss; + bool canPissOffProvi = Prov != -1 && Main.npc[Prov].life >= (Main.npc[Prov].lifeMax * 0.95f) && Main.npc[Prov].Calamity().newAI[3] >= 180f && !Main.npc[Prov].Calamity().CurrentlyEnraged; + return (!NPC.AnyNPCs(ModContent.NPCType()) || canPissOffProvi) && (player.ZoneHallow || player.ZoneUnderworldHeight) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - int posX = (int)player.position.X; - int posY = (int)(player.position.Y - 100f); - int bossToSpawn = ModContent.NPCType(); - CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, Providence.SpawnSound); + var Prov = CalamityGlobalNPC.holyBoss; + bool usingToMakeProviPissedOff = Prov != -1 && Main.npc[Prov].life >= (Main.npc[Prov].lifeMax * 0.95f) && Main.npc[Prov].Calamity().newAI[3] >= 180f && !Main.npc[Prov].Calamity().CurrentlyEnraged; + if (usingToMakeProviPissedOff) + { + (Main.npc[Prov].ModNPC as Providence).hasBeenGivenFullPower = true; + Projectile.NewProjectile(Item.GetSource_FromThis(), player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0); + } + else + { + int posX = (int)player.position.X; + int posY = (int)(player.position.Y - 100f); + int bossToSpawn = ModContent.NPCType(); + CalamityUtils.SpawnBossOnPosUsingItem(player, bossToSpawn, posX, posY, Providence.SpawnSound); + } return true; } } diff --git a/Items/SummonItems/ProfanedShard.cs b/Items/SummonItems/ProfanedShard.cs index e29a74af1c..11a1a9a4df 100644 --- a/Items/SummonItems/ProfanedShard.cs +++ b/Items/SummonItems/ProfanedShard.cs @@ -3,6 +3,7 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.NPCs.ProfanedGuardians; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.SummonItems public class ProfanedShard : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.SummonItems"; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/ProfanedGuardians/GuardianSpawn"); public override void SetStaticDefaults() { ItemID.Sets.SortingPriorityBossSpawns[Type] = 19; // Celestial Sigil @@ -39,10 +41,9 @@ namespace CalamityMod.Items.SummonItems public override bool? UseItem(Player player) { - CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); + CalamityUtils.SpawnBossUsingItem(player, UseSound); return true; } - public override void ModifyTooltips(List list) => list.FindAndReplace("[SPAWN]", this.GetLocalizedValue(Main.remixWorld ? "SpawnRemix" : "SpawnNormal")); public override void AddRecipes() { diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index b2ba5a8b1c..415c44514a 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items npc.life = 0; npc.active = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 8f6cffdec9..4d95f705b3 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddRecipeGroup("AnySilverBar", 18). - AddIngredient(ItemID.Wood, 18). + AddRecipeGroup("Wood", 18). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/SeismicHampick.cs b/Items/Tools/SeismicHampick.cs index bd4f680f0b..626b208649 100644 --- a/Items/Tools/SeismicHampick.cs +++ b/Items/Tools/SeismicHampick.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Items.Tools { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 16 : 127); } - if (Main.rand.NextBool(5) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(5) && !Main.dedServ) { int smoke = Gore.NewGore(player.GetSource_ItemUse(Item), new Vector2(hitbox.X, hitbox.Y), default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Items/Tools/TectonicTruncator.cs b/Items/Tools/TectonicTruncator.cs index 3f022a6ab5..8e56a87c84 100644 --- a/Items/Tools/TectonicTruncator.cs +++ b/Items/Tools/TectonicTruncator.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Tools { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 16 : 127); } - if (Main.rand.NextBool(5) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(5) && !Main.dedServ) { int smoke = Gore.NewGore(player.GetSource_ItemUse(Item), new Vector2(hitbox.X, hitbox.Y), default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index dad1667256..165d179cd3 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Items.Tools GeneralParticleHandler.SpawnParticle(smoke); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < shrapnelCount; i++) { diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index bcdc0a7855..49ef7576af 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -47,7 +47,16 @@ namespace CalamityMod.Items.Weapons.Magic { // Max music note check is in Shoot instead of CanUseItem so that the weapon can still be visually played while at the cap int musicNoteCap = Main.zenithWorld ? 7 : 6; - if (player.ownedProjectileCounts[type] >= musicNoteCap) + + int nonReleasedMusicNotes = 0; + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.type != Item.shoot || proj.owner != player.whoAmI || proj.ai[1] == 2f) + continue; + nonReleasedMusicNotes++; + } + + if (nonReleasedMusicNotes >= musicNoteCap) { Main.musicPitch = -0.5f; SoundEngine.PlaySound(CapSound with { Volume = 0.8f }, player.Center); @@ -55,10 +64,11 @@ namespace CalamityMod.Items.Weapons.Magic } else { - if (player.ownedProjectileCounts[type] <= 0) + if (nonReleasedMusicNotes <= 0) RotationOffset = Main.rand.NextFloat(0f, MathHelper.TwoPi); - Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 0f, RotationOffset); + Projectile note = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI, ai2: nonReleasedMusicNotes); + note.ModProjectile()._randomReleaseRotationOffset = RotationOffset; return false; } } @@ -74,7 +84,8 @@ namespace CalamityMod.Items.Weapons.Magic // Consume much less mana while the maximum number of notes are present public override void ModifyManaCost(Player player, ref float reduce, ref float mult) { - if (player.ownedProjectileCounts[Item.shoot] >= 6) + int nonReleasedMusicNotes = Main.projectile.Count(proj => proj.type == Item.shoot && Main.myPlayer == proj.owner && proj.active && proj.ai[1] != 2f); + if (nonReleasedMusicNotes >= 6) mult *= 0.25f; } diff --git a/Items/Weapons/Magic/Apotheosis.cs b/Items/Weapons/Magic/Apotheosis.cs index eba4e5478b..997c64fb18 100644 --- a/Items/Weapons/Magic/Apotheosis.cs +++ b/Items/Weapons/Magic/Apotheosis.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 30; Item.height = 34; - Item.damage = 230; + Item.damage = 222; Item.DamageType = DamageClass.Magic; Item.mana = 42; Item.useAnimation = Item.useTime = 167; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs index 7fa02f113c..0875c6bebd 100644 --- a/Items/Weapons/Magic/Fabstaff.cs +++ b/Items/Weapons/Magic/Fabstaff.cs @@ -21,11 +21,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 84; Item.height = 84; - Item.damage = 125; + Item.damage = 135; Item.DamageType = DamageClass.Magic; - Item.mana = 50; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 40; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 0521435c36..90f046f193 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.damage = 2250; + Item.damage = 2300; Item.knockBack = 6f; Item.useAnimation = Item.useTime = 300; Item.reuseDelay = 60; diff --git a/Items/Weapons/Magic/TheDanceofLight.cs b/Items/Weapons/Magic/TheDanceofLight.cs index 347545910d..8da2a249d3 100644 --- a/Items/Weapons/Magic/TheDanceofLight.cs +++ b/Items/Weapons/Magic/TheDanceofLight.cs @@ -89,7 +89,6 @@ namespace CalamityMod.Items.Weapons.Magic CreateRecipe(). AddIngredient(ItemID.SkyFracture). AddIngredient(ItemID.LunarFlareBook). - AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Weapons/Magic/Waywasher.cs b/Items/Weapons/Magic/Waywasher.cs index a87fa9c177..83ca88ed9d 100644 --- a/Items/Weapons/Magic/Waywasher.cs +++ b/Items/Weapons/Magic/Waywasher.cs @@ -1,6 +1,7 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -10,31 +11,35 @@ namespace CalamityMod.Items.Weapons.Magic public class Waywasher : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public int shotCount = 0; public override void SetDefaults() { Item.width = 30; Item.height = 30; - Item.damage = 16; + Item.damage = 38; Item.DamageType = DamageClass.Magic; - Item.mana = 4; - Item.useTime = 15; - Item.useAnimation = 15; + Item.mana = 10; + Item.useTime = 14; + Item.useAnimation = 28; + Item.reuseDelay = 23; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 2.5f; + Item.knockBack = 12f; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item8; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 13f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity.RotatedBy(-0.3f * (shotCount % 2 == 0 ? -1 : 1)), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, shotCount % 2 == 0 ? -1 : 1); + + SoundStyle WayWashed = new("CalamityMod/Sounds/Item/WaterSplash" + (shotCount % 2 == 0 ? "1" : "2")); + SoundEngine.PlaySound(WayWashed with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 2 }, position); + + shotCount++; return false; } diff --git a/Items/Weapons/Magic/WrathoftheAncients.cs b/Items/Weapons/Magic/WrathoftheAncients.cs deleted file mode 100644 index 1a625db4d8..0000000000 --- a/Items/Weapons/Magic/WrathoftheAncients.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Projectiles.Magic; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Weapons.Magic -{ - public class WrathoftheAncients : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetDefaults() - { - Item.width = 28; - Item.height = 30; - Item.damage = 47; - Item.DamageType = DamageClass.Magic; - Item.mana = 20; - Item.useTime = 38; - Item.useAnimation = 38; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 6f; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - return false; - } - } -} diff --git a/Items/Weapons/Magic/WrathoftheAncients.png b/Items/Weapons/Magic/WrathoftheAncients.png deleted file mode 100644 index 4412f19055..0000000000 Binary files a/Items/Weapons/Magic/WrathoftheAncients.png and /dev/null differ diff --git a/Items/Weapons/Melee/Carnage.cs b/Items/Weapons/Melee/Carnage.cs index f1831a2ad1..97b34b6923 100644 --- a/Items/Weapons/Melee/Carnage.cs +++ b/Items/Weapons/Melee/Carnage.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -37,6 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee // Carnage's on-hits only occur on valid enemies. Specifically won't trigger on statues. public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); if (target.life > 0 || !target.IsAnEnemy(false)) return; OnHitEffects(player, target, hit.Knockback); diff --git a/Items/Weapons/Melee/ExaltedOathblade.cs b/Items/Weapons/Melee/ExaltedOathblade.cs index 5b15a72276..a764e41083 100644 --- a/Items/Weapons/Melee/ExaltedOathblade.cs +++ b/Items/Weapons/Melee/ExaltedOathblade.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 88; Item.height = 88; - Item.damage = 150; + Item.damage = 140; Item.DamageType = DamageClass.Melee; Item.useAnimation = 23; Item.useTime = 23; @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.ShadowFlame, 450); target.AddBuff(ModContent.BuffType(), 900); - int onHitDamage = player.CalcIntDamage(2 * Item.damage); + int onHitDamage = player.CalcIntDamage(1.25f * Item.damage); Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); blast.DamageType = Item.DamageType; float firstDustScale = 1.7f; diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs index 32f9386daa..c37bc8adb4 100644 --- a/Items/Weapons/Melee/ForbiddenOathblade.cs +++ b/Items/Weapons/Melee/ForbiddenOathblade.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.ShadowFlame, 360); target.AddBuff(ModContent.BuffType(), 720); - int onHitDamage = player.CalcIntDamage(2 * Item.damage); + int onHitDamage = player.CalcIntDamage(1.25f * Item.damage); Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); blast.DamageType = Item.DamageType; float firstDustScale = 1.7f; diff --git a/Items/Weapons/Melee/HellfireFlamberge.cs b/Items/Weapons/Melee/HellfireFlamberge.cs index 0cefd12175..089e30c529 100644 --- a/Items/Weapons/Melee/HellfireFlamberge.cs +++ b/Items/Weapons/Melee/HellfireFlamberge.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Melee { Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, Main.rand.NextBool(3) ? 16 : 174); } - if (Main.rand.NextBool(5) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(5) && !Main.dedServ) { int smoke = Gore.NewGore(player.GetSource_ItemUse(Item), new Vector2(hitbox.X, hitbox.Y), default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Items/Weapons/Melee/IllustriousKnives.cs b/Items/Weapons/Melee/IllustriousKnives.cs index 00cb915087..3ed6cb2d52 100644 --- a/Items/Weapons/Melee/IllustriousKnives.cs +++ b/Items/Weapons/Melee/IllustriousKnives.cs @@ -40,58 +40,16 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float knifeSpeed = Item.shootSpeed; - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = knifeSpeed; - } - else - { - mouseDistance = knifeSpeed / mouseDistance; - } - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; int knifeAmt = 4; - if (Main.rand.NextBool()) - { - knifeAmt++; - } - if (Main.rand.NextBool(4)) - { - knifeAmt++; - } - if (Main.rand.NextBool(6)) - { - knifeAmt++; - } - if (Main.rand.NextBool(8)) - { - knifeAmt++; - } + if (Main.rand.NextBool()) knifeAmt++; + if (Main.rand.NextBool(4)) knifeAmt++; + if (Main.rand.NextBool(6)) knifeAmt++; + if (Main.rand.NextBool(8)) knifeAmt++; + for (int i = 0; i < knifeAmt; i++) { - float knifeSpawnXPos = mouseXDist; - float knifeSpawnYPos = mouseYDist; - float randOffsetDampener = 0.05f * (float)i; - knifeSpawnXPos += (float)Main.rand.Next(-35, 36) * randOffsetDampener; - knifeSpawnYPos += (float)Main.rand.Next(-35, 36) * randOffsetDampener; - mouseDistance = (float)Math.Sqrt((double)(knifeSpawnXPos * knifeSpawnXPos + knifeSpawnYPos * knifeSpawnYPos)); - mouseDistance = knifeSpeed / mouseDistance; - knifeSpawnXPos *= mouseDistance; - knifeSpawnYPos *= mouseDistance; - float x4 = realPlayerPos.X; - float y4 = realPlayerPos.Y; - Projectile.NewProjectile(source, x4, y4, knifeSpawnXPos, knifeSpawnYPos, type, damage, knockback, player.whoAmI); + Vector2 knifeVel = velocity.RotatedByRandom(MathHelper.Pi / 6f); + Projectile.NewProjectile(source, position, knifeVel, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/RedtideSpear.cs b/Items/Weapons/Melee/RedtideSpear.cs deleted file mode 100644 index 78d1e82068..0000000000 --- a/Items/Weapons/Melee/RedtideSpear.cs +++ /dev/null @@ -1,69 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee.Spears; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - [LegacyName("UrchinSpear")] - public class RedtideSpear : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - public override void SetStaticDefaults() - { - ItemID.Sets.Spears[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 56; - Item.height = 56; - Item.damage = 25; - Item.DamageType = TrueMeleeDamageClass.Instance; - Item.noMelee = true; - Item.useTurn = true; - Item.noUseGraphic = true; - Item.useAnimation = 25; - Item.useStyle = ItemUseStyleID.Shoot; - Item.channel = true; - Item.useTime = 25; - Item.knockBack = 5f; - Item.UseSound = null; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4f; - } - - public override void HoldItem(Player player) - { - player.Calamity().mouseWorldListener = true; - } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddTile(TileID.Anvils). - Register(); - } - } - - public class SpearChargePlayer : ModPlayer - { - public bool ChargingKnockbackResist = false; - - public override void PostUpdateMiscEffects() - { - if (ChargingKnockbackResist) - { - Player.noKnockback = true; - ChargingKnockbackResist = false; - } - } - } -} diff --git a/Items/Weapons/Melee/RedtideSpear.png b/Items/Weapons/Melee/RedtideSpear.png deleted file mode 100644 index 2f951da3ff..0000000000 Binary files a/Items/Weapons/Melee/RedtideSpear.png and /dev/null differ diff --git a/Items/Weapons/Melee/UrchinMace.cs b/Items/Weapons/Melee/UrchinMace.cs index 9947723237..ff90145473 100644 --- a/Items/Weapons/Melee/UrchinMace.cs +++ b/Items/Weapons/Melee/UrchinMace.cs @@ -1,6 +1,5 @@ -using System.Linq; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee.MaceFlails; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +10,8 @@ namespace CalamityMod.Items.Weapons.Melee public class UrchinMace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override void SetStaticDefaults() => ItemID.Sets.ToolTipDamageMultiplier[Type] = 2f; public override void SetDefaults() { Item.width = 42; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; } @@ -37,11 +38,6 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().mouseWorldListener = true; } - public override bool CanUseItem(Player player) - { - return !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == ModContent.ProjectileType()); - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 12c48f1fc6..bdbf686074 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -177,7 +177,7 @@ namespace CalamityMod.Items.Weapons.Ranged } } //shell - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2"; Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 66afabba19..51ad67d868 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public override void SetDefaults() { - Item.width = 26; - Item.height = 54; + Item.width = 22; + Item.height = 60; Item.damage = 15; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 28; diff --git a/Items/Weapons/Ranged/Toxibow.png b/Items/Weapons/Ranged/Toxibow.png index 099dd434e0..6b2852f5ae 100644 Binary files a/Items/Weapons/Ranged/Toxibow.png and b/Items/Weapons/Ranged/Toxibow.png differ diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 871115b9eb..5f608b05d3 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthDamageMultiplier => 0.575f; + public override float StealthDamageMultiplier => 0.6f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/CorpusAvertor.cs b/Items/Weapons/Rogue/CorpusAvertor.cs index 210c235930..bfad290128 100644 --- a/Items/Weapons/Rogue/CorpusAvertor.cs +++ b/Items/Weapons/Rogue/CorpusAvertor.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -16,9 +17,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 98; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 15; + Item.useAnimation = Item.useTime = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -26,10 +26,13 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8.5f; + Item.shootSpeed = 14f; Item.DamageType = RogueDamageClass.Instance; } + public override float StealthDamageMultiplier => 2.5f; + public override float StealthKnockbackMultiplier => 2f; + // Gains 10% of missing health as base damage. public override void ModifyWeaponDamage(Player player, ref StatModifier damage) { @@ -37,22 +40,20 @@ namespace CalamityMod.Items.Weapons.Rogue damage.Base += lifeAmount * 0.1f; } - public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - if (player.Calamity().StealthStrikeAvailable()) - type = ModContent.ProjectileType(); - } - - public override float StealthDamageMultiplier => 3.5f; - public override float StealthKnockbackMultiplier => 2f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int dagger = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + int dagger = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (dagger.WithinBounds(Main.maxProjectiles)) Main.projectile[dagger].Calamity().stealthStrike = true; + + // Take 6 HP every time the stealth strike is used + player.statLife -= 6; + if (Main.myPlayer == player.whoAmI) + player.HealEffect(-6); + if (player.statLife <= 0) + player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); return false; } return true; diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index d197eb39dc..0f3435fa1c 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Items.Weapons.Rogue public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 679e92b6ae..4bb20aae43 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -26,12 +26,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Lime; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; + Item.shootSpeed = 17f; Item.DamageType = RogueDamageClass.Instance; } public override float StealthVelocityMultiplier => 1.1f; - public override float StealthDamageMultiplier => 2.1f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 2c33ac188c..66e11cf25d 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -33,8 +33,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1.05f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) diff --git a/Items/Weapons/Rogue/IchorSpear.cs b/Items/Weapons/Rogue/IchorSpear.cs index 251e1e2d00..544b5fab18 100644 --- a/Items/Weapons/Rogue/IchorSpear.cs +++ b/Items/Weapons/Rogue/IchorSpear.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 17f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.38f; + public override float StealthDamageMultiplier => 0.35f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index d1b4b08094..3fe824bcf6 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -13,38 +13,38 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 28; - Item.damage = 15; + Item.damage = 37; + Item.DamageType = RogueDamageClass.Instance; + Item.useAnimation = Item.useTime = 28; + Item.knockBack = 5.75f; + Item.shootSpeed = 4f; + Item.noMelee = true; Item.useTurn = true; Item.noUseGraphic = true; - Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 18; - Item.knockBack = 5.75f; + Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; - Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 3.15f; + public override float StealthDamageMultiplier => 1.15f; + + public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { - int proj = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); + int proj = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) Main.projectile[proj].Calamity().stealthStrike = true; + return false; } - else - { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 4f); - } - return false; + return true; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/NanoblackReaper.cs b/Items/Weapons/Rogue/NanoblackReaper.cs index 7968298efb..4e74227094 100644 --- a/Items/Weapons/Rogue/NanoblackReaper.cs +++ b/Items/Weapons/Rogue/NanoblackReaper.cs @@ -46,8 +46,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = Speed; } - public override float StealthDamageMultiplier => 1.0f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) diff --git a/Items/Weapons/Rogue/NightsGaze.cs b/Items/Weapons/Rogue/NightsGaze.cs index 6382ebf405..04afde8631 100644 --- a/Items/Weapons/Rogue/NightsGaze.cs +++ b/Items/Weapons/Rogue/NightsGaze.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 1.22f; + public override float StealthDamageMultiplier => 1.2f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/RealityRupture.cs b/Items/Weapons/Rogue/RealityRupture.cs index 27b1129ff6..f88d479661 100644 --- a/Items/Weapons/Rogue/RealityRupture.cs +++ b/Items/Weapons/Rogue/RealityRupture.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 86; Item.height = 102; - Item.damage = 225; + Item.damage = 420; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 37; @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 3.9f; + public override float StealthDamageMultiplier => 2.25f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike @@ -54,19 +54,16 @@ namespace CalamityMod.Items.Weapons.Rogue { int projType = BigSpear ? ModContent.ProjectileType() : type; - if (!BigSpear) - SoundEngine.PlaySound(ThrowSound, player.Center); - else - SoundEngine.PlaySound(ThrowSound2, player.Center); + SoundEngine.PlaySound(BigSpear ? ThrowSound2 : ThrowSound, player.Center); if (BigSpear) { - Projectile.NewProjectile(source, position, velocity, projType, BigSpear ? damage * 4 : damage, knockback * 1.5f, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, projType, damage * 4, knockback * 1.5f, player.whoAmI); } - int index = 4; - for (int i = -index; i <= index; i += index) + else { - if (!BigSpear) + int index = 4; + for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); int spear = Projectile.NewProjectile(source, position, perturbedSpeed, projType, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index e1b71f353a..d3f15c1c90 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -37,7 +37,5 @@ namespace CalamityMod.Items.Weapons.Rogue public virtual void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { } - - public override bool ConsumeItem(Player player) => Main.rand.NextFloat() < player.Calamity().rogueAmmoCost; } } diff --git a/Items/Weapons/Rogue/SandDollar.cs b/Items/Weapons/Rogue/SandDollar.cs index c7110b796b..f873ac1eba 100644 --- a/Items/Weapons/Rogue/SandDollar.cs +++ b/Items/Weapons/Rogue/SandDollar.cs @@ -42,8 +42,6 @@ namespace CalamityMod.Items.Weapons.Rogue } } - public override float StealthDamageMultiplier => 1f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike diff --git a/Items/Weapons/Rogue/SealedSingularity.cs b/Items/Weapons/Rogue/SealedSingularity.cs index 9eb6db81d9..0c81d9d686 100644 --- a/Items/Weapons/Rogue/SealedSingularity.cs +++ b/Items/Weapons/Rogue/SealedSingularity.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.Calamity().donorItem = true; } - public override float StealthDamageMultiplier => 0.72f; + public override float StealthDamageMultiplier => 0.75f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index 292c1b9aef..e99ea4e662 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -19,12 +19,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 52; Item.height = 52; - Item.damage = 50; + Item.damage = 75; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 40; + Item.useAnimation = Item.useTime = 41; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 40; Item.knockBack = 2f; Item.UseSound = ThrowSound; Item.autoReuse = true; @@ -35,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 4.2f; + public override float StealthDamageMultiplier => 2.8f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike @@ -53,19 +52,16 @@ namespace CalamityMod.Items.Weapons.Rogue { int projType = BigSpear ? ModContent.ProjectileType() : type; - if (!BigSpear) - SoundEngine.PlaySound(ThrowSound, player.Center); - else - SoundEngine.PlaySound(ThrowSound2, player.Center); + SoundEngine.PlaySound(BigSpear ? ThrowSound2 : ThrowSound, player.Center); if (BigSpear) { - Projectile.NewProjectile(source, position, velocity, projType, BigSpear ? damage * 3 : damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, projType, damage * 3, knockback, player.whoAmI); } - int index = 5; - for (int i = -index; i <= index; i += index) + else { - if (!BigSpear) + int index = 5; + for (int i = -index; i <= index; i += index) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); int spear = Projectile.NewProjectile(source, position, perturbedSpeed, projType, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 82a3094c83..31295b43ed 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -14,10 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { Item.width = Item.height = 94; - Item.damage = 475; + Item.damage = 420; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 100; + Item.useAnimation = Item.useTime = 90; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 10f; Item.UseSound = SoundID.Item1; @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.26f; + public override float StealthDamageMultiplier => 0.3f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index 38f8dc355d..b8f8e6eb71 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -38,8 +38,6 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[Item.shoot] < knifeLimit) { - damage = (int)(damage * 1.1f); - int knifeAmt = knifeCount; if ((player.ownedProjectileCounts[Item.shoot] + knifeCount) >= knifeLimit) knifeAmt = knifeLimit - player.ownedProjectileCounts[Item.shoot]; diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index ae55c3601e..72246ccf3b 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 24; - Item.damage = 52; + Item.damage = 50; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; @@ -26,11 +26,11 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10.5f; + Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 9f; + public override float StealthDamageMultiplier => 1.8f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index 8c35b78585..10cbf7a310 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -29,8 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ModContent.RarityType(); } - public override float StealthDamageMultiplier => 1f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { int javelin = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, -1f); diff --git a/Items/Weapons/Rogue/TimeBolt.cs b/Items/Weapons/Rogue/TimeBolt.cs index 01e0d615bc..6d48b1f18c 100644 --- a/Items/Weapons/Rogue/TimeBolt.cs +++ b/Items/Weapons/Rogue/TimeBolt.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.68f; + public override float StealthDamageMultiplier => 0.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index ebf42d1ca9..5b822be2c0 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void Load() { // Add the body equip texture. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); } diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index cf87cff493..9f7230b417 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void Load() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { EquipLoader.AddEquipTexture(Mod, "CalamityMod/CalPlayer/DrawLayers/AndromedaWithout_Head", EquipType.Head, name: "HeadlessEquipTexture"); } @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "HeadlessEquipTexture", EquipType.Head); ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index df45d5f44b..5ac5707364 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Wood, 10). + AddRecipeGroup("Wood", 10). AddIngredient(ItemID.SoulofLight, 5). AddIngredient(ItemID.SoulofNight, 5). AddIngredient(ItemID.FoodPlatter, 3). diff --git a/Items/Weapons/Summon/SquirrelSquireStaff.cs b/Items/Weapons/Summon/SquirrelSquireStaff.cs index d32e315797..06d8c8ba72 100644 --- a/Items/Weapons/Summon/SquirrelSquireStaff.cs +++ b/Items/Weapons/Summon/SquirrelSquireStaff.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Wood, 10). + AddRecipeGroup("Wood", 10). AddIngredient(ItemID.Acorn). AddTile(TileID.WorkBenches). Register(); diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index d2f2267717..d7e3e8751e 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -176,6 +176,11 @@ GodSlayerInferno: { Description: Your flesh is burning off } +HeavyBleeding: { + DisplayName: Heavy Bleeding + Description: That's gonna need stitches +} + HolyFlames: { DisplayName: Holy Flames Description: Dissolving from holy light diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index 88ff5ae0d2..12ba291af7 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -11,6 +11,18 @@ NotConsumable: Not consumable RogueDamage: "{0}% increased rogue damage" RogueCrit: "{0}% increased rogue critical strike chance" RogueVelocity: "{0}% increased rogue velocity" +DodgeInformation: + ''' + Attacks that deal less than 5% of your max life in damage will not be dodged + The dodge has a cooldown that ranges between 20 and 90 seconds depending on the dodged attack's damage + This cooldown is shared with all other dodges and reflects + ''' +ReflectInformation: + ''' + Projectiles that deal less than 5% of your max life in damage will not be reflected + The reflect has a cooldown that ranges between 20 and 90 seconds depending on the reflected projectile's damage + This cooldown is shared with all other dodges and reflects + ''' GrappleStats: ''' Reach: {0} tiles diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index 07c3988bca..99fdd6fa50 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -41,7 +41,7 @@ Drops: { DownedT2AR: After defeating the second tier of Acid Rain FirstKill: Drops only on the first kill MechBoss: Drops on the first kill of the final Mechanical Boss - ProvidenceNight: Drops if Providence is only attacked during nighttime + ProvidenceEnraged: Drops if Providence has been enraged ProvidenceChallenge: ''' Drops if Providence was defeated only with the [i:CalamityMod/ProfanedSoulArtifact] Profaned Soul Artifact diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index fa13fe286f..2c22570ec1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -56,9 +56,7 @@ AbyssalMirror: { ''' HoldShiftTooltip: ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage - This cooldown is shared with all other dodges and reflects + {$Common.DodgeInformation} Dodging an attack gives stealth ''' FlavorTooltip: "'Light does not reach the depths of the ocean'" @@ -108,12 +106,7 @@ AmalgamatedBrain: { Grants the ability to dodge attacks After dodging, summon damage and crit chance are boosted by 10% ''' - HoldShiftTooltip: - ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage - This cooldown is shared with all other dodges and reflects - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } AmbrosialAmpoule: { @@ -252,11 +245,11 @@ AsgardianAegis: { ''' HoldShiftTooltip: ''' - On Fire!, Hellfire, Chilled, Frozen, Frostburn, Frostbite, Weak, Broken Armor, - Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, - Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, - Blackout, Brain Rot, Burning Blood, Cursed Inferno, Brimstone Flames, - Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno, Burning + On Fire!, Hellfire, Burning, Chilled, Frozen, Frostburn, Frostbite, Weak, + Broken Armor, Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, + Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, Blackout, + Brain Rot, Burning Blood, Heavy Bleeding, Laceration, Cursed Inferno, Brimstone Flames, + Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno ''' } @@ -331,6 +324,7 @@ BloodPact: { Tooltip: ''' Increases max HP by 25% + Immunity to Bleeding, Burning Blood and Heavy Bleeding Healing Potions are 25% more effective ''' } @@ -396,6 +390,7 @@ ChaliceOfTheBloodGod: { Tooltip: ''' Increases max HP by 25% + Immunity to Bleeding, Burning Blood, Heavy Bleeding and Laceration +2 HP/s life regen and reduces the cooldown of healing potions by 25% Taking more than 5 damage converts the hit into a damage over time bleed debuff This bleeding does not interfere with life regeneration @@ -439,8 +434,9 @@ CorrosiveSpine: { Tooltip: ''' 5% increased movement speed - All rogue weapons inflict poison and spawn poisoned clouds on enemy hits - You release a ton of clouds everywhere on hit + Multiplies all sickness and water-related debuff damage by 1.25x + All attacks irradiate enemies and reduces the severity of the sulphuric waters + You burst into radioactive clouds when struck ''' } @@ -658,10 +654,8 @@ EclipseMirror: { ''' HoldShiftTooltip: ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage + {$Common.DodgeInformation} Dodging an attack grants a lot of stealth - This cooldown is shared with all other dodges and reflects ''' FlavorTooltip: "'Its reflection shows naught but darkness'" } @@ -720,7 +714,7 @@ EnchantedPearl: { ''' Increases fishing power by 10 Increases chance to catch crates and loot-containing fish by 15% - Crates are 25% more likely to be higher quality + Crate catches emit pearls and are 25% more likely to be higher quality ''' } @@ -1655,12 +1649,7 @@ StatisNinjaBelt: { Provides light when worn {$Common.AbyssLightLevel1} ''' - HoldShiftTooltip: - ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage - This cooldown is shared with all other dodges and reflects - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } StatisVoidSash: { @@ -1675,12 +1664,7 @@ StatisVoidSash: { Provides light when worn {$Common.AbyssLightLevel1} ''' - HoldShiftTooltip: - ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage - This cooldown is shared with all other dodges and reflects - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } // Be warned translators, this thing fucking sucks @@ -1732,7 +1716,6 @@ StatMeter: { Max Stealth: {0} | Standing Regen: {1} / sec | Moving Regen: {2} / sec Rogue Velocity Boost: {3}% ''' - RogueConsumption: " | Rogue Weapon Consumption Chance: {0}%" // Utility stats ToolRange: Tool Range Bonus: ({0}, {1}) MiningSpeed: " | Mining Speed: {0}%" @@ -1810,12 +1793,7 @@ TheAmalgam: { Grants the ability to dodge attacks After dodging, summon damage and crit chance are boosted by 10% ''' - HoldShiftTooltip: - ''' - Attacks that deal less than 5% of your max life in damage will not be dodged - The dodge has a cooldown that ranges between 15 and 90 seconds depending on the dodged attack's damage - This cooldown is shared with all other dodges and reflects - ''' + HoldShiftTooltip: "{$Common.DodgeInformation}" } TheBee: { @@ -1864,9 +1842,7 @@ TheEvolution: { Tooltip: ''' Reflects projectiles that hit you, negating their damage and dealing 10x damage to enemies - Projectiles that deal less than 5% of your max life in damage will not be reflected - The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage - This cooldown is shared with all other dodges and reflects + {$Common.ReflectInformation} Reflecting a projectile grants +6 HP/s life regen for 5 seconds and grants maximum natural life regen Getting hit by the same enemy projectile type during cooldown will resist its damage by 25% ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 44d5e1c2e0..5210af0c61 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -106,9 +106,7 @@ DaedalusHeadMelee: { Enemies are more likely to target you You reflect projectiles back at enemies Reflected projectiles deal 50% less damage to you - Projectiles that deal less than 5% of your max life in damage will not be reflected - The reflect has a cooldown that ranges between 15 and 90 seconds depending on the reflected projectile's damage - This cooldown is shared with all other dodges and reflects + {$Common.ReflectInformation} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index eaefebe6e8..7ac8dddb6c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -238,6 +238,21 @@ ThanatosMask: { Tooltip: "" } +TheCommandersCap: { + DisplayName: The Commanders Cap + Tooltip: Part of The High-Flying Finery +} + +TheFormalFootwear: { + DisplayName: The Formal Footwear + Tooltip: Part of The High-Flying Finery +} + +TheGrandGarment: { + DisplayName: The Grand Garment + Tooltip: Part of The High-Flying Finery +} + YharonMask: { DisplayName: Yharon Mask Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index e2913c3ac5..596e4a10e0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -174,10 +174,31 @@ Serpentuna: { SparklingEmpress: { DisplayName: Sparkling Empress - Tooltip: + Tooltip: "[GFB]" + TooltipNormal: ''' - Fires a concentrated laser to annihilate your foes - Defeated enemies explode into prism shards + Fires a stream of erratic magic + After firing for long enough, the fish will shine + Ceasing use of the fish while it shines will restore some of your mana and life + 'An beautiful fish that seems to feed on mana' + ''' + TooltipGFB: + ''' + Fires a stream of erratic magic + After firing for long enough, the fish will shine + Ceasing use of the fish while it shines will restore some of your mana and life + 'Hello there, you seem to be an unfamiliar face around here. + Perhaps you are surprised a fish like me is able to speak? + No need for worry, I have no intention of any foul play. + I only hope to find a delectable meal of pure mana on this fine day! + You have a supply of mana, yes? + Would you perchance be so kind as to share a bit with this small fish? + If it is not to your liking do not worry, for I have a compromise to make you. + It should be simple enough, you provide me, the fish, with your mana. + But, in turn I shall provide you plentiful offensive power through my art of fish magic. + Is this an applicable compromise? + Good! + Then let us set out and see the world beyond as I enjoy a fine feast!' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index cceb5e9059..26a976af94 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -20,7 +20,7 @@ AndroombaItem: { BabyCannonballJellyfishItem: { DisplayName: "{$NPCs.BabyCannonballJellyfish.DisplayName}" - Tooltip: "" + Tooltip: Can be fired out of cannons } BabyFlakCrabItem: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 7af99eb1e8..0eee8678d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -371,6 +371,19 @@ BabyGhostBellJar: { Tooltip: "" } +CalamityCanvas: { + DisplayName: Calamity Canvas + Tooltip: + ''' + when placed to open a UI which allows customizing the focus of the painting + to make the focus follow the cursor, again to set it + Arrow keys can also be used to manually adjust the focus point + The scroll wheel zooms the focus in and out + Hold SHIFT to hide the UI without closing it + 'Embrace chaos' + ''' +} + CirrusCouch: { DisplayName: Cirrus Couch Tooltip: This shouldn't exist... @@ -1057,6 +1070,11 @@ WulfrumLureItem: { ''' } +ZenithThrone: { + DisplayName: Zenith Throne + Tooltip: "'There will be no games, only damage per second...'" +} + AbyssBathtub: { DisplayName: Abyss Bathtub Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 35c8c06869..2dc33bef1d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -401,3 +401,42 @@ WhiteWine: { [c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.'] ''' } + +// Food +Barberry: { + DisplayName: Barberry + Tooltip: "{$CommonItemTooltip.MediumStats}" +} + +Cometfruit: { + DisplayName: Cometfruit + Tooltip: + ''' + {$CommonItemTooltip.MediumStats} + 'Tastes stellar!' + ''' +} + +Jackfruit: { + DisplayName: Jackfruit + Tooltip: "{$CommonItemTooltip.MinorStats}" +} + +Lotus: { + DisplayName: Lotus + Tooltip: "{$CommonItemTooltip.MediumStats}" +} + +Mangosteen: { + DisplayName: Mangosteen + Tooltip: + ''' + {$CommonItemTooltip.MediumStats} + 'Queen of fruits' + ''' +} + +Salak: { + DisplayName: Salak + Tooltip: "{$CommonItemTooltip.MinorStats}" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index 6363622e50..c3de3820df 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -228,8 +228,7 @@ ProfanedCore: { Tooltip: ''' Summons Providence when used in the Hallow or Underworld - Unique drop changes depending on the biome fought in - Enrages when fought during nighttime + Use again while Providence is at high health to unleash Her perfect fury {$Common.NotConsumable} 'The heart of Her Guardians, Her wicked wrath shall burn upon whoever now wields it.' ''' @@ -239,16 +238,10 @@ ProfanedShard: { DisplayName: Profaned Shard Tooltip: ''' - [SPAWN] + Summons the Profaned Guardians when used in the Hallow or Underworld {$Common.NotConsumable} 'Her Guardians seek the holder of such vast stolen power.' ''' - SpawnNormal: - ''' - Summons the Profaned Guardians when used in the Hallow or Underworld - Enrages when fought during nighttime - ''' - SpawnRemix: Summons the Profaned Guardians when used in the Hallow or Underworld } SandstormsCore: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 5d49b98b69..108c37acf4 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -1032,7 +1032,7 @@ VoltaicClimax: { Waywasher: { DisplayName: Waywasher - Tooltip: Casts a deluge of inaccurate water bolts + Tooltip: Casts two large swirling waves } Wingman: { @@ -1054,11 +1054,6 @@ WintersFury: { ''' } -WrathoftheAncients: { - DisplayName: Wrath of the Ancients - Tooltip: Summons an energy pulse at the cursor to periodically summon homing spirits -} - WulfrumProsthesis: { DisplayName: Wulfrum Prosthesis Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 60724d75d9..bfd871688a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -998,18 +998,6 @@ RedSun: { ''' } -RedtideSpear: { - DisplayName: Redtide Spear - Tooltip: - ''' - Poisons enemies on hit - Aiming the spear in front of you while running holds it down with increased knockback - Releasing the attack button after the charge makes an upwards slash, sending enemies flying into the air - [c/5C95A1:'The people of the sea were adept hunters, but they abhorred unnecessary violence.] - [c/5C95A1:Unfortunately, neighboring nations were brutish, so they fashioned their tools for war.'] - ''' -} - RemsRevenge: { DisplayName: Rem's Revenge Tooltip: @@ -1436,14 +1424,9 @@ UltimusCleaver: { Tooltip: Launches damaging homing sparks and explodes on enemy hits } -UrchinFlail: { - DisplayName: Urchin Flail - Tooltip: Launch an urchin ball, which shoots a spike on contact with an enemy -} - UrchinMace: { DisplayName: Urchin Mace - Tooltip: Throws out a whirlpool when released at full charge + Tooltip: Throws out a whirlpool when released } VanishingPoint: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 3a9b6a550e..9e5c00e61c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -994,10 +994,10 @@ PristineFury: { ''' LegendaryText: ''' - 'Me and many others lost everything in this world's darkest hour. - I saw a beast descend from the heavens. It had seven eyes in its body, and heralded countless angels of death. + 'I and many others lost everything in this world's darkest hour. + I saw a beast descend from the heavens. A hulking cosmic monstrosity that heralded countless angels of death. My family was torn from me by them, and my people forsake me. Even our supposed protectors did nothing to aid us. - And thus I swore to those I lost that I would never take such pain laying down again, that my name would dwarf even that of Zeratros; + And thus I swore to those I lost that I would do what is right, that my blaze's light would dwarf even that of Zeratros' Sun; That one day, this cruel world would know nothing less than My perfect fury.' ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index cff93d8b80..31b101f9cf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -162,11 +162,10 @@ CorpusAvertor: { DisplayName: Corpus Avertor Tooltip: ''' - Attacks grant lifesteal based on damage dealt - The lower your HP the more damage this weapon does and heals the player on enemy hits - Stealth strikes throw a single rainbow outlined dagger - On enemy hits, this dagger grants 10% damage and +2 HP/s life regen to all members of your team - However, there is a small chance it will cut your health in half instead + Throws a spinning dagger that spawns a rebounding clone + Deals more damage the lower your health, and grants lifesteal + Stealth strikes throw a piercing rainbow dagger which spawns an extra slash in its wake, with a blood cost + This dagger grants players on your team 10% damage and +2 HP/s life regen on hit, and heals them for a portion of damage dealt 'Seems like it has worn down over time' ''' } @@ -262,7 +261,8 @@ DeepWounder: { Tooltip: ''' Throws an abyssal hatchet that inflicts Armor Crunch and Crush Depth to the enemies it hits - Stealth strikes cause the hatchet to be thrown faster and trail water, inflicting Marked for Death in addition to the other debuffs + Stealth strikes cause the hatchet to stick to struck enemies, causing Heavy Bleeding and spawning a burst of water projectiles + Water projectiles launch at the closest enemy after a brief delay ''' } @@ -716,8 +716,8 @@ MeteorFist: { DisplayName: Meteor Fist Tooltip: ''' - Fires a rocket fist that explodes forcefully - Stealth strikes make the fist ricochet between enemies up to 4 times + Fires a wired-guided rocket fist that seeks the cursor and accelerates over time + Stealth strikes immediately start accelerating and drop a meteorite on the struck enemy ''' } @@ -1075,7 +1075,7 @@ SlickCane: { ''' Swipes a cane that steals money from enemies Stealth strikes give a 1 in 20 chance for enemies to drop 1-2 gold coins when hit - Stealth strikes' damage increases in proportion to money in the inventory (up to 5 platinum, gamble wisely) + Stealth strikes boost damage in proportion to money in the inventory, up to 1 Platinum 'Economy at its finest' ''' } @@ -1198,7 +1198,7 @@ TerrorTalons: { Tooltip: ''' Fires small wavering claws - Stealth strikes launch a large, high speed claw which pierces + Stealth strikes launch a large, high speed claw which slashes multiple times ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 0da5bec786..ff133415d5 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -74,6 +74,10 @@ Polaris2: You give Polaris a small treat Polaris3: You tell Polaris she's a good girl Polaris4: You let Polaris cuddle your arm Polaris5: You pet Polaris +Empress1: A fine day for mana consumption. +Empress2: That's quite enough mana... +Empress3: OH GREAT HEAVENS! +Empress4: A // Point Blank PointBlank: Does extra damage to enemies shot at point-blank range // Charge diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 6cbb3601eb..ca653d853b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -85,8 +85,6 @@ GhastlyExplosionShard.DisplayName: Ghastly Fragment GhastlySubBlast.DisplayName: Ghast Blast GleamingBolt.DisplayName: Gleaming Bolt GleamingBolt2.DisplayName: Gleaming Bolt -GraniteEnergy.DisplayName: Granite Energy -GranitePulse.DisplayName: Granite Pulse HadalUrnIsopod.DisplayName: Abyssal Isopod HadalUrnJellyfish.DisplayName: Mirage Jelly HadalUrnLamprey.DisplayName: Sea Lamprey @@ -98,8 +96,8 @@ HellwingBat.DisplayName: Ashen Hellwing HolyFlame.DisplayName: Holy Flame HolyLaser.DisplayName: Holy Laser IceBarrageMain.DisplayName: Ice Barrage -IceBlock.DisplayName: Ice Barrage -IceBlockIcicle.DisplayName: Ice Barrage +IceBlock.DisplayName: Ice Barrage Block +IceBlockIcicle.DisplayName: Ice Barrage Icicle IceCluster.DisplayName: Ice Cluster Icicle.DisplayName: Icicle IcicleStaffProj.DisplayName: Furious Icicle @@ -252,7 +250,7 @@ VoidVortexProj.DisplayName: Void Vortex VolatileStarcore.DisplayName: Volatile Starcore VortexElementalBeam.DisplayName: Vortex Lightning WaterLeechProj.DisplayName: Water Leech -WaywasherProj.DisplayName: Waywasher Blast +WaywasherProj.DisplayName: Waywasher Wave WingmanGrenade.DisplayName: Mana Grenade WingmanShot.DisplayName: Mana Shot WulfrumBolt.DisplayName: Wulfrum Bolt diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index f1bbe599eb..421e5a47bc 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -299,7 +299,6 @@ TruePurityProjection.DisplayName: Purity Projection TumbleweedRolling.DisplayName: Rolling Tumbleweed TyphonsGreedBubble.DisplayName: Typhon's Greed UltimusCleaverDust.DisplayName: Ultimus Flame -UrchinMaceProjectile.DisplayName: Urchin Mace UrchinSpikeFugu.DisplayName: Urchin Spike VirulentBeeWave.DisplayName: Virulent Bee Wave VirulentWave.DisplayName: Virulent Wave diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index cc518ff3b0..1ee76f6ef7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -40,7 +40,7 @@ CobaltEnergy.DisplayName: Cobalt Energy CobaltKunaiProjectile.DisplayName: Cobalt Kunai ConsecratedWaterProjectile.DisplayName: Consecrated Water ContaminatedBileFlask.DisplayName: Contaminated Bile -CorpusAvertorClone.DisplayName: Corpus Avertor +CorpusAvertorClone.DisplayName: Corpus Avertor Clone CorpusAvertorProj.DisplayName: Corpus Avertor CorpusAvertorStealth.DisplayName: Corpus Avertor Corrocloud1.DisplayName: Corrocloud @@ -171,7 +171,7 @@ MangroveChakramProjectile.DisplayName: Mangrove Chakram MetalChunk.DisplayName: Metal Chunk MetalShard.DisplayName: Metal Shard MeteorFistProj.DisplayName: Meteor Fist Gud For A Lot Of Shtuff -MeteorFistStealth.DisplayName: Meteor Fist Gud For A Lot Of Shtuff +MeteorFistMeteorite.DisplayName: Meteorite REALLY Gud For A Lot Of Shtuff MoltenAmputatorProj.DisplayName: Molten Amputator MoltenBlobThrown.DisplayName: Molten Blob MoonSigil.DisplayName: Moon Sigil diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 107d00e2db..660a63246a 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -10,6 +10,7 @@ AstralSandBallGun.DisplayName: Astral Sand AstralSpray.DisplayName: Astral Spray AstralStar.DisplayName: Star AuricLandMineExplosion.DisplayName: Auric Land Mine Explosion +BabyCannonballProjectile.DisplayName: Baby Cannonball Projectile BasicBurst.DisplayName: Nondescript Damaging Explosion BasicPlagueBee.DisplayName: Basic Plague Bee BlazingStarHeal.DisplayName: Blazing Star Heal @@ -99,6 +100,7 @@ PscTransformRocks.DisplayName: Psc Transform Rocks ReaverOrb.DisplayName: Reaver Orb ReaverThornBase.DisplayName: Thorn RedLabSeeker.DisplayName: Seeking Mechanism +RelicGuard.DisplayName: Relic Guard RiftReelerBobber.DisplayName: Chaotic Bobber SandCloakVeil.DisplayName: Dust Veil SandExplosion.DisplayName: Sand @@ -141,4 +143,3 @@ YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation -RelicGuard.DisplayName: Relic Guard diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index b8dd397c36..af5aea506a 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -64,13 +64,16 @@ GodSlayerInferno1: "{0} imploded into nothingness." GodSlayerInferno2: "{0}'s body slipped into oblivion." GodSlayerInferno3: "{0} ceased being a part of our universe." Goldfish: "{0} was once again impaled by Goldfish." +HeavyBleeding1: "{0} expired from heavy internal bleeding." +HeavyBleeding2: "{0} forgot that blood is supposed to stay inside the body." +HeavyBleeding3: "{0} bled profusely to their last breath." HolyFlames1: "{0} fell prey to their sins." HolyFlames2: "{0} burst into sinless ash." HolyFlames3: "{0} was purified by the profaned flame." HolyInferno: "{0} was incinerated by the profaned backdraft." -Laceration1: "{0} expired from heavy internal bleeding." +Laceration1: "{0} was indecently smeared all over the walls." Laceration2: "{0} was turned into a fine red mist." -Laceration3: "{0} forgot that blood is supposed to stay inside the body." +Laceration3: "{0} was pulped, ribbons and rivulets of spent life spattering freely." ManaBurn: "{0}'s life was completely converted into mana." ManaConversionEnchant: "{0}'s life was fully tapped by dark magics." MiracleBlight1: "{0} was blown away by miraculous technological advancements." diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 1303b6d872..bb4cbf380c 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -257,7 +257,7 @@ namespace CalamityMod private static void WikiThisSupport() { // Wikithis is a clientside mod - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; CalamityMod calamity = GetInstance(); diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 7b49fa7201..002ff2ebce 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -211,7 +211,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bloatfish2").Type, NPC.scale); diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index 7d28b94911..d60cbe1b33 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -278,7 +278,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BobbitWorm").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BobbitWorm2").Type, 1f); diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 569955cea9..77b717aaf5 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -650,7 +650,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ColossalSquid2").Type, NPC.scale); diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 62edc486a5..8e5716a636 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -394,7 +394,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cuttlefish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cuttlefish2").Type, 1f); diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index 86f0a98418..ab478d5acd 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.Abyss brokenMask = true; NPC.HitSound = SoundID.NPCHit1; NPC.defense = 15; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 4; i++) { @@ -336,7 +336,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Devilfish2").Type, 1f); diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index 4c3a37908c..f1be9b6e3a 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -92,7 +92,7 @@ namespace CalamityMod.NPCs.Abyss brokenMask = true; NPC.HitSound = SoundID.NPCHit1; NPC.defense = 15; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 4; i++) { @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DevilfishAlt2").Type, 1f); diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 748681ebdf..02450d05e6 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -161,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Wyrm2").Type, 1f); } diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index bbbceef33f..bb6bcfa664 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -161,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Wyrm3").Type, 1f); } diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 37e26cc9b0..5db9631938 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -493,7 +493,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Wyrm").Type, 1f); } diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index 817986fec7..dba229a146 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -161,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Wyrm4").Type, 1f); } diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 4b4373e7a6..9651d90ae0 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -271,7 +271,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantSquid").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantSquid2").Type, 1f); diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index eacba128be..fffdbe9751 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel3").Type, 1f); diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 6a2b05e6f8..700c7a225a 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel3").Type, 1f); diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 64130aad7f..5c3bad9db5 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -396,7 +396,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GulperEel").Type, 1f); } diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index b2104ecf9f..edd3285342 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -173,7 +173,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("GulperEel4").Type, 1f); } diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index 9671f0d830..68f902f3e2 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Laserfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Laserfish2").Type, 1f); diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 1ab39f808a..6b95e594c6 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Abyss if (screamTimer == screamLimit) { SoundEngine.PlaySound(ScreamSound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) { @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Confetti, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LuminousCorvina2").Type, 1f); diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 43324d7bdc..dcbd788354 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MorayEel2").Type, 1f); diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index ed149f9b14..b110c6b019 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishBody").Type, 1f); } } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 20a9467a9b..82664b5438 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -356,7 +356,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishHead").Type, 1f); } } diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index 99b6d6bebf..e18c3657b6 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -147,7 +147,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OarfishTail").Type, 1f); } } diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 0dd0003fcd..a595aa9e36 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -280,7 +280,7 @@ namespace CalamityMod.NPCs.Abyss HopTimer = ai2 == -1 ? 0 : ai2; CalmDownTimer = ai3 == -1 ? 0 : ai3; NPC.netUpdate = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); } @@ -453,7 +453,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Water, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 5; i++) { diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 6eda808819..2fed796aaa 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -174,7 +174,7 @@ namespace CalamityMod.NPCs.Abyss { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ViperFish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ViperFish2").Type, 1f); diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 195f3ad3d0..feba4c4c47 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -257,7 +257,7 @@ namespace CalamityMod.NPCs.AcidRain Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AcidEelGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AcidEelGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/BabyFlakCrab.cs b/NPCs/AcidRain/BabyFlakCrab.cs index 7c5ee432ec..5fc75e32ee 100644 --- a/NPCs/AcidRain/BabyFlakCrab.cs +++ b/NPCs/AcidRain/BabyFlakCrab.cs @@ -149,7 +149,7 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BabyFlakCrabGore").Type, 1f); } diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 1271b5a888..7cfa43f431 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs.AcidRain if (InPhase2 && !HasMadeShellBreakGore) { SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP1Gore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP1Gore2").Type, NPC.scale); @@ -495,7 +495,7 @@ namespace CalamityMod.NPCs.AcidRain Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP2Gore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, -Vector2.UnitY.RotatedByRandom(0.4f) * 4f, Mod.Find("CragmawMireP2Gore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index 873132f844..c9505ec7fe 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -226,7 +226,7 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("FlakCrabGore2").Type, 1f); diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 9d06ba61bc..a901b64e48 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -197,7 +197,7 @@ namespace CalamityMod.NPCs.AcidRain { for (int k = 0; k < 20; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GammaSlimeGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GammaSlimeGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index dfb1a632f8..4a47bcbc42 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -122,7 +122,7 @@ namespace CalamityMod.NPCs.AcidRain { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IrradiatedSlime").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("IrradiatedSlime2").Type, 1f); diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 1f9307fc45..0ab66f14c6 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -477,7 +477,7 @@ namespace CalamityMod.NPCs.AcidRain for (int k = 0; k < 30; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Mauler").Type, NPC.scale); for (int i = 2; i <= 5; i++) diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 89a6358da2..5f50419754 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.AcidRain if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("NuclearToadGore1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("NuclearToadGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index 56bd5315f8..ef3fd1d1f3 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.AcidRain get => NPC.ai[3] == 1f; set { - if (Main.netMode == NetmodeID.Server && value != PerformingJump) + if (Main.dedServ && value != PerformingJump) NPC.netUpdate = true; NPC.ai[3] = value.ToInt(); } @@ -255,7 +255,7 @@ namespace CalamityMod.NPCs.AcidRain Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OrthoceraGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OrthoceraGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 5fa6b6b717..b2968f02eb 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.AcidRain { Lighting.AddLight(NPC.Center, 0.3f, 1.5f, 0.3f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int auraSize = 200; //roughly 12 blocks (half the size of Wither Beast aura) Player player = Main.player[Main.myPlayer]; diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index 8066f0a2cc..2c95fabde1 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.AcidRain Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkyfinGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkyfinGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 333d378eec..1bd7b04ece 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -248,7 +248,7 @@ namespace CalamityMod.NPCs.AcidRain } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSkaterGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSkaterGore2").Type, NPC.scale); diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index f6a51dac40..f85ec39507 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -202,7 +202,7 @@ namespace CalamityMod.NPCs.AcidRain } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("TrilobiteGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("TrilobiteGore2").Type, NPC.scale); diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 87686af096..fa66f19776 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.AquaticScourge { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBody").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBody2").Type, NPC.scale); diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index d1bf9bc88f..9ef8a4450b 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.AquaticScourge { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBodyAlt").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASBodyAlt2").Type, NPC.scale); diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 40cc144e26..0e0f11b603 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -315,7 +315,7 @@ namespace CalamityMod.NPCs.AquaticScourge for (int k = 0; k < 15; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASHead").Type, NPC.scale); } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 7d9a757ca1..0c7761be5b 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.AquaticScourge { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASTail").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ASTail2").Type, NPC.scale); diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 36b0aa784c..faddb06bef 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -288,7 +288,7 @@ namespace CalamityMod.NPCs.Astral Main.dust[cosmos].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = NPC.Center; int goreAmt = 3; diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 1fb2da6802..dbd069a50d 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -123,7 +123,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 5d7d5d3d00..b4dd27e74b 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -132,7 +132,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 5036e8b734..435dcc51a2 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -464,7 +464,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { //head Gore.NewGore(NPC.GetSource_Death(), NPC.Top, NPC.velocity * 0.5f, Mod.Find("AtlasGore4").Type); diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 27def2f9a5..818c5c67b4 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -265,7 +265,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 1d50003cf1..8f004e0ea7 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 0f8ba1f673..d14ec0d4dd 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -282,7 +282,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 7; i++) { diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index aa5b562749..95120b8a6c 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 44d62a6bdf..67d8668cfb 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index ccfc0dcac6..1da35af01f 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -99,7 +99,7 @@ namespace CalamityMod.NPCs.Astral //if dead do gores if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) { diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index 3a039663e9..80ca2ae44c 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -490,7 +490,7 @@ namespace CalamityMod.NPCs.AstrumAureus aureusDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[aureusDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Aureus1").Type, 1f); diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index c90499907a..48520d3f9e 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.AstrumDeus astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; if (NPC.localAI[3] == 1f) diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index d15f166851..e1e14712ef 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -230,7 +230,7 @@ namespace CalamityMod.NPCs.AstrumDeus astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("AstrumDeusHead1").Type, 1f); diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 1cbb9ac13d..df4cda8149 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -164,7 +164,7 @@ namespace CalamityMod.NPCs.AstrumDeus astralDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), 0f, 0f, 100, default, 2f); Main.dust[astralDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("AstrumDeusTail1").Type, 1f); diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 93fc575c92..493114f022 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -290,7 +290,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental brimDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[brimDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("BrimstoneGore1").Type, 1f); diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs index 3f0f8faf89..6b934b0360 100644 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ b/NPCs/Bumblebirb/Bumblefuck.cs @@ -521,7 +521,7 @@ namespace CalamityMod.NPCs.Bumblebirb { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now { diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 1ae8a7732a..95eeab7720 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -266,7 +266,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Calamitas").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Calamitas2").Type, NPC.scale); diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index 405b07e95f..c5b3cbf9c1 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cataclysm").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Cataclysm2").Type, NPC.scale); diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index 9f2ad19fd1..ee72d7ea16 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Catastrophe").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Catastrophe2").Type, NPC.scale); diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 6915fac89a..d6a78285ce 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -143,7 +143,7 @@ namespace CalamityMod.NPCs.CalClone } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSeeker").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSeeker2").Type, 1f); diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs index 8949910384..ed78fd0c8a 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs @@ -70,7 +70,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Inflict Extreme Gravity to nearby players if (revenge) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -219,7 +219,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Main.npc[headOneID].netUpdate = true; // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]); } @@ -235,7 +235,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Main.npc[headTwoID].netUpdate = true; // On server, immediately send the correct extra AI of this head to clients. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]); } @@ -367,7 +367,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs index 0882a65f4f..b5112224ae 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs @@ -1064,7 +1064,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs npc.velocity *= 1.15f; npc.netSpam = 5; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); return; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a053cec900..5796d7df1f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -98,28 +98,20 @@ namespace CalamityMod.NPCs { #region Variables - /// - /// Boss Kill Time data structure - /// + /// Boss Kill Time data structure public static SortedDictionary BossKillTimes; - /// - /// Damage Reduction Lookup Table - /// + /// Damage Reduction Lookup Table public static SortedDictionary DRValues { get; set; } - /// - /// Damage Reduction Value - /// + /// Damage Reduction Value public float DR { get; set; } = 0f; - /// - /// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false. - /// + /// If set to true, the NPC's damage reduction cannot be reduced via any means. This applies regardless of whether is true or false. public bool unbreakableDR = false; /// - /// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.

+ /// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.
/// Used primarily by post-Moon Lord bosses. ///
public bool customDR = false; @@ -128,15 +120,30 @@ namespace CalamityMod.NPCs public int KillTime { get; set; } = 0; - public const int DoGPhase1KillTime = 5400; - - // Debuff Vulnerabilities - // null = neutral, true = vulnerable, false = resistant - // neutral = 100% effective, vulnerable = 400% effective DoT and 200% effective non-DoT effects (within reason, some aren't exactly 200% more effective), resistant = 50% effective + /// + /// Controls the effectiveness of heat debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToHeat = null; + /// + /// Controls the effectiveness of cold debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToCold = null; + /// + /// Controls the effectiveness of sickness debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToSickness = null; + /// + /// Controls the effectiveness of electricity debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToElectricity = null; + /// + /// Controls the effectiveness of water debuffs against this NPC.
+ /// If true, they are vulnerable and debuffs are 200% effective. If false, they are resistant and debuffs are 50% effective. If null, they are neutral and suffer standard effects. + ///
public bool? VulnerableToWater = null; public const double BaseDoTDamageMult = 1D; @@ -154,88 +161,108 @@ namespace CalamityMod.NPCs // Heat debuff effects public bool IncreasedHeatEffects_Fireball = false; public bool IncreasedHeatEffects_CinnamonRoll = false; - public bool IncreasedHeatEffects_FlameWakerBoots = false; - public bool IncreasedHeatEffects_HellfireTreads = false; + public int IncreasedHeatEffects_FireBoots = 0; public bool IncreasedHeatEffects_FlameWings = false; // Toxic Heart effect public bool IncreasedSicknessEffects_ToxicHeart = false; - // Evergreen Gin effect + // Sickness and Water debuff effects public bool IncreasedSicknessAndWaterEffects_EvergreenGin = false; + public bool IncreasedSicknessAndWaterEffects_CorrosiveSpine = false; - // Biome enrage timer max + /// Constant variable representing the grace period, in frames, in which a boss can remain outside of its native biome before enraging. public const int biomeEnrageTimerMax = 300; - // Variable for certain worm bosses used to prevent them from moving too fast upon swapping phases while far away from their target - // Currently only used by DoG + /// + /// Variable for worm bosses used to prevent them from moving too fast upon swapping phases while far away from their target.
+ /// Currently only used by DoG. + ///
public float velocityPriorToPhaseSwap = 0f; public const float velocityPriorToPhaseSwapIncrement = 0.1f; public bool ShouldFallThroughPlatforms; - /// - /// Allows hostile NPCs to deal damage to the player's defense stat, used mostly for hard-hitting bosses. - /// + /// Allows hostile NPCs to deal defense damage to the player, used mostly for hard-hitting bosses. public bool canBreakPlayerDefense = false; - // Total defense loss from some true melee hits and other things that reduce defense + /// Set this value to reduce target defense by a flat amount. public int miscDefenseLoss = 0; - // Distance values for when bosses increase velocity to catch up to their target + /// + /// Constant representing a distance of 200 tiles in pixel measurement.
+ /// Used by bosses to increase their velocity in order to catch up to their target. + ///
public const float CatchUpDistance200Tiles = 3200f; + /// + /// Constant representing a distance of 350 tiles in pixel measurement.
+ /// Used by bosses to increase their velocity in order to catch up to their target. + ///
public const float CatchUpDistance350Tiles = 5600f; + /// + /// Constant representing a distance of 400 tiles in pixel measurement.
+ /// Used as a cap on the distance away from a boss a player can be inflicted with Boss Effects. + ///
+ private const float BossZenDistance = 6400f; /// - /// Destroyer laser colors, used for telegraphs + /// Destroyer laser colors, used for telegraphs.
/// None = -1, Red = 0, Green = 1, Cyan = 2 ///
public int destroyerLaserColor = -1; - // Boss Zen distance - private const float BossZenDistance = 6400f; - - // Buff most vanilla enemy HP by 25% + /// + /// Constant multiplier used to increase vanilla enemy health. + /// private const double EnemyHPMultiplier = 1.25; - - // Used to nerf desert prehardmode enemies pre-Desert Scourge + /// + /// Constant multiplier used to decrease the health and/or damage of pre-Hardmode Desert enemies. + /// private const double DesertEnemyStatMultiplier = 0.75; - - // Used to nerf Master Mode boss HP (base is 27.5% more than Expert) + /// + /// Constant multiplier used to decrease vanilla boss health in Master Mode.
+ /// When combined with the universal health multiplier, results in 27.5% more health than Expert Mode. + ///
public const double MasterModeBossHPMultiplier = 0.85; - // Used to nerf Master Mode enemies + /// Constant multiplier used to decrease enemy health in Master Mode. public const double MasterModeEnemyHPMultiplier = 0.75; + /// Constant multiplier used to decrease enemy damage in Master Mode. public const double MasterModeEnemyDamageMultiplier = 0.9; - - // Used to nerf Expert and Master Mode enemies + /// Constant multiplier used to decrease enemy knockback resistance. public const float ExpertModeEnemyKnockbackMultiplier = 0.05f; + /// public const float MasterModeEnemyKnockbackMultiplier = 0.1f; - // HP and damage multipliers for the Early Hardmode Progression Rework + /// Constant multiplier used for decreasing the health and damage of mechanical bosses if the Early Hardmode Progression Rework config is enabled. public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic = 0.8; + /// public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic = 0.9; + /// public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert = 0.9; + /// public const double EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert = 0.95; - // Used to increase coin drops in Normal Mode - private const double NPCValueMultiplier_NormalCalamity = 1.5; - - // Used to decrease coin drops in Expert Mode + /// Constant multiplier used to increase coin drops in Classic Mode. + private const double NPCValueMultiplier_ClassicCalamity = 1.5; + /// Constant multiplier used to decrease coin drops in Expert Mode. private const double NPCValueMultiplier_ExpertVanilla = 2.5; - - // Used to change the Expert Mode coin drop multiplier + /// private const double NPCValueMultiplier_ExpertCalamity = 1.5; // Dash damage immunity timer public const int maxPlayerImmunities = Main.maxPlayers + 1; public int[] dashImmunityTime = new int[maxPlayerImmunities]; - // Town NPC shop alert animation variables + /// Used to control the animation of the Town NPC Shop Alert icon, if the respective config is enabled. public int shopAlertAnimTimer = 0; + /// public int shopAlertAnimFrame = 0; - // Set to false for this NPC to be unable to generate proximity Rage, regardless of other factors + /// + /// If set to false, prevents this NPC from allowing Rage to be generated by nearby players, regardless of other factors.
+ /// Defaults to true. + ///
public bool ProvidesProximityRage = true; // NewAI @@ -243,24 +270,21 @@ namespace CalamityMod.NPCs public float[] newAI = new float[maxAIMod]; public int AITimer = 0; - // Town NPC Patreon + /// Used for allowing Patreon names for Town NPCs. public bool setNewName = true; - // Stuff used by the Boss Health UI + /// If set to true, the Boss Health Bar for this NPC will count the total health of all individual segments using worm segment logic. public bool SplittingWorm = false; + /// If set to true, allows this NPC to draw a Boss Health Bar, regardless of other factors. public bool CanHaveBossHealthBar = false; + /// If set to true, allows for manually disabling this NPC's Boss Health Bar, even if they are still active. public bool ShouldCloseHPBar = false; - // Timer for how long an NPC is immune to certain debuffs + /// Constant representing the cooldown, in frames, before a boss can be affected by a slowing debuff. public const int slowingDebuffResistanceMin = 1800; + /// Tracks the current slowing debuff cooldown for this NPC. public int debuffResistanceTimer = 0; - // If a boss is affected by knockback and a timer for how long that boss is immune to knockback after being knocked back - public bool bossCanBeKnockedBack = false; - public const int knockbackResistanceMin = 180; - public int knockbackResistanceTimer = 0; - - // Debuffs public int vaporfied = 0; public int timeSlow = 0; @@ -272,9 +296,14 @@ namespace CalamityMod.NPCs public int slowed = 0; public int electrified = 0; public int pearlAura = 0; + /// + /// Counter variable that increments while the NPC is inflicted with Pearl Aura.
+ /// Used to determine when Giant Pearl's pearl shards should rain down onto the NPC. + ///
public int pearlAuraCounter = 0; public int bBlood = 0; public int brainRot = 0; + public int heavybleeding = 0; public int laceration = 0; public int elementalMix = 0; public int marked = 0; @@ -282,6 +311,7 @@ namespace CalamityMod.NPCs public int irradiated = 0; public int bFlames = 0; public int hFlames = 0; + /// Plague debuff. public int pFlames = 0; public int aCrunch = 0; public int crumble = 0; @@ -301,14 +331,19 @@ namespace CalamityMod.NPCs public int cursorFocus = 0; public const int cursorFocusMax = 300; - // Used by Septic Skewer to prevent enemies from hurting the player when they are pulled into them + /// + /// If set to true, prevents this NPC from dealing contact damage.
+ /// Used by Septic Skewer's execution attack. + ///
public bool pacified = false; // Soma Prime Shred deals damage with DirectStrikes instead of with direct debuff damage // It also stacks, scales with ranged damage, and can crit, meaning it needs to know who applied it most recently + /// Tracks how many stacks of the Shred debuff this NPC is inflicted with. public int somaShredStacks = 0; + /// Tracks the index of the player that inflicted this NPC with Shred, for the purpose of scaling damage. public int somaShredApplicator = -1; - // Reduced by the number of active stacks every frame. If it hits zero, one stack disappears. + /// Counter used for removing stacks of Shred. The number of stacks is subtracted every frame, and when it hits zero, it is reset and one stack is removed. public int somaShredFalloff = Shred.StackFalloffFrames; public int cDepth = 0; @@ -322,15 +357,19 @@ namespace CalamityMod.NPCs public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; + /// If greater than 0, this NPC has been "shocked" by Amidias' Spark's on hurt effect. public int shocked = 0; + /// If greater than 0, this NPC has been "shocked" by The Transformer's on hurt effect. public int transformerShocked = 0; public int voidfrost = 0; public int shellfishVore = 0; public int clamDebuff = 0; public int sulphurPoison = 0; + /// If greater than 0, makes this NPC constantly spawn heart gores. public int ladHearts = 0; public int kamiFlu = 0; public int relicOfResilienceWeakness = 0; + /// Cooldown variable for spawning Gauss Dagger's gauss flux projectiles. public int GaussFluxTimer = 0; public int sagePoisonTime = 0; public int sagePoisonDamage = 0; @@ -338,6 +377,10 @@ namespace CalamityMod.NPCs public int trueVulnerabilityHex = 0; public int banishingFire = 0; public int wither = 0; + /// + /// If greater than 0, this enemy will appear to disintegrate into ash when killed.
+ /// Used by Rancor's laser beam. + ///
public int ashesOnDeath = 0; // whoAmI Variables @@ -399,30 +442,34 @@ namespace CalamityMod.NPCs // Drawing variables. public FireParticleSet VulnerabilityHexFireDrawer = null; - // Boss Enrage variable for use with the boss health UI. - // The logic behind this is as follows: - // 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player. - // 2 - Otherwise, check if the demonshade enrage is active. If it is, register this as true. If not, go to step 3. - // 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4. - // 4 - Check if Boss Rush isn't active. If so, set this to true. + /// + /// Boss Enrage variable for use with the boss health UI.
+ /// The logic behind this is as follows: + /// 1 - For special cases with super-enrages (specifically Yharon/SCal with their arenas), go solely based on whether that enrage is active. That information is most important to the player. + /// 2 - Check if the Demonshade enrage is active. If it is, register this as true. If not, go to step 3. + /// 3 - Check if a specific enrage condition (such as Duke Fishron's Ocean check) is met. If it is, and Boss Rush is not active, set this to true. If not, go to step 4. + /// 4 - Check if Boss Rush isn't active. If so, set this to true. + ///
public bool CurrentlyEnraged; - // Increased defense or DR variable for use with the boss health UI. - // The logic behind this is as follows: - // 1 - When bosses are transitioning phases they gain a massive DR increase. - // 2 - When bosses are using certain attacks that make them particularly vulnerable they gain a massive DR or defense increase. + /// + /// Increased defense or DR variable for use with the boss health UI.
+ /// The logic behind this is as follows: + /// 1 - When bosses are transitioning phases they gain a massive DR increase. + /// 2 - When bosses are using certain attacks that make them particularly vulnerable they gain a massive DR or defense increase. + /// While either of these are occuring, this variable should be set to true. + ///
public bool CurrentlyIncreasingDefenseOrDR; - // Other Boss Rush stuff + /// If set to true, this NPC will be ignored by Boss Rush's whitelist and will always be allowed to exist. public bool DoesNotDisappearInBossRush; - // On-Kill variables + /// Variable used for Gladiator's Locket's on-kill effect to ensure it only triggers once per kill. public bool gladiatorOnKill = true; - - // Variable for if enemy has been recently hit by an ArcZap + /// Cooldown variable for Unstable Granite Core's arc zap effect. public int arcZapCooldown = 0; - // Animates worms in the bestiary but only when their entry is being looked at + /// Timer for animating worm enemies in the bestiary. public float bestiaryWormTimer = 0; #endregion @@ -463,10 +510,10 @@ namespace CalamityMod.NPCs myClone.IncreasedElectricityEffects_Transformer = IncreasedElectricityEffects_Transformer; myClone.IncreasedHeatEffects_Fireball = IncreasedHeatEffects_Fireball; myClone.IncreasedHeatEffects_CinnamonRoll = IncreasedHeatEffects_CinnamonRoll; - myClone.IncreasedHeatEffects_FlameWakerBoots = IncreasedHeatEffects_FlameWakerBoots; - myClone.IncreasedHeatEffects_HellfireTreads = IncreasedHeatEffects_HellfireTreads; + myClone.IncreasedHeatEffects_FireBoots = IncreasedHeatEffects_FireBoots; myClone.IncreasedHeatEffects_FlameWings = IncreasedHeatEffects_FlameWings; myClone.IncreasedSicknessEffects_ToxicHeart = IncreasedSicknessEffects_ToxicHeart; + myClone.IncreasedSicknessAndWaterEffects_CorrosiveSpine = IncreasedSicknessAndWaterEffects_CorrosiveSpine; myClone.IncreasedSicknessAndWaterEffects_EvergreenGin = IncreasedSicknessAndWaterEffects_EvergreenGin; myClone.velocityPriorToPhaseSwap = velocityPriorToPhaseSwap; @@ -501,9 +548,6 @@ namespace CalamityMod.NPCs myClone.debuffResistanceTimer = debuffResistanceTimer; - myClone.bossCanBeKnockedBack = bossCanBeKnockedBack; - myClone.knockbackResistanceTimer = knockbackResistanceTimer; - myClone.vaporfied = vaporfied; myClone.timeSlow = timeSlow; myClone.gState = gState; @@ -517,6 +561,7 @@ namespace CalamityMod.NPCs myClone.pearlAuraCounter = pearlAuraCounter; myClone.bBlood = bBlood; myClone.brainRot = brainRot; + myClone.heavybleeding = heavybleeding; myClone.laceration = laceration; myClone.elementalMix = elementalMix; myClone.marked = marked; @@ -880,18 +925,21 @@ namespace CalamityMod.NPCs if (IncreasedHeatEffects_Fireball) heatDamageMult += Fireball.HeatDebuffBoost; - if (IncreasedHeatEffects_FlameWakerBoots) - heatDamageMult += 0.25; + if (IncreasedHeatEffects_FireBoots > 0) + heatDamageMult += 0.25 * IncreasedHeatEffects_FireBoots; if (IncreasedHeatEffects_CinnamonRoll) heatDamageMult += CinnamonRoll.HeatDebuffBoost; - if (IncreasedHeatEffects_HellfireTreads) - heatDamageMult += 0.5; if (IncreasedHeatEffects_FlameWings) heatDamageMult += 0.25; if (IncreasedSicknessEffects_ToxicHeart) sicknessDamageMult += 0.5; + if (IncreasedSicknessAndWaterEffects_CorrosiveSpine) + { + sicknessDamageMult += 0.25; + waterDamageMult += 0.25; + } if (IncreasedSicknessAndWaterEffects_EvergreenGin) { sicknessDamageMult += EvergreenGin.SicknessWaterDebuffBoost; @@ -1236,10 +1284,12 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(30, 6, ref npc.lifeRegen, ref damage); if (somaShredStacks > 0) Shred.TickDebuff(npc, this); - if (laceration > 0) + if (heavybleeding > 0) ApplyDPSDebuff(80, 10, ref npc.lifeRegen, ref damage); + if (laceration > 0) + ApplyDPSDebuff(400, 100, ref npc.lifeRegen, ref damage); if (elementalMix > 0) - ApplyDPSDebuff(400, 80, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(400, 100, ref npc.lifeRegen, ref damage); if (miracleBlight > 0) ApplyDPSDebuff(3000, 500, ref npc.lifeRegen, ref damage); @@ -3448,7 +3498,7 @@ namespace CalamityMod.NPCs // Rebalance coin drops so that Normal Mode enemies and bosses drop an adequate amount of coins. // Increase Normal Mode coin drops by 1.5x. - npc.value = (int)(npc.value * NPCValueMultiplier_NormalCalamity); + npc.value = (int)(npc.value * NPCValueMultiplier_ClassicCalamity); // Change the Expert Mode coin drop multiplier. if (Main.expertMode) @@ -3645,9 +3695,9 @@ namespace CalamityMod.NPCs cirrusBossActive = Main.npc[SCal].ModNPC().cirrus; } - bool nightProvi = npc.type == NPCType() && !Main.IsItDay(); + bool enragedProvi = npc.type == NPCType() && !ProvUtils.StandardAI(); bool dayEmpress = npc.type == NPCID.HallowBoss && NPC.ShouldEmpressBeEnraged(); - if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (nightProvi || dayEmpress)) + if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (enragedProvi || dayEmpress)) { // Set the DR scaling factor float DRScalar = 10f; @@ -3800,7 +3850,7 @@ namespace CalamityMod.NPCs if (KillTime > 0 || npc.type == NPCType()) { // Apply Boss Effects while any boss NPC is active - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < BossZenDistance) Main.player[Main.myPlayer].AddBuff(BuffType(), 2); @@ -4973,7 +5023,7 @@ namespace CalamityMod.NPCs } Lighting.AddLight(npc.Center, dustLerpColor1.ToVector3() * 0.7f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Player localPlayer = Main.LocalPlayer; if (!localPlayer.dead && localPlayer.HitboxForBestiaryNearbyCheck.Intersects(npc.Hitbox)) @@ -5491,8 +5541,6 @@ namespace CalamityMod.NPCs // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; - if (knockbackResistanceTimer > 0) - knockbackResistanceTimer--; if (timeSlow > 0) timeSlow--; @@ -5521,6 +5569,8 @@ namespace CalamityMod.NPCs bBlood--; if (brainRot > 0) brainRot--; + if (heavybleeding > 0) + heavybleeding--; if (laceration > 0) laceration--; if (elementalMix > 0) @@ -5973,16 +6023,16 @@ namespace CalamityMod.NPCs case NPCID.Spazmatism: if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - target.AddBuff(BuffID.Bleeding, 300); + target.AddBuff(BuffType(), 180, true); break; case NPCID.SkeletronPrime: if (npc.ai[1] == 1f || npc.ai[1] == 2f) - target.AddBuff(BuffID.Bleeding, 300); + target.AddBuff(BuffType(), 180, true); break; case NPCID.PrimeSaw: - target.AddBuff(BuffID.Bleeding, 180); + target.AddBuff(BuffType(), 120, true); break; case NPCID.Plantera: @@ -6005,6 +6055,10 @@ namespace CalamityMod.NPCs target.AddBuff(BuffType(), 240); break; + case NPCID.DukeFishron: + target.AddBuff(BuffType(), 120, true); + break; + case NPCID.AncientLight: target.AddBuff(BuffType(), 120); break; @@ -6423,9 +6477,9 @@ namespace CalamityMod.NPCs //20% is balanced for non empowered, while 40% helps ensure psc remains balanced at empowered tier //Some PSC projectiles receive a reduced amount of benefit from this, for balancing purposes modifiers.ScalingBonusDamage += (empowered ? 0.4f : 0.2f) * TagDamageMult; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - var color = ProvUtils.GetDayNightColor(!Main.dayTime, 0); + var color = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0); float power = Math.Min(npc.height / 100f, 3f); var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); @@ -6533,7 +6587,7 @@ namespace CalamityMod.NPCs npc2.velocity.Y -= Main.rand.Next(0, 10) * (Main.getGoodWorld ? 0.5f : 0.1f) + s; npc2.ai[0] = -1000 * Main.rand.Next(3); - if (Main.netMode == NetmodeID.Server && slime < Main.maxNPCs) + if (Main.dedServ && slime < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slime, 0f, 0f, 0f, 0, 0, 0); } } @@ -6822,7 +6876,7 @@ namespace CalamityMod.NPCs if (typeToSpawn != NPCID.None) { int spawnedNPC = NPCLoader.SpawnNPC(typeToSpawn, checkPositionX, checkPositionY - 1); - if (Main.netMode == NetmodeID.Server && spawnedNPC < Main.maxNPCs) + if (Main.dedServ && spawnedNPC < Main.maxNPCs) { Main.npc[spawnedNPC].position.Y -= 8f; NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spawnedNPC); @@ -7127,6 +7181,9 @@ namespace CalamityMod.NPCs if (hFlames > 0 || banishingFire > 0) HolyFlames.DrawEffects(npc, ref drawColor); + if (heavybleeding > 0) + HeavyBleeding.DrawEffects(npc, ref drawColor); + if (laceration > 0) Laceration.DrawEffects(npc, ref drawColor); @@ -7149,7 +7206,7 @@ namespace CalamityMod.NPCs if (rTide > 0) RiptideDebuff.DrawEffects(npc, ref drawColor); - if (somaShredStacks > 0 && Main.netMode != NetmodeID.Server) + if (somaShredStacks > 0 && !Main.dedServ) Shred.DrawEffects(npc, this, ref drawColor); if (sulphurPoison > 0) @@ -7216,7 +7273,7 @@ namespace CalamityMod.NPCs } // Some extraneous and probably undocumented visual effect caused by the heart lad pet thing - if (ladHearts > 0 && !npc.loveStruck && Main.netMode != NetmodeID.Server) + if (ladHearts > 0 && !npc.loveStruck && !Main.dedServ) { if (Main.rand.NextBool(5)) { @@ -7315,6 +7372,7 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno", NPC => NPC.Calamity().gsInferno > 0), ("CalamityMod/Buffs/DamageOverTime/HolyFlames", NPC => NPC.Calamity().hFlames > 0), ("CalamityMod/Buffs/DamageOverTime/Laceration", NPC => NPC.Calamity().laceration > 0), + ("CalamityMod/Buffs/DamageOverTime/HeavyBleeding", NPC => NPC.Calamity().heavybleeding > 0), ("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight > 0), ("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither > 0), ("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().pFlames > 0), diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 95effcf1f3..575a0db534 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -435,13 +435,6 @@ namespace CalamityMod.NPCs npcLoot.ChangeDropRate(ItemID.WispinaBottle, 1, 200); break; - // Necromancer - // Wrath of the Ancients @ 4% Normal, 6.67% Expert+ - case NPCID.Necromancer: - case NPCID.NecromancerArmored: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); - break; - // Giant Cursed Skull // Keelhaul @ 6.67% IF Leviathan dead case NPCID.GiantCursedSkull: diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index 37775253f2..3966839c5e 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -91,6 +91,7 @@ namespace CalamityMod.NPCs private static readonly string[] CyborgNames = { "Sylux", // <@!331812782183809025> (gonkachino) + "XL-39 Nemesis", // <@!1104036024063107082> (yashimayamanata) }; private static readonly string[] DemolitionistNames = { diff --git a/NPCs/CalamityVanillaMinibossesAI.cs b/NPCs/CalamityVanillaMinibossesAI.cs index 10d1ddeb09..c4af09141c 100644 --- a/NPCs/CalamityVanillaMinibossesAI.cs +++ b/NPCs/CalamityVanillaMinibossesAI.cs @@ -622,7 +622,7 @@ namespace CalamityMod.NPCs if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != 58) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 6fb3d01529..41817f7e07 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -322,7 +322,7 @@ namespace CalamityMod.NPCs.CeaselessVoid Main.dust[purpleDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("CeaselessVoid").Type, 1f); diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 02c31c3d75..5c15926749 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -657,7 +657,7 @@ namespace CalamityMod.NPCs.Crabulon Main.npc[crabShroom].SetDefaults(npcType); Main.npc[crabShroom].velocity.X = Main.rand.Next(-50, 51) * (Main.getGoodWorld ? 0.2f : 0.1f); Main.npc[crabShroom].velocity.Y = Main.rand.Next(-50, -31) * (Main.getGoodWorld ? 0.2f : 0.1f); - if (Main.netMode == NetmodeID.Server && crabShroom < Main.maxNPCs) + if (Main.dedServ && crabShroom < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, crabShroom); } } @@ -954,7 +954,7 @@ namespace CalamityMod.NPCs.Crabulon stompDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueFairy, 0f, 0f, 100, default, 2f); Main.dust[stompDust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Crabulon").Type, NPC.scale); diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 0ed1511b15..1c8cbd99a4 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CalamityEye").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CalamityEye2").Type, 1f); diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index 5170db261a..e562c70478 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DespairStone").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DespairStone2").Type, NPC.scale); diff --git a/NPCs/Crags/RenegadeWarlock.cs b/NPCs/Crags/RenegadeWarlock.cs index 034ca0b0ae..770a2ab412 100644 --- a/NPCs/Crags/RenegadeWarlock.cs +++ b/NPCs/Crags/RenegadeWarlock.cs @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int count = Main.zenithWorld ? 20 : 1; // remember that old oversight in the draedon update? for (int g = 0; g < count; g++) diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 05d844cff5..9be31715aa 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -296,7 +296,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Scryllar").Type, NPC.scale); } diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index e73be83f5c..45bf652574 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -269,7 +269,7 @@ namespace CalamityMod.NPCs.Crags { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScryllarRage").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScryllarRage2").Type, NPC.scale); diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index de9995a56b..fedf150195 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -320,7 +320,7 @@ namespace CalamityMod.NPCs.Crags } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSlurper").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SoulSlurper2").Type, NPC.scale); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 9f15609f3e..18bbcb9a8b 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -311,7 +311,7 @@ namespace CalamityMod.NPCs.Cryogen if (!WorldGen.SolidTile(enemySpawnX, enemySpawnY)) { int legendEnemySpawn = NPC.NewNPC(NPC.GetSource_FromAI(), enemySpawnX * 16 + 8, enemySpawnY * 16, spawnType); - if (Main.netMode == NetmodeID.Server && legendEnemySpawn < Main.maxNPCs) + if (Main.dedServ && legendEnemySpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, legendEnemySpawn); break; @@ -1240,7 +1240,7 @@ namespace CalamityMod.NPCs.Cryogen { SoundStyle sound = Main.zenithWorld ? SoundID.NPCDeath14 : TransitionSound; SoundEngine.PlaySound(sound, NPC.Center); - if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) + if (!Main.dedServ && !Main.zenithWorld) { int chipGoreAmount = newPhase >= 5 ? 3 : newPhase >= 3 ? 2 : 1; for (int i = 1; i < chipGoreAmount; i++) @@ -1379,7 +1379,7 @@ namespace CalamityMod.NPCs.Cryogen icyDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, dusttype, 0f, 0f, 100, default, 2f); Main.dust[icyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) + if (!Main.dedServ && !Main.zenithWorld) { float randomSpread = Main.rand.Next(-200, 201) / 100f; for (int i = 1; i < 4; i++) diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 532154de8c..aff0c00efc 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.Cryogen Main.dust[icyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server && !Main.zenithWorld) + if (!Main.dedServ && !Main.zenithWorld) { int totalGores = 16; double radians = MathHelper.TwoPi / totalGores; diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index ca4fb0570f..04f7f4f571 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { switch ((int)NPC.ai[3]) { diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs index 5a24a228c4..7c36c4c1d6 100644 --- a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -303,7 +303,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { switch ((int)NPC.ai[3]) { diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index b72b17ecaf..9b910362cd 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -519,7 +519,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceHead").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index deb6591e6b..c1ae0da906 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -560,7 +560,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Head").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index ff0620eeed..7c83738f4c 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisanceTail").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs index 8c0b1882c9..00290efb8d 100644 --- a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeNuisance2Tail").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 55f6cd07e7..32d276bc6b 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -339,7 +339,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { switch ((int)NPC.ai[3]) { @@ -379,7 +379,7 @@ namespace CalamityMod.NPCs.DesertScourge // Sometimes "Deflect" projectiles in gfb into water blasts. if (Main.rand.NextBool(20) && Main.zenithWorld) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 velocity = new Vector2(-projectile.velocity.X, -projectile.velocity.Y); velocity.Normalize(); diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index fc57caf6b7..66df943fe9 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -1021,7 +1021,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeHead2").Type, NPC.scale); diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index d09f5d3e8d..86d94a3997 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -227,7 +227,7 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScourgeTail").Type, NPC.scale); for (int k = 0; k < 10; k++) diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 43c9f062f9..51946e7d4c 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -195,7 +195,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT2").Type, 1f); diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index 6f9825e6d1..d85e147d7e 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -137,7 +137,7 @@ namespace CalamityMod.NPCs.DevourerofGods } tail = true; } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) { NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -416,7 +416,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoT").Type, 1f); } diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index 24469b1616..7bcc59229f 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -187,7 +187,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoT2").Type, 1f); diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 3523335b13..8eeabe1a7f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -501,7 +501,7 @@ namespace CalamityMod.NPCs.DevourerofGods { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("DoGS6").Type, NPC.scale); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 8e5da0d276..f4d2a079c9 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -287,7 +287,7 @@ namespace CalamityMod.NPCs.DevourerofGods writer.Write(extrapitch); // Be sure to inform clients of the fact that The Devourer of Gods is dying if only the server recieved this packet. - if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) + if (Main.dedServ && !wasDyingBefore && Dying) { NPC.netSpam = 0; NPC.netUpdate = true; @@ -1029,7 +1029,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Set flight time to max during laser walls if (!spawnedGuardians3 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].Calamity().infiniteFlight = true; @@ -1059,7 +1059,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Flight if (NPC.ai[3] == 0f) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -1274,7 +1274,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Ground else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -1864,7 +1864,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Flight if (NPC.ai[3] == 0f) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -2061,7 +2061,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Ground else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -2539,7 +2539,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { SoundEngine.PlaySound(DeathAnimationSound, NPC.Center); @@ -2855,7 +2855,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS2").Type, NPC.scale); diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 2dcd798415..9eddad668f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -420,7 +420,7 @@ namespace CalamityMod.NPCs.DevourerofGods } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS3").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DoGS4").Type, NPC.scale); diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index 8c425427dd..9134f87a5f 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -336,7 +336,7 @@ namespace CalamityMod.NPCs.DraedonLabThings Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Electric); if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 3; i++) Gore.NewGorePerfect(NPC.GetSource_Death(), NPC.Center, NPC.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.7f, 1f), Mod.Find($"RepairUnit{i}").Type); diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index 3b0399f151..c98fbb9b1a 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1750,7 +1750,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Apollo1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Apollo2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index dbd6a74ecb..a41fcab55f 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -853,7 +853,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares case (int)Phase.Deathrays: // Set flight time to max during Deathray Spiral - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < DeathrayEnrageDistance) { @@ -1667,7 +1667,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresBody1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresBody2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 2590e97a5a..29284604a7 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -682,7 +682,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresGaussNuke1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresGaussNuke2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 71b77c28f0..7ba3e64ca0 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -732,7 +732,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresLaserCannon1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresLaserCannon2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 27af6cc19e..fc227df3a3 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -681,7 +681,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresPlasmaFlamethrower1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresPlasmaFlamethrower2").Type, 1f); diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 9934fbdb21..e4dc3a1fb2 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -675,7 +675,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresTeslaCannon1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AresTeslaCannon2").Type, 1f); diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index c24b5dfb85..7818bae958 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -1581,7 +1581,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Artemis1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Artemis2").Type, 1f); diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 3bfd6b266f..5527da2298 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -379,7 +379,7 @@ namespace CalamityMod.NPCs.ExoMechs if (Main.netMode != NetmodeID.MultiplayerClient) SummonExoMech(); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { SoundEngine.PlaySound(CommonCalamitySounds.FlareSound with { Volume = CommonCalamitySounds.FlareSound.Volume * 1.55f }, PlayerToFollow.Center); if (!exoMechdusa) @@ -794,7 +794,7 @@ namespace CalamityMod.NPCs.ExoMechs if (NPC.life > 0) return; - if (Main.netMode != NetmodeID.Server && !HasBeenKilled) + if (!Main.dedServ && !HasBeenKilled) { for (int i = 1; i <= 4; i++) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index 414df945d7..001642cf54 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -681,7 +681,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody1_2").Type, 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 63def90f4a..851583cc43 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -686,7 +686,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody2").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosBody2_2").Type, 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index c857c2b0ae..a5634d6a46 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -837,7 +837,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // If close enough to the target, prepare to fire deathray float slowDownDistance = GetSlowdownAreaEdgeRadius(lastMechAlive); bool readyToFireDeathray = distanceFromTarget < slowDownDistance; - if (readyToFireDeathray) + if (readyToFireDeathray && NPC.localAI[2] == 0f) NPC.localAI[2] = 1f; // Use a lerp to smoothly scale up velocity and turn speed @@ -866,7 +866,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos turnDistance = chargeLocationDistance; // Gradually turn and move slower if within 50 tiles of the target - if (NPC.localAI[2] == 1f) + if (NPC.localAI[2] >= 1f) { // Exponentially scale down velocity if close to the target float velocityScale = distanceFromTarget / slowDownDistance; @@ -876,6 +876,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos baseVelocity *= velocityScale; turnSpeed *= velocityScale; + // Increment localAI[2], this is used as a timer to control the pulsing of the telegraph + float pulseIncrement = 1f / 60f * (distanceFromTarget < slowDownDistance * 0.5f ? 0.75f : 1.5f); + NPC.localAI[2] += pulseIncrement; + calamityGlobalNPC.newAI[2] += 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { @@ -1159,8 +1163,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // A large, faded circle. Is rescaled to fit the radius of the slowdown area. Texture2D auraTexture = AuraTexture.Value; - float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Yes, this is bizarre as fuck. int completelyUseless = 0; int otherExoMechsAlive = CheckForOtherMechs(ref completelyUseless, out _, out _); @@ -1171,14 +1173,17 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos auraGeneralPower *= Utils.GetLerpValue(deathrayTelegraphDuration + deathrayDuration, deathrayTelegraphDuration + deathrayDuration, NPC.Calamity().newAI[2], true); // Determine the characteristics of the aura. This requires intermediate computations to determine if Thanatos is in its final phase as well as for pulsing. + float lifeRatio = NPC.life / (float)NPC.lifeMax; bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); bool lastMechAlive = berserk && otherExoMechsAlive == 0; - float pulse = Main.GlobalTimeWrappedHourly * 0.72f % 1f; + bool isCloseEnough = Vector2.Distance(NPC.Center, Main.player[NPC.target].Center) < GetSlowdownAreaEdgeRadius(lastMechAlive) * 0.5f; + + float pulse = NPC.localAI[2] % 1f; float auraRadius = GetSlowdownAreaEdgeRadius(lastMechAlive) * auraGeneralPower * 1.25f; Vector2 outerAuraScale = Vector2.One * auraRadius / auraTexture.Size(); - Vector2 innerAuraScale = outerAuraScale * pulse * 1.2f; - Color outerAuraColor = Color.White * auraGeneralPower * 0.6f; - Color innerAuraColor = outerAuraColor * (float)Math.Sqrt(1f - pulse); + Vector2 innerAuraScale = outerAuraScale * (1 - pulse) * 1.2f; + Color outerAuraColor = Color.White * auraGeneralPower * 0.65f; + Color innerAuraColor = (isCloseEnough ? outerAuraColor : Color.Red * auraGeneralPower * 0.65f) * (float)Math.Sqrt(pulse); // Draw the aura. spriteBatch.Draw(auraTexture, center, null, outerAuraColor, 0f, auraTexture.Size() * 0.5f, outerAuraScale, SpriteEffects.None, 0f); @@ -1334,7 +1339,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosHead").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosHead2").Type, 1f); diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index a1dcf46bdf..7e5a54ad58 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -684,7 +684,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.dust[plasmaDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosTail").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ThanatosTail2").Type, 1f); diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index afcdb80d2f..e295167654 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.Trophies; @@ -709,7 +710,7 @@ IL_6899: public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 600, true); + target.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index b10d53ba72..758f6cac73 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.HiveMind for (int k = 0; k < 20; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Glass, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DankCreeperGore").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("DankCreeperGore2").Type, 1f); diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 2c7e5ebf0e..01aafe3e10 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -475,7 +475,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.localAI[1] = 1f; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmount = 7; for (int i = 1; i <= goreAmount; i++) @@ -605,7 +605,7 @@ namespace CalamityMod.NPCs.HiveMind int fivePercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); Main.npc[fivePercentMinions].SetDefaults(type); - if (Main.netMode == NetmodeID.Server && fivePercentMinions < Main.maxNPCs) + if (Main.dedServ && fivePercentMinions < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, fivePercentMinions); } @@ -753,7 +753,7 @@ namespace CalamityMod.NPCs.HiveMind if (nextState == 0) { NPC.TargetClosest(); - if (revenge && lifeRatio < 0.53f) + if (revenge && lifeRatio < 0.5f) { if (death) { @@ -762,7 +762,7 @@ namespace CalamityMod.NPCs.HiveMind while (nextState == previousState); previousState = nextState; } - else if (lifeRatio < 0.27f) + else if (lifeRatio < 0.25f) { do nextState = Main.rand.Next(3, 6); @@ -1080,13 +1080,8 @@ namespace CalamityMod.NPCs.HiveMind NPC.ai[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient && Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height)) { - if (NPC.ai[0] == 2f || (NPC.ai[0] == 4f && death)) - { - int maxHearts = revenge ? 2 : 1; - if (expertMode && NPC.CountNPCS(ModContent.NPCType()) < maxHearts) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); - } - else if (!NPC.AnyNPCs(NPCID.EaterofSouls) && NPC.Distance(Main.player[NPC.target].Center) > 80f) + int maxEaters = revenge ? 3 : 2; + if (NPC.CountNPCS(NPCID.EaterofSouls) < maxEaters && NPC.Distance(Main.player[NPC.target].Center) > 80f) NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.EaterofSouls); } @@ -1190,6 +1185,55 @@ namespace CalamityMod.NPCs.HiveMind break; } + + // Dark Heart spawns in phase 2 + if (NPC.life > 0 && expertMode && lifeRatio < 0.5f) + { + if (NPC.ai[3] > NPC.lifeMax * 0.6f) + NPC.ai[3] = NPC.lifeMax * 0.6f; + + int tenPercentHP = (int)(NPC.lifeMax * 0.1); + if ((NPC.life + tenPercentHP) < NPC.ai[3]) + { + NPC.ai[3] = NPC.life; + + int maxDarkHearts = ((revenge && lifeRatio < 0.25f) || death) ? 2 : 1; + if (NPC.CountNPCS(ModContent.NPCType()) < maxDarkHearts) + { + SoundEngine.PlaySound(SoundID.NPCDeath22, NPC.Center); + + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool()) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 35; j++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); + int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); + int type = ModContent.NPCType(); + int tenPercentMinions = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, type); + Main.npc[tenPercentMinions].SetDefaults(type); + if (Main.dedServ && tenPercentMinions < Main.maxNPCs) + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, tenPercentMinions); + } + } + } + } } public override bool CanHitNPC(NPC target) => NPC.alpha == 0; // Can only be hit while fully visible @@ -1267,7 +1311,7 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmount = 10; for (int i = 1; i <= goreAmount; i++) diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 3bef948d92..8d88507216 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -801,7 +801,7 @@ namespace CalamityMod.NPCs.Leviathan bloody2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloody2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("LeviGore").Type, NPC.scale); @@ -916,13 +916,10 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Bleeding, 600, true); + target.AddBuff(ModContent.BuffType(), 180, true); } - public override bool CheckActive() - { - return false; - } + public override bool CheckActive() => false; public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 9582773fef..a4ea0b9aeb 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -186,7 +186,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody2").Type, 1f); diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 33ee0968e7..5f230ad2bb 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -468,7 +468,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead2").Type, 1f); diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index b6536f1e61..8aa015ef78 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -141,7 +141,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail2").Type, 1f); diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index 0e177cee4c..8c65b93520 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.IceRod, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CryoSpirit").Type, 1f); } diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index b48e26de4c..a6a4b88510 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ambient_DarkBrown, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bohldohr2").Type, 1f); diff --git a/NPCs/NormalNPCs/BucketZombie.cs b/NPCs/NormalNPCs/BucketZombie.cs index 17873f340f..d0b4edf209 100644 --- a/NPCs/NormalNPCs/BucketZombie.cs +++ b/NPCs/NormalNPCs/BucketZombie.cs @@ -82,7 +82,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BucketZombie2").Type, 1f); diff --git a/NPCs/NormalNPCs/CladCrab.cs b/NPCs/NormalNPCs/CladCrab.cs index 51e14ce53b..7696168219 100644 --- a/NPCs/NormalNPCs/CladCrab.cs +++ b/NPCs/NormalNPCs/CladCrab.cs @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.NormalNPCs Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Stone, hit.HitDirection, -1f, 0, default, 1f); Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Grass, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab").Type); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("CladCrab2").Type); diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index 17192a95df..f954995ab2 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Sand, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmber").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmber2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index 402b5e213f..a4e87c0b90 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.PurpleCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmethyst").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerAmethyst2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index 528a2c090b..e1a0792b18 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerCrystal").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerCrystal2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index cd13945757..09e32974f5 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemDiamond, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerDiamond").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerDiamond2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 9cda2fb1aa..83098672ad 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GemEmerald, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerEmerald").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerEmerald2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 09f52c7060..85e11808ee 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.HeartCrystal, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerRuby").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerRuby2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index a75e5b20fd..82e676db37 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerSapphire").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerSapphire2").Type, 1f); diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 347d6d546c..3ce4c15784 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -117,7 +117,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.t_Honey, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerTopaz").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("CrawlerTopaz2").Type, 1f); diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 9a4cab62f1..fe9bf61205 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -346,7 +346,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Eidolist").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Eidolist2").Type, NPC.scale); diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index e5eca4bb8e..0877b823af 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -249,7 +249,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenDoor) + if (Main.dedServ & canOpenDoor) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 0, (float)doorCheckX, (float)(doorCheckY - 1), (float)NPC.direction, 0, 0, 0); } @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenTallGate) + if (Main.dedServ & canOpenTallGate) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 4, (float)doorCheckX, (float)(doorCheckY - 1), 0f, 0, 0, 0); } diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs index 8a94dd7c66..30d5b09bca 100644 --- a/NPCs/NormalNPCs/Foveanator.cs +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -505,7 +505,7 @@ namespace CalamityMod.NPCs.NormalNPCs { SoundEngine.PlaySound(SoundID.NPCHit1, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { @@ -927,7 +927,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < 150; i++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2 * hit.HitDirection, -2f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { @@ -953,7 +953,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.dust[dust].velocity *= 3f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); Main.gore[gore].velocity *= 0.4f; diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 616cabe023..3c4fe4c6f8 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Frogfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Frogfish2").Type, 1f); diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 6d7b54958e..9d463af369 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -150,7 +150,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.dust[earthDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = NPC.Center; int goreAmt = 3; diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index bf70ac2606..3bd82cae9d 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -310,7 +310,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Frost, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("IceClasper").Type); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("IceClasper2").Type); diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index ab77e707d2..923a6e30ad 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -285,7 +285,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ImpiousImmolator2").Type, 1f); diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 721b6b923f..5dd4b71209 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MantisShrimp2").Type, 1f); diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index f9a42d6e5e..737a0269d0 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -300,7 +300,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenDoor) + if (Main.dedServ & canOpenDoor) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 0, (float)doorCheckX, (float)(doorCheckY - 1), (float)NPC.direction, 0, 0, 0); } @@ -313,7 +313,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[3] = (float)backUpTimer; NPC.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenTallGate) + if (Main.dedServ & canOpenTallGate) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 4, (float)doorCheckX, (float)(doorCheckY - 1), 0f, 0, 0, 0); } diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index 8640f341e9..1feaea149e 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -212,7 +212,7 @@ namespace CalamityMod.NPCs.NormalNPCs for (int i = 0; i < 150; i++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Plantera_Green, 2 * hit.HitDirection, -2f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), new Vector2(NPC.position.X + (float)Main.rand.Next(NPC.width), NPC.position.Y + (float)Main.rand.Next(NPC.height)), NPC.velocity, 388, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), new Vector2(NPC.position.X + (float)Main.rand.Next(NPC.width), NPC.position.Y + (float)Main.rand.Next(NPC.height)), NPC.velocity, 389, NPC.scale); diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 1f848d4090..31fd92aaa5 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -105,7 +105,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedEnergyBody2").Type, 1f); diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index b997458456..4fb5748983 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -171,7 +171,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AngryDog2").Type, 1f); diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index bb0141847c..c27214493c 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -124,7 +124,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Rotdog2").Type, 1f); diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 6e34f798d6..595c902888 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.ProfanedFire, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScornEater").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScornEater2").Type, 1f); diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 161238d44f..c75989cfda 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -393,7 +393,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BoneTorch, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ShockstormShuttle2").Type, 1f); diff --git a/NPCs/NormalNPCs/Shroomble.cs b/NPCs/NormalNPCs/Shroomble.cs index ce2e765f3d..b7a3f55518 100644 --- a/NPCs/NormalNPCs/Shroomble.cs +++ b/NPCs/NormalNPCs/Shroomble.cs @@ -167,7 +167,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Pixie, hit.HitDirection * 0.5f, -0.5f, 0, default, 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble").Type); Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("Shroomble2").Type); diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index 508c8a2260..dcbd25f0ae 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -225,7 +225,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.npc[spazmatism].localAI[3] = 1f; Main.npc[spazmatism].SyncVanillaLocalAI(); string typeName = Main.npc[spazmatism].TypeName; - if (Main.netMode == NetmodeID.Server && spazmatism < Main.maxNPCs) + if (Main.dedServ && spazmatism < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spazmatism); AchievementsHelper.CheckMechaMayhem(); @@ -875,7 +875,7 @@ namespace CalamityMod.NPCs.NormalNPCs { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_2").Type, NPC.scale); diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index dd3131cb42..7a00d1fa3a 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Stormlion").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Stormlion2").Type, NPC.scale); diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 42e7e11033..1af0826051 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -224,7 +224,7 @@ namespace CalamityMod.NPCs.NormalNPCs { Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.Cloud); - if (Main.rand.NextBool(15) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(15) && !Main.dedServ) { int smokeType = Utils.SelectRandom(Main.rand, GoreID.ChimneySmoke1, GoreID.ChimneySmoke2, GoreID.ChimneySmoke3); Vector2 smokeVelocity = Main.rand.NextVector2CircularEdge(6f, 6f); diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index bc34705496..d9fd23d8cd 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -498,7 +498,7 @@ namespace CalamityMod.NPCs.OldDuke Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, 2 * hit.HitDirection, -2f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.Find("OldDukeGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.Center + Vector2.UnitX * 20f * NPC.direction, NPC.velocity, Mod.Find("OldDukeGore2").Type, NPC.scale); diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 481b7c2a6e..be2fa69fef 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -264,7 +264,7 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[toxicDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("OldDukeToothBallGore2").Type, NPC.scale); diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index 85ec66d493..fd999977ae 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -317,7 +317,7 @@ namespace CalamityMod.NPCs.OldDuke Main.dust[bloody].velocity.X *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SulphurousSharkronGore2").Type, NPC.scale); diff --git a/NPCs/Other/LecherousOrb.cs b/NPCs/Other/LecherousOrb.cs index 8b339b269e..5d6d4e7e7d 100644 --- a/NPCs/Other/LecherousOrb.cs +++ b/NPCs/Other/LecherousOrb.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.Other magic.noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 4; i++) Gore.NewGoreDirect(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2Circular(3f, 3f), Mod.Find($"LecherousGore{i}").Type); diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index c197d7f2b7..360e1a19fa 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.Other playerLOL.velocity.Y *= 0.99f; if (!DownedBossSystem.downedCalamitas && !DownedBossSystem.downedExoMechs) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!playerLOL.dead && playerLOL.active) { diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 31a00fe8ff..2154470e3a 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -208,7 +208,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf3").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 7cf12cca7c..a15339120e 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.Perforator NPC.whoAmI = whoAmI2; } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf2").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf3").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index af7efbb936..552626f6b9 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -204,7 +204,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SmallPerf2").Type, NPC.scale); } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 6896dab446..af7e943b92 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -574,7 +574,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf2").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index abe6f138cd..e3cf886284 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -174,7 +174,7 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -499,7 +499,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf2").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index be6d04386d..1931ce9a48 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -533,7 +533,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SmallPerf").Type, NPC.scale); } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 230e7abc05..6968d2f8cc 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -629,7 +629,7 @@ namespace CalamityMod.NPCs.Perforator } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Hive").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Hive2").Type, 1f); diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 99ea4c7dbd..20cfe2cf62 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -199,7 +199,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf4").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("LargePerf5").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index ddc46d0d16..5363704b89 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.Perforator NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -206,7 +206,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf3").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("MediumPerf4").Type, NPC.scale); diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 43453de572..da90401b93 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -200,7 +200,7 @@ namespace CalamityMod.NPCs.Perforator { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SmallPerf3").Type, NPC.scale); } diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index 1c30016023..4203d6ee5e 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -85,7 +85,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Melter2").Type, 1f); diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index 0b5fe1a1b1..54f956edec 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger").Type, 0.5f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger2").Type, 0.5f); diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index 3511ff8ffc..dad5fb445f 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger").Type, 0.75f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlagueCharger2").Type, 0.75f); diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index 42aaffb6f7..db13bc4c31 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -370,7 +370,7 @@ namespace CalamityMod.NPCs.PlagueEnemies } } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI); } diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index c13bcb2203..9e5acf2b08 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -73,7 +73,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Plagueshell2").Type, 1f); diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index c3ea3971ac..d2c2f4d31f 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -200,7 +200,7 @@ namespace CalamityMod.NPCs.PlagueEnemies { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Plague, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Viruling").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Viruling2").Type, 1f); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index f30c1fad8d..b58379bc2f 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1206,7 +1206,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i < 7; i++) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PlaguebringerGoliathGore" + i).Type, NPC.scale); diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 5364fb0369..a4edf865e1 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -429,7 +429,7 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.netSpam > 10) NPC.netSpam = 10; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 28b62e6587..05b54428c9 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -662,7 +662,7 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.netSpam > 10) NPC.netSpam = 10; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, NPC.whoAmI, 0f, 0f, 0f, 0, 0, 0); } @@ -703,28 +703,13 @@ namespace CalamityMod.NPCs.Polterghast } int damage = NPC.GetProjectileDamage(type); - - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = baseProjectileVelocity / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - float rotation = MathHelper.ToRadians(65); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / 6; - double offsetAngle; + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * baseProjectileVelocity; + Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? 450 : 1800; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-32.5f, 32.5f, i / 5f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = (type == ModContent.ProjectileType() ? 450 : 1800); } } else @@ -732,27 +717,13 @@ namespace CalamityMod.NPCs.Polterghast int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = (baseProjectileVelocity + 5f) / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - float rotation = MathHelper.ToRadians(80); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / 6; - double offsetAngle; + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 5f); + Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 450; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-40f, 40f, i / 5f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = 450; } } } @@ -775,7 +746,7 @@ namespace CalamityMod.NPCs.Polterghast SoundEngine.PlaySound(P2Sound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt").Type, 1f); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt2").Type, 1f); @@ -837,58 +808,26 @@ namespace CalamityMod.NPCs.Polterghast } int damage = NPC.GetProjectileDamage(type); - - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = (baseProjectileVelocity + 1f) / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - int numProj = 7; - float rotation = MathHelper.ToRadians(80); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - for (int i = 0; i < numProj; i++) + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 1f); + Vector2 firingPos = NPC.Center + spreadVel * 3f; + for (int i = 0; i < 7; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = type == ModContent.ProjectileType() ? 450 : 1800; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-40f, 40f, i / 6f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = (type == ModContent.ProjectileType() ? 450 : 1800); } } else { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = (baseProjectileVelocity + 5f) / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - int numProj = 7; - float rotation = MathHelper.ToRadians(100); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - for (int i = 0; i < numProj; i++) + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 5f); + Vector2 firingPos = NPC.Center + spreadVel * 3f; + for (int i = 0; i < 7; i++) { - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); - Main.projectile[proj].timeLeft = 450; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-50f, 50f, i / 6f)); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + shot.timeLeft = 450; } } } @@ -928,7 +867,7 @@ namespace CalamityMod.NPCs.Polterghast SoundEngine.PlaySound(P3Sound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt").Type, 1f); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("Polt2").Type, 1f); @@ -969,31 +908,16 @@ namespace CalamityMod.NPCs.Polterghast NPC.localAI[1] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) { - Vector2 firingPosition = vector; - float playerXDist = player.Center.X - firingPosition.X; - float playerYDist = player.Center.Y - firingPosition.Y; - float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - - playerDistance = baseProjectileVelocity / playerDistance; - playerXDist *= playerDistance; - playerYDist *= playerDistance; - firingPosition.X += playerXDist * 3f; - firingPosition.Y += playerYDist * 3f; - - int numProj = 6 + (getPissed ? 4 : 2); - float rotation = MathHelper.ToRadians(110 + (getPissed ? 15 : 0)); - float baseSpeed = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - double startAngle = Math.Atan2(playerXDist, playerYDist) - rotation / 2; - double deltaAngle = rotation / numProj; - double offsetAngle; - + int numProj = (getPissed ? 10 : 8); + float maxSpread = getPissed ? 125 : 110; int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - + Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * baseProjectileVelocity; + Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < numProj; i++) { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPosition.X, firingPosition.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, 0f, 0f); + float offset = MathHelper.ToRadians(MathHelper.Lerp(-maxSpread * 0.5f, maxSpread * 0.5f, i / (numProj - 1f))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); } } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index eaf87ad7e4..b635cbdc8f 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -191,7 +191,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm2").Type, 1f); } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index c6b9ee2bd8..9a0da979d5 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -190,7 +190,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm3").Type, 1f); } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 6314210647..76d4d11e0d 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -1469,7 +1469,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void HitEffect(NPC.HitInfo hit) { // Create gore and dust hit effects. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; for (int k = 0; k < 15; k++) diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index b77c37a7da..5cdbb2c483 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.TintableDust, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.Center, NPC.velocity, Mod.Find("PrimordialWyrm4").Type, 1f); } diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 8f6db58b0b..82243838f3 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -335,14 +335,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[3] < 0f) NPC.ai[3] = 0f; - // Enrage at nighttime - bool enraged = false; - if (!Main.dayTime && !Main.remixWorld) - { - enraged = true; - NPC.Calamity().CurrentlyEnraged = true; - } - bool phase1 = healerAlive || defenderAlive; NPC.chaseable = !phase1; @@ -367,7 +359,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float goLowOrHighDistance = 540f; // Side swap variables for Phase 2 - float defenderCommanderGuardPhase2Duration = (bossRush || enraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float defenderCommanderGuardPhase2Duration = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; float moveToOtherSideInPhase2GateValue = defenderCommanderGuardPhase2Duration - 120f; float timeBeforeMoveToOtherSideInPhase2Reset = moveToOtherSideInPhase2GateValue * 2f; float totalGoLowDurationPhase2 = 210f; @@ -375,13 +367,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; - float maxChargeVelocity = (bossRush || enraged) ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; + float maxChargeVelocity = bossRush ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; if (Main.getGoodWorld) maxChargeVelocity *= 1.15f; if (CalamityWorld.LegendaryMode && revenge) maxChargeVelocity *= 2f; - float inertia = (bossRush || enraged) ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; + float inertia = bossRush ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (!phase1) @@ -464,7 +456,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (!goLow && !goLowPhase2 && !goHigh) calamityGlobalNPC.newAI[0] = -NPC.direction; - float velocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; if (healerAlive) @@ -501,7 +493,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 targetVector = destination - NPC.Center; Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; - float phaseGateValue = (bossRush || enraged) ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; + float phaseGateValue = bossRush ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; bool continueShootingProjectiles = phase1 || (NPC.ai[2] < (phaseGateValue * 5f)); if (continueShootingProjectiles) @@ -515,7 +507,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Alternate between firing profaned spears and holy fire // Shoot holy blasts in final phase NPC.ai[2] += 1f; - float projectileShootGateValue = (bossRush || enraged) ? 40f : death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; + float projectileShootGateValue = bossRush ? 40f : death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; if (NPC.ai[2] % projectileShootGateValue == 0f) { if (phase1) @@ -529,7 +521,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } bool shootSpear = NPC.ai[2] % (projectileShootGateValue * 2f) == 0f; - float projectileVelocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float projectileVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; Vector2 finalProjectileVelocity = Vector2.Normalize(player.Center - shootFrom) * projectileVelocity; int type = shootSpear ? ModContent.ProjectileType() : ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); @@ -542,8 +534,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (fireExtraProjectiles && shootSpear) { - int baseProjectileAmt = (bossRush || enraged) ? 4 : 2; - int spread = (bossRush || enraged) ? 18 : 10; + int baseProjectileAmt = bossRush ? 4 : 2; + int spread = bossRush ? 18 : 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < baseProjectileAmt; i++) { @@ -562,7 +554,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians else { // Shoot holy blasts - float holyBlastVelocity = (bossRush || enraged) ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; + float holyBlastVelocity = bossRush ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; int projTimeLeft = (int)(2000f / holyBlastVelocity); Vector2 finalHolyBlastVelocity = Vector2.Normalize(player.Center - shootFrom) * holyBlastVelocity; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -675,7 +667,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = Math.Sign(NPC.velocity.X); NPC.ai[1] += 1f; - float phaseGateValue = (bossRush || enraged) ? 90f : death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; + float phaseGateValue = bossRush ? 90f : death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; @@ -696,7 +688,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = (bossRush || enraged) ? 1.053333f : death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; + float velocityMult = bossRush ? 1.053333f : death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -799,7 +791,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool targetRanAwayAndWillNowBeFucked = NPC.ai[2] == 1f; bool boostVelocityToCatchUp = NPC.ai[1] == 0f || targetRanAwayAndWillNowBeFucked; - float velocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; if (boostVelocityToCatchUp) @@ -811,7 +803,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; float totalSpears = 12f; - float shootDuration = (bossRush || enraged) ? 240f : death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; + float shootDuration = bossRush ? 240f : death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; float dontShootTime = shootDuration * 0.3f; float phaseGateValue = dontShootTime + shootDuration; @@ -856,7 +848,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[1] % spearShootDivisor == 0f) { - float spearVelocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float spearVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) spearVelocity *= 1.25f; if (boostVelocityToCatchUp) @@ -874,8 +866,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[1] % (spearShootDivisor * 3) == 0f || targetRanAwayAndWillNowBeFucked) { knockbackVelocity *= 2f; - int baseProjectileAmt = (bossRush || enraged) ? 8 : expertMode ? 6 : 4; - int spread = (bossRush || enraged) ? 60 : expertMode ? 50 : 40; + int baseProjectileAmt = bossRush ? 8 : expertMode ? 6 : 4; + int spread = bossRush ? 60 : expertMode ? 50 : 40; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < baseProjectileAmt; i++) { @@ -911,7 +903,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } float laserGateValue = 120f; - float velocity = (bossRush || enraged) ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; + float velocity = bossRush ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; if (NPC.ai[1] < laserGateValue) velocity *= 6f; if (Main.getGoodWorld) @@ -967,7 +959,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (NPC.ai[2] == laserGateValue) { - float rotation = (bossRush || enraged) ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; + float rotation = bossRush ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, NPC.Center) < 2800f) SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); @@ -1057,11 +1049,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians texture2D15 = Texture_Glow.Value; Color timeBasedColorLerp = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (NPC.Calamity().CurrentlyEnraged) - { - texture2D15 = TextureNight_Glow.Value; - timeBasedColorLerp = Color.Lerp(Color.White, Color.Cyan, 0.75f); - } if (Main.zenithWorld) { texture2D15 = TextureNight_Glow.Value; @@ -1088,9 +1075,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + NPC.DrawBackglow(Main.zenithWorld ? Main.DiscoColor : new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -1166,14 +1153,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 shieldDrawPos = NPC.Center - screenPos; shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - float minHue = NPC.Calamity().CurrentlyEnraged ? 0.4f : (defenderAlive && healerAlive) ? 0.18f : 0.06f; + float minHue = (defenderAlive && healerAlive) ? 0.18f : 0.06f; float maxHue = minHue + 0.12f; float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[1]) / TimeForShieldDespawn; float scaleDuringShieldDespawnScale = 1.8f; float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); - Color color = Main.hslToRgb(MathHelper.Lerp(NPC.Calamity().CurrentlyEnraged ? minHue : maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; - Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, NPC.Calamity().CurrentlyEnraged ? maxHue : maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; color2.A = 0; color *= 0.6f; color2 *= 0.6f; @@ -1302,7 +1289,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA2").Type, 1f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index b8d0f5f027..d15b591dfc 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -247,20 +247,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - // Enrage at nighttime - bool enraged = false; - if (!Main.dayTime && !Main.remixWorld) - { - enraged = true; - NPC.Calamity().CurrentlyEnraged = true; - } - bool phase1 = healerAlive; NPC.chaseable = !phase1; // Phase durations - float commanderGuardPhase2Duration = (bossRush || enraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float commanderGuardPhase2Duration = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; float timeBeforeRocksRespawnInPhase2 = 90f; float throwRocksGateValue = 60f; @@ -269,7 +261,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; - float maxChargeVelocity = (bossRush || enraged) ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; + float maxChargeVelocity = bossRush ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; if (Main.getGoodWorld) maxChargeVelocity *= 1.15f; @@ -389,7 +381,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - float moveVelocity = (bossRush || enraged) ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; + float moveVelocity = bossRush ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; if (Main.getGoodWorld) moveVelocity *= 1.25f; if (healerAlive) @@ -439,7 +431,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Lay a holy bomb every once in a while in phase 1 and while not doing the laser attack if (!commanderUsingLaser) { - float projectileShootGateValue = (bossRush || enraged) ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float projectileShootGateValue = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; NPC.ai[1] += 1f; if (NPC.ai[1] >= projectileShootGateValue) { @@ -509,7 +501,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float shootMoltenBlastsGateValue = commanderGuardPhase2Duration / moltenBlastsDivisor; if (NPC.ai[1] % shootMoltenBlastsGateValue == 0f && !commanderGoingLowOrHighInPhase2) { - float moltenBlastVelocity = (bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float moltenBlastVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; int projTimeLeft = (int)(2400f / moltenBlastVelocity); Vector2 velocity = Vector2.Normalize(player.Center - shootFrom) * moltenBlastVelocity; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -616,7 +608,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = Math.Sign(NPC.velocity.X); NPC.ai[1] += 1f; - float phaseGateValue = (bossRush || enraged) ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; + float phaseGateValue = bossRush ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; @@ -637,7 +629,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = (bossRush || enraged) ? 1.04f : death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; + float velocityMult = bossRush ? 1.04f : death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -649,7 +641,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians else if (NPC.localAI[2] == 1f) { // Charge towards target - float inertia = (bossRush || enraged) ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; + float inertia = bossRush ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; // Stop charging towards the player when within a certain distance @@ -777,11 +769,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians texture2D15 = Texture_Glow.Value; Color timeBasedGlowColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (NPC.Calamity().CurrentlyEnraged) - { - texture2D15 = TextureNight_Glow.Value; - timeBasedGlowColor = Color.Lerp(Color.White, Color.Cyan, 0.75f); - } if (Main.zenithWorld) { texture2D15 = TextureNight_Glow.Value; @@ -808,12 +795,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; - if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; + NPC.DrawBackglow(Main.zenithWorld ? Main.DiscoColor : new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } // Draw laser effects @@ -881,14 +865,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 shieldDrawPos = NPC.Center - screenPos; shieldDrawPos -= new Vector2(shieldTexture.Width, shieldTexture.Height) * NPC.scale / 2f; shieldDrawPos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - float minHue = NPC.Calamity().CurrentlyEnraged ? 0.4f : 0.06f; + float minHue = 0.06f; float maxHue = minHue + 0.12f; float opacityScaleDuringShieldDespawn = (TimeForShieldDespawn - NPC.localAI[1]) / TimeForShieldDespawn; float scaleDuringShieldDespawnScale = 1.8f; float scaleDuringShieldDespawn = (1f - opacityScaleDuringShieldDespawn) * scaleDuringShieldDespawnScale; float colorScale = MathHelper.Lerp(0f, shieldOpacity, opacityScaleDuringShieldDespawn); - Color color = Main.hslToRgb(MathHelper.Lerp(NPC.Calamity().CurrentlyEnraged ? minHue : maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; - Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, NPC.Calamity().CurrentlyEnraged ? maxHue : maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color = Main.hslToRgb(MathHelper.Lerp(maxHue - minHue, maxHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.TwoPi) + 1f) * 0.5f), 1f, 0.5f) * colorScale; + Color color2 = Main.hslToRgb(MathHelper.Lerp(minHue, maxHue - minHue, ((float)Math.Sin(Main.GlobalTimeWrappedHourly * MathHelper.Pi * 3f) + 1f) * 0.5f), 1f, 0.5f) * colorScale; color2.A = 0; color *= 0.6f; color2 *= 0.6f; @@ -990,7 +974,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT2").Type, 1f); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 090bc5367e..1ea8449522 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -177,14 +177,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[0] >= 300f) NPC.ai[1] = 1f; - // Enrage at nighttime - bool enraged = false; - if (!Main.dayTime && !Main.remixWorld) - { - enraged = true; - NPC.Calamity().CurrentlyEnraged = true; - } - // Direction if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) { @@ -224,7 +216,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } bool useCrystalShards = AIState == (float)Phase.CrystalShards; - float velocity = useCrystalShards ? ((bossRush || enraged) ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); + float velocity = useCrystalShards ? (bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); if (Main.getGoodWorld) velocity *= 1.25f; @@ -312,7 +304,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { int type = ModContent.ProjectileType(); int damage = NPC.GetProjectileDamage(type); - int totalProjectiles = (bossRush || enraged) ? 18 : death ? 16 : revenge ? 14 : expertMode ? 12 : 10; + int totalProjectiles = bossRush ? 18 : death ? 16 : revenge ? 14 : expertMode ? 12 : 10; float speedX = -12f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -4f; @@ -351,7 +343,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, shootFrom); - int totalFlameProjectiles = (bossRush || enraged) ? 20 : 16; + int totalFlameProjectiles = bossRush ? 20 : 16; int totalRings = revenge ? 3 : 2; int healingStarChance = revenge ? 8 : expertMode ? 6 : 4; double radians = MathHelper.TwoPi / totalFlameProjectiles; @@ -369,7 +361,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians int type = ModContent.ProjectileType(); int dmgAmt = NPC.GetProjectileDamage(type); - if (Main.rand.NextBool(healingStarChance) && !enraged && !death) + if (Main.rand.NextBool(healingStarChance) && !death) { type = ModContent.ProjectileType(); dmgAmt = NPC.GetProjectileDamageNoScaling(type); @@ -412,7 +404,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Move towards a location above the player if (distanceFromDestination.Length() > idealDistanceFromDestination) { - float inertia = (bossRush || enraged) ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; + float inertia = bossRush ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (Main.getGoodWorld) @@ -467,11 +459,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians texture2D15 = Texture_Glow.Value; Color timeBasedDrawColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - if (NPC.Calamity().CurrentlyEnraged) - { - texture2D15 = TextureNight_Glow.Value; - timeBasedDrawColor = Color.Lerp(Color.White, Color.Cyan, 0.75f); - } if (Main.zenithWorld) { texture2D15 = TextureNight_Glow.Value; @@ -511,12 +498,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - Providence.Providence.BossMode mode = Providence.Providence.BossMode.Day; - if (!Main.dayTime) mode = Providence.Providence.BossMode.Night; + NPC.DrawBackglow(Main.zenithWorld ? Main.DiscoColor : new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, overrideColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } @@ -597,7 +581,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH2").Type, 1f); diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index a2a6edb15e..cf2bb60939 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -325,12 +325,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians drawPos += drawOrigin * NPC.scale + new Vector2(0f, NPC.gfxOffY); Rectangle frame = new Rectangle(0, 0, texture.Width, texture.Height); - Color col = Color.Orange; - - if (!Main.dayTime) col = Color.LightBlue; - if (!NPC.dontTakeDamage) - NPC.DrawBackglow(col.MultiplyRGBA(new Color(255, 255, 255, 0)), 4f, SpriteEffects.None, frame, screenPos, texture); + NPC.DrawBackglow(Color.Orange.MultiplyRGBA(new Color(255, 255, 255, 0)), 4f, SpriteEffects.None, frame, screenPos, texture); spriteBatch.Draw(texture, drawPos, frame, NPC.GetAlpha(drawColor), NPC.rotation, drawOrigin, NPC.scale, SpriteEffects.None, 0f); @@ -379,7 +375,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int npcType = (int)NPC.ai[2]; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedRocksGore" + npcType.ToString()).Type, NPC.scale); diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index a5e8989db5..378213ad2d 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -156,9 +156,9 @@ namespace CalamityMod.NPCs.Providence } } - NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + NPC.DrawBackglow(new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - spriteBatch.Draw(texture2D15, vector43, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, vector43, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossT2").Type, 1f); diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index bf8a0db736..a89548e32b 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -163,9 +163,9 @@ namespace CalamityMod.NPCs.Providence } } - NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + NPC.DrawBackglow(new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, violetLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); @@ -188,7 +188,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossH2").Type, 1f); diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index 9e8ea1d4b1..2466f1a134 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -158,9 +158,9 @@ namespace CalamityMod.NPCs.Providence } } - NPC.DrawBackglow(ProvUtils.GetDayNightColor(0, true), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); + NPC.DrawBackglow(new Color(255, 64, 0, 0), 4f, spriteEffects, NPC.frame, Main.screenPosition, texture2D15); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetDayNightColor(0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, ProvUtils.GetColorBasedOnEnrage(false, 0), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; } @@ -181,7 +181,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ProfanedGuardianBossA2").Type, 1f); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 28c8278993..940b325702 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -34,7 +34,6 @@ using CalamityMod.Tiles.Ores; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Graphics.PackedVector; using ReLogic.Content; using ReLogic.Utilities; using Terraria; @@ -47,7 +46,6 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using static CalamityMod.Projectiles.Rogue.FinalDawnFlame; using Filters = Terraria.Graphics.Effects.Filters; namespace CalamityMod.NPCs.Providence @@ -76,8 +74,8 @@ namespace CalamityMod.NPCs.Providence public enum BossMode { - Night = -1, - Day = 0, + Enraged = -1, + Normal = 0, Rainbow = 1, } @@ -93,7 +91,7 @@ namespace CalamityMod.NPCs.Providence private int frameUsed = 0; private int healTimer = 0; internal bool challenge = Main.expertMode; // Used to determine if Profaned Soul Crystal should drop, couldn't figure out mp mems always dropping it so challenge is singleplayer only. - internal bool hasTakenDaytimeDamage = false; + public bool hasBeenGivenFullPower = false; public static bool shouldDrawInfernoBorder = true; // This is only here for other mods to disable it if they don't want it drawing. public bool Dying = false; public int DeathAnimationTimer; @@ -121,7 +119,7 @@ namespace CalamityMod.NPCs.Providence private const float TimeForStarDespawn = 120f; private const float TimeForShieldDespawn = 120f; - // Every single one of Providence's sprites, both night and day, and their glowmasks + // Every single one of Providence's sprites, both normal and enraged, and their glowmasks #region Textures public static Asset TextureAlt; public static Asset TextureAltNight; @@ -330,7 +328,7 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().newAI[i] = reader.ReadSingle(); // Be sure to inform clients of the fact that Providence is dying if only the server recieved this packet. - if (Main.netMode == NetmodeID.Server && !wasDyingBefore && Dying) + if (Main.dedServ && !wasDyingBefore && Dying) { NPC.netSpam = 0; NPC.netUpdate = true; @@ -362,24 +360,24 @@ namespace CalamityMod.NPCs.Providence // Target variable and boss center Player player = Main.player[NPC.target]; - // Night bool and Color shifting + // Enraged bool and Color shifting bool bossRush = BossRushEvent.BossRushActive; bool getFuckedAI = Main.zenithWorld; if (getFuckedAI) NPC.localAI[1] = (float)BossMode.Rainbow; - else if (!ProvUtils.DayAI()) // Normal Night time activity - NPC.localAI[1] = (float)BossMode.Night; + else if (hasBeenGivenFullPower || bossRush) // Enraged behavior + NPC.localAI[1] = (float)BossMode.Enraged; else - NPC.localAI[1] = (float)BossMode.Day; + NPC.localAI[1] = (float)BossMode.Normal; - // Has Night AI if it's any color except day - bool nightAI = NPC.localAI[1] != (float)BossMode.Day; + // Fully powered up AI if it's any color except normal + bool fullPowerAI = NPC.localAI[1] != (float)BossMode.Normal; // Difficulty bools - bool death = CalamityWorld.death || nightAI; - bool revenge = CalamityWorld.revenge || nightAI; - bool expertMode = Main.expertMode || nightAI; + bool death = CalamityWorld.death || fullPowerAI; + bool revenge = CalamityWorld.revenge || fullPowerAI; + bool expertMode = Main.expertMode || fullPowerAI; // Target's current biome bool isHoly = player.ZoneHallow; @@ -400,8 +398,8 @@ namespace CalamityMod.NPCs.Providence // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Play enrage animation if night starts - if (!getFuckedAI && nightAI && calamityGlobalNPC.newAI[3] == spawnAnimationTime) + // Play enrage animation if she gets angy + if (!getFuckedAI && fullPowerAI && calamityGlobalNPC.newAI[3] == spawnAnimationTime) { AIState = (int)Phase.HolyBlast; NPC.ai[1] = 0f; @@ -410,6 +408,12 @@ namespace CalamityMod.NPCs.Providence calamityGlobalNPC.newAI[1] = 0f; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; + + // Despawn existing projectiles and summon the aura again + DespawnSpecificProjectiles(true); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, -1); + if (Main.netMode != NetmodeID.SinglePlayer) + ProvidenceDyeConditionSyncPacket.Send(this); NPC.netUpdate = true; // Prevent netUpdate from being blocked by the spam counter. @@ -417,14 +421,14 @@ namespace CalamityMod.NPCs.Providence NPC.netSpam = 9; } - // Increase all projectile damage at night, but reduce to 0 for Zenith + // Increase all projectile damage while enraged, but reduce to 0 for Zenith int projectileDamageMult = 1; if (getFuckedAI) projectileDamageMult = 0; - else if (nightAI) + else if (fullPowerAI) projectileDamageMult = 2; - NPC.Calamity().CurrentlyEnraged = !bossRush && nightAI; + NPC.Calamity().CurrentlyEnraged = !bossRush && fullPowerAI; // Projectile damage values int holyLaserDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; @@ -436,19 +440,19 @@ namespace CalamityMod.NPCs.Providence int holyBlastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - // Change dust type at night + // Change dust type while enraged int dustType = ProvUtils.GetDustID(); // Phase times - float phaseTime = nightAI ? (240f - 60f * (1f - lifeRatio)) : 300f; - float crystalPhaseTime = nightAI ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; - int nightCrystalTime = 210; - int gfbCrystalTime = 1500 + nightCrystalTime; + float phaseTime = fullPowerAI ? (240f - 60f * (1f - lifeRatio)) : 300f; + float crystalPhaseTime = fullPowerAI ? (float)Math.Round(60f * lifeRatio) : death ? 60f : 120f; + int enragedCrystalTime = 210; + int gfbCrystalTime = 1500 + enragedCrystalTime; float attackDelayAfterCocoon = phaseTime * 0.3f; // Phases bool ignoreGuardianAmt = lifeRatio < (death ? 0.2f : 0.15f); - bool phase2 = lifeRatio < 0.75f && !nightAI; + bool phase2 = lifeRatio < 0.75f && !fullPowerAI; bool delayAttacks = NPC.localAI[2] > 0f; // Spear phase @@ -781,8 +785,8 @@ namespace CalamityMod.NPCs.Providence else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - // Guardian spawn unless it's night time specifically (can still spawn on Zenith) - if (NPC.localAI[1] != (float)BossMode.Night) + // Guardian spawn unless she's enraged specifically (can still spawn on Zenith) + if (NPC.localAI[1] != (float)BossMode.Enraged) { if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -871,13 +875,13 @@ namespace CalamityMod.NPCs.Providence predictiveShots = true; // Velocity and acceleration - float speedIncreaseTimer = nightAI ? 75f : death ? 120f : 150f; + float speedIncreaseTimer = fullPowerAI ? 75f : death ? 120f : 150f; bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || bossRush; float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; float velocity = (expertMode ? 16f : 15f) + velocityBoost; - if (nightAI) + if (fullPowerAI) { acceleration = 1.5f; velocity = 25f; @@ -958,7 +962,7 @@ namespace CalamityMod.NPCs.Providence phase = (int)Phase.HolyBlast; break; case 3: - phase = (useCrystal || nightAI) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; + phase = (useCrystal || fullPowerAI) ? (int)Phase.Crystal : (int)Phase.MoltenBlobs; break; case 4: phase = useCrystal ? (int)Phase.MoltenBlobs : (int)Phase.FlameCocoon; @@ -967,31 +971,31 @@ namespace CalamityMod.NPCs.Providence phase = useCrystal ? (int)Phase.FlameCocoon : (int)Phase.HolyFire; break; case 6: - phase = (useLaser || nightAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; + phase = (useLaser || fullPowerAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; break; case 7: - phase = (useLaser || nightAI) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; + phase = (useLaser || fullPowerAI) ? (int)Phase.HolyBomb : (int)Phase.MoltenBlobs; break; case 8: - phase = (useLaser || nightAI) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; + phase = (useLaser || fullPowerAI) ? (int)Phase.MoltenBlobs : (int)Phase.SpearCocoon; break; case 9: phase = (int)Phase.HolyBlast; break; case 10: - phase = (useCrystal || nightAI) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; + phase = (useCrystal || fullPowerAI) ? (int)Phase.Crystal : (int)Phase.FlameCocoon; break; case 11: - phase = nightAI ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; + phase = fullPowerAI ? (int)Phase.FlameCocoon : (int)Phase.MoltenBlobs; break; case 12: - phase = (useLaser || nightAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; + phase = (useLaser || fullPowerAI) ? (int)Phase.Laser : (int)Phase.HolyBomb; break; case 13: phase = (int)Phase.SpearCocoon; break; case 14: - phase = (useLaser || nightAI) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; + phase = (useLaser || fullPowerAI) ? (int)Phase.HolyBomb : (int)Phase.HolyBlast; break; default: break; @@ -1091,7 +1095,7 @@ namespace CalamityMod.NPCs.Providence SoundEngine.PlaySound(HolyRaySound, NPC.Center); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 20; i++) { Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(1f, 1.6f), Main.rand.NextFloat(2f, 5f), hiColor, loColor); p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); @@ -1103,7 +1107,7 @@ namespace CalamityMod.NPCs.Providence Color hColor = ProvUtils.GetProjectileColor(255, false); Color lColor = ProvUtils.GetProjectileColor(0, true); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 20; i++) { Particle p = new FlameParticle(NPC.Center + new Vector2(Main.rand.NextFloat(150), 0).RotatedByRandom(MathHelper.TwoPi), 40, Main.rand.NextFloat(0.5f, 0.75f), Main.rand.NextFloat(1f, 2.5f), hColor, lColor); p.Velocity = new Vector2(Main.rand.NextFloat(3f, 19f), 0).RotatedByRandom(MathHelper.TwoPi); @@ -1113,7 +1117,7 @@ namespace CalamityMod.NPCs.Providence GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 1f, 0.1f, 15)); - for (float i = 0; i < 3; i += 0.25f) + for (float i = 0; i < 2.8f; i += 0.35f) { GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.35f, 35)); GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, hColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One * i, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.475f, 25)); @@ -1124,25 +1128,48 @@ namespace CalamityMod.NPCs.Providence if (calamityGlobalNPC.newAI[3] > 10f && calamityGlobalNPC.newAI[3] < spawnAnimationTime) { + // Move effects slightly lower during enrage animation to appear as if they're converging on her core + Vector2 destination = NPC.Center + (NPC.localAI[1] != (float)BossMode.Normal ? new Vector2(0f, 40f) : Vector2.Zero); + if (calamityGlobalNPC.newAI[3] % 10f == 0) { - GeneralParticleHandler.SpawnParticle(new CustomPulse(NPC.Center, Vector2.Zero, Color.Lerp(new Color(25, 25, 25, 0), medColor, sc), "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1.5f, 1f), Main.rand.NextBool(2) ? 0f : MathHelper.Pi, sc * 0.5f, sc * 0.1f, 20)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(destination, Vector2.Zero, Color.Lerp(new Color(25, 25, 25, 0), medColor, sc), "CalamityMod/Particles/SoftRoundExplosion", new Vector2(1.5f, 1f), Main.rand.NextBool() ? 0f : MathHelper.Pi, sc * 0.5f, sc * 0.1f, 20)); SoundStyle SpawnFlareSound = SoundID.Item74; - SpawnFlareSound.MaxInstances = 10; - SoundEngine.PlaySound(SpawnFlareSound.WithVolumeScale(calamityGlobalNPC.newAI[3] / spawnAnimationTime).WithPitchOffset(-1 + (calamityGlobalNPC.newAI[3] / spawnAnimationTime)), NPC.Center); } - Vector2 startPos = NPC.Center + (new Vector2(Main.rand.NextFloat(80, 300) * (sc * 1.6f), 0).RotatedByRandom(Main.rand.NextFloat(MathHelper.TwoPi)) * new Vector2(1.5f, 1f)); + Vector2 startPos = destination + (new Vector2(Main.rand.NextFloat(80, 300) * (sc * 1.6f), 0).RotatedByRandom(Main.rand.NextFloat(MathHelper.TwoPi)) * new Vector2(1.5f, 1f)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(startPos, startPos.DirectionTo(destination) * (startPos.Distance(destination) / 10), false, 10, Main.rand.NextFloat(0.2f, 0.5f) * (sc * 2), medColor)); + } - GeneralParticleHandler.SpawnParticle(new SparkParticle(startPos, startPos.DirectionTo(NPC.Center) * (startPos.Distance(NPC.Center) / 10), false, 10, Main.rand.NextFloat(0.2f, 0.5f) * (sc * 2), medColor)); + // Used to heal her back to full HP during enrage animation + if (fullPowerAI && calamityGlobalNPC.newAI[3] % 9f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = NPC.lifeMax / 400; + if (healAmt > NPC.lifeMax - NPC.life) + healAmt = NPC.lifeMax - NPC.life; + + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + + // Prevent netUpdate from being blocked by the spam counter. + if (NPC.netSpam >= 10) + NPC.netSpam = 9; + + NPC.netUpdate = true; + } + } } calamityGlobalNPC.newAI[3] += 1f; - if (nightAI && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) + if (fullPowerAI && calamityGlobalNPC.newAI[3] >= spawnAnimationTime) calamityGlobalNPC.newAI[3] += 1f; return; @@ -1222,7 +1249,7 @@ namespace CalamityMod.NPCs.Providence projectileVelocityY += expertMode ? 4f : 3f; - if (nightAI) + if (fullPowerAI) projectileVelocityY *= 2f; Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer); @@ -1350,7 +1377,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); dustColor.A = 255; int maxDust = 3; for (int j = 0; j < maxDust; j++) @@ -1388,7 +1415,7 @@ namespace CalamityMod.NPCs.Providence // Inflict Icarus Folly if (NPC.ai[3] >= (phaseTime * 2f)) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Player player2 = Main.player[Main.myPlayer]; bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; @@ -1646,7 +1673,7 @@ namespace CalamityMod.NPCs.Providence if (j % dustDivisor == 0) { currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, j / (float)maxHealDustIterations); - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(dustSpawned * 2.55f)))).X, 1f, 0.5f); dustColor.A = 255; int dust = Dust.NewDust(currentDustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, dustColor, 1f); Main.dust[dust].position = currentDustPos + new Vector2(32f, 32f).RotatedByRandom(MathHelper.TwoPi) * i; @@ -1664,7 +1691,7 @@ namespace CalamityMod.NPCs.Providence } } - if (!nightAI) + if (!fullPowerAI) blue -= 255 / (maxDustLines - 1); } @@ -1675,7 +1702,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustSpawnPos = Vector2.Normalize(NPC.velocity) * new Vector2(80f, 160f); dustSpawnPos = dustSpawnPos.RotatedBy((double)((k - (totalDust / 2 - 1)) * MathHelper.TwoPi / totalDust), default) + dustLineEnd; Vector2 dustVelocity = dustSpawnPos - dustLineEnd; - Color dustColor = Main.hslToRgb(Main.rgbToHsl(nightAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(circleDustSpawned * 7.08f)))).X, 1f, 0.5f); + Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? new Color(100, 200, 250) : new Color(255, 200, Math.Abs(Math.Abs(blue) - (int)(circleDustSpawned * 7.08f)))).X, 1f, 0.5f); dustColor.A = 255; int dust = Dust.NewDust(dustSpawnPos + dustVelocity, 0, 0, DustID.RainbowMk2, dustVelocity.X, dustVelocity.Y, 0, dustColor, 1.4f); Main.dust[dust].noGravity = true; @@ -1686,12 +1713,12 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - float timeLeft = nightAI ? (float)(getFuckedAI ? gfbCrystalTime : nightCrystalTime) : 0f; + float timeLeft = fullPowerAI ? (float)(getFuckedAI ? gfbCrystalTime : enragedCrystalTime) : 0f; Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); } } - if (NPC.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightAI) + if (NPC.ai[1] >= crystalPhaseTime + enragedCrystalTime || !fullPowerAI) { AIState = (int)Phase.PhaseChange; NPC.TargetClosest(); @@ -1704,7 +1731,7 @@ namespace CalamityMod.NPCs.Providence Vector2 dustPosOffset = new Vector2(27f, 59f); - float rotation = (nightAI ? 445f : 460f) + (guardianAmt * 5); + float rotation = (fullPowerAI ? 445f : 460f) + (guardianAmt * 5); NPC.ai[2] += 1f; if (NPC.ai[2] < 120f) @@ -1755,7 +1782,7 @@ namespace CalamityMod.NPCs.Providence if (revenge) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); - if (nightAI && lifeRatio < 0.5f) + if (fullPowerAI && lifeRatio < 0.5f) { rotation *= 0.33f; velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); @@ -1798,7 +1825,7 @@ namespace CalamityMod.NPCs.Providence // Play an animation sound immediately. Also delete various projectiles. if (DeathAnimationTimer == 1f) { - if (Main.netMode != NetmodeID.Server && Main.LocalPlayer.WithinRange(NPC.Center, 4800f)) + if (!Main.dedServ && Main.LocalPlayer.WithinRange(NPC.Center, 4800f)) SoundEngine.PlaySound(DeathAnimationSound with { Volume = 1.65f }); DespawnSpecificProjectiles(); @@ -1873,7 +1900,7 @@ namespace CalamityMod.NPCs.Providence } // Do periodic syncs. - if (Main.netMode == NetmodeID.Server && DeathAnimationTimer % 45f == 44f) + if (Main.dedServ && DeathAnimationTimer % 45f == 44f) { NPC.netUpdate = true; @@ -1902,12 +1929,12 @@ namespace CalamityMod.NPCs.Providence float distanceToTarget = Vector2.Distance(Main.player[NPC.target].Center, NPC.Center); float aiTimer = NPC.ai[3]; - // This bool is only relevant for non-Zenith night AI - bool nightTime = NPC.localAI[1] == (float)BossMode.Night; + // This bool is only relevant for non-Zenith enraged AI + bool fullPower = NPC.localAI[1] == (float)BossMode.Enraged; float baseDistance = 2800f; - float shorterFlameCocoonDistance = (CalamityWorld.death || nightTime) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; - float shorterSpearCocoonDistance = (CalamityWorld.death || nightTime) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f; + float shorterFlameCocoonDistance = (CalamityWorld.death || fullPower) ? 600f : CalamityWorld.revenge ? 400f : Main.expertMode ? 200f : 0f; + float shorterSpearCocoonDistance = (CalamityWorld.death || fullPower) ? 1000f : CalamityWorld.revenge ? 650f : Main.expertMode ? 300f : 0f; float shorterDistance = AIState == (int)Phase.FlameCocoon ? shorterFlameCocoonDistance : shorterSpearCocoonDistance; bool guardianAlive = false; @@ -1947,7 +1974,7 @@ namespace CalamityMod.NPCs.Providence return Utils.GetLerpValue(drawFireDistanceStart, clampedDistance, distanceToTarget, true); } - private void DespawnSpecificProjectiles(bool dying = false) + private void DespawnSpecificProjectiles(bool everything = false) { for (int x = 0; x < Main.maxProjectiles; x++) { @@ -1959,7 +1986,7 @@ namespace CalamityMod.NPCs.Providence else if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) projectile.active = false; - if (dying) + if (everything) { if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || @@ -2068,13 +2095,13 @@ namespace CalamityMod.NPCs.Providence npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); - return !prov.hasTakenDaytimeDamage; - }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceNightText); + return prov.hasBeenGivenFullPower; + }, ModContent.ItemType(), 1, 4, 4, desc: DropHelper.ProvidenceEnragedText); npcLoot.AddIf(info => { Providence prov = info.npc.ModNPC(); - return !prov.hasTakenDaytimeDamage; + return prov.hasBeenGivenFullPower; }, ModContent.ItemType(), 1, 30, 40); // Normal drops: Everything that would otherwise be in the bag @@ -2129,7 +2156,7 @@ namespace CalamityMod.NPCs.Providence public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - bool offColor = NPC.localAI[1] != (float)BossMode.Day; + bool offColor = NPC.localAI[1] != (float)BossMode.Normal && (NPC.Calamity().newAI[3] >= 180f || Main.zenithWorld); Texture2D texture = offColor ? TextureNight.Value : TextureAssets.Npc[Type].Value; Texture2D textureGlow = offColor ? TextureNight_Glow.Value : Texture_Glow.Value; @@ -2146,12 +2173,11 @@ namespace CalamityMod.NPCs.Providence float spawnAnimationTime = 180f; bool spawnAnimation = NPC.Calamity().newAI[3] < spawnAnimationTime; - if (spawnAnimation) + // Bloom circle effect should only appear on spawn animation and not enrage animation, since you can't see it + // Okay it should also appear in Boss Rush as well + if (spawnAnimation && (NPC.localAI[1] == (float)BossMode.Normal || BossRushEvent.BossRushActive)) { Asset orbTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); - - Asset flareTex = ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlast"); - float sc = CalamityUtils.CircInEasing((float)NPC.Calamity().newAI[3] / (float)spawnAnimationTime, 1); for (int i = 0; i < 3; i++) @@ -2241,7 +2267,7 @@ namespace CalamityMod.NPCs.Providence // Draw the glowmask textures + their afterimages // These are the colors at their strongest point. It'll shift towards white by the brightness value used earlier. - Color WingColor = ProvUtils.GetProjectileColor(0); // Default to day + Color WingColor = ProvUtils.GetProjectileColor(0); // Default to normal Color CrystalColor = Color.Violet; if (NPC.localAI[1] == (float)BossMode.Rainbow) @@ -2274,7 +2300,7 @@ namespace CalamityMod.NPCs.Providence CrystalColor = Color.BlueViolet; } } - else if (NPC.localAI[1] == (float)BossMode.Night) + else if (NPC.localAI[1] == (float)BossMode.Enraged && !spawnAnimation) { WingColor = Color.Cyan; CrystalColor = Color.BlueViolet; @@ -2572,19 +2598,6 @@ namespace CalamityMod.NPCs.Providence public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) { - if (!hasTakenDaytimeDamage) - { - if (NPC.localAI[1] == (float)BossMode.Day) - { - hasTakenDaytimeDamage = true; - - if (Main.netMode != NetmodeID.SinglePlayer) - { - ProvidenceDyeConditionSyncPacket.Send(this); - } - } - } - if (challenge) { List exceptionList = new List() @@ -2624,19 +2637,6 @@ namespace CalamityMod.NPCs.Providence public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) { - if (!hasTakenDaytimeDamage) - { - if (NPC.localAI[1] == (float)BossMode.Day) - { - hasTakenDaytimeDamage = true; - - if (Main.netMode != NetmodeID.SinglePlayer) - { - ProvidenceDyeConditionSyncPacket.Send(this); - } - } - } - if (challenge) { challenge = false; @@ -2668,7 +2668,7 @@ namespace CalamityMod.NPCs.Providence if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread * Main.rand.NextFloat(), Mod.Find("Providence").Type, NPC.scale); @@ -2726,6 +2726,8 @@ namespace CalamityMod.NPCs.Providence if (npc.type == ModContent.NPCType() && !BossRushEvent.BossRushActive) { Main.item[itemIndex].GetGlobalItem().HolyFlame = 2f; + if ((npc.ModNPC as Providence).hasBeenGivenFullPower) + Main.item[itemIndex].GetGlobalItem().ProviWasEnraged = true; } else { @@ -2737,6 +2739,7 @@ namespace CalamityMod.NPCs.Providence public float HolyFlame = 0f; public float FlameTimer = 0f; + public bool ProviWasEnraged = false; public override void Update(Item item, ref float gravity, ref float maxFallSpeed) { @@ -2775,7 +2778,7 @@ namespace CalamityMod.NPCs.Providence Color alph = new Color(255f * (HolyFlame / 2f), 255f * (HolyFlame / 2f), 0f, 0f); Color alph2 = new Color(155f * (HolyFlame / 2f), 0f, 0f, 0f); - if (!Main.dayTime) + if (ProviWasEnraged) { lColor.B = 255; @@ -2812,11 +2815,11 @@ namespace CalamityMod.NPCs.Providence // These will be used for almost every single one of her projectiles, so it's useful to have. public static class ProvUtils { - public static bool DayAI() => (Main.IsItDay() || Main.remixWorld) && !Main.zenithWorld && !BossRushEvent.BossRushActive; + public static bool StandardAI() => (CalamityGlobalNPC.holyBoss == -1 || !Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) && !Main.zenithWorld && !BossRushEvent.BossRushActive; - // Simplified to day/night only. For PSC and Profaned Guardians - public static Color GetDayNightColor(int Alpha, bool Outline = false) => GetDayNightColor(!Main.IsItDay() && !Main.remixWorld, Alpha, Outline); - public static Color GetDayNightColor(bool Night, int Alpha, bool Outline = false) + // Simplified to day/night only. For PSC + public static Color GetColorBasedOnEnrage(int Alpha, bool Outline = false) => GetColorBasedOnEnrage(!Main.IsItDay() && !Main.remixWorld, Alpha, Outline); + public static Color GetColorBasedOnEnrage(bool Night, int Alpha, bool Outline = false) { Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day @@ -2841,7 +2844,10 @@ namespace CalamityMod.NPCs.Providence alpha = 100; } - Color FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); // Default to day + Color FinalColor = new Color(255, Outline ? 0 : 255, Outline ? 0 : 255, alpha); // Default to normal + // Color changing should only occur with Providence's projectiles + if (CalamityGlobalNPC.holyBoss == -1) + return FinalColor; if (Main.zenithWorld) { @@ -2858,7 +2864,7 @@ namespace CalamityMod.NPCs.Providence else // Red FinalColor = new Color(250, 100, Outline ? 200 : 100, alpha); } - else if (!DayAI()) + else if (!StandardAI()) FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, alpha); if (Outline) @@ -2869,7 +2875,10 @@ namespace CalamityMod.NPCs.Providence public static Color GetProjectileColor(int Alpha, bool Outline = false) { - Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to day + Color FinalColor = new Color(255, Outline ? 0 : 155, Outline ? 0 : 25, Alpha); // Default to normal + // Color changing should only occur with Providence's projectiles + if (CalamityGlobalNPC.holyBoss == -1) + return FinalColor; if (Main.zenithWorld) { @@ -2886,7 +2895,7 @@ namespace CalamityMod.NPCs.Providence else // Red FinalColor = new Color(250, 100, Outline ? 200 : 100, Alpha); } - else if (!DayAI()) + else if (!StandardAI()) FinalColor = new Color(100, Outline ? 250 : 200, Outline ? 200 : 250, Alpha); if (Outline) @@ -2895,10 +2904,10 @@ namespace CalamityMod.NPCs.Providence return FinalColor; } - // Assign the night bool to turn it into a binary day/night state without accounting for GFB + // Assign the night bool to turn it into a binary day/night state without accounting for GFB, used for PSC public static int GetDustID(bool? Night = null) { - int DustType = (int)CalamityDusts.ProfanedFire; // Default to day + int DustType = (int)CalamityDusts.ProfanedFire; // Default to normal if (Night.HasValue) { @@ -2920,7 +2929,7 @@ namespace CalamityMod.NPCs.Providence else // Red DustType = DustID.RedTorch; } - else if (!DayAI()) + else if (!StandardAI()) DustType = (int)CalamityDusts.Nightwither; return DustType; diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 55c78cf3b1..ecdd062587 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -229,7 +229,7 @@ namespace CalamityMod.NPCs.Ravager NPC.dontTakeDamage = true; if (bossRush) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.Ravager else { NPC.dontTakeDamage = false; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && revenge) Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); @@ -666,7 +666,7 @@ namespace CalamityMod.NPCs.Ravager Main.dust[stompDust].velocity *= 0.2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int stompGore = Gore.NewGore(NPC.GetSource_FromAI(), new Vector2(stompDustArea - 30, NPC.position.Y + NPC.height - 12f), default, Main.rand.Next(61, 64), 1f); Main.gore[stompGore].velocity *= 0.4f; @@ -925,7 +925,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerBody").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerBody2").Type, 1f); diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 924729ad72..d891497c47 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; @@ -309,7 +310,16 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240, true); + { + if (DownedBossSystem.downedProvidence) + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + else + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + } } public override void HitEffect(NPC.HitInfo hit) @@ -325,7 +335,7 @@ namespace CalamityMod.NPCs.Ravager } else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawLeft").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawLeft2").Type, 1f); diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index d6dfb0b0df..731b46802d 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; @@ -310,7 +311,16 @@ namespace CalamityMod.NPCs.Ravager public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240, true); + { + if (DownedBossSystem.downedProvidence) + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + else + { + target.AddBuff(ModContent.BuffType(), 240, true); + } + } } public override void HitEffect(NPC.HitInfo hit) @@ -326,7 +336,7 @@ namespace CalamityMod.NPCs.Ravager } else { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawRight").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerClawRight2").Type, 1f); diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index 376ffdb2d5..f33e45eb6e 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -198,7 +198,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerHead").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerHead2").Type, 1f); diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index f344ab45ce..14e5723fe7 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -81,7 +81,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegLeft").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegLeft2").Type, 1f); diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 31aed5da5b..b3be683e4a 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -83,7 +83,7 @@ namespace CalamityMod.NPCs.Ravager } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegRight").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ScavengerLegRight2").Type, 1f); diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index 547b6ffe4a..4170c15cf3 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -178,7 +178,7 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rockDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float y = NPC.height / 6f; float randomVelocityScale = 0.25f; diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index 2e21538a8d..dc5150c594 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; @@ -179,6 +180,14 @@ namespace CalamityMod.NPCs.Signus return NPC.alpha == 0; } + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 180); + } + public override void HitEffect(NPC.HitInfo hit) { if (NPC.life <= 0) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 764e71dba2..344b2dbdec 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -392,21 +392,21 @@ namespace CalamityMod.NPCs.Signus SoundEngine.PlaySound(SoundID.Item122, NPC.Center); int cosmicMineSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 750f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn, 0f, 0f, 0f, 0, 0, 0); int cosmicMineSpawn2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 750f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn2, 0f, 0f, 0f, 0, 0, 0); if (stealthTimer >= maxStealth) { int stealthCosmicMine = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + 950f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine, 0f, 0f, 0f, 0, 0, 0); int stealthCosmicMine2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - 950f), (int)player.position.Y, ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine2, 0f, 0f, 0f, 0, 0, 0); SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); @@ -590,21 +590,21 @@ namespace CalamityMod.NPCs.Signus type = ModContent.NPCType(); } int cosmicMineSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX), (int)(player.position.Y + spawnY), type); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn, 0f, 0f, 0f, 0, 0, 0); int cosmicMineSpawn2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX), (int)(player.position.Y + spawnY), type); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, cosmicMineSpawn2, 0f, 0f, 0f, 0, 0, 0); if (buffed) { int stealthCosmicMine = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X + spawnX + spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine, 0f, 0f, 0f, 0, 0, 0); int stealthCosmicMine2 = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(player.position.X - spawnX - spawnX / 2), (int)(player.position.Y + spawnY), ModContent.NPCType()); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, stealthCosmicMine2, 0f, 0f, 0f, 0, 0, 0); } @@ -1019,7 +1019,7 @@ namespace CalamityMod.NPCs.Signus teleportDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 2f); Main.dust[teleportDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { float randomSpread = Main.rand.Next(-200, 201) / 100f; Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find("Signus").Type, 1f); diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 313f3ef9b4..a91575514b 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -795,7 +795,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index a0a6ddea2b..47c4f0e1cf 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -498,7 +498,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn); } } diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index ecdcd2f6f5..0de260db20 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -743,7 +743,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 6429f58f7f..727a4065b5 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -787,7 +787,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.npc[slimeSpawn].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeSpawn].ai[0] = (float)(-1000 * Main.rand.Next(3)); Main.npc[slimeSpawn].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawn < Main.maxNPCs) + if (Main.dedServ && slimeSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawn, 0f, 0f, 0f, 0, 0, 0); } } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 409b7a4294..90e0b51f13 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -124,7 +124,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorBody1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorBody2").Type, NPC.scale); @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeBody1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeBody2").Type, NPC.scale); diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index a3e45d207f..1d4f47cbf9 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorHead1").Type, NPC.scale); SoundEngine.PlaySound(ArmorShedSound, NPC.Center); @@ -370,7 +370,7 @@ namespace CalamityMod.NPCs.StormWeaver if (phase3 && !useTornadoes) { // Let it snow while able to use the frost wave attack - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 scaledSize = Main.Camera.ScaledSize; Vector2 scaledPosition = Main.Camera.ScaledPosition; @@ -448,7 +448,7 @@ namespace CalamityMod.NPCs.StormWeaver // Lightning strike if (!Main.DisableIntenseVisualEffects) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (lightningSpeed == 0f) { @@ -792,7 +792,7 @@ namespace CalamityMod.NPCs.StormWeaver if (phase4) { // Adjust lightning flash variables when in phase 3 - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (lightningSpeed > 0f) { @@ -902,7 +902,7 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeHead1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeHead2").Type, NPC.scale); diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index d2bb8f811a..13bc6f7fc9 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorTail1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, NPC.velocity, Mod.Find("SWArmorTail2").Type, NPC.scale); @@ -328,7 +328,7 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeTail1").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SWNudeTail2").Type, NPC.scale); diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index bcbe51c764..2c4804bbdd 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -237,7 +237,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AnthozoanCrabGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AnthozoanCrabGore2").Type, NPC.scale); diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index 32373edccd..be52ddff23 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -165,7 +165,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AquaticUrchin").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("AquaticUrchin2").Type, 1f); diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 8a8a865748..4034dc9a41 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -119,7 +119,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.SulphurousSeaAcid, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BelchingCoralGore").Type, NPC.scale); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BelchingCoralGore2").Type, NPC.scale); diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 2220541c8f..4c7bda3af5 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -188,7 +188,7 @@ namespace CalamityMod.NPCs.SulphurousSea for (int k = 0; k < 15; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Gnasher").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Gnasher2").Type, 1f); diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index 8caf72e232..fcf3f4e3d8 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -166,7 +166,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Sulflounder").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Sulflounder2").Type, 1f); diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index 10f1f085e9..70e1136ec5 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -127,7 +127,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Toxicatfish").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Toxicatfish2").Type, 1f); diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index d289e3d104..ff89752344 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -382,7 +382,7 @@ namespace CalamityMod.NPCs.SulphurousSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Trasher").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Trasher2").Type, 1f); diff --git a/NPCs/SunkenSea/BlindedAngler.cs b/NPCs/SunkenSea/BlindedAngler.cs index 3bf3fb1d27..208e5043c2 100644 --- a/NPCs/SunkenSea/BlindedAngler.cs +++ b/NPCs/SunkenSea/BlindedAngler.cs @@ -141,7 +141,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("BlindAnglerGore2").Type, 1f); diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index f1215cedbe..de57dfa6b1 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Clam2").Type, 1f); diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index d220440e7f..48e4ebabed 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -228,7 +228,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("RayGore2").Type, 1f); diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 0275eb3ed0..0f3fb7b17c 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -136,7 +136,7 @@ namespace CalamityMod.NPCs.SunkenSea if (hitAmount == 5) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[NPC.target].dead && Main.player[NPC.target].active) player.AddBuff(ModContent.BuffType(), 2); //CLAM INVASION @@ -276,7 +276,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.noGravity = false; attack = -1; SoundEngine.PlaySound(SlamSound, NPC.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int stompDustArea = (int)NPC.position.X - 30; stompDustArea < (int)NPC.position.X + NPC.width + 60; stompDustArea += 30) { @@ -375,27 +375,13 @@ namespace CalamityMod.NPCs.SunkenSea SoundEngine.PlaySound(SoundID.Item67, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 clamPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(NPC.velocity.X, NPC.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; int projectileShot = ModContent.ProjectileType(); int damage = Main.masterMode ? 23 : Main.expertMode ? 28 : 35; - float speed = 5f; - Vector2 vector = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); - float targetXDist = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - vector.X + (float)Main.rand.Next(-20, 21); - float targetYDist = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - vector.Y + (float)Main.rand.Next(-20, 21); - float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - targetDistance = speed / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, targetXDist, targetYDist, projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - for (int i = 0; i < 4; i++) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, NPC.SafeDirectionTo(Main.player[NPC.target].Center) * 5f, projectileShot, damage, 0f, Main.myPlayer); + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(NPC.GetSource_FromAI(), clamPosition.X, clamPosition.Y, (float)(Math.Sin(offsetAngle) * 3f), (float)(Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), clamPosition.X, clamPosition.Y, (float)(-Math.Sin(offsetAngle) * 3f), (float)(-Math.Cos(offsetAngle) * 3f), projectileShot, damage, 0f, Main.myPlayer, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 3f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, projectileShot, damage, 0f, Main.myPlayer); } } attack = -1; @@ -503,7 +489,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Obsidian, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantClam1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("GiantClam2").Type, 1f); diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs index 57434671d4..dca664de84 100644 --- a/NPCs/SunkenSea/HauntedChum.cs +++ b/NPCs/SunkenSea/HauntedChum.cs @@ -223,13 +223,13 @@ namespace CalamityMod.NPCs.SunkenSea { VerletSimulatedSegment v = Segments[i]; int goreType = i < Segments.Count / 2 ? Mod.Find("ChumBone2").Type : Mod.Find("ChumBone1").Type; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGorePerfect(NPC.GetSource_Death(), v.position, new Vector2(Main.rand.NextFloat(-2, 2), -6), goreType); } } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChum").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("HauntedChumMouth").Type, 1f); diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index 1e643cb782..1c73fd7386 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -185,7 +185,7 @@ namespace CalamityMod.NPCs.SunkenSea } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismTurtleGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("PrismTurtleGore2").Type, 1f); diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs index 46ec02e744..21e1ca1d13 100644 --- a/NPCs/SunkenSea/SandProwler.cs +++ b/NPCs/SunkenSea/SandProwler.cs @@ -573,7 +573,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaSerpentGore1").Type, 1f); } diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs index bcee5bc704..9fee057a61 100644 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -461,7 +461,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); } - if (NPC.life <= 0 && Main.netMode != NetmodeID.Server) + if (NPC.life <= 0 && !Main.dedServ) { for (int k = 0; k < 10; k++) { diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index 5446f78115..c4e8a83563 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -159,7 +159,7 @@ namespace CalamityMod.NPCs.SunkenSea { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore1").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SeaFloatyGore2").Type, 1f); diff --git a/NPCs/SupremeCalamitas/BrimstoneHeart.cs b/NPCs/SupremeCalamitas/BrimstoneHeart.cs index 1939c891d7..74feec36d7 100644 --- a/NPCs/SupremeCalamitas/BrimstoneHeart.cs +++ b/NPCs/SupremeCalamitas/BrimstoneHeart.cs @@ -139,7 +139,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 2; i++) { diff --git a/NPCs/SupremeCalamitas/SepulcherArm.cs b/NPCs/SupremeCalamitas/SepulcherArm.cs index e68ca7c25f..ecc059ac8c 100644 --- a/NPCs/SupremeCalamitas/SepulcherArm.cs +++ b/NPCs/SupremeCalamitas/SepulcherArm.cs @@ -207,7 +207,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 forearmGoreSpawnPosition = Limbs[0].Center + Main.rand.NextVector2Circular(6f, 6f); Vector2 armGoreSpawnPosition = Limbs[1].Center + Main.rand.NextVector2Circular(6f, 6f); diff --git a/NPCs/SupremeCalamitas/SepulcherBody.cs b/NPCs/SupremeCalamitas/SepulcherBody.cs index 6778daf3d9..9531e78aea 100644 --- a/NPCs/SupremeCalamitas/SepulcherBody.cs +++ b/NPCs/SupremeCalamitas/SepulcherBody.cs @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int variant = (int)(NPC.localAI[3] / 2f % 2f); if (variant == 0) diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 4be779a2fb..6041b0b4e5 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -170,7 +170,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } TailSpawned = true; } - if (!NPC.active && Main.netMode == NetmodeID.Server) + if (!NPC.active && Main.dedServ) { NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, NPC.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -397,7 +397,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 3; i++) { diff --git a/NPCs/SupremeCalamitas/SepulcherTail.cs b/NPCs/SupremeCalamitas/SepulcherTail.cs index ea920d025f..21189ba860 100644 --- a/NPCs/SupremeCalamitas/SepulcherTail.cs +++ b/NPCs/SupremeCalamitas/SepulcherTail.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 2; i++) { diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 2bf50c9b9c..ce3a029a3b 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -252,7 +252,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.dust[brimDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 1; i <= 5; i++) Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find($"SupremeSoulSeeker_Gore{i}").Type, NPC.scale); diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 5684ebbbbc..07ed357e60 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -668,7 +668,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.tile[i + xoffset, j + yoffset].TileType = (ushort)ModContent.TileType(); Main.tile[i + xoffset, j + yoffset].Get().HasTile = true; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i + xoffset, j + yoffset, 1, TileChangeType.None); } diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index f8837a9a2a..0a62a3a2f0 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -181,7 +181,7 @@ namespace CalamityMod.NPCs.TownNPCs npc.ai[0] = phase; npc.ai[1] = 0; npc.netUpdate = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index); } @@ -194,7 +194,7 @@ namespace CalamityMod.NPCs.TownNPCs npc.ai[3] = solutionType; npc.netUpdate = true; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, index); } diff --git a/NPCs/TownNPCs/FAP.cs b/NPCs/TownNPCs/FAP.cs index b7a01b79ce..16aa1dc6aa 100644 --- a/NPCs/TownNPCs/FAP.cs +++ b/NPCs/TownNPCs/FAP.cs @@ -913,6 +913,7 @@ namespace CalamityMod.NPCs.TownNPCs .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnoughToSellPylons, Condition.InHallow) .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) + .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) .Register(); } diff --git a/NPCs/TownNPCs/SEAHOE.cs b/NPCs/TownNPCs/SEAHOE.cs index 7ad7960bd0..b715421059 100644 --- a/NPCs/TownNPCs/SEAHOE.cs +++ b/NPCs/TownNPCs/SEAHOE.cs @@ -219,7 +219,7 @@ namespace CalamityMod.NPCs.TownNPCs { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Amidias").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Amidias2").Type, 1f); diff --git a/NPCs/TownNPCs/THIEF.cs b/NPCs/TownNPCs/THIEF.cs index 8d3fbe9b86..c5c7be082b 100644 --- a/NPCs/TownNPCs/THIEF.cs +++ b/NPCs/TownNPCs/THIEF.cs @@ -329,7 +329,7 @@ namespace CalamityMod.NPCs.TownNPCs { if (NPC.life <= 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bandit").Type, 1f); Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("Bandit2").Type, 1f); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index b6c8b3d42f..0643e0861c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -100,7 +100,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } } @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[2] = 1f; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 392, 1f); Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 393, 1f); @@ -316,7 +316,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (CalamityWorld.LegendaryMode) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) Main.player[Main.myPlayer].AddBuff(BuffID.Confused, 90); @@ -1102,7 +1102,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index b36f788adb..ae5187bf7a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -302,7 +302,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // If for any reason this segment was deleted, send info to clients so they also see it die. - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!npc.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); } @@ -563,13 +563,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[segmentAmt].active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0); segmentAmt = attachedSegments; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } targetPosX = 0f; @@ -760,7 +760,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Manually sync newAI because there is no GlobalNPC.SendExtraAI - if (npc.active && npc.netUpdate && Main.netMode == NetmodeID.Server) + if (npc.active && npc.netUpdate && Main.dedServ) { SyncCalamityNPCAIArrayPacket.Send(npc); } @@ -936,7 +936,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.alpha = 0; } - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!npc.active && Main.dedServ) NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); } @@ -1143,13 +1143,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int num76 = (int)Main.npc[num75].ai[0]; Main.npc[num75].active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num75); num75 = num76; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index 48bc5cedc5..a0cf1d426f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -196,7 +196,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, enrageScale); Main.npc[eye].velocity = servantSpawnVelocity; - if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + if (Main.dedServ && eye < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); } else @@ -361,7 +361,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X; Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y; - if (Main.netMode == NetmodeID.Server && servantSpawn < Main.maxNPCs) + if (Main.dedServ && servantSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, servantSpawn); if (CalamityWorld.LegendaryMode) @@ -397,7 +397,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int phase2Gore = 0; phase2Gore < 2; phase2Gore++) { @@ -818,7 +818,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[eye].velocity.X = servantSpawnVelocity.X; Main.npc[eye].velocity.Y = servantSpawnVelocity.Y; - if (Main.netMode == NetmodeID.Server && eye < Main.maxNPCs) + if (Main.dedServ && eye < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); } else if (!CalamityWorld.LegendaryMode) @@ -1165,7 +1165,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int num22 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu); Main.npc[num22].velocity.X = vector3.X; Main.npc[num22].velocity.Y = vector3.Y; - if (Main.netMode == NetmodeID.Server && num22 < Main.maxNPCs) + if (Main.dedServ && num22 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num22); } @@ -1336,7 +1336,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int num34 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y, NPCID.ServantofCthulhu); Main.npc[num34].velocity.X = vector7.X; Main.npc[num34].velocity.Y = vector7.Y; - if (Main.netMode == NetmodeID.Server && num34 < Main.maxNPCs) + if (Main.dedServ && num34 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index 01ee2f4371..8b1d9bdf75 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -108,7 +108,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } @@ -488,7 +488,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Dust dust = Main.dust[fallDust]; dust.velocity *= 0.2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int fallGore = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(i - 20, npc.position.Y + npc.height - 8f), default, Main.rand.Next(61, 64), 1f); Gore gore = Main.gore[fallGore]; @@ -863,7 +863,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } @@ -1625,7 +1625,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } @@ -1997,7 +1997,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.tile[j, k].TileType == TileID.Torches) { Main.tile[j, k].Get().HasTile = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, j, k); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index dca7c85d7d..09256643a4 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -313,7 +313,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[0] >= 60f) teleported = true; - if (npc.ai[0] == 60f && Main.netMode != NetmodeID.Server) + if (npc.ai[0] == 60f && !Main.dedServ) Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -(float)npc.height / 2), npc.velocity, 734, 1f); if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) @@ -639,7 +639,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[slimeSpawns].ai[0] = -1000 * Main.rand.Next(3); Main.npc[slimeSpawns].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeSpawns < Main.maxNPCs) + if (Main.dedServ && slimeSpawns < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeSpawns); } } @@ -1001,7 +1001,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[num260].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num260].ai[0] = -1000 * Main.rand.Next(3); Main.npc[num260].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num260 < Main.maxNPCs) + if (Main.dedServ && num260 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num260); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index a00ffc39e3..cd9481844a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -522,7 +522,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); NPC.LunarApocalypseIsUp = false; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.WorldData, -1, -1, null, 0, 0f, 0f, 0f, 0, 0, 0); return false; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index 5d51bbce89..f849a006f7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -84,7 +84,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } } @@ -782,7 +782,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn gore if (npc.localAI[2] == 0f) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + Main.rand.Next(npc.width), npc.position.Y + Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index a2504b6643..34b383757a 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -923,7 +923,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); npc.netSpam = 5; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 8a18971df1..ef5b7d0e3c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -900,7 +900,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[slimeScale2].velocity.Y = Main.rand.Next(-30, 1) * 0.1f; Main.npc[slimeScale2].ai[0] = -500 * Main.rand.Next(3); Main.npc[slimeScale2].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && slimeScale2 < Main.maxNPCs) + if (Main.dedServ && slimeScale2 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, slimeScale2); return false; @@ -1634,7 +1634,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[num33].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; Main.npc[num33].ai[0] = -500 * Main.rand.Next(3); Main.npc[num33].ai[1] = 0f; - if (Main.netMode == NetmodeID.Server && num33 < Main.maxNPCs) + if (Main.dedServ && num33 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num33); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index bb78f459cf..a26d087d4d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -157,38 +157,38 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Hand variables bool handsDead = numHandsAlive == 0; int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; - float spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : 60); + float spread = Main.getGoodWorld ? 180 : 60; float headSpinVelocityMult = bossRush ? (phase3 ? 18f : 9f) : (phase3 ? 12f : 4.5f); switch (numHandsAlive) { case 0: numProj = Main.getGoodWorld ? 36 : death ? 9 : 7; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 180 : death ? 90 : 82); + spread = Main.getGoodWorld ? 180 : death ? 90 : 82; headSpinVelocityMult = bossRush ? (phase3 ? 18f : 12f) : (phase3 ? 12f : 6f); break; case 1: numProj = Main.getGoodWorld ? 27 : death ? 7 : 5; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 150 : death ? 76 : 68); + spread = Main.getGoodWorld ? 150 : death ? 76 : 68; headSpinVelocityMult = bossRush ? (phase3 ? 15f : 10f) : (phase3 ? 11.5f : 5f); break; case 2: numProj = Main.getGoodWorld ? 18 : death ? 6 : 4; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 140 : death ? 70 : 62); + spread = Main.getGoodWorld ? 140 : death ? 70 : 62; headSpinVelocityMult = bossRush ? (phase3 ? 13.5f : 9f) : (phase3 ? 11f : 4.5f); break; case 3: numProj = Main.getGoodWorld ? 15 : death ? 5 : 3; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 130 : death ? 64 : 56); + spread = Main.getGoodWorld ? 130 : death ? 64 : 56; headSpinVelocityMult = bossRush ? (phase3 ? 12f : 8f) : (phase3 ? 10.5f : 4f); break; case 4: numProj = Main.getGoodWorld ? 12 : death ? 4 : 3; - spread = MathHelper.ToRadians(Main.getGoodWorld ? 120 : 56); + spread = Main.getGoodWorld ? 120 : 56; headSpinVelocityMult = bossRush ? (phase3 ? 10f : 7f) : (phase3 ? 10f : 3.5f); break; } @@ -241,42 +241,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (Main.netMode != NetmodeID.MultiplayerClient) { - float skullSpeed = death ? 6f : 5f; int type = ProjectileID.Skull; int damage = npc.GetProjectileDamage(type); - float boltTargetXDist = Main.player[npc.target].Center.X - npc.Center.X; - float boltTargetYDist = Main.player[npc.target].Center.Y - npc.Center.Y; - float boltTargetDistance = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); - - boltTargetDistance = skullSpeed / boltTargetDistance; - boltTargetXDist *= boltTargetDistance; - boltTargetYDist *= boltTargetDistance; - Vector2 center = npc.Center; - center.X += boltTargetXDist * 5f; - center.Y += boltTargetYDist * 5f; - - float baseSpeed = (float)Math.Sqrt(boltTargetXDist * boltTargetXDist + boltTargetYDist * boltTargetYDist); - double startAngle = Math.Atan2(boltTargetXDist, boltTargetYDist) - spread / 2; - double deltaAngle = spread / numProj; - double offsetAngle; - // Inverse parabolic projectile spreads - bool evenNumberOfProjectiles = numProj % 2 == 0; - int centralProjectile = evenNumberOfProjectiles ? numProj / 2 : (numProj - 1) / 2; - int otherCentralProjectile = evenNumberOfProjectiles ? centralProjectile - 1 : -1; - float centralScalingAmount = (float)Math.Floor(numProj / (double)centralProjectile) * 0.75f; - float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; - float originalBaseSpeed = baseSpeed; - float minVelocityMultiplier = 0.5f; + Vector2 baseVel = npc.SafeDirectionTo(Main.player[npc.target].Center) * (death ? 6f : 5f); + Vector2 firingPos = npc.Center + baseVel * 5f; + float centralCount = 0.5f * (numProj - 1f); for (int i = 0; i < numProj; i++) { - float velocityScalar = (evenNumberOfProjectiles && (i == centralProjectile || i == otherCentralProjectile)) ? minVelocityMultiplier : MathHelper.Lerp(minVelocityMultiplier, centralScalingAmount, Math.Abs((i + amountToAdd) - centralProjectile) / (float)centralProjectile); - baseSpeed = originalBaseSpeed; - baseSpeed *= velocityScalar; - offsetAngle = startAngle + deltaAngle * i; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), center.X, center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), type, damage, 0f, Main.myPlayer, -2f); - Main.projectile[proj].timeLeft = 600; + float offset = MathHelper.ToRadians(MathHelper.Lerp(-spread * 0.5f, spread * 0.5f, i / (numProj - 1f))); + float velocityMult = MathHelper.Lerp(0.5f, 1.5f, MathF.Abs(centralCount - i) / centralCount); + Projectile shot = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), firingPos, baseVel.RotatedBy(offset) * velocityMult, type, damage, 0f, Main.myPlayer, -2f); + shot.timeLeft = 600; } npc.netUpdate = true; @@ -587,7 +564,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) { int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + if (Main.dedServ && headXAcceleration < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; @@ -611,7 +588,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) { int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DiabolistWhite); - if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + if (Main.dedServ && headXAcceleration < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; @@ -688,7 +665,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!WorldGen.SolidTile(headYAcceleration, headYTopSpeed)) { int headXAcceleration = NPC.NewNPC(npc.GetSource_FromAI(), headYAcceleration * 16 + 8, headYTopSpeed * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && headXAcceleration < Main.maxNPCs) + if (Main.dedServ && headXAcceleration < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, headXAcceleration); break; @@ -907,7 +884,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1423,7 +1400,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!WorldGen.SolidTile(num169, num170)) { int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DarkCaster); - if (Main.netMode == NetmodeID.Server && num171 < Main.maxNPCs) + if (Main.dedServ && num171 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); break; @@ -1560,7 +1537,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index f98bc6c82d..ba1f02cef6 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -198,14 +198,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[destroyer].localAI[3] = 1f; Main.npc[destroyer].SyncVanillaLocalAI(); string typeName = Main.npc[destroyer].TypeName; - if (Main.netMode == NetmodeID.Server && destroyer < Main.maxNPCs) + if (Main.dedServ && destroyer < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, destroyer); AchievementsHelper.CheckMechaMayhem(); if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75); - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[destroyer].GetTypeNetName()), new Color(175, 75, 255)); } } @@ -230,14 +230,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.npc[retinazer].localAI[3] = 1f; Main.npc[retinazer].SyncVanillaLocalAI(); string typeName = Main.npc[retinazer].TypeName; - if (Main.netMode == NetmodeID.Server && retinazer < Main.maxNPCs) + if (Main.dedServ && retinazer < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazer); AchievementsHelper.CheckMechaMayhem(); if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Lang.misc[48].Value, 175, 75); - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, 255)); } } @@ -839,7 +839,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1106,7 +1106,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1403,7 +1403,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -1768,7 +1768,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(0, 10.0); @@ -2385,7 +2385,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); @@ -2670,7 +2670,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); @@ -2945,7 +2945,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); @@ -3249,7 +3249,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) { npc.ai[2] += 10f; - if (npc.ai[2] > 50f || Main.netMode != NetmodeID.Server) + if (npc.ai[2] > 50f || !Main.dedServ) { npc.life = -1; npc.HitEffect(); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index 1bdc9d817e..1ba4788bab 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -414,7 +414,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { @@ -1166,7 +1166,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 2; i++) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 26f7112402..94cc034852 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -69,7 +69,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!WorldGen.SolidTile(targetTileX, targetTileY)) { int impSpawn = NPC.NewNPC(npc.GetSource_FromAI(), targetTileX * 16 + 8, targetTileY * 16, NPCID.FireImp); - if (Main.netMode == NetmodeID.Server && impSpawn < Main.maxNPCs) + if (Main.dedServ && impSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, impSpawn); break; @@ -944,7 +944,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!WorldGen.SolidTile(num353, num354)) { int num355 = NPC.NewNPC(npc.GetSource_FromAI(), num353 * 16 + 8, num354 * 16, 24); - if (Main.netMode == NetmodeID.Server && num355 < Main.maxNPCs) + if (Main.dedServ && num355 < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num355); break; diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 7ec2bdf1e9..a050f29f7d 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -577,7 +577,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { MedusaHeadDustEffect(npc, time); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Player player = Main.player[Main.myPlayer]; if (!player.dead && player.active && player.FindBuffIndex(BuffID.Stoned) == -1) @@ -3420,7 +3420,7 @@ PrepareToShoot: if (npcType == NPCID.GoblinPeon) { WorldGen.KillTile(x, y - 1, false, false, false); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.TileManipulation, -1, -1, null, 0, (float)x, (float)(y - 1), 0f, 0, 0, 0); } @@ -3435,7 +3435,7 @@ PrepareToShoot: npc.ai[3] = (float)aiGateValue; npc.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenDoor) + if (Main.dedServ & canOpenDoor) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 0, (float)x, (float)(y - 1), (float)npc.direction, 0, 0, 0); } @@ -3448,7 +3448,7 @@ PrepareToShoot: npc.ai[3] = (float)aiGateValue; npc.netUpdate = true; } - if (Main.netMode == NetmodeID.Server & canOpenTallGate) + if (Main.dedServ & canOpenTallGate) { NetMessage.SendData(MessageID.ToggleDoorState, -1, -1, null, 4, (float)x, (float)(y - 1), 0f, 0, 0, 0); } @@ -4599,7 +4599,7 @@ PrepareToShoot: } } - if (!npc.active && Main.netMode == NetmodeID.Server) + if (!npc.active && Main.dedServ) { NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); } @@ -5072,13 +5072,13 @@ PrepareToShoot: int differentSegment = (int)Main.npc[q].ai[0]; Main.npc[q].active = false; npc.life = 0; - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, q, 0f, 0f, 0f, 0, 0, 0); } q = differentSegment; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); } @@ -8653,7 +8653,7 @@ PrepareToShoot: dust.noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int j = 0; j < 4; j++) { diff --git a/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs b/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs index c2ca88ae9f..42134ed1c2 100644 --- a/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs +++ b/Packets/Entities/Providence/ProvidenceDyeConditionSyncPacket.cs @@ -21,19 +21,19 @@ namespace CalamityMod.Packets var packet = Instance.CreateBasePacket(); packet.WriteWhoAmI(providence); - packet.Write(providence.hasTakenDaytimeDamage); + packet.Write(providence.hasBeenGivenFullPower); packet.Send(toClient, ignoreClient); } public override void HandlePacket(in BinaryReader packet, int sender) { var providence = packet.ReadModNPC(); - var hasTakenDaytimeDmg = packet.ReadBoolean(); + var hasBeenEnraged = packet.ReadBoolean(); if (providence is null) return; - providence.hasTakenDaytimeDamage = hasTakenDaytimeDmg; + providence.hasBeenGivenFullPower = hasBeenEnraged; } } } diff --git a/Packets/MusicSystems/MusicEventSyncRequestPacket.cs b/Packets/MusicSystems/MusicEventSyncRequestPacket.cs index f2332bba2b..44b5425f09 100644 --- a/Packets/MusicSystems/MusicEventSyncRequestPacket.cs +++ b/Packets/MusicSystems/MusicEventSyncRequestPacket.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Packets public override void HandlePacket(in BinaryReader packet, int sender) { // Only fulfill requests as the server host - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; MusicEventSyncResponsePacket.Send(toClient: sender); diff --git a/Packets/MusicSystems/MusicEventSyncResponsePacket.cs b/Packets/MusicSystems/MusicEventSyncResponsePacket.cs index 4584f78089..adf9a3751e 100644 --- a/Packets/MusicSystems/MusicEventSyncResponsePacket.cs +++ b/Packets/MusicSystems/MusicEventSyncResponsePacket.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Packets public static void Send(int toClient = -1, int ignoreClient = -1) { // Only Server should send Reponse to Clients - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; var packet = Instance.CreateBasePacket(); diff --git a/Packets/Players/CooldownAdditionPacket.cs b/Packets/Players/CooldownAdditionPacket.cs index 831a0f1c3b..a5906855a9 100644 --- a/Packets/Players/CooldownAdditionPacket.cs +++ b/Packets/Players/CooldownAdditionPacket.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Packets string id = CooldownRegistry.registry[instance.netID].ID; player.cooldowns[id] = instance; } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { // Server should NOT handle cooldown itself! // Server doesn't have information for cooldown netIDs! diff --git a/Packets/Players/CooldownRemovalPacket.cs b/Packets/Players/CooldownRemovalPacket.cs index bc65bf7636..1bcd2235f6 100644 --- a/Packets/Players/CooldownRemovalPacket.cs +++ b/Packets/Players/CooldownRemovalPacket.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Packets player.cooldowns.Remove(CooldownRegistry.registry[netID].ID); } } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { // Server should NOT handle cooldown itself! // Server doesn't have information for cooldown netIDs! diff --git a/Packets/Players/SyncCooldownDictionaryPacket.cs b/Packets/Players/SyncCooldownDictionaryPacket.cs index b03393c755..ba8cf8b74b 100644 --- a/Packets/Players/SyncCooldownDictionaryPacket.cs +++ b/Packets/Players/SyncCooldownDictionaryPacket.cs @@ -100,7 +100,7 @@ namespace CalamityMod.Packets } } } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { // Server should NOT handle cooldown itself! // Server doesn't have information for cooldown netIDs! diff --git a/Packets/TileEntities/TECanvasPaintingPacket.cs b/Packets/TileEntities/TECanvasPaintingPacket.cs new file mode 100644 index 0000000000..a7d0b36bbf --- /dev/null +++ b/Packets/TileEntities/TECanvasPaintingPacket.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.TileEntities; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria; + +namespace CalamityMod.Packets +{ + public sealed class TECanvasPaintingPacket : CalamityPacket + { + public static TECanvasPaintingPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.UpdateCanvasPainting; + + public static void Send(TECanvasPainting painting, float posX, float posY, float scale, int toClient = -1, int ignoreClient = -1) + { + if (painting is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteTileEntityID(painting); + packet.Write(posX); + packet.Write(posY); + packet.Write(scale); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var painting = packet.ReadTileEntity(); + float posX = packet.ReadSingle(); + float posY = packet.ReadSingle(); + float scale = packet.ReadSingle(); + + if (painting is null) + return; + + painting.framePosition = new Microsoft.Xna.Framework.Vector2(posX, posY); + painting.scale = scale; + + // When a server gets this packet, it immediately sends an equivalent packet to all clients. + if (Main.dedServ) + Send(painting, posX, posY, scale); + } + } +} diff --git a/Particles/AresCannonChargeParticleSet.cs b/Particles/AresCannonChargeParticleSet.cs index 5e9b00f425..057d126e6d 100644 --- a/Particles/AresCannonChargeParticleSet.cs +++ b/Particles/AresCannonChargeParticleSet.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Particles public override void Update() { // Don't perform any operations on the server. Doing so would be a waste of space as these sets are entirely based on drawcode. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; if (bloom == null) diff --git a/Particles/BaseParticleSet.cs b/Particles/BaseParticleSet.cs index 16f6432ed3..29e4ad197e 100644 --- a/Particles/BaseParticleSet.cs +++ b/Particles/BaseParticleSet.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Particles public virtual void Update() { // Don't perform any operations on the server. Doing so would be a waste of space as these sets are entirely based on drawcode. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; //Spawn new particles if time remains @@ -74,7 +74,7 @@ namespace CalamityMod.Particles public virtual void DrawSet(Vector2 basePosition) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; IEnumerable orderedParticles = Particles; diff --git a/Particles/CustomSprite.cs b/Particles/CustomSprite.cs index 1f0b1bdb66..0b18707b4d 100644 --- a/Particles/CustomSprite.cs +++ b/Particles/CustomSprite.cs @@ -5,7 +5,6 @@ using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using static CalamityMod.Projectiles.Rogue.FinalDawnFlame; namespace CalamityMod.Particles { @@ -22,6 +21,7 @@ namespace CalamityMod.Particles int Timer = 0; float maxGravity = 0f; + float Opacity = 1f; public override bool SetLifetime => true; public override bool UseCustomDraw => true; @@ -54,6 +54,7 @@ namespace CalamityMod.Particles if (Timer > Lifetime - 20) { Scale *= 0.9f; + Opacity *= 0.9f; } Velocity *= 0.85f; @@ -73,7 +74,7 @@ namespace CalamityMod.Particles Rectangle fr = tex.Frame(1, frames, 0, currentFrame); - Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, fr, Color.Lerp(Color.Transparent, Color, Scale), Rotation, new Vector2(tex.Width() * 0.5f, tex.Height() / frames * 0.5f), 1f, SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, Position - Main.screenPosition, fr, Color.Lerp(Color.Transparent, Color, Opacity), Rotation, new Vector2(tex.Width() * 0.5f, tex.Height() / frames * 0.5f), 1f, SpriteEffects.None); } } } diff --git a/Particles/DeathAshParticle.cs b/Particles/DeathAshParticle.cs index eae6742705..9d7c9e5da7 100644 --- a/Particles/DeathAshParticle.cs +++ b/Particles/DeathAshParticle.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Particles { get { - if (Main.netMode != NetmodeID.Server && basicShader is null) + if (!Main.dedServ && basicShader is null) { basicShader = new BasicEffect(Main.instance.GraphicsDevice) { @@ -88,7 +88,7 @@ namespace CalamityMod.Particles public static void CreateAshesFromNPC(NPC npc, Vector2 velocityOverride) { // Don't create ashes serverside. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; VelOverride = velocityOverride; @@ -250,7 +250,7 @@ namespace CalamityMod.Particles public static void UpdateAll() { // Don't draw ashes serverside. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; foreach (DeathAshParticle ash in Ashes) diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index d37925abd5..5edab9f428 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Particles // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. // Don't spawn particles if on the server either, or if the particles dictionary is somehow null. - if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) + if (Main.gamePaused || Main.dedServ || particles == null) return; if (particles.Count >= CalamityClientConfig.Instance.ParticleLimit && !particle.Important) @@ -100,7 +100,7 @@ namespace CalamityMod.Particles // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. // Don't spawn particles if on the server side, or if the particles dictionary is somehow null. - if (Main.gamePaused || Main.netMode == NetmodeID.Server || particles == null) + if (Main.gamePaused || Main.dedServ || particles == null) return; particlesToSpawnNextFrame.Enqueue(particle); diff --git a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs index e30fdd76b2..d6aed5d61b 100644 --- a/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMaceFlailProjectile.cs @@ -328,9 +328,10 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// /// Reserved for extra AI that is always ran regardless of state. Does nothing by default.
- /// Example cases include shooting projectiles in a similar manner to Flower Pow. + /// Example cases include shooting projectiles in a similar manner to Flower Pow.
+ /// Return false to entirely override base flail behaviour. ///
- public virtual void ExtraBehavior() { } + public virtual bool ExtraBehavior() => true; /// /// Handles simple chain drawing. Can be overridden for cases such as chains with multiple frames/variants. @@ -422,31 +423,32 @@ namespace CalamityMod.Projectiles.BaseProjectiles break; } - ExtraBehavior(); - - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); - - // Non-symmetric rotation (symmetric is just in this if condition here) - if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + if (ExtraBehavior()) { - if (Projectile.velocity.Length() > 1f) - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0f).ToDirectionInt(); + + // Non-symmetric rotation (symmetric is just in this if condition here) + if (CurrentFlailState == FlailState.Ricochet || CurrentFlailState == FlailState.Dropping) + { + if (Projectile.velocity.Length() > 1f) + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.Pi + Projectile.velocity.X * 0.1f; + else + Projectile.rotation += Projectile.velocity.X * 0.1f; + } else - Projectile.rotation += Projectile.velocity.X * 0.1f; - } - else - { - Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); - Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); - } + { + Vector2 vectorTowardsPlayer = Projectile.SafeDirectionTo(Owner.MountedCenter); + Projectile.rotation = vectorTowardsPlayer.ToRotation() + MathHelper.ToRadians(270f); + } - Projectile.timeLeft = 2; - Owner.heldProj = Projectile.whoAmI; - Owner.SetDummyItemTime(2); - Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); - if (Projectile.Center.X < Owner.MountedCenter.X) - Owner.itemRotation += MathHelper.Pi; - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + Projectile.timeLeft = 2; + Owner.heldProj = Projectile.whoAmI; + Owner.SetDummyItemTime(2); + Owner.itemRotation = Projectile.DirectionFrom(Owner.MountedCenter).ToRotation(); + if (Projectile.Center.X < Owner.MountedCenter.X) + Owner.itemRotation += MathHelper.Pi; + Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 252450cd0d..7328a7f6e0 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[dust].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index 32f0663f36..116e59a084 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss // Nuke explosion sound. SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Nuke gores Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity, Mod.Find("AresGaussNuke1").Type, 1f); diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index b23f856311..bb0f635a76 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -60,13 +60,5 @@ namespace CalamityMod.Projectiles.Boss } Projectile.Damage(); } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index b46e89914d..0d9d4a4d21 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -134,7 +134,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 29eca0fc93..24a4917bfb 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index 0627b6fd6b..a2252c2bca 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 0ebaf1fcc6..0f763d7085 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[plagued2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/HolyAura.cs b/Projectiles/Boss/HolyAura.cs index 6ef84c0b5e..3ceab6d0b0 100644 --- a/Projectiles/Boss/HolyAura.cs +++ b/Projectiles/Boss/HolyAura.cs @@ -1,6 +1,6 @@ using System; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 210; } + public override void AI() => Projectile.Center = Main.npc[CalamityGlobalNPC.holyBoss].Center; + public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; @@ -76,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss bool underworld = Projectile.ai[0] == 2f; if (!Main.zenithWorld) { - if (Main.IsItDay() || Main.remixWorld) + if (ProvUtils.StandardAI()) { color.R = 255; if (underworld) @@ -84,18 +86,18 @@ namespace CalamityMod.Projectiles.Boss } else { - color.B = 255; + byte blueValue = (byte)(MathHelper.Clamp(MathHelper.Lerp(0, 255, Main.npc[CalamityGlobalNPC.holyBoss].Calamity().newAI[3] / 120f), 0, 255)); + if (blueValue > 255) blueValue = 255; + color.B = blueValue; if (underworld) - color.G = 0; + color.G = (byte)(255 - blueValue); else - color.R = 0; + color.R = (byte)(255 - blueValue); } } color.A = 0; - { - if (color.R > 0) color.R = (byte)MathHelper.Lerp(0, color.R, amount2); if (color.G > 0) diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index d38d41e26d..4b2b1d3666 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Vector2 sc = Vector2.One; @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = !ProvUtils.DayAI() ? 8 : 6; + int totalProjectiles = !ProvUtils.StandardAI() ? 8 : 6; if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) totalProjectiles *= 2; diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index 783cbbc98c..cb0933c919 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Boss { float squish = CalamityUtils.SineBumpEasing(SquishAnimation, 1) * 0.25f; - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBombNight").Value; int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale + squish, Projectile.scale - squish), texture, offset: new Vector2(0, (-22 * (1 - squish)))); diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index af899962cb..3385962d35 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); } - Projectile.alpha -= !ProvUtils.DayAI() ? 10 : 5; + Projectile.alpha -= !ProvUtils.StandardAI() ? 10 : 5; if (Projectile.alpha <= 0) Projectile.Kill(); @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Projectile.scale = 1.5f; - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFireNight").Value; int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, new Vector2(Projectile.scale)); diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index dc59bc060b..3c191e8a20 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 playerDirection = Main.player[playerTracker].Center - Projectile.Center; playerDirection.Normalize(); playerDirection *= projVelocityMult; - float inertia = !ProvUtils.DayAI() ? 20f : 25f; + float inertia = !ProvUtils.StandardAI() ? 20f : 25f; Projectile.velocity = (Projectile.velocity * (inertia - 1f) + playerDirection) / inertia; Projectile.velocity.Normalize(); Projectile.velocity *= projVelocityMult; @@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index 1fc4462898..d07046f83a 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Y > velocityYCap) Projectile.velocity.Y = velocityYCap; - float velocityX = !ProvUtils.DayAI() ? 0.025f : 0.02f; + float velocityX = !ProvUtils.StandardAI() ? 0.025f : 0.02f; if (Projectile.position.X + Projectile.width < player.position.X) { if (Projectile.velocity.X < 0f) @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity.X -= velocityX; } - float velocityXCap = !ProvUtils.DayAI() ? 10f : 8f; + float velocityXCap = !ProvUtils.StandardAI() ? 10f : 8f; if (Projectile.velocity.X > velocityXCap || Projectile.velocity.X < -velocityXCap) Projectile.velocity.X *= 0.97f; @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFlareNight").Value; int framing = texture.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); diff --git a/Projectiles/Boss/HolyProfanedCore.cs b/Projectiles/Boss/HolyProfanedCore.cs new file mode 100644 index 0000000000..db3c46a704 --- /dev/null +++ b/Projectiles/Boss/HolyProfanedCore.cs @@ -0,0 +1,91 @@ +using CalamityMod.Items.SummonItems; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class HolyProfanedCore : ModProjectile, ILocalizedModType + { + public override LocalizedText DisplayName => CalamityUtils.GetItemName(ModContent.ItemType()); + public override string Texture => "CalamityMod/Items/SummonItems/ProfanedCore"; + + public const int Lifetime = 180; + public const int ShakeThreshold = 90; + public ref float Timer => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + } + + public override void AI() + { + var Prov = CalamityGlobalNPC.holyBoss; + // Abort if Provi does not exist + if (Prov == -1) + { + Projectile.active = false; + return; + } + + Timer++; + + // First, briefly flies up + // Then, moves towards the position of Provi's core on her sprite, speed scales based on distance to make it smooth + if (Timer <= 30) + { + Projectile.velocity.Y = -4.5f; + } + else if (Timer > 30 && Timer <= Lifetime) + { + Projectile.velocity = Vector2.Zero; + Vector2 proviCoreLocation = Main.npc[Prov].Center + new Vector2(0f, 40f); + Projectile.Center += (proviCoreLocation - Projectile.Center) * 0.0375f; + + // Awesome particle effects or something + if (Timer > ShakeThreshold) + { + Color flameColor = new Color(255, 223, 112), crystalColor = new Color(190, 141, 184); + + float starScale = MathHelper.Lerp(0f, 6f, (Timer - ShakeThreshold) / (Lifetime - ShakeThreshold)); + CustomSpark attacka = new(proviCoreLocation, Vector2.Zero, "CalamityMod/Particles/FullStar", false, 2, starScale, flameColor, Vector2.One, extraRotation: MathHelper.PiOver4); + GeneralParticleHandler.SpawnParticle(attacka); + CustomSpark attacka2 = new(proviCoreLocation, Vector2.Zero, "CalamityMod/Particles/FullStar", false, 2, starScale * 0.4f, flameColor, Vector2.One); + GeneralParticleHandler.SpawnParticle(attacka2); + + if (Timer % 2 == 0) + { + CustomSpark crystal = new(proviCoreLocation + Main.rand.NextVector2Circular(300, 300), -Vector2.UnitY * 2f, "CalamityMod/Particles/ProvidenceMarkParticle", false, 15, 2f, crystalColor, Vector2.One, fadeIn: true); + GeneralParticleHandler.SpawnParticle(crystal); + } + else + { + Vector2 spawnLocation = proviCoreLocation + Main.rand.NextVector2Circular(250, 250); + CustomSprite rockConverge = new(spawnLocation, (proviCoreLocation - spawnLocation) * 0.08f, 15, "CalamityMod/NPCs/ProfanedGuardians/ProfanedRocks" + Main.rand.Next(1, 6 + 1), 0.3f, Color.White, 0f, false); + rockConverge.Rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + GeneralParticleHandler.SpawnParticle(rockConverge); + } + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + float shakeAmt = MathHelper.Clamp(MathHelper.Lerp(0f, 8f, (Timer - ShakeThreshold) / (Lifetime - ShakeThreshold)), 0f, 8f); + Vector2 drawPos = Projectile.Center + Main.rand.NextVector2CircularEdge(shakeAmt, shakeAmt); + + Projectile.DrawProjectileWithBackglow(new Color(255, 255, 25), lightColor, 3.5f, xPos: drawPos.X, yPos: drawPos.Y); + return false; + } + } +} diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index e09f2ac6e0..00a92cabf5 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -69,14 +69,14 @@ namespace CalamityMod.Projectiles.Boss bool commanderSpear = Projectile.ai[0] == -1f; bool enragedCommanderSpear = Projectile.ai[0] == -2f; - float timeGateValue = !ProvUtils.DayAI() ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); + float timeGateValue = !ProvUtils.StandardAI() ? 420f : ((commanderSpear || enragedCommanderSpear) ? 360f : 540f); if (Projectile.ai[0] <= 0f) { Projectile.ai[1] += 1f; - float slowGateValue = !ProvUtils.DayAI() ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); + float slowGateValue = !ProvUtils.StandardAI() ? 60f : ((commanderSpear || enragedCommanderSpear) ? 30f : 90f); float fastGateValue = 30f; - float minVelocity = !ProvUtils.DayAI() ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); + float minVelocity = !ProvUtils.StandardAI() ? 4f : (enragedCommanderSpear ? 6f : commanderSpear ? 4.5f : 3f); float maxVelocity = minVelocity * 4f; float extremeVelocity = maxVelocity * 2f; float deceleration = 0.95f; @@ -105,8 +105,8 @@ namespace CalamityMod.Projectiles.Boss } else { - float frequency = !ProvUtils.DayAI() ? 0.2f : 0.1f; - float amplitude = !ProvUtils.DayAI() ? 4f : 2f; + float frequency = !ProvUtils.StandardAI() ? 0.2f : 0.1f; + float amplitude = !ProvUtils.StandardAI() ? 4f : 2f; Projectile.ai[1] += frequency; @@ -128,7 +128,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; bool aimedSpear = Projectile.ai[0] > 0f; - Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to day + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to standard yellow if (Main.zenithWorld) { @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Boss else // Red baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); } - else if (!ProvUtils.DayAI()) + else if (!ProvUtils.StandardAI()) baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); GeneralParticleHandler.SpawnParticle(new SparkParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity, false, 15, Main.rand.NextFloat(0.5f, 1.5f) * MathHelper.Clamp(Projectile.velocity.Length() / 15, 0f, 2f), aimedSpear ? baseColor : ProvUtils.GetProjectileColor(255, false))); @@ -156,7 +156,7 @@ namespace CalamityMod.Projectiles.Boss Texture2D drawTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; bool aimedSpear = Projectile.ai[0] > 0f; - Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to day + Color baseColor = new Color(255, aimedSpear ? 255 : 125, aimedSpear ? 25 : 125); // Default to standard yellow Color baseColor2 = new Color(15, 35, 50, 0); if (Main.zenithWorld) @@ -174,7 +174,7 @@ namespace CalamityMod.Projectiles.Boss else // Red baseColor = new Color(255, aimedSpear ? 0 : 125, aimedSpear ? 0 : 255); } - else if (!ProvUtils.DayAI()) + else if (!ProvUtils.StandardAI()) baseColor = new Color(aimedSpear ? 100 : 175, aimedSpear ? 255 : 175, 255); if (!aimedSpear) diff --git a/Projectiles/Boss/LeviathanSpawner.cs b/Projectiles/Boss/LeviathanSpawner.cs index 5bca369957..1826c1ba3e 100644 --- a/Projectiles/Boss/LeviathanSpawner.cs +++ b/Projectiles/Boss/LeviathanSpawner.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.timeLeft == 45) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData ripple = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); Vector2 ripplePos = Projectile.Center; @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Boss public void CreateVisuals() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; WorldUtils.Find((Projectile.Center - Vector2.UnitY * 1200f).ToTileCoordinates(), Searches.Chain(new Searches.Down(150), new CustomConditions.IsWater()), out Point waterTop); diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index e6f75f7469..457affed38 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -123,7 +123,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlastNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y6 = framing * Projectile.frame; Projectile.DrawBackglow(ProvUtils.GetProjectileColor(Projectile.alpha, true), 4f, texture); @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Boss GeneralParticleHandler.SpawnParticle(new CustomPulse(Projectile.Center, Vector2.Zero, hiColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.02f, 0.045f, 5)); - int blobAmt = !ProvUtils.DayAI() ? 9 : 6; + int blobAmt = !ProvUtils.StandardAI() ? 9 : 6; if (Projectile.owner == Main.myPlayer) { Vector2 additionalBlobVelocity = new Vector2(Projectile.velocity.X * 0.1f, Projectile.velocity.Y); diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 83f9446068..9c3698fe8f 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/MoltenBlobNight").Value; int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; int y6 = framing * (1 + Projectile.frame); float squish = CalamityUtils.SineBumpEasing(Landing, 1) * 0.5f; diff --git a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs index b0c177b13f..57c685ea48 100644 --- a/Projectiles/Boss/OverlyDramaticDukeSummoner.cs +++ b/Projectiles/Boss/OverlyDramaticDukeSummoner.cs @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Boss return; } - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", new object[] { diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index d3cf52037b..174bca5a2c 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -61,13 +61,13 @@ namespace CalamityMod.Projectiles.Boss public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(Projectile.alpha); + return ProvUtils.GetProjectileColor(lightColor); } public override bool PreDraw(ref Color lightColor) { - Texture2D texture = ProvUtils.DayAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(Projectile.alpha, true), 4f, texture); + Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProfanedSpearNight").Value; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - Color hiColor = ProvUtils.GetDayNightColor(255, false); - Color loColor = ProvUtils.GetDayNightColor(0, true); + Color hiColor = ProvUtils.GetProjectileColor(255); + Color loColor = ProvUtils.GetProjectileColor(0, true); for (int i = 0; i < 25; i++) { diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index 3b03365fff..b77439580e 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -127,28 +127,28 @@ namespace CalamityMod.Projectiles.Boss // Increment timer Projectile.localAI[0] += 1f; - // At day, fires every 300 frames but lasts 1500-3600 frames. - // At night, fires every 30 framges but lasts 210 frames. - // In GFB, fires at night rate for the first 210 frames, then at day rate for the next 1500. - bool dayAI = ProvUtils.DayAI() || (Main.zenithWorld && Projectile.timeLeft < 1500); + // Normally, fires every 300 frames but lasts 1500-3600 frames. + // When enraged, fires every 30 frames but lasts 210 frames. + // In GFB, fires at enraged rate for the first 210 frames, then at standard rate for the next 1500. + bool standardAI = ProvUtils.StandardAI() || (Main.zenithWorld && Projectile.timeLeft < 1500); - if (Projectile.localAI[0] >= (dayAI ? 300f : 30f)) + if (Projectile.localAI[0] >= (standardAI ? 300f : 30f)) { - // Spawn shards every 30 frames at night or at 300 frames during day - if (Projectile.localAI[0] % 30f == 0f || dayAI) + // Spawn shards every 30 frames while enraged or at 300 frames normally + if (Projectile.localAI[0] % 30f == 0f || standardAI) { SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); Projectile.netUpdate = true; if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = dayAI ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); - float speedX = dayAI ? -21f : -15f; + int totalProjectiles = standardAI ? 15 : (Projectile.localAI[0] % 60f == 0f ? 15 : 10); + float speedX = standardAI ? -21f : -15f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -3f; for (int i = 0; i < totalProjectiles; i++) { - float x4 = dayAI ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; - float randomSpread = dayAI ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); + float x4 = standardAI ? Main.rgbToHsl(new Color(255, 200, Main.DiscoB)).X : Main.rgbToHsl(new Color(Main.DiscoR, 200, 255)).X; + float randomSpread = standardAI ? 0f : Main.rand.Next(-150, 151) * 0.01f * (1f - lifeRatio); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX + speedAdjustment * i + randomSpread, speedY, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, x4, Projectile.whoAmI); } CrystalExplosion(); diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index 482e4f40be..a745f81594 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -59,8 +59,8 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity, 0.3f * Projectile.Opacity); - // Night AI or Guardian Healer - if (!ProvUtils.DayAI() || healerGuardianAlive) + // Enraged AI or Guardian Healer + if (!ProvUtils.StandardAI() || healerGuardianAlive) Projectile.extraUpdates = 1; if (Projectile.timeLeft < 300) @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss else { Projectile.velocity.Y *= 1.06f; - float fallSpeed = (CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Day)) ? 3.5f : 3f; + float fallSpeed = (CalamityWorld.revenge || (Projectile.maxPenetrate != (int)Providence.BossMode.Normal)) ? 3.5f : 3f; if (Projectile.velocity.Y > fallSpeed) Projectile.velocity.Y = fallSpeed; } diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 11d92a468f..7ca90e54b2 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss { ExtraWidth = Projectile.ai[2]; - bool scissorLasers = CalamityWorld.revenge || !ProvUtils.DayAI(); + bool scissorLasers = CalamityWorld.revenge || !ProvUtils.StandardAI(); Vector2? vector78 = null; if (Projectile.velocity.HasNaNs() || Projectile.velocity == Vector2.Zero) @@ -158,12 +158,12 @@ namespace CalamityMod.Projectiles.Boss Vector2 scale = new Vector2(Projectile.scale * ExtraWidth, Projectile.scale); - bool dayTime = ProvUtils.DayAI(); - Texture2D texture2D19 = dayTime ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : + bool standardTexture = ProvUtils.StandardAI(); + Texture2D texture2D19 = standardTexture ? ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/Projectiles/Boss/ProvidenceHolyRayNight", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture2D20 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D20 = standardTexture ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMid", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayMidNight", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture2D21 = dayTime ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : + Texture2D texture2D21 = standardTexture ? ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEnd", AssetRequestMode.ImmediateLoad).Value : ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float rayDrawLength = Projectile.localAI[1]; //length of laser diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/ScavengerNuke.cs index e7dcece543..8da689fd1c 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/ScavengerNuke.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -81,6 +82,21 @@ namespace CalamityMod.Projectiles.Boss } } + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + { + if (DownedBossSystem.downedProvidence) + { + target.AddBuff(ModContent.BuffType(), 180, true); + } + else + { + target.AddBuff(ModContent.BuffType(), 180, true); + } + } + } + public override void OnKill(int timeLeft) { SoundEngine.PlaySound(ExplosionSound, Projectile.Center); @@ -108,7 +124,7 @@ namespace CalamityMod.Projectiles.Boss Main.dust[nukeDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 45daa0f955..7693532568 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -1,4 +1,5 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; @@ -89,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnKill(int timeLeft) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 9e879ce749..3953ea2929 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -57,88 +57,144 @@ namespace CalamityMod.Projectiles } } - // Source variables. + /// + /// If true, this projectile was spawned from a dash hit.
+ /// Solely used to prevent the projectile from inflicting Vulnerability Hex when using the Aflame enchantment. + ///
public bool CreatedByPlayerDash = false; - // Speed cap for accelerating boss laser projectiles with 2 extraUpdates. + /// Constant variable used as a speed cap for boss laser projectiles with 2 extra updates. public const float AcceleratingBossLaserVelocityCap = 8f; - // Damage Adjusters + /// Constant variable used to determine the percentage a projectile's damage is reduced by pierce resist on each hit. public const float PierceResistHarshness = 0.12f; + /// Constant variable used to determine the maximum percentage a projectile's damage can be reduced by pierce resist. public const float PierceResistCap = 0.8f; - // defDamage was being used for frame1 hacks. this stands in as the replacement for that logic. + /// + /// Used for executing frame one hacks. Things set during this include: + ///
* Reducing projectile damage for Hardmode enemies and in Master Mode. + ///
* Adding armor penetration to rogue projectiles spawned while wearing Filthy Glove or its upgrades. + ///
* Increasing the damage of projectiles from the post-Moon Lord Dungeon, and from the post-DoG Pumpkin Moon, Frost Moon, and Solar Eclipse. + ///
private bool frameOneHacksExecuted = false; - // Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit". - // For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage. - // They then take the remainder (e.g. the remaining 16%) and roll against that for a final +100% (like normal crits). - // For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead. - // An example of this is Soma Prime, but any bullet fired from that gun can supercrit when this bool is activated. - // Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times + /// + /// Enables "supercrits". When crit is over 100%, projectiles with this bool enabled can "supercrit".
+ /// For every 100% critical strike chance over 100%, "supercrit" projectiles do a guaranteed +100% damage.
+ /// They then take the remainder and roll against that for a final +100% (like normal crits).
+ /// For example if you have 716% critical strike chance, you are guaranteed +700% damage and then have a 16% chance for +800% damage instead.
+ /// An example of this is Soma Prime, but any bullet fired from that gun can supercrit when this bool is activated.
+ /// Set this to -1 if you want the projectile to supercrit forever, and to any positive value to make it supercrit only x times. + ///
public int supercritHits = 0; - // Without adjusting underlying crit calculations, set this to true to force a projectile as a crit. // TODO -- In the TML 1.4.4 port, there is a much better way to set NPC strike events to be forced crits. + /// Set to true to force a projectile to critically strike. public bool forcedCrit = false; - // The total bonus damage (as a ratio of the projectile's own damage) applied to this projectile as a result of a ricoshot combo. + /// The total bonus damage (as a ratio of the projectile's own damage) applied to this projectile as a result of a ricoshot combo. public float totalRicoshotDamageBonus = 0f; - // If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. + /// If true, this projectile can apply the infinitely-stacking Shred debuff iconic to Soma Prime. public bool appliesSomaShred = false; - // Arc Flash bolt spawning management + /// + /// If true, this projectile is able to spawn lightning while using Arc Flash Ring.
+ /// This is set to false when lightning is procced, and is reset to true when the cooldown ends. + ///
public bool spawnArcFlash = true; + /// Cooldown variable for Arc Flash Ring's lightning. Primarily used for lingering projectiles and minions. public int arcFlashCooldown = 0; - // Adds Brimstone flames to bullets, currently only used by Animosity + /// + /// If true, adds a brimstone trail to the projectile, and makes it inflict Brimstone Flames.
+ /// Used by Animosity. + ///
public bool brimstoneBullets = false; + /// + /// If true, adds a fire trail to the projectile, and makes it inflict Hellfire.
+ /// Used by Thermocline Blaster. + ///
// Used by Megalodon, Seadragon & Voidragon, allows bullets to track their damage scaling public bool sharkBullets = false; // Adds fire to bullets, currently used by Thermocline Blaster public bool fireBullet = false; - - // Adds ice to bullets, currently used by Thermocline Blaster + /// + /// If true, adds an ice trail to the projectile, and makes it inflict Frostbite.
+ /// Used by Thermocline Blaster. + ///
public bool iceBullet = false; - - // Adds shock to bullets, currently used by Arietes 41 + /// + /// If true, adds an electric trail to the projectile, and makes it inflict Electrified and create an explosion on hit.
+ /// Used by Arietes 41. + ///
public bool shockBullet = false; - - // Adds... pearl? to bullets (visual 1, blue), currently used by Pearl God - public bool pearlBullet1 = false; - // Adds... pearl? to bullets (visual 2, pink), currently used by Pearl God - public bool pearlBullet2 = false; - // Adds... pearl? to bullets (visual 3, yellow), currently used by Pearl God - public bool pearlBullet3 = false; - - // Adds lifesteal to bullets, currently used by Arietes 41 + /// + /// If true, adds a white trail to the projectile, and allows it to lifesteal.
+ /// Used by Arietes 41. + ///
public bool lifeBullet = false; - - // Adds lifesteal to bullets (visual 1), currently used by Pearl God - public bool betterLifeBullet1 = false; - // Adds lifesteal to bullets (visual 2), currently used by Pearl God - public bool betterLifeBullet2 = false; - - // If true, this projectile creates impact sparks upon hitting enemies + /// + /// If true, this projectile creates visual impact sparks upon hitting enemies.
+ /// Used by Deepcore GK2. + ///
public bool deepcoreBullet = false; - - // If set to a value greater than 0, causes this projectile to gain homing with a range equal to the value in pixels. - // Currently used for Arterial Assault. + /// + /// If true, adds a blue and pearly trail to the projectile, and makes it create an explosion on hit.
+ /// Used by Pearl God. + ///
+ public bool pearlBullet1 = false; + /// + /// If true, adds a pink and pearly trail to the projectile, and makes it create an explosion on hit.
+ /// Used by Pearl God. + ///
+ public bool pearlBullet2 = false; + /// + /// If true, adds a khaki and pearly trail to the projectile, and makes it create an explosion on hit.
+ /// Used by Pearl God. + ///
+ public bool pearlBullet3 = false; + /// + /// If true, adds a blue, pink, and khaki helix trail to the projectile, and allows it to lifesteal.
+ /// Used by Pearl God. + ///
+ public bool betterLifeBullet1 = false; + /// + public bool betterLifeBullet2 = false; + /// + /// If set to a value greater than 0, causes this projectile to gain homing with a range equal to the value in pixels.
+ /// Used by Arterial Assault. + ///
public float conditionalHomingRange = 0f; - // Amount of extra updates that are set in SetDefaults. + /// + /// Variable used for storing the actual amount of extra updates a projectile has.
+ /// This is NOT set automatically, and must be set whenever it is needed. + ///
public int defExtraUpdates = -1; - // How many times this projectile has pierced. + /// + /// How many times this projectile has pierced an enemy which applies pierce resist.
+ /// Used for calculating pierce resist damage reduction. + ///
public int timesPierced = 0; - // Point-blank shot timer and distance check. + /// + /// If this projectile uses point-blank damage, this gets set to , then is decremented every frame.
+ /// If it reaches 0, this projectile can no longer deal point-blank damage. + ///
public int pointBlankShotDuration = 0; + /// + /// If this projectile uses point-blank damage, this value is incremented on every update by the distance the projectile traveled on that update.
+ /// If it exceeds , this projectile can no longer deal point-blank damage. + ///
public float pointBlankShotDistanceTravelled = 0f; + /// Constant variable which stores how many frames a projectile is allowed to deal point-blank damage. public const int DefaultPointBlankDuration = 18; // 18 frames + /// Constant variable which stores the maximum distance a projectile can travel to deal point-blank damage, in pixels. public const float PointBlankShotDistanceLimit = 240f; // 15 tiles // Empress of Light variables @@ -151,47 +207,70 @@ namespace CalamityMod.Projectiles private const int FishronCthulhunadoTotalDuration = 840; private const int FishronTornadoTimeBeforeDealingDamage = 60; - // Temporary flat damage reduction effects. This is typically used for parry effects such as Ark of the Ancients + /// Timer for how long a projectile's damage is reduced by the value in . public int flatDRTimer = 0; - /// - /// The amount of final damage substracted from the projectile's own damage count when hitting the player. Resets to 0 if the flatDRTimer variable drops to 0 - /// + /// A temporary flat amount subtracted from the projectile's damage when hitting the player. Resets to 0 if drops to 0. public int flatDR = 0; - /// - /// Allows hostile Projectiles to deal damage to the player's defense stat, used mostly for hard-hitting bosses. - /// + /// If true, allows hostile projectiles to deal defense damage to the player. Used mostly for hard-hitting bosses. public bool DealsDefenseDamage = false; - // Old Fashioned buff. This does not have effect unless the player has the buff consumed. + /// + /// Determines how this projectile's damage is affected by the Old Fashioned buff. This does not have an effect unless the player has the buff consumed.
+ /// If true, its damage is buffed. If false, its damage is nerfed. If null, its damage is unchanged. Defaults to null. + ///
public bool? buffedByOldFashioned; - - // Nihility Quiver + /// If true, this projectile has been buffed by Quiver of Nihility's void fields. Used to ensure the buff is only applied once. public bool nihilicArrow = false; // Rogue Stuff + /// If true, this projectile is from a rogue stealth strike. The primary variable responsible for triggering stealth strike effects. public bool stealthStrike = false; + /// + /// Number of times this stealth strike projectile has pierced an enemy.
+ /// Used to limit the number of times a projectile can proc certain effects from rogue accessories. + ///
public int stealthStrikeHitCount = 0; + /// Variable to ensure that Ethereal Extorter's soul projectiles only spawn on projectiles spawning directly from item use. public bool extorterBoost = false; + /// + /// If true, this projectile is a Venerated Locket clone projectile.
+ /// Used to prevent certain rogue weapon and accessory effects. + ///
public bool LocketClone = false; + /// + /// If true, this projectile cannot proc projectile effects from rogue accessories.
+ /// Set this variable for projectiles that are prone to spawning an excessive amount of projectiles. + ///
public bool CannotProc = false; + /// Tracks whether this projectile has already triggered Scuttler's Jewel's projectile effect. public bool JewelSpikeSpawned = false; // Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben // TODO -- uses of this variable are undocumented and unstable. Remove it from the API surface. public int lineColor = 0; - // This flag is set to true on summon-classed attacks that are NOT minions, and thus should ALWAYS be able to hit enemies ALL the time. - // There are several enemies/NPCs in Calamity which do not take damage from minions in certain circumstances. + /// + /// There are several NPCs in Calamity which do not take damage from minions in certain circumstances.
+ /// If true, this variable allows a projectile that deals summon damage to bypass this mechanic. + ///
public bool overridesMinionDamagePrevention = false; // Enchantment variables. + /// + /// Variable used as a timer for minions with the Hellbound enchantment.
+ /// When spawned, this value is set to and gets decremented every frame. When it reaches 0, the minion explodes and despawns.
+ /// Also used for spawning smaller explosions and for scaling damage as the timer decreases. + ///
public int ExplosiveEnchantCountdown = 0; + /// Constant variable which stores the duration of minions with the Hellbound enchantment, in frames. public const int ExplosiveEnchantTime = 2400; - // Custom update priority. - // Calamity sorts projectiles by their update priority to fix otherwise absurdly difficult to resolve visual bugs on certain weapons. - // Examples include Mechworm segments detaching or Rancor's laser beam being offset from the magic circle. + /// + /// Custom update priority.
+ /// Calamity sorts projectiles by their update priority to fix otherwise absurdly difficult to resolve visual bugs on certain weapons.
+ /// Examples include Mechworm segments detaching or Rancor's laser beam being offset from the magic circle. + ///
public float UpdatePriority = 0f; #region On Spawn @@ -1428,7 +1507,7 @@ namespace CalamityMod.Projectiles if (Main.rand.NextBool(10)) Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Enchanted_Pink, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, projectile.velocity * 0.2f, Main.rand.Next(16, 18), 1f); } @@ -3915,7 +3994,7 @@ namespace CalamityMod.Projectiles confetti.velocity.X += Main.rand.Next(-50, 51) * 0.05f; confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; } - if (Main.rand.NextBool(40) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(40) && !Main.dedServ) { int Type = Main.rand.Next(276, 283); Gore confetti = Gore.NewGoreDirect(projectile.GetSource_FromAI(), projectile.position, velocity, Type, 1f); @@ -4259,7 +4338,7 @@ namespace CalamityMod.Projectiles // Create sparks on hit to hammer in the defense shredding. if (deepcoreBullet) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 cen = Vector2.Lerp(projectile.Center, target.Center, 0.65f); int numSparks = Main.rand.Next(2, 5); diff --git a/Projectiles/Enemy/AstralMeteorProj.cs b/Projectiles/Enemy/AstralMeteorProj.cs index aa52ac2ac9..0f43d65bcf 100644 --- a/Projectiles/Enemy/AstralMeteorProj.cs +++ b/Projectiles/Enemy/AstralMeteorProj.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Enemy } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreCount = 3; Vector2 goreSource = Projectile.Center; diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 9c6b8b2761..6d24b0c175 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Enemy Main.dust[earthyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Enemy/EarthRockSmall.cs b/Projectiles/Enemy/EarthRockSmall.cs index 50fe80569b..3ce772af66 100644 --- a/Projectiles/Enemy/EarthRockSmall.cs +++ b/Projectiles/Enemy/EarthRockSmall.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Enemy Main.dust[earthyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 83405cfade..0ac939d000 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Projectiles.Magic public ref float Timer => ref Projectile.ai[0]; public ref float AIState => ref Projectile.ai[1]; - public ref float NoteSequence => ref Projectile.localAI[1]; + public ref float NoteSequence => ref Projectile.ai[2]; public int LingeringTime = 300; public int FadeOutTime = 20; public bool HasSetFadeOutVelocity = false; - private bool _hasSpawned; + public float _randomReleaseRotationOffset; public Player Owner => Main.player[Projectile.owner]; @@ -44,13 +44,7 @@ namespace CalamityMod.Projectiles.Magic } public override void AI() - { - if (!_hasSpawned) - { - NoteSequence = Owner.ownedProjectileCounts[Type] - 1; - _hasSpawned = true; - } - + { Timer++; // Slight size oscillation @@ -88,8 +82,9 @@ namespace CalamityMod.Projectiles.Magic // If the player stops using the weapon, switch to fade away mode if (Owner.releaseUseItem) { - Owner.Calamity().arpeggioCooldown = 40; + Owner.Calamity().arpeggioCooldown = 45; AIState = 1f; + Projectile.netUpdate = true; } } else if (AIState == 1f) // Brief fade away @@ -113,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 255; float degreesAmt = Main.zenithWorld ? 51.428f : 60f; - Vector2 musicNoteRotationOffset = Vector2.UnitY.RotatedBy(MathHelper.ToRadians(degreesAmt * NoteSequence) + Projectile.ai[2]); + Vector2 musicNoteRotationOffset = Vector2.UnitY.RotatedBy(MathHelper.ToRadians(degreesAmt * NoteSequence) + _randomReleaseRotationOffset); Vector2 mouse = Owner.ClampedMouseWorld(); Projectile.Center = mouse + musicNoteRotationOffset * 220f; @@ -204,8 +199,8 @@ namespace CalamityMod.Projectiles.Magic SingularSoundInstanceSystem.PlaySingleInstance(AnahitasArpeggio.HitSound, 60, 60, Owner); } - public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.localAI[1]); + public override void SendExtraAI(BinaryWriter writer) => writer.Write(_randomReleaseRotationOffset); - public override void ReceiveExtraAI(BinaryReader reader) => Projectile.localAI[1] = reader.ReadSingle(); + public override void ReceiveExtraAI(BinaryReader reader) => _randomReleaseRotationOffset = reader.ReadSingle(); } } diff --git a/Projectiles/Magic/ApotheosisEnergy.cs b/Projectiles/Magic/ApotheosisEnergy.cs index aa6b8bae8d..7aa7bea46c 100644 --- a/Projectiles/Magic/ApotheosisEnergy.cs +++ b/Projectiles/Magic/ApotheosisEnergy.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.extraUpdates = 1; Projectile.timeLeft = 210; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 1; + Projectile.localNPCHitCooldown = 4; } public override void AI() @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < Projectile.oldPos.Length; i++) { - if (Collision.CheckAABBvAABBCollision(Projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Projectile.oldPos[i], projHitbox.Size(), targetHitbox.TopLeft(), targetHitbox.Size())) return true; } return false; diff --git a/Projectiles/Magic/ApotheosisWorm.cs b/Projectiles/Magic/ApotheosisWorm.cs index 7e088f2488..43f9c166df 100644 --- a/Projectiles/Magic/ApotheosisWorm.cs +++ b/Projectiles/Magic/ApotheosisWorm.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.timeLeft = 300; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 9; + Projectile.localNPCHitCooldown = 6; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; @@ -352,14 +352,15 @@ namespace CalamityMod.Projectiles.Magic // Manual collision detection that incorporates segments. public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - if (Collision.CheckAABBvAABBCollision(Projectile.position, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Projectile.position, projHitbox.Size(), targetHitbox.TopLeft(), targetHitbox.Size())) return true; for (int i = 0; i < Segments.Length; i++) { - if (Collision.CheckAABBvAABBCollision(Segments[i].Center - projHitbox.Size() * 0.5f, projHitbox.Size(), targetHitbox.TopLeft(), projHitbox.Size())) + if (Collision.CheckAABBvAABBCollision(Segments[i].Center - projHitbox.Size() * 0.5f, projHitbox.Size(), targetHitbox.TopLeft(), targetHitbox.Size())) return true; } + return false; } } diff --git a/Projectiles/Magic/Asteroid.cs b/Projectiles/Magic/Asteroid.cs index 5d354632ee..f481a41547 100644 --- a/Projectiles/Magic/Asteroid.cs +++ b/Projectiles/Magic/Asteroid.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[killDust].velocity *= 2f; Main.dust[killDust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 2; k++) { diff --git a/Projectiles/Magic/AsteroidMolten.cs b/Projectiles/Magic/AsteroidMolten.cs index 5c1561bd7b..593186be24 100644 --- a/Projectiles/Magic/AsteroidMolten.cs +++ b/Projectiles/Magic/AsteroidMolten.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[killFire].velocity *= 2f; Main.dust[killFire].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 2; k++) { diff --git a/Projectiles/Magic/AstralStarMagic.cs b/Projectiles/Magic/AstralStarMagic.cs index 5b201e4b1e..075eb98bf5 100644 --- a/Projectiles/Magic/AstralStarMagic.cs +++ b/Projectiles/Magic/AstralStarMagic.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[idx].position = Projectile.Center + velocity * 6f; } - if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(24) && !Main.dedServ) { int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.1f, 16, 1f); Main.gore[idx].velocity *= 0.66f; @@ -108,7 +108,7 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f, 150); } - if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(10) && !Main.dedServ) Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.1f, Main.rand.Next(16, 18), 1f); if (Projectile.ai[0] == 1f) @@ -176,7 +176,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity * 0.05f, Main.rand.Next(16, 18), 1f); diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 6c069c3319..4861b6e389 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 8; i++) { - Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack, Projectile.owner, Projectile.ai[0]); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0]); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/BlindingLight.cs b/Projectiles/Magic/BlindingLight.cs index b4b206a6da..a5a5b0602b 100644 --- a/Projectiles/Magic/BlindingLight.cs +++ b/Projectiles/Magic/BlindingLight.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Projectiles.Magic float progress = (float)Math.Sin(Projectile.ai[0] / Lifetime * MathHelper.Pi); if (Projectile.ai[0] > 55f) progress = MathHelper.Lerp(progress, 0f, (Projectile.ai[0] - 55f) / 5f); - if (Main.netMode != NetmodeID.Server && Projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. + if (!Main.dedServ && Projectile.ai[0] > 15f) // Otherwise a white flash appears, but it quickly disappears. { if (!Filters.Scene["CalamityMod:LightBurst"].IsActive()) Filters.Scene.Activate("CalamityMod:LightBurst", Projectile.Center).GetShader().UseTargetPosition(Projectile.Center).UseProgress(0f); @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) Filters.Scene.Deactivate("CalamityMod:LightBurst"); } diff --git a/Projectiles/Magic/BloodBlast.cs b/Projectiles/Magic/BloodBlast.cs index 340b745e51..ea18c079db 100644 --- a/Projectiles/Magic/BloodBlast.cs +++ b/Projectiles/Magic/BloodBlast.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -56,5 +57,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += 0.3f * (float)Projectile.direction; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Magic/ClamorNoctusStar.cs b/Projectiles/Magic/ClamorNoctusStar.cs index 0930c2506c..ed88380a08 100644 --- a/Projectiles/Magic/ClamorNoctusStar.cs +++ b/Projectiles/Magic/ClamorNoctusStar.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Magic brightDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100, default, 1f); Main.dust[brightDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 3; k++) { diff --git a/Projectiles/Magic/ClamorNoctusWyvern.cs b/Projectiles/Magic/ClamorNoctusWyvern.cs index 3de2a503bc..8196533cc1 100644 --- a/Projectiles/Magic/ClamorNoctusWyvern.cs +++ b/Projectiles/Magic/ClamorNoctusWyvern.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Shadewood, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int head = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.8f, Mod.Find("ClamorNoctusHead").Type); Main.gore[head].timeLeft /= 10; diff --git a/Projectiles/Magic/DarkSparkBeam.cs b/Projectiles/Magic/DarkSparkBeam.cs index aee980f024..242551db4a 100644 --- a/Projectiles/Magic/DarkSparkBeam.cs +++ b/Projectiles/Magic/DarkSparkBeam.cs @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Magic DelegateMethods.v3_1 = color.ToVector3() * 0.3f; Vector2 size = new Vector2(Projectile.velocity.Length() * Projectile.localAI[1], Projectile.width * Projectile.scale); float shaderLength = Projectile.velocity.ToRotation(); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) ((WaterShaderData)Filters.Scene["WaterDistortion"].GetShader()).QueueRipple(Projectile.position + new Vector2(size.X * 0.5f, 0f).RotatedBy(shaderLength), color, size, RippleShape.Square, shaderLength); Utils.PlotTileLine(Projectile.Center, Projectile.Center + Projectile.velocity * Projectile.localAI[1], Projectile.width * Projectile.scale, DelegateMethods.CastLight); diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 1443b9062c..8fdd57539f 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -44,17 +45,12 @@ namespace CalamityMod.Projectiles.Magic }); Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/GraniteEnergy.cs b/Projectiles/Magic/GraniteEnergy.cs deleted file mode 100644 index 0f73dca550..0000000000 --- a/Projectiles/Magic/GraniteEnergy.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class GraniteEnergy : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = 12; - Projectile.height = 12; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.DamageType = DamageClass.Magic; - Projectile.timeLeft = 90; - } - - public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 60 && target.CanBeChasedBy(Projectile); - - public override void AI() - { - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.ToRadians(90); - if (Main.rand.NextBool()) - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 0.6f); - - if (Projectile.timeLeft < 60) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 12f, 20f); - } - } -} diff --git a/Projectiles/Magic/GraniteEnergy.png b/Projectiles/Magic/GraniteEnergy.png deleted file mode 100644 index f49fec4516..0000000000 Binary files a/Projectiles/Magic/GraniteEnergy.png and /dev/null differ diff --git a/Projectiles/Magic/GranitePulse.cs b/Projectiles/Magic/GranitePulse.cs deleted file mode 100644 index 885df7e794..0000000000 --- a/Projectiles/Magic/GranitePulse.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class GranitePulse : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public bool initialized = false; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 6; - } - - public override void SetDefaults() - { - Projectile.width = 40; - Projectile.height = 46; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.timeLeft = 1200; - } - - public override void AI() - { - Projectile.velocity = new Vector2(0f, (float)Math.Sin((double)(MathHelper.TwoPi * Projectile.ai[0] / 300f)) * 0.5f); - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= 300f) - { - Projectile.ai[0] = 0f; - Projectile.netUpdate = true; - } - - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - Projectile.ai[1] += 1f; - if (Projectile.ai[1] >= 7200f) - { - Projectile.alpha += 5; - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - Projectile.Kill(); - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projCount = 0; - int index = 0; - float findOldest = 0f; - int projType = Projectile.type; - foreach (Projectile proj in Main.ActiveProjectiles) - { - if (proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) - { - projCount++; - if (proj.ai[1] > findOldest) - { - index = proj.whoAmI; - findOldest = proj.ai[1]; - } - } - } - if (projCount > 1) - { - Main.projectile[index].netUpdate = true; - Main.projectile[index].ai[1] = 36000f; - return; - } - } - if (!initialized) - { - SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); - Projectile.ExpandHitboxBy(20); - for (int d = 0; d < 5; d++) - { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 0.5f); - Main.dust[ecto].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[ecto].scale = 0.5f; - Main.dust[ecto].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 10; d++) - { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Main.dust[ecto].noGravity = true; - Main.dust[ecto].velocity *= 5f; - ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 0.5f); - Main.dust[ecto].velocity *= 2f; - } - initialized = true; - } - if (Projectile.timeLeft % 50 == 1 && Projectile.alpha <= 0) - { - SoundEngine.PlaySound(SoundID.NPCHit53, Projectile.Center); - Projectile.ExpandHitboxBy(20); - for (int d = 0; d < 5; d++) - { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Vortex, 0f, 0f, 100, default, 0.5f); - Main.dust[ecto].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[ecto].scale = 0.5f; - Main.dust[ecto].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 10; d++) - { - int ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 1f); - Main.dust[ecto].noGravity = true; - Main.dust[ecto].velocity *= 5f; - ecto = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedWhiteBluePurple, 0f, 0f, 100, default, 0.5f); - Main.dust[ecto].velocity *= 2f; - } - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < 8; i++) - { - Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 3f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int height = texture.Height / Main.projFrames[Type]; - int frameHeight = height * Projectile.frame; - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, height / 2f), Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Magic/GranitePulse.png b/Projectiles/Magic/GranitePulse.png deleted file mode 100644 index f6b69d417b..0000000000 Binary files a/Projectiles/Magic/GranitePulse.png and /dev/null differ diff --git a/Projectiles/Magic/IceBarrageMain.cs b/Projectiles/Magic/IceBarrageMain.cs index a4b5c68f74..7abf042476 100644 --- a/Projectiles/Magic/IceBarrageMain.cs +++ b/Projectiles/Magic/IceBarrageMain.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - private int pwidth = 58; - private int pheight = 58; + private const int pwidth = 58; + private const int pheight = 58; + private ref float Timer => ref Projectile.ai[0]; public override void SetDefaults() { Projectile.width = pwidth; @@ -30,130 +32,99 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - NPC closestTarget = Projectile.Center.ClosestNPCAt(500f, true, true); + NPC closestTarget = Projectile.Center.ClosestNPCAt(5000f, true, true); if (closestTarget != null) - { Projectile.Center = closestTarget.Center; - } - Projectile.ai[0]++; - Projectile.ai[1]++; + Timer++; for (int j = 0; j < 3; j++) { - int dustType = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) + int dustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + if (Timer < 140f) { - dustType = 80; - } - if (Projectile.ai[0] < 140f) - { - Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f)); - int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, direction.X, direction.Y, 50, default, 1.3f); - Main.dust[dust].noGravity = true; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, Main.rand.NextVector2Circular(-4f, 4f), 50, default, 1.3f); + dust.noGravity = true; } else { int direct = Main.rand.NextBool() ? 1 : -1; - Vector2 dir1 = new Vector2(0f, 10f) * direct; - int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir1.X, dir1.Y, 50, default, 1.3f); - Main.dust[dust1].noGravity = true; - Main.dust[dust1].velocity = dir1; - int direct2 = Main.rand.NextBool() ? 1 : -1; - Vector2 dir2 = new Vector2(10f, 0f) * direct2; - int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir2.X, dir2.Y, 50, default, 1.3f); - Main.dust[dust2].noGravity = true; - Main.dust[dust2].velocity = dir2; + Vector2 dustSpawn = Projectile.position + new Vector2(Main.rand.Next(Projectile.width), Main.rand.Next(Projectile.height)); + + Dust dust1 = Dust.NewDustPerfect(dustSpawn, dustType, Vector2.UnitY * 10f * direct, 50, default, 1.3f); + dust1.noGravity = true; + direct = Main.rand.NextBool() ? 1 : -1; + Dust dust2 = Dust.NewDustPerfect(dustSpawn, dustType, Vector2.UnitX * 10f * direct, 50, default, 1.3f); + dust2.noGravity = true; } } - if (Projectile.ai[0] < 55) + + if (Timer < 55) { - for (int i = 0; i < 10; i++) + for (int i = 0; i < 9; i++) { - int dtype1 = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) - { - dtype1 = 80; - } - Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); - Vector2 Dspeed = Projectile.Center - Dpos; - Dspeed.Normalize(); - Dspeed *= 0.5f; - float Dscale = Main.rand.NextFloat(1.5f, 2f); - int d1 = Dust.NewDust(Dpos, 1, 1, dtype1, Dspeed.X, Dspeed.Y, 0, default, Dscale); - Main.dust[d1].velocity = Dspeed; - Main.dust[d1].noGravity = true; + int auraDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + Vector2 auraDustPos = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(250f, 270f); + Vector2 auraDustSpeed = Vector2.Normalize(Projectile.Center - auraDustPos) * 0.5f; + + Dust auraDust = Dust.NewDustPerfect(auraDustPos, auraDustType, auraDustSpeed, Scale: Main.rand.NextFloat(1.5f, 2f)); + auraDust.noGravity = true; } } - else if (Projectile.ai[0] == 55f) + else if (Timer == 55f) { - for (int i = 0; i < 270; i++) + for (int i = 0; i < 210; i++) { - int dtype2 = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) - { - dtype2 = 80; - } - Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360))); - Vector2 Dspeed = Projectile.Center - Dpos; - Dspeed.Normalize(); - Dspeed *= Main.rand.NextFloat(8f, 34f); - float Dscale = Main.rand.NextFloat(1.5f, 2f); - int d1 = Dust.NewDust(Dpos, 1, 1, dtype2, Dspeed.X, Dspeed.Y, 0, default, Dscale); - Main.dust[d1].velocity = Dspeed; - Main.dust[d1].noGravity = true; + int inwardDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + Vector2 inwardDustPos = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(250f, 270f); + Vector2 inwardDustSpeed = Vector2.Normalize(Projectile.Center - inwardDustPos) * Main.rand.NextFloat(8f, 34f); + + Dust inwardDust = Dust.NewDustPerfect(inwardDustPos, inwardDustType, inwardDustSpeed, Scale: Main.rand.NextFloat(1.5f, 2f)); + inwardDust.noGravity = true; } } - else if (Projectile.ai[0] == 140f) + else if (Timer == 140f) { Vector2 projcenter = Projectile.Center; Projectile.width = 200; Projectile.height = 200; Projectile.Center = projcenter; Projectile.Damage(); - for (int i = 0; i < 180; i++) + + for (int i = 0; i < 150; i++) { - int dtype3 = Main.rand.NextBool() ? 68 : 67; - if (Main.rand.NextBool(4)) - { - dtype3 = 80; - } - Vector2 explosiondir = new Vector2(Main.rand.NextFloat(-18f, 18f), Main.rand.NextFloat(-18f, 18f)); - int d2 = Dust.NewDust(Projectile.Center, 1, 1, dtype3, explosiondir.X, explosiondir.Y, 50, default, 1.5f); - Main.dust[d2].noGravity = true; - } - for (int k = 0; k < 45; k++) - { - Vector2 projspeed = new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f)); - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3)); - Main.projectile[ice].timeLeft = 600; - Main.projectile[ice].DamageType = DamageClass.Magic; + int outwardDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod; + Dust outwardDust = Dust.NewDustPerfect(Projectile.Center, outwardDustType, Main.rand.NextVector2Circular(-18f, 18f), 50, default, 1.5f); + outwardDust.noGravity = true; } Projectile.width = pwidth; Projectile.height = pheight; Projectile.Center = projcenter; - Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 44f); - int block1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos1, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f, 0f); - Main.projectile[block1].Center = pos1; - Vector2 pos2 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 48f, Projectile.Center.Y); - int block2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos2, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f, 0f); - Main.projectile[block2].Center = pos2; - Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 44f); - int block3 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos3, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f, 0f); - Main.projectile[block3].Center = pos3; - Vector2 pos4 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 49f, Projectile.Center.Y); - int block4 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos4, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f, 0f); - Main.projectile[block4].Center = pos4; + + // Bottom + Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 20f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos1, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f); + // Left + Vector2 pos2 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 20f, Projectile.Center.Y); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos2, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f); + // Top + Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 20f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos3, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f); + // Right + Vector2 pos4 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 20f, Projectile.Center.Y); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos4, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f); } - if (Projectile.ai[0] > 90) + + if (Timer > 90) { + Projectile.ai[1]++; if (Projectile.ai[1] >= 5f) { - Vector2 projspeed = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f)); - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3)); + Vector2 spawnPos = Projectile.Center + new Vector2(Main.rand.NextFloat(-200f, 200f), -400f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Vector2.UnitY * 6f, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, Main.rand.Next(3)); if (ice.WithinBounds(Main.maxProjectiles)) { - Main.projectile[ice].timeLeft = 600; + Main.projectile[ice].tileCollide = false; Main.projectile[ice].DamageType = DamageClass.Magic; } Projectile.ai[1] = 0f; @@ -161,16 +132,7 @@ namespace CalamityMod.Projectiles.Magic } } - public override bool? CanDamage() - { - if (Projectile.ai[0] == 140f) - return null; - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 60); - } + public override bool? CanDamage() => Timer == 140f ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Magic/IceBlock.cs b/Projectiles/Magic/IceBlock.cs index b2c837da75..25cf1f7c0a 100644 --- a/Projectiles/Magic/IceBlock.cs +++ b/Projectiles/Magic/IceBlock.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; + Projectile.localNPCHitCooldown = 30; Projectile.coldDamage = true; } @@ -32,32 +32,29 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.alpha > 20) { Projectile.alpha -= 12; + if (Projectile.alpha < 20) + Projectile.alpha = 20; } - if (Projectile.alpha < 20) - { - Projectile.alpha = 20; - } + foreach (Projectile proj in Main.ActiveProjectiles) { if (proj.type == ModContent.ProjectileType() && proj.owner == Main.myPlayer) { - Vector2 pos1 = new Vector2(proj.Center.X, proj.Center.Y - (proj.height * 0.5f) - 44f); - Vector2 pos2 = new Vector2(proj.Center.X + (proj.width * 0.5f) + 48f, proj.Center.Y); - Vector2 pos3 = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 44f); - Vector2 pos4 = new Vector2(proj.Center.X - (proj.width * 0.5f) - 49f, proj.Center.Y); + // 0 = Bottom, 1 = Left, 2 = Top, 3 = Right + // Why is 0 Bottom instead of Top? Hitbox alignment. switch (Projectile.ai[0]) { case 0: - Projectile.Center = pos1; + Projectile.Center = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 20f); break; case 1: - Projectile.Center = pos2; + Projectile.Center = new Vector2(proj.Center.X - (proj.width * 0.5f) - 20f, proj.Center.Y); break; case 2: - Projectile.Center = pos3; + Projectile.Center = new Vector2(proj.Center.X, proj.Center.Y - (proj.height * 0.5f) - 20f); break; case 3: - Projectile.Center = pos4; + Projectile.Center = new Vector2(proj.Center.X + (proj.width * 0.5f) + 20f, proj.Center.Y); break; default: break; } @@ -66,13 +63,13 @@ namespace CalamityMod.Projectiles.Magic switch (Projectile.ai[0]) { case 1: - Projectile.rotation = (MathHelper.Pi * 0.5f); + Projectile.rotation = MathHelper.PiOver2; break; case 2: Projectile.rotation = MathHelper.Pi; break; case 3: - Projectile.rotation = (MathHelper.Pi * 1.5f); + Projectile.rotation = MathHelper.Pi * 1.5f; break; default: break; } diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index ea0c2e3dde..4bc6077cae 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs index a1a816d07b..1e5b83411e 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailBlue.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailBlue.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs index 6114267a51..749b9ed2e1 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailGreen.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailGreen.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs index 3fc98ecb6c..222346e501 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailPurple.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailPurple.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Magic { SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/MadAlchemistsCocktailRed.cs b/Projectiles/Magic/MadAlchemistsCocktailRed.cs index 9a7fb721b2..d449802240 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailRed.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailRed.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); SoundEngine.PlaySound(SoundID.Item107, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 704, 1f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, -Projectile.oldVelocity * 0.2f, 705, 1f); diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index de520ad65e..aeb777d2c8 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -37,17 +38,13 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + int type = (i < 3 ? ModContent.ProjectileType() : ModContent.ProjectileType()); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, type, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); diff --git a/Projectiles/Magic/MeteorStar.cs b/Projectiles/Magic/MeteorStar.cs index e983295e45..b1fc470aa9 100644 --- a/Projectiles/Magic/MeteorStar.cs +++ b/Projectiles/Magic/MeteorStar.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Magic if (Main.rand.NextBool(4) || explodingSoon) SoundEngine.PlaySound(SoundID.Item9, Projectile.Center); } - if ((Main.rand.NextBool(12) || (explodingSoon && Main.rand.NextBool(3))) && Main.netMode != NetmodeID.Server) + if ((Main.rand.NextBool(12) || (explodingSoon && Main.rand.NextBool(3))) && !Main.dedServ) { Gore star = Gore.NewGoreDirect(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f, Main.rand.Next(16, 18), 1f); star.velocity *= 0.66f; @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Magic smoke.fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 5; i++) { diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index b0c6fe4ce1..76a251b329 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -53,19 +53,13 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - offset).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner); } } Projectile.penetrate--; diff --git a/Projectiles/Magic/RancorFog.cs b/Projectiles/Magic/RancorFog.cs index 5ef1397d9e..af5e72d30e 100644 --- a/Projectiles/Magic/RancorFog.cs +++ b/Projectiles/Magic/RancorFog.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.velocity *= 0.985f; // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. diff --git a/Projectiles/Magic/SparklingEmpressHoldout.cs b/Projectiles/Magic/SparklingEmpressHoldout.cs new file mode 100644 index 0000000000..8e544c347a --- /dev/null +++ b/Projectiles/Magic/SparklingEmpressHoldout.cs @@ -0,0 +1,212 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SparklingEmpressHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * -3; + public override float MaxOffsetLengthFromArm => 40f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float RecoilResolveSpeed => 0.5f; + public override float WeaponTurnSpeed => 0.05f; + + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float completion => ref Projectile.ai[1]; + public Color EffectsColor = Color.Cyan; + public bool hasLetGo = false; + public int time = 0; + public int postFireTimer = 0; + public bool deservesMana = false; + + public float GfbMult = 1; + public int cooldownTime => 20 * (deservesMana ? 2 : 1); + + public override void KillHoldoutLogic() + { + if (HeldItem.type != Owner.ActiveItem().type || Owner.dead) + Projectile.Kill(); + if (Owner.CantUseHoldout() && !hasLetGo) + postFireTimer = cooldownTime; + } + + public override void HoldoutAI() + { + if (Main.zenithWorld) + GfbMult = MathHelper.Clamp((int)(time / 60), 1, 7); + if (!hasLetGo) + { + if (shootingTimer >= (deservesMana && !Main.zenithWorld ? 6 : 3)) + { + if (Owner.CheckMana(HeldItem, (int)(HeldItem.mana * GfbMult), true, false)) + { + Shoot(); + shootingTimer = 0f; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + postFireTimer = cooldownTime; + } + } + + shootingTimer++; + + if (time >= 120) + deservesMana = true; + if (time == 120) + { + SoundStyle f = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); + for (int k = 0; k < 14; k++) + { + Vector2 vel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(5.1f, 8.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), vel); + dust2.scale = Main.rand.NextFloat(1.15f, 1.45f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(EffectsColor, Color.White, 0.5f) : EffectsColor; + } + } + } + time++; + + if (Main.zenithWorld) + { + if (!hasLetGo) + { + if (time % 60 == 0 && time > 120 && time <= 420) + { + SoundStyle f = new("CalamityMod/Sounds/Item/MeldShoot"); + SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); + } + if (time == 420) + { + SoundStyle warnSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGNukeWarning"); + SoundEngine.PlaySound(warnSound with { Volume = 0.7f, Pitch = 0.8f }, Projectile.Center); + } + // gfb texts + if (time == 1) + CombatText.NewText(Projectile.Hitbox, Color.SkyBlue, CalamityUtils.GetTextValue("Misc.Empress1")); + if (time == 300) + CombatText.NewText(Projectile.Hitbox, Color.DeepSkyBlue, CalamityUtils.GetTextValue("Misc.Empress2")); + if (time == 510) + CombatText.NewText(Projectile.Hitbox, Color.DodgerBlue, CalamityUtils.GetTextValue("Misc.Empress3")); + Owner.velocity += -Projectile.velocity * MathHelper.Lerp(GfbMult, 1, 0.6f) * 0.1f; + } + + if (time >= 540) + { + if (time < 600) + { + if (time % 10 == 0) + { + Particle boom = new CustomPulse(Projectile.Center, -Projectile.velocity * 0.3f, Color.DodgerBlue, "CalamityMod/Particles/BloomRing", new Vector2(1, 1f), 0, 0, 4, 10); + GeneralParticleHandler.SpawnParticle(boom); + SoundStyle f = new("CalamityMod/Sounds/Item/MeldExplosion"); + SoundEngine.PlaySound(f with { Volume = 0.5f, Pitch = 0.95f }, Projectile.Center); + for (int k = 0; k < 18; k++) + { + Projectile explode = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Vector2.One * 5).RotatedByRandom(100), ModContent.ProjectileType(), Projectile.damage * 5, Projectile.knockBack, Projectile.owner, 0, 0); + explode.hostile = true; + explode.extraUpdates = 3; + explode.tileCollide = false; + } + } + if (time % 3 == 0) + CombatText.NewText(Projectile.Hitbox, Color.Cyan, CalamityUtils.GetTextValue("Misc.Empress4")); + } + if (postFireTimer == 0) + postFireTimer = (cooldownTime * 5); + deservesMana = false; + } + } + + if (postFireTimer > 0) + PostFireEffect(); + } + public void PostFireEffect() + { + hasLetGo = true; + + if (deservesMana && postFireTimer % 8 == 0) + { + int manaGained = 24; + Owner.statMana += manaGained; + if (Main.myPlayer == Owner.whoAmI) + Owner.ManaEffect(manaGained); + + if (Owner.statMana > Owner.statManaMax2) + Owner.statMana = Owner.statManaMax2; + + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(GunTipPosition, (-Vector2.UnitY * Main.rand.NextFloat(3f, 5f)).RotatedByRandom(0.6f), "CalamityMod/Particles/HeartParticle", false, 45, Main.rand.NextFloat(0.9f, 1.2f), Color.Lerp(Color.Aqua, Color.DodgerBlue, i * 0.5f), Vector2.One, true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + OffsetLengthFromArm -= 9f; + + SoundStyle s = new("CalamityMod/Sounds/Custom/PistolShrimpBubbleBurst"); + SoundEngine.PlaySound(s with { Volume = 0.35f, Pitch = -postFireTimer * 0.01f, MaxInstances = -1 }, Projectile.Center); + } + if (deservesMana && (postFireTimer + 2) % 8 == 0) + { + Owner.HealPlayer(1); + } + if (postFireTimer == 1) + Projectile.Kill(); + postFireTimer--; + } + public void Shoot() + { + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); + Vector2 firingVelocity = (shootDirection * 4); + for (int k = 0; k < (int)(GfbMult); k++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition + firingVelocity * 5, firingVelocity.RotatedByRandom(Main.zenithWorld ? GfbMult * 0.08f : 0), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0); + + for (int k = 0; k < 4; k++) + { + Vector2 shootVel = (shootDirection * 15).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 1.8f); + + Dust dust2 = Dust.NewDustPerfect(GunTipPosition, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.75f, 0.9f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Lerp(EffectsColor, Color.White, 0.5f) : EffectsColor; + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D shineTex = ModContent.Request("CalamityMod/Particles/FullStar").Value; + + Vector2 vibration = (hasLetGo ? Vector2.Zero : (Main.rand.NextVector2Circular(2, 2) * (time >= 840 && Main.zenithWorld ? 4 : 1))); + + Main.EntitySpriteDraw(texture, drawPosition + vibration, null, Projectile.GetAlpha(lightColor), drawRotation + (MathHelper.ToRadians(45f * (Projectile.spriteDirection))), rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + if (deservesMana && !hasLetGo) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(shineTex, GunTipPosition - Main.screenPosition, null, Color.DodgerBlue with { A = 0 }, Projectile.rotation + MathHelper.ToRadians(45 * (i == 0 ? -1 : 1)), shineTex.Size() * 0.5f, new Vector2(0.9f, 2.5f) * Main.rand.NextFloat(0.7f, 1.1f) * MathHelper.Lerp(GfbMult, 1, 0.6f), SpriteEffects.None, 0); + } + return false; + } + } +} diff --git a/Projectiles/Magic/SparklingLaser.cs b/Projectiles/Magic/SparklingLaser.cs index a969a6d5f9..4a6cbb038c 100644 --- a/Projectiles/Magic/SparklingLaser.cs +++ b/Projectiles/Magic/SparklingLaser.cs @@ -1,238 +1,85 @@ -using System; -using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; -using Terraria.Audio; -using Terraria.Enums; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { - public class SparklingLaser : BaseLaserbeamProjectile, ILocalizedModType + public class SparklingLaser : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public bool playedSound = false; - public const int ChargeupTime = 50; - - public Player Owner => Main.player[Projectile.owner]; - public override Color LightCastColor => new Color(204, 204, 255); //#CCCCFF - public override float Lifetime => 18000f; - public override float MaxScale => 1f; - public override float MaxLaserLength => 1600f; //100 tiles - public override Texture2D LaserBeginTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserBegin", AssetRequestMode.ImmediateLoad).Value; - public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserMid", AssetRequestMode.ImmediateLoad).Value; - public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/SparklingLaserEnd", AssetRequestMode.ImmediateLoad).Value; - private const float AimResponsiveness = 0.8f; // Last Prism is 0.92f. Lower makes the laser turn faster. - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 5; - } - + public ref float time => ref Projectile.ai[0]; + public bool isSplit => Projectile.ai[1] == 5; + public ref NPC targeted => ref Main.npc[(int)Projectile.ai[2]]; + public Color mainColor = Color.Cyan; public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 25; + Projectile.height = 25; Projectile.friendly = true; Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.hide = true; - Projectile.timeLeft = 18000; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 20; + Projectile.penetrate = 1; + Projectile.tileCollide = true; + Projectile.timeLeft = 300; + Projectile.ArmorPenetration = 20; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 3; } - - public override void DetermineScale() + public override void AI() { - Projectile.scale = Time < ChargeupTime ? 0f : MaxScale; + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time == 0) + { + mainColor = Main.rand.NextBool() ? Color.Cyan : Color.DodgerBlue; + } + if (targetDist < 1400) + { + float beamSize = (isSplit ? 0.4f : 1f); + Particle beamBody = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 65, Projectile.velocity * 0.05f, "CalamityMod/Particles/Crack", false, (int)(7 * (isSplit ? 2 : 1)), 0.15f * beamSize, mainColor * 0.7f, new Vector2(0.7f, 1.4f), true, true, extraRotation: MathHelper.ToRadians(180), shrinkSpeed: (isSplit ? 0.4f : 1.1f), glowCenterScale: 0.7f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(beamBody); + } + if (isSplit) + { + Projectile.velocity *= 0.98f; + } + else if (Projectile.velocity.Length() < 9) + { + Projectile.velocity *= 1.01f; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.035f); + } + time++; } - - public override float DetermineLaserLength() + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - return DetermineLaserLength_CollideWithTiles(5); - } - - public override bool PreAI() - { - // Multiplayer support here, only run this code if the client running it is the owner of the projectile - if (Projectile.owner == Main.myPlayer) + if (!isSplit) { - Vector2 rrp = Owner.RotatedRelativePoint(Owner.MountedCenter, true); - UpdateAim(rrp); - Projectile.direction = Main.MouseWorld.X > Owner.Center.X ? 1 : -1; - Projectile.netUpdate = true; - } - - int dir = Projectile.direction; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.Center = Owner.Center + Projectile.velocity * 56f; //Distance offset - Projectile.timeLeft = 18000; //Infinite lifespan - Owner.ChangeDir(dir); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - Owner.itemRotation = ((Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * -Owner.direction).ToRotation(); - - if (!Owner.channel) - { - Projectile.Kill(); - return false; - } - // Do we still have enough mana? If not, we kill the projectile because we cannot use it anymore - if (Owner.miscCounter % 10 == 0 && !Owner.CheckMana(Owner.ActiveItem(), -1, true)) - { - Projectile.Kill(); - return false; - } - - if (Time < ChargeupTime) - { - // Crate charge-up dust. - int dustCount = (int)(Time / 20f); - Vector2 spawnPos = Projectile.Center; - for (int k = 0; k < dustCount + 1; k++) + Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7; + Projectile splitProj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (shootDirection).RotatedByRandom(0.4f) * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0, 5, target.whoAmI); + splitProj.timeLeft = 120; + splitProj.penetrate = -1; + splitProj.extraUpdates = 2; + for (int k = 0; k < 3; k++) { - Dust dust = Dust.NewDustDirect(spawnPos, 1, 1, DustID.Electric, Projectile.velocity.X / 2f, Projectile.velocity.Y / 2f); - dust.position += Main.rand.NextVector2Square(-10f, 10f); - dust.velocity = Main.rand.NextVector2Unit() * (10f - dustCount * 2f) / 10f; - dust.scale = Main.rand.NextFloat(0.5f, 1f); - dust.noGravity = true; - } - Time++; - return false; - } + Vector2 shootVel = (shootDirection).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 1.8f); - // Play a cool sound when fully charged. - if (!playedSound) - { - SoundEngine.PlaySound(SoundID.Item68, Projectile.Center); - playedSound = true; - } - return true; - } - - public override void PostAI() - { - // Determine frames. - Projectile.frameCounter++; - if (Projectile.frameCounter % 5f == 4f) - Projectile.frame = (Projectile.frame + 1) % Main.projFrames[Type]; - } - - // Gently adjusts the aim vector of the laser to point towards the mouse. - private void UpdateAim(Vector2 source) - { - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 aimVector = Vector2.Normalize(Main.MouseWorld - source); - if (aimVector.HasNaNs()) - aimVector = -Vector2.UnitY; - aimVector = Vector2.Normalize(Vector2.Lerp(aimVector, Vector2.Normalize(Projectile.velocity), AimResponsiveness)); - - if (aimVector != Projectile.velocity) - Projectile.netUpdate = true; - Projectile.velocity = aimVector; - } - - public override bool ShouldUpdatePosition() => false; - - public override bool? CanDamage() => Time >= ChargeupTime; - - // Update CutTiles so the laser will cut tiles (like grass). - public override void CutTiles() - { - DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; - Vector2 unit = Projectile.velocity; - Utils.PlotTileLine(Projectile.Center, Projectile.Center + unit * LaserLength, Projectile.width + 16, DelegateMethods.CutTiles); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (target.life <= 0 && target.lifeMax > 5 && Projectile.owner == Main.myPlayer) - { - int shardDamage = Projectile.damage / 5; - int shardAmt = Main.rand.Next(2, 4); - for (int s = 0; s < shardAmt; s++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, velocity, ModContent.ProjectileType(), shardDamage, 0f, Projectile.owner); - if (shard.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard].DamageType = DamageClass.Magic; + Dust dust2 = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), shootVel); + dust2.scale = Main.rand.NextFloat(0.9f, 1.15f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.DodgerBlue : Color.Cyan; } } + target.AddBuff(ModContent.BuffType(), (isSplit ? 60 : 120)); + + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } - - public override bool PreDraw(ref Color lightColor) - { - // This should never happen, but just in case- - if (Projectile.velocity == Vector2.Zero || Time < ChargeupTime) - return false; - - Color beamColor = LaserOverlayColor; - Rectangle startFrameArea = LaserBeginTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Rectangle middleFrameArea = LaserMiddleTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Rectangle endFrameArea = LaserEndTexture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - - // Start texture drawing. - // This is a lot more scuffed than other lasers... for some reason I'll try not to think about right now. - Vector2 laserBeginCenter = Projectile.Center - Main.screenPosition + Projectile.velocity * Projectile.scale * 50f; - Main.EntitySpriteDraw(LaserBeginTexture, - laserBeginCenter, - startFrameArea, - beamColor, - Projectile.rotation, - LaserBeginTexture.Size() / 2f, - Projectile.scale, - SpriteEffects.None, - 0); - - // Prepare things for body drawing. - float laserBodyLength = LaserLength; - laserBodyLength -= (startFrameArea.Height / 2 + endFrameArea.Height) * Projectile.scale; - Vector2 centerOnLaser = Projectile.Center - Main.screenPosition; - centerOnLaser += Projectile.velocity * Projectile.scale * 10.5f; - - // Body drawing. - if (laserBodyLength > 0f) - { - float laserOffset = middleFrameArea.Height * Projectile.scale; - float incrementalBodyLength = 0f; - while (incrementalBodyLength + 1f < laserBodyLength) - { - centerOnLaser += Projectile.velocity * laserOffset; - incrementalBodyLength += laserOffset; - Main.EntitySpriteDraw(LaserMiddleTexture, - centerOnLaser, - middleFrameArea, - beamColor, - Projectile.rotation, - LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, - Projectile.scale, - SpriteEffects.None, - 0); - } - } - - // End texture drawing. - if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) - { - Main.EntitySpriteDraw(LaserEndTexture, - centerOnLaser, - endFrameArea, - beamColor, - Projectile.rotation, - LaserEndTexture.Frame(1, 1, 0, 0).Top(), - Projectile.scale, - SpriteEffects.None, - 0); - } - return false; - } + public override bool? CanHitNPC(NPC target) => (target == targeted && isSplit) ? false : null; } } diff --git a/Projectiles/Magic/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index c23a73f8d4..d1f2164ad8 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Magic ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 028a3a5681..79df19ea9c 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -125,15 +125,11 @@ namespace CalamityMod.Projectiles.Magic break; case 2f: - float spread = 30f * 0.01f * MathHelper.PiOver2; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(source, Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - offset).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } break; } diff --git a/Projectiles/Magic/WaywasherProj.cs b/Projectiles/Magic/WaywasherProj.cs index 83e2a7f9b6..cec445d21b 100644 --- a/Projectiles/Magic/WaywasherProj.cs +++ b/Projectiles/Magic/WaywasherProj.cs @@ -1,64 +1,139 @@ -using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Magic { public class WaywasherProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float time => ref Projectile.ai[0]; + public int dir = 0; + public bool returning = false; public override void SetDefaults() { - Projectile.width = 16; - Projectile.height = 16; + Projectile.width = 55; + Projectile.height = 55; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.alpha = 0; - Projectile.penetrate = 2; - Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 225; Projectile.DamageType = DamageClass.Magic; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.extraUpdates = 2; } - public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f * (float)Projectile.direction; - Lighting.AddLight(Projectile.Center, 0f, 0.1f, 0.7f); - for (int i = 0; i < 2; i++) + if (time == 0) + dir = (int)Projectile.ai[1]; + if (time == 4) { - float shortXVel = Projectile.velocity.X / 3f * (float)i; - float shortYVel = Projectile.velocity.Y / 3f * (float)i; - int fourConst = 4; - int waterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)fourConst, Projectile.position.Y + (float)fourConst), Projectile.width - fourConst * 2, Projectile.height - fourConst * 2, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 1.2f); - Dust dust = Main.dust[waterDust]; - dust.noGravity = true; - dust.velocity *= 0.1f; - dust.velocity += Projectile.velocity * 0.1f; - dust.position.X -= shortXVel; - dust.position.Y -= shortYVel; + Particle fadeInfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 13, 0.75f, Color.White, new Vector2(1, 1f), true, false, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(fadeInfx); + for (int i = 0; i < 3; i++) + { + Particle fadeInfx2 = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f), "CalamityMod/Particles/WaterFoam", true, 13, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(fadeInfx2); + } + } + Lighting.AddLight(Projectile.Center, Color.RoyalBlue.ToVector3() * 0.7f); + + // Slows down and decays if it's inside tiles + if (Collision.SolidCollision(Projectile.Center, 20, 20)) + { + Projectile.velocity *= 0.95f; + Projectile.timeLeft = (int)(Projectile.timeLeft * 0.9f); + } + + // I hate this but it's the only way to make it move in the very specific way it needs to + int timeValue = (int)(time / 12); + float turnMult = timeValue switch + { + 0 => 0.05f, + 1 => 0.1f, + 2 => 0.2f, + 3 => -0.2f, + 4 => -0.3f, + 5 => -0.4f, + 6 => -0.6f, + 7 => -0.9f, + 8 => -1.13f, + _ => -1.7f, + }; + if (timeValue == 9) + { + returning = true; + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + } + Projectile.velocity = Projectile.velocity.RotatedBy(0.2f * turnMult * dir); + + // Making things look convincingly "watery" takes a lot of visual work... + Visuals(); + + time += returning ? -1 : 1; + } + public void Visuals() + { + if (Main.rand.NextBool()) + { + // If you're looking at this to use the water effects, this is the main one I recommend you take + Particle waterfx = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.7f, "CalamityMod/Particles/WaterFoam", false, 9, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(waterfx); + } + + Particle projBody = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, -Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 6, 0.3f, Color.RoyalBlue, new Vector2(1, 1f), true, false, shrinkSpeed: 0.5f); + GeneralParticleHandler.SpawnParticle(projBody); + + Vector2 tip = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 35; + Particle seafoam = new CustomSpark(tip, Projectile.velocity * Main.rand.NextFloat(0.7f, 0.9f), "CalamityMod/Particles/BloomCircle", false, 2, Main.rand.NextFloat(0.35f, 0.45f), Color.White, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-0.4f, 0.4f)); + GeneralParticleHandler.SpawnParticle(seafoam); + if (Main.rand.NextBool(10)) + { + for (int i = 0; i < 2; i++) + { + Particle smallSeafoam = new CustomSpark(tip, -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.4f), "CalamityMod/Particles/BloomCircle", true, 15, Main.rand.NextFloat(0.12f, 0.18f), Color.White * 0.7f, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1)); + GeneralParticleHandler.SpawnParticle(smallSeafoam); + + Dust dust = Dust.NewDustPerfect(tip + Main.rand.NextVector2Circular(8, 8), ModContent.DustType(), -Projectile.velocity.RotatedByRandom(0.5f) * Main.rand.NextFloat(0.9f, 1.4f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 0.8f); + dust.color = Color.White; + dust.noLightEmittence = true; + } } if (Main.rand.NextBool(5)) { - int otherFourConst = 4; - int otherWaterDust = Dust.NewDust(new Vector2(Projectile.position.X + (float)otherFourConst, Projectile.position.Y + (float)otherFourConst), Projectile.width - otherFourConst * 2, Projectile.height - otherFourConst * 2, DustID.Water, 0f, 0f, 0, new Color(64, 224, 208), 0.6f); - Main.dust[otherWaterDust].velocity *= 0.25f; - Main.dust[otherWaterDust].velocity += Projectile.velocity * 0.5f; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 12 + Main.rand.Next(8); + bubble.scale = Main.rand.NextFloat(0.5f, 0.9f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + target.AddBuff(ModContent.BuffType(), 120); + float minMult = 0.1f; + int hitsToMinMult = 5; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; + } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - for (int k = 0; k < 10; k++) + Particle fadeOutfx = new CustomSpark(Projectile.Center, Projectile.velocity * 0.3f, "CalamityMod/Particles/BloomCircle", false, 13, 0.75f, Color.White, new Vector2(1, 1f), true, false, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(fadeOutfx); + for (int i = 0; i < 3; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Water, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f, 0, new Color(0, 142, 255), 1f); + Particle fadeOutfx2 = new CustomSpark(Projectile.Center, Projectile.velocity.RotatedByRandom(0.4f), "CalamityMod/Particles/WaterFoam", true, 13, 0.45f, Color.DeepSkyBlue, new Vector2(1, 1f), true, false, extraRotation: Main.rand.NextFloat(-1, 1), shrinkSpeed: 0.1f); + GeneralParticleHandler.SpawnParticle(fadeOutfx2); } } } diff --git a/Projectiles/Magic/WaywasherProj.png b/Projectiles/Magic/WaywasherProj.png deleted file mode 100644 index 115a36bf88..0000000000 Binary files a/Projectiles/Magic/WaywasherProj.png and /dev/null differ diff --git a/Projectiles/Magic/WyvernProjectile.cs b/Projectiles/Magic/WyvernProjectile.cs index 8900d5bdd0..e1e5c9c80a 100644 --- a/Projectiles/Magic/WyvernProjectile.cs +++ b/Projectiles/Magic/WyvernProjectile.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Magic { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Cloud, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int head = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.8f, Mod.Find("WyvernHead").Type); Main.gore[head].timeLeft /= 10; diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index 7c811c7501..105a0a852e 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -174,7 +174,7 @@ namespace CalamityMod.Projectiles.Magic ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index dfbfc0db3d..d798f5435c 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int starGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starGore].velocity *= 0.66f; @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Melee/BonebreakerProjectile.cs b/Projectiles/Melee/BonebreakerProjectile.cs index 4e3dd6de31..765c4831b3 100644 --- a/Projectiles/Melee/BonebreakerProjectile.cs +++ b/Projectiles/Melee/BonebreakerProjectile.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -89,14 +90,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(BuffID.BoneJavelin, 180); + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 90); target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.BoneJavelin, 180); + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 90); target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index e75c10b4c5..414c822892 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; @@ -57,18 +58,12 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.numHits < 1) { - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Melee/DragonRageFireball.cs b/Projectiles/Melee/DragonRageFireball.cs index ff741f31f5..40ea618ffa 100644 --- a/Projectiles/Melee/DragonRageFireball.cs +++ b/Projectiles/Melee/DragonRageFireball.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index e2d37191ad..5582b11828 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -235,7 +235,8 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { - pause = 6; + // This was used to give some "Hitstop" on hit, but it looks a bit strange so it's on hold + //pause = 6; for (int i = 0; i < 5; i++) { Particle spark = new GlowSparkParticle(target.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * (-25), false, 12, 0.12f - i * 0.025f, mainColor, new Vector2(3.75f, 0.9f), true, false, 1.15f); diff --git a/Projectiles/Melee/ElementalGlassStar.cs b/Projectiles/Melee/ElementalGlassStar.cs index 8c711f571f..940d229889 100644 --- a/Projectiles/Melee/ElementalGlassStar.cs +++ b/Projectiles/Melee/ElementalGlassStar.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int starGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starGore].velocity *= 0.66f; @@ -132,7 +132,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(spark); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs index 0274780ffe..7da3f79836 100644 --- a/Projectiles/Melee/ForbiddenOathbladeProjectile.cs +++ b/Projectiles/Melee/ForbiddenOathbladeProjectile.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = Alpha; Projectile.timeLeft = TimeLeft; Projectile.ignoreWater = true; + Projectile.tileCollide = false; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 3; @@ -45,6 +46,9 @@ namespace CalamityMod.Projectiles.Melee float alphaLightScale = Projectile.alpha / (float)Alpha; Lighting.AddLight(Projectile.Center, 0.5f * alphaLightScale, 0f, 0.5f * alphaLightScale); + if (Projectile.timeLeft < TimeLeft - 30) + Projectile.tileCollide = true; + if (Projectile.timeLeft > FadeOutTime) { if (Projectile.velocity.Length() < MaxVelocity) diff --git a/Projectiles/Melee/GalileosPlanet.cs b/Projectiles/Melee/GalileosPlanet.cs index 5cf1d49137..5a1b7ac0d9 100644 --- a/Projectiles/Melee/GalileosPlanet.cs +++ b/Projectiles/Melee/GalileosPlanet.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Melee/GhastlySoulLarge.cs b/Projectiles/Melee/GhastlySoulLarge.cs index 085ce42998..0aad553929 100644 --- a/Projectiles/Melee/GhastlySoulLarge.cs +++ b/Projectiles/Melee/GhastlySoulLarge.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Type] = 4; + Main.projFrames[Type] = 5; ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 5; ProjectileID.Sets.TrailingMode[Type] = 2; @@ -28,8 +28,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -48,14 +47,7 @@ namespace CalamityMod.Projectiles.Melee HomingBuff -= 0.01f; Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.frame = 0; - + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) diff --git a/Projectiles/Melee/GhastlySoulLarge.png b/Projectiles/Melee/GhastlySoulLarge.png index 417c094b01..af33deded8 100644 Binary files a/Projectiles/Melee/GhastlySoulLarge.png and b/Projectiles/Melee/GhastlySoulLarge.png differ diff --git a/Projectiles/Melee/GhastlySoulMedium.cs b/Projectiles/Melee/GhastlySoulMedium.cs index 874f2f8820..c168ae37db 100644 --- a/Projectiles/Melee/GhastlySoulMedium.cs +++ b/Projectiles/Melee/GhastlySoulMedium.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Type] = 4; + Main.projFrames[Type] = 5; ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 5; ProjectileID.Sets.TrailingMode[Type] = 2; @@ -28,8 +28,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -48,14 +47,7 @@ namespace CalamityMod.Projectiles.Melee HomingBuff -= 0.01f; Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.frame = 0; - + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) diff --git a/Projectiles/Melee/GhastlySoulMedium.png b/Projectiles/Melee/GhastlySoulMedium.png index f9a5111949..6e84788360 100644 Binary files a/Projectiles/Melee/GhastlySoulMedium.png and b/Projectiles/Melee/GhastlySoulMedium.png differ diff --git a/Projectiles/Melee/GhastlySoulSmall.cs b/Projectiles/Melee/GhastlySoulSmall.cs index 8a37f9eae7..1458537533 100644 --- a/Projectiles/Melee/GhastlySoulSmall.cs +++ b/Projectiles/Melee/GhastlySoulSmall.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetStaticDefaults() { - Main.projFrames[Type] = 4; + Main.projFrames[Type] = 5; ProjectileID.Sets.CultistIsResistantTo[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 5; ProjectileID.Sets.TrailingMode[Type] = 2; @@ -29,8 +29,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.width = 30; - Projectile.height = 30; + Projectile.width = Projectile.height = 32; Projectile.alpha = 100; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -49,14 +48,7 @@ namespace CalamityMod.Projectiles.Melee HomingBuff -= 0.01f; Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.frame = 0; - + Projectile.frame = Projectile.frameCounter / 5 % Main.projFrames[Type]; Lighting.AddLight(Projectile.Center, 0.5f, 0.2f, 0.9f); if (Projectile.timeLeft % 2 == 0 && Projectile.timeLeft < TimeLeft - 10) diff --git a/Projectiles/Melee/GhastlySoulSmall.png b/Projectiles/Melee/GhastlySoulSmall.png index 96f62a52d5..d4c94bce06 100644 Binary files a/Projectiles/Melee/GhastlySoulSmall.png and b/Projectiles/Melee/GhastlySoulSmall.png differ diff --git a/Projectiles/Melee/GreenWater.cs b/Projectiles/Melee/GreenWater.cs index 8341347563..eeb9a90d56 100644 --- a/Projectiles/Melee/GreenWater.cs +++ b/Projectiles/Melee/GreenWater.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee } if (Projectile.ai[0] == 0) // "Jaw" teeth { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } for (int i = 0; i <= 4; i++) { diff --git a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs index 5941aa2188..d1da4b4c20 100644 --- a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs +++ b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails base.SetDefaults(); } - public override void ExtraBehavior() + public override bool ExtraBehavior() { // Randomly play grass sounds idly if it is moving/spinning if ((CurrentFlailState == FlailState.Spinning || Projectile.velocity.Length() > 2f) && Projectile.soundDelay <= 0) @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails AuraScale = MathHelper.Clamp(AuraScale + 1f / MaxAuraTime, 0f, 1f); if (AuraScale < 0.15f) - return; + return true; // The dust machine for (int i = 0; i < (int)(10 * AuraScale); i++) @@ -78,6 +78,8 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails } else AuraScale = MathHelper.Clamp(AuraScale - 3f / MaxAuraTime, 0f, 1f); + + return true; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/UrchinMaceProjectile.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs similarity index 54% rename from Projectiles/Melee/UrchinMaceProjectile.cs rename to Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 619af44ec1..17eb3bd5ad 100644 --- a/Projectiles/Melee/UrchinMaceProjectile.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -1,64 +1,73 @@ using System; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee +namespace CalamityMod.Projectiles.Melee.MaceFlails { - public class UrchinMaceProjectile : ModProjectile, ILocalizedModType + public class UrchinMaceProj : BaseMaceFlailProjectile { - public new string LocalizationCategory => "Projectiles.Melee"; - public Player Owner => Main.player[Projectile.owner]; + // The entire chain is on the mace sprite, in which the player swings public override string Texture => "CalamityMod/Items/Weapons/Melee/UrchinMace"; + public override string ChainTexturePath => string.Empty; - public static float MaxWindup = 110; - public ref float Windup => ref Projectile.ai[0]; - public float WindupProgress => MathHelper.Clamp(Windup, 0, MaxWindup) / MaxWindup; - public static float whirlpoolDamageMultiplier = 2f; + // This flail only runs through one state (spin), thereby making most parameters unnecessary to fill out + public override int AssociatedItemID => ModContent.ItemType(); + public override int SpinIFrames => 15; + public override float SpinHitboxRadius => 64f; + public override float SpinVerticalFactor => 1f; // This flail moves circular + public override float LaunchSpeed => 22f; + + public static float MaxWindup = 45f; public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 60; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 60; + base.SetDefaults(); + Projectile.localNPCHitCooldown = SpinIFrames * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.ownerHitCheck = true; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + public override void SpinAI(float launchSpeed) { - //Prevent spam click abuse - if (Windup < Projectile.localNPCHitCooldown) - return false; + float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; + if (Projectile.owner == Main.myPlayer) + { + // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = Owner.MountedCenter.DirectionTo(Main.MouseWorld).SafeNormalize(Vector2.UnitX * Owner.direction); + Owner.ChangeDir((toMouse.X > 0f).ToDirectionInt()); + if (!Owner.channel && WindupProgress >= 1f) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, toMouse * launchSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * LaunchDamage), Projectile.knockBack, Projectile.owner); + SoundEngine.PlaySound(SoundID.Item7, Owner.MountedCenter); + Projectile.Kill(); + return; + } - float collisionPoint = 0f; - float bladeLength = 70 * Projectile.scale; - float bladeWidth = 30 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.rotation.ToRotationVector2() * bladeLength), bladeWidth, ref collisionPoint); - } - - public override void AI() - { - Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); + if (StateTimer == MaxWindup) + { + for (int i = 0; i < 25; i++) + { + Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); + Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; + } + } + } Projectile.velocity = Vector2.Zero; - Projectile.rotation += (WindupProgress * MathHelper.PiOver4 / 1.5f) * Owner.direction; - - if (Owner.channel) - { - Projectile.timeLeft = 2; - UpdateOwnerVars(); - } + Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; if (WindupProgress > 0.5f) { @@ -73,31 +82,17 @@ namespace CalamityMod.Projectiles.Melee } } - Projectile.Center = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 10f - Vector2.UnitX * 4 * Owner.direction; + StateTimer++; + } + public override bool ExtraBehavior() + { if (Projectile.soundDelay <= 0) { SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce, Owner.MountedCenter); Projectile.soundDelay = 28; } - if (Windup == MaxWindup && Owner.whoAmI == Main.myPlayer) - { - SoundEngine.PlaySound(SoundID.Item43, Owner.MountedCenter); - - for (int i = 0; i < 25; i++) - { - Vector2 dustPos = Owner.position + Main.rand.NextVector2FromRectangle(Owner.Hitbox); - Dust dust = Dust.NewDustPerfect(dustPos, 176, Vector2.UnitY * -5f * Main.rand.NextFloat(1f, 2f) + Owner.velocity, Scale: Main.rand.NextFloat(1f, 2f)); - dust.noGravity = true; - } - } - - Windup++; - } - - public void UpdateOwnerVars() - { float armPointingDirection = ((Owner.Calamity().mouseWorld - Owner.MountedCenter).ToRotation()); //"crop" the rotation so the player only points their arm in a smaller range. (The back arm points in the throw direction) @@ -111,12 +106,13 @@ namespace CalamityMod.Projectiles.Melee armPointingDirection = -MathHelper.Pi + MathHelper.PiOver4 * 1.5f * Utils.GetLerpValue(-MathHelper.Pi, -MathHelper.PiOver4, armPointingDirection, true); } - Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armPointingDirection - MathHelper.PiOver2); Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); + + Projectile.timeLeft = 2; Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; + Owner.SetDummyItemTime(2); + return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -130,26 +126,15 @@ namespace CalamityMod.Projectiles.Melee } } - //If we don't do that, the hit enemies get knocked back towards you if you hit them from the right?? - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - // This would knock enemies away consistently, but i'm choosing to go with the other option - //hitDirection = Math.Sign(target.Center.X - Owner.Center.X); - - //Doing it this way lets the player choose if they want to knockback enemies towards them by pointing away from them - modifiers.HitDirectionOverride = Owner.direction; - } - public override bool PreDraw(ref Color lightColor) { - Owner.ChangeDir(Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X)); - - Texture2D maceTexture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Texture2D whirlpoolTexture = ModContent.Request("CalamityMod/Projectiles/Melee/RedtideWhirlpool").Value; + Texture2D maceTexture = TextureAssets.Projectile[Type].Value; + Texture2D whirlpoolTexture = TextureAssets.Projectile[ModContent.ProjectileType()].Value; + float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f; - float whirlpoolOpacity = WindupProgress * 0.2f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; - float whirlpoolRotation = Windup * 0.34f * Owner.direction; + float whirlpoolOpacity = WindupProgress * 0.2f + MathF.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; + float whirlpoolRotation = StateTimer * 0.34f * Owner.direction; SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity * 0.3f, whirlpoolRotation * 1.2f, whirlpoolTexture.Size() / 2f, whirlpoolScale, flip, 0); @@ -158,20 +143,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 handleOrigin = new Vector2(0, maceTexture.Height); float maceRotation = Projectile.rotation + MathHelper.PiOver4; Main.EntitySpriteDraw(maceTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), maceRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0); - return false; } - - public override void OnKill(int timeLeft) - { - //Spawn a whirlpool typhoon after sending it out - if (WindupProgress >= 1f && Projectile.owner == Main.myPlayer) - { - // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Main.MouseWorld - Owner.position).SafeNormalize(Vector2.One) * 25f, ModContent.ProjectileType(), (int)(Projectile.damage * whirlpoolDamageMultiplier), Projectile.knockBack, Projectile.owner, 0, 0f); - } - - SoundEngine.PlaySound(SoundID.Item7, Projectile.position); - } } } diff --git a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs index 3b78e442ef..1073486d6b 100644 --- a/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs +++ b/Projectiles/Melee/MaceFlails/YateveoBloomMace.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails base.SetDefaults(); } - public override void ExtraBehavior() + public override bool ExtraBehavior() { if (Main.rand.NextBool(3)) { @@ -37,6 +37,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails spore.noGravity = true; spore.scale = 1.5f; } + return true; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs index db79a3a927..bdf5b9b823 100644 --- a/Projectiles/Melee/MantisClawSlash.cs +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -16,6 +16,7 @@ using Terraria.DataStructures; using System.Collections.Generic; using CalamityMod.Graphics.Primitives; using Terraria.Graphics.Shaders; +using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee { @@ -91,6 +92,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], MathHelper.TwoPi * dir, 0.15f); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override bool? CanDamage() { diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index be9c4ce20d..3f656010c7 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee 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 ref int EmpoweredHammer => ref Main.player[Projectile.owner].Calamity().Holyhammer; public override void SetStaticDefaults() { diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index 1365f97247..e3515eca78 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -82,18 +82,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 1; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index 42d3b112e9..0b983a87b8 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -42,6 +42,16 @@ namespace CalamityMod.Projectiles.Melee Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f)); dust.noGravity = true; } + + Vector2 trailOffset = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(40f, 48f); + Dust trail = Dust.NewDustPerfect(Projectile.Center + trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 3f); + trail.alpha = Main.rand.Next(120, 180 + 1); + trail = Dust.NewDustPerfect(Projectile.Center - trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); + trail.noGravity = true; + trail.scale = Main.rand.NextFloat(0.8f, 3f); + trail.alpha = Main.rand.Next(120, 180 + 1); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/RemsRevengeExplosion.cs b/Projectiles/Melee/RemsRevengeExplosion.cs index 3d1c9452c0..2a44122aa2 100644 --- a/Projectiles/Melee/RemsRevengeExplosion.cs +++ b/Projectiles/Melee/RemsRevengeExplosion.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; namespace CalamityMod.Projectiles.Melee { @@ -12,6 +13,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public ref float Time => ref Projectile.ai[0]; + public override void SetDefaults() { Projectile.width = Projectile.height = 80; @@ -19,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.timeLeft = 5; + Projectile.timeLeft = 20; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -27,21 +31,42 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.ai[1] > 0f) - return; - - // Makeshift metal-blood explosion sound that is good enough ig - SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); - for (int p = 0; p < 10; p++) + if (Time == 0f) { - Vector2 velocity = (-Vector2.UnitY).RotatedByRandom(MathHelper.ToRadians(75f)) * Main.rand.NextFloat(4f, 6f); - float scale = Main.rand.NextFloat(0.6f, 2f); - Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); - GeneralParticleHandler.SpawnParticle(blood); + // Makeshift metal-blood explosion sound that is good enough ig + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/Ravager/RavagerStomp", 2) { Pitch = -0.75f, PitchVariance = 0.5f }, Projectile.Center); + + for (int i = 0; i < 5; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 5, i, true)), "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.5f + 0.03f * i, (int)(20 - i * 1.5f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + for (int i = 0; i < 3; i++) + { + Particle explosion = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.DarkRed, Color.Red, Utils.GetLerpValue(0, 3, i, true)), "CalamityMod/Projectiles/FireProj", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 2f + 0.22f * i, (int)(20 - i * 2f)); + GeneralParticleHandler.SpawnParticle(explosion); + } + + Particle outerGlow = new CustomPulse(Projectile.Center, Vector2.Zero, Color.RosyBrown, "CalamityMod/Particles/BloomCircle", Vector2.One, 0f, 0.1f, 2f, 24, true); + GeneralParticleHandler.SpawnParticle(outerGlow); + + for (int p = 0; p < 16; p++) + { + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(8f, 12f); + float scale = Main.rand.NextFloat(0.6f, 2f); + Particle blood = new BloodParticle(Projectile.Center, velocity, 30, scale, Color.DarkRed); + GeneralParticleHandler.SpawnParticle(blood); + } } - Projectile.ai[1]++; + + Projectile.scale = MathHelper.Lerp(0f, 1f, PiecewiseAnimation(Time / 20f, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) })); + Time++; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CircularHitboxCollision(Projectile.Center, Projectile.width * Projectile.scale, targetHitbox); } } diff --git a/Projectiles/Melee/RespiteblockBlood.cs b/Projectiles/Melee/RespiteblockBlood.cs index 2a3e81ca9b..5cee5c6c73 100644 --- a/Projectiles/Melee/RespiteblockBlood.cs +++ b/Projectiles/Melee/RespiteblockBlood.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45, targetHitbox); } diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs index 239d3bbccc..5e691dfb7b 100644 --- a/Projectiles/Melee/RespiteblockHoldout.cs +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 500); + target.AddBuff(ModContent.BuffType(), 500); Player player = Main.player[Projectile.owner]; Vector2 spawnPos = Projectile.Center + (Projectile.velocity.RotatedBy(MathHelper.ToRadians(45f * Projectile.direction)) * 10) + Main.rand.NextVector2Circular(13, 13); diff --git a/Projectiles/Melee/ScourgeoftheCosmosProj.cs b/Projectiles/Melee/ScourgeoftheCosmosProj.cs index 4767611827..813b2ed575 100644 --- a/Projectiles/Melee/ScourgeoftheCosmosProj.cs +++ b/Projectiles/Melee/ScourgeoftheCosmosProj.cs @@ -33,25 +33,19 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.alpha <= 200) { - int inc; - for (int i = 0; i < 2; i = inc + 1) + for (int i = 0; i < 2; i++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - float shortXVel = Projectile.velocity.X / 4f * i; - float shortYVel = Projectile.velocity.Y / 4f * i; - int scourgeDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Main.dust[scourgeDust].position.X = Projectile.Center.X - shortXVel; - Main.dust[scourgeDust].position.Y = Projectile.Center.Y - shortYVel; - Dust dust = Main.dust[scourgeDust]; - dust.velocity *= 0f; - Main.dust[scourgeDust].scale = 0.7f; - inc = i; + Dust scourgeDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); + scourgeDust.position = Projectile.Center - Projectile.velocity * i * 0.25f; + scourgeDust.velocity *= 0f; + scourgeDust.scale = 0.7f; } } Projectile.alpha -= 50; if (Projectile.alpha < 0) Projectile.alpha = 0; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver4; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 180f) { @@ -82,18 +76,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity.Y = -oldVelocity.Y; if (Projectile.owner == Main.myPlayer) { - int minisAmt = 1; - if (Main.rand.NextBool(10)) - minisAmt++; - int inc; - for (int j = 0; j < minisAmt; j = inc + 1) + int minisAmt = Main.rand.Next(1, 2 + 1); + for (int j = 0; j < minisAmt; j++) { - float randXDirect = Main.rand.Next(-35, 36) * 0.02f; - float randYDirect = Main.rand.Next(-35, 36) * 0.02f; - randXDirect *= 10f; - randYDirect *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randXDirect, randYDirect, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Main.myPlayer); - inc = j; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Projectile.owner); } } } @@ -103,40 +89,27 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCHit4, Projectile.position); - int inc; - for (int i = 0; i < 10; i = inc + 1) + for (int i = 0; i < 10; i++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int killedDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[killedDust]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); dust.scale *= 1.1f; - Main.dust[killedDust].noGravity = true; - inc = i; + dust.noGravity = true; } - for (int j = 0; j < 15; j = inc + 1) + for (int j = 0; j < 15; j++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - int killedDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); - Dust dust = Main.dust[killedDust2]; + Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustType, 0f, 0f, 0, default, 1f); dust.velocity *= 2.5f; - dust = Main.dust[killedDust2]; dust.scale *= 0.8f; - Main.dust[killedDust2].noGravity = true; - inc = j; + dust.noGravity = true; } if (Projectile.owner == Main.myPlayer) { - int minisAmt = 3; - if (Main.rand.NextBool(10)) - minisAmt++; - for (int j = 0; j < minisAmt; j = inc + 1) + int minisAmt = Main.rand.Next(3, 4 + 1); + for (int j = 0; j < minisAmt; j++) { - float randXDirect = Main.rand.Next(-35, 36) * 0.02f; - float randYDirect = Main.rand.Next(-35, 36) * 0.02f; - randXDirect *= 10f; - randYDirect *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.position.X, Projectile.position.Y, randXDirect, randYDirect, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack * 0.35f, Main.myPlayer); - inc = j; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack * 0.35f, Projectile.owner); } } } diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs b/Projectiles/Melee/Spears/RedtideSpearProjectile.cs deleted file mode 100644 index 89b1190f23..0000000000 --- a/Projectiles/Melee/Spears/RedtideSpearProjectile.cs +++ /dev/null @@ -1,334 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Utilities; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using static CalamityMod.CalamityUtils; - -namespace CalamityMod.Projectiles.Melee.Spears -{ - public class RedtideSpearProjectile : ModProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public Player Owner => Main.player[Projectile.owner]; - public static int Lifetime = 28; - public int Timer => Lifetime - Projectile.timeLeft; - - private SlotId ChargeWindSoundSlot; - - - public int ChargeDirection => Math.Sign(Projectile.velocity.X); - - #region Thrust - //Basic animation variables. - public float ThrustProgress => Timer / (float)Lifetime; - public float BaseRotation => Projectile.velocity.ToRotation(); - public float ThrustRotation => BaseRotation + Owner.direction * RotationShift; - - //Thrust animation keys - public CurveSegment thrust = new CurveSegment(EasingType.PolyIn, 0f, 0.15f, 0.85f, 3); - public CurveSegment hold = new CurveSegment(EasingType.SineBump, 0.3f, 1f, 0.2f); - public CurveSegment retract = new CurveSegment(EasingType.PolyOut, 0.7f, 1f, -1f, 2); - public CurveSegment correct = new CurveSegment(EasingType.PolyIn, 0.85f, 0f, 0.17f); - internal float Displacement => PiecewiseAnimation(ThrustProgress, new CurveSegment[] { thrust, hold, retract, correct }); - - internal const float startRotation = MathHelper.PiOver4 * 0.1f; - internal const float downwardsRotation = MathHelper.PiOver4 * 0.15f; - internal const float upwardsRotation = MathHelper.PiOver4 * -0.44f; - internal const float loweredTime = 0.25f; - - public CurveSegment downwards = new CurveSegment(EasingType.SineOut, 0f, startRotation, downwardsRotation, 2); - public CurveSegment raiseback = new CurveSegment(EasingType.SineIn, loweredTime, startRotation + downwardsRotation, upwardsRotation); - public CurveSegment stayUp = new CurveSegment(EasingType.Linear, 0.8f, startRotation + downwardsRotation + upwardsRotation, 0f); - internal float RotationShift => PiecewiseAnimation(ThrustProgress, new CurveSegment[] { downwards, raiseback, stayUp }); - public int InitializationTime => (int)(loweredTime * Lifetime); - #endregion - - #region Drag along the ground - - - public static int MaxRunTime = 300; - //Player can only do the run attack while moving fast horizontally in the direction of the thrust, but remaining on the ground - public bool CanRunAttack => Owner.velocity.Y >= -0.8f && Owner.velocity.Y <= 7f && Math.Abs(Owner.velocity.X) >= Owner.maxRunSpeed * 0.7f && Math.Sign(Owner.velocity.X) == ChargeDirection && Owner.channel && !RunBroken; - //You can only start a run attack if you meet the other conditions, but ALSO you can't do it if you are aiming too much upwards or downwards - public bool CanStartRunAttack => CanRunAttack && Math.Abs(Owner.ClampedMouseWorld().Y - Owner.MountedCenter.Y) <= 300; - public ref float RunTimer => ref Projectile.ai[0]; - //The window of time during which the run hasn't fully started, and is indentical to the regular thrust's start. This tells us when we can no longer do this switch. - public bool FullyRunning => RunTimer > InitializationTime; - - //Basically tracks if the run has been broken, either because the player did not try to run at all, stopped running, or ran for too long. - public bool RunBroken - { - get => Projectile.ai[1] > 0f; - set { Projectile.ai[1] = value ? 1f : 0f; } - } - - public static int UpThrustLifetime = 20; - public int UpThrustTimer => UpThrustLifetime - Projectile.timeLeft; - public float UpThrustProgress => UpThrustTimer / (float)UpThrustLifetime; - - //Gets the ideal rotation for the spear while running. Basically, slightly angled downwards towards the ground, to the left or right of the player depending on the direction - public float IdealSpearRotationForRun - { - get - { - float rotation = MathHelper.PiOver4 * 0.12f; - - if (ChargeDirection > 0) - return rotation; - - //Mirror the angle if facing left. - return MathHelper.Pi - rotation - MathHelper.TwoPi; - } - } - - //Properly wrap the angle. Indeed, the angles on the left suddenly go from Pi to -Pi - public float ProjectileRotationButWrappedForTransition - { - get - { - if (ChargeDirection < 0 && Projectile.rotation > 0) - return Projectile.rotation - MathHelper.TwoPi; - - return Projectile.rotation; - } - } - - public CurveSegment transitionSegment => new CurveSegment(EasingType.PolyInOut, 0f, ProjectileRotationButWrappedForTransition, IdealSpearRotationForRun - ProjectileRotationButWrappedForTransition, 2); - internal float RunAttackRotation => PiecewiseAnimation(Math.Clamp(RunTimer / 30f, 0f, 1f), new CurveSegment[] { transitionSegment }); - - - public CurveSegment anticipationDown => new CurveSegment(EasingType.SineIn, 0f, IdealSpearRotationForRun, ChargeDirection * MathHelper.PiOver4 * 0.1f, 2); - public CurveSegment upthrust => new CurveSegment(EasingType.SineOut, 0.4f, IdealSpearRotationForRun + ChargeDirection * MathHelper.PiOver4 * 0.1f, ChargeDirection * MathHelper.PiOver2 * -0.75f); - public CurveSegment holdup => new CurveSegment(EasingType.Linear, 0.8f, IdealSpearRotationForRun + ChargeDirection * MathHelper.PiOver2 * -0.7f, -0.14f); - internal float UpThrustRotation => PiecewiseAnimation(UpThrustProgress, new CurveSegment[] { anticipationDown, upthrust, holdup }); - - - public CurveSegment goback = new CurveSegment(EasingType.SineOut, 0f, 0.68f, -0.2f); - public CurveSegment goforwardfast = new CurveSegment(EasingType.PolyIn, 0.33f, 0.58f, 0.7f, 3); - public CurveSegment gobounce = new CurveSegment(EasingType.Linear, 0.6f, 1.28f, 0f); - public CurveSegment gobackagain = new CurveSegment(EasingType.SineOut, 0.86f, 1.28f, -0.2f); - internal float UpThrustDisplacement => PiecewiseAnimation(UpThrustProgress, new CurveSegment[] { goback, goforwardfast, gobounce, gobackagain }); - - #endregion - - #region General calculations - public enum AttackState { ForwardThrust, RunAttack, UpwardsThrust }; - public AttackState CurrentAttackState => (RunBroken && !FullyRunning) ? AttackState.ForwardThrust : (RunBroken || RunTimer > MaxRunTime) ? AttackState.UpwardsThrust : AttackState.RunAttack; - - //Gets the proper rotation based on the current state of the spear - public float AppropriateRotation - { - get - { - //If the player isn't fully running yet, we just don't care about the actual attack, and have them have the default thrust rotation - if (!FullyRunning) - return ThrustRotation; - - if (CurrentAttackState == AttackState.RunAttack) - return RunAttackRotation; - - if (CurrentAttackState == AttackState.UpwardsThrust) - return UpThrustRotation; - - return ThrustRotation; - } - } - - //Gets the proper displacement based on the state of the spear - public float AppropriateDisplacement - { - get - { - //If the player isn't fully running yet, we just don't care about the actual attack, and have them have the default thrust rotation - if (!FullyRunning) - return Displacement; - - //If the player is running, make them keep the lance a bit behind as they run - if (CurrentAttackState == AttackState.RunAttack) - return MathHelper.Lerp(0.93f, 0.68f, Math.Clamp(RunTimer / 30f, 0f, 1f)); - - if (CurrentAttackState == AttackState.UpwardsThrust) - return UpThrustDisplacement; - - return Displacement; - } - } - #endregion - - public override void SetDefaults() - { - Projectile.width = 56; - Projectile.DamageType = TrueMeleeDamageClass.Instance; //Dictates whether this is a melee-class weapon. - Projectile.timeLeft = Lifetime; - Projectile.height = 56; - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.ownerHitCheck = true; - } - - public override bool ShouldUpdatePosition() - { - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float collisionPoint = 0f; - float bladeLength = 85 * Projectile.scale; - float bladeWidth = 20 * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + AppropriateRotation.ToRotationVector2() * bladeLength * -0.5f, Projectile.Center + ThrustRotation.ToRotationVector2() * bladeLength * 0.5f, bladeWidth, ref collisionPoint); - } - - public override void AI() - { - UpThrustLifetime = 20; - - - //If the player starts the attack without being able to do a run attack, mark the run as "broken" from the start. - if (Projectile.timeLeft == Lifetime && RunTimer == 0 && !CanStartRunAttack) - { - RunBroken = true; - } - - if (CurrentAttackState == AttackState.RunAttack) - { - Owner.GetModPlayer().ChargingKnockbackResist = true; - - //Keep the projectile alive during the run attack. - //The fullyRunning check is important, because the animation timer relies on the projectiles time left for the startup animation. - if (FullyRunning) - Projectile.timeLeft++; - - else - //We never actually use Projectile.rotation to draw or do any collision calculations. - //Instead, we use it to keep track of the final rotation of the spear BEFORE it was fully running - //We proceed to use this value to smooth the transition between the start of the thrust animation with the run animation. - Projectile.rotation = AppropriateRotation; - - //If at any point of the run attack, something happens to interrupt it, break the run and transition back into a forward or upwards thrust, depending on how long the player ran. - if (!CanRunAttack) - { - RunBroken = true; - //If the player was running for long enough, allow them to do a thrust attack. For this, we change the animation timer. - if (FullyRunning) - { - Projectile.timeLeft = UpThrustLifetime; - } - } - - ActiveSound soundOut; - if (!SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out soundOut) || !soundOut.IsPlaying) - ChargeWindSoundSlot = SoundEngine.PlaySound(SoundID.DD2_BookStaffTwisterLoop with { IsLooped = true, Volume = SoundID.DD2_BookStaffTwisterLoop.Volume * 0.7f }, Projectile.Center); - - else - { - soundOut.Volume = MathHelper.Lerp(0f, SoundID.DD2_BookStaffTwisterLoop.Volume * 0.7f, Math.Clamp(RunTimer / 120f, 0f, 1f)); - soundOut.Position = Projectile.Center; - } - - RunTimer++; - - if (Main.rand.NextBool()) - { - int dustOpacity = Main.rand.Next(80); - float dustScale = Main.rand.NextFloat(1f, 1.4f); - Vector2 dustVelocity = (AppropriateRotation + MathHelper.Pi).ToRotationVector2().RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.5f, 5f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + AppropriateRotation.ToRotationVector2() * 40f, 16, dustVelocity, Alpha: dustOpacity, Scale: dustScale); - } - } - - //Basic spear attack - else if (CurrentAttackState == AttackState.ForwardThrust) - { - if (ThrustProgress == 0.5f) - SoundEngine.PlaySound(SoundID.DD2_JavelinThrowersAttack, Projectile.Center); - } - - else if (CurrentAttackState == AttackState.UpwardsThrust) - { - ActiveSound soundOut; - - - if (SoundEngine.TryGetActiveSound(ChargeWindSoundSlot, out soundOut)) - { - soundOut.Volume *= 0.7f; - soundOut.Position = Projectile.Center; - if (soundOut.Volume < 0.2f) - soundOut.Stop(); - } - - if (ThrustProgress == 0.5f) - SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing, Projectile.Center); - } - - UpdateOwnerVars(); - Vector2 thrust = AppropriateRotation.ToRotationVector2() * (AppropriateDisplacement * 40f + 5f); - - //During the run anim, make the spear bob up and down. - if (CurrentAttackState == AttackState.RunAttack) - thrust -= Vector2.UnitY * 2f * MathHelper.Clamp(0.5f + 0.8f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f), 0f, 1f); - - Projectile.Center = Owner.MountedCenter + thrust; - } - - public void UpdateOwnerVars() - { - Owner.ChangeDir(Math.Sign(BaseRotation.ToRotationVector2().X)); - Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, AppropriateRotation - MathHelper.PiOver2); - Owner.heldProj = Projectile.whoAmI; - Owner.itemTime = 2; - Owner.itemAnimation = 2; - - //Add more latency after an upwards thrust, for impact purposes - if (CurrentAttackState == AttackState.UpwardsThrust) - { - Owner.itemTime = 20; - Owner.itemAnimation = 20; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - //Send the enemy flying up if hit by the upwards thrust. - if (CurrentAttackState == AttackState.UpwardsThrust) - { - target.velocity.Y -= 12 * (float)Math.Sqrt(target.knockBackResist); - target.FlungNPC().ApplyCollisionDamage(target, Owner, 50, Vector2.Zero, 5f); - } - - target.AddBuff(BuffID.Poisoned, 180); - - if (CurrentAttackState == AttackState.RunAttack) - { - // 17APR2024: Ozzatron: Redtide Spear's charge gives iframes when striking enemies in a similar manner to a ram dash. - // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. - int redtideRamIFrames = 5; - Owner.GiveUniversalIFrames(redtideRamIFrames); - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Boost the knockback during the run attack - if (CurrentAttackState == AttackState.RunAttack) - modifiers.Knockback *= 1.35f; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor, AppropriateRotation + MathHelper.PiOver2 * 1.5f - MathHelper.ToRadians(12), texture.Size() / 2f, Projectile.scale, 0, 0); - return false; - } - } -} diff --git a/Projectiles/Melee/Spears/RedtideSpearProjectile.png b/Projectiles/Melee/Spears/RedtideSpearProjectile.png deleted file mode 100644 index b72059c817..0000000000 Binary files a/Projectiles/Melee/Spears/RedtideSpearProjectile.png and /dev/null differ diff --git a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs index 014132bc87..b2348aa66c 100644 --- a/Projectiles/Melee/Spears/VulcaniteLanceProj.cs +++ b/Projectiles/Melee/Spears/VulcaniteLanceProj.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Vector2 goreVec = Projectile.Center + Projectile.velocity; - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 1f); Main.gore[smoke].behindTiles = true; diff --git a/Projectiles/Melee/StreamGougePortal.cs b/Projectiles/Melee/StreamGougePortal.cs index 12c3f98945..f2eb585a16 100644 --- a/Projectiles/Melee/StreamGougePortal.cs +++ b/Projectiles/Melee/StreamGougePortal.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee { target.AddBuff(ModContent.BuffType(), 300); SoundEngine.PlaySound(SoundID.Item74, target.Center); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Color impactColor = Color.Lerp(Color.Cyan, Color.White, Main.rand.NextFloat(0.3f, 0.64f)); diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 89652246eb..3938a7e9cc 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -46,6 +46,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } + + if (Main.rand.NextBool(8)) + { + Dust offTrail = Dust.NewDustPerfect(Projectile.Center, 171, Main.rand.NextVector2Circular(0.2f, 0.2f)); + offTrail.noGravity = true; + offTrail.scale = Main.rand.NextFloat(0.6f, 1.2f); + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 120); diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index 9b2db2a9b5..5c8bc84c26 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { // Play a splatter and impact sound. SoundEngine.PlaySound(SoundID.DD2_CrystalCartImpact, Projectile.Center); diff --git a/Projectiles/Melee/WulfrumScrew.cs b/Projectiles/Melee/WulfrumScrew.cs index 1f6bb696fc..2a245b5267 100644 --- a/Projectiles/Melee/WulfrumScrew.cs +++ b/Projectiles/Melee/WulfrumScrew.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Melee } } - if (!screwRegained && Main.netMode != NetmodeID.Server) + if (!screwRegained && !Main.dedServ) { Gore screwGore = Gore.NewGorePerfect(Projectile.GetSource_Death(), Projectile.position, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(4f, 6f) + Projectile.velocity * 0.7f, Mod.Find("WulfrumScrewGore").Type); screwGore.timeLeft = 20; @@ -127,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(CommonCalamitySounds.WulfrumNPCDeathSound, Projectile.Center); SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore screwGore = Gore.NewGorePerfect(Projectile.GetSource_Death(), Projectile.position, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(1f, 3f) + Projectile.velocity * 0.7f, Mod.Find("WulfrumScrewGore").Type); screwGore.timeLeft = 20; diff --git a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs index 0efc358a1f..8ffe1ba0b9 100644 --- a/Projectiles/Melee/Yoyos/FaultLineYoyo.cs +++ b/Projectiles/Melee/Yoyos/FaultLineYoyo.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, default, Main.rand.Next(375, 378), 0.5f); Main.gore[smoke].behindTiles = true; diff --git a/Projectiles/Pets/ChibiiDoggo.cs b/Projectiles/Pets/ChibiiDoggo.cs index 95ea59780d..4d38d44c8c 100644 --- a/Projectiles/Pets/ChibiiDoggo.cs +++ b/Projectiles/Pets/ChibiiDoggo.cs @@ -175,7 +175,7 @@ IL_6899: //companion cube lighting check and stab // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Color color; diff --git a/Projectiles/Pets/ChibiiDoggoFly.png b/Projectiles/Pets/ChibiiDoggoFly.png index 04ac5eb788..da5e4805c0 100644 Binary files a/Projectiles/Pets/ChibiiDoggoFly.png and b/Projectiles/Pets/ChibiiDoggoFly.png differ diff --git a/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png b/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png index 01fd2cd453..6feebe1cde 100644 Binary files a/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png and b/Projectiles/Pets/ChibiiDoggoFlyMonochrome.png differ diff --git a/Projectiles/Pets/LadShark.cs b/Projectiles/Pets/LadShark.cs index 314e849006..128d560148 100644 --- a/Projectiles/Pets/LadShark.cs +++ b/Projectiles/Pets/LadShark.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Pets { if (Projectile.owner == Main.myPlayer) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int heartCount = Main.rand.Next(20, 31); for (int i = 0; i < heartCount; i++) diff --git a/Projectiles/Ranged/AcidRocket.cs b/Projectiles/Ranged/AcidRocket.cs index dd0e6c6f0c..982bd2cb2c 100644 --- a/Projectiles/Ranged/AcidRocket.cs +++ b/Projectiles/Ranged/AcidRocket.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged { CalamityUtils.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); // Trailing effects, only applied when homing - if (Main.netMode != NetmodeID.Server && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) + if (!Main.dedServ && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) { Color color = new Color(136, 211, 113, 127); Color fadeColor = new Color(165, 165, 86); diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.cs b/Projectiles/Ranged/AdamAcceleratorBeam.cs index cb36de16a4..84159ca526 100644 --- a/Projectiles/Ranged/AdamAcceleratorBeam.cs +++ b/Projectiles/Ranged/AdamAcceleratorBeam.cs @@ -94,7 +94,7 @@ namespace CalamityMod.Projectiles.Ranged Color beamColor = GetBeamColor(polarity); ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. diff --git a/Projectiles/Ranged/AuroraFire.cs b/Projectiles/Ranged/AuroraFire.cs index afd3c9a209..42d6af0c6d 100644 --- a/Projectiles/Ranged/AuroraFire.cs +++ b/Projectiles/Ranged/AuroraFire.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Opacity = Utils.GetLerpValue(0f, 15f, Time, true) * Utils.GetLerpValue(450f, 360f, Time, true); // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index f80294e65a..d9a48ebcd8 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Terraria; @@ -40,6 +41,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Ranged/BlightFlames.cs b/Projectiles/Ranged/BlightFlames.cs index cf32ee4072..36e3556d39 100644 --- a/Projectiles/Ranged/BlightFlames.cs +++ b/Projectiles/Ranged/BlightFlames.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Ranged } // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. diff --git a/Projectiles/Ranged/BuzzkillHoldout.cs b/Projectiles/Ranged/BuzzkillHoldout.cs index e7833c92a3..04c8fdb96e 100644 --- a/Projectiles/Ranged/BuzzkillHoldout.cs +++ b/Projectiles/Ranged/BuzzkillHoldout.cs @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 240); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") { Volume = 0.7f }, GunTipPosition); int SawLevel = (Time / ChargeupTime >= 1f).ToInt() + (Time / ChargeupTime >= 0.25f).ToInt(); diff --git a/Projectiles/Ranged/BuzzkillSaw.cs b/Projectiles/Ranged/BuzzkillSaw.cs index ac72578d91..a9d383fd87 100644 --- a/Projectiles/Ranged/BuzzkillSaw.cs +++ b/Projectiles/Ranged/BuzzkillSaw.cs @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 150); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/SwiftSlice") with { Pitch = 0.15f * Projectile.numHits }, Projectile.Center); int bloodCount = 6 + 10 * (int)SawLevel; diff --git a/Projectiles/Ranged/CardDiamond.cs b/Projectiles/Ranged/CardDiamond.cs index 30ffcf5781..e6f934e331 100644 --- a/Projectiles/Ranged/CardDiamond.cs +++ b/Projectiles/Ranged/CardDiamond.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[paper].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 57b5a81cfd..0e457db337 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle onKill = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastShoot"); SoundEngine.PlaySound(onKill with { Volume = 0.4f, Pitch = 0.4f }, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 7; k++) { diff --git a/Projectiles/Ranged/FreedomStarBeam.cs b/Projectiles/Ranged/FreedomStarBeam.cs index f647654627..ed2c586152 100644 --- a/Projectiles/Ranged/FreedomStarBeam.cs +++ b/Projectiles/Ranged/FreedomStarBeam.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Ranged ProduceBeamDust(beamColor); // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 5e47ed764b..45dd067be9 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged ProjectileID.Sets.TrailCacheLength[Type] = 6; ProjectileID.Sets.TrailingMode[Type] = 0; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) TextureBlue = Mod.Assets.Request("Projectiles/Ranged/GodSlayerSlugBlue", AssetRequestMode.ImmediateLoad).Value; } diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index 97e1887874..9dae2a8086 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Ranged { initialized = true; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { SoundEngine.PlaySound(CommonCalamitySounds.LargeWeaponFireSound with { Volume = CommonCalamitySounds.LargeWeaponFireSound.Volume * 0.45f }, Projectile.Center); } diff --git a/Projectiles/Ranged/MaelstromHoldout.cs b/Projectiles/Ranged/MaelstromHoldout.cs index 4825992c84..88a747cb15 100644 --- a/Projectiles/Ranged/MaelstromHoldout.cs +++ b/Projectiles/Ranged/MaelstromHoldout.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Projectiles.Ranged public void ShootProjectiles(Vector2 shootPosition) { // Create electric particles. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 16; i++) { diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 12dacb88a4..7408ace3d2 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[exo].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 9; @@ -185,15 +185,11 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.owner == Main.myPlayer) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - for (int i = 0; i < 4; i++) + float angleOffset = Main.rand.NextFloat(-30f, 30f); + for (int i = 0; i < 8; i++) { - double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); - int proj2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f + angleOffset) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner, ai1: 1f); } } } diff --git a/Projectiles/Ranged/MechanicalBarracuda.cs b/Projectiles/Ranged/MechanicalBarracuda.cs index ee921712b0..ca668b7d03 100644 --- a/Projectiles/Ranged/MechanicalBarracuda.cs +++ b/Projectiles/Ranged/MechanicalBarracuda.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -28,5 +29,10 @@ namespace CalamityMod.Projectiles.Ranged // This needs to happen retroactively due to Deadshot Brooch and other potential items boosting updates public override void AI() => Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } } } diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs index 0f1e920e05..6f357a690c 100644 --- a/Projectiles/Ranged/MiniSharkron.cs +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Ranged Dust dust = Main.dust[idx]; dust.velocity /= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int tail = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, Projectile.velocity * 0.8f, 584, 1f); Main.gore[tail].timeLeft /= 10; diff --git a/Projectiles/Ranged/MortarRoundProj.cs b/Projectiles/Ranged/MortarRoundProj.cs index 95dee8af46..f84155a472 100644 --- a/Projectiles/Ranged/MortarRoundProj.cs +++ b/Projectiles/Ranged/MortarRoundProj.cs @@ -109,7 +109,7 @@ namespace CalamityMod.Projectiles.Ranged // Reused by Rubber Mortar Rounds. internal static void SpawnExplosionGores(Projectile p) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; Vector2 goreSource = p.Center; diff --git a/Projectiles/Ranged/PlagueTaintedDrone.cs b/Projectiles/Ranged/PlagueTaintedDrone.cs index 834053e7a0..c364af3ef6 100644 --- a/Projectiles/Ranged/PlagueTaintedDrone.cs +++ b/Projectiles/Ranged/PlagueTaintedDrone.cs @@ -159,7 +159,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[dust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 2; diff --git a/Projectiles/Ranged/PlasmaBlast.cs b/Projectiles/Ranged/PlasmaBlast.cs index 4c9fda47d3..af1049f2ba 100644 --- a/Projectiles/Ranged/PlasmaBlast.cs +++ b/Projectiles/Ranged/PlasmaBlast.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[extraDust].position = Projectile.Center + extraDustVel * 12f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int gore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[gore].velocity *= 0.66f; @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.9f; if (Main.rand.NextBool(10)) Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.FireworkFountain_Blue, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } diff --git a/Projectiles/Ranged/PristineSecondary.cs b/Projectiles/Ranged/PristineSecondary.cs index b796cff7d9..13d95204ca 100644 --- a/Projectiles/Ranged/PristineSecondary.cs +++ b/Projectiles/Ranged/PristineSecondary.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Opacity = Utils.GetLerpValue(280f, 135f, Projectile.timeLeft, true) * Utils.GetLerpValue(0f, 90f, Projectile.timeLeft, true); // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index 2e1a91320e..d806b0180c 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ExpandHitboxBy(300); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 10; diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index acfbcffc99..bc9098440e 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -58,18 +58,12 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i <= 1; i++) + for (int i = 0; i < 4; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 4f) - (MathHelper.Pi / 2f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Ranged/SputterComet.cs b/Projectiles/Ranged/SputterComet.cs index c0f6a38eb1..315818597a 100644 --- a/Projectiles/Ranged/SputterComet.cs +++ b/Projectiles/Ranged/SputterComet.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/SputterCometBig.cs b/Projectiles/Ranged/SputterCometBig.cs index 99391f093e..7f227bbb77 100644 --- a/Projectiles/Ranged/SputterCometBig.cs +++ b/Projectiles/Ranged/SputterCometBig.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/TheMaelstromExplosion.cs b/Projectiles/Ranged/TheMaelstromExplosion.cs index d4c0e99c0c..b2ae9a476e 100644 --- a/Projectiles/Ranged/TheMaelstromExplosion.cs +++ b/Projectiles/Ranged/TheMaelstromExplosion.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Opacity = Projectile.scale * Utils.GetLerpValue(0f, 30f, Projectile.timeLeft, true); // Emit sparks and dust. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int sparkLifetime = Main.rand.Next(22, 36); float sparkScale = Main.rand.NextFloat(1f, 1.3f); diff --git a/Projectiles/Ranged/TheMaelstromShark.cs b/Projectiles/Ranged/TheMaelstromShark.cs index 5bb5ecb83f..a9a4037ffe 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Ranged { // Create death effects for the shark, including a death sound, gore, and some blood. SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity, Mod.Find("MaelstromReaperShark1").Type, Projectile.scale); Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, Projectile.velocity, Mod.Find("MaelstromReaperShark2").Type, Projectile.scale); diff --git a/Projectiles/Ranged/ToxicArrow.png b/Projectiles/Ranged/ToxicArrow.png index a791e861f1..d837cc26d5 100644 Binary files a/Projectiles/Ranged/ToxicArrow.png and b/Projectiles/Ranged/ToxicArrow.png differ diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 119517a572..9eabd1a422 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Ranged } } Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f, 16, 1f); Main.gore[idx].velocity *= 0.66f; @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) { Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } @@ -88,7 +88,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index 86c3d946d9..fc22e9fde8 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int g = 0; g < 3; g++) { diff --git a/Projectiles/Ranged/VoidBlast.cs b/Projectiles/Ranged/VoidBlast.cs index 53ce8804ea..a1bae89537 100644 --- a/Projectiles/Ranged/VoidBlast.cs +++ b/Projectiles/Ranged/VoidBlast.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[extraDust].velocity = value3 * 0.66f; Main.dust[extraDust].position = Projectile.Center + value3 * 12f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int voidGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[voidGore].velocity *= 0.66f; @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) { Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } diff --git a/Projectiles/Rogue/AuroradicalSplitter.cs b/Projectiles/Rogue/AuroradicalSplitter.cs index 519b63f719..be67889e6f 100644 --- a/Projectiles/Rogue/AuroradicalSplitter.cs +++ b/Projectiles/Rogue/AuroradicalSplitter.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int g = 0; g < 3; g++) { diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index 2d471c304d..0970899e66 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[astral].velocity *= 2f; Main.dust[astral].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int g = 0; g < 3; g++) { diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index 6ef3ba74cc..828e638019 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[fire].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 444921731e..50845d0ef5 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -109,6 +110,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += RotationIncrement; return; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 360); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 360); public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index 4a997ecf91..ba321e035e 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,6 +41,10 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); diff --git a/Projectiles/Rogue/CelestusProj.cs b/Projectiles/Rogue/CelestusProj.cs index 3ff5f325cb..d1f724e892 100644 --- a/Projectiles/Rogue/CelestusProj.cs +++ b/Projectiles/Rogue/CelestusProj.cs @@ -152,15 +152,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 2.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); diff --git a/Projectiles/Rogue/CorpusAvertorClone.cs b/Projectiles/Rogue/CorpusAvertorClone.cs index 740a9c4f82..561260ec7a 100644 --- a/Projectiles/Rogue/CorpusAvertorClone.cs +++ b/Projectiles/Rogue/CorpusAvertorClone.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,6 +13,9 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + public const int MaxClones = 3; + private ref float CloneNum => ref Projectile.ai[0]; + public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -35,26 +39,8 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.04f; - Projectile.velocity.X *= 1.005f; - Projectile.velocity.Y *= 1.005f; - - switch ((int)Projectile.ai[0]) - { - case 20: - Projectile.scale = 0.7f; - break; - case 40: - Projectile.scale = 0.8f; - break; - case 60: - Projectile.scale = 0.9f; - break; - default: - break; - } - Projectile.width = Projectile.height = (int)(24f * Projectile.scale); - - CalamityUtils.HomeInOnNPC(Projectile, true, 150f, 12f, 20f); + if (Projectile.timeLeft < 165) + CalamityUtils.HomeInOnNPC(Projectile, true, 480f, 14f, 20f); } public override Color? GetAlpha(Color lightColor) @@ -70,28 +56,14 @@ namespace CalamityMod.Projectiles.Rogue return false; } + public override bool? CanDamage() => Projectile.timeLeft > 165 ? false : null; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int heal = (int)Math.Round(hit.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; + target.AddBuff(ModContent.BuffType(), 180); - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - int heal = (int)Math.Round(info.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + if (CloneNum < MaxClones && Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -Projectile.velocity.RotatedByRandom(MathHelper.Pi / 8f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, CloneNum + 1); } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index a16cb344c3..7c00bf1283 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,6 +13,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + private ref float Timer => ref Projectile.ai[0]; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 6; @@ -31,29 +34,22 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; + Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.03f; - if (Projectile.ai[0] < 120f) - Projectile.ai[0] += 1f; + if (Timer < 120f) + Timer += 1f; - if (Projectile.ai[0] < 61f) + if (Timer == 20f) { - if (Projectile.ai[0] % 20f == 0f) - { - Vector2 velocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y); - float mult = Projectile.ai[0] / 80f; // Ranges from 0.25 to 0.5 to 0.75 - velocity *= mult; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), - (int)(Projectile.damage * mult), Projectile.knockBack * mult, Projectile.owner, Projectile.ai[0]); - } + Vector2 cloneVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(1f, 1.75f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cloneVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, 1f); } - else - { - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); + if (Timer > 60f) + { + Projectile.velocity *= 1.01f; + + int scale = (int)((Timer - 60f) * 3f); int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); Main.dust[dust].velocity *= 0f; Main.dust[dust].noGravity = true; @@ -62,12 +58,16 @@ namespace CalamityMod.Projectiles.Rogue public override Color? GetAlpha(Color lightColor) { - if (Projectile.ai[0] >= 61f) + Color returnColor; + if (Timer >= 61f) { - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - return new Color(scale, 0, 0, 50); + returnColor = Color.Lerp(Color.White, Color.Red, Math.Min((Timer - 60f) / 120f * 3f, 1f)); + returnColor.A = 50; + return returnColor; } - return new Color(0, 0, 0, 50); + returnColor = Color.White; + returnColor.A = 50; + return returnColor; } public override bool PreDraw(ref Color lightColor) @@ -78,11 +78,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 180); + int heal = (int)Math.Round(hit.Damage * 0.05); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) + if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); @@ -90,11 +92,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { - int heal = ((int)Math.Round(info.Damage * 0.05)); + target.AddBuff(ModContent.BuffType(), 180); + + int heal = (int)Math.Round(info.Damage * 0.05); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0) return; CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index ab2d5f309a..99f36ef71e 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -1,9 +1,12 @@ -using System; -using CalamityMod.Balancing; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Particles; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; +using System; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +17,10 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/CorpusAvertor"; + private ref float Timer => ref Projectile.ai[0]; + private ref float Slash => ref Projectile.ai[1]; // If set to 1, this is the slash projectile + private Vector2 startPos = Vector2.Zero; + public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 10; @@ -22,74 +29,99 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 24; - Projectile.height = 24; + Projectile.width = 32; + Projectile.height = 32; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 300; } public override void AI() { - Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.02f; + if (startPos == Vector2.Zero) + startPos = Projectile.Center; - if (Projectile.ai[0] < 120f) - Projectile.ai[0] += 1f; + if (Timer < 120f) + Timer += 1f; - Projectile.velocity.X *= 1.01f; - Projectile.velocity.Y *= 1.01f; + Projectile.rotation = Projectile.velocity.ToRotation() + (MathHelper.Pi / 3f); + Projectile.velocity *= 1.01f; - int scale = (int)((Projectile.ai[0] - 60f) * 4.25f); - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); - Main.dust[dust].velocity *= 0f; - Main.dust[dust].noGravity = true; + if (Slash == 1f) + { + if (Timer > 4f) + { + GlowSparkParticle glow = new(Projectile.Center, Vector2.Normalize(Projectile.velocity), false, 10, 0.055f, Color.DarkRed, new Vector2(0.66f, 1.5f), true, false); + GeneralParticleHandler.SpawnParticle(glow); + } + } + else + { + int scale = (int)((Timer - 60f) * 4.25f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, new Color(scale, 0, 0, 50), 2f); + Main.dust[dust].velocity *= 0f; + Main.dust[dust].noGravity = true; + } + + if (Timer == 60f && Slash == 0f) + { + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Volume = 0.4f, PitchVariance = 0.06f }, startPos); + if (Main.myPlayer == Projectile.owner) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), startPos, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 1f); + } + Projectile.tileCollide = true; + } } public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Projectile.alpha); public override bool PreDraw(ref Color lightColor) { + if (Slash == 1f) + return false; + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (target.lifeMax > 5) + target.AddBuff(ModContent.BuffType(), 180); + if (target.lifeMax > 5 && Projectile.numHits == 0 && Slash == 0f) OnHitEffects(hit.Damage); + + if (Projectile.numHits > 0 && !(target.life <= 0 && target.realLife == -1)) + Projectile.damage = (int)(Projectile.damage * 0.9f); + if (Projectile.damage < 1) + Projectile.damage = 1; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - OnHitEffects(info.Damage); + target.AddBuff(ModContent.BuffType(), 180); + if (Projectile.numHits == 0 && Slash == 0f) + OnHitEffects(info.Damage); } private void OnHitEffects(int damage) { Player player = Main.player[Projectile.owner]; - if (Main.rand.NextBool(7)) - { - int lifeLossAmt = (int)Math.Ceiling(player.statLife * 0.5); - player.statLife -= lifeLossAmt; - if (Main.myPlayer == player.whoAmI) - player.HealEffect(-lifeLossAmt, true); - if (player.statLife <= 0) - player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CorpusAvertor").Format(player.name)), 1000.0, 0, false); - } - else if (Main.LocalPlayer.team == player.team && player.team != 0) + if (Main.LocalPlayer.team == player.team && player.team != 0) { Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); - player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); int heal = (int)Math.Round(damage * 0.025); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; - if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0) + if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.LocalPlayer, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } } } diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index 10c8612d1e..21c1045017 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 240); Projectile.Kill(); } diff --git a/Projectiles/Rogue/CraniumSMASH.cs b/Projectiles/Rogue/CraniumSMASH.cs index ed0d560383..ba9217eadf 100644 --- a/Projectiles/Rogue/CraniumSMASH.cs +++ b/Projectiles/Rogue/CraniumSMASH.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue { SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/CraniumSmasherExplosive.cs b/Projectiles/Rogue/CraniumSmasherExplosive.cs index 81c22a57e6..ba7f842023 100644 --- a/Projectiles/Rogue/CraniumSmasherExplosive.cs +++ b/Projectiles/Rogue/CraniumSmasherExplosive.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -33,6 +34,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; Projectile.velocity.X = Projectile.velocity.X * 0.99f; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { @@ -47,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/CraniumSmasherProj.cs b/Projectiles/Rogue/CraniumSmasherProj.cs index ed8559ee80..de0167b165 100644 --- a/Projectiles/Rogue/CraniumSmasherProj.cs +++ b/Projectiles/Rogue/CraniumSmasherProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -35,6 +36,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y = Projectile.velocity.Y + 0.085f; Projectile.velocity.X = Projectile.velocity.X * 0.99f; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 180); + } public override void OnKill(int timeLeft) { diff --git a/Projectiles/Rogue/CraniumSmasherStealth.cs b/Projectiles/Rogue/CraniumSmasherStealth.cs index 08b9cf9f6f..d530131132 100644 --- a/Projectiles/Rogue/CraniumSmasherStealth.cs +++ b/Projectiles/Rogue/CraniumSmasherStealth.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; @@ -40,6 +41,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.owner == Main.myPlayer) { int smash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); @@ -49,6 +51,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { + target.AddBuff(ModContent.BuffType(), 300); if (Projectile.owner == Main.myPlayer) { int smash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f); @@ -69,7 +72,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index b0a1f1e7fa..f8f7e01382 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -75,8 +75,8 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index eccc24db80..8575ee7ec5 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -14,10 +14,13 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/DeepWounder"; + public NPC StuckTo; + public Vector2 StuckOffset = Vector2.Zero; + public override void SetDefaults() { - Projectile.width = 20; - Projectile.height = 20; + Projectile.width = 30; + Projectile.height = 30; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 3; @@ -29,26 +32,32 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation += 0.2f * Projectile.direction; + Projectile.rotation += (StuckTo == null ? 0.2f : 0.35f) * Projectile.direction; if (Projectile.Calamity().stealthStrike) { int spriteWidth = 52; int spriteHeight = 48; - Vector2 spriteCenter = Projectile.Center - new Vector2(spriteWidth / 2, spriteHeight / 2); - for (int i = 0; i < 30; i++) + for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(spriteCenter, spriteWidth, spriteHeight, DustID.Water, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); + int dust = Dust.NewDust(Projectile.position, spriteWidth, spriteHeight, DustID.Water, Projectile.velocity.X * 0.1f, Projectile.velocity.Y * 0.1f, 0, default, 1f); Main.dust[dust].noGravity = true; } - if (Main.rand.NextBool(5)) + if (StuckTo != null) { - Vector2 waterVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - waterVelocity.Normalize(); - waterVelocity *= 3; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spriteCenter, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.05f), 1, Projectile.owner, 0, 0); + if (!StuckTo.CanBeChasedBy(Projectile)) + Projectile.Kill(); + + Projectile.Center = StuckTo.Center + StuckOffset; + Projectile.velocity = Vector2.Zero; + + if (Projectile.timeLeft % 5 == 0) + { + Vector2 waterVelocity = (Projectile.Center - StuckTo.Center).SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.Pi / 6f) * 8f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, waterVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1f), 1, Projectile.owner, 0, 0); + } } } } @@ -59,34 +68,25 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + if (StuckTo == null) + { + StuckTo = target; + StuckOffset = Projectile.Center - target.Center; + } } } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 150); - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 120); } } - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - if (Projectile.direction > 0) - { - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - } - else - { - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.FlipHorizontally, 0); - } - return false; - } - public override bool OnTileCollide(Vector2 oldVelocity) { Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); diff --git a/Projectiles/Rogue/DeepWounderWater.cs b/Projectiles/Rogue/DeepWounderWater.cs index d6dcd18c22..01e4daddb8 100644 --- a/Projectiles/Rogue/DeepWounderWater.cs +++ b/Projectiles/Rogue/DeepWounderWater.cs @@ -1,6 +1,5 @@ - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,48 +9,74 @@ namespace CalamityMod.Projectiles.Rogue public class DeepWounderWater : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + + private const int TimeBeforeBurst = 120; + private bool foundTarget = false; + public override void SetDefaults() { Projectile.width = 12; Projectile.height = 12; Projectile.friendly = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 50; + Projectile.timeLeft = 160; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; } public override void AI() { - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Water, Projectile.velocity.X, Projectile.velocity.Y); - Main.dust[dust].noGravity = true; - } - + Dust idleDust = Dust.NewDustPerfect(Projectile.Center, DustID.Water, Vector2.Zero, Scale: 1.5f); + idleDust.noGravity = true; Projectile.rotation += 0.2f; - Projectile.velocity.Y += 0.2f; - if (Projectile.velocity.Y > 16f) + if (Projectile.timeLeft > TimeBeforeBurst) { - Projectile.velocity.Y = 16f; + Projectile.velocity *= 0.97f; + } + else + { + // Zoom off towards the nearest target + // Don't bother running code if you've already found one + if (foundTarget) + return; + + // Find the closest target + float npcDistCompare = 960f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile)) + continue; + + float hitboxWidth = Math.Max(n.Hitbox.Width / 2f, n.Hitbox.Height / 2f); + float currentNPCDist = n.Distance(Projectile.Center) - hitboxWidth; + if ((currentNPCDist < npcDistCompare) && (Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + if (index != -1) + { + foundTarget = true; + + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], 7f, 4); + Projectile.MaxUpdates = 4; + if (Projectile.timeLeft < TimeBeforeBurst) + Projectile.timeLeft = TimeBeforeBurst; + + for (int i = 0; i < 12; i++) + { + Vector2 dustVel = Main.rand.NextVector2CircularEdge(7, 7); + Dust dustBurst = Dust.NewDustPerfect(Projectile.Center, DustID.Water, dustVel); + dustBurst.noGravity = true; + } + } } } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position + Projectile.velocity, Projectile.velocity, Projectile.width, Projectile.height); - Projectile.Kill(); - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - return false; - } + public override bool? CanDamage() => Projectile.timeLeft <= TimeBeforeBurst; } } diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 4a0ca90ed7..2f70791b27 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -56,10 +56,13 @@ namespace CalamityMod.Projectiles.Rogue Vector2 moveToMouse = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); if (Projectile.numHits == 0 || Projectile.Calamity().stealthStrike) { - if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 18 : 13) && time > 8) - Projectile.velocity += moveToMouse * (Projectile.Calamity().stealthStrike ? 0.8f : 0.4f); - else if (time > 8) - Projectile.velocity *= 0.9f; + if (time > 8) + { + if (Projectile.velocity.Length() < (Projectile.Calamity().stealthStrike ? 20 : 13)) + Projectile.velocity += moveToMouse * (Projectile.Calamity().stealthStrike ? 1f : 0.4f); + else + Projectile.velocity *= 0.9f; + } if (Projectile.velocity.Length() > 3) { @@ -144,14 +147,7 @@ namespace CalamityMod.Projectiles.Rogue Particle orb7 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Black, "CalamityMod/Particles/SmallBloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 3, 0f, 12, false); GeneralParticleHandler.SpawnParticle(orb7); } - public override void OnKill(int timeLeft) - { - if (!Projectile.Calamity().stealthStrike) - Explode(false); - else - Explode(true); - - } + public override void OnKill(int timeLeft) => Explode(Projectile.Calamity().stealthStrike); internal void Explode(bool big) { @@ -163,7 +159,7 @@ namespace CalamityMod.Projectiles.Rogue Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb2); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.4f : 0.8f)), Projectile.knockBack * 1.5f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); SoundStyle explo = new("CalamityMod/Sounds/Item/MeldExplosion"); SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); if (big) diff --git a/Projectiles/Rogue/DragonShit.cs b/Projectiles/Rogue/DragonShit.cs index 3946698d41..22ca91db72 100644 --- a/Projectiles/Rogue/DragonShit.cs +++ b/Projectiles/Rogue/DragonShit.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[idx].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/DukesDecapitatorProj.cs b/Projectiles/Rogue/DukesDecapitatorProj.cs index 35b995769f..99f9cb0933 100644 --- a/Projectiles/Rogue/DukesDecapitatorProj.cs +++ b/Projectiles/Rogue/DukesDecapitatorProj.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -60,10 +61,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); Projectile.velocity = Vector2.Zero; rotationAmount -= 0.05f; } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnKill(int timeLeft) { for (int i = 0; i < 20; i++) diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index 7467556d56..fd05f16eb4 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -37,6 +37,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index 31f3c1cf9b..860ff5228b 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -37,6 +38,9 @@ namespace CalamityMod.Projectiles.Rogue Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Rogue/LeonidCometBig.cs b/Projectiles/Rogue/LeonidCometBig.cs index 0491cc876c..babf525421 100644 --- a/Projectiles/Rogue/LeonidCometBig.cs +++ b/Projectiles/Rogue/LeonidCometBig.cs @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Rogue dust2.velocity *= 2f; dust2.noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int index1 = 0; index1 < 2; ++index1) { diff --git a/Projectiles/Rogue/LeonidStar.cs b/Projectiles/Rogue/LeonidStar.cs index fddf210ab3..69c9b1b43b 100644 --- a/Projectiles/Rogue/LeonidStar.cs +++ b/Projectiles/Rogue/LeonidStar.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Rogue int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, Projectile.velocity.X, Projectile.velocity.Y, 0, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.5f); Main.dust[dust].noGravity = true; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int num480 = 0; num480 < 3; num480++) { diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index d8917d0db4..85a6f13add 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -237,7 +237,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (target == chosenTarget || Projectile.Calamity().stealthStrike) - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); if (!stuckInTarget && canStick && !Projectile.Calamity().stealthStrike) { if (Projectile.timeLeft < 400) diff --git a/Projectiles/Rogue/MeteorFistMeteorite.cs b/Projectiles/Rogue/MeteorFistMeteorite.cs new file mode 100644 index 0000000000..5281f17885 --- /dev/null +++ b/Projectiles/Rogue/MeteorFistMeteorite.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MeteorFistMeteorite : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "Terraria/Images/Backgrounds/Ambience/Meteor"; + + public override void SetDefaults() + { + Projectile.width = 62; + Projectile.height = 96; + Projectile.friendly = true; + Projectile.MaxUpdates = 2; + Projectile.tileCollide = false; + Projectile.timeLeft = 360; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.scale = 2f; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 5 * Projectile.MaxUpdates) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 3) + Projectile.frame = 0; + } + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + for (int i = 0; i < 2; i++) + { + Dust meteorDust = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 0.5f, Projectile.width, Projectile.height / 2, DustID.Torch, 0f, 0f, 100, default, 0.5f); + meteorDust.scale *= 2f + Main.rand.NextFloat(); + meteorDust.velocity *= 0.2f; + meteorDust.noGravity = true; + } + + if (Projectile.Center.Y > Main.npc[(int)Projectile.ai[0]].Center.Y) + Projectile.tileCollide = true; + } + + public override void OnKill(int timeLeft) + { + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3f; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HellbornImpact"), Projectile.Center); + + Projectile.ExpandHitboxBy(300); + Projectile.penetrate = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.Damage(); + + for (int k = 0; k < 50; k++) + { + int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); + Main.dust[boomDust2].noGravity = true; + Main.dust[boomDust2].velocity *= 5f; + boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + Main.dust[boomDust2].velocity *= 2f; + } + CustomPulse outerRing = new(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomRing", Vector2.One, 0f, 0f, 2.8f, 15); + GeneralParticleHandler.SpawnParticle(outerRing); + CustomPulse innerRing = new(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/DetailedExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0f, 0.8f, 30, true, 0.8f); + GeneralParticleHandler.SpawnParticle(innerRing); + } + + // Can hit if: + // 1: Is the same NPC the fist hit. 2: The NPC the fist hit is no longer active. 3: The fist hit a worm segment, and this NPC is another segment of the same worm. 4: Damage from the explosion. + public override bool? CanHitNPC(NPC target) => target.whoAmI == Projectile.ai[0] || !Main.npc[(int)Projectile.ai[0]].active || (target.realLife != -1 && target.realLife == Main.npc[(int)Projectile.ai[0]].realLife) || Projectile.penetrate == -1 ? null : false; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire, 240); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 240); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, 4, 0, Projectile.frame); + SpriteEffects effect = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, frame.Size() / 2f, Projectile.scale, effect); + return false; + } + } +} diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index 009cbfeda3..cc694bad98 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -1,6 +1,10 @@ -using System; +using CalamityMod.DataStructures; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,88 +15,131 @@ namespace CalamityMod.Projectiles.Rogue public class MeteorFistProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + + public List Wire; + private const int Lifetime = 210; + private const int WireSegments = 15; + private const float MaxSpeed = 22.5f; + public ref float Timer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; public override void SetDefaults() { Projectile.width = 20; Projectile.height = 20; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 360; + Projectile.penetrate = 2; // Only hits once, has 2 pierce to create a visual illusion of the connecting wire being left behind after hit + Projectile.timeLeft = Lifetime; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; } public override void AI() { - if (Projectile.velocity.Length() >= 4f) + Player Owner = Main.player[Projectile.owner]; + Timer++; + + // Initialize the connecting wire + if (Wire == null || Wire.Count < WireSegments) { - for (int i = 0; i < 2; i++) + Wire = new List(WireSegments); + for (int i = 0; i < WireSegments; i++) { - float dustyX = 0f; - float dustyY = 0f; - if (i == 1) - { - dustyX = Projectile.velocity.X * 0.5f; - dustyY = Projectile.velocity.Y * 0.5f; - } - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[meteorDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[meteorDust].velocity *= 0.2f; - Main.dust[meteorDust].noGravity = true; + VerletSimulatedSegment segment = new VerletSimulatedSegment(Owner.Center + Vector2.UnitY * i * 10f); + Wire.Add(segment); + } + + Wire[0].locked = true; + Wire[Wire.Count - 1].locked = true; + } + + // Spawn some fire dust, plus smoke if traveling fast enough + if (Projectile.numHits == 0) + { + Dust meteorDust = Dust.NewDustDirect(Projectile.position - Projectile.velocity * 0.5f, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); + meteorDust.scale *= 2f + Main.rand.NextFloat(); + meteorDust.velocity *= 0.2f; + meteorDust.noGravity = true; + + if (Projectile.velocity.Length() >= 7f) + { + Vector2 smokePos = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * 10f; + HeavySmokeParticle smoking = new(smokePos, Vector2.UnitX.RotatedBy(Projectile.rotation + MathHelper.Pi) * 4f, Color.Orange, 5, 0.33f, 0.75f); + GeneralParticleHandler.SpawnParticle(smoking); } } - // Almost instantly accelerate to very high speed - if (Projectile.velocity.Length() < 12f) + if (Projectile.numHits == 0) { - Projectile.velocity *= 1.25f; + // Homing movement + Vector2 guidedDirection = (Owner.ClampedMouseWorld() - Projectile.Center).SafeNormalize(Vector2.UnitX); + float guidedSpeed = Timer < 60f && !Projectile.Calamity().stealthStrike ? 4f : (Timer + (Projectile.Calamity().stealthStrike ? 60f : 0f)) / 7.5f; + if (guidedSpeed > MaxSpeed) + guidedSpeed = MaxSpeed; + float guidedTurnStrength = MathHelper.Lerp(0.05f, Projectile.Calamity().stealthStrike ? 0.32f : 0.18f, Timer / (float)Lifetime); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Owner.ClampedMouseWorld()).ToRotation(), guidedTurnStrength).ToRotationVector2() * guidedSpeed * Owner.Calamity().rogueVelocity; + + // If you haven't hit anything, explode and leave the wire + if (Projectile.timeLeft == 2) + SetUpLeftoverWireEffect(); } - else if (Main.rand.NextBool()) + else { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; + // Used for the sagging motion of the leftover wire + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y += 0.2f; + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; } - Projectile.ai[0] += 1f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.1f; - } + // Done to ensure the leftover wire is flush with the ground + Projectile.rotation = Projectile.numHits > 0 ? 0f : Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Wire[0].oldPosition = Wire[0].position; + Wire[0].position = Owner.Center; + Wire[Wire.Count - 1].oldPosition = Wire[0].position; + Wire[Wire.Count - 1].position = Projectile.Center + Vector2.UnitY.RotatedBy(Projectile.rotation) * (Projectile.numHits > 0 ? 14f : 8f); + Wire = VerletSimulatedSegment.SimpleSimulation(Wire, 10, loops: 1, gravity: 0.3f); } - public override void OnKill(int timeLeft) + // Both of these are done for wire leftover effect + public override bool OnTileCollide(Vector2 oldVelocity) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 40; j++) + if (Projectile.numHits == 0) + SetUpLeftoverWireEffect(); + return false; + } + public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; + + // Fuck off stupid Vile Spits + public override bool? CanHitNPC(NPC target) => NPCID.Sets.ProjectileNPC[target.type] ? false : null; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.OnFire, 120); + if (Main.myPlayer == Projectile.owner) { - int boomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust].velocity *= 3f; - if (Main.rand.NextBool()) + // Stealth strikes drop a whole ass meteorite because hell yeah + if (Projectile.Calamity().stealthStrike) { - Main.dust[boomDust].scale = 0.5f; - Main.dust[boomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Vector2 meteorSpawn = target.Center + new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(-650f, -750f)); + Vector2 meteorVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(meteorSpawn, target, 15f, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), meteorSpawn, meteorVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2, Projectile.owner, target.whoAmI); } } - for (int k = 0; k < 70; k++) + + // Visual effects + SetUpLeftoverWireEffect(); + } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); + + private void SetUpLeftoverWireEffect() + { + Projectile.numHits++; + Timer = 0f; + Projectile.timeLeft = 90; + + SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + for (int k = 0; k < 30; k++) { int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); Main.dust[boomDust2].noGravity = true; @@ -101,57 +148,47 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[boomDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + Vector2 source = new Vector2(Projectile.Center.X - 24f, Projectile.Center.Y - 24f); + for (int g = 1; g <= 3; g++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) + float velocityMult = g * 0.33f; + for (int spawn = 0; spawn < 2; spawn++) { - velocityMult = 0.66f; + int type = Main.rand.Next(61, 64); + int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + Gore gore = Main.gore[smoke]; + gore.velocity *= velocityMult; } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; } } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + public float WidthFunction(float completionRatio) => 0.4f; + public Color ColorFunction(float completionRatio) { - target.AddBuff(BuffID.OnFire, 120); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + float fadeThreshold = 60f; + float opacity = Projectile.numHits > 0 && Timer > fadeThreshold ? MathHelper.Lerp(0.75f, 0f, (Timer - fadeThreshold) / 30f) : 0.75f; + return Color.Orange * opacity; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); + public override bool PreDraw(ref Color lightColor) + { + // Draw the wire + List wirePoints = new List(); + if (Wire != null && Wire.Count > 0) + { + for (int i = 0; i < Wire.Count; i++) + { + wirePoints.Add(Wire[i].position); + } + } + PrimitiveRenderer.RenderTrail(wirePoints, new(WidthFunction, ColorFunction), 75); + + // Fist itself only draws if it hasn't hit + // After hitting, the fist stops drawing, creating the illusion of the wire being left behind + return Projectile.numHits == 0; + } } } diff --git a/Projectiles/Rogue/MeteorFistStealth.cs b/Projectiles/Rogue/MeteorFistStealth.cs deleted file mode 100644 index a70b1fae0a..0000000000 --- a/Projectiles/Rogue/MeteorFistStealth.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class MeteorFistStealth : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/Rogue/MeteorFistProj"; - - public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; - public override void SetDefaults() - { - Projectile.width = 20; - Projectile.height = 20; - Projectile.friendly = true; - Projectile.penetrate = 4; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 360; - Projectile.DamageType = RogueDamageClass.Instance; - } - - public override void AI() - { - if (Projectile.velocity.Length() >= 4f) - { - for (int i = 0; i < 2; i++) - { - float dustyX = 0f; - float dustyY = 0f; - if (i == 1) - { - dustyX = Projectile.velocity.X * 0.5f; - dustyY = Projectile.velocity.Y * 0.5f; - } - int meteorDust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + dustyX, Projectile.position.Y + 3f + dustyY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[meteorDust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[meteorDust].velocity *= 0.2f; - Main.dust[meteorDust].noGravity = true; - } - } - - // Almost instantly accelerate to very high speed - if (Projectile.velocity.Length() < 12f) - { - Projectile.velocity *= 1.25f; - } - else if (Main.rand.NextBool()) - { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - Main.rand.Next(2); - fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 0.5f); - Main.dust[fieryDust].scale = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[fieryDust].noGravity = true; - Main.dust[fieryDust].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f; - } - - Projectile.ai[0] += 1f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[0] > 10f || Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 10f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Math.Abs(Projectile.velocity.X) < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int j = 0; j < 40; j++) - { - int boomDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[boomDust].scale = 0.5f; - Main.dust[boomDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int k = 0; k < 70; k++) - { - int boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[boomDust2].noGravity = true; - Main.dust[boomDust2].velocity *= 5f; - boomDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Main.dust[boomDust2].velocity *= 2f; - } - - if (Main.netMode != NetmodeID.Server) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 3; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.OnFire, 120); - int boom = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); - Projectile.damage = (int)(Projectile.damage * 0.6666); - float minDist = 999f; - int index = 0; - // Get the closest enemy to the fist - if (Projectile.penetrate != -1) - { - foreach (var npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false) && npc != target) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - Vector2 newFistVelocity; - if (minDist < 999f) - { - newFistVelocity = Main.npc[index].Center - Projectile.Center; - } - else - { - newFistVelocity = -Projectile.velocity; - } - newFistVelocity.Normalize(); - newFistVelocity *= 10f; - Projectile.velocity = newFistVelocity; - } - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 120); - } -} diff --git a/Projectiles/Rogue/PlaguenadeProj.cs b/Projectiles/Rogue/PlaguenadeProj.cs index 8f8ff934e5..7e1a120629 100644 --- a/Projectiles/Rogue/PlaguenadeProj.cs +++ b/Projectiles/Rogue/PlaguenadeProj.cs @@ -111,7 +111,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[fire].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/RealityRuptureMini.cs b/Projectiles/Rogue/RealityRuptureMini.cs index 9add981a53..ce5384bb64 100644 --- a/Projectiles/Rogue/RealityRuptureMini.cs +++ b/Projectiles/Rogue/RealityRuptureMini.cs @@ -23,14 +23,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.width = 34; Projectile.height = 34; Projectile.friendly = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.penetrate = 3; Projectile.timeLeft = 800; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; Projectile.extraUpdates = 3; - Projectile.tileCollide = false; } public override void AI() @@ -96,7 +93,5 @@ namespace CalamityMod.Projectiles.Rogue { SoundEngine.PlaySound(Hitsound, Projectile.position); } - - //public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Ichor, 120); } } diff --git a/Projectiles/Rogue/ReboundingRainbowProj.cs b/Projectiles/Rogue/ReboundingRainbowProj.cs index 7a05825cc5..8f847a26a8 100644 --- a/Projectiles/Rogue/ReboundingRainbowProj.cs +++ b/Projectiles/Rogue/ReboundingRainbowProj.cs @@ -142,20 +142,15 @@ namespace CalamityMod.Projectiles.Rogue int splitProj = ModContent.ProjectileType(); if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[splitProj] < 16) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); - int disk2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile split = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 8; - Main.projectile[disk].usesIDStaticNPCImmunity = Main.projectile[disk2].usesIDStaticNPCImmunity = true; - Main.projectile[disk].timeLeft = Main.projectile[disk2].timeLeft = 60; + split.idStaticNPCHitCooldown = 8; + split.usesIDStaticNPCImmunity = true; + split.timeLeft = 60; } } } diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 894510f190..83667543fa 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -177,15 +177,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 2f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/SeafoamBombProj.cs b/Projectiles/Rogue/SeafoamBombProj.cs index aef6b80960..2dc19aeb2d 100644 --- a/Projectiles/Rogue/SeafoamBombProj.cs +++ b/Projectiles/Rogue/SeafoamBombProj.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), posX, posY, 0f, 0f, ModContent.ProjectileType(), (int)((double)Projectile.damage * 0.4), 0f, Projectile.owner, 0f, 0f); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = Projectile.Calamity().stealthStrike ? 6 : 3; diff --git a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs index 60081d12c1..14c1948ae8 100644 --- a/Projectiles/Rogue/ShatteredSunScorchedBlade.cs +++ b/Projectiles/Rogue/ShatteredSunScorchedBlade.cs @@ -230,7 +230,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dusty].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index 95bc85c671..ce965f114c 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -142,16 +142,17 @@ namespace CalamityMod.Projectiles.Rogue } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - // Boost dmg in proportion to money, caps at 3 plat. Unless in Gfb cuz it would be funny + // Boost dmg in proportion to money, caps at 1 plat. Much higher cap in GFB cuz it would be funny if (Projectile.Calamity().stealthStrike) { Player player = Main.player[Projectile.owner]; double money = Utils.CoinsCount(out bool overflow, player.inventory); - if (money >= 3000000 && !Main.zenithWorld) - money = 3000000; + double cap = Main.zenithWorld ? 100000000 : 1000000; + if (money >= cap) + money = cap; if (money != 0) { - modifiers.SourceDamage *= (float)(money / 1250000 + 1); + modifiers.SourceDamage *= (float)(money / 1000000 + 1); SoundEngine.PlaySound(TheSevensStriker.JackpotSound, Projectile.Center); for (int j = 0; j < 8; j++) { diff --git a/Projectiles/Rogue/SpearofDestinyProjectile.cs b/Projectiles/Rogue/SpearofDestinyProjectile.cs index 7326defabb..3a8948bad7 100644 --- a/Projectiles/Rogue/SpearofDestinyProjectile.cs +++ b/Projectiles/Rogue/SpearofDestinyProjectile.cs @@ -15,7 +15,6 @@ namespace CalamityMod.Projectiles.Rogue public static readonly SoundStyle Hitsound = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit2") { PitchVariance = 0.3f, Volume = 0.5f }; public int framesInAir = 0; - private bool initialized = false; public int SparkChance = 1; public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -25,12 +24,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 12; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 2; Projectile.timeLeft = 600; - AIType = 0; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; Projectile.extraUpdates = 2; } @@ -43,15 +38,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y += 0.3f; } - if (!initialized) - { - if (Projectile.Calamity().stealthStrike) - { - Projectile.penetrate++; - Projectile.tileCollide = false; - } - initialized = true; - } if (Projectile.timeLeft % 2 == 0 && Main.rand.NextBool(SparkChance) && Projectile.numHits == 0) { SparkParticle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 7, 0.7f, Color.PaleGoldenrod * 0.3f); @@ -121,7 +107,5 @@ namespace CalamityMod.Projectiles.Rogue Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, Color.White, rotation, origin, scale, SpriteEffects.None, 0); return false; } - - //public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Ichor, 120); } } diff --git a/Projectiles/Rogue/SphereBlue.cs b/Projectiles/Rogue/SphereBlue.cs index d2c7637ab4..4a9aeb4033 100644 --- a/Projectiles/Rogue/SphereBlue.cs +++ b/Projectiles/Rogue/SphereBlue.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage /= 2; Projectile.Damage(); SoundEngine.PlaySound(SoundID.NPCDeath37, Projectile.position); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Rogue/SubductionSlicerProj.cs b/Projectiles/Rogue/SubductionSlicerProj.cs index 8136bb01ce..429d657d1b 100644 --- a/Projectiles/Rogue/SubductionSlicerProj.cs +++ b/Projectiles/Rogue/SubductionSlicerProj.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue if (Main.rand.NextBool(5)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 16 : 127, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); Vector2 goreVec = new Vector2(Projectile.position.X + Projectile.width / 2 + Projectile.velocity.X, Projectile.position.Y + Projectile.height / 2 + Projectile.velocity.Y); - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Projectiles/Rogue/TalonLargeProj.cs b/Projectiles/Rogue/TalonLargeProj.cs index e5c7941a05..6b33174415 100644 --- a/Projectiles/Rogue/TalonLargeProj.cs +++ b/Projectiles/Rogue/TalonLargeProj.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,7 @@ namespace CalamityMod.Projectiles.Rogue public class TalonLargeProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + private NPC hitTarget = null; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 8; @@ -20,13 +22,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 5; + Projectile.penetrate = 2; Projectile.tileCollide = false; Projectile.timeLeft = 180; Projectile.DamageType = RogueDamageClass.Instance; Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 30 total + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -39,26 +41,85 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Clentaminator_Cyan, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - Projectile.ai[0]++; - if (Projectile.ai[0] > 2f) + + // Fade out after hitting + // After completely fading, spawn an extra slash if you haven't hit the limit + if (Projectile.numHits > 0) { - Projectile.tileCollide = true; + Projectile.alpha += 12; + if (Projectile.alpha >= 255) + { + // Exit early if we've hit the limit of 5 slashes + if (Projectile.ai[1] >= 4f) + { + Projectile.Kill(); + return; + } + + // Target index is originally the index of the NPC that was hit, but if this becomes invalid, find a new NPC to target + int index = hitTarget.whoAmI; + if (!hitTarget.CanBeChasedBy(Projectile)) + { + float checkDist = 1000f; + index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < checkDist) + { + checkDist = currentNPCDist; + index = n.whoAmI; + } + } + } + // Spawn the extra slash + if (index != -1) + { + Vector2 spawnOffset = Main.npc[index].Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 8f).RotatedBy(Main.rand.NextBool() ? MathHelper.Pi : 0) * Main.rand.NextFloat(140f, 180f); + Vector2 spawnVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnOffset, Main.npc[index], 12f, 3); + + if (Main.myPlayer == Projectile.owner) + { + Projectile extraSlash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnOffset, spawnVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, Projectile.ai[1] + 1); + extraSlash.Calamity().stealthStrike = true; + extraSlash.tileCollide = false; + (extraSlash.ModProjectile as TalonLargeProj).hitTarget = hitTarget; + } + + PointParticle point = new(spawnOffset, Vector2.Normalize(spawnVel), false, 6, 2.25f, Color.Cyan); + GeneralParticleHandler.SpawnParticle(point); + } + Projectile.Kill(); + } } + + Projectile.ai[0]++; + Projectile.tileCollide = Projectile.ai[1] == 0f && Projectile.ai[0] > 2f; Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } - public override void OnKill(int timeLeft) + public override bool? CanDamage() { - for (int i = 0; i <= 10; i++) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); - } + if (Projectile.numHits > 0) + return false; + if (hitTarget == null || Projectile.getRect().Intersects(hitTarget.getRect())) + return null; + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + hitTarget = target; + Projectile.tileCollide = false; } public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1); return false; } } diff --git a/Projectiles/Rogue/TalonSmallProj.cs b/Projectiles/Rogue/TalonSmallProj.cs index 921bcc1e21..017bdfe455 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -9,24 +10,17 @@ namespace CalamityMod.Projectiles.Rogue public class TalonSmallProj : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - private static float SineFrequency = 0.05f; - private static float SineAmplitude = 0.008f; - private static float RotationIncrement = 0.26f; public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; - - SineFrequency = 0.15f; - SineAmplitude = 0.06f; - RotationIncrement = 0.26f; } public override void AI() @@ -42,39 +36,35 @@ namespace CalamityMod.Projectiles.Rogue // Doesn't collide with tiles for the first 2 frames Projectile.tileCollide = Projectile.ai[0] > 2f; - // Apply fancy sine movement, then slight gravity, then cap velocity. - // Original velocity is reconstructed so that it can be used in the calculation + // Apply fancy sine movement. Original velocity is reconstructed so that it can be used in the calculation. Vector2 originalVelocity = new Vector2(Projectile.localAI[0], Projectile.localAI[1]); ApplySineVelocity(originalVelocity); - // projectile.velocity.Y += 0.08f; - float currentSpeed = Projectile.velocity.Length(); - float maxSpeed = 1.4f * originalVelocity.Length(); - if (currentSpeed > maxSpeed) - Projectile.velocity *= maxSpeed / currentSpeed; // spawn dust if (Main.rand.NextBool(5)) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + int dustType = Main.rand.NextBool() ? DustID.Chlorophyte : DustID.UnusedBrown; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, Scale: 0.9f); } // freely spins instead of facing forwards - Projectile.rotation += RotationIncrement; + Projectile.rotation += 0.26f; Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.ai[0]++; } private void ApplySineVelocity(Vector2 baseVelocity) { - float radians = Projectile.ai[1] * (-MathHelper.PiOver2 + SineFrequency * Projectile.ai[0]); - Projectile.velocity += SineAmplitude * baseVelocity.RotatedBy(radians); + float radians = Projectile.ai[1] * (float)Math.Sin(-MathHelper.PiOver2 + 0.25f * Projectile.ai[0]); + Projectile.velocity = baseVelocity.RotatedBy(radians); } public override void OnKill(int timeLeft) { - for (int i = 0; i <= 5; i++) + for (int i = 0; i < 4; i++) { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.UnusedBrown, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); + int dustType = Main.rand.NextBool() ? DustID.Chlorophyte : DustID.UnusedBrown; + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } } diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 7b4cbfeb6e..9741c76fb2 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -51,19 +51,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - - int projID = ModContent.ProjectileType(); - int splitDamage = (int)(Projectile.damage * 0.25f); - float splitKB = 1f; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f) * 2f, (float)(Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f) * 2f, (float)(-Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 10f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack * 0.25f, Projectile.owner); } } } diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index ecc9ecb312..e0063dc6e0 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -1,4 +1,5 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon; using CalamityMod.CalPlayer; using CalamityMod.Projectiles.Typeless; @@ -242,6 +243,7 @@ namespace CalamityMod.Projectiles.Summon { if (Main.rand.NextBool(3)) target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 90); SoundEngine.PlaySound(SoundID.Item70 with { Volume = SoundID.Item70.Volume * 0.5f }, Projectile.Center); Projectile.velocity = new Vector2(0f, 5f).RotatedBy(Projectile.velocity.ToRotation() + 1.5f); diff --git a/Projectiles/Summon/CosmicBlastBig.cs b/Projectiles/Summon/CosmicBlastBig.cs index 0706b0aca0..7cc8b704ca 100644 --- a/Projectiles/Summon/CosmicBlastBig.cs +++ b/Projectiles/Summon/CosmicBlastBig.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[rainbowDust].velocity = value3 * 0.66f; Main.dust[rainbowDust].position = Projectile.Center + value3 * 12f; } - if (Main.rand.NextBool(24) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(24) && !Main.dedServ) { int rainbowGore = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[rainbowGore].velocity *= 0.66f; @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Summon int rainbowDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowTorch, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1.2f); Main.dust[rainbowDust].noGravity = true; } - if (Main.rand.NextBool(10) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(10) && !Main.dedServ) { Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } diff --git a/Projectiles/Summon/CosmilampBeam.cs b/Projectiles/Summon/CosmilampBeam.cs index 59c85fe961..68d6b66b8f 100644 --- a/Projectiles/Summon/CosmilampBeam.cs +++ b/Projectiles/Summon/CosmilampBeam.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; @@ -104,6 +105,8 @@ namespace CalamityMod.Projectiles.Summon return MathHelper.Lerp(0f, maxWidth, expansionCompletion); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); + public override bool PreDraw(ref Color lightColor) { Projectile.localAI[0] = 0f; diff --git a/Projectiles/Summon/Dreadmine.cs b/Projectiles/Summon/Dreadmine.cs index 6a71d0f425..cf476b8845 100644 --- a/Projectiles/Summon/Dreadmine.cs +++ b/Projectiles/Summon/Dreadmine.cs @@ -202,7 +202,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Summon/HallowedStarSummon.cs b/Projectiles/Summon/HallowedStarSummon.cs index e009601059..4bb33d179c 100644 --- a/Projectiles/Summon/HallowedStarSummon.cs +++ b/Projectiles/Summon/HallowedStarSummon.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.alpha = alphaMin; } Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * Projectile.direction; - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, Projectile.velocity * 0.2f, 16, 1f); Main.gore[idx].velocity *= 0.66f; @@ -70,7 +70,7 @@ namespace CalamityMod.Projectiles.Summon { Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f); } - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) { Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } @@ -102,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 3; i++) { diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index 6fc3619098..c37e9eca65 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -578,7 +578,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int index = Gore.NewGore(Projectile.GetSource_Death(), new Vector2(Projectile.position.X - (float)(Projectile.width / 2), Projectile.position.Y - (float)(Projectile.height / 2)), new Vector2(0.0f, 0.0f), Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index c26bbef323..e6a4a36e32 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -89,6 +89,11 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.DisableCrit(); + } + public override Color? GetAlpha(Color lightColor) { if (Projectile.timeLeft < 85) diff --git a/Projectiles/Summon/MiniGuardianHolyRay.cs b/Projectiles/Summon/MiniGuardianHolyRay.cs index 0256dbe178..7064b63c4f 100644 --- a/Projectiles/Summon/MiniGuardianHolyRay.cs +++ b/Projectiles/Summon/MiniGuardianHolyRay.cs @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Summon ModContent.Request("CalamityMod/ExtraTextures/Lasers/ProvidenceHolyRayEndNight", AssetRequestMode.ImmediateLoad).Value; float num223 = Projectile.localAI[1]; //length of laser - Color color44 = ProvUtils.GetDayNightColor(!Main.dayTime, 0) * 0.9f; + Color color44 = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0) * 0.9f; Vector2 vector = Projectile.Center - Main.screenPosition; Rectangle? sourceRectangle2 = null; Main.spriteBatch.Draw(texture2D19, vector, sourceRectangle2, color44, Projectile.rotation, texture2D19.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); diff --git a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs index 29d1cbf675..2fe43d71ee 100644 --- a/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs +++ b/Projectiles/Summon/ProfanedSoulCrystalProjectiles.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { - int pscState = (int)(Main.dayTime ? Providence.BossMode.Day : Providence.BossMode.Night); + int pscState = (int)(Main.dayTime ? Providence.BossMode.Normal : Providence.BossMode.Enraged); int dustID = ProvUtils.GetDustID(!Main.dayTime); int num469 = Dust.NewDust(Projectile.Center, Projectile.width, Projectile.height, dustID, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; @@ -136,7 +136,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -144,7 +144,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -325,7 +325,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -333,7 +333,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -499,8 +499,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha), 1); return false; } @@ -735,7 +735,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -743,7 +743,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Summon/ProfanedCrystalRangedHugesNight").Value; int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -801,7 +801,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.scale != 1.5f) return; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int num625 = 0; num625 < 3; num625++) { @@ -939,14 +939,14 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -1790,8 +1790,8 @@ namespace CalamityMod.Projectiles.Summon public override bool PreDraw(ref Color lightColor) { var psc = Projectile.ai[0] > 0f; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime && psc, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Type].Value); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], ProvUtils.GetDayNightColor(!Main.dayTime && psc, Projectile.alpha), 1); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime && psc, Projectile.alpha, true), 4f, Terraria.GameContent.TextureAssets.Projectile[Type].Value); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], ProvUtils.GetColorBasedOnEnrage(!Main.dayTime && psc, Projectile.alpha), 1); return false; } @@ -1908,7 +1908,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -1916,7 +1916,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } @@ -2047,7 +2047,7 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) { - return ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha); + return ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha); } public override bool PreDraw(ref Color lightColor) @@ -2055,7 +2055,7 @@ namespace CalamityMod.Projectiles.Summon Texture2D texture = Main.dayTime ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyFire2Night").Value; int num214 = texture.Height / Main.projFrames[Type]; int y6 = num214 * Projectile.frame; - Projectile.DrawBackglow(ProvUtils.GetDayNightColor(!Main.dayTime, Projectile.alpha, true), 4f, texture); + Projectile.DrawBackglow(ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, Projectile.alpha, true), 4f, texture); Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, num214 / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } diff --git a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs index 10a4fd4d31..3945b1d12d 100644 --- a/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs +++ b/Projectiles/Summon/SmallAresArms/MinionPlasmaGas.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms Time++; // 08DEC2023: Ozzatron: All below code does not run on dedicated servers as it requires clientside lighting information. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Calculate light power. This checks below the position of the fog to check if this fog is underground. diff --git a/Projectiles/Summon/SpikecragSpike.cs b/Projectiles/Summon/SpikecragSpike.cs index 64bbebe33c..54160267e4 100644 --- a/Projectiles/Summon/SpikecragSpike.cs +++ b/Projectiles/Summon/SpikecragSpike.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + target.AddBuff(ModContent.BuffType(), 120); if (Main.zenithWorld) { target.AddBuff(ModContent.BuffType(), 180); diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index 2d75e0c803..dfa4c71d3b 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -551,7 +551,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int index = Gore.NewGore(Projectile.GetSource_Death(), Projectile.Center, new Vector2(0f, 0f), Main.rand.Next(61, 64), Projectile.scale); Main.gore[index].velocity *= 0.1f; diff --git a/Projectiles/Summon/Umbrella/MagicHammer.cs b/Projectiles/Summon/Umbrella/MagicHammer.cs index dbfb69f4b1..5f939a93d9 100644 --- a/Projectiles/Summon/Umbrella/MagicHammer.cs +++ b/Projectiles/Summon/Umbrella/MagicHammer.cs @@ -275,7 +275,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella Main.dust[confetti].velocity.X += Main.rand.NextFloat(-2.5f, 2.5f); Main.dust[confetti].velocity.Y += Main.rand.NextFloat(-2.5f, 2.5f); Main.dust[confetti].scale *= Main.rand.NextFloat(0.7f, 1.3f); - if (Main.netMode != NetmodeID.Server && Main.rand.NextBool()) + if (!Main.dedServ && Main.rand.NextBool()) { int confettiGore = Main.rand.Next(276, 283); int idx = Gore.NewGore(Projectile.GetSource_FromThis(), target.Center, target.velocity, confettiGore, 1f); diff --git a/Projectiles/Summon/Umbrella/MagicTree.cs b/Projectiles/Summon/Umbrella/MagicTree.cs index 725df0f5ca..6eea005194 100644 --- a/Projectiles/Summon/Umbrella/MagicTree.cs +++ b/Projectiles/Summon/Umbrella/MagicTree.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Projectiles.Summon.Umbrella break; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 20; i++) { diff --git a/Projectiles/Typeless/AeroExplosive.cs b/Projectiles/Typeless/AeroExplosive.cs index b2526a6fd6..c5598f8f9a 100644 --- a/Projectiles/Typeless/AeroExplosive.cs +++ b/Projectiles/Typeless/AeroExplosive.cs @@ -104,7 +104,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[fire].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Typeless/AstralStar.cs b/Projectiles/Typeless/AstralStar.cs index c393d028f3..3958cf21cd 100644 --- a/Projectiles/Typeless/AstralStar.cs +++ b/Projectiles/Typeless/AstralStar.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[astralDust].position = Projectile.Center + rotational * 12f; } - if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(48) && !Main.dedServ) { int starry = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f); Main.gore[starry].velocity *= 0.66f; @@ -81,7 +81,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.light = 0.9f; if (Main.rand.NextBool(10)) Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1f); - if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(20) && !Main.dedServ) Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f); } } @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Typeless starryDust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), 0f, 0f, 100, default, 1f); Main.dust[starryDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int k = 0; k < 3; k++) Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f); diff --git a/Projectiles/Typeless/BabyCannonballProjectile.cs b/Projectiles/Typeless/BabyCannonballProjectile.cs new file mode 100644 index 0000000000..15f00571b0 --- /dev/null +++ b/Projectiles/Typeless/BabyCannonballProjectile.cs @@ -0,0 +1,137 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + // This is p much just the Sulphuric Acid Cannon rocket but without the sticky behaviour + public class BabyCannonballProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + + public override string Texture => "CalamityMod/NPCs/Abyss/BabyCannonballJellyfish"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + Main.projFrames[Type] = 4; + } + + public override void SetDefaults() + { + Projectile.width = 36; + Projectile.height = 36; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.alpha = 255; + Projectile.MaxUpdates = 3; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + + CalamityUtils.HomeInOnNPC(Projectile, true, 720f, 16f, Projectile.MaxUpdates * 20f); + // Trailing effects + if (!Main.dedServ && Projectile.FinalExtraUpdate() && Projectile.velocity.Length() > 3f) + { + Color color = new Color(136, 211, 113, 127); + Color fadeColor = new Color(165, 165, 86); + Vector2 gasSpawnPosition = Projectile.Center + Main.rand.NextVector2Circular(8f, 8f); + Vector2 gasVelocity = Projectile.velocity * 1.2f + Projectile.velocity.RotatedBy(0.75f) * 0.3f; + gasVelocity *= Main.rand.NextFloat(0.24f, 0.6f); + + Particle gas = new MediumMistParticle(gasSpawnPosition, gasVelocity, color, fadeColor, Main.rand.NextFloat(0.5f, 1f), 205 - Main.rand.Next(50), 0.02f); + GeneralParticleHandler.SpawnParticle(gas); + for (int i = 0; i < 2; i++) + { + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity, false, 8, 0.13f * (i == 0 ? 0.2f : 0.5f), Color.Lerp(Color.SeaGreen, Color.PaleGreen, 0.25f) * 0.5f, new Vector2(0.3f, 1f), false, false, 0.8f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < 2; i++) + { + Color bubbleColor = Main.rand.NextBool() ? Color.SeaGreen : Color.YellowGreen; + Vector2 bubbleSpawnPos = Projectile.Center + Main.rand.NextVector2Circular(50, 50); + Vector2 bubbleVelocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f); + Particle bubble = new DirectionalPulseRing(bubbleSpawnPos, bubbleVelocity, bubbleColor, new Vector2(0.8f, 1), 0, 0.1f, 0f, 75); + GeneralParticleHandler.SpawnParticle(bubble); + } + } + Projectile.Opacity = 1f; + + if (Projectile.frameCounter++ > 4) + { + Projectile.frameCounter = 0; + Projectile.frame++; + } + if (Projectile.frame >= Main.projFrames[Type]) + { + Projectile.frame = 0; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); + + public override void OnKill(int timeLeft) + { + SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); + if (Projectile.owner == Main.myPlayer) + { + int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Main.projectile[p].DamageType = DamageClass.Default; + } + // Circular spread of clouds and bubbles for impact + for (int i = 0; i < 35; i++) + { + Vector2 smokeVel = Main.rand.NextVector2Unit() * Main.rand.NextVector2Circular(32f, 32f); + Color smokeColor = Main.rand.NextBool() ? Color.SeaGreen : Color.PaleGreen; + Particle smoke = new MediumMistParticle(Projectile.Center, smokeVel, smokeColor, Color.Black, Main.rand.NextFloat(1.4f, 4f), (200 - Main.rand.Next(60)), 0.08f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 8; i++) + { + Vector2 bubbleVel = Main.rand.NextVector2Circular(26f, 26f); + Color bubbleColor = Main.rand.NextBool() ? Color.OliveDrab : Color.SeaGreen; + DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center, bubbleVel, bubbleColor, new Vector2(0.8f, 1), 0, 0.21f, 0f, 50); + GeneralParticleHandler.SpawnParticle(pulse); + } + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.SeaGreen, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (targetHitbox.Width > 8 && targetHitbox.Height > 8) + { + targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8); + } + return null; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 origin = frame.Size() * 0.5f; + Main.EntitySpriteDraw(Texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Projectiles/Typeless/BossRushEffectThing.cs b/Projectiles/Typeless/BossRushEffectThing.cs index 7242715a11..7b91925a73 100644 --- a/Projectiles/Typeless/BossRushEffectThing.cs +++ b/Projectiles/Typeless/BossRushEffectThing.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Typeless BossRushDialogueSystem.StartDialogue(DownedBossSystem.startedBossRushAtLeastOnce ? BossRushDialoguePhase.StartRepeat : BossRushDialoguePhase.Start); CalamityNetcode.SyncWorld(); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { BossRushStagePacket.Send(); } diff --git a/Projectiles/Typeless/BossRushEndEffectThing.cs b/Projectiles/Typeless/BossRushEndEffectThing.cs index 14e38d5403..67ad0a2a99 100644 --- a/Projectiles/Typeless/BossRushEndEffectThing.cs +++ b/Projectiles/Typeless/BossRushEndEffectThing.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Typeless foreach (Player p in Main.ActivePlayers) { int rock = Item.NewItem(p.GetSource_Misc("CalamityMod_BossRushRock"), (int)p.position.X, (int)p.position.Y, p.width, p.height, ModContent.ItemType()); - if (rock < Main.maxItems && Main.netMode == NetmodeID.Server) + if (rock < Main.maxItems && Main.dedServ) { Main.timeItemSlotCannotBeReusedFor[rock] = 54000; NetMessage.SendData(MessageID.InstancedItem, p.whoAmI, -1, null, rock); diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index a84c07f3e1..99313d1a2a 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -189,23 +189,11 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - Vector2 velocity = Projectile.velocity; - velocity.Normalize(); - velocity *= 4f; - - int spread = 45; - int numProj = 4; - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y); - double startAngle = Math.Atan2(velocity.X, velocity.Y) - rotation / 2; - double deltaAngle = rotation / (float)numProj; - double offsetAngle; - - for (int i = 0; i < numProj; i++) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4f; + for (int i = 0; i < 4; i++) { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), - ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner, 0f, 0f); + float offset = MathHelper.ToRadians(MathHelper.Lerp(-22.5f, 22.5f, i / 3f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(offset), ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner); } SoundEngine.PlaySound(SoundID.Item110, Projectile.Center); diff --git a/Projectiles/Typeless/DemonshadeRedDevil.cs b/Projectiles/Typeless/DemonshadeRedDevil.cs index 2e1a342110..6a464560cb 100644 --- a/Projectiles/Typeless/DemonshadeRedDevil.cs +++ b/Projectiles/Typeless/DemonshadeRedDevil.cs @@ -14,6 +14,9 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public int dust = 3; + public ref float State => ref Projectile.ai[0]; // 0 = attacking, 1 = returning, 2 = initial spawn + public ref float Timer => ref Projectile.ai[1]; + public override void SetStaticDefaults() { Main.projFrames[Type] = 5; @@ -55,6 +58,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.timeLeft = 2; } } + dust--; if (dust >= 0) { @@ -65,57 +69,41 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[brimDust].scale *= 1.15f; } } + Projectile.frameCounter++; if (Projectile.frameCounter > 8) { - Projectile.frame++; Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame > 4) + Projectile.frame = 0; } - if (Projectile.frame > 4) - { - Projectile.frame = 0; - } + float lights = (float)Main.rand.Next(90, 111) * 0.01f; lights *= Main.essScale; Lighting.AddLight(Projectile.Center, 1f * lights, 0f * lights, 0.15f * lights); + Projectile.rotation = Projectile.velocity.X * 0.04f; if ((double)Math.Abs(Projectile.velocity.X) > 0.2) { Projectile.spriteDirection = -Projectile.direction; } - float attackRange = 2000f; - bool decelerate = false; - if (Projectile.ai[0] == 2f) + + if (State == 2f) { - Projectile.ai[1] += 1f; - Projectile.extraUpdates = 1; - if (Projectile.ai[1] > 40f) + Timer++; + if (Timer > 60f) { - Projectile.ai[1] = 1f; - Projectile.ai[0] = 0f; - Projectile.extraUpdates = 0; - Projectile.numUpdates = 0; + Timer = 1f; + State = 0f; Projectile.netUpdate = true; } - else - { - decelerate = true; - } - } - if (decelerate) - { return; } - Vector2 projPos = Projectile.position; + + Vector2 attackPos = Projectile.position; + float attackRange = 2000f; bool canAttack = false; - if (Projectile.ai[0] != 1f) - { - Projectile.tileCollide = false; - } - if (Projectile.tileCollide && WorldGen.SolidTile(Framing.GetTileSafely((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16))) - { - Projectile.tileCollide = false; - } if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; @@ -125,7 +113,7 @@ namespace CalamityMod.Projectiles.Typeless if (!canAttack && npcDist < attackRange) { attackRange = npcDist; - projPos = npc.Center; + attackPos = npc.Center; canAttack = true; } } @@ -140,68 +128,54 @@ namespace CalamityMod.Projectiles.Typeless if ((!canAttack && npcDist < attackRange) && Collision.CanHitLine(Projectile.position, Projectile.width, Projectile.height, nPC2.position, nPC2.width, nPC2.height)) { attackRange = npcDist; - projPos = nPC2.Center; + attackPos = nPC2.Center; canAttack = true; } } } } - float separationAnxietyDist = 2000f; - if (canAttack) - { - separationAnxietyDist = 3000f; - } + + float separationAnxietyDist = canAttack ? 3000f: 2000f; if (Vector2.Distance(player.Center, Projectile.Center) > separationAnxietyDist) { - Projectile.ai[0] = 1f; - Projectile.tileCollide = false; + State = 1f; Projectile.netUpdate = true; } - if (canAttack && Projectile.ai[0] == 0f) + if (canAttack && State == 0f) { - Vector2 projDirection = projPos - Projectile.Center; + Vector2 projDirection = attackPos - Projectile.Center; float projDist = projDirection.Length(); projDirection.Normalize(); if (projDist > 200f) { - float scaleFactor2 = 16f; //8 - projDirection *= scaleFactor2; + projDirection *= 25f; Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } else { - projDirection *= -4f; + projDirection *= -9f; Projectile.velocity = (Projectile.velocity * 40f + projDirection) / 41f; } } else { - bool isReturning = false; - if (!isReturning) - { - isReturning = Projectile.ai[0] == 1f; - } - float returnSpeed = 5f; //6 - if (isReturning) - { - returnSpeed = 12f; //15 - } - Vector2 center2 = Projectile.Center; - Vector2 playerDirection = player.Center - center2 + new Vector2(0f, -30f); //-60 + bool isReturning = State == 1f; + float returnSpeed = isReturning ? 24f : 15f; + + Vector2 playerDirection = player.Center - Projectile.Center + new Vector2(0f, -30f); float playerDist = playerDirection.Length(); - if (playerDist > 200f && returnSpeed < 6.5f) //200 and 8 + if (playerDist > 200f && returnSpeed < 10f) { - returnSpeed = 6.5f; //8 + returnSpeed = 18f; } if (playerDist < 150f && isReturning && !Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) { - Projectile.ai[0] = 0f; + State = 0f; Projectile.netUpdate = true; } if (playerDist > 2000f) { - Projectile.position.X = player.Center.X - (float)(Projectile.width / 2); - Projectile.position.Y = player.Center.Y - (float)(Projectile.height / 2); + Projectile.Center = player.Center; Projectile.netUpdate = true; } if (playerDist > 70f) @@ -210,34 +184,29 @@ namespace CalamityMod.Projectiles.Typeless playerDirection *= returnSpeed; Projectile.velocity = (Projectile.velocity * 40f + playerDirection) / 41f; } - else if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) + else if (Projectile.velocity == Vector2.Zero) { - Projectile.velocity.X = -0.2f; - Projectile.velocity.Y = -0.1f; + Projectile.velocity = new Vector2(-0.2f, -0.1f); } } - if (Projectile.ai[1] > 0f) + if (Timer > 0f) { - Projectile.ai[1] += (float)Main.rand.Next(1, 4); + Timer += Main.rand.Next(1, 2 + 1); } - if (Projectile.ai[1] > 80f) + if (Timer > 80f) { - Projectile.ai[1] = 0f; + Timer = 0f; Projectile.netUpdate = true; } - if (Projectile.ai[0] == 0f) + if (State == 0f) { - float speed = 24f; - int projType = ProjectileID.UnholyTridentFriendly; - if (canAttack && Projectile.ai[1] == 0f) + if (canAttack && Timer == 0f) { - Projectile.ai[1] += 1f; - if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, projPos, 0, 0)) + Timer += 1f; + if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, attackPos, 0, 0)) { - Vector2 velocity = projPos - Projectile.Center; - velocity.Normalize(); - velocity *= speed; - int trident = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, 0f, Main.myPlayer); + Vector2 velocity = Vector2.Normalize(attackPos - Projectile.Center) * 24f; + int trident = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ProjectileID.UnholyTridentFriendly, Projectile.damage, 0f, Main.myPlayer); if (trident.WithinBounds(Main.maxProjectiles)) { Main.projectile[trident].timeLeft = 300; @@ -251,16 +220,6 @@ namespace CalamityMod.Projectiles.Typeless } } - public override bool PreDraw(ref Color lightColor) - { - SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int framing = Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height / Main.projFrames[Type]; - int y6 = framing * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); - return false; - } - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index 7278015b26..7d0236bda1 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Typeless } Vector2 goreVec = Projectile.position; - if (Main.rand.NextBool(8) && Main.netMode != NetmodeID.Server) + if (Main.rand.NextBool(8) && !Main.dedServ) { int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 0.75f); Main.gore[smoke].behindTiles = true; diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index 9a7a34cff4..7d3096428b 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localNPCHitCooldown = 10; Projectile.Damage(); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreVec = new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f); float smokeScale = 0.66f; diff --git a/Projectiles/Typeless/ShadeNimbusSpawner.cs b/Projectiles/Typeless/ShadeNimbusSpawner.cs index a29894b24e..d8328507a0 100644 --- a/Projectiles/Typeless/ShadeNimbusSpawner.cs +++ b/Projectiles/Typeless/ShadeNimbusSpawner.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Typeless for (int k = 0; k < 20; k++) Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Glass, Projectile.velocity.X > 0f ? 1f : -1f, -1f); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y * 0.4f); Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore").Type); diff --git a/Projectiles/Typeless/SkyFlareFriendly.cs b/Projectiles/Typeless/SkyFlareFriendly.cs index 629bd290f6..dac01d5b9a 100644 --- a/Projectiles/Typeless/SkyFlareFriendly.cs +++ b/Projectiles/Typeless/SkyFlareFriendly.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[skyDust2].velocity *= 2f; } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = Projectile.Center; int goreAmt = 3; diff --git a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs index 46beb0c945..616ca734da 100644 --- a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(smoke); } - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { for (int i = 0; i < 4; i++) { diff --git a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs index cb061bacb7..a4d86d4de0 100644 --- a/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs +++ b/Projectiles/Typeless/WulfrumScaffoldKitHoldout.cs @@ -117,7 +117,7 @@ namespace CalamityMod.Projectiles.Typeless Owner.ConsumeItem(ModContent.ItemType()); Kit.storedScrap = WulfrumScaffoldKit.TilesPerScrap - 1; SoundEngine.PlaySound(SoundID.Item65); - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Gore shard = Gore.NewGoreDirect(Projectile.GetSource_FromThis(), Owner.Center, Main.rand.NextVector2Circular(4f, 4f), Mod.Find("WulfrumPinger2").Type, Main.rand.NextFloat(0.5f, 1f)); shard.timeLeft = 10; diff --git a/Skies/AstralMonolithSky.cs b/Skies/AstralMonolithSky.cs index 07dad080e5..e486069cd3 100644 --- a/Skies/AstralMonolithSky.cs +++ b/Skies/AstralMonolithSky.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Skies spriteBatch.Draw(SkyTextureRefs.AstralSky.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); // Terraria's conditions. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int bgTop = (int)((-Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); float colorMult = 0.952f * opacity; diff --git a/Skies/AstralSky.cs b/Skies/AstralSky.cs index 3c8d2caa0c..3814134d1a 100644 --- a/Skies/AstralSky.cs +++ b/Skies/AstralSky.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Skies spriteBatch.Draw(SkyTextureRefs.AstralSky.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White * opacity); // Terraria's conditions. - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int bgTop = (int)((-Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); float colorMult = 0.952f * opacity; diff --git a/Skies/ExoMechsSky.cs b/Skies/ExoMechsSky.cs index efdc1eb8f9..0a873ca312 100644 --- a/Skies/ExoMechsSky.cs +++ b/Skies/ExoMechsSky.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Skies public static void CreateLightningBolt(int count = 1, bool playSound = false) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; for (int i = 0; i < count; i++) diff --git a/Sounds/Custom/AstrumAureus/AstrumAureusSpawn.ogg b/Sounds/Custom/AstrumAureus/AstrumAureusSpawn.ogg new file mode 100644 index 0000000000..9319832fdc Binary files /dev/null and b/Sounds/Custom/AstrumAureus/AstrumAureusSpawn.ogg differ diff --git a/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn.ogg b/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn.ogg new file mode 100644 index 0000000000..f4c922d5cc Binary files /dev/null and b/Sounds/Custom/BrimstoneElemental/BrimstoneSpawn.ogg differ diff --git a/Sounds/Custom/ProfanedGuardians/GuardianSpawn.ogg b/Sounds/Custom/ProfanedGuardians/GuardianSpawn.ogg new file mode 100644 index 0000000000..06572d9cd4 Binary files /dev/null and b/Sounds/Custom/ProfanedGuardians/GuardianSpawn.ogg differ diff --git a/Sounds/Item/WaterSplash1.ogg b/Sounds/Item/WaterSplash1.ogg new file mode 100644 index 0000000000..ccad82cb42 Binary files /dev/null and b/Sounds/Item/WaterSplash1.ogg differ diff --git a/Sounds/Item/WaterSplash2.ogg b/Sounds/Item/WaterSplash2.ogg new file mode 100644 index 0000000000..717b7bc646 Binary files /dev/null and b/Sounds/Item/WaterSplash2.ogg differ diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs index 1d5e366f57..d1915040fc 100644 --- a/Systems/Collections/PierceResistExceptionList.cs +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Systems.Collections ProjectileID.Terragrim, ProjectileType(), ProjectileType(), + ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -89,7 +91,7 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs index 27808b0d0a..6dab54e61f 100644 --- a/Systems/Collections/ProjectileDestroyExceptionsList.cs +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -3,6 +3,7 @@ using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.MaceFlails; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using Terraria.ID; @@ -32,7 +33,7 @@ namespace CalamityMod.Systems.Collections ProjectileID.ChargedBlasterCannon, ProjectileID.MedusaHead, - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Systems/UIManagementSystem.cs b/Systems/UIManagementSystem.cs index bf003f4504..fa9408ef58 100644 --- a/Systems/UIManagementSystem.cs +++ b/Systems/UIManagementSystem.cs @@ -149,6 +149,14 @@ namespace CalamityMod.Systems DefenseDamageDisplayUI.Draw(Main.spriteBatch); return true; }, InterfaceScaleType.None)); + + // Canvas painting. + layers.Insert(mouseIndex, new LegacyGameInterfaceLayer("Canvas Painting", () => + { + if (Main.LocalPlayer.Calamity().CurrentlyViewedCanvasID != -1) + CanvasPaintingUIState.DrawCanvasUI(Main.spriteBatch); + return true; + }, InterfaceScaleType.None)); } // Invasion UIs. diff --git a/Systems/World/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs index 5b2fe01fb1..ad3ac88db8 100644 --- a/Systems/World/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -192,7 +192,7 @@ namespace CalamityMod.Systems WorldGen.SquareTileFrame(x, y2); WorldGen.SquareTileFrame(x + 2, y2); WorldGen.SquareTileFrame(x - 1, y2); - if (Main.tile[x, y2].TileType == TileID.PlanteraBulb && Main.netMode == NetmodeID.Server) + if (Main.tile[x, y2].TileType == TileID.PlanteraBulb && Main.dedServ) { NetMessage.SendTileSquare(-1, x, y2, 5); } @@ -225,7 +225,7 @@ namespace CalamityMod.Systems WorldGen.PlaceJunglePlant(x, y2, TileID.LifeFruit, WorldGen.genRand.Next(3), 0); WorldGen.SquareTileFrame(x, y2); WorldGen.SquareTileFrame(x + 1, y2 + 1); - if (Main.tile[x, y2].TileType == TileID.LifeFruit && Main.netMode == NetmodeID.Server) + if (Main.tile[x, y2].TileType == TileID.LifeFruit && Main.dedServ) { NetMessage.SendTileSquare(-1, x, y2, 4); } @@ -307,7 +307,7 @@ namespace CalamityMod.Systems WorldGen.SquareTileFrame(x, y); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, x, y, 1, TileChangeType.None); } } diff --git a/TileEntities/TECanvasPainting.cs b/TileEntities/TECanvasPainting.cs new file mode 100644 index 0000000000..7c478dbcc0 --- /dev/null +++ b/TileEntities/TECanvasPainting.cs @@ -0,0 +1,83 @@ +using CalamityMod.Packets; +using CalamityMod.Tiles.Furniture; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; + +namespace CalamityMod.TileEntities +{ + public class TECanvasPainting : ModTileEntity + { + public Vector2 framePosition = new Vector2(0, 0); + public float scale = 1f; + + public override bool IsTileValidForEntity(int x, int y) + { + Tile tile = Main.tile[x, y]; + return tile.HasTile && tile.TileType == ModContent.TileType() && tile.TileFrameX == 0 && tile.TileFrameY == 0; + } + + public override int Hook_AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + // WHY do I need to subtract 1 from both???? + // Todo: Figure out what the heckity heckering heckling heckereckering heckly heccing hecky heck heck is happening here + int iMinus = i - 1; + int jMinus = j - 1; + + // If in multiplayer, tell the server to place the tile entity and DO NOT place it yourself. That would mismatch IDs. + // Also tell the server that you placed the 5x5 tiles that make up the painting. + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, iMinus, jMinus, 5, 5); + NetMessage.SendData(MessageID.TileEntityPlacement, -1, -1, null, iMinus, jMinus, Type); + return -1; + } + + // If in single player, just place the tile entity + int id = Place(iMinus, jMinus); + return id; + } + + public override void OnNetPlace() + { + NetMessage.SendData(MessageID.TileEntitySharing, -1, -1, null, ID, Position.X, Position.Y); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(framePosition.X); + writer.Write(framePosition.Y); + writer.Write(scale); + } + + public override void NetReceive(BinaryReader reader) + { + framePosition = new Vector2(reader.ReadSingle(), reader.ReadSingle()); + scale = reader.ReadSingle(); + } + + public override void SaveData(TagCompound tag) + { + tag.Add("posX", framePosition.X); + tag.Add("posY", framePosition.Y); + tag.Add("scale", scale); + } + + public override void LoadData(TagCompound tag) + { + framePosition = new Vector2(tag.Get("posX"), tag.Get("posY")); + scale = tag.Get("scale"); + } + + public void SendSyncPacket() + { + if (Main.netMode == NetmodeID.SinglePlayer) + return; + + TECanvasPaintingPacket.Send(this, framePosition.X, framePosition.Y, scale); + } + } +} diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 892883f846..78fcd95db6 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -215,7 +215,7 @@ namespace CalamityMod.TileEntities InitialCellCountBeforeDecrypting = 0; LearnFromHeldSchematic(out bool anythingChanged); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { SyncDecryptCountdown(); SyncContainedStuff(); @@ -255,7 +255,7 @@ namespace CalamityMod.TileEntities anythingChanged = true; } - if (Main.netMode == NetmodeID.Server && anythingChanged) + if (Main.dedServ && anythingChanged) CalamityNetcode.SyncWorld(); } diff --git a/Tiles/Abyss/AbyssGravel.cs b/Tiles/Abyss/AbyssGravel.cs index 11b173fd95..061e29abef 100644 --- a/Tiles/Abyss/AbyssGravel.cs +++ b/Tiles/Abyss/AbyssGravel.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/AbyssalPots.cs b/Tiles/Abyss/AbyssalPots.cs index 5e1366ea24..8e269c0357 100644 --- a/Tiles/Abyss/AbyssalPots.cs +++ b/Tiles/Abyss/AbyssalPots.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Tiles.Abyss Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmt = Main.rand.Next(1, 2 + 1); for (int k = 0; k < goreAmt; k++) diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index 5c4ca18d92..59f1194b03 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -2,6 +2,7 @@ using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs.AcidRain; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -114,6 +115,11 @@ namespace CalamityMod.Tiles.Abyss if (type != -1) Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.NextBool(3)) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/Abyss/AcidWoodTreeSapling.cs b/Tiles/Abyss/AcidWoodTreeSapling.cs index 28be3ad585..30a8bd2878 100644 --- a/Tiles/Abyss/AcidWoodTreeSapling.cs +++ b/Tiles/Abyss/AcidWoodTreeSapling.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Tiles.Abyss bool isPlayerNear = WorldGen.PlayerLOS(i, j); WorldGen.RangeFrame(i - 2, trueStartingPositionY - treeHeight - 1, i + 2, trueStartingPositionY + 1); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, (int)((double)trueStartingPositionY - (double)treeHeight * 0.5), treeHeight + 1, TileChangeType.None); if (isPlayerNear) WorldGen.TreeGrowFXCheck(i, j); diff --git a/Tiles/Abyss/HardenedSulphurousSandstone.cs b/Tiles/Abyss/HardenedSulphurousSandstone.cs index f48079fad5..566169bb26 100644 --- a/Tiles/Abyss/HardenedSulphurousSandstone.cs +++ b/Tiles/Abyss/HardenedSulphurousSandstone.cs @@ -87,7 +87,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/PlantyMush.cs b/Tiles/Abyss/PlantyMush.cs index 76aa71e9e4..48bfde5d53 100644 --- a/Tiles/Abyss/PlantyMush.cs +++ b/Tiles/Abyss/PlantyMush.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(7) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -109,7 +109,7 @@ namespace CalamityMod.Tiles.Abyss newVineTile.TileType = (ushort)ModContent.TileType(); newVineTile.Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/PyreMantle.cs b/Tiles/Abyss/PyreMantle.cs index 90da582ec4..f942d7bb15 100644 --- a/Tiles/Abyss/PyreMantle.cs +++ b/Tiles/Abyss/PyreMantle.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/PyreMantleMolten.cs b/Tiles/Abyss/PyreMantleMolten.cs index ea4522232d..a0f968d2e5 100644 --- a/Tiles/Abyss/PyreMantleMolten.cs +++ b/Tiles/Abyss/PyreMantleMolten.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(16) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/ShaleColumns.cs b/Tiles/Abyss/ShaleColumns.cs index ef89091409..aeb276c33a 100644 --- a/Tiles/Abyss/ShaleColumns.cs +++ b/Tiles/Abyss/ShaleColumns.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; } diff --git a/Tiles/Abyss/SulphurousColumn.cs b/Tiles/Abyss/SulphurousColumn.cs index 6cd644742d..285effeb6a 100644 --- a/Tiles/Abyss/SulphurousColumn.cs +++ b/Tiles/Abyss/SulphurousColumn.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Tiles.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Explode into a bunch of rocks when broken. diff --git a/Tiles/Abyss/SulphurousPots.cs b/Tiles/Abyss/SulphurousPots.cs index 99a5328bf9..147d91b787 100644 --- a/Tiles/Abyss/SulphurousPots.cs +++ b/Tiles/Abyss/SulphurousPots.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Tiles.Abyss Tile tileAtPosition = CalamityUtils.ParanoidTileRetrieval(i, j); if (tileAtPosition.TileFrameX % 36 == 0 && tileAtPosition.TileFrameY % 36 == 0) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { int goreAmt = Main.rand.Next(1, 2 + 1); for (int k = 0; k < goreAmt; k++) diff --git a/Tiles/Abyss/SulphurousSand.cs b/Tiles/Abyss/SulphurousSand.cs index 3dbc1957d9..c1782766db 100644 --- a/Tiles/Abyss/SulphurousSand.cs +++ b/Tiles/Abyss/SulphurousSand.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[i, tileLocationY - 4].LiquidAmount == 255) { WorldGen.PlaceTile(i, tileLocationY, 81, true, false, -1, 0); - if (Main.netMode == NetmodeID.Server && Main.tile[i, tileLocationY].HasTile) + if (Main.dedServ && Main.tile[i, tileLocationY].HasTile) NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); } } @@ -108,7 +108,7 @@ namespace CalamityMod.Tiles.Abyss if (ambientObjectAmt < ambientObjectMax) { WorldGen.PlaceTile(i, tileLocationY, 324, true, false, -1, Main.rand.Next(2)); - if (Main.netMode == NetmodeID.Server && Main.tile[i, tileLocationY].HasTile) + if (Main.dedServ && Main.tile[i, tileLocationY].HasTile) NetMessage.SendTileSquare(-1, i, tileLocationY, 1, TileChangeType.None); } } @@ -162,7 +162,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } Main.tile[i, j].Get().Slope = SlopeType.Solid; diff --git a/Tiles/Abyss/SulphurousSandstone.cs b/Tiles/Abyss/SulphurousSandstone.cs index 692a04edbc..716cfd62fb 100644 --- a/Tiles/Abyss/SulphurousSandstone.cs +++ b/Tiles/Abyss/SulphurousSandstone.cs @@ -88,7 +88,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } Main.tile[i, j].Get().Slope = SlopeType.Solid; diff --git a/Tiles/Abyss/SulphurousShale.cs b/Tiles/Abyss/SulphurousShale.cs index 7b5000cd0a..1ecdc028b3 100644 --- a/Tiles/Abyss/SulphurousShale.cs +++ b/Tiles/Abyss/SulphurousShale.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Tiles.Abyss Main.tile[vineX, vineY].TileType = (ushort)ModContent.TileType(); Main.tile[vineX, vineY].Get().HasTile = true; WorldGen.SquareTileFrame(vineX, vineY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, vineX, vineY, 3, TileChangeType.None); } Main.tile[i, j].Get().Slope = SlopeType.Solid; @@ -127,7 +127,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(22) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/SulphurousVines.cs b/Tiles/Abyss/SulphurousVines.cs index 7bde6900b1..58306e6d98 100644 --- a/Tiles/Abyss/SulphurousVines.cs +++ b/Tiles/Abyss/SulphurousVines.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Tiles.Abyss WorldGen.SquareTileFrame(i, j, true); // Send update packets as needed. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, x, y, 3, TileChangeType.None); } } diff --git a/Tiles/Abyss/ViperVines.cs b/Tiles/Abyss/ViperVines.cs index adca8b1c5f..232125a4e6 100644 --- a/Tiles/Abyss/ViperVines.cs +++ b/Tiles/Abyss/ViperVines.cs @@ -96,7 +96,7 @@ namespace CalamityMod.Tiles.Abyss tileBelow.TileType = Type; tileBelow.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } diff --git a/Tiles/Abyss/Voidstone.cs b/Tiles/Abyss/Voidstone.cs index 70dfd6b0f2..e9ce5af903 100644 --- a/Tiles/Abyss/Voidstone.cs +++ b/Tiles/Abyss/Voidstone.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Tiles.Abyss up.TileFrameX = (short)(WorldGen.genRand.Next(6) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } diff --git a/Tiles/Astral/AstralGrass.cs b/Tiles/Astral/AstralGrass.cs index 6acc3ddd47..7239f09f05 100644 --- a/Tiles/Astral/AstralGrass.cs +++ b/Tiles/Astral/AstralGrass.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.Astral up.TileFrameX = (short)(WorldGen.genRand.Next(20) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -74,7 +74,7 @@ namespace CalamityMod.Tiles.Astral up.TileFrameX = (short)(WorldGen.genRand.Next(23) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 00e225c7df..4361cf3493 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -136,6 +137,11 @@ namespace CalamityMod.Tiles.Astral type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.NextBool(3)) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 845f461076..6c0d7fc4fe 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Food; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -122,6 +123,16 @@ namespace CalamityMod.Tiles.AstralDesert type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.Next(36) < 5) // Vanilla palm fruit logic goes first + { + int fruitType = Main.rand.NextBool() ? ItemID.Coconut : ItemID.Banana; + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } + else if (Main.rand.Next(36) < 5) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index a411ad61cf..aaa2519155 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -2,6 +2,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; +using CalamityMod.Items.Potions.Food; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -136,6 +137,11 @@ namespace CalamityMod.Tiles.AstralSnow type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } + else if (Main.rand.NextBool(3)) + { + int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); + } return false; } } diff --git a/Tiles/BaseTiles/BranchDrawer.cs b/Tiles/BaseTiles/BranchDrawer.cs index 9f331ddd07..0a5eb328b5 100644 --- a/Tiles/BaseTiles/BranchDrawer.cs +++ b/Tiles/BaseTiles/BranchDrawer.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Tiles.BaseTiles { get { - if (Main.netMode != NetmodeID.Server && basicShader is null) + if (!Main.dedServ && basicShader is null) { basicShader = new BasicEffect(Main.instance.GraphicsDevice) { diff --git a/Tiles/BaseTiles/DynamicallyGrownTree.cs b/Tiles/BaseTiles/DynamicallyGrownTree.cs index a4f4a23084..a1b64d284f 100644 --- a/Tiles/BaseTiles/DynamicallyGrownTree.cs +++ b/Tiles/BaseTiles/DynamicallyGrownTree.cs @@ -66,7 +66,7 @@ namespace CalamityMod.Tiles.BaseTiles MaxCutoffBranchesPerBranch = MaxCutoffBranchesPerBranch }; - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) BranchDrawer.BarkTexture = ModContent.Request(Texture, AssetRequestMode.ImmediateLoad).Value; } diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index d805d126a9..f5479a2a7a 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -6,16 +6,15 @@ using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; -using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.Enums; +using Terraria.GameContent.Achievements; using Terraria.ID; using Terraria.ModLoader; @@ -238,7 +237,7 @@ namespace CalamityMod.Tiles { tile.Get().HasTile = false; WorldGen.KillTile(x, y, fail: false, effectOnly: false, noItem: true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.TrySendData(17, -1, -1, null, 20, x, y); } } @@ -249,7 +248,7 @@ namespace CalamityMod.Tiles { Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 8, j * 16 + 8, 0f, 0.41f, projectileType, damage, 0f, Main.myPlayer); } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { int proj = Projectile.NewProjectile(new EntitySource_TileBreak(i, j), i * 16 + 8, j * 16 + 8, 0f, 0.41f, projectileType, damage, 0f, Main.myPlayer); Main.projectile[proj].netUpdate = true; @@ -309,6 +308,7 @@ namespace CalamityMod.Tiles { DropItem(i, j, ItemID.SoulofNight, quantity: 4, asStack: false, spreadMinMax); WorldGen.altarCount++; // altarCount does not update automatically if ProgressionRework is enabled! + AchievementsHelper.NotifyProgressionEvent(6); // Gives the Begone, Evil! achievement } // Drop Evil Smasher on every 12 alter smashed diff --git a/Tiles/Crags/ScorchedRemainsGrass.cs b/Tiles/Crags/ScorchedRemainsGrass.cs index aaab2a3a01..9d48394481 100644 --- a/Tiles/Crags/ScorchedRemainsGrass.cs +++ b/Tiles/Crags/ScorchedRemainsGrass.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Tiles.Crags up.TileFrameX = (short)(WorldGen.genRand.Next(20) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } @@ -113,7 +113,7 @@ namespace CalamityMod.Tiles.Crags up.TileFrameX = (short)(WorldGen.genRand.Next(8) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } diff --git a/Tiles/FloralParadise/LushVines.cs b/Tiles/FloralParadise/LushVines.cs index eeb8817853..5300739e3e 100644 --- a/Tiles/FloralParadise/LushVines.cs +++ b/Tiles/FloralParadise/LushVines.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Tiles.FloralParadise Main.tile[i, below].Get().HasTile = true; WorldGen.SquareTileFrame(i, below, true); WorldGen.SquareTileFrame(i, below - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None); NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None); diff --git a/Tiles/FloralParadise/PeatMoss.cs b/Tiles/FloralParadise/PeatMoss.cs index b92e58ecff..3824a28f8f 100644 --- a/Tiles/FloralParadise/PeatMoss.cs +++ b/Tiles/FloralParadise/PeatMoss.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Tiles.FloralParadise Main.tile[i, belowY].TileType = (ushort)ModContent.TileType(); Main.tile[i, belowY].Get().HasTile = true; WorldGen.SquareTileFrame(i, belowY, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, belowY, 3, TileChangeType.None); } diff --git a/Tiles/FloralParadise/SmallVines.cs b/Tiles/FloralParadise/SmallVines.cs index 8cdbfd28dd..c49c7b19b4 100644 --- a/Tiles/FloralParadise/SmallVines.cs +++ b/Tiles/FloralParadise/SmallVines.cs @@ -81,7 +81,7 @@ namespace CalamityMod.Tiles.FloralParadise Main.tile[i, below].Get().HasTile = true; WorldGen.SquareTileFrame(i, below, true); WorldGen.SquareTileFrame(i, below - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, below, 3, TileChangeType.None); NetMessage.SendTileSquare(-1, i, below - 1, 3, TileChangeType.None); diff --git a/Tiles/FloralParadise/WaterfallCreator.cs b/Tiles/FloralParadise/WaterfallCreator.cs index ad070df5af..9bda03602b 100644 --- a/Tiles/FloralParadise/WaterfallCreator.cs +++ b/Tiles/FloralParadise/WaterfallCreator.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Tiles.FloralParadise public override void NearbyEffects(int i, int j, bool closer) { Tile tile = CalamityUtils.ParanoidTileRetrieval(i, j); - if (Main.netMode == NetmodeID.Server || !Main.rand.NextBool() || Main.gamePaused || tile.LiquidAmount > 0) + if (Main.dedServ || !Main.rand.NextBool() || Main.gamePaused || tile.LiquidAmount > 0) return; for (int k = 0; k < 16; k++) diff --git a/Tiles/Furniture/CalamityCanvasBorder.png b/Tiles/Furniture/CalamityCanvasBorder.png new file mode 100644 index 0000000000..4d32a61675 Binary files /dev/null and b/Tiles/Furniture/CalamityCanvasBorder.png differ diff --git a/Tiles/Furniture/CalamityCanvasCorner.png b/Tiles/Furniture/CalamityCanvasCorner.png new file mode 100644 index 0000000000..cb1dc47a9e Binary files /dev/null and b/Tiles/Furniture/CalamityCanvasCorner.png differ diff --git a/Tiles/Furniture/CalamityCanvasTile.cs b/Tiles/Furniture/CalamityCanvasTile.cs new file mode 100644 index 0000000000..78f3d92d5f --- /dev/null +++ b/Tiles/Furniture/CalamityCanvasTile.cs @@ -0,0 +1,224 @@ +using CalamityMod.TileEntities; +using CalamityMod.UI; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class CalamityCanvasTile : ModTile + { + public static Asset border; + public static Asset corner; + + public override void Load() + { + border = ModContent.Request("CalamityMod/Tiles/Furniture/CalamityCanvasBorder"); + corner = ModContent.Request("CalamityMod/Tiles/Furniture/CalamityCanvasCorner"); + } + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.LavaDeath = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 5; + TileObjectData.newTile.Height = 5; + TileObjectData.newTile.CoordinateHeights = new int[] { 18, 18, 18, 18, 18 }; + TileObjectData.newTile.UsesCustomCanPlace = true; + //TileObjectData.newTile.Origin = new Point16(2, 0); + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(ModContent.GetInstance().Hook_AfterPlacement, -1, 0, false); + TileObjectData.addTile(Type); + + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + + AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); + } + public override bool HasSmartInteract(int i, int j, Terraria.GameContent.ObjectInteractions.SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Main.LocalPlayer.CancelSignsAndChests(); + TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 5, 5); + if (cube != null) + { + CanvasPaintingUIState.ResetVars(); + Main.LocalPlayer.Calamity().CurrentlyViewedCanvasID = cube.ID; + SoundEngine.PlaySound(SoundID.MenuOpen); + Main.playerInventory = true; + Main.recBigList = false; + } + Recipe.FindRecipes(); + return false; + } + + public override void MouseOver(int i, int j) + { + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.noThrow = 2; + Main.LocalPlayer.cursorItemIconEnabled = true; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile t = Main.tile[i, j]; + int left = i - t.TileFrameX % (5 * 18) / 18; + int top = j - t.TileFrameY % (5 * 18) / 18; + + TECanvasPainting canvas = CalamityUtils.FindTileEntity(i, j, 5, 5, 18); + + canvas?.Kill(left, top); + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile t = Main.tile[i, j]; + Texture2D texture = TextureAssets.Tile[Type].Value; + TECanvasPainting cube = CalamityUtils.FindTileEntity(i, j, 1, 1); + float baseDimension = 80; // 5 * 16 + Vector2 pos = new Vector2(i * 16, j * 16) + CalamityUtils.TileDrawOffset; + if (cube != null && t.TileFrameX == 0) + { + int fPX = (int)cube.framePosition.X; + int fPY = (int)cube.framePosition.Y; + int scale = (int)(baseDimension * cube.scale); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + spriteBatch.Draw(texture, pos - Main.screenPosition, new Rectangle(fPX, fPY, scale, scale), Lighting.GetColor(i, j), 0, new Vector2(0, 0), 1 / cube.scale, 0, 0); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, Main.Rasterizer, null); + } + // Calculate and draw the borders + if (t.TileFrameX == 0 && t.TileFrameY == 0) + DrawBorders(spriteBatch, pos - Main.screenPosition, new Point(i, j)); + return false; + } + public static void DrawBorders(SpriteBatch spriteBatch, Vector2 pos, Point cords) + { + Texture2D texture = border.Value; + Texture2D cornerTex = corner.Value; + ushort canvasID = (ushort)ModContent.TileType(); + int commonDim = 8; + int finalCord = 72; + int size = 80; + Color light = Lighting.GetColor(cords.X, cords.Y); + + // Check for nearby Canvas paintings + // If they are cleanly lined up with this Canvas painting, don't draw borders between them + bool drawTop = true; + bool drawLeft = true; + bool drawRight = true; + bool drawBottom = true; + // Corners + bool drawTopLeft = false; + bool drawTopRight = false; + bool drawBottomLeft = false; + bool drawBottomRight = false; + + // The bottom right tile of the canvas painting + Point bottomRight = new Point(cords.X + 4, cords.Y + 4); + + // Adjacent tiles that may or may not have other canvas paintings + Tile left = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, cords.Y); + Tile top = CalamityUtils.ParanoidTileRetrieval(cords.X, cords.Y - 1); + Tile right = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, bottomRight.Y); + Tile bottom = CalamityUtils.ParanoidTileRetrieval(bottomRight.X, bottomRight.Y + 1); + + // Check if adjacent tiles are canvas paintings that are lined up with this one + bool validTop = ValidCanvasFrame(top, 0, size, canvasID); + bool validRight = ValidCanvasFrame(right, 0, size, canvasID); + bool validLeft = ValidCanvasFrame(left, finalCord, 0, canvasID); + bool validBottom = ValidCanvasFrame(bottom, finalCord, 0, canvasID); + + if (validTop) + { + drawTop = false; + } + if (validBottom) + { + drawBottom = false; + } + if (validRight) + { + drawRight = false; + // Check for junction corners + Tile topright = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, cords.Y - 1); + Tile bottomright = CalamityUtils.ParanoidTileRetrieval(bottomRight.X + 1, bottomRight.Y + 1); + if (!drawTop && !ValidCanvasFrame(topright, 0, size, canvasID)) + { + drawTopRight = true; + } + if (!drawBottom && !ValidCanvasFrame(bottomright, 0, 0, canvasID)) + { + drawBottomRight = true; + } + } + if (validLeft) + { + drawLeft = false; + // Check for junction corners + Tile topleft = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, cords.Y - 1); + Tile bottomleft = CalamityUtils.ParanoidTileRetrieval(cords.X - 1, bottomRight.Y + 1); + if (!drawTop && !ValidCanvasFrame(topleft, finalCord, size, canvasID)) + { + drawTopLeft = true; + } + if (!drawBottom && !ValidCanvasFrame(bottomleft, finalCord, 0, canvasID)) + { + drawBottomLeft = true; + } + } + + // Draw the sides + if (drawBottom) + spriteBatch.Draw(texture, pos + Vector2.UnitY * finalCord, new Rectangle(0, texture.Height - commonDim, texture.Width, commonDim), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawTop) + spriteBatch.Draw(texture, pos, new Rectangle(0, 0, texture.Width, commonDim), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawRight) + spriteBatch.Draw(texture, pos + Vector2.UnitX * finalCord, new Rectangle(texture.Width - commonDim, commonDim, commonDim, texture.Height - (2 * commonDim)), light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawLeft) + spriteBatch.Draw(texture, pos, new Rectangle(0, commonDim, commonDim, texture.Height - (2 * commonDim)), light, 0, new Vector2(0, 0), 1, 0, 0); + + // Draw the corners + // All corner drawing is done with a single corner sprite that is rotated and flipped about depending on the situation + if (drawTop && drawLeft) + spriteBatch.Draw(cornerTex, pos, null, light, 0, new Vector2(0, 0), 1, 0, 0); + if (drawTop && drawRight) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitX * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0); + if (drawBottom && drawLeft) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitY * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipVertically, 0); + if (drawBottom && drawRight) + spriteBatch.Draw(cornerTex, pos + Vector2.One * size, null, light, MathHelper.Pi, new Vector2(0, 0), 1, 0, 0); + + // Draw junction corners + if (drawTopLeft) + spriteBatch.Draw(cornerTex, pos + corner.Size(), null, light, MathHelper.Pi, new Vector2(0, 0), 1, 0, 0); + if (drawTopRight) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitX * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipVertically, 0); + if (drawBottomLeft) + spriteBatch.Draw(cornerTex, pos + Vector2.UnitY * finalCord, null, light, 0, new Vector2(0, 0), 1, SpriteEffects.FlipHorizontally, 0); + if (drawBottomRight) + spriteBatch.Draw(cornerTex, pos - corner.Size() + Vector2.One * size, null, light, 0, new Vector2(0, 0), 1, 0, 0); + } + + // Check if the tile is a canvas tile that has the correct tile frames + public static bool ValidCanvasFrame(Tile t, int frameX, int frameY, ushort canvasID) + { + return t.HasTile && t.TileType == canvasID && t.TileFrameX == frameX && t.TileFrameY == frameY; + } + } +} diff --git a/Tiles/Furniture/CalamityCanvasTile.png b/Tiles/Furniture/CalamityCanvasTile.png new file mode 100644 index 0000000000..24941a8f62 Binary files /dev/null and b/Tiles/Furniture/CalamityCanvasTile.png differ diff --git a/Tiles/Furniture/ZenithThrone.cs b/Tiles/Furniture/ZenithThrone.cs new file mode 100644 index 0000000000..fc87137266 --- /dev/null +++ b/Tiles/Furniture/ZenithThrone.cs @@ -0,0 +1,87 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.Tiles.BaseTiles.BranchDrawer; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture +{ + public class ZenithThrone : ModTile + { + public override void SetStaticDefaults() + { + RegisterItemDrop(ModContent.ItemType()); + + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + Main.tileWaterDeath[Type] = false; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.Height = 11; + TileObjectData.newTile.Width = 8; + TileObjectData.newTile.Origin = new Point16(4, 9); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.LavaPlacement = LiquidPlacement.Allowed; + TileObjectData.addTile(Type); + + // All sofas count as chairs. + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(43, 199, 217), Language.GetText("ItemName.Throne")); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.IceTorch); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) + { + Tile tile = Framing.GetTileSafely(i, j); + Player player = Main.LocalPlayer; + + int tileNum = tile.TileFrameX / 18; + + info.DirectionOffset = 0; + float offset = 0f; + // left 2 tiles + if (tileNum <= 1) + offset = 18 * (2 - tileNum); + // right 2 tiles + else if (tileNum >= 6) + offset = 18 * -(tileNum - 5); + + if (player.direction == -1) + offset *= -1; + + info.VisualOffset = new Vector2(offset, -8); + info.TargetDirection = player.direction; + + info.AnchorTilePosition.X = i; + info.AnchorTilePosition.Y = j; + } + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/Furniture/ZenithThrone.png b/Tiles/Furniture/ZenithThrone.png new file mode 100644 index 0000000000..45b189d567 Binary files /dev/null and b/Tiles/Furniture/ZenithThrone.png differ diff --git a/Tiles/Furniture/ZenithThrone_Highlight.png b/Tiles/Furniture/ZenithThrone_Highlight.png new file mode 100644 index 0000000000..622ef22261 Binary files /dev/null and b/Tiles/Furniture/ZenithThrone_Highlight.png differ diff --git a/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs b/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs index e078ae2fd6..23fffb7d2b 100644 --- a/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs +++ b/Tiles/Rubblemaker/Abyss/ShaleColumnsEcho.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.Rubblemaker.Abyss public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs b/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs index 60c30ebb13..1fbefd2843 100644 --- a/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs +++ b/Tiles/Rubblemaker/SulphurousSea/SulphurousColumnEcho.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SulphurousSea public override void KillMultiTile(int i, int j, int frameX, int frameY) { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) return; // Explode into a bunch of rocks when broken. diff --git a/Tiles/SunkenSea/Ambient/DepthVines.cs b/Tiles/SunkenSea/Ambient/DepthVines.cs index faf1b14f81..7c5f36445d 100644 --- a/Tiles/SunkenSea/Ambient/DepthVines.cs +++ b/Tiles/SunkenSea/Ambient/DepthVines.cs @@ -77,7 +77,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient tileBelow.TileType = Type; tileBelow.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 4bb35609b7..9638735706 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Tiles.SunkenSea up.TileFrameX = (short)(WorldGen.genRand.Next(15) * 18); WorldGen.SquareTileFrame(i, j - 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index 445a4ae2a2..d982d24e92 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Tiles.SunkenSea Below.TileType = (ushort)ModContent.TileType(); Below.HasTile = true; WorldGen.SquareTileFrame(i, j + 1, true); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } diff --git a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs index 9791f7ac0b..7eb231b5e6 100644 --- a/UI/CalamitasEnchantments/CalamitasEnchantUI.cs +++ b/UI/CalamitasEnchantments/CalamitasEnchantUI.cs @@ -172,12 +172,12 @@ namespace CalamityMod.UI.CalamitasEnchants if (CurrentlyHeldItem.IsAir) return 0; - int cost = CurrentlyHeldItem.value * 4; + int cost = CurrentlyHeldItem.value * 2; // Increase the cost of enchanting significantly if doing so would upgrade the item directly. if (SelectedEnchantment.HasValue && SelectedEnchantment.Value.Name == CalamityUtils.GetText(EnchantmentManager.ExhumedNamePath)) { - cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 5; + cost = (int)MathHelper.Min(cost, Item.buyPrice(5)) * 2; // 29SEP2024: Ozzatron: exhuming stackable items scales the cost with the stack size cost *= CurrentlyHeldItem.stack; diff --git a/UI/CanvasPaintingUI.cs b/UI/CanvasPaintingUI.cs new file mode 100644 index 0000000000..72afbf1107 --- /dev/null +++ b/UI/CanvasPaintingUI.cs @@ -0,0 +1,239 @@ +using CalamityMod.CalPlayer; +using CalamityMod.TileEntities; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.UI +{ + public class CanvasPaintingUIState + { + public static float scrollOld = 0; + public static float scrollNew = 0; + public static bool moving = false; + public static bool justClicked = false; + + public static void DrawCanvasUI(SpriteBatch spriteBatch) + { + CalamityPlayer p = Main.LocalPlayer.Calamity(); + // The UI only draws if the player is viewing a painting. + if (p.CurrentlyViewedCanvasID == -1) + return; + + // Check if this tile entity ID is actually a painting. If it's not, immediately destroy this UI. + TECanvasPainting painting; + bool validPainting = TileEntity.ByID.TryGetValue(p.CurrentlyViewedCanvasID, out TileEntity te); + if (validPainting && te is TECanvasPainting cast) + painting = cast; + else + { + p.CurrentlyViewedCanvasID = -1; + ResetVars(); + return; + } + + // If the player's inventory isn't open, or they have a chest open, OR they are using a channelled item, immediately destroy this UI. + if (!Main.playerInventory || Main.LocalPlayer.chest != -1 || Main.LocalPlayer.channel) + { + ClosePainting(ref p, painting); + return; + } + + // If the player is too far away from their viewed canvas, immediately destroy this UI and play the menu close sound. + // Currently commented out as moving away lets player's see adjacent paintings + /*Vector2 paintingPosition = painting.Position.ToWorldCoordinates() + new Vector2(20, 20); + if (Main.LocalPlayer.DistanceSQ(paintingPosition) > 160f * 160f) + { + ClosePainting(ref p, painting); + return; + }*/ + + int paintingTileSize = 80; + + // The zoom modifier of the painting + float paintingFrameScale = painting.scale; + Vector2 paintingFramePosition = painting.framePosition; + + bool hideUI = Main.keyState.IsKeyDown(Keys.LeftShift); + + Texture2D tex = TextureAssets.Tile[ModContent.TileType()].Value; + + // This is the length and width of the UI box, which is a square + float dimension = Main.screenHeight * 0.66f; + + // How large the base texture is compared to the UI box + float sizeRatio = dimension / tex.Height; + + // The positions for both the square UI box and the painting + Vector2 baseDrawPos = new Vector2(Main.screenWidth * 0.5f - dimension * 0.5f, Main.screenHeight * 0.5f - dimension * 0.5f); + Vector2 posterDrawPos = baseDrawPos + Vector2.UnitX * ((dimension - tex.Width * sizeRatio) * 0.5f); + + // Draw a background square panel, then draw the actual painting + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null); + if (!hideUI) + { + //spriteBatch.Draw(TextureAssets.MagicPixel.Value, baseDrawPos, new Rectangle(0, 0, (int)dimension, (int)dimension), Color.Gray, 0, new Vector2(0, 0), 1f, 0, 0); + spriteBatch.Draw(tex, posterDrawPos, null, Color.White, 0, new Vector2(0, 0), sizeRatio, 0, 0); + } + + // How large one pixel is on the painting + float pixelRatio = paintingTileSize * sizeRatio; + + MouseState state = Microsoft.Xna.Framework.Input.Mouse.GetState(); + // Handle size scrolling. Scrolling is more precise at smaller values + float scrollAmount = painting.scale >= 1 ? 1f : 0.25f; + // If the player scrolls down, the box grows + if (scrollOld > scrollNew) + { + float increasedScale = MathHelper.Clamp(painting.scale + scrollAmount, 0.25f, 10); + painting.scale = increasedScale; + painting.SendSyncPacket(); + } + // If the player scrolls up, the box shrinks + else if (scrollNew > scrollOld) + { + // Needs to be gate at 2 when going down + scrollAmount = painting.scale >= 2 ? 1f : 0.25f; + float decreasedScale = MathHelper.Clamp(painting.scale - scrollAmount, 0.25f, 10); + painting.scale = decreasedScale; + painting.SendSyncPacket(); + } + + // Border buffer size + int borderSize = 4; + // The size of the cursor box + Vector2 cursorDimension = new Vector2(pixelRatio) * paintingFrameScale; + + // The position of the cursor box. Clamped to be inside of the painting + // Moving + Vector2 movingCursorPos = Vector2.Clamp(Main.MouseScreen - cursorDimension * 0.5f + new Vector2(10, 10), posterDrawPos, posterDrawPos + tex.Size() * sizeRatio - cursorDimension); + // Static + Vector2 currentPos = Vector2.Clamp(paintingFramePosition / (float)(tex.Height / (float)dimension) + posterDrawPos, posterDrawPos, posterDrawPos + tex.Size() * sizeRatio - cursorDimension); + // Decide whether the cursor should be following the mouse or not + Vector2 cursorPosition = moving ? movingCursorPos : currentPos; + + bool clicked = Main.mouseLeft && Main.mouseLeftRelease; + if (moving) + { + // Set the variables for the painting's frame position and zoom scale + painting.framePosition = (cursorPosition - posterDrawPos) * (tex.Height / dimension); + // Deactivate if the player left clicks + if (clicked) + { + moving = false; + SoundEngine.PlaySound(SoundID.MenuTick); + painting.SendSyncPacket(); + } + } + else + { + // Activate if the player left clicks or scrolls + if (clicked || scrollOld != scrollNew) + { + moving = true; + SoundEngine.PlaySound(SoundID.MenuTick); + } + // Allow precise pixel increments with arrow keys + else + { + if (Main.keyState.IsKeyDown(Keys.Left) && Main.oldKeyState.IsKeyUp(Keys.Left)) + { + painting.framePosition.X = MathHelper.Clamp(painting.framePosition.X - 1, 0, tex.Width); + painting.SendSyncPacket(); + } + if (Main.keyState.IsKeyDown(Keys.Right) && Main.oldKeyState.IsKeyUp(Keys.Right)) + { + painting.framePosition.X = MathHelper.Clamp(painting.framePosition.X + 1, 0, tex.Width); + painting.SendSyncPacket(); + } + if (Main.keyState.IsKeyDown(Keys.Up) && Main.oldKeyState.IsKeyUp(Keys.Up)) + { + painting.framePosition.Y = MathHelper.Clamp(painting.framePosition.Y - 1, 0, tex.Height); + painting.SendSyncPacket(); + } + if (Main.keyState.IsKeyDown(Keys.Down) && Main.oldKeyState.IsKeyUp(Keys.Down)) + { + painting.framePosition.Y = MathHelper.Clamp(painting.framePosition.Y + 1, 0, tex.Height); + painting.SendSyncPacket(); + } + } + } + + // Draw the cursor + if (!hideUI) + { + // Top row + DrawRectangle(spriteBatch, cursorPosition - new Vector2(borderSize), new Vector2(cursorDimension.X + borderSize * 2, borderSize)); + // Bottom row + DrawRectangle(spriteBatch, cursorPosition + new Vector2(-borderSize, cursorDimension.Y), new Vector2(cursorDimension.X + borderSize * 2, borderSize)); + // Left column + DrawRectangle(spriteBatch, cursorPosition - new Vector2(borderSize, 0), new Vector2(borderSize, cursorDimension.Y + borderSize)); + // Right column + DrawRectangle(spriteBatch, cursorPosition + new Vector2(cursorDimension.X, 0), new Vector2(borderSize, cursorDimension.Y + borderSize)); + } + + // Draw a preview of the painting on the side + float extraScale = 7f; + float halfDim = paintingTileSize * sizeRatio * extraScale / 2; + int previewSliceSize = (int)(paintingFrameScale * paintingTileSize); + float previewScale = sizeRatio / paintingFrameScale * extraScale; + int previewDimension = (int)(previewSliceSize * previewScale); + Vector2 demoPosition = posterDrawPos + new Vector2(dimension + halfDim, dimension / 2 - halfDim); + if (!hideUI) + spriteBatch.Draw(tex, demoPosition, new Rectangle((int)paintingFramePosition.X, (int)paintingFramePosition.Y, previewSliceSize, previewSliceSize), Color.White, 0, new Vector2(0, 0), previewScale, 0, 0); + + // Block the mouse if intersecting with the painting area + bool intersectingMain = Mouse().Intersects(new Rectangle((int)baseDrawPos.X, (int)baseDrawPos.Y, (int)dimension, (int)dimension)); + bool intersectingPrev = Mouse().Intersects(new Rectangle((int)demoPosition.X, (int)demoPosition.Y, previewDimension, previewDimension)); + if (intersectingMain || intersectingPrev) + { + Main.blockMouse = Main.LocalPlayer.mouseInterface = true; + } + + // Set both scroll states to the mouse's current scroll value + if (scrollOld == 0 && scrollNew == 0) + { + scrollOld = state.ScrollWheelValue; + scrollNew = state.ScrollWheelValue; + } + // Update scroll values + else + { + scrollOld = scrollNew; + scrollNew = state.ScrollWheelValue; + } + spriteBatch.ExitShaderRegion(); + } + + public static void ClosePainting(ref CalamityPlayer clam, TECanvasPainting te) + { + clam.CurrentlyViewedCanvasID = -1; + ResetVars(); + te.SendSyncPacket(); + } + + public static void ResetVars() + { + scrollOld = 0; + scrollNew = 0; + moving = false; + } + + public static void DrawRectangle(SpriteBatch spriteBatch, Vector2 position, Vector2 dimensions) + { + spriteBatch.Draw(TextureAssets.MagicPixel.Value, position, new Rectangle(0, 0, (int)dimensions.X, (int)dimensions.Y), Main.DiscoColor, 0, new Vector2(0, 0), 1f, 0, 0); + } + + private static Rectangle Mouse() + { + return new Rectangle((int)(Main.MouseWorld.X - Main.screenPosition.X), (int)(Main.MouseWorld.Y - Main.screenPosition.Y), 10, 10); + } + } +} diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 1cb2255b9f..6b19c38c64 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -119,7 +119,7 @@ namespace CalamityMod public static string CatastropheKilledLast = CalamityUtils.GetTextValue("Condition.Drops.CatastropheKilledLast"); public static string CynosureText = CalamityUtils.GetTextValue("Condition.Drops.Cynosure"); - public static string ProvidenceNightText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceNight"); + public static string ProvidenceEnragedText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceEnraged"); public static string ProvidenceChallengeText = CalamityUtils.GetTextValue("Condition.Drops.ProvidenceChallenge"); #endregion @@ -1450,7 +1450,7 @@ namespace CalamityMod return; // If server-side, then the item must be spawned for each client individually. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NPC npc = info.npc; int idx = Item.NewItem(npc.GetSource_Loot(), npc.Center, itemId, stack, true, -1); diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 2407103f72..89973967e4 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -27,7 +27,7 @@ namespace CalamityMod if (Main.netMode == NetmodeID.SinglePlayer) Main.NewText(Language.GetTextValue(key), textColor.Value); - else if (Main.netMode == NetmodeID.Server || Main.netMode == NetmodeID.MultiplayerClient) + else if (Main.dedServ || Main.netMode == NetmodeID.MultiplayerClient) ChatHelper.BroadcastChatMessage(NetworkText.FromKey(key), textColor.Value); } @@ -139,7 +139,7 @@ namespace CalamityMod if (soundPos.X == -1f || soundPos.Y == -1f) volume = 1f; - else if (WorldGen.gen || Main.dedServ || Main.netMode == NetmodeID.Server) + else if (WorldGen.gen || Main.dedServ || Main.dedServ) volume = 0f; else { diff --git a/Utilities/NPCUtils.cs b/Utilities/NPCUtils.cs index 77b8af6dbd..7159ab6ce0 100644 --- a/Utilities/NPCUtils.cs +++ b/Utilities/NPCUtils.cs @@ -879,7 +879,7 @@ namespace CalamityMod { Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), new Color(175, 75, 255)); } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", [Main.npc[npcIndex].GetTypeNetName()]), new Color(175, 75, 255)); } @@ -989,7 +989,7 @@ namespace CalamityMod npc.timeLeft *= 20; // Server Exclusive: Sync NPC Data - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spawnedNPCIdx); } @@ -1022,7 +1022,7 @@ namespace CalamityMod /// The index of the player who will spawn Old Duke. internal static void SpawnOldDuke(int playerIndex) { - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) return; Player player = Main.player[playerIndex]; diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 0230959ea1..83a425b6b3 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -697,7 +697,7 @@ namespace CalamityMod { CalamityPlayer mp = p.Calamity(); mp.cooldowns[id] = instance; - mp.SyncCooldownAddition(Main.netMode == NetmodeID.Server, instance); + mp.SyncCooldownAddition(Main.dedServ, instance); } return instance; diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 23ccce13f9..592f3e067f 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -984,7 +984,7 @@ PostWallBlastLoop:; } // Smoke, which counts as a Gore - if (Main.netMode != NetmodeID.Server) + if (!Main.dedServ) { Vector2 goreSource = projectile.Center; int goreAmt = 3; diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index 6b2030d211..44e781e3a0 100644 --- a/Walls/AbyssGravelWall.cs +++ b/Walls/AbyssGravelWall.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/Walls/EutrophicSandWall.cs b/Walls/EutrophicSandWall.cs index c7395af510..d6b6bb71c2 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/EutrophicSandWall.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/Walls/PyreMantleWall.cs b/Walls/PyreMantleWall.cs index 6b03ce47fd..6ee73138b7 100644 --- a/Walls/PyreMantleWall.cs +++ b/Walls/PyreMantleWall.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/VoidstoneWallUnsafe.cs index b67cd4a7ae..2b50eada3f 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/VoidstoneWallUnsafe.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Walls Main.tile[i, j].Get().LiquidType = LiquidID.Water; Main.tile[i, j].LiquidAmount = byte.MaxValue; WorldGen.SquareTileFrame(i, j); - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.sendWater(i, j); } } diff --git a/World/Abyss.cs b/World/Abyss.cs index 7a62816fe9..359ef44311 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -1182,7 +1182,7 @@ namespace CalamityMod.World ///
public static void UnlockAllAbyssChests() { - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) { UnlockAbyssChestsPacket.Send(); DoUnlockAllAbyssChests(); diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 0df55e7229..9a487be65a 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -90,7 +90,7 @@ namespace CalamityMod.World WorldGen.SquareTileFrame(x, y); // Inform all clients of the tile change. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, x, y); } } diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 274d345845..8ec21d15fd 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -1177,7 +1177,7 @@ namespace CalamityMod.World { WorldGen.SquareTileFrame(x, y, true); } - else if (Main.netMode == NetmodeID.Server) + else if (Main.dedServ) { NetMessage.SendTileSquare(-1, x, y, 1); } diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 1f481d23c4..41d3748e0a 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -20,17 +20,36 @@ namespace CalamityMod.World public static class CalamityWorld { #region Vars + /// Tracks the amount of money stolen by the Bandit in this world, in Copper Coins. public static int MoneyStolenByBandit = 0; + /// + /// Tracks the number of reforges which have been performed since the Bandit last refunded the player.
+ /// Used to allow the refund feature to work, and for allowing special Goblin Tinkerer and Bandit dialogue. + ///
public static int Reforges; + /// + /// If false, this world was created before the Draedon Update (1.5.0.001).
+ /// Worlds created before the Draedon Update will not lock specific Draedon's Arsenal recipes behind Schematics. + ///
public static bool IsWorldAfterDraedonUpdate = false; + /// + /// Stores the pre-Hardmode ore types that this world generated with.
+ /// Is not actually used for any world gen tasks, and is only used to change the item sprite of the Suspicious Scrap item. + ///
public static ushort[] OreTypes = new ushort[4]; // Modes - public static bool revenge = false; // Revengeance Mode - public static bool death = false; // Death Mode - public static bool armageddon = false; // Armageddon Mode + /// If true, the world is in Revengeance Mode. + public static bool revenge = false; + /// If true, the world is in Death Mode. + public static bool death = false; + /// + /// If true, taking damage while a boss is alive will instantly kill the player.
+ /// Unused by Calamity and can only be set externally. + ///
+ public static bool armageddon = false; - // Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy) + /// Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy). public static bool LegendaryMode => Main.getGoodWorld && ReflectMasterMode(); // FTW automatically bumps difficulties up and has no proper check for Master since a world generated in Expert Mode will be classified as Master @@ -48,26 +67,33 @@ namespace CalamityMod.World // Shrines public static int[] SChestX = new int[10]; public static int[] SChestY = new int[10]; + /// Used to determine if the Roxcalibur shrine has been placed in the world. public static bool roxShrinePlaced = false; - // Planetoids + /// Used to check if the world has generated Luminite planetoids from Moon Lord's defeat. public static bool HasGeneratedLuminitePlanetoids = false; - // Town NPC spawn/home bools + /// If true, the Bandit has lived in this world. Used to ensure their spawn condition is not required on subsequent respawns. public static bool spawnedBandit = false; + /// If true, the Drunk Princess has lived in this world. Used to ensure her spawn condition is not required on subsequent respawns. public static bool spawnedCirrus = false; + /// If true, the Archmage has lived in a house in this world. Solely used as a condition for dialogue. public static bool foundHomePermafrost = false; - // Town Pet name chosen bools + /// Used for allowing custom Town Cat patreon names. public static bool catName = false; + /// Used for allowing custom Town Dog patreon names. public static bool dogName = false; + /// Used for allowing custom Town Bunny patreon names. public static bool bunnyName = false; // Draedon Summoning stuff. public static int DraedonSummonCountdown = 0; public static ExoMech DraedonMechToSummon; public static Vector2 DraedonSummonPosition = Vector2.Zero; + /// Used to track whether or not Draedon has given their initial monologue when summoned before the Exo Mechs fight for the first time. public static bool TalkedToDraedon = false; + /// If true, Draedon will immediately spawn Exo Mechdusa after being summoned. public static bool DraedonMechdusa = false; public static bool AbleToSummonDraedon { diff --git a/World/Planets/LuminitePlanet.cs b/World/Planets/LuminitePlanet.cs index 01a92face5..fccaf54011 100644 --- a/World/Planets/LuminitePlanet.cs +++ b/World/Planets/LuminitePlanet.cs @@ -88,7 +88,7 @@ namespace CalamityMod.World.Planets })); // And sync the entire thing. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, origin.X - radius - 16, origin.Y - radius - 16, radius * 2 + 16, radius * 2 + 16); } } diff --git a/World/Planets/LuminitePlanet2.cs b/World/Planets/LuminitePlanet2.cs index e1aaa76bfd..e9cd5f9204 100644 --- a/World/Planets/LuminitePlanet2.cs +++ b/World/Planets/LuminitePlanet2.cs @@ -94,7 +94,7 @@ namespace CalamityMod.World.Planets })); // And sync the entire thing. - if (Main.netMode == NetmodeID.Server) + if (Main.dedServ) NetMessage.SendTileSquare(-1, origin.X - radius - 36, origin.Y - radius - 36, radius * 2 + 36, radius * 2 + 36); } }