diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 8e7ba80c19..6c11422ea1 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -357,9 +357,6 @@ namespace CalamityMod.Balancing #endregion #region Exo Mechs: Ares - // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(ResistTrueMelee(0.5f)))); - // 30% resist to Dynamic Pursuer. NPCSpecificBalancingChanges.AddRange(Bundle(CalamityLists.AresIDs, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); @@ -504,11 +501,11 @@ namespace CalamityMod.Balancing #endregion #region Supreme Calamitas: Soul Seekers - // 85% resist to Chicken Cannon. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.15f, ProjectileType()))); + // 80% resist to Chicken Cannon. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.2f, ProjectileType()))); - // 50% resist to Subsuming Vortex. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.5f, ProjectileType(), ProjectileType(), ProjectileType()))); + // 40% resist to Subsuming Vortex. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType(), ProjectileType()))); // 40% resist to Supernova. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.6f, ProjectileType(), ProjectileType()))); @@ -518,15 +515,6 @@ namespace CalamityMod.Balancing // 25% resist to Yharim's Crystal. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.75f, ProjectileType()))); - - // 10% resist to Celestus. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType(), ProjectileType()))); - - // 10% resist to Executioner's Blade stealth strikes. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); - - // 10% resist to Surge Driver's alt click comets. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.9f, ProjectileType()))); #endregion } diff --git a/Buffs/Potions/TeslaBuff.cs b/Buffs/Potions/TeslaBuff.cs deleted file mode 100644 index e5a8fac63b..0000000000 --- a/Buffs/Potions/TeslaBuff.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Potions -{ - public class TeslaBuff : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().tesla = true; - } - } -} diff --git a/Buffs/StatDebuffs/PearlAura.cs b/Buffs/StatDebuffs/PearlAura.cs index b7b27ee3df..ed0232c4b2 100644 --- a/Buffs/StatDebuffs/PearlAura.cs +++ b/Buffs/StatDebuffs/PearlAura.cs @@ -1,4 +1,6 @@ -using Terraria; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -19,5 +21,16 @@ namespace CalamityMod.Buffs.StatDebuffs npc.DelBuff(buffIndex); buffIndex--; } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + if (Main.rand.NextBool(4)) + { + int dustType = Main.rand.NextBool() ? DustID.GemSapphire : DustID.BlueCrystalShard; + Vector2 dustVelocity = Vector2.UnitX.RotatedBy(Main.rand.NextFloat(-MathHelper.Pi / 12f, 0f)) * (Main.rand.NextBool() ? -1f : 1f); + Dust theDust = Dust.NewDustDirect(npc.position, npc.width, npc.height, dustType, dustVelocity.X, dustVelocity.Y); + theDust.noGravity = true; + } + } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2bbb8073fa..ebd12e50be 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -179,6 +179,7 @@ namespace CalamityMod.CalPlayer #region Timer and Counter public int gaelSwipes = 0; + public int arsenalCooldown = 0; public int dragoonDrizzlefishGelBoost = 1; public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; @@ -507,6 +508,8 @@ namespace CalamityMod.CalPlayer public bool evasionScarf = false; public bool badgeOfBravery = false; public bool warbannerOfTheSun = false; + public bool tesla = false; + public bool teslaVisuals = true; public bool cryogenSoul = false; public bool ascendantInsignia = false; public int ascendantInsigniaBuffTime = 0; @@ -551,7 +554,7 @@ namespace CalamityMod.CalPlayer public bool aBrain = false; public bool amalgam = false; public bool raiderTalisman = false; - public float raiderCritBonus = RaidersTalisman.RaiderBonus; + public float raiderCritLifespan = 0f; public int raiderSoundCooldown = 0; public bool gSabaton = false; public int gSabatonHotkeyHoldTime = 0; @@ -968,7 +971,6 @@ namespace CalamityMod.CalPlayer public bool astralInjection = false; public bool gravityNormalizer = false; public bool flaskHoly = false; - public bool tesla = false; public bool galvanicCorrosion = false; public bool sulphurskin = false; public bool baguette = false; @@ -1177,7 +1179,7 @@ namespace CalamityMod.CalPlayer public bool omegaBlueTransformation; public bool omegaBlueTransformationForce; public bool omegaBlueTransformationPower; - public bool redBow; + public bool ghostBracelet; #endregion #region Calamitas Enchant Effects @@ -1736,6 +1738,8 @@ namespace CalamityMod.CalPlayer evolution = false; nanotech = false; deadshotBrooch = false; + tesla = false; + teslaVisuals = true; cryogenSoul = false; ascendantInsignia = false; ascendantTrail = false; @@ -2032,7 +2036,6 @@ namespace CalamityMod.CalPlayer astralInjection = false; gravityNormalizer = false; flaskHoly = false; - tesla = false; galvanicCorrosion = false; sulphurskin = false; baguette = false; @@ -2231,7 +2234,7 @@ namespace CalamityMod.CalPlayer omegaBlueTransformationPrevious = omegaBlueTransformation; omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false; - redBow = false; + ghostBracelet = false; rageModeActive = false; adrenalineModeActive = false; @@ -2334,6 +2337,7 @@ namespace CalamityMod.CalPlayer #region Debuffs heldGaelsLastFrame = false; gaelSwipes = 0; + arsenalCooldown = 0; andromedaState = AndromedaPlayerState.Inactive; planarSpeedBoost = 0; galileoCooldown = 0; @@ -2353,7 +2357,7 @@ namespace CalamityMod.CalPlayer spiritOriginConvertedCrit = 0; rage = 0f; adrenaline = 0f; - raiderCritBonus = 0f; + raiderCritLifespan = 0f; raiderSoundCooldown = 0; gSabatonHotkeyHoldTime = 0; gSabatonFall = 0; @@ -2501,7 +2505,6 @@ namespace CalamityMod.CalPlayer astralInjection = false; gravityNormalizer = false; flaskHoly = false; - tesla = false; galvanicCorrosion = false; sulphurskin = false; baguette = false; @@ -2844,16 +2847,15 @@ namespace CalamityMod.CalPlayer Player.statLife = Player.statLifeMax2; } } - if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.1f && - wearingRogueArmor && rogueStealthMax > 0 && !Player.HasCooldown(Cooldowns.SandCloak.ID)) + if (CalamityKeybinds.SandCloakHotkey.JustPressed && sandCloak && Main.myPlayer == Player.whoAmI && !Player.HasCooldown(Cooldowns.SandCloak.ID)) { - Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.SandCloak.ID, CalamityUtils.SecondsToFrames(20)); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - rogueStealth -= rogueStealthMax * 0.1f; - int damage = Player.ApplyArmorAccDamageBonusesTo(7); + int damage = Player.ApplyArmorAccDamageBonusesTo(12); + float knockback = 2.5f; - int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 8, Player.whoAmI); + int veil = Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, Player.whoAmI); Main.projectile[veil].Center = Player.Center; SoundEngine.PlaySound(SoundID.Item45, Player.Center); } @@ -3479,12 +3481,12 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer) { - //While holding hotkey, but before slam, bring Y velocity closer to 0 + // While holding hotkey, but before slam, bring Y velocity closer to 0 if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) { Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 2f)) / 60f; } - //Play sound a bit early so it goes in time with the fall + // Play sound a bit early so it goes in time with the fall if (gSabatonHotkeyHoldTime == 15 && !gSabatonFalling) { SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); @@ -3493,9 +3495,11 @@ namespace CalamityMod.CalPlayer if (gSabatonHotkeyHoldTime == 30) { gSabatonFalling = true; + Player.velocity.Y = 0.01f; } - //Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued - if (Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) + // Cancel fall and don't give 'on ground' effects if on rope, on mount, grappled, or tongued + // Also cancel fall if the player has upwards Y velocity (Goodbye Inner Tube cheese) + if (Player.velocity.Y < 0f || Player.pulley || Player.mount.Active || Player.grappling[0] != -1 || Player.tongued) { gSabatonFall = 0; gSabatonFalling = false; @@ -3504,16 +3508,16 @@ namespace CalamityMod.CalPlayer { SpawnGravistarParticle(); - //Cap time converted to damage at 2 seconds + // Cap time converted to damage at 2 seconds if (gSabatonFall < 120) gSabatonFall++; Player.maxFallSpeed = 40f; Player.gravity = 1.3f; - //If the player can fly during the fall, the physics gets a bit funky + // If the player can fly during the fall, the physics gets a bit funky Player.controlJump = false; - //Check if player hit some form of solid resistance (the ground) + // Check if player hit some form of solid resistance (the ground) if (Player.oldVelocity.Y == Player.velocity.Y) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); @@ -3524,7 +3528,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); gSabatonFall = 0; gSabatonFalling = false; - //Temporary jump speed is granted for 40 frames + // Temporary jump speed is granted for 40 frames gSabatonTempJumpSpeed = 40; } } @@ -3535,6 +3539,10 @@ namespace CalamityMod.CalPlayer gSabatonFall = 0; gSabatonFalling = false; } + + // Reset The Evolution's same projectile DR if unequipped or the cooldown ends + if (!evolution || !Player.HasCooldown(GlobalDodge.ID)) + projTypeJustHitBy = -1; } #endregion @@ -3883,9 +3891,6 @@ namespace CalamityMod.CalPlayer #region Get Weapon Damage And KB public override void ModifyWeaponDamage(Item item, ref StatModifier damage) { - if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type)) - damage += 0.1f; - if (item.CountsAsClass()) { // Apply weapon modifier stealth strike damage bonus @@ -3973,7 +3978,7 @@ namespace CalamityMod.CalPlayer if (item.CountsAsClass()) { var source = Player.GetSource_ItemUse(item); - if (fungalSymbiote && CalamityLists.MushroomWeaponIDs.Contains(item.type) && Player.whoAmI == Main.myPlayer) + if (fungalSymbiote && Player.HasBuff(ModContent.BuffType()) && Player.whoAmI == Main.myPlayer) { if (Player.itemAnimation == (int)(Player.itemAnimationMax * 0.1) || Player.itemAnimation == (int)(Player.itemAnimationMax * 0.3) || @@ -4288,11 +4293,11 @@ namespace CalamityMod.CalPlayer profanedCrystalAnimCounter = new KeyValuePair(0, 10); } - if (redBow) + if (ghostBracelet) { - Player.legs = EquipLoader.GetEquipSlot(Mod, "RedBow", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "RedBow", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "RedBow", EquipType.Head); + Player.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs); + Player.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); + Player.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); } if (snowRuffianSet) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index cf7314b1e8..5659e067de 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -41,12 +41,10 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.UI; using CalamityMod.World; using Microsoft.Xna.Framework; -using Mono.Cecil; using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; -using Terraria.GameContent.Events; using Terraria.Graphics.Renderers; using Terraria.Graphics.Shaders; using Terraria.ID; @@ -498,10 +496,6 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ManaBurn").Format(Player.name)); } - if (bloodyMary || everclear || evergreenGin || fireball || margarita || moonshine || moscowMule || redWine || screwdriver || starBeamRye || tequila || tequilaSunrise || vodka || whiteWine || Player.tipsy) - { - damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.AlcoholSmall").Format(Player.name)); - } if (witheredDebuff) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").Format(Player.name)); @@ -934,6 +928,7 @@ namespace CalamityMod.CalPlayer { proj.hostile = false; proj.friendly = true; + proj.damage *= 10; proj.velocity *= -2f; proj.extraUpdates += 1; proj.penetrate = 1; @@ -1038,13 +1033,7 @@ namespace CalamityMod.CalPlayer if (evolution) { if (proj.type == projTypeJustHitBy) - projectileDamageReduction += 0.15; - } - - if (transformer) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet) - projectileDamageReduction += 0.5; + projectileDamageReduction += 0.25; } if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) @@ -1292,20 +1281,36 @@ namespace CalamityMod.CalPlayer if (!hasIFrames && !Player.creativeGodMode) nextHitDealsDefenseDamage |= proj.Calamity().DealsDefenseDamage; - if (sulphurSet && !proj.friendly && hurtInfo.Damage > 0) + // CIT 22JUL2024: This entire code segment is bugged, so I'm disabling it. + // Very likely because it's trying to index into Main.npc using Projectile.owner. + /*if (!proj.friendly && hurtInfo.Damage > 0) { if (Main.player[proj.owner] is null) { if (!Main.npc[proj.owner].friendly) - Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 60); + { + if (sulphurSet) + Main.npc[proj.owner].AddBuff(BuffID.Poisoned, 60); + if (aSpark) + { + if (transformer) + Main.npc[proj.owner].Calamity().transformerShocked = 120; + else + Main.npc[proj.owner].Calamity().shocked = 120; + } + } } else { Player p = Main.player[proj.owner]; if (p.hostile && Player.hostile && (Player.team != p.team || p.team == 0)) - p.AddBuff(BuffID.Poisoned, 60); + { + if (sulphurSet) + p.AddBuff(BuffID.Poisoned, 60); + } + } - } + }*/ // Apply The Bee cooldown, must be applied here so that it does not apply on dodges if (theBee && shouldTriggerBeeCooldown) @@ -1315,6 +1320,21 @@ namespace CalamityMod.CalPlayer theBeeCooldown = TheBee.CooldownLength; } + if (ursaSergeant) + { + ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); + Player.AddBuff(ModContent.BuffType(), 150); + for (int i = 0; i < 9; i++) + { + Particle spark2 = new LineParticle(Player.Center, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), false, 20, Main.rand.NextFloat(0.5f, 1.1f), Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise); + GeneralParticleHandler.SpawnParticle(spark2); + Dust dust2 = Dust.NewDustPerfect(Player.Center, 267, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f)); + dust2.scale = Main.rand.NextFloat(0.75f, 1.2f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? Color.Coral : Color.DarkTurquoise; + } + } + if (proj.hostile && hurtInfo.Damage > 0) { if (proj.type == ProjectileID.TorchGod) @@ -1469,23 +1489,6 @@ namespace CalamityMod.CalPlayer // As these reflects do not cancel damage, they need to be in OnHit rather than ModifyHit if (CalamityLists.projectileDestroyExceptionList.TrueForAll(x => proj.type != x) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) { - // The Transformer can reflect bullets - if (transformer) - { - if (proj.type == ProjectileID.BulletSnowman || proj.type == ProjectileID.BulletDeadeye || proj.type == ProjectileID.SniperBullet || proj.type == ProjectileID.VortexLaser) - { - proj.hostile = false; - proj.friendly = true; - proj.velocity *= -1f; - proj.damage = (int)Player.GetBestClassDamage().ApplyTo(proj.damage * 8); - proj.penetrate = 1; - - // 17APR2024: Ozzatron: The Transformer is a reflect which also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. - int transformerIFrames = Player.ComputeReflectIFrames(); - Player.GiveUniversalIFrames(transformerIFrames, true); - } - } - double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -2404,15 +2407,15 @@ namespace CalamityMod.CalPlayer if (npcDist < range) { - float duration = Main.rand.Next(300 + (int)hurtInfo.Damage / 3, 480 + (int)hurtInfo.Damage / 2); - npc.AddBuff(BuffID.Confused, (int)duration, false); + int duration = Main.rand.Next(300 + hurtInfo.Damage / 3, 480 + hurtInfo.Damage / 2); + npc.AddBuff(BuffID.Confused, duration, false); if (amalgam) { - npc.AddBuff(BuffID.Venom, (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); - npc.AddBuff(ModContent.BuffType(), (int)duration); + npc.AddBuff(BuffID.Venom, duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); + npc.AddBuff(ModContent.BuffType(), duration); } } } @@ -2527,36 +2530,40 @@ namespace CalamityMod.CalPlayer } if (aSpark) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - if (hurtInfo.Damage > 0) + SoundEngine.PlaySound(SoundID.Item93, Player.Center); + + // Only visual effects are done here + // The actual spark spawning is now handled with the shocked variable in CalamityGlobalNPC + + SeaFoamParticle boom = new(Player.Center, Vector2.Zero, new Color(89, 239, 247), new Color(56, 158, 209), 1f, 200f, Main.rand.NextBool() ? -1f : 1f); + GeneralParticleHandler.SpawnParticle(boom); + + for (int e = 0; e < 6; e++) { - SoundEngine.PlaySound(SoundID.Item93, Player.Center); - - // Start with base damage, then apply the best damage class you can - int sDamage = 6; + Vector2 dustVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(4.5f, 5.25f); + Dust electric = Dust.NewDustPerfect(Player.Center, DustID.Electric, dustVel, Scale: 0.75f); + electric.noGravity = true; if (transformer) - sDamage += 42; - sDamage = (int)Player.GetBestClassDamage().ApplyTo(sDamage); - sDamage = Player.ApplyArmorAccDamageBonusesTo(sDamage); - - if (Player.whoAmI == Main.myPlayer) { - float sparkCount = transformer ? 10f : 8f; - for (float i = 0f; i < sparkCount; i++) - { - Vector2 velocity = (MathHelper.TwoPi * i / sparkCount).ToRotationVector2() * 5f; - Projectile spark = Projectile.NewProjectileDirect(source, Player.Center, velocity, ModContent.ProjectileType(), sDamage, 1.25f, Player.whoAmI); - spark.timeLeft = 120; - if (transformer) - { - spark.timeLeft = 240; - spark.extraUpdates = 1; - spark.penetrate = 10; - } - } + NanoParticle nano = new(Player.Center, dustVel, new Color(0, 186, 242), 1f, 20, true, true); + GeneralParticleHandler.SpawnParticle(nano); } } } + if (rBrain) + { + if (!CalamityUtils.AnyProjectiles(ModContent.ProjectileType())) + { + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + int effectStrength = amalgam ? 3 : aBrain ? 2 : 1; + int effectDamage = amalgam ? 300 : aBrain ? 50 : 15; + effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage); + effectDamage = Player.ApplyArmorAccDamageBonusesTo(effectDamage); + + Vector2 spawnerVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 40f) * 12.5f; + Projectile.NewProjectile(source, Player.Center, spawnerVelocity, ModContent.ProjectileType(), effectDamage, 0f, Player.whoAmI, 0f, 0f, effectStrength); + } + } if (inkBomb && !abyssalMirror && !eclipseMirror) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index ff672e4da5..8952142a04 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -654,10 +654,12 @@ namespace CalamityMod.CalPlayer if (trinketOfChi || chiRegen) Player.lifeRegen += 2; + // Remember this is for 5 seconds after triggering a reflect with a long cooldown if (evolutionLifeRegenCounter > 0) { - Player.lifeRegenTime += 2; - Player.lifeRegen += 2; + Player.lifeRegen += 12; + if (Player.lifeRegenTime < 3600f) + Player.lifeRegenTime = 3600f; } if (darkSunRing) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index afad3a11f3..fddf921748 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -193,13 +193,12 @@ namespace CalamityMod.CalPlayer Player.GetCritChance() = -spiritOriginConvertedCrit; } - if (Player.ActiveItem().type == ModContent.ItemType()) - heldGaelsLastFrame = true; - if (Player.ActiveItem().type != ModContent.ItemType()) saharaSlicersBolts = 0; // De-equipping Gael's Greatsword deletes all rage. + if (Player.ActiveItem().type == ModContent.ItemType()) + heldGaelsLastFrame = true; else if (heldGaelsLastFrame) { heldGaelsLastFrame = false; @@ -1414,6 +1413,8 @@ namespace CalamityMod.CalPlayer Player.buffImmune[ModContent.BuffType()] = true; } + if (arsenalCooldown > 0) + arsenalCooldown--; if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0) ascendantInsigniaCooldown--; if (DragonsBreathAudioCooldown > 0) @@ -1446,8 +1447,8 @@ namespace CalamityMod.CalPlayer soundCooldown--; if (shadowPotCooldown > 0) shadowPotCooldown--; - if (raiderCritBonus > 0f) - raiderCritBonus -= RaidersTalisman.RaiderBonus / (float)CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); + if (raiderCritLifespan > 0f) + raiderCritLifespan--; if (raiderSoundCooldown > 0) raiderSoundCooldown--; if (astralStarRainCooldown > 0) @@ -1570,6 +1571,9 @@ namespace CalamityMod.CalPlayer FlameLickedShell.HandleParryCountdown(Player); } + if (!flameLickedShell && flameLickedShellParry > 0) + flameLickedShellParry--; + // Silver Armor "Medkit" effect if (silverMedkitTimer > 0) { @@ -1828,8 +1832,8 @@ namespace CalamityMod.CalPlayer } // Raider Talisman bonus - if (raiderTalisman && !StealthStrikeAvailable()) - Player.GetCritChance() += raiderCritBonus; + if (raiderTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) + Player.GetCritChance() += RaidersTalisman.RaiderBonus; if (kamiBoost) Player.GetDamage() += 0.15f; @@ -2266,11 +2270,12 @@ namespace CalamityMod.CalPlayer double breathLossMult = 1D - (Player.gills ? 0.2 : 0D) - // 0.8 (oceanCrest ? 0.2 : 0D) - // 0.8 + (victideSet ? 0.2 : 0D) - // 0.8 (Player.accDivingHelm ? 0.25 : 0D) - // 0.75 (Player.arcticDivingGear ? 0.25 : 0D) - // 0.75 (aquaticEmblem ? 0.25 : 0D) - // 0.75 (Player.accMerman ? 0.3 : 0D) - // 0.7 - (victideSet ? 0.2 : 0D) - // 0.85 + (reaverExplore ? 0.3 : 0D) - // 0.7 ((aquaticHeart && NPC.downedBoss3) ? 0.3 : 0D) - // 0.7 (abyssalDivingSuit ? 0.3 : 0D); // 0.7 @@ -2358,7 +2363,7 @@ namespace CalamityMod.CalPlayer // Reduce breath if (Player.breath > 0) - Player.breath -= (int)(cDepth ? breathLoss + 1D : breathLoss); + Player.breath -= (int)(cDepth && !depthCharm ? breathLoss + 1D : breathLoss); } // If breath is greater than 0 and player has gills or is merfolk, balance out the effects by reducing breath @@ -2911,7 +2916,7 @@ namespace CalamityMod.CalPlayer if (giantPearl) { - if (Main.netMode != NetmodeID.MultiplayerClient && !areThereAnyDamnBosses) + if (Main.netMode != NetmodeID.MultiplayerClient) { foreach (NPC npc in Main.ActiveNPCs) { @@ -3032,7 +3037,11 @@ namespace CalamityMod.CalPlayer } if (mushy) - Player.statDefense += 6; + { + Player.statDefense += 8; + if (fungalSymbiote) + Player.GetDamage() += 0.1f; + } if (omniscience) { @@ -3117,14 +3126,6 @@ namespace CalamityMod.CalPlayer if (manaOverloader) Player.GetDamage() += 0.06f; - if (rBrain) - { - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.75)) - Player.GetDamage() += 0.1f; - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.moveSpeed -= 0.05f; - } - if (bloodyWormTooth) { Player.GetDamage() += 0.1f; @@ -3231,7 +3232,7 @@ namespace CalamityMod.CalPlayer var p = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = 600; + Main.projectile[p].originalDamage = baseDamage; } } @@ -3532,11 +3533,24 @@ namespace CalamityMod.CalPlayer if (check) { // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list - var source = Player.GetSource_Buff(Player.FindBuffIndex(ModContent.BuffType())); - int damage = (int)Player.GetBestClassDamage().ApplyTo(10); + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + int damage = (int)Player.GetBestClassDamage().ApplyTo(12); if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI); } + + // Reduce duration of Static Discharge + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (Player.buffType[l] == ModContent.BuffType()) + { + if (Player.buffTime[l] > 2) + { + Player.buffTime[l]--; + break; + } + } + } } } else if (Player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 2c192904f9..03fd95daf7 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -7,9 +7,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; -using CalamityMod.EntitySources; using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Prismatic; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; @@ -27,7 +25,6 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using Microsoft.Xna.Framework; -using MonoMod.Cil; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -59,9 +56,10 @@ namespace CalamityMod.CalPlayer return; // Handle on-hit melee effects for the gem tech armor set. - GemTechState.MeleeOnHitEffects(target); + if (item.CountsAsClass()) + GemTechState.MeleeOnHitEffects(target); - // Handle on-hit melee effects for the mythril armor set. + // Handle on-hit melee effects for the mythril armor set. (all class inclusive) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); if (witheringWeaponEnchant) @@ -202,11 +200,11 @@ namespace CalamityMod.CalPlayer GemTechState.MeleeOnHitEffects(target); // Handle on-hit ranged effects for the gem tech armor set. - if (proj.CountsAsClass() && proj.type != ModContent.ProjectileType()) + if (proj.CountsAsClass() && proj.type != ProjectileType()) GemTechState.RangedOnHitEffects(target, proj.damage); // Handle on-hit projectiles effects for the mythril armor set. - if (proj.type != ModContent.ProjectileType()) + if (proj.type != ProjectileType()) MythrilArmorSetChange.OnHitEffects(target, damageDone, Player); if (witheringWeaponEnchant) @@ -497,7 +495,7 @@ namespace CalamityMod.CalPlayer if (Main.player[Main.myPlayer].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) return; - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); } if ((cgp.betterLifeBullet1 || cgp.betterLifeBullet2) && proj.numHits == 0) @@ -519,7 +517,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i <= 2; i++) { - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); } } @@ -625,13 +623,13 @@ namespace CalamityMod.CalPlayer if (!proj.CountsAsClass() && !proj.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, proj.velocity, ProjectileID.ConfettiMelee, 0, 0f, proj.owner); - if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ModContent.ProjectileType()) + if (alchFlask && AlchFlaskCooldown == 0 && proj.type != ProjectileType()) { int seekerDamage = (int)Player.GetBestClassDamage().ApplyTo(10); seekerDamage = Player.ApplyArmorAccDamageBonusesTo(seekerDamage); Vector2 seekerVelocity = new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1.2f); - Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ModContent.ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); + Projectile bee = Projectile.NewProjectileDirect(source, position, seekerVelocity, ProjectileType(), seekerDamage, 0f, Player.whoAmI, -20, 30, 2); bee.ArmorPenetration = 20; bee.penetrate = 2; bee.extraUpdates = 1; @@ -674,7 +672,7 @@ namespace CalamityMod.CalPlayer { AbaddonCooldown = 15; int AbaddonExploDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.03f, 25); - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); } if (ursaSergeant && ursaSergeantCooldown <= 0) @@ -684,7 +682,7 @@ namespace CalamityMod.CalPlayer int ursaSlashdamage = (int)Player.GetBestClassDamage().ApplyTo(333); ursaSlashdamage = Player.ApplyArmorAccDamageBonusesTo(ursaSlashdamage); - Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), ursaSlashdamage, 0f, Player.whoAmI); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), ursaSlashdamage, 0f, Player.whoAmI); } if (proj.CountsAsClass()) @@ -807,7 +805,7 @@ namespace CalamityMod.CalPlayer // Bloodflare Mage Explosion: 50%, softcap starts at 500 base damage to not overly punish slow weapons int bloodflareFireballDamage = Player.ApplyArmorAccDamageBonusesTo(CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250)); - int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); + int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); if (fire.WithinBounds(Main.maxProjectiles)) { Main.projectile[fire].DamageType = DamageClass.Generic; @@ -1097,9 +1095,9 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), damage, proj.knockBack, proj.owner, 1f, 0f); SoundEngine.PlaySound(SoundID.Item14, proj.Center); - for (int dustexplode = 0; dustexplode < 360; dustexplode++) + for (int dustexplode = 0; dustexplode < 180; dustexplode++) { - Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); + Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode * 2)); int d = Dust.NewDust(proj.Center, proj.width, proj.height, Main.rand.NextBool() ? DustType() : DustType(), dustd.X, dustd.Y, 100, default, 1f); Main.dust[d].noGravity = true; Main.dust[d].position = proj.Center; @@ -1154,7 +1152,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { - raiderCritBonus = RaidersTalisman.RaiderBonus; + raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); if (raiderSoundCooldown <= 0) { SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, Player.Center); @@ -1202,7 +1200,7 @@ namespace CalamityMod.CalPlayer { if (eGauntlet) { - CalamityUtils.Inflict246DebuffsNPC(target, ModContent.BuffType()); + CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } if (ataxiaFire) { @@ -1285,7 +1283,7 @@ namespace CalamityMod.CalPlayer //20% chance for Voltaic Jelly if (Main.rand.NextBool(starTaintedGenerator ? 1 : 5)) { - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(BuffType(), 60); } } @@ -1303,6 +1301,11 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 180); if (sulphurSet) target.AddBuff(BuffID.Poisoned, 60); + if (aSpark && Player.IsUnderwater()) + { + int duration = transformer ? 120 : 60; + target.AddBuff(BuffType(), duration); + } if (abyssalAmulet) { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); @@ -1344,7 +1347,7 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center.X, target.Center.Y, target.velocity.X / 2, target.velocity.Y / 2, ProjectileType(), 0, 0f); } if (Main.player[Main.myPlayer].lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) @@ -1510,7 +1513,7 @@ namespace CalamityMod.CalPlayer if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) { target.Calamity().gladiatorOnKill = false; - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0f); } if (reaverDefense) diff --git a/CalamityLists.cs b/CalamityLists.cs index e32b18fd92..1a82841380 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -106,8 +106,6 @@ namespace CalamityMod public static List amalgamBuffList; public static List persistentBuffList; public static List MagicGunIDs; - public static List MushroomWeaponIDs; - public static List MushroomProjectileIDs; public static List BlacklistedWeaponsWithToolPower; // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. @@ -911,17 +909,17 @@ namespace CalamityMod NPCType(), NPCType(), NPCType(), + NPCID.EyeofCthulhu, + NPCType(), NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, - NPCID.EyeofCthulhu, - NPCType(), NPCID.QueenBee, + NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, - NPCID.Deerclops, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.PirateShipCannon, @@ -939,7 +937,6 @@ namespace CalamityMod NPCID.Plantera, NPCID.PlanterasTentacle, NPCType(), - NPCID.HallowBoss, NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, @@ -957,6 +954,7 @@ namespace CalamityMod NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, + NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, @@ -1564,6 +1562,7 @@ namespace CalamityMod TileType(), TileType(), TileType(), + TileType(), TileID.LivingFire, TileID.LivingCursedFire, TileID.LivingDemonFire, @@ -1587,7 +1586,6 @@ namespace CalamityMod BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), @@ -1725,34 +1723,6 @@ namespace CalamityMod ItemID.ZapinatorOrange }; - MushroomWeaponIDs = new List() - { - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.Hammush, - ItemID.MushroomSpear, - ItemID.Shroomerang - }; - - MushroomProjectileIDs = new List() - { - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileID.TruffleSpore, - ProjectileID.MushroomSpear, - ProjectileID.Shroomerang - }; - // This list intentionally does not contain Grax. BlacklistedWeaponsWithToolPower = new List() { @@ -2762,8 +2732,6 @@ namespace CalamityMod amalgamBuffList = null; persistentBuffList = null; MagicGunIDs = null; - MushroomWeaponIDs = null; - MushroomProjectileIDs = null; BlacklistedWeaponsWithToolPower = null; zombieList = null; diff --git a/Cooldowns/ArsenalPower.cs b/Cooldowns/ArsenalPower.cs new file mode 100644 index 0000000000..d61c4bce55 --- /dev/null +++ b/Cooldowns/ArsenalPower.cs @@ -0,0 +1,21 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.Localization; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Cooldowns +{ + public class ArsenalPower : CooldownHandler + { + public static new string ID => "ArsenalPower"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/ArsenalPower"; + public override Color OutlineColor => Color.White; + public override Color CooldownStartColor => Color.Sienna; + public override Color CooldownEndColor => Color.LightSlateGray; + + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/ArsenalOffCooldown"); + } +} diff --git a/Cooldowns/ArsenalPower.png b/Cooldowns/ArsenalPower.png new file mode 100644 index 0000000000..72e59d3de1 Binary files /dev/null and b/Cooldowns/ArsenalPower.png differ diff --git a/Cooldowns/ArsenalPowerOutline.png b/Cooldowns/ArsenalPowerOutline.png new file mode 100644 index 0000000000..2378fee32c Binary files /dev/null and b/Cooldowns/ArsenalPowerOutline.png differ diff --git a/Cooldowns/ArsenalPowerOverlay.png b/Cooldowns/ArsenalPowerOverlay.png new file mode 100644 index 0000000000..92655b1c94 Binary files /dev/null and b/Cooldowns/ArsenalPowerOverlay.png differ diff --git a/ExtraTextures/Lasers/BirbAuraEnd.png b/ExtraTextures/Lasers/BirbAuraEnd.png deleted file mode 100644 index 4003d549d6..0000000000 Binary files a/ExtraTextures/Lasers/BirbAuraEnd.png and /dev/null differ diff --git a/ExtraTextures/Lasers/BirbAuraEndpoints.png b/ExtraTextures/Lasers/BirbAuraEndpoints.png new file mode 100644 index 0000000000..bf4bfa8594 Binary files /dev/null and b/ExtraTextures/Lasers/BirbAuraEndpoints.png differ diff --git a/ExtraTextures/Lasers/BirbAuraStart.png b/ExtraTextures/Lasers/BirbAuraStart.png deleted file mode 100644 index 1a999c374d..0000000000 Binary files a/ExtraTextures/Lasers/BirbAuraStart.png and /dev/null differ diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index e1c1a5f31e..a823f93126 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -8,7 +8,6 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - // TODO -- this item includes a dodge accessory, Brain of Cthulhu public class AmalgamatedBrain : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; @@ -24,29 +23,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.aBrain = true; player.brainOfConfusionItem = Item; - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(60); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } - player.GetDamage() += 0.1f; + player.GetDamage() += 0.05f; } public override void AddRecipes() diff --git a/Items/Accessories/AmidiasPendant.cs b/Items/Accessories/AmidiasPendant.cs deleted file mode 100644 index 12e0ce87ad..0000000000 --- a/Items/Accessories/AmidiasPendant.cs +++ /dev/null @@ -1,82 +0,0 @@ -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class AmidiasPendant : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public const int ShardProjectiles = 2; - public const float ShardAngleSpread = 120; - public int ShardCountdown = 0; - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 46; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (ShardCountdown <= 0) - { - ShardCountdown = 140; - } - if (ShardCountdown > 0) - { - ShardCountdown -= Main.rand.Next(1, 4); - if (ShardCountdown <= 0) - { - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_Accessory(Item); - int speed2 = 25; - float spawnX = Main.rand.Next(1000) - 500 + player.Center.X; - float spawnY = -1000 + player.Center.Y; - Vector2 baseSpawn = new Vector2(spawnX, spawnY); - Vector2 baseVelocity = player.Center - baseSpawn; - baseVelocity.Normalize(); - baseVelocity *= speed2; - int spawnOffset = ShardProjectiles * 15; - float spread = -ShardAngleSpread / 2f; - for (int i = 0; i < ShardProjectiles; i++) - { - Vector2 spawn = baseSpawn; - spawn.X = spawn.X + i * 30 - spawnOffset; - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(spread + (ShardAngleSpread * i / (float)ShardProjectiles))); - velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f; - int type = 0; - int damage = 0; - switch (Main.rand.Next(3)) - { - case 0: - type = ModContent.ProjectileType(); - damage = 15; - break; - case 1: - type = ModContent.ProjectileType(); - damage = 15; - break; - case 2: - type = ModContent.ProjectileType(); - damage = 30; - break; - } - - int finalDamage = (int)player.GetBestClassDamage().ApplyTo(damage); - finalDamage = player.ApplyArmorAccDamageBonusesTo(finalDamage); - Projectile.NewProjectile(source, spawn.X, spawn.Y, velocity.X / 3, velocity.Y / 2, type, finalDamage, 5f, Main.myPlayer); - } - } - } - } - } - } -} diff --git a/Items/Accessories/AmidiasPendant.png b/Items/Accessories/AmidiasPendant.png deleted file mode 100644 index ff71e1fc5f..0000000000 Binary files a/Items/Accessories/AmidiasPendant.png and /dev/null differ diff --git a/Items/Accessories/AmidiasSpark.cs b/Items/Accessories/AmidiasSpark.cs index e15f15b358..e47f734736 100644 --- a/Items/Accessories/AmidiasSpark.cs +++ b/Items/Accessories/AmidiasSpark.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().transformer; + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 1b6e0c3011..5478959941 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { - Item.width = 38; - Item.height = 44; + Item.width = 50; + Item.height = 48; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.defense = 8; // we buff Ankh Shield to 8 diff --git a/Items/Accessories/AsgardsValor.png b/Items/Accessories/AsgardsValor.png index 6a56bed385..316e59b4bd 100644 Binary files a/Items/Accessories/AsgardsValor.png and b/Items/Accessories/AsgardsValor.png differ diff --git a/Items/Accessories/GiantPearl.cs b/Items/Accessories/GiantPearl.cs index e1e9e339a4..c80f33d6a8 100644 --- a/Items/Accessories/GiantPearl.cs +++ b/Items/Accessories/GiantPearl.cs @@ -1,10 +1,14 @@ using CalamityMod.CalPlayer; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { + [LegacyName("AmidiasPendant")] public class GiantPearl : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -22,6 +26,32 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.giantPearl = true; Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.45f, 0.8f, 0.8f); + + // Draw the aura visual + float npcDistCompare = 1000f; + foreach (NPC n in Main.ActiveNPCs) + { + if (n.friendly || n.dontTakeDamage) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, player.Center); + if (currentNPCDist < npcDistCompare) + npcDistCompare = currentNPCDist; + } + float opacity = Utils.Remap(npcDistCompare, 120f, 640f, 1f, 0f); + + if (opacity > 0.7f) + { + for (int d = 0; d < 3; d++) + { + Vector2 bubbleSpawn = player.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 120f; + GenericBubbleParticle bubble = new(bubbleSpawn, Main.rand.NextVector2CircularEdge(0.75f, 0.75f), 0.3f, Main.rand.NextFloat(MathHelper.TwoPi), 8); + GeneralParticleHandler.SpawnParticle(bubble); + } + } + + CustomPulse auraVisual = new(player.Center, Vector2.Zero, new Color(75, 164, 191), "CalamityMod/Particles/HighResFoggyCircleHardEdge", Vector2.One, 0f, 0.12f, 0.1175f, 3, true, opacity); + GeneralParticleHandler.SpawnParticle(auraVisual); } } } diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index 722a59065d..6786c4d73a 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -15,7 +15,7 @@ using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Back)] - //Its not like its a renamed version of the bayonet, but i put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. + //It's not like it's a renamed version of the bayonet, but I put this here more as a way to "refund" the item, so it doesnt end up rotting as an unloaded item. [LegacyName("MarniteBayonet")] public class MarniteRepulsionShield : ModItem, ILocalizedModType { @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Blue; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; - Item.defense = 2; + Item.defense = 4; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), baseDamage, 10f, Main.myPlayer); + var hitbox = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), baseDamage, 12f, Main.myPlayer); hitbox.originalDamage = baseDamage; } } @@ -91,6 +91,7 @@ namespace CalamityMod.Items.Accessories Projectile.penetrate = -1; Projectile.timeLeft = 700; Projectile.tileCollide = false; + Projectile.ArmorPenetration = 20; Projectile.netImportant = true; } diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index a9ead56f4f..6c6c9be664 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -33,11 +33,11 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.nCore = true; player.GetDamage() += 0.1f; - int damage = (int)player.GetBestClassDamage().ApplyTo(250); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - float knockBack = 3f; + + // Spawn nebula stars if (Main.rand.NextBool(15)) { + // Count the number of current active nebula stars; if this is at least 10, no more can spawn int numProj = 0; foreach (Projectile p in Main.ActiveProjectiles) { @@ -46,56 +46,32 @@ namespace CalamityMod.Items.Accessories numProj++; } } - var source = player.GetSource_Accessory(Item); if (Main.rand.Next(15) >= numProj && numProj < 10) { int spawnRadius = 24; - int backupSpawnRadius = 90; - for (int j = 0; j < 50; j++) + for (int j = 0; j < 50; j++) // Attempt to spawn the star randomly around the player { - int randomProjOffset = Main.rand.Next(200 - j * 2, 400 + j * 2); + float randomProjOffset = Main.rand.NextFloat(200 - j * 2, 400 + j * 2); Vector2 center = player.Center; - center.X += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1); - center.Y += (float)Main.rand.Next(-randomProjOffset, randomProjOffset + 1); + center.X += Main.rand.NextFloat(-randomProjOffset, randomProjOffset + 1); + center.Y += Main.rand.NextFloat(-randomProjOffset, randomProjOffset + 1); + // Ensure we are not trying to spawn the star on top of a solid tile or liquid if (!Collision.SolidCollision(center, spawnRadius, spawnRadius) && !Collision.WetCollision(center, spawnRadius, spawnRadius)) { center.X += (float)(spawnRadius / 2); center.Y += (float)(spawnRadius / 2); - if (Collision.CanHit(new Vector2(player.Center.X, player.position.Y), 1, 1, center, 1, 1) || Collision.CanHit(new Vector2(player.Center.X, player.position.Y - 50f), 1, 1, center, 1, 1)) + // Ensure the star's spawn point has line-of-sight with the player + if (Collision.CanHit(player.Center, 1, 1, center, 1, 1) || Collision.CanHit(player.Center - new Vector2(0f, 50f), 1, 1, center, 1, 1)) { - int projTileX = (int)center.X / 16; - int projTileY = (int)center.Y / 16; - bool canSpawnProj = false; - if (Main.rand.NextBool(3) && Main.tile[projTileX, projTileY] != null && Main.tile[projTileX, projTileY].WallType > 0) + if (Main.rand.NextBool(3) && Main.myPlayer == player.whoAmI) { - canSpawnProj = true; - } - else - { - center.X -= (float)(backupSpawnRadius / 2); - center.Y -= (float)(backupSpawnRadius / 2); - if (Collision.SolidCollision(center, backupSpawnRadius, backupSpawnRadius)) - { - center.X += (float)(backupSpawnRadius / 2); - center.Y += (float)(backupSpawnRadius / 2); - canSpawnProj = true; - } - } - if (canSpawnProj) - { - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].owner == player.whoAmI && Main.projectile[k].type == ModContent.ProjectileType() && (center - Main.projectile[k].Center).Length() < 48f) - { - canSpawnProj = false; - break; - } - } - if (canSpawnProj && Main.myPlayer == player.whoAmI) - { - Projectile.NewProjectile(source, center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); - return; - } + var source = player.GetSource_Accessory(Item); + int damage = (int)player.GetBestClassDamage().ApplyTo(250); + damage = player.ApplyArmorAccDamageBonusesTo(damage); + float knockBack = 3f; + + Projectile.NewProjectile(source, center.X, center.Y, 0f, 0f, ModContent.ProjectileType(), damage, knockBack, player.whoAmI); + return; } } } diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 9181a9e2ea..ced3c36784 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 12f; + public const float RaiderBonus = 10f; public const int RaiderCooldown = 5; public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 783cdf7762..f83fe3c9fe 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -20,28 +20,9 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(18); - damage = player.ApplyArmorAccDamageBonusesTo(damage); - - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } CalamityPlayer modPlayer = player.Calamity(); modPlayer.rBrain = true; + player.GetDamage() += 0.06f; } public override void AddRecipes() diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index 9097563d19..4f69f242e0 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -7,8 +7,6 @@ namespace CalamityMod.Items.Accessories { public class SandCloak : ModItem, ILocalizedModType { - public static float KnockbackStrength = 0.3f; - public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -17,7 +15,6 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; - Item.defense = 2; } public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SandCloakHotkey); diff --git a/Items/Accessories/TeslasAmulet.cs b/Items/Accessories/TeslasAmulet.cs new file mode 100644 index 0000000000..ee228c52b2 --- /dev/null +++ b/Items/Accessories/TeslasAmulet.cs @@ -0,0 +1,45 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class TeslasAmulet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 14)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + } + + public override void SetDefaults() + { + Item.width = 32; + Item.height = 32; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().tesla = true; + player.Calamity().teslaVisuals = !hideVisual; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(8). + AddIngredient(8). + AddIngredient(4). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Potions/TeslaPotion.png b/Items/Accessories/TeslasAmulet.png similarity index 100% rename from Items/Potions/TeslaPotion.png rename to Items/Accessories/TeslasAmulet.png diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index 066b87b52e..62ec2bec08 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -34,28 +34,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); + modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.amalgam = true; player.brainOfConfusionItem = Item; player.GetDamage() += 0.15f; - - if (player.immune) - { - var source = player.GetSource_Accessory(Item); - if (player.miscCounter % 6 == 0) - { - if (player.whoAmI == Main.myPlayer) - { - int damage = (int)player.GetBestClassDamage().ApplyTo(300); - Projectile rain = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileType(), damage, 2f, player.whoAmI); - if (rain.whoAmI.WithinBounds(Main.maxProjectiles)) - { - rain.DamageType = DamageClass.Generic; - rain.tileCollide = false; - rain.penetrate = 1; - } - } - } - } } public override void AddRecipes() diff --git a/Items/Accessories/TheTransformer.cs b/Items/Accessories/TheTransformer.cs index 6504109afd..a744261963 100644 --- a/Items/Accessories/TheTransformer.cs +++ b/Items/Accessories/TheTransformer.cs @@ -27,6 +27,8 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override bool CanEquipAccessory(Player player, int slot, bool modded) => !player.Calamity().aSpark; + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/Accessories/Vanity/Apelusa_Body.png b/Items/Accessories/Vanity/Apelusa_Body.png deleted file mode 100644 index 501db51809..0000000000 Binary files a/Items/Accessories/Vanity/Apelusa_Body.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Apelusa_Head.png b/Items/Accessories/Vanity/Apelusa_Head.png deleted file mode 100644 index df7384ea15..0000000000 Binary files a/Items/Accessories/Vanity/Apelusa_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Apelusa_Legs.png b/Items/Accessories/Vanity/Apelusa_Legs.png deleted file mode 100644 index 0e6cf7a844..0000000000 Binary files a/Items/Accessories/Vanity/Apelusa_Legs.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Dandy_Body.png b/Items/Accessories/Vanity/Dandy_Body.png new file mode 100644 index 0000000000..d6778db86e Binary files /dev/null and b/Items/Accessories/Vanity/Dandy_Body.png differ diff --git a/Items/Accessories/Vanity/Dandy_Head.png b/Items/Accessories/Vanity/Dandy_Head.png new file mode 100644 index 0000000000..b107474d18 Binary files /dev/null and b/Items/Accessories/Vanity/Dandy_Head.png differ diff --git a/Items/Accessories/Vanity/Dandy_Legs.png b/Items/Accessories/Vanity/Dandy_Legs.png new file mode 100644 index 0000000000..364147d83b Binary files /dev/null and b/Items/Accessories/Vanity/Dandy_Legs.png differ diff --git a/Items/Accessories/Vanity/RedBow.cs b/Items/Accessories/Vanity/GhostBracelet.cs similarity index 79% rename from Items/Accessories/Vanity/RedBow.cs rename to Items/Accessories/Vanity/GhostBracelet.cs index a336b99bdf..b5087243a8 100644 --- a/Items/Accessories/Vanity/RedBow.cs +++ b/Items/Accessories/Vanity/GhostBracelet.cs @@ -4,23 +4,22 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class RedBow : ModItem, ILocalizedModType + [LegacyName("RedBow")] + public class GhostBracelet : ModItem, ILocalizedModType { - public new string LocalizationCategory => "Items.Accessories"; public override void Load() { if (Main.netMode != NetmodeID.Server) { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Apelusa_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Apelusa_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Apelusa_Legs", EquipType.Legs, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Head", EquipType.Head, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Body", EquipType.Body, this); + EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Legs", EquipType.Legs, this); } } public override void SetStaticDefaults() { - if (Main.netMode == NetmodeID.Server) return; @@ -37,8 +36,8 @@ namespace CalamityMod.Items.Accessories.Vanity public override void SetDefaults() { - Item.width = 22; - Item.height = 30; + Item.width = 42; + Item.height = 38; Item.accessory = true; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; @@ -48,21 +47,21 @@ namespace CalamityMod.Items.Accessories.Vanity public override void UpdateVanity(Player player) { - player.Calamity().redBow = true; + player.Calamity().ghostBracelet = true; } public override void UpdateAccessory(Player player, bool hideVisual) { if (!hideVisual) { - player.Calamity().redBow = true; + player.Calamity().ghostBracelet = true; } } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Silk, 5). + AddIngredient(ItemID.Silk, 20). AddTile(TileID.Loom). Register(); } diff --git a/Items/Accessories/Vanity/GhostBracelet.png b/Items/Accessories/Vanity/GhostBracelet.png new file mode 100644 index 0000000000..9ae96bca31 Binary files /dev/null and b/Items/Accessories/Vanity/GhostBracelet.png differ diff --git a/Items/Accessories/Vanity/RedBow.png b/Items/Accessories/Vanity/RedBow.png deleted file mode 100644 index 21ad13f679..0000000000 Binary files a/Items/Accessories/Vanity/RedBow.png and /dev/null differ diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index 006989a52d..1a7dd7e305 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -61,13 +61,13 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 14; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; } public override bool IsArmorSet(Item head, Item body, Item legs) { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + return body.type == ItemType() && legs.type == ItemType(); } public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index 711995fa8f..34eb51bc23 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 0; + Item.defense = 1; } private void ActivateLift(Terraria.On_Player.orig_QuickMount orig, Player self) @@ -79,7 +79,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect orig(self); } - public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType(); + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType(); public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType(); public bool IsPartOfSet(Item item) => item.type == ItemType() || item.type == ItemType(); @@ -155,12 +155,13 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; + Item.defense = 2; } public override void UpdateEquip(Player player) { player.tileSpeed += 0.5f; + player.wallSpeed += 0.5f; } public override void ModifyTooltips(List tooltips) => MarniteArchitectHeadgear.ModifySetTooltips(this, tooltips); @@ -204,7 +205,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override void PostUpdateMiscEffects() { - if (!setEquipped && Player.mount.Type == ModContent.MountType() && Player.mount.Active) + if (!setEquipped && Player.mount.Type == MountType() && Player.mount.Active) Player.mount.Dismount(Player); if (mounted) @@ -367,7 +368,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect //Sprites if (Main.netMode != NetmodeID.Server) { - MountData.frontTextureGlow = ModContent.Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); + MountData.frontTextureGlow = Request("CalamityMod/Items/Armor/MarniteArchitect/MarniteLiftFire"); } } diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index bb67093e5b..4fb96d018e 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -41,8 +41,9 @@ namespace CalamityMod.Items.Armor.Reaver modPlayer.reaverExplore = true; modPlayer.wearingRogueArmor = true; player.findTreasure = true; - player.blockRange += 4; player.aggro -= 200; + if (player.IsUnderwater()) + player.gills = true; if (player.whoAmI == Main.myPlayer) { @@ -55,6 +56,10 @@ namespace CalamityMod.Items.Armor.Reaver { Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); } + + // These are static variables. Awesome + Player.tileRangeX += 7; + Player.tileRangeY += 7; } } @@ -63,8 +68,8 @@ namespace CalamityMod.Items.Armor.Reaver player.ignoreWater = true; player.lavaImmune = true; player.pickSpeed -= 0.2f; - player.tileSpeed += 0.4f; - player.wallSpeed += 0.4f; + player.tileSpeed += 0.5f; + player.wallSpeed += 0.5f; } public override void AddRecipes() diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 6d5858ea5e..0ed6f4412c 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -82,9 +82,9 @@ namespace CalamityMod.Items.Armor.Wulfrum } } - else if (player.HasItem(ModContent.ItemType())) + else if (player.HasItem(ItemType())) { - player.ConsumeItem(ModContent.ItemType()); + player.ConsumeItem(ItemType()); //I Thiiiinnnk there's no need to add mp syncing packets since cooldowns get auto synced right. player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime); //Though do i need to sync that or is the player inventory auto synced? @@ -234,7 +234,7 @@ namespace CalamityMod.Items.Armor.Wulfrum setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); tooltips.Insert(setBonusIndex + 1, setBonus1); - int AmmoItem = ModContent.ItemType(); + int AmmoItem = ItemType(); string AmmoDisplay = $"[i:{AmmoItem}] {CalamityUtils.GetItemName(AmmoItem)}"; TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", CalamityUtils.GetTextFromModItem("AbilityDescription").Format(AmmoDisplay)); setBonus2.OverrideColor = new Color(110, 192, 93); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 47319bfbf7..131e9d5158 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -204,6 +204,10 @@ namespace CalamityMod.Items break; } + // Increase how much health Mushrooms heal. + if (item.type == ItemID.Mushroom && item.healLife == 15) + item.healLife = 25; + // Allow Beam Sword to change direction when it fires, because vanilla disables it for some reason. if (item.type == ItemID.BeamSword) item.ChangePlayerDirectionOnShoot = true; @@ -1629,9 +1633,10 @@ namespace CalamityMod.Items if (grabRangeMultiplier > 1f) grabRange = (int)(grabRangeMultiplier * grabRange); - // Then, if wearing the appropriate Reaver armor, add 20 flat item grab range. + // Then, if wearing the appropriate Reaver armor, add 246 flat item grab range. (2.625 + 15.375 = 18 tiles) + // For reference, Treasure Magnet adds 150 (2.625 + 9.375 = 12 tiles) if (player.Calamity().reaverExplore) - grabRange += 20; + grabRange += 246; } #endregion diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 0c4058647f..a1811f12a2 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -826,7 +826,7 @@ namespace CalamityMod.Items //Flame Waker Boots buff. if (item.type == ItemID.FlameWakerBoots) { - EditTooltipByNum(0, (line) => line.Text = "Multiplies all fire-based debuff damage by 1.25\n" + + EditTooltipByNum(0, (line) => line.Text = "Multiplies all fire-based debuff damage by 1.25x\n" + "All attacks light enemies on fire\n" + "'Never get cold feet again'"); } @@ -835,7 +835,7 @@ namespace CalamityMod.Items if (item.type == ItemID.HellfireTreads) { EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("fire blocks", "the Burning and On Fire! debuffs")); - EditTooltipByNum(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5, does not stack with downgrades\n" + + EditTooltipByNum(2, (line) => line.Text += "\nMultiplies all fire-based debuff damage by 1.5x, does not stack with downgrades\n" + "All attacks inflict Hellfire"); } diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 07c6955b62..65eec140e7 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -248,7 +248,7 @@ namespace CalamityMod.Items { ItemID.TerraBlade, Do(DamageExact(122)) }, // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, // Terrarian is extremely overpowered and requires a heavy nerf. - { ItemID.Terrarian, Do(AutoReuse, DamageExact(86)) }, + { ItemID.Terrarian, Do(AutoReuse, DamageExact(90)) }, { ItemID.TheEyeOfCthulhu, Do(AutoReuse, DamageExact(90)) }, { ItemID.TheRottedFork, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.TheUndertaker, Do(PointBlank, AutoReuse, DamageExact(15)) }, diff --git a/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs b/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs new file mode 100644 index 0000000000..74c7b3f5a0 --- /dev/null +++ b/Items/Placeables/LivingFire/LivingPlagueFireBlock.cs @@ -0,0 +1,44 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Tiles.LivingFire; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.LivingFire +{ + public class LivingPlagueFireBlock : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() + { + Item.width = 10; + Item.height = 12; + Item.maxStack = 9999; + Item.useTurn = true; + Item.autoReuse = true; + Item.useAnimation = 15; + Item.useTime = 10; + Item.useStyle = ItemUseStyleID.Swing; + Item.consumable = true; + Item.createTile = ModContent.TileType(); + } + + public override void PostUpdate() + { + Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0f, 1f, 0.2f); + } + + public override void AddRecipes() + { + CreateRecipe(20). + AddIngredient(ItemID.LivingFireBlock, 20). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/LivingFire/LivingPlagueFireBlock.png b/Items/Placeables/LivingFire/LivingPlagueFireBlock.png new file mode 100644 index 0000000000..8b7b3dd14b Binary files /dev/null and b/Items/Placeables/LivingFire/LivingPlagueFireBlock.png differ diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index a75ba175dc..be17479df9 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Potions.Alcohol Item.value = Item.sellPrice(silver: 40); } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Potions.Alcohol } } player.AddBuff(Item.buffType, Item.buffTime); - return true; } } } diff --git a/Items/Potions/AureusCell.cs b/Items/Potions/AureusCell.cs index 2393b8088c..3249adefee 100644 --- a/Items/Potions/AureusCell.cs +++ b/Items/Potions/AureusCell.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Potions Item.buffTime = CalamityUtils.SecondsToFrames(360f); } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { if (PlayerInput.Triggers.JustPressed.QuickBuff) { @@ -49,7 +49,6 @@ namespace CalamityMod.Items.Potions } player.AddBuff(BuffID.MagicPower, Item.buffTime); player.AddBuff(BuffID.ManaRegeneration, Item.buffTime); - return true; } } } diff --git a/Items/Potions/HadalStew.cs b/Items/Potions/HadalStew.cs index a901b1bcab..1fbecce577 100644 --- a/Items/Potions/HadalStew.cs +++ b/Items/Potions/HadalStew.cs @@ -52,12 +52,11 @@ namespace CalamityMod.Items.Potions return player.potionDelay <= 0 && player.Calamity().potionTimer <= 0; } - public override bool? UseItem(Player player) + public override void OnConsumeItem(Player player) { player.AddBuff(BuffType, BuffDuration); // fixes hardcoded potion sickness duration from quick heal (see CalamityPlayerMiscEffects.cs) player.Calamity().potionTimer = 2; - return true; } public override void AddRecipes() diff --git a/Items/Potions/TeslaPotion.cs b/Items/Potions/TeslaPotion.cs deleted file mode 100644 index 1fa1a540b3..0000000000 --- a/Items/Potions/TeslaPotion.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.Buffs.Potions; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; -using CalamityMod.Items.Placeables.Ores; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Potions -{ - public class TeslaPotion : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Potions"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 20; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 14)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 32; - Item.height = 32; - Item.useTurn = true; - Item.maxStack = 9999; - Item.rare = ItemRarityID.Orange; - Item.useAnimation = 17; - Item.useTime = 17; - Item.useStyle = ItemUseStyleID.DrinkLiquid; - Item.UseSound = SoundID.Item3; - Item.consumable = true; - Item.buffType = ModContent.BuffType(); - Item.buffTime = CalamityUtils.SecondsToFrames(480f); - Item.value = Item.buyPrice(0, 2, 0, 0); - } - - public override void AddRecipes() - { - CreateRecipe(5). - AddIngredient(ItemID.BottledWater). - AddIngredient(2). - AddIngredient(5). - AddIngredient(). - AddIngredient(). - AddTile(TileID.Bottles). - AddDecraftCondition(CalamityConditions.DownedHiveMindOrPerforator). - Register(); - - CreateRecipe(). - AddIngredient(ItemID.BottledWater). - AddIngredient(10). - AddIngredient(). - AddTile(TileID.AlchemyTable). - Register() - .DisableDecraft(); - } - } -} diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 2de57c9d47..9e11870259 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -38,8 +38,8 @@ namespace CalamityMod.Items.SummonItems.Invasion public override bool? UseItem(Player player) { - CalamityNetcode.SyncWorld(); - AcidRainEvent.TryStartEvent(true); + AcidRainEvent.TryStartEvent(forceRain: true); + //CalamityNetcode.SyncWorld(); //TryStartEvent(forceRain: true) already sync the world data return true; } diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs index 965b1b0ff3..0ec3bb1df7 100644 --- a/Items/SummonItems/Invasion/MartianDistressRemote.cs +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -39,7 +39,16 @@ namespace CalamityMod.Items.SummonItems.Invasion public override bool? UseItem(Player player) { - Main.StartInvasion(InvasionID.MartianMadness); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Main.invasionDelay = 0; + Main.StartInvasion(InvasionID.MartianMadness); + } + else + { + //-7.0 is hardcoded id for MartianMadness Event + NetMessage.SendData(MessageID.SpawnBossUseLicenseStartEvent, number: player.whoAmI, number2: -7.0f); + } return true; } diff --git a/Items/Tools/BobbitHook.cs b/Items/Tools/BobbitHook.cs index f67d9f7fe3..34c55f4352 100644 --- a/Items/Tools/BobbitHook.cs +++ b/Items/Tools/BobbitHook.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Tools Item.shootSpeed = BobbitHead.LaunchSpeed; // How quickly the hook is shot. Item.shoot = ProjectileType(); Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } } } diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index 70705a1e1a..8f63502ece 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -34,9 +34,15 @@ namespace CalamityMod.Items.Tools.ClimateChange public override bool CanUseItem(Player player) { + //Only SinglePlayer or DedServ should change time to prevent unwanted race condition + if (Main.netMode == NetmodeID.MultiplayerClient) + return true; + if (CalamityPlayer.areThereAnyDamnBosses) return false; + + // Early Morning -> Noon if (Main.dayTime && Main.time < NoonCutoff) Main.SkipToTime(NoonCutoff, true); diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 9423468e0d..03aabed864 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -90,15 +90,15 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags }; itemLoot.AddIf(getsHapuFruit, ModContent.ItemType()); - // Apelusa dev item - // Name specific: "Pelusa" - static bool getsRedBow(DropAttemptInfo info) + // Dandy dev item + // Name specific: "Dandy" + static bool getsGhostBracelet(DropAttemptInfo info) { string playerName = info.player.name; - return playerName == "Pelusa"; + return playerName == "Dandy"; } - itemLoot.AddIf(getsRedBow, ModContent.ItemType()); + itemLoot.AddIf(getsGhostBracelet, ModContent.ItemType()); // Mishiro dev vanity // Name specific: "Amber" or "Mishiro" diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index 653ce53ecf..b3c7e03f97 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.useTurn = false; Item.knockBack = 7f; + Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 99fe8347cd..4c7236b41d 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.useStyle = ItemUseStyleID.Shoot; Item.shoot = ModContent.ProjectileType(); Item.UseSound = null; + Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); diff --git a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs index f69d253b41..812c5471b7 100644 --- a/Items/Weapons/DraedonsArsenal/TrackingDisk.cs +++ b/Items/Weapons/DraedonsArsenal/TrackingDisk.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index ccb6632d8c..63aeac78ab 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Projectiles.Magic; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; @@ -11,37 +12,61 @@ namespace CalamityMod.Items.Weapons.Magic public class SeethingDischarge : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + + public int DartTimer = 0; public override void SetDefaults() { Item.width = 28; Item.height = 32; - Item.damage = 52; + Item.damage = 40; Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 24; - Item.useAnimation = 24; + Item.mana = 20; + Item.useTime = 60; + Item.useAnimation = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6.75f; - Item.UseSound = CommonCalamitySounds.FlareSound; + Item.UseSound = BrimstoneElemental.ShellFireSound; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; + Item.shootSpeed = 10f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + 10f * 0.05f; - float SpeedY = velocity.Y + 10f * 0.05f; - float SpeedX2 = velocity.X - 10f * 0.05f; - float SpeedY2 = velocity.Y - 10f * 0.05f; - float SpeedX3 = velocity.X + 0f * 0.05f; - float SpeedY3 = velocity.Y + 0f * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); - Projectile.NewProjectile(source, position.X, position.Y, SpeedX3, SpeedY3, type, damage, knockback, player.whoAmI, 0f, 0f); + DartTimer++; + + // Spawn hellblasts + float diameter = 50f; + Vector2 projVelocity = velocity.SafeNormalize(Vector2.UnitY); + projVelocity *= diameter; + + int totalProjectiles = 5; + float offsetAngle = MathHelper.Pi * 0.2f; + + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = projVelocity.RotatedBy(offsetAngle * radians); + Projectile.NewProjectile(source, player.Center + offset, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + } + + // Every 3rd attack, spawn a ring of homing darts + if (DartTimer == 3) + { + DartTimer = 0; + + totalProjectiles = 8; + Vector2 initialOffset = Vector2.UnitX.RotatedBy(Main.rand.NextFloat(0f, MathHelper.PiOver4)); + for (int k = 0; k < totalProjectiles; k++) + { + velocity = initialOffset.RotatedBy(MathHelper.TwoPi * (k / (float)totalProjectiles)) * Item.shootSpeed; + Projectile.NewProjectile(source, player.Center, velocity, type, damage, 0f, player.whoAmI, 0f, 1f); + } + } + return false; } } diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index cdfa059331..f699830afb 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 86; Item.height = 104; - Item.damage = 466; + Item.damage = 460; Item.DamageType = DamageClass.Magic; Item.useTime = Item.useAnimation = 20; Item.shootSpeed = 7f; diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index e84f4cc892..7802877825 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/BalefulHarvester.cs b/Items/Weapons/Melee/BalefulHarvester.cs index 81bb2411b5..b1b41f3c1a 100644 --- a/Items/Weapons/Melee/BalefulHarvester.cs +++ b/Items/Weapons/Melee/BalefulHarvester.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 74; - Item.height = 86; + Item.width = 86; + Item.height = 98; Item.damage = 105; Item.DamageType = DamageClass.Melee; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/BalefulHarvester.png b/Items/Weapons/Melee/BalefulHarvester.png index 7b97d34b12..360c99acaf 100644 Binary files a/Items/Weapons/Melee/BalefulHarvester.png and b/Items/Weapons/Melee/BalefulHarvester.png differ diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index 3b47ca0784..f531b3b86b 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/ExobladeGlow").Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, Request("CalamityMod/Items/Weapons/Melee/ExobladeGlow").Value); } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 5d4b85312a..3e803861ed 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -16,9 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 126; Item.height = 42; - Item.damage = 290; + Item.damage = 277; Item.DamageType = DamageClass.Ranged; - Item.useTime = Item.useAnimation = 33; + Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; @@ -27,58 +27,20 @@ namespace CalamityMod.Items.Weapons.Ranged // No use sound is intentional Item.autoReuse = true; Item.shootSpeed = 14.5f; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Rocket; Item.channel = true; - } - - public override void HoldItem(Player player) - { - Item.channel = player.altFunctionUse != 2; - Item.noUseGraphic = player.altFunctionUse != 2; + Item.noUseGraphic = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); - public override bool AltFunctionUse(Player player) => true; - - // Right click doesn't use ammo because it's a detonation signal. - public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse != 2; - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 || player.altFunctionUse == 2; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Play a sound and detonate all in-flight rockets, but don't shoot anything. - if (player.altFunctionUse == 2) - { - SoundEngine.PlaySound(SoundID.Item110, position); - DetonateRockets(player); - return false; - } - - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI, 1); - // Otherwise just play a grenade launcher sound and fire a rocket. - //Main.PlaySound(SoundID.Item61, position); - //Projectile.NewProjectile(source, position, velocity, item.shoot, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, 0, 0f, player.whoAmI, 1); return false; } - - private void DetonateRockets(Player player) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner != player.whoAmI || p.type != Item.shoot) - continue; - - // All rockets will instantly explode on the next frame and send packets to indicate as such. - p.timeLeft = 1; - p.netUpdate = true; - p.netSpam = 0; - } - } - - // Right clicking to detonate all rockets is very fast. - public override float UseSpeedMultiplier(Player player) => player.altFunctionUse == 2 ? 5f : 1f; } } diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index 7427e49ab6..2deeabc7b3 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -1,18 +1,12 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using CalamityMod.NPCs.NormalNPCs; +using System.Collections.Generic; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Ranged; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; -using static Humanizer.In; namespace CalamityMod.Items.Weapons.Ranged { @@ -37,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 38; Item.height = 34; - Item.damage = 35; + Item.damage = 41; Item.DamageType = DamageClass.Ranged; Item.useTime = SetUseTime; diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index 8ccc7e6781..0da66baf7a 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Green; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.DamageType = RogueDamageClass.Instance; + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index b1dfd66b28..926ce17a5a 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -34,6 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); + Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/TheFinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs index 45f45c9fe6..833894bfcf 100644 --- a/Items/Weapons/Rogue/TheFinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; Item.autoReuse = false; diff --git a/Items/Weapons/Summon/Cnidarian.cs b/Items/Weapons/Summon/Cnidarian.cs index 836c151c26..01f80f495b 100644 --- a/Items/Weapons/Summon/Cnidarian.cs +++ b/Items/Weapons/Summon/Cnidarian.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.channel = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ProjectileType(); Item.shootSpeed = 10f; Item.rare = ItemRarityID.Green; @@ -124,7 +124,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; + Texture2D properSprite = Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.DrawNewInventorySprite(properSprite, new Vector2(42f, 34), position, drawColor, origin, scale); return false; @@ -132,7 +132,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { - Texture2D properSprite = ModContent.Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; + Texture2D properSprite = Request("CalamityMod/Items/Weapons/Summon/Cnidarian").Value; spriteBatch.Draw(properSprite, Item.position - Main.screenPosition, null, lightColor, rotation, properSprite.Size() / 2f, scale, 0, 0); return false; diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 42c88f0356..00bd7cbc0b 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -597,11 +597,6 @@ SulphurskinBuff: { Description: The sulphuric waters have a lesser effect on you } -TeslaBuff: { - DisplayName: Tesla's Electricity - Description: Summons an aura of electricity -} - WeaponImbueBrimstone: { DisplayName: Weapon Imbue: Brimstone Description: Melee, Whip, and Rogue attacks ignite enemies with brimstone flames @@ -785,7 +780,7 @@ KamiBuff: { Mushy: { DisplayName: Mushy - Description: Increased defense by 6 and life regen by 1HP/s + Description: Increased defense by 8 and life regen by 1HP/s } PhantomicEmpowerment: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 6ad0a5f551..9d7722532f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -42,7 +42,7 @@ AbyssalDivingSuit: { Grants the ability to swim, extends underwater breathing, emits light underwater, and improves mobility on ice Provides a moderate amount of light and reduces breath loss in the abyss Abyss creatures are less likely to see you, mitigates the abyss' defense reduction, and lets you sink faster in liquids - Grants immunity to the sulphurous waters + Grants immunity to the sulphurous waters and Crush Depth's increased breath loss ''' } @@ -103,10 +103,11 @@ AmalgamatedBrain: { DisplayName: Amalgamated Brain Tooltip: ''' - 10% increased damage - Shade rains down and enemies are confused when hit, - and summon damage and crit chance are boosted by 10% + 5% increased damage + Taking damage confuses nearby enemies and spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks + After dodging, summon damage and crit chance are boosted by 10% ''' HoldShiftTooltip: ''' @@ -129,14 +130,14 @@ AmbrosialAmpoule: { ''' } -AmidiasPendant: { - DisplayName: Amidias' Pendant - Tooltip: Periodically rains down prism shards that briefly stun enemies -} - AmidiasSpark: { DisplayName: Amidias' Spark - Tooltip: Taking damage releases a blast of sparks + Tooltip: + ''' + Attacks inflict Static Discharge while underwater + Taking damage causes the enemy to be shocked + Shocked enemies constantly release sparks + ''' } AncientFossil: { @@ -359,7 +360,7 @@ BlunderBooster: { 12% increased rogue damage and 15% increased rogue projectile velocity Stealth generates 10% faster Summons a red lightning aura around the player that electrifies nearby enemies - The aura's appearance can be toggled with visibility + The aura has reduced opacity if visibility is disabled Press [KEY] to consume 25% of your maximum stealth to perform a swift upwards diagonal dash This dash leaves a trail of red lightning bolts This effect has a 1 second cooldown before it can be used again @@ -573,6 +574,7 @@ DepthCharm: { ''' Reduces the damage caused by drowning in the abyss Removes the bleed effect caused by the upper layers of the abyss + Removes the increased breath loss of Crush Depth ''' } @@ -808,8 +810,8 @@ FungalSymbiote: { Tooltip: ''' You grow mushrooms on the grass beneath you - Consuming mushrooms provides the Mushy buff, granting 6 defense and +1 HP/s life regen - All mushroom-based weapons deal 10% more damage and emit harmless mushrooms + Consuming mushrooms provides the Mushy buff, granting 8 defense and +1 HP/s life regen + 10% increased damage while you have the Mushy buff ''' } @@ -819,7 +821,7 @@ GiantPearl: { ''' You have a light aura around you Enemies within the aura are slowed down - Does not work while a boss is alive + You release homing prism shards while an enemy is slowed Provides a small amount of light in the abyss ''' } @@ -1101,8 +1103,7 @@ Nanotech: { Stealth strikes summon nanobeams and sparks on enemy hits Stealth strikes have +15 armor penetration, deal 5% more damage, and heal for 2 HP 15% increased rogue damage and 15% increased rogue velocity - Landing a stealth strike grants a 12% crit bonus to non-stealth strikes - This crit bonus slowly decays + Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds ''' } @@ -1356,11 +1357,7 @@ RadiantOoze: { RaidersTalisman: { DisplayName: Raider's Talisman - Tooltip: - ''' - Stealth strikes grant 12% crit bonus to non-stealth strikes - This crit bonus slowly decays - ''' + Tooltip: Stealth strikes grant 10% critical strike chance to non-stealth strikes for 5 seconds } RampartofDeities: { @@ -1410,9 +1407,9 @@ RottenBrain: { DisplayName: Rotten Brain Tooltip: ''' - 10% increased damage when below 75% life - 5% decreased movement speed when below 50% life - Shade rains down when you are hit + 6% increased damage + Taking damage spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds ''' } @@ -1458,9 +1455,9 @@ SandCloak: { Tooltip: ''' 5% increased movement speed - Press [KEY] to consume 10% of your maximum stealth to create a protective dust veil - While inside the veil, you gain 6 defense and +1 HP/s life regen - This effect has a 30 second cooldown before it can be used again + Press [KEY] to create a protective sand veil which damages enemies inside it + While inside the veil, you gain 6 defense and 3% critical strike chance + This effect has a 20 second cooldown before it can be used again ''' } @@ -1754,6 +1751,16 @@ SupremeBaitTackleBoxFishingStation: { ''' } +TeslasAmulet: { + DisplayName: Tesla's Amulet + Tooltip: + ''' + Generates an electrifying field that slows enemies + The field has reduced opacity if visibility is disabled + Reduces the duration of the Static Discharge debuff + ''' +} + TheAbsorber: { DisplayName: The Absorber Tooltip: @@ -1772,8 +1779,11 @@ TheAmalgam: { Tooltip: ''' 15% increased damage - Shade rains down when you are hit + Most buffs last twice as long, and persist after dying + Taking damage inflicts several debuffs on nearby enemies and spawns a dank creeper + The dank creeper flies above you, exploding into several shaderain clouds Grants the ability to dodge attacks + After dodging, summon damage and crit chance are boosted by 10% ''' HoldShiftTooltip: ''' @@ -1828,12 +1838,12 @@ TheEvolution: { DisplayName: The Evolution Tooltip: ''' - Reflects projectiles that hit you, making them harmless to you but 10x more harmful to enemies + Reflects projectiles that hit you, reducing their damage to 1 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 - Reflecting a projectile grants +1 HP/s life regen and accelerated life regen for 5 seconds - If the same enemy projectile type hits you again you will resist its damage by 15% + 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% ''' } @@ -1863,10 +1873,11 @@ TheTransformer: { DisplayName: The Transformer Tooltip: ''' - Multiplies all electric debuff damage by 1.5 - Taking damage releases a blast of sparks - Complete immunity to Electrified and all electric attacks - You take halved damage from enemy bullets and reflect them for 800% damage + Multiplies all electricity debuff damage by 1.5x + Attacks inflict Static Discharge while underwater + Reduces the damage of all electricity debuffs by 50% + Taking damage causes the enemy to be shocked + Shocked enemies constantly release sparks ''' } @@ -2027,9 +2038,9 @@ CrystalHeartVodka: { Tooltip: "'Tastes like strawberry cream liqueur (and estrogen)'" } -CocosFeather: { - DisplayName: Coco's Feather - Tooltip: "" +GhostBracelet: { + DisplayName: Ghost Bracelet + Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity } HapuFruit: { @@ -2050,8 +2061,3 @@ Popo: { 'Don't let the demons steal your nose' ''' } - -RedBow: { - DisplayName: Red Bow - Tooltip: "'Pelusa's favorite bow'" -} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 675c64e604..eb17975d7f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -460,17 +460,17 @@ ReaverHeadExplore: { DisplayName: Reaver Headgear Tooltip: ''' - 20% increased mining speed and block/wall placement speed + 20% increased mining speed + 50% increased block & wall placement speed Grants immunity to lava and can move freely through liquids ''' SetBonus: ''' - Highlights all treasure nearby - Increased item grab range and block placement range - Mining tiles restores breath while underwater - Summons a reaver orb to light up the area around you - Reduces enemy aggression, even in the abyss - Provides a small amount of light in the abyss + Summons an orb which highlights nearby treasure and provides light + Grants underwater breathing and reduced enemy aggression + These have a moderate effect while in the Abyss + Increased block placement & tool range by 7 + Increases pickup range for items ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index ab21fcb087..438e31c223 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -96,7 +96,7 @@ MarniteArchitectHeadgear: { MarniteArchitectToga: { DisplayName: Marnite Architect Toga - Tooltip: Increases tile placement speed by 50% + Tooltip: Increases block & wall placement speed by 50% } SnowRuffianChestplate: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 11566009ab..d3c1dfc482 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -46,7 +46,7 @@ UrsaSergeant: { Attacks maul enemies with astral claw swipes Taking damage reduces the cooldown, but inflicts you with Astral Infection Enemy kills also reduce the cooldown - Swipes will be opaque and produce no sound if visibility is disabled + Swipes will be translucent and silent if visibility is disabled ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 4a904bb8a6..b6c818e2e0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -3095,6 +3095,11 @@ LivingHolyFireBlock: { Tooltip: "" } +LivingPlagueFireBlock: { + DisplayName: Living Plague Fire Block + Tooltip: "" +} + DraedonExoSelectMusicBox: { DisplayName: Music Box (Exo Mech Selection) Tooltip: Plays 'Signal Received' by CDMusic diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 295ba11731..bcbcf33076 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -155,15 +155,6 @@ SupremeManaPotion: { Tooltip: "" } -TeslaPotion: { - DisplayName: Tesla Potion - Tooltip: - ''' - Summons an aura of electricity that electrifies and slows enemies - Aura damage is reduced on bosses - ''' -} - ZenPotion: { DisplayName: Zen Potion Tooltip: Vastly decreases enemy spawn rate diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index bccef2915e..248ea0cf93 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -158,7 +158,8 @@ PulseTurretRemote: { DisplayName: Pulse Turret Remote Tooltip: ''' - Summons a pulse turret which eradicates nearby foes with focused energy blasts + {$CommonItemTooltip.Sentry} + Summons a turret to fire explosive pulse blasts at your enemies Only one pulse turret may exist at a time ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 8c4fbd7b25..ac617a0f5e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -723,7 +723,11 @@ SanguineFlare: { SeethingDischarge: { DisplayName: Seething Discharge - Tooltip: Fires a barrage of brimstone blasts + Tooltip: + ''' + Fires an accelerating arc of brimstone hellblasts + Every third attack spawns a brimstone dart ring which chases after foes + ''' } Serpentine: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 1eb75ba619..0cc85f6ce8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -239,11 +239,7 @@ Buzzkill: { ChickenCannon: { DisplayName: Chicken Cannon - Tooltip: - ''' - Fires chicken flares which create enormous incendiary explosions - Press to detonate all airborne rockets - ''' + Tooltip: Fires chicken flares which create enormous incendiary explosions } ChromaticEruption: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 4254373b8c..5e28528e24 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -588,7 +588,11 @@ Hypothermia: { Icebreaker: { DisplayName: Icebreaker - Tooltip: Stealth strikes spawn a cosmic explosion and freeze nearby enemies on enemy hits + Tooltip: + ''' + Throws an icy hammer that magically returns to the player + Stealth strikes spawn a cosmic explosion and freeze nearby enemies on hit + ''' } IceStar: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index d51e5d1554..d0a381c6fa 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -24,7 +24,8 @@ AquasScepter: { DisplayName: Aqua's Scepter Tooltip: ''' - Summons a giant storm cloud sentry to rain down on your foes, and strike nearby enemies with overloading tesla energy + {$CommonItemTooltip.Sentry} + Summons a giant storm cloud to rain down on your foes, and strike nearby enemies with overloading tesla energy 'Captain! I think- we've got a risk of rain!' ''' } @@ -44,6 +45,7 @@ AtlasMunitionsBeacon: { DisplayName: Atlas Munitions Beacon Tooltip: ''' + [c/F2B629:{$CommonItemTooltip.Sentry}] [c/F2B629:Brings forth an exo-powered, stationary cannon] [c/F2B629:The cannon will fire at enemies within its range] [c/F27049:If an enemy is in close proximity, it will enter Overdrive] @@ -96,7 +98,11 @@ BrittleStarStaff: { CadaverousCarrion: { DisplayName: Cadaverous Carrion - Tooltip: Summons a gross, shark-puking Old Duke head on the ground + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a gross, shark-puking Old Duke head on the ground + ''' } CalamarisLament: { @@ -115,7 +121,11 @@ CalamarisLament: { CausticCroakerStaff: { DisplayName: Caustic Croaker Staff - Tooltip: Summons a toad that explodes if enemies are nearby + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a toad that explodes if enemies are nearby + ''' } CausticStaff: { @@ -214,7 +224,8 @@ CryogenicStaff: { DisplayName: Cryogenic Staff Tooltip: ''' - Summons an animated ice construct to protect you + {$CommonItemTooltip.Sentry} + Summons an ice construct to unleash the cold upon your enemies Fire rate and range increase the longer it targets an enemy ''' } @@ -277,7 +288,11 @@ DragonbloodDisgorger: { DreadmineStaff: { DisplayName: Dreadmine Staff - Tooltip: Summons a dreadmine turret to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a turret that swarms your enemies with sea mines + ''' } EnchantedConch: { @@ -415,7 +430,8 @@ GuidelightofOblivion: { DisplayName: Guidelight of Oblivion Tooltip: ''' - Summons a lantern turret to fight for you + {$CommonItemTooltip.Sentry} + Summons a lantern that swarms your enemies with flames 'Shadows dream of endless fire, flames devour and embers swoop' ''' } @@ -424,6 +440,7 @@ HarvestStaff: { DisplayName: Harvest Staff Tooltip: ''' + {$CommonItemTooltip.Sentry} Grows a pumpkin patch that sprouts pumpkins nearby Pumpkins will hop out when approached by nearby creatures or players Once out, they will aggressively tackle enemies, exploding on hit @@ -443,7 +460,11 @@ HerringStaff: { HivePod: { DisplayName: Hive Pod - Tooltip: Summons an astraglomerate to protect you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons an astraglomerate to spawn glomerings at your enemies + ''' } IgneousExaltation: { @@ -503,7 +524,6 @@ Metastasis: { It takes up 4 minion slots and it can only be summoned once [c/C61B40:A contemplated possible future of the cosmic serpent,] [c/C61B40:A gruesome warning for those blinded by the hunger for power.] - ''' } @@ -540,7 +560,11 @@ MutatedTruffle: { OrthoceraShell: { DisplayName: Orthocera Shell - Tooltip: Summons a flying orthocera sentry at the mouse position + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a flying orthocera to spit acid streams at your enemies + ''' } Perdition: { @@ -564,7 +588,11 @@ PlantationStaff: { PolypLauncher: { DisplayName: Polyp Launcher - Tooltip: Summons a polyp bunch that launches coral chunks at nearby enemies + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a polyp bunch that launches coral chunks at nearby enemies + ''' } PuffShroom: { @@ -586,14 +614,18 @@ RustyBeaconPrototype: { DisplayName: Rusty Beacon Prototype Tooltip: ''' - Summons a long-abandoned drone to support you - The drone hovers in place and releases toxic waves that irradiate hit enemies + {$CommonItemTooltip.Sentry} + Summons a long-abandoned drone that passively emits irradiated waves ''' } SanctifiedSpark: { DisplayName: Sanctified Spark - Tooltip: Summons a profaned energy turret to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a friendly immolator to fire holy sparks at your enemies + ''' } SandSharknadoStaff: { @@ -649,17 +681,26 @@ SlimePuppetStaff: { SpikecragStaff: { DisplayName: Spikecrag Staff Tooltip: "[GFB]" - TooltipNormal: Summons a spikecrag to protect you + TooltipNormal: + ''' + {$CommonItemTooltip.Sentry} + Summons a bed of stalagmites to spray spikes at your enemies + ''' TooltipGFB: ''' - Summons a spikecrag to protect you" + {$CommonItemTooltip.Sentry} + Summons a bed of stalagmites to spray spikes at your enemies Defeating the Profaned Goddess unlocks its true power ''' } SquirrelSquireStaff: { DisplayName: Squirrel Squire Staff - Tooltip: Summons a squirrel squire to fight for you + Tooltip: + ''' + {$CommonItemTooltip.Sentry} + Summons a squirrel to throw acorns at your enemies + ''' } StaffOfNecrosteocytes: { diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 811944daa8..47396ea6f7 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -579,7 +579,7 @@ THIEF: { LikeNPC: "{NPCName} doesn't only keep spiky balls in his pockets, he keeps a ton of cash! He's too absentminded to notice I'm stealing from him too! I like that a lot!" DislikeNPC: What a goody two shoes, {NPCName} is! I dislike her out of principle! …And because she has almost no material goods. LikeNPC_Princess: I couldn't bear to steal anything from {NPCName}, she's so cute! - Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how she does it!" + Princess_LovesNPC: "{NPCName} gifts me with nice exact replicas of other's things, I wonder how they do it!" } } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index bfc7b09788..a457e9850c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -81,7 +81,7 @@ HolyFlare.DisplayName: Holy Flare HolyLight.DisplayName: Holy Light HolySpear.DisplayName: Holy Spear HomingGasBulb.DisplayName: Homing Gas Bulb -HomingGasBulbSporeGas.DisplayName: Homing Gas Bulb Spore Gas +HomingGasBulbSporeGas.DisplayName: Spore Bulb Gas IceBlast.DisplayName: Ice Blast IceBomb.DisplayName: Ice Bomb IceRain.DisplayName: Ice Rain diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 3227b6c5db..5be0d801b9 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -20,7 +20,6 @@ AstralCrystalInvisibleExplosion.DisplayName: Astral Crystal Invisible Explosion AstralStarMagic.DisplayName: Astral Star AtlantisSpear.DisplayName: Atlantis Spear AugurTentacle.DisplayName: Elemental Tentacle -AuraRain.DisplayName: Aura Rain AuroraAustralis.DisplayName: Aurora Australis BeamingBolt.DisplayName: Beaming Bolt BeamingBolt2.DisplayName: Beaming Bolt @@ -195,7 +194,6 @@ SerpentineBody.DisplayName: Serpentine SerpentineHead.DisplayName: Serpentine SerpentineTail.DisplayName: Serpentine ShadecrystalProjectile.DisplayName: Shadecrystal -ShadeNimbus.DisplayName: Shade Nimbus ShadeNimbusCloud.DisplayName: Shade Nimbus Shaderain.DisplayName: Shaderain Shadowbolt.DisplayName: Shadowbolt diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 2ca20a426c..2a9058f92e 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -76,6 +76,7 @@ DeepWounderWater.DisplayName: Water Droplet DesecratedBubble.DisplayName: Desecrated Bubble DesecratedWaterProj.DisplayName: Desecrated Water DestructionBolt.DisplayName: Destruction Bolt +DestructionExplosion.DisplayName: Destruction Explosion DestructionStar.DisplayName: Star of Destruction DragonScalesInfernado.DisplayName: Infernado DragonShit.DisplayName: Fire @@ -328,4 +329,3 @@ WrathwingCinder.DisplayName: Wrathwing Eruption WrathwingFireball.DisplayName: Wrathwing Fireball WrathwingSpear.DisplayName: Wrathwing WulfrumKnifeProj.DisplayName: Wulfrum Knife -DestructionExplosion.DisplayName: Destruction Explosion diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 259341d807..1124cb8671 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -89,9 +89,7 @@ OmegaBlueTentacle.DisplayName: Omega Blue Tentacle OnyxLabSeeker.DisplayName: Seeking Mechanism PauldronDash.DisplayName: Pauldron Dash PauldronExplosion.DisplayName: Pauldron Explosion -PendantProjectile1.DisplayName: Prism Shard -PendantProjectile2.DisplayName: Prism Shard -PendantProjectile3.DisplayName: Prism Shard +PearlAuraShard.DisplayName: Prism Shard PlaguePulse.DisplayName: Plague Pulse PoisonousSeawater.DisplayName: Seawater PscTransformAnimation.DisplayName: Psc Transform Animation @@ -105,6 +103,9 @@ SandExplosion.DisplayName: Sand Seashell.DisplayName: Seashell SepulcherSoul.DisplayName: Tormented Soul SerpentsBiteHook.DisplayName: Serpent's Bite +ShadeNimbus.DisplayName: Shade Nimbus +ShadeNimbusRain.DisplayName: Shade Rain +ShadeNimbusSpawner.DisplayName: Dank Creeper ShadowflameExplosion.DisplayName: Shadowflame Explosion ShadowflameExplosionBig.DisplayName: Shadowflame Explosion SkyFlareFriendly.DisplayName: Flare diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 040a177b97..f6dc2c8748 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -3,7 +3,6 @@ AbyssDrown2: Oxygen failed to reach {0} from the depths of the Abyss. AbyssDrown3: "{0} faded away, lost in the dark waters." AlcoholBig1: "{0} downed too many shots." AlcoholBig2: "{0}'s liver failed." -AlcoholSmall: "{0} succumbed to alcohol sickness." Armageddon: "{0} failed the challenge at hand." AstralInfection1: "{0}'s infection spread too far." AstralInfection2: "{0}'s skin was replaced by the astral virus." @@ -85,6 +84,7 @@ Plague2: "{0} couldn't vaccinate against the plague." Plague3: "{0} was reduced to nutrient rich sludge." ProfanedSoulCrystal: "{0} was summoned too soon." ProvidenceAntiHealing: "{0} was purged of their unworthy existence." +Rebecca: "{0} was once again exploded by CIT." Riptide1: "{0} was swept away by the tides." Riptide2: "{0} was ripped apart by the current." SearingLava1: "{0}'s soul was released by the lava." diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 190c786713..b52c15e978 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -80,6 +80,7 @@ ExtensionName: { // Cooldowns Cooldowns: { AquaticHeartIceShield: Ice Shield Cooldown + ArsenalPower: Arsenal Cooldown AscendEffect: Ascension Cooldown BloodflareFrenzy: Blood Frenzy Cooldown BloodflareRangedSet: Bloodflare Soul Cooldown diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index 3e221f5442..e7a5ceade6 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -37,7 +37,7 @@ SetBonus: { ''' Eskimo: ''' - Multiplies all cold-based debuff damage by 1.25 + Multiplies all cold-based debuff damage by 1.25x Cold enemies will deal reduced contact damage to the player Provides immunity to the Chilled, Frozen, Frostburn and Glacial State debuffs ''' diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 73ab93575a..1ec0ce7533 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -1074,8 +1074,8 @@ namespace CalamityMod double Damage(DamageClass damageClass) => Math.Round(Main.LocalPlayer.GetTotalDamage(damageClass).Additive * Main.LocalPlayer.GetTotalDamage(damageClass).Multiplicative * 100 - 100); int Crit(DamageClass damageClass) => (int)Main.LocalPlayer.GetTotalCritChance(damageClass); - int rogueItem = ModContent.ItemType(); - DamageClass rogueDamageClass = ModContent.GetInstance(); + int rogueItem = ItemType(); + DamageClass rogueDamageClass = GetInstance(); Func rogueDamage = () => $"Rogue Damage: {Damage(rogueDamageClass)}%"; Func rogueCrit = () => $"Rogue Critical: {Crit(rogueDamageClass)}%"; fargos.Call("AddStat", rogueItem, rogueDamage); diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index 14a0dbf9f7..1e5192ee43 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -91,8 +91,8 @@ namespace CalamityMod.NPCs.Abyss public override void SendExtraAI(BinaryWriter writer) { - writer.Write(NPC.localAI[0]); writer.Write(playerCrossed); + writer.Write(NPC.localAI[0]); } public override void ReceiveExtraAI(BinaryReader reader) diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index c3455067f5..40ebfeb51d 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -156,8 +156,8 @@ namespace CalamityMod.NPCs.AcidRain hasDoneDeathray = reader.ReadBoolean(); AttackIndex = reader.ReadInt32(); DelayTime = reader.ReadInt32(); - DeathrayTime = reader.ReadInt32(); JumpTimer = reader.ReadSingle(); + DeathrayTime = reader.ReadInt32(); ShootPosition = reader.ReadVector2(); } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 6931c0d21c..89f96d85b8 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -112,8 +112,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ReceiveExtraAI(BinaryReader reader) { - NPC.chaseable = reader.ReadBoolean(); currentMode = reader.ReadInt32(); + NPC.chaseable = reader.ReadBoolean(); NPC.localAI[0] = reader.ReadSingle(); NPC.localAI[1] = reader.ReadSingle(); NPC.localAI[3] = reader.ReadSingle(); diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index 2896c962f3..40fa624d73 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -130,6 +130,7 @@ namespace CalamityMod.NPCs.CalClone double dist = death ? 180 : 150; NPC.position.X = parent.Center.X - (int)(Math.Cos(rad) * dist) - NPC.width / 2; NPC.position.Y = parent.Center.Y - (int)(Math.Sin(rad) * dist) - NPC.height / 2; + NPC.velocity = Vector2.Zero; NPC.ai[1] += death ? 0.5f : 2f; return false; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index 214a023c11..ad6d55af05 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -47,11 +47,12 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; - float exhaustionGateValue = 300f; + float exhaustionGateValue = 360f; if (Main.getGoodWorld) exhaustionGateValue *= 0.5f; - float exhaustionIncreasePerAttack = exhaustionGateValue * 0.1f; + float numberOfAttacksBeforeExhaustion = 12f; + float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); bool exhausted = calamityGlobalNPC.newAI[1] == 1f; bool phase2 = lifeRatio <= (death ? 0.8f : revenge ? 0.7f : 0.5f); bool phase3 = lifeRatio <= (death ? 0.5f : (revenge ? 0.35f : 0.2f)) && expertMode; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index fad87e4254..81a98247d3 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -246,6 +246,7 @@ namespace CalamityMod.NPCs public int slowed = 0; public int electrified = 0; public int pearlAura = 0; + public int pearlAuraCounter = 0; public int bBlood = 0; public int brainRot = 0; public int laceration = 0; @@ -282,6 +283,8 @@ namespace CalamityMod.NPCs public int astralInfection = 0; public int wDeath = 0; public int nightwither = 0; + public int shocked = 0; + public int transformerShocked = 0; public int shellfishVore = 0; public int clamDebuff = 0; public int sulphurPoison = 0; @@ -470,6 +473,7 @@ namespace CalamityMod.NPCs myClone.slowed = slowed; myClone.electrified = electrified; myClone.pearlAura = pearlAura; + myClone.pearlAuraCounter = pearlAuraCounter; myClone.bBlood = bBlood; myClone.brainRot = brainRot; myClone.laceration = laceration; @@ -502,6 +506,8 @@ namespace CalamityMod.NPCs myClone.astralInfection = astralInfection; myClone.wDeath = wDeath; myClone.nightwither = nightwither; + myClone.shocked = shocked; + myClone.transformerShocked = transformerShocked; myClone.shellfishVore = shellfishVore; myClone.clamDebuff = clamDebuff; myClone.sulphurPoison = sulphurPoison; @@ -964,27 +970,6 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); } - // Vermillion Flux - if (vermillionFlux > 0) - { - int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets - ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); - } - - // Auric Rebuke - if (auricRebuke > 0) - { - int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets - ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); - } - - // Static Discharge - if (staticDischarge > 0) - { - int baseStaticDischargeDoTValue = (int)(6 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets - ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); - } - // Banishing Fire if (banishingFire > 0) { @@ -1113,6 +1098,27 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseElectrifiedDoTValue, baseElectrifiedDoTValue / 22, ref npc.lifeRegen, ref damage); } + // Vermillion Flux + if (vermillionFlux > 0) + { + int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets + ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); + } + + // Auric Rebuke + if (auricRebuke > 0) + { + int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets + ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); + } + + // Static Discharge + if (staticDischarge > 0) + { + int baseStaticDischargeDoTValue = (int)(6 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets + ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); + } + // Crush Depth if (cDepth > 0) { @@ -1127,6 +1133,43 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseRiptideDoTValue, baseRiptideDoTValue / 3, ref npc.lifeRegen, ref damage); } + if (npc.dryadBane) + { + // Buffs match 1:1 with Town NPC buffs + // See CalamityGlobalTownNPC: BuffTownNPC + float buffedDryadsBaneMult = 0f + + (NPC.downedMoonlord ? 0.6f : 0f) + + (DownedBossSystem.downedProvidence ? 0.2f : 0f) + + (DownedBossSystem.downedPolterghast ? 0.2f : 0f) + + (DownedBossSystem.downedDoG ? 0.2f : 0f) + + (DownedBossSystem.downedYharon ? 0.2f : 0f) + + (DownedBossSystem.downedExoMechs ? 0.6f : 0f) + + (DownedBossSystem.downedCalamitas ? 0.6f : 0f); + if (Main.expertMode) + buffedDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int buffedDryadsBaneDoTValue = 2 * (int)(4 * buffedDryadsBaneMult); + npc.lifeRegen -= buffedDryadsBaneDoTValue; + + // Scales damage tick if greater than the vanilla amount + float vanillaDryadsBaneMult = 1f + + (NPC.downedBoss1 ? 0.1f : 0f) + + (NPC.downedBoss2 ? 0.1f : 0f) + + (NPC.downedBoss3 ? 0.1f : 0f) + + (NPC.downedQueenBee ? 0.1f : 0f) + + (Main.hardMode ? 0.4f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedPlantBoss ? 0.15f : 0f) + + (NPC.downedGolemBoss ? 0.15f : 0f) + + (NPC.downedAncientCultist ? 0.15f : 0f); + if (Main.expertMode) + vanillaDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int totalDryadsBaneDoTValue = 2 * (int)(4 * vanillaDryadsBaneMult) + buffedDryadsBaneDoTValue; + if (damage < totalDryadsBaneDoTValue / 6) + damage = totalDryadsBaneDoTValue / 6; + } + // Debuffs that aren't affected by weaknesses or resistances. if (vaporfied > 0) ApplyDPSDebuff(30, 6, ref npc.lifeRegen, ref damage); @@ -1438,7 +1481,7 @@ namespace CalamityMod.NPCs npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; } - else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { // HP boosted in Master Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar) npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.masterMode ? 1.7 : 1.2)); @@ -1446,10 +1489,9 @@ namespace CalamityMod.NPCs } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65); - npc.scale = 1.2f; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.55); } - else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == NPCType()) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 10f; @@ -2462,7 +2504,7 @@ namespace CalamityMod.NPCs { if (!NPC.downedMechBossAny) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == ModContent.NPCType()) + if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2472,7 +2514,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == ModContent.NPCType()) + if (CalamityLists.DestroyerIDs.Contains(npc.type) || npc.type == NPCID.Probe || CalamityLists.SkeletronPrimeIDs.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -3423,7 +3465,7 @@ namespace CalamityMod.NPCs public override bool PreAI(NPC npc) { // Change Spaz and Ret weaknesses and resistances when phase 2 starts. - if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) { if (npc.ai[0] >= 2f) { @@ -5133,6 +5175,9 @@ namespace CalamityMod.NPCs npc.ai[3] = 0f; } + // Incremement Giant Pearl's pearl shard counter + pearlAuraCounter++; + // Debuff decrements if (debuffResistanceTimer > 0) debuffResistanceTimer--; @@ -5211,6 +5256,10 @@ namespace CalamityMod.NPCs wDeath--; if (nightwither > 0) nightwither--; + if (shocked > 0) + shocked--; + if (transformerShocked > 0) + transformerShocked--; if (shellfishVore > 0) shellfishVore--; if (clamDebuff > 0) @@ -5219,8 +5268,6 @@ namespace CalamityMod.NPCs sulphurPoison--; if (sagePoisonTime > 0) sagePoisonTime--; - if (kamiFlu > 0) - kamiFlu--; if (relicOfResilienceCooldown > 0) relicOfResilienceCooldown--; if (relicOfResilienceWeakness > 0) @@ -5252,11 +5299,9 @@ namespace CalamityMod.NPCs Particle sparks = new LineParticle(npc.Center, new Vector2(Main.rand.NextFloat(-9f, 9f), Main.rand.NextFloat(-9f, 9f)), false, 45, 0.9f, Main.rand.NextBool() ? Color.Cyan : Color.SkyBlue); GeneralParticleHandler.SpawnParticle(sparks); } - //Particle boop = new CustomPulse(npc.Center, Vector2.Zero, new Color(233, 95, 212), "CalamityMod/Particles/Sparkle2", Vector2.One, Main.rand.NextFloat(-5f, 5f), 0.8f + (float)(0.04 * veriumDoomStacks), 1.6f + (float)(0.08 * veriumDoomStacks), 40); - //GeneralParticleHandler.SpawnParticle(boop); SoundEngine.PlaySound(new("CalamityMod/Sounds/NPCHit/CryogenHit", 3) { Volume = 0.6f }, npc.Center); - Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), 100 + (15 * veriumDoomStacks), 0, Main.myPlayer, 200f); + Projectile.NewProjectile(npc.GetSource_FromThis(), npc.Center, Vector2.Zero, ProjectileType(), 100 + (15 * veriumDoomStacks), 0, Main.myPlayer, 200f); veriumDoomMarked = false; veriumDoomStacks = 0; @@ -5312,10 +5357,43 @@ namespace CalamityMod.NPCs } } - if (!CalamityPlayer.areThereAnyDamnBosses && !CalamityLists.enemyImmunityList.Contains(npc.type)) + if (pearlAura > 0) { - if (pearlAura > 0) - npc.velocity *= 0.9f; + // Slow the enemy + npc.velocity *= 0.9f; + + // Spawn pearl shards on a counter + if (pearlAuraCounter % 12 == 0) + { + SoundEngine.PlaySound(SoundID.Item49, Main.LocalPlayer.Center); + Vector2 shardVel = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 7.5f; + int damage = 20; + Projectile.NewProjectile(npc.GetSource_FromThis(), Main.LocalPlayer.Center, shardVel, ProjectileType(), damage, 5f, Main.myPlayer); + } + } + + if (shocked > 0 || transformerShocked > 0) + { + var player = Main.LocalPlayer; + bool strongerShock = transformerShocked > 0; + + int frequency = strongerShock ? 10 : 12; + + // Spawn sparks from the enemy + if (player.miscCounter % frequency == 0) + { + int sDamage = strongerShock ? 50 : 10; + Vector2 velocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 5f; + Projectile spark = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), npc.Center, velocity, ProjectileType(), sDamage, 0f, player.whoAmI, 0f, 1f); + spark.timeLeft = 120; + spark.penetrate = 3; + if (strongerShock) + { + spark.timeLeft = 240; + spark.extraUpdates = 1; + spark.penetrate = 10; + } + } } // Auric Ore/Repulsers reject Town NPCs and dummies (Auric Land Mines work on them too) @@ -5380,7 +5458,7 @@ namespace CalamityMod.NPCs SoundEngine.PlaySound(explode with { Pitch = 0.8f }, touchedTile.ToWorldCoordinates()); GenericSparkle sparker = new GenericSparkle(touchedTile.ToWorldCoordinates(), Vector2.Zero, Color.Goldenrod, Color.Gold, 2.5f, 9, Main.rand.NextFloat(-0.01f, 0.01f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Projectile.NewProjectile(new EntitySource_TileInteraction(npc, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ModContent.ProjectileType(), 40000, 0f); + Projectile.NewProjectile(new EntitySource_TileInteraction(npc, touchedTile.X, touchedTile.Y), touchedTile.ToWorldCoordinates(), Vector2.Zero, ProjectileType(), 40000, 0f); WorldGen.KillTile(touchedTile.X, touchedTile.Y, noItem: true); continue; } @@ -5402,7 +5480,7 @@ namespace CalamityMod.NPCs if (tile.TileType == auricOreID) { npc.SimpleStrikeNPC((int)(npc.lifeMax * 0.2f), 0); - npc.AddBuff(ModContent.BuffType(), 120); + npc.AddBuff(BuffType(), 120); } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/ExoMechs/TeslaShoot1"), npc.Center); break; @@ -5420,6 +5498,14 @@ namespace CalamityMod.NPCs if (target.Calamity().sulphurSet) npc.AddBuff(BuffID.Poisoned, 60); + if (target.Calamity().aSpark) + { + if (target.Calamity().transformer) + transformerShocked = 120; + else + shocked = 120; + } + if (target.Calamity().snowman) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) @@ -5584,6 +5670,27 @@ namespace CalamityMod.NPCs #endregion #region Modify Hit + public override void ModifyHitPlayer(NPC npc, Player target, ref Player.HurtModifiers modifiers) + { + // Kaguya hair boom GIF + if (npc.type == NPCID.Shark && target.name == "Rebecca" && Main.zenithWorld) + { + SoundEngine.PlaySound(AresGaussNuke.NukeExplosionSound, target.Center); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 12f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 12f; + + target.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Rebecca").Format(target.name)), 1000.0, 0); + modifiers.SourceDamage *= target.statLifeMax2 * Main.rand.NextFloat(3f, 6f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile explosion = Projectile.NewProjectileDirect(npc.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 9999, 0f, Main.myPlayer, ItemID.MiniNukeII, 0.01f); + explosion.friendly = false; + explosion.hostile = true; + explosion.timeLeft = 5; + } + } + } + public override void ModifyHitByItem(NPC npc, Player player, Item item, ref NPC.HitModifiers modifiers) { CalamityPlayer modPlayer = player.Calamity(); @@ -5859,7 +5966,7 @@ namespace CalamityMod.NPCs for (int i = 0; i < Main.maxNPCs; i++) { NPC nPC = Main.npc[i]; - if (nPC.active && nPC.type == ModContent.NPCType() && nPC.life > 0) + if (nPC.active && nPC.type == NPCType() && nPC.life > 0) { nPC.life = 0; nPC.HitEffect(); @@ -5924,7 +6031,7 @@ namespace CalamityMod.NPCs if (npc.life <= 0) { if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), ModContent.NPCType()); + NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.position.X + (float)(npc.width / 2)), (int)(npc.position.Y + (float)npc.height), NPCType()); } break; @@ -6466,7 +6573,7 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) npc.frameCounter = 0D; } } @@ -6530,6 +6637,9 @@ namespace CalamityMod.NPCs if (nightwither > 0) Nightwither.DrawEffects(npc, ref drawColor); + if (pearlAura > 0) + PearlAura.DrawEffects(npc, ref drawColor); + if (pFlames > 0) // Plague debuff Plague.DrawEffects(npc, ref drawColor); @@ -6653,22 +6763,20 @@ namespace CalamityMod.NPCs if (gState > 0) drawColor = Color.Cyan; - else if (electrified > 0) + else if (auricRebuke > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); - drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; + drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; } - else if (vermillionFlux > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkRed, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } - - else if (auricRebuke > 0) + else if (electrified > 0) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); - drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; + drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } else if (absorberAffliction > 0) @@ -6678,7 +6786,7 @@ namespace CalamityMod.NPCs drawColor = Color.Fuchsia; else if (pearlAura > 0) - drawColor = Color.White; + drawColor = new Color(185, 185, 255); else if (timeSlow > 0 || tesla > 0) drawColor = Color.Aquamarine; @@ -6694,7 +6802,7 @@ namespace CalamityMod.NPCs return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (npc.type == NPCID.KingSlime && Main.masterMode && CalamityWorld.revenge) - return NPC.AnyNPCs(ModContent.NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; + return NPC.AnyNPCs(NPCType()) ? Color.Lerp(new Color(0, 0, 150, npc.alpha), new Color(125, 125, 255, npc.alpha), (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f) : null; if (npc.type == NPCID.QueenBee && Main.zenithWorld) { @@ -6892,7 +7000,7 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) + if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || CalamityLists.DestroyerIDs.Contains(npc.type)) return false; } @@ -7666,7 +7774,7 @@ namespace CalamityMod.NPCs } // His afterimages I can't get to work, so fuck it - else if (npc.type == NPCID.SkeletronPrime || npc.type == ModContent.NPCType()) + else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { Texture2D npcTexture = (masterMode && revenge && npc.type == NPCID.SkeletronPrime) ? CalamityMod.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index ffd619919b..3e7777ce5d 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -465,6 +465,11 @@ namespace CalamityMod.NPCs case NPCID.TheGroom: npcLoot.Add(ModContent.ItemType(), 10); break; + + // Ghost Bracelet @ 10% (Dandy requests this drops at a "high chance" but inventory clutter is real so) + case NPCID.Ghost: + npcLoot.Add(ModContent.ItemType(), 10); + break; #endregion #region Blood Moon diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index abf91440b3..5f961afcc5 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -170,6 +170,7 @@ namespace CalamityMod.NPCs "Cap'n Deek", // "Alex N" on Patreon (No discord account) "Captain Billy Bones", // <@!699589229507772416> (djackv) "Captain J. Crackers", // <@!233232602994049024> (qyuuno) + "Gol D. Roger", // <@!256228859110752257> (xtra3678) }; private static readonly string[] PrincessNames = { @@ -1000,7 +1001,7 @@ namespace CalamityMod.NPCs break; case NPCID.Wizard: - if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ModContent.ItemType()) && !Main.LocalPlayer.ZoneHallow) + if (Main.rand.NextBool(6) && !Main.LocalPlayer.InventoryHas(ItemID.RodofDiscord) && !Main.LocalPlayer.InventoryHas(ItemType()) && !Main.LocalPlayer.ZoneHallow) chat = CalamityUtils.GetTextValue("Vanilla.WizardChat.MentionRoD"); if (Main.rand.NextBool(10) && Main.hardMode) chat = CalamityUtils.GetTextValue("Vanilla.WizardChat.Hardmode"); @@ -1028,6 +1029,8 @@ namespace CalamityMod.NPCs modifiers.SourceDamage *= 2f; } + // Does not affect Dryad's Bane + // See CalamityGlobalNPC: UpdateLifeRegen public override void BuffTownNPC(ref float damageMult, ref int defense) { if (NPC.downedMoonlord) @@ -1070,7 +1073,7 @@ namespace CalamityMod.NPCs public override bool? CanBeHitByProjectile(NPC npc, Projectile projectile) { //Not an axe but close enough - if (npc.type == NPCID.TaxCollector && projectile.type == ModContent.ProjectileType()) + if (npc.type == NPCID.TaxCollector && projectile.type == ProjectileType()) return true; return base.CanBeHitByProjectile(npc, projectile); } @@ -1115,7 +1118,7 @@ namespace CalamityMod.NPCs if (type == NPCID.Demolitionist) { - shop.Add(ModContent.ItemType(), Condition.DownedMechBossAny); + shop.Add(ItemType(), Condition.DownedMechBossAny); } if (type == NPCID.ArmsDealer) diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 929abfba7b..3561ac61c7 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -94,11 +94,11 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.dontTakeDamage); + writer.Write(playedbuildsound); writer.Write(NPC.localAI[0]); writer.Write(NPC.localAI[1]); writer.Write(NPC.localAI[2]); writer.Write(NPC.localAI[3]); - writer.Write(playedbuildsound); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index d77b5ef431..0a92d506bf 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -155,6 +155,7 @@ namespace CalamityMod.NPCs.Cryogen writer.Write(biomeEnrageTimer); writer.Write(teleportLocationX); writer.Write(NPC.dontTakeDamage); + writer.Write(NPC.localAI[1]); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } @@ -164,6 +165,7 @@ namespace CalamityMod.NPCs.Cryogen biomeEnrageTimer = reader.ReadInt32(); teleportLocationX = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); + NPC.localAI[1] = reader.ReadSingle(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } @@ -236,15 +238,18 @@ namespace CalamityMod.NPCs.Cryogen if ((int)NPC.ai[0] + 1 > currentPhase) HandlePhaseTransition((int)NPC.ai[0] + 1); - if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f && Main.netMode != NetmodeID.MultiplayerClient && (NPC.ai[0] < 3f || bossRush || (death && NPC.ai[0] > 3f))) //spawn shield for phase 0 1 2, not 3 4 5 + if (NPC.ai[2] == 0f && NPC.localAI[1] == 0f) { + NPC.localAI[1] = 1f; SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); - int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); - NPC.ai[2] = shieldSpawn + 1; - NPC.localAI[1] = -1f; - NPC.netUpdate = true; - Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; - Main.npc[shieldSpawn].netUpdate = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + NPC.netUpdate = true; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } int shieldTracker = (int)NPC.ai[2] - 1; @@ -256,11 +261,6 @@ namespace CalamityMod.NPCs.Cryogen { NPC.dontTakeDamage = false; NPC.ai[2] = 0f; - - if (NPC.localAI[1] == -1f) - NPC.localAI[1] = death ? 540f : expertMode ? 720f : 1080f; - if (NPC.localAI[1] > 0f) - NPC.localAI[1] -= 1f; } if (CalamityConfig.Instance.BossesStopWeather) @@ -428,6 +428,15 @@ namespace CalamityMod.NPCs.Cryogen NPC.ai[0] = 1f; NPC.localAI[0] = 0f; NPC.netUpdate = true; + + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } } else if (NPC.ai[0] == 1f) @@ -617,6 +626,15 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[0] = 0f; calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; + + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } } } else if (NPC.ai[0] == 2f) @@ -968,6 +986,18 @@ namespace CalamityMod.NPCs.Cryogen calamityGlobalNPC.newAI[2] = 0f; NPC.netUpdate = true; + if (death) + { + SoundEngine.PlaySound(ShieldRegenSound, NPC.Center); + if (NPC.ai[2] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + int shieldSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + NPC.ai[2] = shieldSpawn + 1; + Main.npc[shieldSpawn].ai[0] = NPC.whoAmI; + Main.npc[shieldSpawn].netUpdate = true; + } + } + int chance = 100; if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) chance = 20; diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index 19e69bdb32..f1fd71ba5d 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -32,11 +32,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.height = 216; NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; NPC.DR_NERD(0.4f); - NPC.lifeMax = CalamityWorld.death ? 700 : 1400; - if (BossRushEvent.BossRushActive) - { - NPC.lifeMax = 10000; - } + NPC.LifeMaxNERB(2800, 3360, 33600); NPC.Opacity = 0f; NPC.HitSound = Cryogen.HitSound; NPC.DeathSound = BreakSound; diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs index cb66c1bf91..b20ce40bf3 100644 --- a/NPCs/NormalNPCs/Foveanator.cs +++ b/NPCs/NormalNPCs/Foveanator.cs @@ -115,7 +115,7 @@ namespace CalamityMod.NPCs.NormalNPCs CalamityUtils.CalamityTargeting(NPC, options); } - float enrageScale = bossRush ? 0.5f : 0.4f; + float enrageScale = bossRush ? 0.5f : 0.3f; if (Main.IsItDay() || bossRush) { NPC.Calamity().CurrentlyEnraged = !bossRush; diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index a6c63dd4d7..9ad8a39ed9 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -296,7 +296,7 @@ namespace CalamityMod.NPCs.PlagueEnemies float stingerAttackSpeed = 12f; float stingerAttackAccel = 0.12f; - Vector2 stingerSpawnPos = new Vector2(NPC.Center.X + (float)(40 * NPC.direction), NPC.position.Y + (float)NPC.height * 0.8f); + Vector2 stingerSpawnPos = new Vector2(NPC.Center.X + (float)(40 * NPC.direction), NPC.Bottom.Y + 30f); Vector2 stingerAttackPos = NPC.Center; float stingerAttackTargetX = Main.player[NPC.target].Center.X - stingerAttackPos.X; float stingerAttackTargetY = Main.player[NPC.target].Center.Y - 300f - stingerAttackPos.Y; @@ -382,22 +382,23 @@ namespace CalamityMod.NPCs.PlagueEnemies Texture2D texture2D15 = TextureAssets.Npc[NPC.type].Value; Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[NPC.type].Value.Width / 2), (float)(TextureAssets.Npc[NPC.type].Value.Height / Main.npcFrameCount[NPC.type] / 2)); - int afterimageAmt = 7; - if (NPC.ai[0] != 0f) - afterimageAmt = 5; if (CalamityConfig.Instance.Afterimages) { - for (int i = 1; i < afterimageAmt; i += 2) + if (NPC.ai[0] == 0f && NPC.localAI[0] == 1f) { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (float)(afterimageAmt - i) / 15f; - Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; - afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + int chargeAfterimageAmount = 6; + for (int i = 1; i < chargeAfterimageAmount; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(chargeAfterimageAmount - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[NPC.type])) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } } } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index f9a10891e9..6d3571c909 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -58,6 +58,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Lighting.AddLight(NPC.Center, 0.03f, 0.2f, 0f); + NPC.rotation = NPC.velocity.X * 0.04f; + Player player = Main.player[NPC.target]; if (!player.active || player.dead) { diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 0d37d654b4..e9acfe7182 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public class PlaguebringerGoliath : ModNPC { // Use for all projectiles and spawned enemies. - public static Color BackglowColor => new Color(255, 100, 24, 80) * 0.6f; + public static Color BackglowColor => new Color(255, 100, 24, 80); private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private const float MissileAngleSpread = 60; @@ -1265,22 +1265,23 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Rectangle rectangle = new Rectangle(NPC.frame.X, NPC.frame.Y, texture.Width / 2, texture.Height / frameCount); Vector2 halfSizeTexture = rectangle.Size() / 2f; Vector2 posOffset = new Vector2(charging ? 175 : 125, 0); - int afterimageAmt = 10; - if (NPC.ai[0] != 0f && NPC.ai[0] != 4f) - afterimageAmt = 7; + int chargeAfterimageAmount = 10; if (CalamityConfig.Instance.Afterimages) { - for (int j = 1; j < afterimageAmt; j += 2) + if ((NPC.ai[0] == 0f || NPC.ai[0] == 4f) && charging) { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (afterimageAmt - j) / 15f; - Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; - afterimagePos += halfSizeTexture * NPC.scale + posOffset; - spriteBatch.Draw(texture, afterimagePos, new Rectangle?(rectangle), afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + for (int j = 1; j < chargeAfterimageAmount; j += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.White, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (chargeAfterimageAmount - j) / 15f; + Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(texture, afterimagePos, new Rectangle?(rectangle), afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } } } @@ -1293,15 +1294,18 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (CalamityConfig.Instance.Afterimages) { - for (int k = 1; k < afterimageAmt; k++) + if ((NPC.ai[0] == 0f || NPC.ai[0] == 4f) && charging) { - Color otherAfterimageColor = redLerpColor; - otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); - otherAfterimageColor *= (afterimageAmt - k) / 15f; - Vector2 otherAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - otherAfterimagePos -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; - otherAfterimagePos += halfSizeTexture * NPC.scale + posOffset; - spriteBatch.Draw(glowTexture, otherAfterimagePos, new Rectangle?(rectangle), otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + for (int k = 1; k < chargeAfterimageAmount; k++) + { + Color otherAfterimageColor = redLerpColor; + otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); + otherAfterimageColor *= (chargeAfterimageAmount - k) / 15f; + Vector2 otherAfterimagePos = NPC.oldPos[k] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + otherAfterimagePos -= new Vector2(glowTexture.Width, glowTexture.Height / frameCount) * NPC.scale / 2f; + otherAfterimagePos += halfSizeTexture * NPC.scale + posOffset; + spriteBatch.Draw(glowTexture, otherAfterimagePos, new Rectangle?(rectangle), otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } } } diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 6e520e527b..77ca318ef2 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -574,7 +574,6 @@ namespace CalamityMod.NPCs.SunkenSea // Equipment npcLoot.Add(ModContent.ItemType(), 3); - npcLoot.Add(ModContent.ItemType(), 3); // Trophy npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index f3b693f785..a5a6484c86 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -206,6 +206,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas float distanceFromSCal = Main.getGoodWorld ? 300f : 225f; NPC.position = SCal.Center - MathHelper.ToRadians(RotationalDegreeOffset).ToRotationVector2() * distanceFromSCal - NPC.Size * 0.5f; + NPC.velocity = Vector2.Zero; RotationalDegreeOffset += 0.5f; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index f4d15860fe..d4a518e626 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -897,9 +897,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Movement calculations - npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); - // Go to a random phase after pausing for a bit if (npc.ai[1] >= phaseLimit) { @@ -922,6 +919,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } } + else + npc.SimpleFlyMovement(idealVelocity, stingerAttackAccel); } if (Main.netMode == NetmodeID.Server) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 499d9ae6a8..23947c59d7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -363,7 +363,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && !(npc.ai[1] == 1f && phase3)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && (!(npc.ai[1] == 1f && phase3) || masterMode)) { // Teleport dust for (int m = 0; m < 30; m++) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index f0a62255b7..9a2852dcb5 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -326,7 +326,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (shouldSpinAround) { - npc.localAI[3] = 120f; + npc.localAI[3] = 300f; npc.SyncVanillaLocalAI(); } @@ -346,22 +346,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float accelerationMult = 1f; if (!cannonAlive) { - acceleration += 0.01f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!laserAlive) { - acceleration += 0.01f; - accelerationMult += 0.5f; + acceleration += 0.0125f; + accelerationMult += 0.25f; } if (!viceAlive) - acceleration += 0.01f; + acceleration += 0.0125f; if (!sawAlive) - acceleration += 0.01f; + acceleration += 0.0125f; if (masterMode) acceleration *= accelerationMult; - float topVelocity = acceleration * 90f; + float topVelocity = acceleration * 100f; float deceleration = masterMode ? 0.7f : 0.85f; float headDecelerationUpDist = 0f; @@ -651,7 +651,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning - float spinVelocity = 20f; + float spinVelocity = 30f; if (npc.ai[2] == 2f) { // Play angry noise @@ -756,8 +756,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 21f : death ? 18f : 15f; - float flightAcceleration = bossRush ? 1f : death ? 0.65f : 0.4f; + float flightVelocity = bossRush ? 24f : death ? 21f : 18f; + float flightAcceleration = bossRush ? 1f : death ? 0.8f : 0.6f; if (masterMode) { diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index d453e357ef..9321fc2333 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.4f : 0f; + float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -622,8 +622,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : 52f) : 26f)) { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || finalPhase) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; float retinazerPhase2LaserSpeed = 10f; @@ -648,16 +647,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses retinazerPhase2TargetY *= retinazerPhase2TargetDist; Vector2 laserVelocity = new Vector2(retinazerPhase2TargetX, retinazerPhase2TargetY); - if (canHit) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } + Projectile.NewProjectile(npc.GetSource_FromAI(), eyePosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -728,8 +718,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : 20f) : 10f)) { - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !spazAlive || finalPhase) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; int type = ProjectileID.DeathLaser; @@ -752,16 +741,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses retinazerPhase2RapidFireTargetY *= retinazerPhase2RapidFireTargetDist; Vector2 laserVelocity = new Vector2(retinazerPhase2RapidFireTargetX, retinazerPhase2RapidFireTargetY); - if (canHit) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = 300; - } + Projectile.NewProjectile(npc.GetSource_FromAI(), retinazerPhase2RapidFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 150f, laserVelocity, type, damage, 0f, Main.myPlayer); } } } @@ -769,7 +749,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += spazAlive ? 1f : 1.5f; if (npc.ai[2] >= (masterMode ? 150f : 180f) - (death ? (masterMode ? 60f : 90f) * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f)) { - npc.ai[1] = (!spazAlive || finalPhase) ? 4f : 0f; + npc.ai[1] = finalPhase ? 4f : 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -1009,7 +989,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : masterMode ? 0.4f : 0f; + float enrageScale = bossRush ? 0.5f : masterMode ? 0.3f : 0f; if (Main.IsItDay() || bossRush) { npc.Calamity().CurrentlyEnraged = !bossRush; @@ -1103,7 +1083,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase HP ratios float phase2LifeRatio = oblivionAlive ? 0.5f : masterMode ? 0.85f : 0.7f; - float finalPhaseLifeRatio = masterMode ? 0.4f : 0.25f; + float finalPhaseLifeRatio = masterMode ? 0.3f : 0.15f; // Movement variables float phase1MaxSpeedIncrease = masterMode ? 2.25f : 4.5f; @@ -1576,15 +1556,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phaseGateValue = NPC.IsMechQueenUp ? 900f : 180f - (death ? 60f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] >= phaseGateValue) { - npc.ai[1] = (!retAlive || finalPhase) ? 5f : 1f; + npc.ai[1] = finalPhase ? 5f : 1f; npc.ai[2] = 0f; npc.ai[3] = 0f; npc.netUpdate = true; } // Fire fireballs and flamethrower - bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (canHit || !retAlive || finalPhase) + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { // Play flame sound on timer npc.localAI[2] += 1f; @@ -1642,20 +1621,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } Vector2 flamethrowerVelocity = new Vector2(spazmatismFlamethrowerTargetX, spazmatismFlamethrowerTargetY); - if (canHit) + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + if (masterMode && npc.ai[3] % 30f == 0f) { - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - if (masterMode && npc.ai[3] % 30f == 0f) - { - type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); - } - } - else - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; + type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; + damage = npc.GetProjectileDamage(type); + Projectile.NewProjectile(npc.GetSource_FromAI(), spazmatismFlamethrowerPos + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); } } } diff --git a/Particles/CustomPulse.cs b/Particles/CustomPulse.cs index a3072597f7..415faf1555 100644 --- a/Particles/CustomPulse.cs +++ b/Particles/CustomPulse.cs @@ -18,11 +18,12 @@ namespace CalamityMod.Particles private string NewTexture; private float OriginalScale; private float FinalScale; + private float BaseOpacity; private float opacity; private Vector2 Squish; private Color BaseColor; - public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true) + public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true, float baseOpacity = 1f) { Position = position; Velocity = velocity; @@ -32,6 +33,7 @@ namespace CalamityMod.Particles FinalScale = finalScale; Scale = originalScale; Lifetime = lifeTime; + BaseOpacity = baseOpacity; Squish = squish; Rotation = rotation; UseAltVisual = UseAdditiveBlend; @@ -42,7 +44,7 @@ namespace CalamityMod.Particles float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); - opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) * BaseOpacity; Color = BaseColor * opacity; Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); diff --git a/Particles/CustomSpark.cs b/Particles/CustomSpark.cs new file mode 100644 index 0000000000..6b2b72ef92 --- /dev/null +++ b/Particles/CustomSpark.cs @@ -0,0 +1,92 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class CustomSpark : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public bool GlowCenter = false; + public string NewTexture; + public float ExtraRotation; + public Vector2 Stretch = new Vector2(0.5f, 1.6f); + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public bool AltVisual = true; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public CustomSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color color, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false) + { + Position = relativePosition; + Velocity = velocity; + NewTexture = texture; + ExtraRotation = extraRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + + AltVisual = useAddativeBlend; + GlowCenter = glowCenter; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + } + + public override void Update() + { + if (!FadeIn) + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, Color.Transparent, (float)Math.Pow(LifetimeCompletion, 3D)); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = Stretch * Scale; + Texture2D texture = ModContent.Request(NewTexture).Value; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, col, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (GlowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f), Rotation, texture.Size() * 0.5f, scale * 0.8f, 0, 0f); + } + } +} diff --git a/Particles/GlowSquareParticle.cs b/Particles/GlowSquareParticle.cs new file mode 100644 index 0000000000..971f7f1995 --- /dev/null +++ b/Particles/GlowSquareParticle.cs @@ -0,0 +1,66 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class GlowSquareParticle : Particle + { + public Color InitialColor; + public bool AffectedByGravity; + public float fadeOut = 1; + public bool imporant; + public bool glowCenter; + public float RotationUse; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + public override bool UseAdditiveBlend => true; + + public override string Texture => "CalamityMod/Particles/GlowSquareParticle"; + + public GlowSquareParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, bool GlowCenter = true, float rotation = 0) + { + Position = relativePosition; + Velocity = velocity; + AffectedByGravity = affectedByGravity; + Scale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + glowCenter = GlowCenter; + RotationUse = rotation; + } + public override void Update() + { + //if (RotationUse != 0 && fadeOut == 1) + //Rotation = Main.rand.NextFloat(-100, 100); + fadeOut -= 0.1f; + Scale *= 0.93f; + Color = Color.Lerp(InitialColor, InitialColor * 0.2f, (float)Math.Pow(LifetimeCompletion, 3D)); + Velocity *= 0.95f; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + if (RotationUse != 0) + { + Rotation += RotationUse; + RotationUse *= 0.992f; + } + else + Rotation = Velocity.ToRotation() + MathHelper.PiOver2; + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Vector2 scale = new Vector2(1f, 1f) * Scale; + Texture2D texture = ModContent.Request(Texture).Value; + + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color, Rotation, texture.Size() * 0.5f, scale, 0, 0f); + if (glowCenter) + spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.White * fadeOut * 0.7f, Rotation, texture.Size() * 0.5f, scale * new Vector2(0.9f, 0.9f), 0, 0f); + } + } +} diff --git a/Particles/GlowSquareParticle.png b/Particles/GlowSquareParticle.png new file mode 100644 index 0000000000..308df23843 Binary files /dev/null and b/Particles/GlowSquareParticle.png differ diff --git a/Particles/ThunderBoltVFX.cs b/Particles/ThunderBoltVFX.cs index 83b6461954..46aecc9660 100644 --- a/Particles/ThunderBoltVFX.cs +++ b/Particles/ThunderBoltVFX.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; @@ -12,26 +13,75 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public Vector2 Squish; - public float ShakePower; - public float Opacity; - public Projectile AttachedProjectile; - public float DisplacementFromProjectile; + /// + /// The function that decides to follow a specific . + /// + public Func FollowFunction; - public ThunderBoltVFX(Vector2 position, Color color, float rotation, float scale, Vector2 squish, float opacity = 1f, float shakePower = 20f, Projectile projectileToFollow = null, float displacementFromProjectile = 0f) + /// + /// The opacity of this particle, can only go from 0 to 1.
+ /// Defaults to 1. + ///
+ public float Opacity + { + get => opacity; + set => opacity = Math.Clamp(value, 0f, 1f); + } + private float opacity = 1f; + + /// + /// The amount of shaking this particle will have.
+ /// Will always be positive.
+ /// Defaults to 0. + ///
+ public float ShakePower + { + get => shakePower; + set => shakePower = Math.Abs(value); + } + private float shakePower; + + /// + /// The squish of this particle, how much is streched, widened, distorted, etc.
+ /// For standard purposes, it defaults to . + ///
+ public Vector2 Squish = Vector2.One; + + /// + /// A constructor that spawns a particle that does not move from where it spawns. + /// + public ThunderBoltVFX(Vector2 position, float rotation, float scale, Color color, int lifeTime, float shakePower, float opacity = 1f, Vector2? squish = null) { Position = position; - Velocity = Vector2.Zero; - Color = color; - Scale = scale; - Squish = squish; Rotation = rotation; + Scale = scale; + Color = color; Opacity = opacity; + Lifetime = lifeTime; ShakePower = shakePower; - if (projectileToFollow != null) - AttachedProjectile = projectileToFollow; - DisplacementFromProjectile = displacementFromProjectile; - Lifetime = 30; + if (squish != null) + Squish = (Vector2)squish; + } + + /// + /// A constructor that spawns a particle that follows a specific .
+ /// For simple one-line positions, you can just write in the argument, for example:
+ ///
+ /// () => Projectile.Center + /// For more complicated logic to decide which it should follow,
+ /// you'd just make your own function which returns a and give it as an argument. + ///
+ public ThunderBoltVFX(Func followFunction, float rotation, float scale, Color color, int lifeTime, float shakePower, float opacity = 1f, Vector2? squish = null) + { + FollowFunction = followFunction; + Rotation = rotation; + Scale = scale; + Color = color; + Opacity = opacity; + Lifetime = lifeTime; + ShakePower = shakePower; + if (squish != null) + Squish = (Vector2)squish; } public override void Update() @@ -40,9 +90,7 @@ namespace CalamityMod.Particles float fadeFactor = 1f - 0.05f * MathHelper.Clamp((Time - 10) / 10f, 0f, 1f); Opacity *= fadeFactor; Squish.X *= fadeFactor; - - if (AttachedProjectile != null && AttachedProjectile.active) - Position = AttachedProjectile.Center + Vector2.UnitY * DisplacementFromProjectile; + if (FollowFunction is not null) Position = FollowFunction.Invoke(); } public override void CustomDraw(SpriteBatch spriteBatch) diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 7b0113ff24..01673d9b36 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -200,7 +200,7 @@ namespace CalamityMod.Projectiles.Boss int height = texture.Height / Main.projFrames[Projectile.type]; int drawStart = height * Projectile.frame; Vector2 origin = Projectile.Size / 2; - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/ApolloRocketGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/ApolloRocketGlow").Value, Projectile.Center - Main.screenPosition, new Rectangle(0, drawStart, texture.Width, height), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index 0cf7e9e6ba..5f6e1b731e 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.width = 80; - Projectile.height = 80; + Projectile.width = 32; + Projectile.height = 32; Projectile.hostile = true; Projectile.alpha = 255; Projectile.penetrate = -1; @@ -76,6 +76,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.Kill(); return; } + if (Projectile.localAI[0] % 4 == 0) + Projectile.frameCounter++; Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * Math.PI / timeBeforeVanish) * 10f * projScale; if (Projectile.scale > projScale) @@ -129,43 +131,47 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { if (Projectile.velocity == Vector2.Zero) - { return false; - } - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; - Texture2D texture2 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraStart", AssetRequestMode.ImmediateLoad).Value; - Texture2D texture3 = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEnd", AssetRequestMode.ImmediateLoad).Value; - float auraDrawLength = Projectile.localAI[1]; //length of laser + + Texture2D middleTex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Texture2D endpointTex = ModContent.Request("CalamityMod/ExtraTextures/Lasers/BirbAuraEndpoints", AssetRequestMode.ImmediateLoad).Value; + + // Used to track the animation of the segments + int middleFrame = Projectile.frameCounter % 12; + int endpointFrame = Projectile.frameCounter % 3; + float auraDrawLength = Projectile.localAI[1]; // Length of the laser Color grayColor = new Color(128, 128, 128, 0); - Vector2 vector = Projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle2 = null; - Main.EntitySpriteDraw(texture2, vector, sourceRectangle2, grayColor, Projectile.rotation, texture2.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); - auraDrawLength -= (texture2.Height / 2 + texture3.Height) * Projectile.scale; + + // Draw the bottom endpoint segment + Rectangle? sourceRectangle2 = endpointTex.Frame(1, 3, 0, endpointFrame); + Vector2 endPosition = Projectile.Center - Main.screenPosition - new Vector2(0f, 22f); // Of course it's 22, this stupid fucking accursed number + Main.EntitySpriteDraw(endpointTex, endPosition, sourceRectangle2, grayColor, Projectile.rotation, endpointTex.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + + // Draw the middle segments + auraDrawLength -= (endpointTex.Height / 2 + endpointTex.Height) * Projectile.scale; Vector2 projCenter = Projectile.Center; - projCenter += Projectile.velocity * Projectile.scale * texture2.Height / 2f; - if (auraDrawLength > 0f) + projCenter += Projectile.velocity * Projectile.scale * endpointTex.Height / 2f; + if (auraDrawLength > 0f) // Only draw a middle segment if there's enough height for one { float auraSegment = 0f; - Rectangle drawRectangle = new Rectangle(0, 0, texture.Width, texture.Height); + Rectangle drawRectangle = middleTex.Frame(12, 1, middleFrame, 0); while (auraSegment + 1f < auraDrawLength) { if (auraDrawLength - auraSegment < drawRectangle.Height) { drawRectangle.Height = (int)(auraDrawLength - auraSegment); } - Main.EntitySpriteDraw(texture, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(middleTex, projCenter - Main.screenPosition, new Rectangle?(drawRectangle), grayColor, Projectile.rotation, new Vector2(drawRectangle.Width / 2, 0f), Projectile.scale, SpriteEffects.None, 0); auraSegment += drawRectangle.Height * Projectile.scale; projCenter += Projectile.velocity * drawRectangle.Height * Projectile.scale; - drawRectangle.Y += texture.Height; - if (drawRectangle.Y + drawRectangle.Height > texture.Height) + drawRectangle.Y += middleTex.Height; + if (drawRectangle.Y + drawRectangle.Height > middleTex.Height) { drawRectangle.Y = 0; } } } - Vector2 vector2 = projCenter - Main.screenPosition; - sourceRectangle2 = null; - Main.EntitySpriteDraw(texture3, vector2, sourceRectangle2, grayColor, Projectile.rotation, texture3.Frame(1, 1, 0, 0).Top(), Projectile.scale, SpriteEffects.None, 0); + // There is intentionally no top endpoint segment drawn return false; } diff --git a/Projectiles/Boss/BirbAura.png b/Projectiles/Boss/BirbAura.png index 3515f6998c..0b6f0a7026 100644 Binary files a/Projectiles/Boss/BirbAura.png and b/Projectiles/Boss/BirbAura.png differ diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index d34e761d03..2056239802 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -38,9 +38,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Cal Clone bullet hell projectiles accelerate after a certain time has passed - if (Projectile.ai[0] == 2f && Main.expertMode && Projectile.timeLeft < 1260) + if (Projectile.ai[0] == 2f && (Main.expertMode || BossRushEvent.BossRushActive) && Projectile.timeLeft < 1260) { - if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 15f : 10f)) + if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 12.5f : 10f)) Projectile.velocity *= 1.005f; } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 2b4199bdcb..202b85a3e9 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -3,6 +3,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs.PlaguebringerGoliath; using CalamityMod.World; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -13,6 +14,7 @@ namespace CalamityMod.Projectiles.Boss public class HiveBombGoliath : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetStaticDefaults() { Main.projFrames[Projectile.type] = 4; @@ -84,14 +86,20 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Projectile.DrawProjectileWithBackglow(PlaguebringerGoliath.BackglowColor, lightColor, 4f); + Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); - return false; - } - public override Color? GetAlpha(Color lightColor) - { - return new Color(50, 250, 50, Projectile.alpha); + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/HiveBombGoliathGlow").Value; + Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 drawArea = Projectile.Center - Main.screenPosition; + drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawArea += textureArea + new Vector2(0f, Projectile.gfxOffY); + Color whiteColor = Color.White; + int height = glow.Height / Main.projFrames[Projectile.type]; + int drawStart = height * Projectile.frame; + Main.spriteBatch.Draw(glow, drawArea, new Rectangle(0, drawStart, glow.Width, height), whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); + + return false; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/HiveBombGoliathGlow.png b/Projectiles/Boss/HiveBombGoliathGlow.png new file mode 100644 index 0000000000..13874fb07b Binary files /dev/null and b/Projectiles/Boss/HiveBombGoliathGlow.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index c2b3dffdb8..fc59234722 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -4,17 +4,20 @@ using CalamityMod.NPCs.PlaguebringerGoliath; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; +using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class PlagueStingerGoliath : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; + public override void SetDefaults() { Projectile.width = 10; Projectile.height = 10; - Projectile.scale = 1.5f; Projectile.hostile = true; Projectile.penetrate = -1; Projectile.tileCollide = false; @@ -55,20 +58,20 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Projectile.DrawProjectileWithBackglow(PlaguebringerGoliath.BackglowColor, lightColor, 4f); + Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } public override void PostDraw(Color lightColor) { - Vector2 center = new Vector2(Projectile.Center.X, Projectile.Center.Y); - Vector2 textureArea = new Vector2(Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Width / 2, Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / 2); - Vector2 drawArea = center - Main.screenPosition; - drawArea -= new Vector2(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Width, ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value.Height) * 1f / 2f; - drawArea += textureArea * 1f + new Vector2(0f, 4f + Projectile.gfxOffY); + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; + Vector2 textureArea = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); + Vector2 drawArea = Projectile.Center - Main.screenPosition; + drawArea -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawArea += textureArea + new Vector2(0f, Projectile.gfxOffY); Color whiteColor = Color.White; - Main.spriteBatch.Draw(ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value, drawArea, - null, whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(glow, drawArea, null, whiteColor, Projectile.rotation, textureArea, Projectile.scale, SpriteEffects.None, 0); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 822a848f4f..a7615548da 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 10; Projectile.height = 10; - Projectile.scale = 1.5f; Projectile.hostile = true; Projectile.penetrate = -1; Projectile.extraUpdates = 2; @@ -45,7 +44,8 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { - Projectile.DrawProjectileWithBackglow(PlaguebringerGoliath.BackglowColor, lightColor, 4f); + Projectile.DrawBackglow(PlaguebringerGoliath.BackglowColor, 4f); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor); return false; } @@ -54,10 +54,10 @@ namespace CalamityMod.Projectiles.Boss Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Value; Vector2 origin = new Vector2(glow.Width / 2, glow.Height / Main.projFrames[Projectile.type] / 2); Vector2 drawPos = Projectile.Center - Main.screenPosition; - drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) * 1f / 2f; - drawPos += origin * 1f + new Vector2(0f, 0f + 4f + Projectile.gfxOffY); - Color color = new Color(127 - Projectile.alpha, 127 - Projectile.alpha, 127 - Projectile.alpha, 0).MultiplyRGBA(Color.Red); - Main.spriteBatch.Draw(glow, drawPos, null, color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + drawPos -= new Vector2(glow.Width, glow.Height / Main.projFrames[Projectile.type]) / 2f; + drawPos += origin + new Vector2(0f, Projectile.gfxOffY); + Color whiteColor = Color.White; + Main.spriteBatch.Draw(glow, drawPos, null, whiteColor, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } public override void OnKill(int timeLeft) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index b0f5b94fb5..083e4dcb55 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.Buffs; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; @@ -2670,7 +2671,7 @@ namespace CalamityMod.Projectiles { int totalProjectiles = masterMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); + int type = ProjectileType(); float velocity = 1f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) @@ -3639,7 +3640,7 @@ namespace CalamityMod.Projectiles if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) { - if (modPlayer.fungalSymbiote && CalamityLists.MushroomProjectileIDs.Contains(projectile.type)) + if (modPlayer.fungalSymbiote && player.HasBuff(BuffType())) { if (Main.player[projectile.owner].miscCounter % 6 == 0 && projectile.FinalExtraUpdate()) { @@ -3810,7 +3811,7 @@ namespace CalamityMod.Projectiles } break; case CalamityGlobalBuff.ModdedFlaskEnchant: - int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : ModContent.DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); + int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); if (Main.rand.NextBool(4)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); @@ -3830,7 +3831,7 @@ namespace CalamityMod.Projectiles { if ((player.Calamity().flaskBrimstone || player.Calamity().flaskCrumbling || player.Calamity().flaskHoly) && !projectile.noEnchantments && !projectile.noEnchantmentVisuals) { - int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : ModContent.DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); + int dustType = player.Calamity().flaskHoly ? (Main.rand.NextBool() ? 87 : (int)CalamityDusts.ProfanedFire) : player.Calamity().flaskBrimstone ? (Main.rand.NextBool() ? 114 : DustType()) : (Main.rand.NextBool() ? 121 : DustID.Stone); if (Main.rand.NextBool(player.Calamity().flaskCrumbling ? 5 : 4)) { Dust dust = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, dustType, 0f, 0f, 100, default, Main.rand.NextFloat(0.6f, 0.9f)); @@ -3897,7 +3898,7 @@ namespace CalamityMod.Projectiles PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f, Color.Crimson * 0.7f); GeneralParticleHandler.SpawnParticle(spark); - Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : ModContent.DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); + Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : DustType(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f)); dust.noGravity = true; dust.scale = Main.rand.NextFloat(0.5f, 1f); } @@ -4805,7 +4806,7 @@ namespace CalamityMod.Projectiles int beeType = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); if (Main.zenithWorld) { - beeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); + beeType = Main.rand.NextBool(3) ? NPCType() : NPCType(); } else if (Main.masterMode || BossRushEvent.BossRushActive) { diff --git a/Projectiles/Magic/AuraRain.cs b/Projectiles/Magic/AuraRain.cs deleted file mode 100644 index 3abea1c3f3..0000000000 --- a/Projectiles/Magic/AuraRain.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class AuraRain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.aiStyle = ProjAIStyleID.RainCloud; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = true; - Projectile.timeLeft = 300; - Projectile.alpha = 255; - Projectile.scale = 1.1f; - Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 1; - AIType = ProjectileID.RainFriendly; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; - Dust dust = Main.dust[Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Demonite, Projectile.velocity.X, Projectile.velocity.Y, 100, default, 1f)]; - dust.velocity = Vector2.Zero; - dust.position -= Projectile.velocity / 5f; - dust.noGravity = true; - dust.scale = 0.8f; - dust.noLight = true; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[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; - } - } -} diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs index 098ba4593b..bbd4f3a18e 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneBarrage.cs @@ -35,13 +35,15 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + // Play a sound upon spawning if (Projectile.ai[0] == 0f) { SoundEngine.PlaySound(BrimstoneElemental.DartSound, Projectile.Center); Projectile.ai[0] = 1f; } - if (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < (Projectile.ai[1] == 1f ? 12f : 16f)) + // Accelerate over time + if ((Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) < 16f) && Projectile.ai[1] != 1f) { Projectile.velocity *= 1.01f; } @@ -57,6 +59,30 @@ namespace CalamityMod.Projectiles.Magic Projectile.frame = 0; } Lighting.AddLight(Projectile.Center, 0.75f, 0f, 0f); + + // Seething Discharge darts have weak homing capabilities + if (Projectile.ai[1] == 1f && Projectile.timeLeft < 585) + { + float npcDistCompare = 480f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + if (index != -1) + { + float homingStrength = Main.rand.NextFloat(0.075f, 0.085f); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.npc[index].Center).ToRotation(), homingStrength).ToRotationVector2() * 12f; + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); diff --git a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs index f43a8400cc..2535e7ee60 100644 --- a/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs +++ b/Projectiles/Magic/SeethingDischargeBrimstoneHellblast.cs @@ -30,11 +30,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = false; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.timeLeft = 255; Projectile.alpha = 0; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 20; } public override void AI() diff --git a/Projectiles/Magic/ShadeNimbus.cs b/Projectiles/Magic/ShadeNimbus.cs deleted file mode 100644 index 9bf3b72a10..0000000000 --- a/Projectiles/Magic/ShadeNimbus.cs +++ /dev/null @@ -1,92 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class ShadeNimbus : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; - - public override void SetStaticDefaults() - { - Main.projFrames[Projectile.type] = 6; - } - - public override void SetDefaults() - { - Projectile.width = 54; - Projectile.height = 24; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 8) - { - Projectile.frameCounter = 0; - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Projectile.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(); - } - } - else - { - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 8f) - { - Projectile.ai[0] = 0f; - if (Projectile.owner == Main.myPlayer) - { - int rainX = (int)(Projectile.position.X + 14f + (float)Main.rand.Next(Projectile.width - 28)); - int rainY = (int)(Projectile.position.Y + (float)Projectile.height + 4f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), (float)rainX, (float)rainY, 0f, 5f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); - } - } - } - Projectile.localAI[0] += 1f; - if (Projectile.localAI[0] >= 10f) - { - Projectile.localAI[0] = 0f; - int projCount = 0; - int oldestCloud = 0; - float cloudAge = 0f; - int projType = Projectile.type; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[1] < 3600f) - { - projCount++; - if (proj.ai[1] > cloudAge) - { - oldestCloud = projIndex; - cloudAge = proj.ai[1]; - } - } - } - if (projCount > 2) - { - Main.projectile[oldestCloud].netUpdate = true; - Main.projectile[oldestCloud].ai[1] = 36000f; - return; - } - } - } - } -} diff --git a/Projectiles/Magic/Shaderain.cs b/Projectiles/Magic/Shaderain.cs index da5645ebb2..b4dc9c2450 100644 --- a/Projectiles/Magic/Shaderain.cs +++ b/Projectiles/Magic/Shaderain.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Projectiles.Magic public class Shaderain : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/Magic/AuraRain"; public override void SetDefaults() { diff --git a/Projectiles/Magic/AuraRain.png b/Projectiles/Magic/Shaderain.png similarity index 100% rename from Projectiles/Magic/AuraRain.png rename to Projectiles/Magic/Shaderain.png diff --git a/Projectiles/Magic/Teslabeam.cs b/Projectiles/Magic/Teslabeam.cs index ba7bb2f167..bc5f59087b 100644 --- a/Projectiles/Magic/Teslabeam.cs +++ b/Projectiles/Magic/Teslabeam.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic public override void SendExtraAI(BinaryWriter writer) { writer.Write(damageMultiplier); - writer.Write(damageShouldDecay); writer.Write(decayGracePeriod); + writer.Write(damageShouldDecay); } public override void ReceiveExtraAI(BinaryReader reader) diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.cs b/Projectiles/Melee/BalefulHarvesterProjectile.cs index 8855fed60a..f2e5c9157d 100644 --- a/Projectiles/Melee/BalefulHarvesterProjectile.cs +++ b/Projectiles/Melee/BalefulHarvesterProjectile.cs @@ -14,13 +14,11 @@ namespace CalamityMod.Projectiles.Melee { ProjectileID.Sets.TrailCacheLength[Projectile.type] = 5; ProjectileID.Sets.TrailingMode[Projectile.type] = 0; - Main.projFrames[Projectile.type] = 5; } public override void SetDefaults() { - Projectile.width = 46; - Projectile.height = 36; + Projectile.width = Projectile.height = 24; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; @@ -46,15 +44,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.alpha = 0; } - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 4) - Projectile.frame = 0; - if (Projectile.ai[0] >= 0f && Projectile.ai[0] < 200f) { int npcTracker = (int)Projectile.ai[0]; diff --git a/Projectiles/Melee/BalefulHarvesterProjectile.png b/Projectiles/Melee/BalefulHarvesterProjectile.png index da20d1059b..ed73d2a5f7 100644 Binary files a/Projectiles/Melee/BalefulHarvesterProjectile.png and b/Projectiles/Melee/BalefulHarvesterProjectile.png differ diff --git a/Projectiles/Melee/BladecrestOathswordProj.cs b/Projectiles/Melee/BladecrestOathswordProj.cs index a7d2d28243..b962bf36c3 100644 --- a/Projectiles/Melee/BladecrestOathswordProj.cs +++ b/Projectiles/Melee/BladecrestOathswordProj.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class BladecrestOathswordProj : BaseIdleHoldoutProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public enum SwingState + public enum SwingState : byte { Default, Swinging @@ -57,14 +57,14 @@ namespace CalamityMod.Projectiles.Melee { writer.Write(Direction); writer.Write(PostSwingRepositionDelay); - writer.Write((int)CurrentState); + writer.Write((byte)CurrentState); } public override void ReceiveExtraAI(BinaryReader reader) { Direction = reader.ReadInt32(); PostSwingRepositionDelay = reader.ReadSingle(); - CurrentState = (SwingState)reader.ReadInt32(); + CurrentState = (SwingState)reader.ReadByte(); } public override void SafeAI() diff --git a/Projectiles/Melee/CosmicIceBurst.cs b/Projectiles/Melee/CosmicIceBurst.cs index 56788a64b3..48d9db3e83 100644 --- a/Projectiles/Melee/CosmicIceBurst.cs +++ b/Projectiles/Melee/CosmicIceBurst.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[1] += 0.01f; Projectile.scale = Projectile.ai[1]; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (float)(3 * Main.projFrames[Projectile.type])) + if (Projectile.ai[0] >= (3 * Main.projFrames[Projectile.type])) { Projectile.Kill(); return; @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { Vector2 mountedCenter = Main.player[Projectile.owner].MountedCenter; - Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5f) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5f) / 16)); if (Projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[Projectile.type]) { colorArea = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f)); @@ -115,16 +115,18 @@ namespace CalamityMod.Projectiles.Melee return new Color(150, Main.DiscoG, 255, 127); }*/ + // Only inflict Nightwither if not spawned from Icebreaker public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.ai[2] != 1f) + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(BuffID.Frostburn, 180); - target.AddBuff(ModContent.BuffType(), 420); + if (Projectile.ai[2] != 1f) + target.AddBuff(ModContent.BuffType(), 420); Projectile.direction = Main.player[Projectile.owner].direction; } } diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index f7a99cea55..394182dcc3 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,17 +1,13 @@ using System; -using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -23,7 +19,7 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; - public override float HitboxOutset => 105; + public override float HitboxOutset => 135; public override Vector2 HitboxSize => new Vector2(255, 255); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index 01ce362432..146d323354 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -24,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandDad"; public override float HitboxOutset => 125; - public override Vector2 HitboxSize => new Vector2(170, 170); + public override Vector2 HitboxSize => new Vector2(190, 190); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(0, 124); @@ -127,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee if (time == (int)(timeMax * 0.4f)) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); - SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.3f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.32f) }, Projectile.Center); } if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) { @@ -136,7 +137,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 165), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); GeneralParticleHandler.SpawnParticle(new LineParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue)); GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * 2, Main.rand.NextBool(4) ? Color.Black : Color.DarkBlue, 23, Main.rand.NextFloat(0.5f, 1f), 0.65f)); } @@ -154,9 +155,21 @@ namespace CalamityMod.Projectiles.Melee if (CanHit) { - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { - GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 19, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.Gold : Color.Goldenrod)); + if (Main.rand.NextBool(4)) + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Color.Black, false, false, false)); + else + GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, false, 23, Main.rand.NextFloat(0.5f, 1f), Main.rand.NextBool(4) ? Color.DodgerBlue : Color.Blue)); + } + for (int i = 0; i < 3; i++) + { + float randRot = Main.rand.NextFloat(-30, -60); + Vector2 dustVel = (new Vector2(0, 15 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(185, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel * Main.rand.NextFloat(0.1f, 0.5f)); + dust2.scale = Main.rand.NextFloat(0.45f, 0.95f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool(3) ? Color.Goldenrod : Color.Gold; } } } @@ -252,9 +265,9 @@ namespace CalamityMod.Projectiles.Melee float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { - Color auraColor = Color.Lerp(Color.DarkGoldenrod, Color.Gold, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; + Color auraColor = Color.Lerp(Color.Goldenrod, Color.Gold, Utils.GetLerpValue(0, 5, i)) * 0.5f * fadeIn; Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/GrandDadGhost").Value; Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); rotationalDrawOffset *= MathHelper.Lerp(3f, 5.25f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index c847f5e1cd..08b75853bb 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; public override float HitboxOutset => 105; - public override Vector2 HitboxSize => new Vector2(150, 150); + public override Vector2 HitboxSize => new Vector2(175, 175); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(0, 124); @@ -159,10 +159,10 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Cyan : Color.DarkOrchid; diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 2059bbeb3b..01666d03fd 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -1,11 +1,7 @@ using System; -using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; -using Humanizer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -13,8 +9,6 @@ using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.Graphics.Renderers; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -47,7 +41,7 @@ namespace CalamityMod.Projectiles.Melee public bool chargedSwing = false; // True if you have a charged swing fully charged public int chargeTimer = 0; // Timer for charging the blade with right click - public int chargeTimerMax = 240; + public int chargeTimerMax = 240; // This is set to be base don use time on spawn public SlotId AudSlot; public override void SetDefaults() @@ -67,7 +61,8 @@ namespace CalamityMod.Projectiles.Melee aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; useAnim = Owner.itemAnimationMax; storedUseAnim = useAnim; - chargeTimerMax = useAnim * 5; + + chargeTimerMax = useAnim * 5; // Max charge time is set here if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -401,7 +396,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.25f; int hitsToMinMult = 4; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? 3.5f * (GFBMulti) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? 4f * (GFBMulti) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index 6198ed202c..31ca65eac1 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -1,17 +1,13 @@ using System; -using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.PrimordialWyrm; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; -using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -128,7 +124,7 @@ namespace CalamityMod.Projectiles.Melee if (time == (int)(timeMax * 0.4f)) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); - SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = 0.55f }, Projectile.Center); + SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.35f, 0.55f) }, Projectile.Center); } if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) { @@ -153,7 +149,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 2; i++) { - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(170, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(150, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); dust2.scale = Main.rand.NextFloat(0.55f, 0.85f); dust2.noGravity = true; dust2.color = Main.rand.NextBool() ? Color.Silver : Color.Gold; diff --git a/Projectiles/Melee/OldLordClaymoreProj.cs b/Projectiles/Melee/OldLordClaymoreProj.cs index e28a4fe8d1..2ad7609cef 100644 --- a/Projectiles/Melee/OldLordClaymoreProj.cs +++ b/Projectiles/Melee/OldLordClaymoreProj.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee public class OldLordClaymoreProj : BaseIdleHoldoutProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public enum SwingState + public enum SwingState : byte { Default, Swinging, @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee writer.Write(Direction); writer.Write(PostSwingRepositionDelay); writer.Write(ChargePower); - writer.Write((int)CurrentState); + writer.Write((byte)CurrentState); } public override void ReceiveExtraAI(BinaryReader reader) @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Melee Direction = reader.ReadInt32(); PostSwingRepositionDelay = reader.ReadSingle(); ChargePower = reader.ReadSingle(); - CurrentState = (SwingState)reader.ReadInt32(); + CurrentState = (SwingState)reader.ReadByte(); } public override void SafeAI() diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 50e65632aa..b7510385cf 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -160,7 +160,13 @@ namespace CalamityMod.Projectiles.Melee //Chunger var Sound = SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Volume = CommonCalamitySounds.LightningSound.Volume * 0.4f }, Projectile.Center); - Particle thunder = new ThunderBoltVFX(Projectile.Center + Vector2.UnitY * 20f, Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, 0f, 1.5f, Vector2.One, 1f, 15f, Projectile, 20f); + Particle thunder = new ThunderBoltVFX( + () => Projectile.Center + Vector2.UnitY * 20f, + 0f, + 1.5f, + Main.rand.NextBool() ? Main.rand.NextBool() ? Color.Goldenrod : Color.GreenYellow : Main.rand.NextBool() ? Color.Cyan : Color.Magenta, + 30, + 15f); GeneralParticleHandler.SpawnParticle(thunder); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) diff --git a/Projectiles/Ranged/ChickenExplosion.cs b/Projectiles/Ranged/ChickenExplosion.cs index 0db0ed946a..bfbffc0be1 100644 --- a/Projectiles/Ranged/ChickenExplosion.cs +++ b/Projectiles/Ranged/ChickenExplosion.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Ranged if (Main.dedServ) return; - for (int i = 0; i < 70; i++) + for (int i = 0; i < 50; i++) { // The exponent being greater than 1 gives the randomness a bias towards 0. This means that more dust will spawn // closer to the center than the edge. diff --git a/Projectiles/Ranged/ChickenRocket.cs b/Projectiles/Ranged/ChickenRocket.cs index 60ac94fae2..dcf3ba3218 100644 --- a/Projectiles/Ranged/ChickenRocket.cs +++ b/Projectiles/Ranged/ChickenRocket.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; // Slight gravity, equivalent to Plasma Grenade. - Projectile.velocity.Y += 0.09f; + Projectile.velocity.Y += 0.075f; } // Instead of dying instantly on collision, fly straight up for a moment. @@ -85,33 +85,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnKill(int timeLeft) { - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 1040; - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); if (Projectile.owner == Main.myPlayer) - { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - } + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - for (int i = 0; i < 40; i++) - { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 2f); - Main.dust[d].velocity *= 3f; - if (Main.rand.NextBool()) - { - Main.dust[d].scale = 0.5f; - Main.dust[d].fadeIn = 1f + Main.rand.NextFloat(); - } - } - for (int i = 0; i < 70; i++) - { - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 3f); - Main.dust[d].noGravity = true; - Main.dust[d].velocity *= 5f; - d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 2f); - Main.dust[d].velocity *= 2f; - } } } } diff --git a/Projectiles/Ranged/PolarStar.cs b/Projectiles/Ranged/PolarStar.cs index b870ab4aff..fd0109446f 100644 --- a/Projectiles/Ranged/PolarStar.cs +++ b/Projectiles/Ranged/PolarStar.cs @@ -1,21 +1,8 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Dusts; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Dusts; using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; using Terraria.ModLoader; -using static CalamityMod.Items.Weapons.Ranged.PolarisParrotfish; -using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Ranged { @@ -42,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.penetrate = -1; // Only hits once, "pierces" so that it can last a bit after hitting Projectile.extraUpdates = 2; - Projectile.timeLeft = 50; + Projectile.timeLeft = 40; Projectile.DamageType = DamageClass.Ranged; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; diff --git a/Projectiles/Ranged/PumplerHoldout.cs b/Projectiles/Ranged/PumplerHoldout.cs index 93522b1934..6dea938198 100644 --- a/Projectiles/Ranged/PumplerHoldout.cs +++ b/Projectiles/Ranged/PumplerHoldout.cs @@ -1,4 +1,5 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -28,8 +29,13 @@ namespace CalamityMod.Projectiles.Ranged private ref float CurrentChargingFrames => ref Projectile.ai[0]; private ref float PumpkinsCharge => ref Projectile.ai[1]; + private ref float FramesToLoadNextPumpkin => ref Projectile.localAI[0]; + + //This possibly could moved to ai[2] ¯\_(ツ)_/¯ private ref float Overfilled => ref Projectile.localAI[1]; //This functionally is a "IsPlayingShootAnim" variable + + private bool IsOverfilled => (Overfilled >= 0.5f); private float angularSpread = MathHelper.ToRadians(15); public override void SetDefaults() @@ -49,10 +55,10 @@ namespace CalamityMod.Projectiles.Ranged Vector2 tipPosition = armPosition + Projectile.velocity * Projectile.width * 0.5f; // Unloads all pumpkins if you can't shoot/stop holding out the projectile or if the gun is overfilled - if (Owner.CantUseHoldout() || Overfilled == 1f) + if (Owner.CantUseHoldout() || IsOverfilled) { - if (PumpkinsCharge <= 0f && Overfilled == 0f) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it + if (PumpkinsCharge <= 0f && !IsOverfilled) //If the projectile isnt playing its animation and if there arent any pumpkins loaded, kill it { Projectile.Kill(); return; @@ -68,7 +74,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.frameCounter = 0; } // Shoot anim is done? Remove the shoot anim tag - if (Projectile.frame == 0 && Overfilled == 1f) + if (Projectile.frame == 0 && IsOverfilled) Overfilled = 0f; //Animation stuff end @@ -145,7 +151,7 @@ namespace CalamityMod.Projectiles.Ranged SmokeBurst(tipPosition); FramesToLoadNextPumpkin = Owner.ActiveItem().useAnimation; //reset the reload time PumpkinsCharge = 0; //Unload the barrel - if (!(Overfilled == 1f)) + if (!IsOverfilled) Overfilled = 1f; //Make the shoot anim play Projectile.frame = 6; //Initialize the animation } @@ -213,7 +219,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { Main.spriteBatch.EnterShaderRegion(); - if (PumpkinsCharge > 0 && Overfilled == 0f) + if (PumpkinsCharge > 0 && !IsOverfilled) { GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(MathHelper.Clamp(1f - 0.20f * CurrentChargingFrames - 0.1f * (5f - PumpkinsCharge), 0f, 1f)); //tint effect is visible if its charging. The more pumpkins are loaded, the more opacity @@ -240,12 +246,12 @@ namespace CalamityMod.Projectiles.Ranged //netcode hell public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Overfilled); + writer.Write(IsOverfilled); } public override void ReceiveExtraAI(BinaryReader reader) { - Overfilled = reader.ReadInt32(); + Overfilled = reader.ReadBoolean() ? 1.0f : 0.0f; } } } diff --git a/Projectiles/Rogue/DestructionExplosion.cs b/Projectiles/Rogue/DestructionExplosion.cs index 6cff80c9fe..d20d58abca 100644 --- a/Projectiles/Rogue/DestructionExplosion.cs +++ b/Projectiles/Rogue/DestructionExplosion.cs @@ -1,12 +1,8 @@ -using System; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee +namespace CalamityMod.Projectiles.Rogue { public class DestructionExplosion : ModProjectile, ILocalizedModType { diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 3e033f6ed7..308432534e 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -1,16 +1,11 @@ using System; using CalamityMod.Particles; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Graphics.PackedVector; using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; -using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.Projectiles.Rogue { diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 4ae1e85156..d040baf46a 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -28,6 +28,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = 600; AIType = ProjectileID.WoodenBoomerang; Projectile.coldDamage = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() @@ -55,7 +57,7 @@ namespace CalamityMod.Projectiles.Rogue { if (explosionCount < 3) //max amount of explosions to prevent worm memes { - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; explosionCount++; @@ -85,7 +87,7 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Calamity().stealthStrike) { //no explosion count cap in pvp - int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f); + int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index 42621db550..d63bb9830f 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = 1; Projectile.tileCollide = true; Projectile.ignoreWater = true; - Projectile.timeLeft = 50; + Projectile.timeLeft = 25; Projectile.DamageType = RogueDamageClass.Instance; } diff --git a/Projectiles/Summon/GlacialEmbracePointyThing.cs b/Projectiles/Summon/GlacialEmbracePointyThing.cs index a06cefa7f5..a1535c1d7b 100644 --- a/Projectiles/Summon/GlacialEmbracePointyThing.cs +++ b/Projectiles/Summon/GlacialEmbracePointyThing.cs @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon writer.Write(recharging); writer.Write(circling); writer.Write(circlingPlayer); - writer.Write((double)floatyDistance); + writer.Write(floatyDistance); writer.Write(target is null ? -1 : target.whoAmI); } public override void ReceiveExtraAI(BinaryReader reader) @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Summon recharging = reader.ReadInt32(); circling = reader.ReadBoolean(); circlingPlayer = reader.ReadBoolean(); - floatyDistance = (float)reader.ReadDouble(); + floatyDistance = reader.ReadSingle(); int targ = reader.ReadInt32(); target = targ == -1 ? null : Main.npc[targ]; } diff --git a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs index 2ac39278e4..a504571104 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/Paradoxica.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions public override void ReceiveExtraAI(BinaryReader reader) { hasTeleported = reader.ReadBoolean(); - ChargeStartingPosition = reader.ReadPackedVector2(); + ChargeStartingPosition = reader.ReadVector2(); } public override void AI() diff --git a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs index 8518677727..bf709d1a85 100644 --- a/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs +++ b/Projectiles/Summon/SmallAresArms/ExoskeletonCannon.cs @@ -83,6 +83,10 @@ namespace CalamityMod.Projectiles.Summon.SmallAresArms { Projectile.rotation = reader.ReadSingle(); + //limb count has passed from SendExtraAI + //therefore we should read this for packet aligns sake + _ = reader.ReadInt32(); + int limbCount = Limbs.Limbs.Length; for (int i = 0; i < limbCount; i++) { diff --git a/Projectiles/Typeless/AscendantAura.cs b/Projectiles/Typeless/AscendantAura.cs index 6e5b32dcc9..311dfd0c3d 100644 --- a/Projectiles/Typeless/AscendantAura.cs +++ b/Projectiles/Typeless/AscendantAura.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -69,6 +70,7 @@ namespace CalamityMod.Projectiles.Typeless int lifetime = Main.rand.Next(3, 6); float scale = Main.rand.NextFloat(0.5f, 0.9f); Color color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; + /* SparkParticle spark1 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(7, 12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); GeneralParticleHandler.SpawnParticle(spark1); SparkParticle spark2 = new SparkParticle(spawnPos, new Vector2(Main.rand.NextFloat(-7, -12), Main.rand.NextFloat(7, 12)), false, lifetime, scale, color); @@ -81,6 +83,7 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(spark5); SparkParticle spark6 = new SparkParticle(Projectile.Center + new Vector2(-20, 0), new Vector2(Main.rand.NextFloat(-7, -12), 0), false, lifetime, scale - 0.3f, color); GeneralParticleHandler.SpawnParticle(spark6); + */ // Emit some light Vector3 Light = new Vector3(0.251f, 0.255f, 0.219f); @@ -94,14 +97,42 @@ namespace CalamityMod.Projectiles.Typeless { float rot = MathHelper.ToRadians(i * rotFactor); Vector2 offset = new Vector2(8f, 0).RotatedBy(rot); - Vector2 velOffset = new Vector2(2.5f, 0).RotatedBy(rot); - Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 204, new Vector2(velOffset.X, velOffset.Y)); + Vector2 velOffset = new Vector2(10.5f, 0).RotatedBy(rot); + Dust dust = Dust.NewDustPerfect(Projectile.Center + offset, 278, new Vector2(velOffset.X, velOffset.Y)); dust.noGravity = true; - dust.velocity = velOffset * Main.rand.NextFloat(0.9f, 1.1f); - dust.scale = 2.5f; + dust.velocity = velOffset * Main.rand.NextFloat(0.2f, 1.1f); + dust.scale = Main.rand.NextFloat(0.3f, 0.8f); + dust.color = Main.rand.NextBool(3) ? Color.LightGreen : Color.Khaki; } + + SoundStyle s = new("CalamityMod/Sounds/Item/AscendantActivate"); + SoundEngine.PlaySound(s with { Volume = 0.3f, Pitch = -0.9f }, Projectile.Center); } + public override bool PreDraw(ref Color lightColor) + { + Texture2D rTexture = ModContent.Request("CalamityMod/Projectiles/Typeless/AscendantAura").Value; + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/GlowSpark").Value; + Color drawColor = Color.Lerp(Color.Khaki, Color.LightGreen, Utils.GetLerpValue(240, -100, Projectile.timeLeft, true)); + + Vector2 bScale = new Vector2(Main.rand.NextFloat(0.15f, 0.2f), 0.5f) * Projectile.scale * 0.04f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true) * Main.rand.NextFloat(0.7f, 1.3f); + + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(-30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(90f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(-90f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(0, -30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true)) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0, bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + new Vector2(0, 30 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true)) * Main.rand.NextFloat(0.6f, 1.3f), null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), MathHelper.ToRadians(180f), bTexture.Size() * 0.5f, bScale, SpriteEffects.None, 0); + + for (int i = 0; i < 4; i++) + { + Vector2 bScale2 = new Vector2(0.1f, 0.8f) * Projectile.scale * 0.04f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true) * Main.rand.NextFloat(0.7f, 1.3f); + Vector2 bVel = new Vector2(20 * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), 0).RotatedBy(MathHelper.ToRadians(45f + (i * 90))) * Main.rand.NextFloat(0.6f, 1.3f); + Main.EntitySpriteDraw(bTexture, Projectile.Center - Main.screenPosition + bVel, null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), bVel.ToRotation() + MathHelper.ToRadians(90f), bTexture.Size() * 0.5f, bScale2, SpriteEffects.None, 0); + } + + Main.EntitySpriteDraw(rTexture, Projectile.Center - Main.screenPosition, null, drawColor with { A = 0 } * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), Projectile.rotation, rTexture.Size() * 0.5f, Projectile.scale * 0.4f * Utils.GetLerpValue(0, 20, Projectile.timeLeft, true), SpriteEffects.None, 0); + return false; + } public override bool? CanDamage() => false; } } diff --git a/Projectiles/Typeless/AscendantAura.png b/Projectiles/Typeless/AscendantAura.png index fb2bd6cc34..e48fd57ef6 100644 Binary files a/Projectiles/Typeless/AscendantAura.png and b/Projectiles/Typeless/AscendantAura.png differ diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 61bf31726a..9ef3c27837 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -86,42 +86,13 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - // Don't draw the aura at all if visibility is toggled off - if (!Main.player[Projectile.owner].Calamity().blunderBoosterVisibility) - return false; - Texture2D sprite = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; Color drawColour = Color.White; Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); - float opacity = 1f; - int sparkCount = 0; - int fadeTime = 20; - - if (Projectile.timeLeft < fadeTime) - { - opacity = Projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - Projectile.timeLeft; - } - - for (int i = 0; i < sparkCount * 2; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - float rangeDiff = 2f; - - Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustPos.Normalize(); - dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - - int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } + float opacity = Main.player[Projectile.owner].Calamity().blunderBoosterVisibility ? 1f : 0.25f; Main.EntitySpriteDraw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); return false; diff --git a/Projectiles/Typeless/GenericElectricSpark.cs b/Projectiles/Typeless/GenericElectricSpark.cs index 607550060d..869b6548cb 100644 --- a/Projectiles/Typeless/GenericElectricSpark.cs +++ b/Projectiles/Typeless/GenericElectricSpark.cs @@ -23,7 +23,12 @@ namespace CalamityMod.Projectiles.Typeless Projectile.localNPCHitCooldown = 15; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Prevents Amidias' Spark sparks from inflicting it to not make its other effect worthless + if (Projectile.ai[1] != 1f) + target.AddBuff(ModContent.BuffType(), 120); + } public override void AI() { diff --git a/Projectiles/Typeless/PendantProjectile3.cs b/Projectiles/Typeless/PearlAuraShard.cs similarity index 70% rename from Projectiles/Typeless/PendantProjectile3.cs rename to Projectiles/Typeless/PearlAuraShard.cs index cf8165e20d..0732ddd80f 100644 --- a/Projectiles/Typeless/PendantProjectile3.cs +++ b/Projectiles/Typeless/PearlAuraShard.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless { - public class PendantProjectile3 : ModProjectile, ILocalizedModType + public class PearlAuraShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Typeless"; public override void SetDefaults() @@ -16,17 +16,17 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.timeLeft = 220; - Projectile.penetrate = 1; Projectile.tileCollide = false; } public override void AI() { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); + if (Projectile.timeLeft < 210) + CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 10f, 20f); Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 4; i++) { int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); Main.dust[dust].noGravity = true; @@ -34,9 +34,5 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[dust].velocity += Projectile.velocity * 0.1f; } } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 60); } } diff --git a/Projectiles/Typeless/PendantProjectile3.png b/Projectiles/Typeless/PearlAuraShard.png similarity index 100% rename from Projectiles/Typeless/PendantProjectile3.png rename to Projectiles/Typeless/PearlAuraShard.png diff --git a/Projectiles/Typeless/PendantProjectile1.cs b/Projectiles/Typeless/PendantProjectile1.cs deleted file mode 100644 index f04ae59970..0000000000 --- a/Projectiles/Typeless/PendantProjectile1.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PendantProjectile1 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity += Projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 30); - } -} diff --git a/Projectiles/Typeless/PendantProjectile1.png b/Projectiles/Typeless/PendantProjectile1.png deleted file mode 100644 index df5a566c0b..0000000000 Binary files a/Projectiles/Typeless/PendantProjectile1.png and /dev/null differ diff --git a/Projectiles/Typeless/PendantProjectile2.cs b/Projectiles/Typeless/PendantProjectile2.cs deleted file mode 100644 index c50d8c358f..0000000000 --- a/Projectiles/Typeless/PendantProjectile2.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class PendantProjectile2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override void SetDefaults() - { - Projectile.width = 10; - Projectile.height = 10; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 220; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.2f / 255f, (255 - Projectile.alpha) * 0.2f / 255f); - Projectile.rotation += Projectile.velocity.X * 1.25f; - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare_Blue, 0f, 0f, 100, default, 0.6f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity += Projectile.velocity * 0.1f; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 30); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 30); - } -} diff --git a/Projectiles/Typeless/PendantProjectile2.png b/Projectiles/Typeless/PendantProjectile2.png deleted file mode 100644 index bcf5f2e978..0000000000 Binary files a/Projectiles/Typeless/PendantProjectile2.png and /dev/null differ diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index 35ff4a2359..a68256bee6 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -33,12 +33,12 @@ namespace CalamityMod.Projectiles.Typeless { Projectile.rotation += 0.01f; - Player player = Main.player[Main.myPlayer]; + Player player = Main.LocalPlayer; Vector2 posDiff = player.Center - Projectile.Center; if (posDiff.Length() <= radius) { - player.statDefense += 6; - player.lifeRegen += 2; + player.statDefense += 8; + player.GetCritChance() += 3; } } @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Typeless // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback if (CalamityGlobalNPC.ShouldAffectNPC(target)) { - float knockbackMultiplier = SandCloak.KnockbackStrength * MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); + float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); Vector2 trueKnockback = target.Center - Projectile.Center; trueKnockback.Normalize(); target.velocity = trueKnockback * knockbackMultiplier; diff --git a/Projectiles/Typeless/ShadeNimbus.cs b/Projectiles/Typeless/ShadeNimbus.cs new file mode 100644 index 0000000000..593d90780c --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbus.cs @@ -0,0 +1,96 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbus : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Boss/ShadeNimbusHostile"; + + public const float Lifespan = 210f; + public ref float RainTimer => ref Projectile.ai[0]; + + public override void SetStaticDefaults() + { + Main.projFrames[Projectile.type] = 6; + } + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 24; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + { + Projectile.frame = 0; + } + } + + if (Projectile.velocity.Length() > 0.5f) + Projectile.velocity *= 0.9765f; + else + Projectile.velocity = Vector2.Zero; + + // Push away horizontally from other shade nimbuses + float pushForce = 0.02f; + for (int k = 0; k < Main.maxProjectiles; k++) + { + Projectile otherProj = Main.projectile[k]; + if (!otherProj.active || k == Projectile.whoAmI) + continue; + + bool sameProjType = otherProj.type == Projectile.type; + float taxicabDist = Vector2.Distance(Projectile.Center, otherProj.Center); + float distanceGate = 20f; + if (sameProjType && taxicabDist < distanceGate) + { + if (Projectile.position.X < otherProj.position.X) + Projectile.velocity.X -= pushForce; + else + Projectile.velocity.X += pushForce; + } + } + + Projectile.ai[1] += 1f; + if (Projectile.ai[1] >= Lifespan) + { + Projectile.alpha += 5; + if (Projectile.alpha > 255) + { + Projectile.alpha = 255; + Projectile.Kill(); + } + } + else if (Projectile.ai[1] >= 15f) + { + RainTimer += 1f; + if (RainTimer > 8f) + { + RainTimer = 0f; + if (Projectile.owner == Main.myPlayer) + { + float rainX = Projectile.position.X + Main.rand.NextFloat(14f, Projectile.width - 28f); + float rainY = Projectile.position.Y + Projectile.height + 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), rainX, rainY, 0f, 10f, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 0f); + } + } + } + } + + // The cloud doesn't deal damage, just the rain + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/ShadeNimbusRain.cs b/Projectiles/Typeless/ShadeNimbusRain.cs new file mode 100644 index 0000000000..6e16735484 --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbusRain.cs @@ -0,0 +1,43 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbusRain : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Boss/ShaderainHostile"; + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 40; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 180; + Projectile.alpha = 50; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 8; + } + + public override void OnKill(int timeLeft) + { + int shadeDust = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + (float)Projectile.height - 2f), 2, 2, DustID.Demonite, 0f, 0f, 0, default, 1f); + Dust dust = Main.dust[shadeDust]; + dust.position.X -= 2f; + dust.alpha = 38; + dust.velocity *= 0.1f; + dust.velocity += -Projectile.oldVelocity * 0.25f; + dust.scale = 0.95f; + } + + public override Color? GetAlpha(Color lightColor) => new Color(100, 255, 100, Projectile.alpha); + + public override void OnHitNPC(NPC target, NPC.HitInfo info, int damageDone) => target.AddBuff(ModContent.BuffType(), 60); + } +} diff --git a/Projectiles/Typeless/ShadeNimbusSpawner.cs b/Projectiles/Typeless/ShadeNimbusSpawner.cs new file mode 100644 index 0000000000..a29894b24e --- /dev/null +++ b/Projectiles/Typeless/ShadeNimbusSpawner.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ShadeNimbusSpawner : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/NPCs/HiveMind/DankCreeper"; + + public ref float EffectStrength => ref Projectile.ai[2]; // 1 Rotten Brain, 2 Amal Brain, 3 The Amalgam + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 70; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 35; + } + + public override void AI() => Projectile.rotation = Projectile.velocity.X * 0.05f; + + // The spawner should not deal damage + public override bool? CanDamage() => false; + + public override void OnKill(int timeLeft) + { + // Kill sound, dust, and gores of Dank Creeper + SoundEngine.PlaySound(SoundID.NPCDeath1, Projectile.Center); + + 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) + { + Vector2 goreVelocity = new Vector2(Projectile.velocity.X, Projectile.velocity.Y * 0.4f); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore2").Type); + Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, goreVelocity, Mod.Find("DankCreeperGore3").Type); + } + + // Spawn shade rain clouds out to the sides + // Number of clouds and their damage scale based on what accessory in the upgrade path triggered it (damage is set when the spawner is created) + int cloudAmt = EffectStrength == 3f ? 10 : EffectStrength == 2f ? 6 : 4; + for (int c = -(cloudAmt / 2); c < cloudAmt / 2; c++) + { + Vector2 cloudVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi / 72f) * Main.rand.NextFloat(4.5f, 11f); + cloudVelocity *= c < 0f ? -1f : 1f; + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, cloudVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + } + } + } +} diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 64b1ae6879..1185a9aa11 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -60,12 +60,6 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; Projectile.Center = player.Center; - if (player is null || player.dead) - { - player.ClearBuff(ModContent.BuffType()); - player.Calamity().tesla = false; - Projectile.Kill(); - } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -100,32 +94,7 @@ namespace CalamityMod.Projectiles.Typeless Rectangle sourceRect = new Rectangle(Projectile.width * (int)Projectile.localAI[1], Projectile.height * (int)Projectile.localAI[0], Projectile.width, Projectile.height); Vector2 origin = new Vector2(Projectile.width / 2, Projectile.height / 2); - float opacity = 1f; - int sparkCount = 0; - int fadeTime = 20; - - if (Projectile.timeLeft < fadeTime) - { - opacity = Projectile.timeLeft * (1f / fadeTime); - sparkCount = fadeTime - Projectile.timeLeft; - } - - for (int i = 0; i < sparkCount * 2; i++) - { - int dustType = 132; - if (Main.rand.NextBool()) - { - dustType = 264; - } - float rangeDiff = 2f; - - Vector2 dustPos = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - dustPos.Normalize(); - dustPos *= radius + Main.rand.NextFloat(-rangeDiff, rangeDiff); - - int dust = Dust.NewDust(Projectile.Center + dustPos, 1, 1, dustType, 0, 0, 0, default, 0.75f); - Main.dust[dust].noGravity = true; - } + float opacity = Main.player[Projectile.owner].Calamity().teslaVisuals ? 1f : 0.25f; Main.EntitySpriteDraw(sprite, Projectile.Center - Main.screenPosition, sourceRect, drawColour * opacity, Projectile.rotation, origin, 1f, SpriteEffects.None, 0); return false; diff --git a/Sounds/Item/ArsenalOffCooldown.ogg b/Sounds/Item/ArsenalOffCooldown.ogg new file mode 100644 index 0000000000..3be62abb8b Binary files /dev/null and b/Sounds/Item/ArsenalOffCooldown.ogg differ diff --git a/Systems/WorldMiscUpdateSystem.cs b/Systems/WorldMiscUpdateSystem.cs index c172445a7b..cc580cd0d9 100644 --- a/Systems/WorldMiscUpdateSystem.cs +++ b/Systems/WorldMiscUpdateSystem.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Systems // Reset this int because it causes bugs with other mods if you delete Dr. Draedon through abnormal means. if (CalamityGlobalNPC.draedon != -1) { - if (!NPC.AnyNPCs(ModContent.NPCType())) + if (!NPC.AnyNPCs(NPCType())) CalamityGlobalNPC.draedon = -1; } @@ -132,13 +132,13 @@ namespace CalamityMod.Systems if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45) { IEntitySource source = new EntitySource_WorldEvent(); - Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 0, 0f); + Projectile.NewProjectile(source, DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ProjectileType(), 0, 0f); } if (DraedonSummonCountdown == 0) { IEntitySource source = new EntitySource_WorldEvent(); - NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); + NPC.NewNPC(source, (int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, NPCType()); } } #endregion Handle Draedon Summoning @@ -242,7 +242,7 @@ namespace CalamityMod.Systems if (CalamityGlobalTile.GrowthTiles.Contains(tileType) && growthTile.Slope == SlopeType.Solid && !growthTile.IsHalfBlock) { int growthChance = 2; - if (tileType == ModContent.TileType()) + if (tileType == TileType()) growthChance *= 5; if (Main.rand.NextBool(growthChance)) @@ -269,18 +269,18 @@ namespace CalamityMod.Systems { Tile tile = Main.tile[x, y]; bool growTile = !tile.HasTile && tile.LiquidAmount >= 128; - bool isSunkenSeaTile = tileType == ModContent.TileType() || tileType == ModContent.TileType(); + bool isSunkenSeaTile = tileType == TileType() || tileType == TileType(); bool meetsAdditionalGrowConditions = tile.Slope == SlopeType.Solid && !tile.IsHalfBlock && tile.LiquidType != LiquidID.Lava; if (growTile && meetsAdditionalGrowConditions) { - int tileType2 = ModContent.TileType(); + int tileType2 = TileType(); - if (tileType == ModContent.TileType()) - tileType2 = ModContent.TileType(); + if (tileType == TileType()) + tileType2 = TileType(); bool canPlaceBasedOnAttached = true; - if (tileType2 == ModContent.TileType() && !isSunkenSeaTile) + if (tileType2 == TileType() && !isSunkenSeaTile) canPlaceBasedOnAttached = false; if (canPlaceBasedOnAttached && CanPlaceBasedOnProximity(x, y, tileType2)) @@ -395,7 +395,7 @@ namespace CalamityMod.Systems public static bool CanPlaceBasedOnProximity(int x, int y, int tileType) { - if (tileType == ModContent.TileType() && !DownedBossSystem.downedLeviathan) + if (tileType == TileType() && !DownedBossSystem.downedLeviathan) return false; int minDistanceFromOtherTiles = 10; @@ -458,10 +458,10 @@ namespace CalamityMod.Systems int chance = (int)spawnRate; if (Main.rand.NextBool(chance)) { - if (!NPC.AnyNPCs(ModContent.NPCType()) && Main.netMode != NetmodeID.MultiplayerClient && + if (!NPC.AnyNPCs(NPCType()) && Main.netMode != NetmodeID.MultiplayerClient && ArmoredDiggerSpawnCooldown <= 0) { - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, NPCType()); ArmoredDiggerSpawnCooldown = 36000; } } @@ -507,7 +507,7 @@ namespace CalamityMod.Systems bool adultWyrmAlive = CalamityGlobalNPC.adultEidolonWyrmHead != -1 && Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active; if (!adultWyrmAlive) - NPC.SpawnOnPlayer(player.whoAmI, ModContent.NPCType()); + NPC.SpawnOnPlayer(player.whoAmI, NPCType()); } #endregion } diff --git a/Systems/WorldgenManagementSystem.cs b/Systems/WorldgenManagementSystem.cs index 36a6baef26..d7c58193c9 100644 --- a/Systems/WorldgenManagementSystem.cs +++ b/Systems/WorldgenManagementSystem.cs @@ -148,11 +148,11 @@ namespace CalamityMod.Systems })); } - // All further tasks occur after vanilla worldgen is completed + // All further tasks occur right before vanilla worldgen is completed (which includes The Dirtiest Block and final secret seed adjustments) int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); if (FinalIndex != -1) { - int currentFinalIndex = FinalIndex; + int currentFinalIndex = FinalIndex - 1; // Reallocate gems so rarity corresponds to depth tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index da3a59a6f7..299a868cf6 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -85,9 +85,6 @@ namespace CalamityMod.Tiles } } - // This function has two purposes: - // 1 - Shatters adjacent Lumenyl or Sea Prism crystals when a neighboring solid tile is destroyed - // 2 - Gives the player breath back when breaking blocks with Reaver set bonus public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem) { Tile tile = Main.tile[i, j]; @@ -309,13 +306,6 @@ namespace CalamityMod.Tiles if (player is null || !player.active) return; - if (player.Calamity().reaverExplore && !fail) - { - player.breath += 20; - if (player.breath > player.breathMax) - player.breath = player.breathMax; - } - // Mining set gives a chance for additional ore. This can be abused for infinite ore but it has a cooldown to prevent too much abuse if (player.Calamity().miningSet && player.Calamity().miningSetCooldown <= 0 && !fail && TileID.Sets.Ore[tile.TileType]) { diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.cs b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs new file mode 100644 index 0000000000..10f9f299e6 --- /dev/null +++ b/Tiles/LivingFire/LivingPlagueFireBlockTile.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +namespace CalamityMod.Tiles.LivingFire +{ + public class LivingPlagueFireBlockTile : ModTile + { + //Thank you to Seraph for getting living fire blocks to work properly. + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + HitSound = SoundID.Dig; + AddMapEntry(new Color(0, 171, 31)); + AnimationFrameHeight = 90; + Main.tileSolid[Type] = false; + Main.tileNoAttach[Type] = false; + Main.tileFrameImportant[Type] = false; + TileObjectData.newTile.Width = 1; + TileObjectData.newTile.Height = 1; + TileObjectData.newTile.Origin = new Point16(0, 0); + TileObjectData.newTile.CoordinateHeights = new int[] { 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.HookCheckIfCanPlace = new PlacementHook(CanPlaceAlter, -1, 0, true); + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.HookPostPlaceMyPlayer = new PlacementHook(AfterPlacement, -1, 0, false); + + TileObjectData.addTile(Type); + } + + public int CanPlaceAlter(int i, int j, int type, int style, int direction, int alternate) => 1; + + public static int AfterPlacement(int i, int j, int type, int style, int direction, int alternate) + { + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendTileSquare(Main.myPlayer, i, j, 1, 1); + } + return 1; + } + + public override bool CanPlace(int i, int j) + { + List> around = new List> + { + new List() {i, j-1 }, + new List() {i-1, j }, + new List() {i+1, j }, + new List() {i, j+1 } + }; + //if (Main.tile[i, j]) || tile.type == Type + + //return true; //temporary for testing purposes + + if (Main.tile[i, j].WallType != WallID.None) + { + return true; + } + + for (int k = 0; k < around.Count; ++k) + { + Tile tile = Main.tile[around[k][0], around[k][1]]; + if (tile.HasTile && (Main.tileSolid[tile.TileType] || CalamityLists.livingFireBlockList.Contains(tile.TileType))) + { + return true; + } + } + return false; + } + + public override void AnimateTile(ref int frame, ref int frameCounter) + { + frame = Main.tileFrame[TileID.LivingFire]; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 0f; + g = 1f; + b = 0.2f; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, (int)CalamityDusts.Plague, 0f, 0f, 1, default, 1f); + return false; + } + } +} diff --git a/Tiles/LivingFire/LivingPlagueFireBlockTile.png b/Tiles/LivingFire/LivingPlagueFireBlockTile.png new file mode 100644 index 0000000000..2282b3ce0a Binary files /dev/null and b/Tiles/LivingFire/LivingPlagueFireBlockTile.png differ diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 3654c3679a..08c516dac1 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -254,22 +254,21 @@ namespace CalamityMod // 0.6f is the minimum for vanilla but Calamity changes it to 0.2f // Windy days occur when wind speed is at least 0.5f (0.4f in vanilla) so this should never cause a windy day float windSpeed = 0f; - if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) - if (Main.windSpeedCurrent == 0f) - { - windSpeed = Main.rand.NextFloat(0.2f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); - } - else if (Main.windSpeedCurrent < 0.2f && Main.windSpeedCurrent > 0f) - { - windSpeed = Main.rand.NextFloat(0.2f, 0.4f); - } - else if (Main.windSpeedCurrent > -0.2f && Main.windSpeedCurrent < 0f) - { - windSpeed = Main.rand.NextFloat(-0.4f, -0.2f); - } + if (Main.windSpeedCurrent == 0f) + { + windSpeed = Main.rand.NextFloat(0.3f, 0.4f) * (Main.rand.Next(0, 2) * 2 - 1); + } + else if (Main.windSpeedCurrent < 0.3f && Main.windSpeedCurrent > 0f) + { + windSpeed = Main.rand.NextFloat(0.3f, 0.4f); + } + else if (Main.windSpeedCurrent > -0.3f && Main.windSpeedCurrent < 0f) + { + windSpeed = Main.rand.NextFloat(-0.4f, -0.3f); + } if (windSpeed != 0f) { - Main.windSpeedCurrent = windSpeed < 0f ? -0.2f : 0.2f; + Main.windSpeedCurrent = windSpeed < 0f ? -0.3f : 0.3f; Main.windSpeedTarget = windSpeed; } Sandstorm.StartSandstorm(); diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 98d5f453bd..08128135fb 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -224,6 +224,8 @@ namespace CalamityMod light += 1; if (mp.jellyfishNecklace && underwater) // inherited by jellyfish diving gear and higher light += 1; + if (mp.reaverExplore) + light += 2; if (mp.lumenousAmulet && underwater) light += 2; if (mp.shine) diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index 5979a32adb..a9611366dd 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -707,7 +707,7 @@ namespace CalamityMod public static void DrawStarTrail(this Projectile projectile, Color outer, Color inner, float auraHeight = 10f) { - Texture2D aura = ModContent.Request("CalamityMod/Projectiles/StarTrail").Value; + Texture2D aura = Request("CalamityMod/Projectiles/StarTrail").Value; Vector2 offsets = new Vector2(0f, projectile.gfxOffY) - Main.screenPosition; Rectangle auraRec = aura.Frame(); float auraRotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index 4508e9c84c..3e5fae0989 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -77,7 +77,7 @@ namespace CalamityMod // This check is done twice because the draw order matters. We want to draw the background icon before any text. if (item.stack > 0) { - if (item.type == ModContent.ItemType()) + if (item.type == ItemType()) { slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Blood").Value; } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 7f9f60001e..fa2cb36748 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -696,10 +696,10 @@ namespace CalamityMod if (ignoreAbyss) { - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); - tileExcludeList.Add(ModContent.TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); + tileExcludeList.Add(TileType()); } return !Main.tileContainer[tile.TileType] && !tileExcludeList.Contains(tile.TileType); diff --git a/World/Abyss.cs b/World/Abyss.cs index 7dd9c746a4..54b16021f0 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -324,8 +324,7 @@ namespace CalamityMod.World AbyssIsland(abyssChasmX, Main.remixWorld ? 105 : AbyssChasmBottom + 5, 65, 75, 40, 45, ModContent.TileType(), false, false, false); //place terminus shrine - UndergroundShrines.SpecialHut((ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.WallType(), UndergroundShrines.UndergroundShrineType.Abyss, abyssChasmX, Main.remixWorld ? 100 : AbyssChasmBottom); + UndergroundShrines.PlaceAbyssShrine(abyssChasmX, Main.remixWorld ? 100 : AbyssChasmBottom); //place islands in the sulphuric depths layer //start placing islands at the world surface so the abyss hole isnt completely empty diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 10573d76b6..0f4734b77d 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -57,7 +57,7 @@ namespace CalamityMod.World for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) { WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); - Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); } } diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index b761b4656f..51487e5f4c 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -61,13 +61,8 @@ namespace CalamityMod.World Tile tileUp4 = Main.tile[i, j - 4]; Tile tileUp5 = Main.tile[i, j - 5]; - int[] DungeonWalls = { 7, 94, 95, 8, 98, 99, 9, 96, 97 }; - //if (Main.tileDungeon[tile.TileType] && DungeonWalls.Contains(tileUp.WallType) && !tileUp.HasTile) - if (Main.tileDungeon[tile.TileType] && !tileUp1.HasTile && !tileUp2.HasTile && !tileUp3.HasTile && !tileUp4.HasTile && !tileUp5.HasTile) { - //i += WorldGen.dungeonSide * -16; - //determine the archive brick color if (tile.TileType == TileID.BlueDungeonBrick) dungeonArchiveColor = 0; @@ -77,7 +72,6 @@ namespace CalamityMod.World dungeonArchiveColor = 2; placedArchive = true; - break; } } @@ -88,20 +82,19 @@ namespace CalamityMod.World if (dungeonArchiveColor == 0) { - SchematicManager.PlaceSchematic(SchematicManager.BlueArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + PlaceSchematic(BlueArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } if (dungeonArchiveColor == 1) { - SchematicManager.PlaceSchematic(SchematicManager.GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + PlaceSchematic(GreenArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } if (dungeonArchiveColor == 2) { - SchematicManager.PlaceSchematic(SchematicManager.PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, + PlaceSchematic(PinkArchiveKey, new Point(i, j), SchematicAnchor.TopCenter, ref firstItem, new Action(FillArchiveChests)); } - break; } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index d109e2340b..adda47c705 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -3,11 +3,15 @@ using System.Collections.Generic; using CalamityMod.Items.Accessories; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; +using CalamityMod.Items.Placeables.FurnitureAbyss; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Schematics; using CalamityMod.Tiles.DraedonStructures; +using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Walls; using Microsoft.Xna.Framework; @@ -16,6 +20,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.Schematics.SchematicManager; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.World { @@ -37,10 +42,10 @@ namespace CalamityMod.World { return true; } - if (tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType() || - tile.WallType == ModContent.WallType() || - tile.WallType == ModContent.WallType()) + if (tile.TileType == TileType() || + tile.TileType == TileType() || + tile.WallType == WallType() || + tile.WallType == WallType()) { return true; } @@ -54,7 +59,7 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.BattlePotion, ItemID.HunterPotion, ItemID.TrapsightPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.RottenChunk, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CorruptionKey, 1), new ChestItem(ItemID.CorruptTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -65,10 +70,10 @@ namespace CalamityMod.World if (Main.zenithWorld) { - int evil = Utils.SelectRandom(WorldGen.genRand, ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType()); + int evil = Utils.SelectRandom(WorldGen.genRand, ItemType(), ItemType(), ItemType()); contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.RottenChunk, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CorruptionKey, 1), new ChestItem(ItemID.CorruptTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -144,7 +149,7 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.BattlePotion, ItemID.HunterPotion, ItemID.TrapsightPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.Vertebrae, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CrimsonKey, 1), new ChestItem(ItemID.CrimsonTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -159,12 +164,12 @@ namespace CalamityMod.World //Cannot modify the return value of List.this[int] because its not a variable so gotta do this instead contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.Vertebrae, WorldGen.genRand.Next(24, 28 + 1)), new ChestItem(ItemID.CrimsonKey, 1), new ChestItem(ItemID.CrimsonTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 2 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(2, 2 + 1)), new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), new ChestItem(ItemID.GasTrap, 1), }; @@ -237,8 +242,8 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ShinePotion, ItemID.MiningPotion, ItemID.BuilderPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.DungeonDesertKey, 1), new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -250,12 +255,12 @@ namespace CalamityMod.World int golfClub = Utils.SelectRandom(WorldGen.genRand, ItemID.GolfClubBronzeWedge, ItemID.GolfClubWedge, ItemID.GasTrap); contents = new List() { - new ChestItem(ModContent.ItemType(), 1), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(6, 8 + 1)), + new ChestItem(ItemType(), 1), + new ChestItem(ItemType(), WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.DungeonDesertKey, 1), new ChestItem(ItemID.DesertTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), new ChestItem(golfClub, 1), //Implying that the golfer messed with the loot but forgot this, OR its trapped }; @@ -321,7 +326,7 @@ namespace CalamityMod.World List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.Geode, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.BlueTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -343,8 +348,10 @@ namespace CalamityMod.World do { - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionX = Main.rand.NextBool() ? WorldGen.genRand.Next((int)(Main.maxTilesX * 0.55f), Main.maxTilesX - WorldGen.beachDistance) : WorldGen.genRand.Next(WorldGen.beachDistance, (int)(Main.maxTilesX * 0.45f)); + int placementPositionY = WorldGen.genRand.Next((int)GenVars.rockLayer + 20, Main.maxTilesY - 220); + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)GenVars.worldSurface + 100, (int)GenVars.rockLayer); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -361,9 +368,10 @@ namespace CalamityMod.World canGenerateInLocation = false; //The granite geode is supposed to fully float in free air. No tile replacements - if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.remixWorld) + if (tile.WallType == WallID.GraniteUnsafe && !tile.HasTile && !Main.drunkWorld) graniteWallsInArea++; - else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.remixWorld) //Get fixed boi makes it generate in marble biomes + // Drunk world variant + else if ((tile.WallType == WallID.MarbleUnsafe || tile.TileType == TileID.Marble) && Main.drunkWorld) graniteWallsInArea++; } } @@ -374,8 +382,45 @@ namespace CalamityMod.World else { bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillGraniteShrineChest)); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, Main.drunkWorld ? new Action(FillMarbleShrineChest) : new Action(FillGraniteShrineChest)); CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Drunk world: turns into a Marble Geode + if (Main.drunkWorld) + { + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + switch (tile.TileType) + { + case TileID.Granite: // Granite Block --> Marble Block + tile.TileType = TileID.Marble; + break; + case TileID.GraniteBlock: // Smooth Granite Block --> Smooth Marble Block + tile.TileType = TileID.MarbleBlock; + break; + case TileID.Containers: // Granite Chest --> Marble Chest + tile.TileFrameX += 36; + break; + case TileID.ExposedGems: // Sapphire --> Diamond + tile.TileFrameX += 54; + break; + } + switch (tile.WallType) + { + case WallID.Granite: // Granite Wall --> Marble Wall + tile.WallType = WallID.Marble; + break; + case WallID.SapphireGemspark: // Sapphire Gemspark Wall --> Diamond Gemspark Wall + tile.WallType = WallID.DiamondGemspark; + tile.WallColor = PaintID.None; + break; + } + } + } + } break; } @@ -389,7 +434,7 @@ namespace CalamityMod.World int foodType = Utils.SelectRandom(WorldGen.genRand, ItemID.ChristmasPudding, ItemID.SugarCookie, ItemID.GingerbreadCookie); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), @@ -402,13 +447,13 @@ namespace CalamityMod.World { contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.FlinxFur, WorldGen.genRand.Next(6, 8 + 1)), new ChestItem(ItemID.FrozenKey, 1), new ChestItem(ItemID.IceTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), new ChestItem(ItemID.Eggnog, WorldGen.genRand.Next(10, 12 + 1)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(200, 349 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(200, 349 + 1)), new ChestItem(Main.rand.NextBool() ? ItemID.GasTrap : ItemID.Marshmallow, 1) }; } @@ -474,7 +519,7 @@ namespace CalamityMod.World potionType = ItemID.RedPotion; List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.WhiteTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -496,8 +541,10 @@ namespace CalamityMod.World do { - int placementPositionX = WorldGen.genRand.Next((int)(Main.maxTilesX * 0.1f), (int)(Main.maxTilesX * 0.9f)); - int placementPositionY = WorldGen.genRand.Next((int)(Main.maxTilesY * 0.2f), (int)(Main.maxTilesY * 0.85f)); + int placementPositionX = Main.rand.NextBool() ? WorldGen.genRand.Next((int)(Main.maxTilesX * 0.55f), Main.maxTilesX - WorldGen.beachDistance) : WorldGen.genRand.Next(WorldGen.beachDistance, (int)(Main.maxTilesX * 0.45f)); + int placementPositionY = WorldGen.genRand.Next((int)GenVars.rockLayer + 20, Main.maxTilesY - 220); + if (Main.remixWorld) + placementPositionY = WorldGen.genRand.Next((int)GenVars.worldSurface + 100, (int)GenVars.rockLayer); Point placementPoint = new Point(placementPositionX, placementPositionY); Vector2 schematicSize = new Vector2(TileMaps[mapKey].GetLength(0), TileMaps[mapKey].GetLength(1)); @@ -516,9 +563,10 @@ namespace CalamityMod.World //Marble biomes either have blocks or walls, occasionally both //This should be near maximum to prevent the structure from overextending - if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.zenithWorld) + if ((tile.TileType == TileID.Marble || tile.WallType == WallID.MarbleUnsafe) && !Main.drunkWorld) marbleStuffInArea++; - else if ((tile.WallType == WallID.GraniteUnsafe || tile.TileType == TileID.Granite) && Main.zenithWorld) //Generates in granite in gfb + // Drunk world variant + else if ((tile.TileType == TileID.Granite || tile.WallType == WallID.GraniteUnsafe) && Main.drunkWorld) marbleStuffInArea++; //There should be some space between the pillars so it doesn't make pillars in the middle of nowhere zone @@ -536,8 +584,48 @@ namespace CalamityMod.World else { bool _ = true; - PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, new Action(FillMarbleShrineChest)); + PlaceSchematic(mapKey, new Point(placementPoint.X, placementPoint.Y), SchematicAnchor.TopLeft, ref _, Main.drunkWorld ? new Action(FillGraniteShrineChest) : new Action(FillMarbleShrineChest)); CalamityUtils.AddProtectedStructure(new Rectangle(placementPoint.X, placementPoint.Y, (int)schematicSize.X, (int)schematicSize.Y), 4); + + // Drunk world: turns into a Granite Column + if (Main.drunkWorld) + { + for (int x = placementPoint.X; x < placementPoint.X + schematicSize.X; x++) + { + for (int y = placementPoint.Y; y < placementPoint.Y + schematicSize.Y; y++) + { + Tile tile = CalamityUtils.ParanoidTileRetrieval(x, y); + switch (tile.TileType) + { + case TileID.Marble: // Marble Block --> Granite Block + tile.TileType = TileID.Granite; + break; + case TileID.MarbleBlock: // Smooth Marble Block --> Smooth Granite Block + tile.TileType = TileID.GraniteBlock; + break; + case TileID.MarbleColumn: // Marble Column --> Granite Column + tile.TileType = TileID.GraniteColumn; + break; + case TileID.Containers: // Marble Chest --> Granite Chest + tile.TileFrameX -= 36; + break; + case TileID.Platforms: // Marble Platform --> Granite Platform + tile.TileFrameY -= 18; + break; + } + switch (tile.WallType) + { + case WallID.Marble: // Marble Wall --> Granite Wall + tile.WallType = WallID.Granite; + break; + case WallID.MarbleBlock: // Smooth Marble Wall --> Smooth Granite Wall + tile.WallType = WallID.GraniteBlock; + tile.WallColor = PaintID.None; + break; + } + } + } + } break; } @@ -551,7 +639,7 @@ namespace CalamityMod.World int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.ShinePotion, ItemID.MiningPotion, ItemID.BuilderPotion); List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.TruffleWorm, 3), new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(100, 110 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), @@ -565,11 +653,11 @@ namespace CalamityMod.World //"Cannot modify the return value of List.this[int] because its not a variable" so gotta do this instead, I could add a bunch of bools but I feel this is better for how much is changed contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.TruffleWorm, 3), new ChestItem(ItemID.MushroomTorch, WorldGen.genRand.Next(50, 60 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), - new ChestItem(ModContent.ItemType(), WorldGen.genRand.Next(2, 3 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(2, 3 + 1)), new ChestItem(ItemID.RedPotion, WorldGen.genRand.Next(1, 2 + 1)), new ChestItem(ItemID.GasTrap, 1) }; @@ -658,7 +746,7 @@ namespace CalamityMod.World potionType = ItemID.Sake; List contents = new List() { - new ChestItem(ModContent.ItemType(), 1), + new ChestItem(ItemType(), 1), new ChestItem(ItemID.PinkGel, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(50, 60 + 1)), new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), @@ -787,298 +875,90 @@ namespace CalamityMod.World } #endregion - //Enums and generation methods for old shrines - //Currently still used for Abyss (Terminus) shrine - #region Enumeration - public enum UndergroundShrineType + #region Abyss Shrine + public static void PlaceAbyssShrine(int chestLeftX, int chestTopY) { - Surface, - Cavern, - WorldEvil, - Ice, - Desert, - Mushroom, - Granite, - Marble, - Abyss - } - #endregion + // Shrine position + int shrineLeftX = chestLeftX - 5; + int shrineRightX = chestLeftX + 4; + int shrineTopY = chestTopY - 5; + int shrineBottomY = chestTopY + 3; - #region Hut Outline Creation - - // Special Hut: Takes arguments of tile type 1, tile type 2, wall type, hut type (useful if you use this method to generate different huts), and location of the shrine (x and y) - public static void SpecialHut(ushort tile, ushort tile2, ushort wall, UndergroundShrineType hutType, int shrineLocationX, int shrineLocationY) - { - // Random variables for shrine size - int randomX = WorldGen.genRand.Next(2, 4); - int randomY = WorldGen.genRand.Next(2, 4); - - // Replace tiles in shrine area with shrine tile type 1 - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + // Creates a solid box of Smooth Voidstone + for (int x = shrineLeftX; x <= shrineRightX; x++) { - for (int y = shrineLocationY - randomY - 1; y <= shrineLocationY + randomY + 1; y++) + for (int y = shrineTopY; y <= shrineBottomY; y++) { Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileType = tile; + Main.tile[x, y].TileType = (ushort)TileType(); Main.tile[x, y].Get().Slope = SlopeType.Solid; - Main.tile[x, y].LiquidAmount = 0; Main.tile[x, y].Get().LiquidType = LiquidID.Water; } } - // Replace walls in shrine area with shrine wall type - for (int x = shrineLocationX - randomX; x <= shrineLocationX + randomX; x++) + // Carve out the inner room to make the above box hollow + for (int x = shrineLeftX + 1; x <= shrineRightX - 1; x++) { - for (int y = shrineLocationY - randomY; y <= shrineLocationY + randomY; y++) - { - Main.tile[x, y].Get().HasTile = false; - Main.tile[x, y].WallType = wall; - } - } - - // Remove tiles from the inner part of the shrine area - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) - { - for (int y = shrineLocationY + randomY - 2; y <= shrineLocationY + randomY; y++) - Main.tile[x, y].Get().HasTile = false; - } - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) - { - for (int y = shrineLocationY + randomY - 2; y <= shrineLocationY + randomY - 1; y++) + for (int y = shrineTopY + 1; y <= shrineBottomY - 1; y++) Main.tile[x, y].Get().HasTile = false; } - // Replace tiles from bottom of shrine area with shrine tile type 2 - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + // Carve out the entrance + for (int x = shrineLeftX; x <= shrineRightX; x++) { - int verticalOffset = 4; - int y = shrineLocationY + randomY + 2; - while (!Main.tile[x, y].HasTile && y < Main.maxTilesY && verticalOffset > 0) - { - Main.tile[x, y].Get().HasTile = true; - Main.tile[x, y].TileType = tile2; - Main.tile[x, y].Get().Slope = SlopeType.Solid; - y++; - verticalOffset--; - } + for (int y = shrineBottomY - 3; y <= shrineBottomY - 1; y++) + Main.tile[x, y].Get().HasTile = false; } - // Replace tiles from top of shrine with shrine tile type 1 - randomX -= WorldGen.genRand.Next(1, 3); - int num21 = shrineLocationY - randomY - 2; - while (randomX > -1) + // Add in the pyramid-like hat + int yTop = shrineTopY - 1; + int halfWidth = 4; + while (halfWidth > -1) { - for (int x = shrineLocationX - randomX - 1; x <= shrineLocationX + randomX + 1; x++) + halfWidth -= WorldGen.genRand.Next(1, 3); // Random step distance + for (int x = chestLeftX - halfWidth - 1; x <= chestLeftX + halfWidth; x++) { - Main.tile[x, num21].Get().HasTile = true; - Main.tile[x, num21].TileType = tile; + Main.tile[x, yTop].Get().HasTile = true; + Main.tile[x, yTop].TileType = (ushort)TileType(); } - randomX -= WorldGen.genRand.Next(1, 3); - num21--; + yTop--; } - // Place shrine chest - CalamityWorld.SChestX[(int)hutType] = shrineLocationX; - CalamityWorld.SChestY[(int)hutType] = shrineLocationY; - SpecialChest(hutType); + // Place the chest and fill it + Chest chest = MiscWorldgenRoutines.AddChestWithLoot(chestLeftX, chestTopY, (ushort)TileType()); + if (chest != null) + FillAbyssShrineChest(chest); } - #endregion - #region Chest Creation - // Special Chest: Used for placing shrine chests, takes argument of the shrine type which dictates what item will spawn in the first slot of this chest - public static void SpecialChest(UndergroundShrineType shrineType) + public static void FillAbyssShrineChest(Chest chest) { - int item = 0; - //1.4 chests are dubious and use another ID type, so there's 2 now - int chestType = 21; - int chestSubType = 0; - - switch (shrineType) + int dropType = Utils.SelectRandom(WorldGen.genRand, ItemType(), ItemType(), ItemType()); + int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.PotionOfReturn, ItemID.LuckPotionGreater); + if (Main.zenithWorld) { - case UndergroundShrineType.Surface: - item = ModContent.ItemType(); //Default chest - break; - case UndergroundShrineType.Cavern: - item = ModContent.ItemType(); - chestSubType = 44; //Obsidian - break; - case UndergroundShrineType.WorldEvil: - item = WorldGen.crimson ? ModContent.ItemType() : ModContent.ItemType(); - chestType = WorldGen.crimson ? 21 : 467; //Flesh and Lesion - chestSubType = WorldGen.crimson ? 43 : 3; - break; - case UndergroundShrineType.Ice: - item = ModContent.ItemType(); - chestSubType = 47; //Glass - break; - case UndergroundShrineType.Desert: - item = ModContent.ItemType(); - chestType = 467; - chestSubType = 10; //Sandstone - break; - case UndergroundShrineType.Mushroom: - item = ModContent.ItemType(); - chestSubType = 32; //Mushroom - break; - case UndergroundShrineType.Granite: - item = ModContent.ItemType(); - chestSubType = 50; //Granite - break; - case UndergroundShrineType.Marble: - item = ModContent.ItemType(); - chestSubType = 51; //Marble - break; - case UndergroundShrineType.Abyss: - item = ModContent.ItemType(); - chestType = ModContent.TileType(); - break; + dropType = ItemID.OldShoe; + potionType = ItemID.RedPotion; } - - // Destroy tiles in chest spawn location - for (int j = CalamityWorld.SChestX[(int)shrineType] - 1; j <= CalamityWorld.SChestX[(int)shrineType] + 1; j++) + List contents = new List() { - for (int k = CalamityWorld.SChestY[(int)shrineType]; k <= CalamityWorld.SChestY[(int)shrineType] + 2; k++) - WorldGen.KillTile(j, k, false, false, false); - } + new ChestItem(ItemType(), 1), + new ChestItem(dropType, 1), + new ChestItem(ItemType(), WorldGen.genRand.Next(100, 110 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(20, 24 + 1)), + new ChestItem(ItemType(), WorldGen.genRand.Next(10, 12 + 1)), + new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), + }; - // Attempt to fix sloped tiles under the chest to prevent the chest from killing itself (literally) - for (int l = CalamityWorld.SChestX[(int)shrineType] - 1; l <= CalamityWorld.SChestX[(int)shrineType] + 1; l++) + if (Main.zenithWorld) + contents.Add(new ChestItem(ItemID.GasTrap, 1)); + + for (int i = 0; i < contents.Count; i++) { - for (int m = CalamityWorld.SChestY[(int)shrineType]; m <= CalamityWorld.SChestY[(int)shrineType] + 3; m++) - { - if (m < Main.maxTilesY) - { - Main.tile[l, m].Get().Slope = SlopeType.Solid; - Main.tile[l, m].Get().IsHalfBlock = false; - } - } + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); + chest.item[i].stack = contents[i].Stack; } - - // Place the chest, finally - WorldGen.AddBuriedChest(CalamityWorld.SChestX[(int)shrineType], CalamityWorld.SChestY[(int)shrineType], item, false, chestSubType, false, (ushort)(chestType)); } #endregion - - #region Direct Gen - /*public static void PlaceShrines() - { - int x = Main.maxTilesX; - int y = Main.maxTilesY; - int genLimit = x / 2; - int generateBack = genLimit - 80; //Small = 2020 - int generateForward = genLimit + 80; //Small = 2180 - double shrineChance = 100E-05; - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Surface Shrine - { - int tilesX = WorldGen.genRand.Next((int)(x * 0.35), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.65)); - int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Dirt || Main.tile[tilesX, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].TileType == TileID.Dirt || Main.tile[tilesX2, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.RedBrick, TileID.Dirt, WallID.RedBrick, 0, tilesX2, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Evil Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.35f)); - - if (Main.tile[tilesX, tilesY].TileType == (WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone)) - { - SpecialHut(WorldGen.crimson ? TileID.CrimtaneBrick : TileID.DemoniteBrick, - WorldGen.crimson ? TileID.Crimstone : TileID.Ebonstone, - WorldGen.crimson ? WallID.CrimtaneBrick : WallID.DemoniteBrick, UndergroundShrineType.WorldEvil, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Cavern - { - int tilesX = WorldGen.genRand.Next((int)(x * 0.3), generateBack); - int tilesX2 = WorldGen.genRand.Next(generateForward, (int)(x * 0.7)); - int tilesY = WorldGen.genRand.Next((int)(y * 0.55f), (int)(y * 0.8f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX, tilesY); - break; - } - if (Main.tile[tilesX2, tilesY].TileType == TileID.Stone) - { - SpecialHut(TileID.ObsidianBrick, TileID.Obsidian, WallID.ObsidianBrick, UndergroundShrineType.Cavern, tilesX2, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Ice Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.IceBlock) - { - SpecialHut(TileID.IceBrick, TileID.IceBlock, WallID.IceBrick, UndergroundShrineType.Ice, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Desert Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.3f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.DesertFossil) - { - SpecialHut(TileID.DesertFossil, TileID.Sandstone, WallID.DesertFossil, UndergroundShrineType.Desert, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Mushroom Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.MushroomGrass) - { - SpecialHut(TileID.MushroomBlock, TileID.Mud, WallID.MushroomUnsafe, UndergroundShrineType.Mushroom, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Granite Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Granite) - { - SpecialHut(TileID.GraniteBlock, TileID.Granite, WallID.GraniteUnsafe, UndergroundShrineType.Granite, tilesX, tilesY); - break; - } - } - - for (int k = 0; k < (int)(x * y * shrineChance); k++) //Marble Shrine - { - int tilesX = WorldGen.genRand.Next(0, x); - int tilesY = WorldGen.genRand.Next((int)(y * 0.35f), (int)(y * 0.5f)); - - if (Main.tile[tilesX, tilesY].TileType == TileID.Marble) - { - SpecialHut(TileID.MarbleBlock, TileID.Marble, WallID.MarbleUnsafe, UndergroundShrineType.Marble, tilesX, tilesY); - break; - } - } - }*/ - #endregion } }