diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 0fe1c1512f..aa31164e4e 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -204,10 +204,6 @@ namespace CalamityMod.Buffs tip = CalamityUtils.GetTextValue("Vanilla.BuffDescription.ChaosState"); break; - case BuffID.IceBarrier: - tip = tip.Replace("25", "15"); - break; - case BuffID.MagicPower: tip = tip.Replace("20", "10"); break; diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index b4d0be15c0..97cc48f2b3 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Buffs.DamageOverTime public static DebuffData debuffData = new DebuffData() { EnemyLostRegen = 3996, //6x the tick size - SicknessDebuffScaling = 1, + HeatDebuffScaling = 1, MinimumDamageTickSize = 666, //Vhex should always have ticks of 666 MultiplierDamageTickSize = 0 }; diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index dc05297df1..d24a61bc89 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -7,12 +8,18 @@ namespace CalamityMod.Buffs.StatDebuffs { public class WhisperingDeath : ModBuff { + // Whispering Death does not deal DoT, but is classified as a sickness debuff. + public static DebuffData debuffData = new DebuffData() + { + SicknessDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 392cd70ebb..44219086bf 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -112,8 +112,6 @@ namespace CalamityMod.CalPlayer public double projectileDamageReduction = 0D; public int hellbornShots = 0; public int garandShots = 0; - public int searedPanCounter = 0; - public int searedPanTimer = 0; /// If set to true, prevents all player dashes. Used by Ball and Chain, and Stygian Shield. public bool blockAllDashes = false; /// Used by Flamsteed Ring to reset the player's hitbox size after dismounting. @@ -368,12 +366,8 @@ namespace CalamityMod.CalPlayer public int dragonRageHits = 0; /// Cooldown variable for Dragon Rage's fireball spawning to prevent spamming projectiles when hitting multiple enemies simultaneously. public int dragonRageCooldown = 0; - public const float AquaticBoostMax = 10000f; - /// - /// Counter variable which controls Aquatic Emblem's stat boosts while underwater.
- /// This counter starts at , and is decremented by 2 for every frame the player remains underwater, reaching maximum boosts when it hits 0. - ///
- public float aquaticBoost = 0f; + /// Counter variable which controls Aquatic Emblem's stat boosts while underwater. + public float aquaticBoost = 0; public int galileoCooldown = 0; /// Used to track Prideful Hunter's Planar Ripper's movement speed boost, along with its visual effects. public int planarSpeedBoost = 0; @@ -728,8 +722,6 @@ namespace CalamityMod.CalPlayer public bool tCloudberry = false; /// If true, the player has consumed Sacred Strawberry. public bool sStrawberry = false; - /// If true, the player has consumed Nimble Bounder. - public bool nimbleBounderBoost = false; public bool revJamDrop = false; /// If true, the player has consumed Mushroom Plasma Root. public bool rageBoostOne = false; @@ -804,7 +796,6 @@ namespace CalamityMod.CalPlayer public bool ascendantInsignia = false; public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; - public bool ascendantTrail = false; /// Used to toggle dust spawned while swinging, through accessory visibility. public bool magmaStoneVisuals = true; public bool eGauntlet = false; @@ -1751,7 +1742,6 @@ namespace CalamityMod.CalPlayer sStrawberry = false; pHeart = false; cShard = false; - nimbleBounderBoost = false; revJamDrop = false; rageBoostOne = false; rageBoostTwo = false; @@ -1804,7 +1794,6 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("dragonFruit", sStrawberry); boost.AddWithCondition("phantomHeart", pHeart); boost.AddWithCondition("cometShard", cShard); - boost.AddWithCondition("nimbleBounder", nimbleBounderBoost); boost.AddWithCondition("revJam", revJamDrop); boost.AddWithCondition("rageOne", rageBoostOne); boost.AddWithCondition("rageTwo", rageBoostTwo); @@ -1895,7 +1884,6 @@ namespace CalamityMod.CalPlayer sStrawberry = boost.Contains("dragonFruit"); pHeart = boost.Contains("phantomHeart"); cShard = boost.Contains("cometShard"); - nimbleBounderBoost = boost.Contains("nimbleBounder"); revJamDrop = boost.Contains("revJam"); rageBoostOne = boost.Contains("rageOne"); rageBoostTwo = boost.Contains("rageTwo"); @@ -2028,7 +2016,7 @@ namespace CalamityMod.CalPlayer percentMaxLifeIncrease += 25; if (affliction || afflicted) - percentMaxLifeIncrease += 10; + percentMaxLifeIncrease += Affliction.MaxLifeBoostPercent; if (community) percentMaxLifeIncrease += (int)(TheCommunity.CalculatePower() * TheCommunity.HealthMultiplier); @@ -2244,7 +2232,6 @@ namespace CalamityMod.CalPlayer teslaVisuals = true; cryogenSoul = false; ascendantInsignia = false; - ascendantTrail = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; @@ -3246,7 +3233,6 @@ namespace CalamityMod.CalPlayer CurrentlyViewedHologramText = string.Empty; #endregion - ascendantTrail = false; evilSmasherBoost = 0; burningSeaBurnOut = 0; flareGunOverheat = 0; @@ -3254,8 +3240,6 @@ namespace CalamityMod.CalPlayer lucreciaEnergy = 0; elementalMastery = 0; garandShots = 0; - searedPanCounter = 0; - searedPanTimer = 0; persecutedEnchantSummonTimer = 0; momentumCapacitorTime = 0; momentumCapacitorBoost = 0f; @@ -3320,8 +3304,8 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ItemType())); Projectile.NewProjectile(source, Player.Center - Vector2.UnitY * 45f, Vector2.Zero, ProjectileType(), 0, 0f); SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/AscendantActivate")); - ascendantInsigniaCooldown = 2400; - ascendantInsigniaBuffTime = 240; //4 seconds + ascendantInsigniaCooldown = AscendantInsignia.AbilityCooldown; + ascendantInsigniaBuffTime = AscendantInsignia.AbilityDuration; } int numOfBlobs = Player.ownedProjectileCounts[ProjectileType()]; @@ -3400,8 +3384,7 @@ namespace CalamityMod.CalPlayer } if (CalamityKeybinds.AngelicAllianceHotKey.JustPressed && angelicAlliance && Main.myPlayer == Player.whoAmI && !divineBless && !Player.HasCooldown(Cooldowns.DivineBless.ID)) { - int seconds = CalamityUtils.SecondsToFrames(15f); - Player.AddBuff(BuffType(), seconds, false); + Player.AddBuff(BuffType(), AngelicAlliance.DivineBlessDuration, false); SoundEngine.PlaySound(AngelicAlliance.ActivationSound, Player.Center); // Spawn an archangel for every minion you have @@ -3423,7 +3406,7 @@ namespace CalamityMod.CalPlayer float start = 360f / angelAmt; Projectile.NewProjectile(source, new Vector2((int)(Player.Center.X + (Math.Sin(projIndex * start) * 300)), (int)(Player.Center.Y + (Math.Cos(projIndex * start) * 300))), Vector2.Zero, ProjectileType(), proj.damage / 10, proj.knockBack / 10f, Player.whoAmI, Main.rand.Next(180), projIndex * start); - Player.HealPlayer(2); + Player.HealPlayer(AngelicAlliance.HealPerAngelSpawned); } } if (CalamityKeybinds.SpectralVeilHotKey.JustPressed && spectralVeil && Main.myPlayer == Player.whoAmI && rogueStealth >= rogueStealthMax * 0.25f && @@ -4463,6 +4446,30 @@ namespace CalamityMod.CalPlayer Lighting.AddLight(Player.Center, Light * (0.55f + (oceanCrestTimer * 0.0035f))); } + if (rampartOfDeities) + { + // Ice Barrier buff inherited from Frozen Turtle Shell + if (Player.statLife <= Player.statLifeMax2 * 0.5) + Player.AddBuff(BuffID.IceBarrier, 5); + + // Paladin's Shield application + if (Player.statLife > Player.statLifeMax2 * 0.25f) + { + Player.hasPaladinShield = true; + if (Player.whoAmI != Main.myPlayer && Player.miscCounter % 10 == 0) + { + var localPlayer = Main.LocalPlayer; + if (localPlayer.team == Player.team && Player.team != 0) + { + float teamPlayerXDist = Player.position.X - localPlayer.position.X; + float teamPlayerYDist = Player.position.Y - localPlayer.position.Y; + if ((float)Math.Sqrt(teamPlayerXDist * teamPlayerXDist + teamPlayerYDist * teamPlayerYDist) < 800f) + localPlayer.AddBuff(BuffID.PaladinsShield, 20); + } + } + } + } + // True melee damage from various vanilla equipment placed here. // Titan Glove and ALL upgrades. @@ -4566,8 +4573,7 @@ namespace CalamityMod.CalPlayer (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? SilvaArmor.AccelerationBoost : 0f) + (getSandCloakAccelBoost ? 0.75f : 0f) + - (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + - (ascendantInsignia ? 0.25f : 0f) + // Added to Soaring Insignia's 1.25x multiplier to get 1.5x + (ascendantInsignia ? (AscendantInsignia.AccelerationBoost - 0.25f) : 0f) + // Subtracted 0.25 provided by Soaring Insignia (statisNinjaBelt ? 0.6f : 0f) + (statisVoidSash ? 0.85f : 0f) + (blueCandle ? WeightlessCandle.AccelerationBoost : 0f) + @@ -4586,7 +4592,6 @@ namespace CalamityMod.CalPlayer (dragonScales ? 0.1f : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? SilvaArmor.AccelerationBoost : 0f) + - (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + //(exaltedKillMode ? 0.4f : devilsDevastationKillMode ? 0.7f : 0) + (hasteLevel * 0.05f); diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index afe9da6ed0..6ecc8fd1d2 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1014,7 +1014,7 @@ namespace CalamityMod.CalPlayer bool isReducedTrap = (proj.trap || proj.type == ProjectileID.RollingCactusSpike || proj.type == ProjectileID.Landmine) && !isIgnoredTrap; if (Player.Calamity().trapProtection && isReducedTrap) - modifiers.SourceDamage *= 0.35f; + modifiers.SourceDamage *= (1f - ArchaicPowder.TrapDamageReduction); // Reduce damage dealt by rainbow trails if (proj.type == ProjectileID.HallowBossLastingRainbow) @@ -2261,7 +2261,7 @@ namespace CalamityMod.CalPlayer if (aquaticHeartIce) { SoundEngine.PlaySound(SoundID.NPCDeath7, Player.Center); - Player.AddCooldown(AquaticHeartIceShield.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(AquaticHeartIceShield.ID, AquaticHeart.IceShieldCooldown); for (int d = 0; d < 10; d++) { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 20bce9b8de..b6d1b0e46a 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; +using CalamityMod.DataStructures; using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; @@ -117,8 +118,8 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(crushDepth, 18, purity); ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity); ApplyDoTDebuff(shadowflame, 30, purity); - ApplyDoTDebuff(brimstoneFlames, abaddon ? 15 : 30, purity); - ApplyDoTDebuff(plague, alchFlask ? 15 : 30, purity); + ApplyDoTDebuff(brimstoneFlames, (int)MathF.Round(30 * (abaddon ? (1f - Abaddon.BrimstoneFlamesReduction) : 1f)), purity); + ApplyDoTDebuff(plague, (int)MathF.Round(30 * (abaddon ? (1f - AlchemicalFlask.PlagueReduction) : 1f)), purity); ApplyDoTDebuff(vHex, 30); // Has other effects ApplyDoTDebuff(searingLava, 30); ApplyDoTDebuff(demonicFlames, 33, purity); // Never inflicted on the player @@ -307,9 +308,9 @@ namespace CalamityMod.CalPlayer int buffID = Player.buffType[l]; if (Player.buffTime[l] <= 2) continue; - bool shouldHalveDuration = CalamityBuffSets.IsSicknessDebuff[buffID]; + bool shouldHalveDuration = BuffDatasets.DebuffDataset[buffID].SicknessDebuffScaling > 0; if (livingDewHalveDebuffs) - shouldHalveDuration |= CalamityBuffSets.IsFireDebuff[buffID]; + shouldHalveDuration |= BuffDatasets.DebuffDataset[buffID].HeatDebuffScaling > 0; if (purity) shouldHalveDuration |= CalamityBuffSets.IsDebuff[buffID]; @@ -320,7 +321,7 @@ namespace CalamityMod.CalPlayer if (divineBless) { - if (Player.whoAmI == Main.myPlayer && Player.miscCounter % 15 == 0) // Flat 4 health per second + if (Player.whoAmI == Main.myPlayer && Player.miscCounter % AngelicAlliance.DivineBlessFramesPerHeal == 0) // Flat 4 health per second { if (!noLifeRegen) Player.HealPlayer(1, HealTextType.None); @@ -355,7 +356,7 @@ namespace CalamityMod.CalPlayer } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(l => CalamityBuffSets.IsFireDebuff[l])) + if (permafrostsConcoction && Player.buffType.Any(l => BuffDatasets.DebuffDataset[l].HeatDebuffScaling > 0)) { if (Player.lifeRegenTime < 900) Player.lifeRegenTime = 900; @@ -368,7 +369,7 @@ namespace CalamityMod.CalPlayer { float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / (float)Player.statLifeMax2; //Ambrosial Ampule and ooze give between 2 and 5 hp/s - int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp(4f, 10f, missingLifeRatio));//Rounding is needed for it to ever actually give +5 hp/s, as the integer conversion would otherwise floor it. + int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp(RadiantOoze.MinRegenBoost, RadiantOoze.MaxRegenBoost, missingLifeRatio));//Rounding is needed for it to ever actually give +5 hp/s, as the integer conversion would otherwise floor it. Player.lifeRegen += lifeRegenToGive; radiantOozeRegen += lifeRegenToGive / 2f; purityRegen += lifeRegenToGive / 2f; @@ -574,7 +575,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += HallowedRune.RegenBoost; if (affliction || afflicted) - Player.lifeRegen += 1; + Player.lifeRegen += Affliction.RegenBoost; if (trinketOfChi || chiRegen) Player.lifeRegen += 2; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 05ec0a8a49..7fe500b940 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2710,19 +2710,12 @@ namespace CalamityMod.CalPlayer Player.jumpSpeedBoost += TheAbsorber.JumpSpeedBoost; } - // Nimble Bounder bonus - if (nimbleBounderBoost) - { - Player.moveSpeed += NimbleBounder.MoveSpeedBoost; - Player.jumpSpeedBoost += NimbleBounder.JumpSpeedBoost; - } - // Affliction bonus if (affliction || afflicted) { - Player.endurance += 0.07f; - Player.statDefense += 9; - Player.GetDamage() += 0.1f; + Player.endurance += Affliction.DamageReductionBoost; + Player.statDefense += Affliction.DefenseBoost; + Player.GetDamage() += Affliction.DamageBoost; } float[] light = new float[3]; @@ -2945,8 +2938,8 @@ namespace CalamityMod.CalPlayer if (!ascendantInsignia && ascendantInsigniaBuffTime > 0) { ascendantInsigniaBuffTime = 0; - ascendantInsigniaCooldown = 2400; - Player.AddCooldown(AscendEffect.ID, 2400); + ascendantInsigniaCooldown = AscendantInsignia.AbilityCooldown; + Player.AddCooldown(AscendEffect.ID, AscendantInsignia.AbilityCooldown); } if (!brimflameSet && brimflameFrenzy) @@ -3002,7 +2995,7 @@ namespace CalamityMod.CalPlayer { divineBless = false; Player.ClearBuff(ModContent.BuffType()); - Player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60)); + Player.AddCooldown(Cooldowns.DivineBless.ID, AngelicAlliance.DivineBlessCooldown); } // Armageddon's Dodge Disable feature puts Shadow Dodge/Holy Protection on permanent cooldown @@ -3313,15 +3306,14 @@ namespace CalamityMod.CalPlayer // Aquatic Emblem bonus if (aquaticEmblem) { - if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet && - !Player.mount.Active) + if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet && !Player.mount.Active) { - if (aquaticBoost > 0f) + if (aquaticBoost < AquaticEmblem.TimeToReachMaxBoost) { - aquaticBoost -= 2f; - if (aquaticBoost <= 0f) + aquaticBoost++; + if (aquaticBoost > AquaticEmblem.TimeToReachMaxBoost) { - aquaticBoost = 0f; + aquaticBoost = AquaticEmblem.TimeToReachMaxBoost; if (Main.netMode == NetmodeID.MultiplayerClient) NetMessage.SendData(MessageID.PlayerStealth, -1, -1, null, Player.whoAmI, 0f, 0f, 0f, 0, 0, 0); } @@ -3329,18 +3321,18 @@ namespace CalamityMod.CalPlayer } else { - aquaticBoost += 2f; - if (aquaticBoost > AquaticBoostMax) - aquaticBoost = AquaticBoostMax; + aquaticBoost--; + if (aquaticBoost <= 0f) + aquaticBoost = 0f; if (Player.mount.Active) - aquaticBoost = AquaticBoostMax; + aquaticBoost = 0f; } - Player.statDefense += (int)((1f - aquaticBoost * 0.0001f) * 20f); - Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; + Player.statDefense += (int)Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxDefenseBoost); + Player.moveSpeed -= Utils.Remap(aquaticBoost, 0, AquaticEmblem.TimeToReachMaxBoost, 0, AquaticEmblem.MaxMoveSpeedReduction); } else - aquaticBoost = AquaticBoostMax; + aquaticBoost = 0f; if (Player.HeldItem.type == ModContent.ItemType() && Player.StandingStill(0.1f)) { @@ -3709,18 +3701,6 @@ namespace CalamityMod.CalPlayer if (Player.HeldItem.type != ModContent.ItemType()) evilSmasherBoost = 0; } - if (searedPanCounter > 0) - { - if (Player.HeldItem.type != ModContent.ItemType()) - { - searedPanCounter = 0; - searedPanTimer = 0; - } - else if (searedPanTimer < SearedPan.ConsecutiveHitOpening) - searedPanTimer++; - else - searedPanCounter = 0; - } // Flight time boosts double flightTimeMult = 1D + @@ -3731,8 +3711,7 @@ namespace CalamityMod.CalPlayer (soaring ? SoaringPotion.FlightBoost : 0D) + (prismaticGreaves ? PrismaticGreaves.FlightTimeBoost : 0D) + (plagueReaper ? PlagueReaperMask.SetBonusFlightTimeBoost : 0D) + - (ascendantInsignia ? 0.17 : 0D) + // Added to soaring insignia's flight to get 50% - (Player.empressBrooch ? 0.33 : 0D) + + (ascendantInsignia ? AscendantInsignia.FlightTimeBoost : Player.empressBrooch ? 0.33D : 0D) + externalFlightTimeMultBoost; if (community) @@ -3976,10 +3955,9 @@ namespace CalamityMod.CalPlayer if (ascendantInsignia && ascendantInsigniaBuffTime > 0) { - ascendantTrail = true; infiniteFlight = true; if (ascendantInsigniaBuffTime == 1) - Player.AddCooldown(AscendEffect.ID, 2400); + Player.AddCooldown(AscendEffect.ID, AscendantInsignia.AbilityCooldown); ascendantInsigniaBuffTime--; } @@ -4355,7 +4333,7 @@ namespace CalamityMod.CalPlayer angelicActivate = -1; if (angelicActivate == 1) - Player.AddCooldown(Cooldowns.DivineBless.ID, CalamityUtils.SecondsToFrames(60)); + Player.AddCooldown(Cooldowns.DivineBless.ID, AngelicAlliance.DivineBlessCooldown); } if (theBee && Player.statLife >= Player.statLifeMax2 && (!HasAnyEnergyShield || TotalEnergyShielding >= TotalMaxShieldDurability)) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 90d305f192..f409370f5c 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -202,11 +202,11 @@ namespace CalamityMod.CalPlayer // Arc Flash Ring lightning strike (Remember to change the one for projectile hits if applicable when you change this one!) // This one has a lot less limits than the projectile one, but that's because vanilla broadsword code is limiting (wow so surprising) - bool spawnChance = (Main.rand.Next(0, 100) < 6); + bool spawnChance = (Main.rand.Next(100) < ArcFlashRing.LightningSpawnPercent); if (arcFlashRing && spawnChance) { var source = item.GetSource_FromThis(); - int damage = (int)(((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) + int damage = (int)(((hit.Damage * ArcFlashRing.LightningDamageMult) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) Projectile bolt = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); bolt.DamageType = hit.DamageType; @@ -1216,18 +1216,15 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), TitanHeartMask.OnHitDebuffDuration); } } - if (summon) + if (summon && !whip) { - if (pSoulArtifact && !profanedCrystal) + if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) + target.AddBuff(BuffType(), 600); + else if (pSoulArtifact) target.AddBuff(BuffType(), 300); - if (profanedCrystal && (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) - { - target.AddBuff(BuffType(), 600); - } - if (divineBless) - target.AddBuff(BuffType(), 60); + target.AddBuff(BuffType(), AngelicAlliance.BanishingFireDuration); if (shadowMinions) target.AddBuff(BuffID.ShadowFlame, 180); @@ -1256,8 +1253,6 @@ namespace CalamityMod.CalPlayer target.AddBuff(BuffType(), 120); target.AddBuff(BuffType(), 120); } - if (voidOfExtinction) - CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); if (frostFlare) CalamityUtils.Inflict246DebuffsNPC(target, BuffID.Frostburn2); if (omegaBlueChestplate) diff --git a/Cooldowns/PanaceaCooldown.cs b/Cooldowns/PanaceaCooldown.cs new file mode 100644 index 0000000000..cc2e416f71 --- /dev/null +++ b/Cooldowns/PanaceaCooldown.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using Terraria.Audio; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class PanaceaCooldown : CooldownHandler + { + public static new string ID => "Panacea"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/PanaceaCooldown"; + public override Color OutlineColor => new Color(122, 198, 255); + public override Color CooldownStartColor => new Color(0, 128, 255); + public override Color CooldownEndColor => new Color(0, 255, 255); + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Custom/AbilitySounds/PotionSicknessOver"); + } +} diff --git a/Cooldowns/PanaceaCooldown.png b/Cooldowns/PanaceaCooldown.png new file mode 100644 index 0000000000..290132735c Binary files /dev/null and b/Cooldowns/PanaceaCooldown.png differ diff --git a/Cooldowns/PanaceaCooldownOutline.png b/Cooldowns/PanaceaCooldownOutline.png new file mode 100644 index 0000000000..f31edcf0b4 Binary files /dev/null and b/Cooldowns/PanaceaCooldownOutline.png differ diff --git a/Cooldowns/PanaceaCooldownOverlay.png b/Cooldowns/PanaceaCooldownOverlay.png new file mode 100644 index 0000000000..7d72fd3769 Binary files /dev/null and b/Cooldowns/PanaceaCooldownOverlay.png differ diff --git a/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index f663064384..e468aef941 100644 --- a/DataStructures/DebuffData.cs +++ b/DataStructures/DebuffData.cs @@ -23,6 +23,7 @@ namespace CalamityMod.DataStructures BuffID.CursedInferno, DebuffData.CursedInferno, BuffID.ShadowFlame, DebuffData.Shadowflame, BuffID.Daybreak, DebuffData.Daybroken, + BuffID.Burning, DebuffData.Burning, BuffID.Frostburn, DebuffData.Frostburn, BuffID.Frostburn2, DebuffData.Frostbite, BuffID.Poisoned, DebuffData.Poisoned, @@ -378,6 +379,11 @@ namespace CalamityMod.DataStructures HeatDebuffScaling = 1, NPCLifeRegenMethod = DaybrokenRegen }; + // Provided purely to classify it as a heat debuff + public static DebuffData Burning = new DebuffData() + { + HeatDebuffScaling = 1 + }; public static DebuffData Frostburn = new DebuffData() { EnemyLostRegen = 16, diff --git a/Dusts/DiamondDust.cs b/Dusts/DiamondDust.cs index 501f5b7643..3b34857b02 100644 --- a/Dusts/DiamondDust.cs +++ b/Dusts/DiamondDust.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -7,7 +9,16 @@ namespace CalamityMod.Dusts { public class DiamondDust : ModDust { + public static Asset GlowDiamond { get; private set; } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (!Main.dedServ) + GlowDiamond = ModContent.Request("CalamityMod/Particles/SquareRotated"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -38,26 +49,51 @@ namespace CalamityMod.Dusts return false; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; - // dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true); Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp)); // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); if (!dust.noLight) { for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0); } return false; } } + + public class DiamondDustPixelated : DiamondDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts); + return false; + } + + public static void DrawPixelated(Dust dust) + { + // dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash + float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true); + Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp)); + + // Glow Orb + Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.spriteBatch.Draw(GlowDiamond.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, GlowDiamond.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0); + } + } + } } diff --git a/Dusts/LightDust.cs b/Dusts/LightDust.cs index d0f83ba587..6e5338861a 100644 --- a/Dusts/LightDust.cs +++ b/Dusts/LightDust.cs @@ -1,6 +1,9 @@ using System; +using CalamityMod.Enums; +using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -8,6 +11,19 @@ namespace CalamityMod.Dusts { public class LightDust : ModDust { + public static Asset SolidCircle { get; private set; } + + public static Asset BloomCircle { get; private set; } + + public override void Load() + { + if (Main.dedServ) + return; + + SolidCircle = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle"); + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -28,21 +44,37 @@ namespace CalamityMod.Dusts return true; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); if (!dust.noLight) - { - Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); - } + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); return false; } } + + public class LightDustPixelated : LightDust + { + public override string Texture => "CalamityMod/Dusts/LightDust"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + // Glow Orb + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + } + } } diff --git a/Dusts/SquareDust.cs b/Dusts/SquareDust.cs index 054b05ad37..7c25502b6a 100644 --- a/Dusts/SquareDust.cs +++ b/Dusts/SquareDust.cs @@ -1,6 +1,8 @@ using System; +using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -8,7 +10,16 @@ namespace CalamityMod.Dusts { public class SquareDust : ModDust { + public static Asset GlowSquare { get; private set; } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (!Main.dedServ) + GlowSquare = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -42,22 +53,44 @@ namespace CalamityMod.Dusts } public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; - Vector2 squash = Vector2.One; // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0f); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0f); if (!dust.noLight) { for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0f); } return false; } } + + public class SquareDustPixelated : SquareDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + Vector2 squash = Vector2.One; + + // Glow Orb + Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0f); + if (dust.alpha < 1) + Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.095f, SpriteEffects.None, 0f); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.spriteBatch.Draw(GlowSquare.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowSquare.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0f); + } + } + } } diff --git a/Dusts/SquashDust.cs b/Dusts/SquashDust.cs index 5894cedb1b..8adfb2beaa 100644 --- a/Dusts/SquashDust.cs +++ b/Dusts/SquashDust.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -7,7 +9,21 @@ namespace CalamityMod.Dusts { public class SquashDust : ModDust { + public static Asset SolidCircle { get; private set; } + + public static Asset BloomCircle { get; private set; } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (Main.dedServ) + return; + + SolidCircle = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle"); + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -37,24 +53,45 @@ namespace CalamityMod.Dusts return false; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); if (!dust.noLight) { - Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); } return false; } } + + public class SquashDustPixelated : SquashDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + + // Glow Orb + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + } + } } diff --git a/Dusts/SquashDustHollow.cs b/Dusts/SquashDustHollow.cs index 9378128784..ec82d5aa67 100644 --- a/Dusts/SquashDustHollow.cs +++ b/Dusts/SquashDustHollow.cs @@ -1,5 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -7,7 +9,16 @@ namespace CalamityMod.Dusts { public class SquashDustHollow : ModDust { + public static Asset BloomRing { get; private set; } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (!Main.dedServ) + BloomRing = ModContent.Request("CalamityMod/Particles/BloomRing"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -36,25 +47,49 @@ namespace CalamityMod.Dusts return false; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomRing").Value; - // dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn); // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); if (!dust.noLight) { for (int i = 0; i < 2; i++) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); } return false; } } + + public class SquashDustHollowPixelated : SquashDustHollow + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + // dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash + Vector2 squash = Vector2.Lerp(new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)), Vector2.One, dust.fadeIn); + + // Glow Orb + Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0); + if (!dust.noLight) + { + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(BloomRing.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomRing.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + } + } + } } diff --git a/Dusts/SquashDustTileTouch.cs b/Dusts/SquashDustTileTouch.cs index 0884d87cb4..8b994b462d 100644 --- a/Dusts/SquashDustTileTouch.cs +++ b/Dusts/SquashDustTileTouch.cs @@ -1,13 +1,15 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Systems.Graphic.PixelationSystem; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Dusts { - public class SquashDustTileTouch : ModDust + public class SquashDustTileTouch : SquashDust { public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -16,12 +18,14 @@ namespace CalamityMod.Dusts public override bool Update(Dust dust) { bool touchedTiles = false; - int size = (int)(2); + int size = 2; + if (Collision.SolidCollision(dust.position, size, size)) { touchedTiles = true; dust.velocity = Vector2.Zero; } + float fadeSpeed = (dust.fadeIn + 1); // For this dust, fadeIn is used to increase the power of gravity if it's active, otherwise it makes it's lifetime change dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2; dust.velocity *= 0.96f; @@ -45,24 +49,30 @@ namespace CalamityMod.Dusts return false; } + } + + public class SquashDustTileTouchPixelated : SquashDustTileTouch + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts); + return false; + } + private static void DrawPixelated(Dust dust) + { Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.04f, SpriteEffects.None, 0); if (!dust.noLight) { - Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, squash * dust.scale * 0.075f, SpriteEffects.None, 0); } - return false; } } } diff --git a/Dusts/UnstableDust.cs b/Dusts/UnstableDust.cs index ee9cbf0fce..82f42fbfb5 100644 --- a/Dusts/UnstableDust.cs +++ b/Dusts/UnstableDust.cs @@ -1,6 +1,8 @@ using System; +using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -8,7 +10,16 @@ namespace CalamityMod.Dusts { public class UnstableDust : ModDust { + public static Asset GlowStar { get; private set; } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void Load() + { + if (!Main.dedServ) + GlowStar = ModContent.Request("CalamityMod/Particles/FullStar"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -41,23 +52,45 @@ namespace CalamityMod.Dusts return false; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/FullStar").Value; - Vector2 squash = new Vector2(0.4f, 1); float texScaling = 6; - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0); if (!dust.noLight) { - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0); + Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0); } return false; } } + + public class UnstableDustPixelated : UnstableDust + { + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), Enums.GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + Vector2 squash = new Vector2(0.4f, 1); + float texScaling = 6; + + Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.1f * texScaling, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.04f * texScaling, SpriteEffects.None, 0); + if (!dust.noLight) + { + Main.spriteBatch.Draw(GlowStar.Value, dust.position - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.3f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, GlowStar.Size() * 0.5f, squash * dust.scale * 0.025f * texScaling, SpriteEffects.None, 0); + } + } + } } diff --git a/Dusts/VoidDust.cs b/Dusts/VoidDust.cs index 793f7b826d..e66a8f3bf4 100644 --- a/Dusts/VoidDust.cs +++ b/Dusts/VoidDust.cs @@ -1,6 +1,9 @@ using System; +using CalamityMod.Enums; +using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -8,6 +11,19 @@ namespace CalamityMod.Dusts { public class VoidDust : ModDust { + public static Asset SolidCircle { get; private set; } + + public static Asset BloomCircle { get; private set; } + + public override void Load() + { + if (Main.dedServ) + return; + + SolidCircle = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle"); + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -28,20 +44,41 @@ namespace CalamityMod.Dusts return true; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; if (!dust.noLight) { - Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; // Glow Orb - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); } - Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); return false; } } + + public class VoidDustPixelated : VoidDust + { + public override string Texture => "CalamityMod/Dusts/VoidDust"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + if (!dust.noLight) + { + // Glow Orb + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.1f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.04f, SpriteEffects.None, 0); + } + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + } + } } diff --git a/Dusts/VoidDustInverted.cs b/Dusts/VoidDustInverted.cs index d5df7d199f..4c30aec8d8 100644 --- a/Dusts/VoidDustInverted.cs +++ b/Dusts/VoidDustInverted.cs @@ -1,6 +1,9 @@ using System; +using CalamityMod.Enums; +using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ModLoader; @@ -8,6 +11,22 @@ namespace CalamityMod.Dusts { public class VoidDustInverted : ModDust { + public static Asset SolidCircle { get; private set; } + + public static Asset BloomCircle { get; private set; } + + public static Asset SmallBloomCircle { get; private set; } + + public override void Load() + { + if (Main.dedServ) + return; + + SolidCircle = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle"); + BloomCircle = ModContent.Request("CalamityMod/Particles/BloomCircle"); + SmallBloomCircle = ModContent.Request("CalamityMod/Particles/SmallBloom"); + } + public override void OnSpawn(Dust dust) { dust.scale *= Main.rand.NextFloat(0.8f, 1f); @@ -28,23 +47,39 @@ namespace CalamityMod.Dusts return true; } + public override bool PreDraw(Dust dust) { - Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f); - - Texture2D solidCenter = ModContent.Request("CalamityMod/ExtraTextures/BasicCircle").Value; - Texture2D bloom2 = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; - - Texture2D bloom = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; - - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0); if (dust.alpha < 1) - Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(bloom2, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom2.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0); if (!dust.noLight) - Main.EntitySpriteDraw(solidCenter, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, solidCenter.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); return false; } } + + public class VoidDustInvertedPixelated : VoidDustInverted + { + public override string Texture => "CalamityMod/Dusts/VoidDustInverted"; + + public override bool PreDraw(Dust dust) + { + PixelationManager.AddPixelatedDrawer((_) => DrawPixelated(dust), GeneralDrawLayer.AfterDusts); + return false; + } + + private static void DrawPixelated(Dust dust) + { + Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * 0.4f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.068f, SpriteEffects.None, 0); + if (dust.alpha < 1) + Main.spriteBatch.Draw(SmallBloomCircle.Value, dust.position - Main.screenPosition, null, Color.Black * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SmallBloomCircle.Size() * 0.5f, dust.scale * 0.057f, SpriteEffects.None, 0); + + Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, dust.scale * 0.07f, SpriteEffects.None, 0); + if (!dust.noLight) + Main.spriteBatch.Draw(SolidCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * 0.75f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, SolidCircle.Size() * 0.5f, dust.scale * 0.075f, SpriteEffects.None, 0); + } + } } diff --git a/Enums/GeneralDrawLayer.cs b/Enums/GeneralDrawLayer.cs new file mode 100644 index 0000000000..319e734f49 --- /dev/null +++ b/Enums/GeneralDrawLayer.cs @@ -0,0 +1,21 @@ +using System; + +namespace CalamityMod.Enums +{ + /// + /// A general collection of points in Terraria's overall draw order that graphical systems in the mod draw to. + /// + [Flags] + public enum GeneralDrawLayer + { + BeforeAllTiles = 0, + BeforeSolidTiles = 1, + BeforeNPCs = 2, + AfterNPCs = 4, + BeforeProjectiles = 8, + AfterProjectiles = 16, + AfterPlayers = 32, + AfterDusts = 64, + AfterEverything = 128, + } +} diff --git a/Gores/ArmoredDigger/ArmoredDiggerBody.png b/Gores/ArmoredDigger/ArmoredDiggerBody.png deleted file mode 100644 index 082eb57526..0000000000 Binary files a/Gores/ArmoredDigger/ArmoredDiggerBody.png and /dev/null differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerBody2.png b/Gores/ArmoredDigger/ArmoredDiggerBody2.png deleted file mode 100644 index a7a22f0697..0000000000 Binary files a/Gores/ArmoredDigger/ArmoredDiggerBody2.png and /dev/null differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerHead.png b/Gores/ArmoredDigger/ArmoredDiggerHead.png deleted file mode 100644 index 7debb48e29..0000000000 Binary files a/Gores/ArmoredDigger/ArmoredDiggerHead.png and /dev/null differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerHead2.png b/Gores/ArmoredDigger/ArmoredDiggerHead2.png deleted file mode 100644 index c1fe479da5..0000000000 Binary files a/Gores/ArmoredDigger/ArmoredDiggerHead2.png and /dev/null differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerTail.png b/Gores/ArmoredDigger/ArmoredDiggerTail.png deleted file mode 100644 index 6a30219a5b..0000000000 Binary files a/Gores/ArmoredDigger/ArmoredDiggerTail.png and /dev/null differ diff --git a/Gores/ArmoredDigger/ArmoredDiggerTail2.png b/Gores/ArmoredDigger/ArmoredDiggerTail2.png deleted file mode 100644 index 616e848530..0000000000 Binary files a/Gores/ArmoredDigger/ArmoredDiggerTail2.png and /dev/null differ diff --git a/Graphics/Metaballs/BigRipMetaball.cs b/Graphics/Metaballs/BigRipMetaball.cs index c78acfa9c5..faee855da9 100644 --- a/Graphics/Metaballs/BigRipMetaball.cs +++ b/Graphics/Metaballs/BigRipMetaball.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -77,7 +78,7 @@ namespace CalamityMod.Graphics.Metaballs // Load the layer asset wrapper. LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/BigRipLayer", AssetRequestMode.ImmediateLoad); } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => new Color(239, 111, 85) * 0.5f; diff --git a/Graphics/Metaballs/BloodBoilerMetaball.cs b/Graphics/Metaballs/BloodBoilerMetaball.cs index 7b253e77ab..42fce30903 100644 --- a/Graphics/Metaballs/BloodBoilerMetaball.cs +++ b/Graphics/Metaballs/BloodBoilerMetaball.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -48,7 +49,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override Color EdgeColor => Color.Red with { A = 0 }; diff --git a/Graphics/Metaballs/BloodBoilerMetaball2.cs b/Graphics/Metaballs/BloodBoilerMetaball2.cs index 323bb8ba1f..2786575f77 100644 --- a/Graphics/Metaballs/BloodBoilerMetaball2.cs +++ b/Graphics/Metaballs/BloodBoilerMetaball2.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -48,7 +49,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override Color EdgeColor => Color.Red with { A = 0 }; diff --git a/Graphics/Metaballs/BloodMetaball.cs b/Graphics/Metaballs/BloodMetaball.cs index 28457126f8..952950e6ce 100644 --- a/Graphics/Metaballs/BloodMetaball.cs +++ b/Graphics/Metaballs/BloodMetaball.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -79,7 +80,7 @@ namespace CalamityMod.Graphics.Metaballs // Load the layer asset wrapper. LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/BloodLayer", AssetRequestMode.ImmediateLoad); } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => new Color(67, 17, 17); diff --git a/Graphics/Metaballs/CalamitasMetaball.cs b/Graphics/Metaballs/CalamitasMetaball.cs index 86bcd3fa23..52e9eeb066 100644 --- a/Graphics/Metaballs/CalamitasMetaball.cs +++ b/Graphics/Metaballs/CalamitasMetaball.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball; namespace CalamityMod.Graphics.Metaballs { @@ -71,7 +71,7 @@ namespace CalamityMod.Graphics.Metaballs // Load the layer asset wrapper. LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/CalamitasLayer", AssetRequestMode.ImmediateLoad); } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => Color.Lerp(Color.Crimson, Color.Black, 0f); diff --git a/Graphics/Metaballs/CataclysmMetaball.cs b/Graphics/Metaballs/CataclysmMetaball.cs index 62131a6df4..59221f3d51 100644 --- a/Graphics/Metaballs/CataclysmMetaball.cs +++ b/Graphics/Metaballs/CataclysmMetaball.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball; namespace CalamityMod.Graphics.Metaballs { @@ -71,7 +71,7 @@ namespace CalamityMod.Graphics.Metaballs // Load the layer asset wrapper. LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/CataclysmLayer", AssetRequestMode.ImmediateLoad); } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => new Color(255,0,229); diff --git a/Graphics/Metaballs/CatastropheMetaball.cs b/Graphics/Metaballs/CatastropheMetaball.cs index 24f54493a0..399af76ad4 100644 --- a/Graphics/Metaballs/CatastropheMetaball.cs +++ b/Graphics/Metaballs/CatastropheMetaball.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball; namespace CalamityMod.Graphics.Metaballs { @@ -73,7 +73,7 @@ namespace CalamityMod.Graphics.Metaballs // Load the layer asset wrapper. LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/CatastropheLayer", AssetRequestMode.ImmediateLoad); } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => new Color(0,255,255); diff --git a/Graphics/Metaballs/DoGDistortionMetaball.cs b/Graphics/Metaballs/DoGDistortionMetaball.cs index 84a32b18ab..260f13a4a1 100644 --- a/Graphics/Metaballs/DoGDistortionMetaball.cs +++ b/Graphics/Metaballs/DoGDistortionMetaball.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Effects; +using CalamityMod.Enums; using CalamityMod.Projectiles.Boss; using CalamityMod.Systems.Graphic; using Microsoft.Xna.Framework; @@ -33,7 +34,7 @@ namespace CalamityMod.Graphics.Metaballs public static List Particles { get; private set; } = []; - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override bool AnythingToDraw => Particles.Count > 0 || CalamityUtils.AnyProjectiles(ModContent.ProjectileType()); diff --git a/Graphics/Metaballs/DragonsBreathMetaball.cs b/Graphics/Metaballs/DragonsBreathMetaball.cs index aba4cc4458..f134656a39 100644 --- a/Graphics/Metaballs/DragonsBreathMetaball.cs +++ b/Graphics/Metaballs/DragonsBreathMetaball.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -68,7 +69,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override void Update() { diff --git a/Graphics/Metaballs/DragonsBreathMetaball2.cs b/Graphics/Metaballs/DragonsBreathMetaball2.cs index 49753e9ebb..bd18795fa2 100644 --- a/Graphics/Metaballs/DragonsBreathMetaball2.cs +++ b/Graphics/Metaballs/DragonsBreathMetaball2.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -68,7 +69,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override void Update() { diff --git a/Graphics/Metaballs/GalaxyMetaball.cs b/Graphics/Metaballs/GalaxyMetaball.cs index 4d93ed1020..feec8791a1 100644 --- a/Graphics/Metaballs/GalaxyMetaball.cs +++ b/Graphics/Metaballs/GalaxyMetaball.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -56,7 +57,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs; public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f); diff --git a/Graphics/Metaballs/GruesomeMetaball.cs b/Graphics/Metaballs/GruesomeMetaball.cs index 0c281d7e5f..348099bcd6 100644 --- a/Graphics/Metaballs/GruesomeMetaball.cs +++ b/Graphics/Metaballs/GruesomeMetaball.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -56,7 +57,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override Color EdgeColor => new(61, 6, 2); diff --git a/Graphics/Metaballs/Metaball.cs b/Graphics/Metaballs/Metaball.cs index ae150455a4..61e90d84a4 100644 --- a/Graphics/Metaballs/Metaball.cs +++ b/Graphics/Metaballs/Metaball.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -33,7 +34,7 @@ namespace CalamityMod.Graphics.Metaballs /// /// The draw layer in which metaballs should be drawn. /// - public abstract MetaballDrawLayer DrawContext + public abstract GeneralDrawLayer DrawLayer { get; } diff --git a/Graphics/Metaballs/MetaballDrawLayer.cs b/Graphics/Metaballs/MetaballDrawLayer.cs deleted file mode 100644 index d061aabe61..0000000000 --- a/Graphics/Metaballs/MetaballDrawLayer.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace CalamityMod.Graphics.Metaballs -{ - public enum MetaballDrawLayer - { - BeforeNPCs, - BeforeProjectiles, - AfterProjectiles, - } -} diff --git a/Graphics/Metaballs/MetaballManager.cs b/Graphics/Metaballs/MetaballManager.cs index 2e7721341b..123e007766 100644 --- a/Graphics/Metaballs/MetaballManager.cs +++ b/Graphics/Metaballs/MetaballManager.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -15,8 +16,6 @@ namespace CalamityMod.Graphics.Metaballs { // Prepare event subscribers. RenderTargetManager.RenderTargetUpdateLoopEvent += PrepareMetaballTargets; - On_Main.DrawProjectiles += DrawMetaballsAfterProjectiles; - On_Main.DrawNPCs += DrawMetaballsBeforeNPCs; } public override void OnModUnload() @@ -86,51 +85,20 @@ namespace CalamityMod.Graphics.Metaballs Main.spriteBatch.End(); } - private void DrawMetaballsAfterProjectiles(On_Main.orig_DrawProjectiles orig, Main self) - { - if (AnyActiveMetaballsAtLayer(MetaballDrawLayer.BeforeProjectiles)) - { - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - DrawMetaballs(MetaballDrawLayer.BeforeProjectiles); - Main.spriteBatch.End(); - } - - orig(self); - - if (AnyActiveMetaballsAtLayer(MetaballDrawLayer.AfterProjectiles)) - { - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - DrawMetaballs(MetaballDrawLayer.AfterProjectiles); - Main.spriteBatch.End(); - } - } - - private void DrawMetaballsBeforeNPCs(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles) - { - if (!behindTiles && AnyActiveMetaballsAtLayer(MetaballDrawLayer.BeforeNPCs)) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - DrawMetaballs(MetaballDrawLayer.BeforeNPCs); - Main.spriteBatch.ExitShaderRegion(); - } - orig(self, behindTiles); - } - /// /// Checks if a metaball of a given layering type is currently in use. This is used to minimize needless restarts when there is nothing to draw. /// /// The metaball layer type to check against. - internal static bool AnyActiveMetaballsAtLayer(MetaballDrawLayer layerType) => - metaballs.Any(m => m.AnythingToDraw && m.DrawContext == layerType); + internal static bool AnyActiveMetaballsAtLayer(GeneralDrawLayer layerType) => + metaballs.Any(m => m.AnythingToDraw && m.DrawLayer == layerType); /// - /// Draws all metaballs of a given . Used for layer ordering reasons. + /// Draws all metaballs of a given . Used for layer ordering reasons. /// /// The layer type to draw with. - public static void DrawMetaballs(MetaballDrawLayer layerType) + internal static void DrawMetaballs(GeneralDrawLayer layerType) { - foreach (Metaball metaball in metaballs.Where(m => m.DrawContext == layerType && m.AnythingToDraw)) + foreach (Metaball metaball in metaballs.Where(m => m.DrawLayer == layerType && m.AnythingToDraw)) { for (int i = 0; i < metaball.LayerTargets.Count; i++) { diff --git a/Graphics/Metaballs/PaintMetaballs.cs b/Graphics/Metaballs/PaintMetaballs.cs index 4773d80083..dfa9472c02 100644 --- a/Graphics/Metaballs/PaintMetaballs.cs +++ b/Graphics/Metaballs/PaintMetaballs.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -64,7 +65,7 @@ namespace CalamityMod.Graphics.Metaballs public override bool AnythingToDraw => Particles.Any(); - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override IEnumerable Layers { diff --git a/Graphics/Metaballs/PhotoMetaball.cs b/Graphics/Metaballs/PhotoMetaball.cs index 7b2d07c007..d831e44c4b 100644 --- a/Graphics/Metaballs/PhotoMetaball.cs +++ b/Graphics/Metaballs/PhotoMetaball.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; -using CalamityMod.Rarities; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -54,7 +54,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public Color sparkColor; public int Time = 0; diff --git a/Graphics/Metaballs/PhotoMetaball2.cs b/Graphics/Metaballs/PhotoMetaball2.cs index cdba6d5b54..59b2c81aa8 100644 --- a/Graphics/Metaballs/PhotoMetaball2.cs +++ b/Graphics/Metaballs/PhotoMetaball2.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; -using CalamityMod.Rarities; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -54,7 +54,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public Color sparkColor; public int Time; diff --git a/Graphics/Metaballs/PhotoMetaball3.cs b/Graphics/Metaballs/PhotoMetaball3.cs index 017697f976..e5ff5c9194 100644 --- a/Graphics/Metaballs/PhotoMetaball3.cs +++ b/Graphics/Metaballs/PhotoMetaball3.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; -using CalamityMod.Rarities; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -47,7 +47,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public Color sparkColor; public int Time = 0; diff --git a/Graphics/Metaballs/PhotoMetaball4.cs b/Graphics/Metaballs/PhotoMetaball4.cs index 114a32bf76..e9c5adc160 100644 --- a/Graphics/Metaballs/PhotoMetaball4.cs +++ b/Graphics/Metaballs/PhotoMetaball4.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; -using CalamityMod.Rarities; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -47,7 +47,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public Color sparkColor; public int Time; diff --git a/Graphics/Metaballs/RancorLavaMetaball.cs b/Graphics/Metaballs/RancorLavaMetaball.cs index 5c26a4ffdb..4999ac66d2 100644 --- a/Graphics/Metaballs/RancorLavaMetaball.cs +++ b/Graphics/Metaballs/RancorLavaMetaball.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Effects; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -44,7 +45,7 @@ namespace CalamityMod.Graphics.Metaballs public override bool AnythingToDraw => Particles.Any(); - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override IEnumerable Layers { diff --git a/Graphics/Metaballs/ScalArenaMetaball.cs b/Graphics/Metaballs/ScalArenaMetaball.cs index a57d474009..c7a1039e74 100644 --- a/Graphics/Metaballs/ScalArenaMetaball.cs +++ b/Graphics/Metaballs/ScalArenaMetaball.cs @@ -1,18 +1,13 @@ using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using CalamityMod.NPCs; +using CalamityMod.Enums; using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.Systems.Mechanic; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball; -using static CalamityMod.Systems.LavaRenderingSystem; namespace CalamityMod.Graphics.Metaballs { @@ -82,7 +77,7 @@ namespace CalamityMod.Graphics.Metaballs WavyLineLayer = ModContent.Request($"CalamityMod/Graphics/Metaballs/ScalArenaLayerWave", AssetRequestMode.ImmediateLoad).Value; } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs; public override Color EdgeColor => SupremeCalamitas.CurrentColor; diff --git a/Graphics/Metaballs/SeekersMetaball.cs b/Graphics/Metaballs/SeekersMetaball.cs index d389e569e5..a0658bb66d 100644 --- a/Graphics/Metaballs/SeekersMetaball.cs +++ b/Graphics/Metaballs/SeekersMetaball.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using static CalamityMod.Graphics.Metaballs.StreamGougeMetaball; namespace CalamityMod.Graphics.Metaballs { @@ -73,7 +73,7 @@ namespace CalamityMod.Graphics.Metaballs // Load the layer asset wrapper. LayerAsset = ModContent.Request($"CalamityMod/Graphics/Metaballs/SeekersLayer", AssetRequestMode.ImmediateLoad); } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => new Color(255,106,0); diff --git a/Graphics/Metaballs/SignusMetaball.cs b/Graphics/Metaballs/SignusMetaball.cs index 7c90c5fda0..c0179a8ebc 100644 --- a/Graphics/Metaballs/SignusMetaball.cs +++ b/Graphics/Metaballs/SignusMetaball.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Graphics.Metaballs @@ -77,7 +77,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs; public override void Load() { if (Main.dedServ) diff --git a/Graphics/Metaballs/StarsmokeMetaball.cs b/Graphics/Metaballs/StarsmokeMetaball.cs index e5f2565257..3bdfa5e22d 100644 --- a/Graphics/Metaballs/StarsmokeMetaball.cs +++ b/Graphics/Metaballs/StarsmokeMetaball.cs @@ -1,12 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; -using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Graphics.Metaballs @@ -80,7 +79,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeNPCs; public override void Load() { if (Main.dedServ) diff --git a/Graphics/Metaballs/StreamGougeMetaball.cs b/Graphics/Metaballs/StreamGougeMetaball.cs index 0f31626192..d13ebc9af9 100644 --- a/Graphics/Metaballs/StreamGougeMetaball.cs +++ b/Graphics/Metaballs/StreamGougeMetaball.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Graphics.Metaballs @@ -56,7 +56,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.AfterProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.AfterProjectiles; public override Color EdgeColor => Color.Lerp(Color.DarkBlue, Color.Black, 0.75f); diff --git a/Graphics/Metaballs/VoidGeneratorMetaball.cs b/Graphics/Metaballs/VoidGeneratorMetaball.cs index 69029411f3..a21754f651 100644 --- a/Graphics/Metaballs/VoidGeneratorMetaball.cs +++ b/Graphics/Metaballs/VoidGeneratorMetaball.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -26,7 +27,7 @@ namespace CalamityMod.Graphics.Metaballs } } - public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeProjectiles; + public override GeneralDrawLayer DrawLayer => GeneralDrawLayer.BeforeProjectiles; public override Color EdgeColor => Color.Lerp(Color.Purple, Color.Black, 0.75f); diff --git a/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs b/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs index 14edbcb506..f40c983f56 100644 --- a/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs +++ b/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework.Graphics; +using CalamityMod.Enums; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Graphics.Primitives { @@ -10,11 +11,11 @@ namespace CalamityMod.Graphics.Primitives /// /// The layer to render the primitive(s) to. /// - PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles; + GeneralDrawLayer LayerToRenderTo => GeneralDrawLayer.BeforeProjectiles; /// /// Render primitives that use pixelation here. /// - void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer); + void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer); } } diff --git a/Graphics/Primitives/PixelationPrimitiveLayer.cs b/Graphics/Primitives/PixelationPrimitiveLayer.cs deleted file mode 100644 index 4f05c51ef2..0000000000 --- a/Graphics/Primitives/PixelationPrimitiveLayer.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace CalamityMod.Graphics.Primitives -{ - /// - /// Controls what layer the renders to. - /// - [Flags] - public enum PixelationPrimitiveLayer - { - BeforeNPCs = 1, - AfterNPCs = 2, - BeforeProjectiles = 4, - AfterProjectiles = 8, - AfterPlayers = 16 - } -} diff --git a/Graphics/Primitives/PrimitivePixelationSystem.cs b/Graphics/Primitives/PrimitivePixelationSystem.cs index 4d2bc635de..36a0e186b8 100644 --- a/Graphics/Primitives/PrimitivePixelationSystem.cs +++ b/Graphics/Primitives/PrimitivePixelationSystem.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Graphics.Primitives public class PrimitivePixelationSystem : ModSystem { #region Fields/Properties + private static ManagedRenderTarget PixelationTarget_BeforeAllTiles; + + private static ManagedRenderTarget PixelationTarget_BeforeSolidTiles; + private static ManagedRenderTarget PixelationTarget_BeforeNPCs; private static ManagedRenderTarget PixelationTarget_AfterNPCs; @@ -20,6 +25,10 @@ namespace CalamityMod.Graphics.Primitives private static ManagedRenderTarget PixelationTarget_AfterPlayers; + private static ManagedRenderTarget PixelationTarget_AfterDusts; + + private static ManagedRenderTarget PixelationTarget_AfterEverything; + private static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.instance.GraphicsDevice, width / 2, height / 2); /// @@ -35,22 +44,38 @@ namespace CalamityMod.Graphics.Primitives #region Loading public override void Load() { - On_Main.CheckMonoliths += DrawToTargets; - On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs; - On_Main.DrawProjectiles += DrawTarget_Projectiles; - On_Main.DrawPlayers_AfterProjectiles += DrawTarget_Players; + if (Main.dedServ) + return; - PixelationTarget_BeforeNPCs = new(true, CreatePixelTarget); - PixelationTarget_AfterNPCs = new(true, CreatePixelTarget); - PixelationTarget_BeforeProjectiles = new(true, CreatePixelTarget); - PixelationTarget_AfterProjectiles = new(true, CreatePixelTarget); - PixelationTarget_AfterPlayers = new(true, CreatePixelTarget); + Main.QueueMainThreadAction(() => + { + PixelationTarget_BeforeAllTiles = new(true, CreatePixelTarget); + PixelationTarget_BeforeSolidTiles = new(true, CreatePixelTarget); + PixelationTarget_BeforeNPCs = new(true, CreatePixelTarget); + PixelationTarget_AfterNPCs = new(true, CreatePixelTarget); + PixelationTarget_BeforeProjectiles = new(true, CreatePixelTarget); + PixelationTarget_AfterProjectiles = new(true, CreatePixelTarget); + PixelationTarget_AfterPlayers = new(true, CreatePixelTarget); + PixelationTarget_AfterDusts = new(true, CreatePixelTarget); + PixelationTarget_AfterEverything = new(true, CreatePixelTarget); + }); + + On_Main.CheckMonoliths += DrawToTargets; + //On_Main.DrawBackgroundBlackFill += DrawTarget_BeforeAllTiles; + //On_Main.DoDraw_Tiles_Solid += DrawTarget_BeforeSolidTiles; + //On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs; + //On_Main.DrawProjectiles += DrawTarget_Projectiles; + //On_Main.DrawPlayers_AfterProjectiles += DrawTarget_Players; + //On_Main.DrawDust += DrawTarget_AfterDusts; + //On_Main.DrawInfernoRings += DrawTarget_AfterEverything; } public override void Unload() { + if (Main.dedServ) + return; + On_Main.CheckMonoliths -= DrawToTargets; - On_Main.DoDraw_DrawNPCsOverTiles -= DrawTarget_NPCs; } #endregion @@ -63,11 +88,15 @@ namespace CalamityMod.Graphics.Primitives return; } + var beforeAllTiles = new List(); + var beforeSolidTiles = new List(); var beforeNPCs = new List(); var afterNPCs = new List(); var beforeProjectiles = new List(); var afterProjectiles = new List(); var afterPlayers = new List(); + var afterDusts = new List(); + var afterEverything = new List(); // Check every active projectile. foreach (Projectile projectile in Main.ActiveProjectiles) @@ -75,14 +104,24 @@ namespace CalamityMod.Graphics.Primitives // If the projectile is active, a mod projectile, and uses the interface, add it to the list of primitives to draw this frame. if (projectile.ModProjectile != null && projectile.ModProjectile is IPixelatedPrimitiveRenderer pixelPrimitiveProjectile) { - if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs)) + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeAllTiles)) + beforeAllTiles.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeSolidTiles)) + beforeSolidTiles.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeNPCs)) beforeNPCs.Add(pixelPrimitiveProjectile); - if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs)) + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterNPCs)) afterNPCs.Add(pixelPrimitiveProjectile); - if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles)) + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeProjectiles)) beforeProjectiles.Add(pixelPrimitiveProjectile); - if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers)) + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterProjectiles)) + afterProjectiles.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterPlayers)) afterPlayers.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterDusts)) + afterDusts.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterEverything)) + afterEverything.Add(pixelPrimitiveProjectile); } } @@ -92,24 +131,38 @@ namespace CalamityMod.Graphics.Primitives // If the NPC is active, a mod NPC, and uses the interface, add it to the list of primitives to draw this frame. if (npc.ModNPC != null && npc.ModNPC is IPixelatedPrimitiveRenderer pixelPrimitiveNPC) { - if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs)) + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeAllTiles)) + beforeAllTiles.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeSolidTiles)) + beforeSolidTiles.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeNPCs)) beforeNPCs.Add(pixelPrimitiveNPC); - if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs)) + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterNPCs)) afterNPCs.Add(pixelPrimitiveNPC); - if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles)) + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.BeforeProjectiles)) beforeProjectiles.Add(pixelPrimitiveNPC); - if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers)) + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterProjectiles)) + afterProjectiles.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterPlayers)) afterPlayers.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterDusts)) + afterDusts.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(GeneralDrawLayer.AfterEverything)) + afterEverything.Add(pixelPrimitiveNPC); } } CurrentlyRendering = true; - DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, PixelationPrimitiveLayer.BeforeNPCs, beforeNPCs); - DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, PixelationPrimitiveLayer.AfterNPCs, afterNPCs); - DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, PixelationPrimitiveLayer.BeforeProjectiles, beforeProjectiles); - DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, PixelationPrimitiveLayer.AfterProjectiles, afterProjectiles); - DrawPrimsToRenderTarget(PixelationTarget_AfterPlayers, PixelationPrimitiveLayer.AfterPlayers, afterPlayers); + DrawPrimsToRenderTarget(PixelationTarget_BeforeAllTiles, GeneralDrawLayer.BeforeAllTiles, beforeAllTiles); + DrawPrimsToRenderTarget(PixelationTarget_BeforeSolidTiles, GeneralDrawLayer.BeforeSolidTiles, beforeSolidTiles); + DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, GeneralDrawLayer.BeforeNPCs, beforeNPCs); + DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, GeneralDrawLayer.AfterNPCs, afterNPCs); + DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, GeneralDrawLayer.BeforeProjectiles, beforeProjectiles); + DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, GeneralDrawLayer.AfterProjectiles, afterProjectiles); + DrawPrimsToRenderTarget(PixelationTarget_AfterPlayers, GeneralDrawLayer.AfterPlayers, afterPlayers); + DrawPrimsToRenderTarget(PixelationTarget_AfterDusts, GeneralDrawLayer.AfterDusts, afterDusts); + DrawPrimsToRenderTarget(PixelationTarget_AfterEverything, GeneralDrawLayer.AfterEverything, afterEverything); Main.instance.GraphicsDevice.SetRenderTarget(null); @@ -117,7 +170,7 @@ namespace CalamityMod.Graphics.Primitives orig(); } - private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, PixelationPrimitiveLayer layer, List pixelPrimitives) + private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, GeneralDrawLayer layer, List pixelPrimitives) { // Swap to the target regardless, in order to clear any leftover content from last frame. Not doing this results in the final frame lingering once it stops rendering. renderTarget.SwapTo(); @@ -135,31 +188,31 @@ namespace CalamityMod.Graphics.Primitives #endregion #region Target Drawing - private void DrawTarget_NPCs(On_Main.orig_DoDraw_DrawNPCsOverTiles orig, Main self) + internal static void DrawTargetScaled(GeneralDrawLayer drawLayer, bool startSpritebatch = true) { - DrawTargetScaled(PixelationTarget_BeforeNPCs); - orig(self); - DrawTargetScaled(PixelationTarget_AfterNPCs); + if (startSpritebatch) + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + Main.spriteBatch.Draw(ReturnAssociatedRenderTarget(drawLayer), Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); + + if (startSpritebatch) + Main.spriteBatch.End(); } - private void DrawTarget_Projectiles(On_Main.orig_DrawProjectiles orig, Main self) + private static RenderTarget2D ReturnAssociatedRenderTarget(GeneralDrawLayer drawLayer) { - DrawTargetScaled(PixelationTarget_BeforeProjectiles); - orig(self); - DrawTargetScaled(PixelationTarget_AfterProjectiles); - } - - private void DrawTarget_Players(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) - { - orig(self); - DrawTargetScaled(PixelationTarget_AfterPlayers); - } - - private static void DrawTargetScaled(ManagedRenderTarget target) - { - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - Main.spriteBatch.Draw(target, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 2f, SpriteEffects.None, 0f); - Main.spriteBatch.End(); + return drawLayer switch + { + GeneralDrawLayer.BeforeAllTiles => PixelationTarget_BeforeAllTiles, + GeneralDrawLayer.BeforeSolidTiles => PixelationTarget_BeforeSolidTiles, + GeneralDrawLayer.BeforeNPCs => PixelationTarget_BeforeNPCs, + GeneralDrawLayer.AfterNPCs => PixelationTarget_AfterNPCs, + GeneralDrawLayer.BeforeProjectiles => PixelationTarget_BeforeProjectiles, + GeneralDrawLayer.AfterProjectiles => PixelationTarget_AfterProjectiles, + GeneralDrawLayer.AfterPlayers => PixelationTarget_AfterPlayers, + GeneralDrawLayer.AfterDusts => PixelationTarget_AfterDusts, + _ => PixelationTarget_AfterEverything + }; } #endregion } diff --git a/Graphics/Primitives/PrimitiveRenderer.cs b/Graphics/Primitives/PrimitiveRenderer.cs index 2fcc1b9acf..84e3d9ca65 100644 --- a/Graphics/Primitives/PrimitiveRenderer.cs +++ b/Graphics/Primitives/PrimitiveRenderer.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Graphics.Primitives /// The third controls how many points are created for the trail, and the fourth determines whether the primitive is subsequently rendered. /// /// If you wish to use pixelation, you MUST make the NPC/Projectile inherit and use instead of predraw..
- /// You can also optionally specify a render layer with . It is by default. + /// You can also optionally specify a render layer with . It is by default. ///
[Autoload(Side = ModSide.Client)] public sealed class PrimitiveRenderer : ModSystem diff --git a/Graphics/Renderers/BaseRenderer.cs b/Graphics/Renderers/BaseRenderer.cs index 8cdfa0ae6d..cb1e3dc5a8 100644 --- a/Graphics/Renderers/BaseRenderer.cs +++ b/Graphics/Renderers/BaseRenderer.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.ModLoader; @@ -14,7 +15,7 @@ namespace CalamityMod.Graphics.Renderers /// /// The layer that the target should be drawn at. /// - public abstract DrawLayer Layer { get; } + public abstract GeneralDrawLayer Layer { get; } /// /// Whether the target should draw and be drawn to this frame. diff --git a/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs index ac4203ca1b..8c2f927e08 100644 --- a/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DeerclopsShadowRenderer.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; +using CalamityMod.Enums; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,7 +12,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers { #region Fields/Properties - public override DrawLayer Layer => DrawLayer.AfterEverything; + public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterEverything; public static NPC Deerclops => Main.npc[NPC.deerclopsBoss]; diff --git a/Graphics/Renderers/CalamityRenderers/DoGDeathAnimationRenderer.cs b/Graphics/Renderers/CalamityRenderers/DoGDeathAnimationRenderer.cs index a00c083af6..fab7fc3d6f 100644 --- a/Graphics/Renderers/CalamityRenderers/DoGDeathAnimationRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DoGDeathAnimationRenderer.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs; +using CalamityMod.Enums; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -18,7 +19,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers private set; } - public override DrawLayer Layer => DrawLayer.NPC; + public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterNPCs; public override bool ShouldDraw => !Main.gameMenu && CalamityDrawParameterNPC.DoGDeathAnimationTimer > 0; diff --git a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs index 3b4b977c61..1e4c5f474e 100644 --- a/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/DyeableShadersRenderer.cs @@ -3,6 +3,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -28,7 +29,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers private static List RenderersToDrawThisFrame; - public override DrawLayer Layer => DrawLayer.Player; + public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterPlayers; // This ignores MainTarget, and handles its own targets, so always call the draw methods. public override bool ShouldDraw => true; diff --git a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs index 409ff05a3e..6599c20f89 100644 --- a/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/HolyInfernoRenderer.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs; +using CalamityMod.Enums; +using CalamityMod.NPCs; using CalamityMod.NPCs.Providence; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,7 +14,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers { #region Fields/Properties - public override DrawLayer Layer => DrawLayer.BeforeTiles; + public override GeneralDrawLayer Layer => GeneralDrawLayer.BeforeAllTiles; public static Providence Provi { diff --git a/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs b/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs index 98871deb15..95ef112087 100644 --- a/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs +++ b/Graphics/Renderers/CalamityRenderers/MiracleBlightRenderer.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Enums; using CalamityMod.NPCs; using CalamityMod.NPCs.ExoMechs.Ares; using Microsoft.Xna.Framework; @@ -42,7 +43,7 @@ namespace CalamityMod.Graphics.Renderers.CalamityRenderers private set; } - public override DrawLayer Layer => DrawLayer.NPC; + public override GeneralDrawLayer Layer => GeneralDrawLayer.AfterNPCs; // Unsure whether its more performant to always draw, or to check if any NPC actually has the debuff. public override bool ShouldDraw => true; diff --git a/Graphics/Renderers/RendererManager.cs b/Graphics/Renderers/RendererManager.cs index a4b0132ce1..338feab7b0 100644 --- a/Graphics/Renderers/RendererManager.cs +++ b/Graphics/Renderers/RendererManager.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -24,16 +25,8 @@ namespace CalamityMod.Graphics.Renderers if (Main.dedServ) return; - Main.QueueMainThreadAction(() => - { - // This hooks here, because doing it any sooner causes the screen position to be a frame behind. - On_Main.CheckMonoliths += DrawToTargets; - On_Main.DrawNPCs += DrawNPCRenderers; - On_Main.DrawProjectiles += DrawProjectileRenderers; - On_Main.DrawPlayers_AfterProjectiles += DrawPlayerRenderers; - On_Main.DrawBackgroundBlackFill += DrawBeforeTileRenderers; - On_Main.DrawInfernoRings += DrawAfterEverythingRenderers; - }); + // This hooks here, because doing it any sooner causes the screen position to be a frame behind. + Main.QueueMainThreadAction(() => On_Main.CheckMonoliths += DrawToTargets); } public override void Unload() @@ -43,24 +36,13 @@ namespace CalamityMod.Graphics.Renderers // Clear the cached renderers, so they can be readded on mod loading when initialized. Renderers.Clear(); - - Main.QueueMainThreadAction(() => - { - // Supposed to be auto-unloaded, but considering TMods poor track record with actually doing this, manually unload them. - On_Main.CheckMonoliths -= DrawToTargets; - On_Main.DrawNPCs -= DrawNPCRenderers; - On_Main.DrawProjectiles -= DrawProjectileRenderers; - On_Main.DrawPlayers_AfterProjectiles -= DrawPlayerRenderers; - On_Main.DrawBackgroundBlackFill -= DrawBeforeTileRenderers; - On_Main.DrawInfernoRings -= DrawAfterEverythingRenderers; - }); } #endregion #region Updating public override void PreUpdateEntities() { - if (Main.netMode is NetmodeID.Server) + if (Main.dedServ) return; foreach (var renderer in Renderers) @@ -69,7 +51,7 @@ namespace CalamityMod.Graphics.Renderers public override void PostUpdateEverything() { - if (Main.netMode is NetmodeID.Server) + if (Main.dedServ) return; foreach (var renderer in Renderers) @@ -78,6 +60,17 @@ namespace CalamityMod.Graphics.Renderers #endregion #region Drawing + internal static void DrawRendererAtLayer(GeneralDrawLayer drawLayer) + { + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); + + var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer == drawLayer); + foreach (var renderer in renderers) + renderer.DrawTarget(Main.spriteBatch); + + Main.spriteBatch.End(); + } + private void DrawToTargets(On_Main.orig_CheckMonoliths orig) { orig(); @@ -106,82 +99,6 @@ namespace CalamityMod.Graphics.Renderers Main.instance.GraphicsDevice.SetRenderTarget(null); } - - private void DrawNPCRenderers(On_Main.orig_DrawNPCs orig, Main self, bool behindTiles) - { - orig(self, behindTiles); - - if (behindTiles) - return; - - var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.NPC); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); - - foreach (var renderer in renderers) - renderer.DrawTarget(Main.spriteBatch); - - Main.spriteBatch.ExitShaderRegion(); - } - - private void DrawProjectileRenderers(On_Main.orig_DrawProjectiles orig, Main self) - { - orig(self); - - var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Projectile); - - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); - - foreach (var renderer in renderers) - renderer.DrawTarget(Main.spriteBatch); - - Main.spriteBatch.End(); - } - - private void DrawPlayerRenderers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) - { - orig(self); - - var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.Player); - - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); - - foreach (var renderer in renderers) - renderer.DrawTarget(Main.spriteBatch); - - Main.spriteBatch.End(); - } - - private void DrawBeforeTileRenderers(On_Main.orig_DrawBackgroundBlackFill orig, Main self) - { - var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.BeforeTiles); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); - - foreach (var renderer in renderers) - renderer.DrawTarget(Main.spriteBatch); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); - - orig(self); - } - - private void DrawAfterEverythingRenderers(On_Main.orig_DrawInfernoRings orig, Main self) - { - var renderers = Renderers.Where(renderer => renderer.ShouldDraw && renderer.Layer is DrawLayer.AfterEverything); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise); - foreach (var renderer in renderers) - renderer.DrawTarget(Main.spriteBatch); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.Transform); - orig(self); - } #endregion } } diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index 3da313883e..80315b5772 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -43,7 +43,6 @@ namespace CalamityMod.ILEditing IL_Main.DoDraw += CustomDoDrawChanges; On_Main.DrawCursor += UseCoolFireCursorEffect; On_Main.SortDrawCacheWorms += DrawFusableParticles; - On_Main.DrawInfernoRings += DrawForegroundParticles; On_TileDrawing.Draw += ClearTilePings; On_CommonCode.ModifyItemDropFromNPC += ColorBlightedGel; On_MoonlordDeathDrama.RequestLight += DisableFlashesWithPhotosensitivityConfig; @@ -59,6 +58,15 @@ namespace CalamityMod.ILEditing IL_TileDrawing.DrawTrees += DrawTreeGlowMask; On_TileDrawing.DrawBasicTile += DrawTreeTrunkAndCactusGlowMask; + // Graphics (GeneralDrawLayer detours) + On_Main.DrawBackgroundBlackFill += GeneralDrawLayer_DrawToLayer_BeforeAllTiles; + On_Main.DoDraw_Tiles_Solid += GeneralDrawLayer_DrawToLayer_BeforeSolidTiles; + On_Main.DoDraw_DrawNPCsOverTiles += GeneralDrawLayer_DrawToLayer_NPCs; + On_Main.DrawProjectiles += GeneralDrawLayer_DrawToLayer_Projectiles; + On_Main.DrawPlayers_AfterProjectiles += GeneralDrawLayer_DrawToLayer_AfterPlayers; + On_Main.DrawDust += GeneralDrawLayer_DrawToLayer_AfterDusts; + On_Main.DrawInfernoRings += GeneralDrawLayer_DrawToLayer_AfterEverything; + // NPC behavior IL_Main.UpdateTime += PermitNighttimeTownNPCSpawning; On_Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate; @@ -87,7 +95,6 @@ namespace CalamityMod.ILEditing On_Item.GetShimmered += ShimmerEffectEdits; On_Player.Teleport += TPOverride; On_TileDrawing.DrawSingleTile += GlowMaskTileRender; - On_Main.DoUpdate_HandleChat += SpawnPunchCard; On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; On_Player.ItemCheck_ReleaseCritter += ReleaseCritterVariant; On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 480634bd66..aa38dfed86 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -8,6 +8,9 @@ using CalamityMod.DataStructures; using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.FluidSimulation; +using CalamityMod.Graphics.Metaballs; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Graphics.Renderers; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.Wulfrum; @@ -26,6 +29,7 @@ using CalamityMod.Projectiles; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; +using CalamityMod.Systems.Graphic.PixelationSystem; using CalamityMod.Systems.Mechanic; using CalamityMod.Tiles; using CalamityMod.Walls; @@ -73,42 +77,6 @@ namespace CalamityMod.ILEditing //private static readonly MethodInfo textureGetValueMethod = typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance); - #region Punch Card Spawning Command - private static void SpawnPunchCard(On_Main.orig_DoUpdate_HandleChat orig) - { - // Any of these conditions should result in normal behaviour - if (!Main.drawingPlayerChat || Main.CurrentInputTextTakerOverride != null || Main.editSign || PlayerInput.UsingGamepad) - { - orig(); - return; - } - - // Allow only one pick up of the card this way per player (also don't give it to dead people) - Player player = Main.LocalPlayer; - if (player.Calamity().spawnedPunchCard || player.dead || !player.active) - { - orig(); - return; - } - - // Find 2 specific sets of text from the live chat box (as the player is typing) - // Gives the item to you and abruptly shuts the chat box down if both parts are found - string text = Main.chatText.ToLower(); - string prefix = "Items.Accessories.PunchCard.SpawnText"; - if ((text.Contains(CalamityUtils.GetTextValue($"{prefix}1")) || text.Contains(CalamityUtils.GetTextValue($"{prefix}1Alt"))) && text.Contains(CalamityUtils.GetTextValue($"{prefix}2"))) - { - player.QuickSpawnItem(Player.GetSource_None(), ModContent.ItemType(), 1); - player.Calamity().spawnedPunchCard = true; - Main.chatText = ""; - Main.ClosePlayerChat(); - Main.chatRelease = false; - SoundEngine.PlaySound(SoundID.MenuClose); - return; - } - orig(); - } - #endregion - #region Dash Fixes and Improvements private static void MakeShieldSlamIFramesConsistent(ILContext il) { @@ -908,6 +876,82 @@ namespace CalamityMod.ILEditing } #endregion + #region GeneralDrawLayer Systems Drawing + private static void GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer drawLayer) + { + Main.spriteBatch.SafeAction(() => + { + Main.spriteBatch.TryEnd(); + GeneralParticleHandler.DrawParticleCollectionsAtSpecificLayer(drawLayer); + }); + + Main.spriteBatch.SafeAction(() => + { + Main.spriteBatch.TryEnd(); + Main.spriteBatch.TryBegin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + MetaballManager.DrawMetaballs(drawLayer); + }); + + Main.spriteBatch.SafeAction(() => + { + Main.spriteBatch.TryEnd(); + PrimitivePixelationSystem.DrawTargetScaled(drawLayer); + }); + + PixelationManager.DrawPixelatedTargets(drawLayer); + + Main.spriteBatch.SafeAction(() => + { + Main.spriteBatch.TryEnd(); + RendererManager.DrawRendererAtLayer(drawLayer); + }); + } + + private static void GeneralDrawLayer_DrawToLayer_BeforeAllTiles(On_Main.orig_DrawBackgroundBlackFill orig, Main self) + { + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeAllTiles); + orig(self); + } + + private static void GeneralDrawLayer_DrawToLayer_BeforeSolidTiles(On_Main.orig_DoDraw_Tiles_Solid orig, Main self) + { + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeSolidTiles); + orig(self); + } + + private static void GeneralDrawLayer_DrawToLayer_NPCs(On_Main.orig_DoDraw_DrawNPCsOverTiles orig, Main self) + { + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeNPCs); + orig(self); + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterNPCs); + } + + private static void GeneralDrawLayer_DrawToLayer_Projectiles(On_Main.orig_DrawProjectiles orig, Main self) + { + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.BeforeProjectiles); + orig(self); + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterProjectiles); + } + + private static void GeneralDrawLayer_DrawToLayer_AfterPlayers(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) + { + orig(self); + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterPlayers); + } + + private static void GeneralDrawLayer_DrawToLayer_AfterDusts(On_Main.orig_DrawDust orig, Main self) + { + orig(self); + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterDusts); + } + + private static void GeneralDrawLayer_DrawToLayer_AfterEverything(On_Main.orig_DrawInfernoRings orig, Main self) + { + orig(self); + GeneralDrawLayer_DrawForSupportedSystems(GeneralDrawLayer.AfterEverything); + } + #endregion + #region General Particle Rendering private static void DrawFusableParticles(On_Main.orig_SortDrawCacheWorms orig, Main self) { @@ -919,11 +963,6 @@ namespace CalamityMod.ILEditing orig(self); } - private static void DrawForegroundParticles(On_Main.orig_DrawInfernoRings orig, Main self) - { - GeneralParticleHandler.DrawAllParticles(Main.spriteBatch); - orig(self); - } #endregion #region Disable Moon Lord Style Flashes With Photosensitivity Config diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index cf3c780050..6f3dfd0ba5 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,7 +10,11 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; + public static int CritBoost = 8; + public static float BrimstoneFlamesReduction = 0.5f; public static int AbaddonExploDamage = 25; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, BrimstoneFlamesReduction.ToPercent()); + public override void SetDefaults() { Item.width = 26; @@ -22,7 +27,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().abaddon = true; - player.GetCritChance() += 8; + player.GetCritChance() += CritBoost; } } } diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs index 40e9b7a0eb..d3135909f2 100644 --- a/Items/Accessories/AbyssalMirror.cs +++ b/Items/Accessories/AbyssalMirror.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,12 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; public bool HasFlavorTooltip => true; + + public static int AggroReduction = 450; + public static float StandingStealthRegenBoost = 0.25f; + public static float MovingStealthRegenBoost = 0.12f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(StandingStealthRegenBoost.ToPercent(), MovingStealthRegenBoost.ToPercent()); + public override void SetDefaults() { Item.width = 30; @@ -23,10 +30,10 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.stealthGenStandstill += 0.25f; - modPlayer.stealthGenMoving += 0.12f; + modPlayer.stealthGenStandstill += StandingStealthRegenBoost; + modPlayer.stealthGenMoving += MovingStealthRegenBoost; modPlayer.abyssalMirror = true; - player.aggro -= 450; + player.aggro -= AggroReduction; } public override void AddRecipes() diff --git a/Items/Accessories/AeroStone.cs b/Items/Accessories/AeroStone.cs index 93676815e0..c1a23a6579 100644 --- a/Items/Accessories/AeroStone.cs +++ b/Items/Accessories/AeroStone.cs @@ -4,6 +4,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,6 +13,9 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; + public static int FlightTimeBoostFlat = 50; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoostFlat.FramesToSeconds()); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(4, 8)); @@ -30,7 +34,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().aeroStone = true; - player.wingTimeMax += 50; + player.wingTimeMax += FlightTimeBoostFlat; } public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) diff --git a/Items/Accessories/Affliction.cs b/Items/Accessories/Affliction.cs index be8a8b917a..1a4317f211 100644 --- a/Items/Accessories/Affliction.cs +++ b/Items/Accessories/Affliction.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,6 +13,14 @@ namespace CalamityMod.Items.Accessories public class Affliction : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int RegenBoost = 1; + public static int MaxLifeBoostPercent = 10; + public static float DamageReductionBoost = 0.07f; + public static int DefenseBoost = 9; + public static float DamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), MaxLifeBoostPercent, DamageReductionBoost.ToPercent(), DefenseBoost, DamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 38; @@ -19,6 +28,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Accessories/AlchemicalFlask.cs b/Items/Accessories/AlchemicalFlask.cs index aea37c1bf8..15197f8af1 100644 --- a/Items/Accessories/AlchemicalFlask.cs +++ b/Items/Accessories/AlchemicalFlask.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Accessories public class AlchemicalFlask : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float PlagueReduction = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(PlagueReduction.ToPercent()); + public override void SetDefaults() { Item.width = 26; diff --git a/Items/Accessories/AlluringBait.cs b/Items/Accessories/AlluringBait.cs index 786435906e..d31ed4b4d0 100644 --- a/Items/Accessories/AlluringBait.cs +++ b/Items/Accessories/AlluringBait.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -7,6 +8,10 @@ namespace CalamityMod.Items.Accessories public class AlluringBait : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int FishingPowerBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBoost); + public override void SetDefaults() { Item.width = 26; @@ -19,7 +24,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().alluringBait = true; - player.fishingSkill += 10; + player.fishingSkill += FishingPowerBoost; } } } diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index ac6c8b1a82..06edff9d56 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,7 +13,9 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; + public static float DamageBoost = 0.05f; public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(18); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent()); public override void SetDefaults() { @@ -21,6 +24,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,7 +33,7 @@ namespace CalamityMod.Items.Accessories modPlayer.rBrain = true; // Handles shaderain cloud spawning on hit modPlayer.aBrain = true; player.brainOfConfusionItem = Item; - player.GetDamage() += 0.05f; + player.GetDamage() += DamageBoost; } public override void AddRecipes() diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index 9036f66442..8cd7145e58 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Accessories public class AmbrosialAmpoule : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MaxLifeBoost = 50; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost, RadiantOoze.MinRegenBoost.ToRegenPerSecond(), RadiantOoze.MaxRegenBoost.ToRegenPerSecond()); + public override void SetDefaults() { Item.width = 20; @@ -23,7 +28,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - player.statLifeMax2 += 50; + player.statLifeMax2 += MaxLifeBoost; if (!player.HasBuff(BuffID.Honey)) player.AddBuff(BuffID.Honey, 2); diff --git a/Items/Accessories/AncientFossil.cs b/Items/Accessories/AncientFossil.cs index 6293e34145..ef73c7adbe 100644 --- a/Items/Accessories/AncientFossil.cs +++ b/Items/Accessories/AncientFossil.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -7,6 +8,10 @@ namespace CalamityMod.Items.Accessories public class AncientFossil : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float MiningSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MiningSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 26; @@ -18,7 +23,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.pickSpeed -= 0.1f; + player.pickSpeed -= MiningSpeedBoost; player.Calamity().aFossil = true; player.Calamity().fallingBlockProtection = true; } diff --git a/Items/Accessories/AngelicAlliance.cs b/Items/Accessories/AngelicAlliance.cs index e1b1cdfc06..e0cc74a488 100644 --- a/Items/Accessories/AngelicAlliance.cs +++ b/Items/Accessories/AngelicAlliance.cs @@ -6,6 +6,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -16,6 +17,18 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/AngelicAllianceActivation"); + // This accessory is insane. wtf. - Iris + public static int MinionSlotBoost = 2; + public static float TotalSummonDamageBoost = 0.15f; // this is partially all-class -- this number represents the whole thing + public static float DamageBoost = 0.08f; + public static int RegenBoostDuringFlight = 4; + public static int DivineBlessDuration = CalamityUtils.SecondsToFrames(15); + public static int DivineBlessCooldown = CalamityUtils.SecondsToFrames(60); + public static int HealPerAngelSpawned = 2; + public static int BanishingFireDuration = CalamityUtils.SecondsToFrames(1); + public static int DivineBlessFramesPerHeal = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, TotalSummonDamageBoost.ToPercent(), DamageBoost.ToPercent(), RegenBoostDuringFlight.ToRegenPerSecond(), DivineBlessDuration.FramesToSeconds(), HealPerAngelSpawned, (60 / (float)DivineBlessFramesPerHeal).Round(), (DivineBlessCooldown / 3600f).Round()); + public override void SetDefaults() { Item.width = 56; @@ -32,11 +45,11 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.angelicAlliance = true; - player.GetDamage() += 0.08f; - player.GetDamage() += 0.07f; //7% + 8% = 15% - player.maxMinions += 2; + player.GetDamage() += DamageBoost; + player.GetDamage() += TotalSummonDamageBoost - DamageBoost; + player.maxMinions += MinionSlotBoost; if (player.wingTime < player.wingTimeMax) - player.lifeRegen += 4; + player.lifeRegen += RegenBoostDuringFlight; } public override void AddRecipes() diff --git a/Items/Accessories/AquaticEmblem.cs b/Items/Accessories/AquaticEmblem.cs index 7171d7c9d2..760c5ba1ef 100644 --- a/Items/Accessories/AquaticEmblem.cs +++ b/Items/Accessories/AquaticEmblem.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -8,6 +9,12 @@ namespace CalamityMod.Items.Accessories public class AquaticEmblem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MaxDefenseBoost = 20; + public static float MaxMoveSpeedReduction = 0.1f; + public static int TimeToReachMaxBoost = CalamityUtils.SecondsToFrames(10); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(TimeToReachMaxBoost.FramesToSeconds(), MaxDefenseBoost, MaxMoveSpeedReduction.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -15,6 +22,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AquaticHeart.cs b/Items/Accessories/AquaticHeart.cs index d8605af83c..be830a8235 100644 --- a/Items/Accessories/AquaticHeart.cs +++ b/Items/Accessories/AquaticHeart.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.BaseItems; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -14,6 +15,8 @@ namespace CalamityMod.Items.Accessories public static float WaterSpeedBoost = 0.15f; public static float IceShieldDamageReductionBoost = 0.2f; + public static int IceShieldCooldown = CalamityUtils.SecondsToFrames(30); + public static LocalizedText FullTooltip => CalamityUtils.GetText("Items.Accessories.AquaticHeart.FullTooltip").WithFormatArgs(WaterSpeedBoost.ToPercent(), IceShieldDamageReductionBoost.ToPercent(), IceShieldCooldown.FramesToSeconds()); public override string AssetPath => "CalamityMod/Items/Accessories/"; public override (EquipType, string, string)[] EquipSlots => @@ -39,7 +42,7 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List tooltips) { - string statusTooltip = this.GetLocalizedValue(NPC.downedBoss3 ? "FullTooltip" : "LockedTooltip"); + string statusTooltip = NPC.downedBoss3 ? FullTooltip.ToString() : this.GetLocalizedValue("LockedTooltip"); tooltips.FindAndReplace("[STATUS]", statusTooltip); } } diff --git a/Items/Accessories/ArcFlashRing.cs b/Items/Accessories/ArcFlashRing.cs index ab5618118d..c2e110cae8 100644 --- a/Items/Accessories/ArcFlashRing.cs +++ b/Items/Accessories/ArcFlashRing.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,11 @@ namespace CalamityMod.Items.Accessories public class ArcFlashRing : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int LightningSpawnPercent = 6; + public static float LightningDamageMult = 4f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(LightningSpawnPercent, LightningDamageMult); + public override void SetDefaults() { Item.width = 56; @@ -18,6 +24,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ArchaicPowder.cs b/Items/Accessories/ArchaicPowder.cs index 452d0a0bcc..bb6f6d5597 100644 --- a/Items/Accessories/ArchaicPowder.cs +++ b/Items/Accessories/ArchaicPowder.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Crags; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Accessories public class ArchaicPowder : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float MiningSpeedBoost = 0.25f; + public static float TrapDamageReduction = 0.65f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MiningSpeedBoost.ToPercent(), TrapDamageReduction.ToPercent()); + public override void SetDefaults() { Item.width = 56; @@ -20,7 +26,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.pickSpeed -= 0.25f; + player.pickSpeed -= MiningSpeedBoost; player.Calamity().aPowder = true; player.Calamity().fallingBlockProtection = true; player.Calamity().trapProtection = true; @@ -29,7 +35,7 @@ namespace CalamityMod.Items.Accessories if (player.chiselSpeed) player.pickSpeed += 0.15f; if (player.Calamity().aFossil) - player.pickSpeed += 0.1f; + player.pickSpeed += AncientFossil.MiningSpeedBoost; } public override void AddRecipes() diff --git a/Items/Accessories/AscendantInsignia.cs b/Items/Accessories/AscendantInsignia.cs index d1d22d9a12..63c682c630 100644 --- a/Items/Accessories/AscendantInsignia.cs +++ b/Items/Accessories/AscendantInsignia.cs @@ -7,6 +7,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -15,6 +16,16 @@ namespace CalamityMod.Items.Accessories public class AscendantInsignia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + // These values override Soaring Insignia's + public static double FlightTimeBoost = 0.5D; + public static float MoveSpeedBoost = 0.15f; + public static float JumpSpeedBoost = 0.75f; // NOTE: Tooltip shares this number with move speed % as they're equal + public static float AccelerationBoost = 0.5f; + public static int AbilityDuration = CalamityUtils.SecondsToFrames(4); + public static int AbilityCooldown = CalamityUtils.SecondsToFrames(40); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FlightTimeBoost.ToPercent(), MoveSpeedBoost.ToPercent(), (1f + AccelerationBoost).Round(), AbilityDuration.FramesToSeconds(), AbilityCooldown.FramesToSeconds()); + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.AscendantInsigniaHotKey); public override void SetDefaults() { @@ -23,6 +34,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.accessory = true; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) @@ -30,8 +42,8 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.ascendantInsignia = true; player.empressBrooch = true; - player.moveSpeed += 0.05f; - player.jumpSpeedBoost += 0.25f; + player.moveSpeed += MoveSpeedBoost; + player.jumpSpeedBoost += JumpSpeedBoost - 0.5f; } public override void AddRecipes() diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index d77f390a86..4bdcef3fcf 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodPact.cs b/Items/Accessories/BloodPact.cs index deb11f3734..739dbe82c0 100644 --- a/Items/Accessories/BloodPact.cs +++ b/Items/Accessories/BloodPact.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Yellow; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 23c4716747..94f56a3c97 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index aeb23ca680..f81bb96832 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 0b60fcda8f..14c7c7566f 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.accessory = true; + Item.expert = true; } public override void UpdateVanity(Player player) diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index 60bd140a45..c9e140fe6e 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 0177e7f04c..66d5d7aa9a 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Items.Accessories Item.defense = 20; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DynamoStemCells.cs b/Items/Accessories/DynamoStemCells.cs index 4885c220ef..730a23181a 100644 --- a/Items/Accessories/DynamoStemCells.cs +++ b/Items/Accessories/DynamoStemCells.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 4cf105a720..39b31a175b 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/FungalClump.cs b/Items/Accessories/FungalClump.cs index b7a5cb048e..b244204a94 100644 --- a/Items/Accessories/FungalClump.cs +++ b/Items/Accessories/FungalClump.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index cb4e4dba87..7185fcd33b 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityCyanBuyPrice; Item.rare = ItemRarityID.Cyan; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/InterstellarStompers.cs b/Items/Accessories/InterstellarStompers.cs index 992c2d701c..2f82b292fb 100644 --- a/Items/Accessories/InterstellarStompers.cs +++ b/Items/Accessories/InterstellarStompers.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; + Item.expert = true; } public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.GravistarSabatonHotkey); diff --git a/Items/Accessories/LeviathanAmbergris.cs b/Items/Accessories/LeviathanAmbergris.cs index 29b3f78836..9b2c6f2057 100644 --- a/Items/Accessories/LeviathanAmbergris.cs +++ b/Items/Accessories/LeviathanAmbergris.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.accessory = true; Item.rare = ItemRarityID.Lime; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ManaPolarizer.cs b/Items/Accessories/ManaPolarizer.cs index 95e449d742..73fc472501 100644 --- a/Items/Accessories/ManaPolarizer.cs +++ b/Items/Accessories/ManaPolarizer.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index 103e179a93..f4cea457eb 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Accessories/OceanCrest.cs b/Items/Accessories/OceanCrest.cs index 9266827683..26d97b69d3 100644 --- a/Items/Accessories/OceanCrest.cs +++ b/Items/Accessories/OceanCrest.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OldDukeScales.cs b/Items/Accessories/OldDukeScales.cs index 0a7355d763..cbe4f9314f 100644 --- a/Items/Accessories/OldDukeScales.cs +++ b/Items/Accessories/OldDukeScales.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RadiantOoze.cs b/Items/Accessories/RadiantOoze.cs index 42a64e5120..6c5173059b 100644 --- a/Items/Accessories/RadiantOoze.cs +++ b/Items/Accessories/RadiantOoze.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -11,6 +12,11 @@ namespace CalamityMod.Items.Accessories public class RadiantOoze : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int MinRegenBoost = 4; + public static int MaxRegenBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinRegenBoost.ToRegenPerSecond(), MaxRegenBoost.ToRegenPerSecond()); + public override void SetDefaults() { Item.width = 20; diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 68bc76f46d..a36913d189 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; @@ -7,7 +6,6 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -81,31 +79,11 @@ namespace CalamityMod.Items.Accessories player.panic = panicNecklaceEnabled; // Large hit iframe effect taken from Seraph Tracers + // IceBarrier and PaladinsShield effects are defined in CalPlayer.PostUpdateEquips modPlayer.rampartOfDeities = true; - // Ice Barrier buff inherited from Frozen Turtle Shell - if (player.statLife <= player.statLifeMax2 * 0.5) - player.AddBuff(BuffID.IceBarrier, 5); - // Knockback immunity inherited from Paladin's Shield player.noKnockback = true; - - // Paladin's Shield application - if (player.statLife > player.statLifeMax2 * 0.25f) - { - player.hasPaladinShield = true; - if (player.whoAmI != Main.myPlayer && player.miscCounter % 10 == 0) - { - int myPlayer = Main.myPlayer; - if (Main.player[myPlayer].team == player.team && player.team != 0) - { - float teamPlayerXDist = player.position.X - Main.player[myPlayer].position.X; - float teamPlayerYDist = player.position.Y - Main.player[myPlayer].position.Y; - if ((float)Math.Sqrt(teamPlayerXDist * teamPlayerXDist + teamPlayerYDist * teamPlayerYDist) < 800f) - Main.player[myPlayer].AddBuff(BuffID.PaladinsShield, 20); - } - } - } } public override void AddRecipes() diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index d48784a538..01a644c84f 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ShieldoftheHighRuler.cs b/Items/Accessories/ShieldoftheHighRuler.cs index 1d7bc17922..c824ecf196 100644 --- a/Items/Accessories/ShieldoftheHighRuler.cs +++ b/Items/Accessories/ShieldoftheHighRuler.cs @@ -24,13 +24,14 @@ namespace CalamityMod.Items.Accessories Item.width = 36; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 30; + Item.damage = 300; Item.knockBack = 9f; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; Item.defense = 4; Item.accessory = true; + Item.expert = true; } public override bool MeleePrefix() => false; diff --git a/Items/Accessories/SpectralVeil.cs b/Items/Accessories/SpectralVeil.cs index c2c749190f..3cc01929cb 100644 --- a/Items/Accessories/SpectralVeil.cs +++ b/Items/Accessories/SpectralVeil.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; + Item.expert = true; } public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.SpectralVeilHotKey); diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index d8c8cc6475..f6b903d3fa 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.rare = RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index 740b72b151..6f41d35859 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Yellow; Item.accessory = true; Item.defense = 10; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheEvolution.cs b/Items/Accessories/TheEvolution.cs index 7f0dff4b8a..5b90135f40 100644 --- a/Items/Accessories/TheEvolution.cs +++ b/Items/Accessories/TheEvolution.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index da800d501b..5981c7e279 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Vanity/PunchCard.cs b/Items/Accessories/Vanity/PunchCard.cs deleted file mode 100644 index 17f7cb92c1..0000000000 --- a/Items/Accessories/Vanity/PunchCard.cs +++ /dev/null @@ -1,39 +0,0 @@ -using CalamityMod.Items.BaseItems; -using CalamityMod.UI; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories.Vanity -{ - public class PunchCard : TransformationAccessory, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public override (EquipType, string, string)[] EquipSlots => - [ - (EquipType.Head, "Shayy", null), - (EquipType.Body, "Shayy", null), - (EquipType.Legs, "Shayy", null), - ]; - - public override void SetDefaults() - { - Item.width = 42; - Item.height = 38; - Item.accessory = true; - Item.value = Item.buyPrice(gold: 10); // Sold by Skeleton Merchant named "Sans Undertale" - Item.rare = ItemRarityID.Purple; - Item.vanity = true; - Item.Calamity().devItem = true; - Item.useAnimation = Item.useTime = 20; - Item.useStyle = ItemUseStyleID.HoldUp; - } - - public override bool? UseItem(Player player) - { - if (Main.myPlayer == player.whoAmI) - PopupGUIManager.FlipActivityOfGUIWithType(typeof(PunchCardGUI)); - return true; - } - } -} diff --git a/Items/Accessories/Vanity/PunchCard.png b/Items/Accessories/Vanity/PunchCard.png deleted file mode 100644 index 51e56a5319..0000000000 Binary files a/Items/Accessories/Vanity/PunchCard.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Shayy_Body.png b/Items/Accessories/Vanity/Shayy_Body.png deleted file mode 100644 index 56fbab6258..0000000000 Binary files a/Items/Accessories/Vanity/Shayy_Body.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Shayy_Head.png b/Items/Accessories/Vanity/Shayy_Head.png deleted file mode 100644 index 25b28f865a..0000000000 Binary files a/Items/Accessories/Vanity/Shayy_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Shayy_Legs.png b/Items/Accessories/Vanity/Shayy_Legs.png deleted file mode 100644 index 270b56183d..0000000000 Binary files a/Items/Accessories/Vanity/Shayy_Legs.png and /dev/null differ diff --git a/Items/Accessories/VoidofCalamity.cs b/Items/Accessories/VoidofCalamity.cs index adbefc4037..0bbdbe026a 100644 --- a/Items/Accessories/VoidofCalamity.cs +++ b/Items/Accessories/VoidofCalamity.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index 33898f8cf4..01b6b8c0ea 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -12,10 +13,10 @@ namespace CalamityMod.Items.Accessories public class VoidofExtinction : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const int FireProjectiles = 2; - public const float FireAngleSpread = 120; - public int FireCountdown = 0; + + public static int CritBoost = 13; public static int VoidExploDamage = 40; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, Abaddon.BrimstoneFlamesReduction.ToPercent()); public override void SetDefaults() { @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.voidOfExtinction = true; modPlayer.abaddon = true; - player.GetCritChance() += 13; + player.GetCritChance() += CritBoost; } } diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index a2ba0a5298..fb469a4bb3 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.accessory = true; + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/SoulofCryogen.cs b/Items/Accessories/Wings/SoulofCryogen.cs index 14aedb1d51..f9f009b438 100644 --- a/Items/Accessories/Wings/SoulofCryogen.cs +++ b/Items/Accessories/Wings/SoulofCryogen.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.height = 26; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; + Item.expert = true; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 2d0096cb73..919e4a0b4c 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -18,10 +18,11 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.defense = 12; // Why did this give 30 defense? This thing really needs a rework lol + Item.defense = 12; Item.accessory = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.rare = ModContent.RarityType(); + Item.expert = true; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 84e7a6ee9f..fe36457f50 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -262,8 +262,8 @@ namespace CalamityMod.Items if (item.type == ItemID.Zenith) item.rare = RarityType(); - // Make most expert items no longer expert because they drop in all modes now. - switch (item.type) + // CIT 16OCT2025: Following overwhelming dev vote, Expert+ drops are NOT available in Classic + /*switch (item.type) { case ItemID.RoyalGel: case ItemID.EoCShield: @@ -288,7 +288,7 @@ namespace CalamityMod.Items case ItemID.LongRainbowTrailWings: item.expert = false; break; - } + }*/ // Allow Souls to be used as ammo for SHPC. if (item.type == ItemID.SoulofLight || item.type == ItemID.SoulofNight || item.type == ItemID.SoulofFlight || item.type == ItemID.SoulofMight || item.type == ItemID.SoulofSight || item.type == ItemID.SoulofFright) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 5a95f46cb8..ac63b0d935 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -369,8 +369,6 @@ namespace CalamityMod.Items nameLine.OverrideColor = ShatteredCommunity.GetRarityColor(); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = ShatteredCommunity.GetRarityColor(); - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(132, 37, 147), new Color(0, 255, 0), 5f); //alternates purple and neon green if (item.type == ModContent.ItemType()) nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(255, 166, 0), new Color(25, 250, 25), 6f); //alternates between emerald green and amber (BanditHueh) if (item.type == ModContent.ItemType()) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 2526913ed4..27102ec65d 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -1260,9 +1260,6 @@ namespace CalamityMod.Items shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); - //Calamity Permanent Upgrades - shimmerTransmute[ItemID.FrogLeg] = ModContent.ItemType(); - // -- Vanilla Boss Shimmer Drop Cycles -- // These cycles follow the order of: Melee Weapons A to Z -> Ranged Weapons A to Z -> Magic Weapons A to Z -> Summon Weapons A to Z -> Rogue Weapons A to Z (Based off of their in-game names) diff --git a/Items/DisgustingMeat.cs b/Items/DisgustingMeat.cs index 9a635b1bec..1f334a6ab9 100644 --- a/Items/DisgustingMeat.cs +++ b/Items/DisgustingMeat.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Items TryDropBoosterItem(player, ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); TryDropBoosterItem(player, ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); TryDropBoosterItem(player, ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); - TryDropBoosterItem(player, ref calPlayer.nimbleBounderBoost, ModContent.ItemType()); } else { diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index d5daec913e..f5cc0493f7 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -30,13 +30,5 @@ namespace CalamityMod.Items.Materials brightness *= Main.essScale; Lighting.AddLight((int)((Item.position.X + (Item.width / 2)) / 16f), (int)((Item.position.Y + (Item.height / 2)) / 16f), 0.75f * brightness, 0f, 0f); } - - public override void AddRecipes() - { - CreateRecipe(10). - AddIngredient(ItemID.BloodMoonStarter). - Register() - .DisableDecraft(); - } } } diff --git a/Items/PermanentBoosters/NimbleBounder.cs b/Items/PermanentBoosters/NimbleBounder.cs deleted file mode 100644 index 04ebe5daa6..0000000000 --- a/Items/PermanentBoosters/NimbleBounder.cs +++ /dev/null @@ -1,71 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.CalPlayer; -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Items.PermanentBoosters -{ - public class NimbleBounder : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - - public static float MoveSpeedBoost = 0.05f; - public static float JumpSpeedBoost = 0.25f; // This also amounts to 5% so the tooltip is shared with movement speed - public static float AccelerationBoost = 0.1f; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), AccelerationBoost.ToPercent()); - - public override void SetDefaults() - { - Item.width = 20; - Item.height = 20; - Item.consumable = true; - Item.useAnimation = Item.useTime = 30; - Item.UseSound = SoundID.Zombie13; // frog sfx - Item.useStyle = ItemUseStyleID.HoldUp; - // Same price as Frog Leg, which is used to shimmer into it - Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); - Item.maxStack = Item.CommonMaxStack; - Item.Calamity().devItem = true; - } - - public static bool HasConsumedBefore(Player player) => player.Calamity().nimbleBounderBoost; - - public override bool CanUseItem(Player player) - { - if (HasConsumedBefore(player)) - { - // Refuse Text can be added on here - return false; - } - - return true; - } - - public override bool? UseItem(Player player) - { - if (player.itemAnimation > 0 && player.itemTime == 0) - { - player.itemTime = Item.useTime; - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.nimbleBounderBoost = true; - } - return true; - } - - // Gives a purple light when dropped as an item - public override void PostUpdate() - { - Lighting.AddLight((int)((Item.position.X + Item.width / 2) / 16f), (int)((Item.position.Y + Item.height / 2) / 16f), 0.51f, 0.14f, 0.57f); - } - - public override void ModifyTooltips(List list) - { - if (HasConsumedBefore(Main.LocalPlayer)) - list.AddConsumedTooltip(); - } - } -} diff --git a/Items/PermanentBoosters/NimbleBounder.png b/Items/PermanentBoosters/NimbleBounder.png deleted file mode 100644 index a329a79c57..0000000000 Binary files a/Items/PermanentBoosters/NimbleBounder.png and /dev/null differ diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.cs b/Items/Placeables/Banners/BurrowerBanner.cs similarity index 77% rename from Items/Placeables/Banners/ArmoredDiggerBanner.cs rename to Items/Placeables/Banners/BurrowerBanner.cs index f035d46d06..0b5abd9db3 100644 --- a/Items/Placeables/Banners/ArmoredDiggerBanner.cs +++ b/Items/Placeables/Banners/BurrowerBanner.cs @@ -1,6 +1,6 @@ namespace CalamityMod.Items.Placeables.Banners { - public class ArmoredDiggerBanner : BaseBanner + public class BurrowerBanner : BaseBanner { public override int BannerTileStyle => 77; public override int BannerKillRequirement => 25; diff --git a/Items/Placeables/Banners/ArmoredDiggerBanner.png b/Items/Placeables/Banners/BurrowerBanner.png similarity index 100% rename from Items/Placeables/Banners/ArmoredDiggerBanner.png rename to Items/Placeables/Banners/BurrowerBanner.png diff --git a/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs b/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs new file mode 100644 index 0000000000..e0225466c7 --- /dev/null +++ b/Items/Placeables/Furniture/Paintings/AmidiasPainting.cs @@ -0,0 +1,19 @@ +using CalamityMod.Tiles.Furniture.Paintings; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Furniture.Paintings +{ + public class AmidiasPainting : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.width = 52; + Item.height = 34; + Item.value = Item.buyPrice(gold: 1); + } + } +} diff --git a/Items/Placeables/Furniture/Paintings/AmidiasPainting.png b/Items/Placeables/Furniture/Paintings/AmidiasPainting.png new file mode 100644 index 0000000000..2d555e093f Binary files /dev/null and b/Items/Placeables/Furniture/Paintings/AmidiasPainting.png differ diff --git a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs index 659e6039de..efd95563bb 100644 --- a/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/Paintings/ThankYouPainting.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings public static IList devList = new List() { - "Altix", + "Altixal", "apotofkoolaid", "AquaSG", "Atalya", @@ -85,7 +85,6 @@ namespace CalamityMod.Items.Placeables.Furniture.Paintings "Raesh", "Sagittariod", "Shade", - "Shayy", "Spider Prov", "StipulateVenus", "Sunny", diff --git a/Items/Placeables/Underworld/Dreadstone.cs b/Items/Placeables/Underworld/Dreadstone.cs deleted file mode 100644 index 1927f25e75..0000000000 --- a/Items/Placeables/Underworld/Dreadstone.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Underworld -{ - public class Dreadstone : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetStaticDefaults() => Item.ResearchUnlockCount = 100; - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); - - } -} diff --git a/Items/Placeables/Underworld/Dreadstone.png b/Items/Placeables/Underworld/Dreadstone.png deleted file mode 100644 index 3ad756b5e3..0000000000 Binary files a/Items/Placeables/Underworld/Dreadstone.png and /dev/null differ diff --git a/Items/Potions/BottledPanacea.cs b/Items/Potions/BottledPanacea.cs new file mode 100644 index 0000000000..347e59c2f1 --- /dev/null +++ b/Items/Potions/BottledPanacea.cs @@ -0,0 +1,67 @@ +using CalamityMod.Cooldowns; +using CalamityMod.DataStructures; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class BottledPanacea : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(84, 215, 254), + new Color(35, 101, 192) + }; + } + + public override void SetDefaults() + { + Item.UseSound = SoundID.Item3; + Item.useStyle = ItemUseStyleID.DrinkLiquid; + Item.useTurn = true; + Item.useTime = Item.useAnimation = 17; + Item.maxStack = Item.CommonMaxStack; + Item.consumable = true; + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; + } + + public override bool CanUseItem(Player player) => !player.HasCooldown(PanaceaCooldown.ID); + + public override bool? UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = Item.useTime; + SoundEngine.PlaySound(SoundID.Item4, player.Center); + + for (int i = Player.MaxBuffs - 1; i >= 0; i--) + { + int buffType = player.buffType[i]; + if (BuffDatasets.DebuffDataset[buffType] is not null && (BuffDatasets.DebuffDataset[buffType].SicknessDebuffScaling > 0 || BuffDatasets.DebuffDataset[buffType].ElectricDebuffScaling > 0)) + player.DelBuff(i); + } + + for (int i = 0; i < 4; i++) + { + Vector2 plusVel = new Vector2(Main.rand.NextFloat(-0.55f, 0.55f), Main.rand.NextFloat(-6f, 0f)); + HealingPlus plus = new(Main.rand.NextVector2FromRectangle(player.Hitbox), Main.rand.NextFloat(1.25f, 1.5f), plusVel, Color.SkyBlue, Color.SkyBlue, 20); + GeneralParticleHandler.SpawnParticle(plus); + } + for (int d = 0; d < 10; d++) + Dust.NewDust(player.position, player.width, player.height, DustID.BlueTorch); + + player.AddCooldown(PanaceaCooldown.ID, CalamityUtils.SecondsToFrames(30)); + } + return true; + } + } +} diff --git a/Items/Potions/BottledPanacea.png b/Items/Potions/BottledPanacea.png new file mode 100644 index 0000000000..8a98e6f6bf Binary files /dev/null and b/Items/Potions/BottledPanacea.png differ diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index e121905f8a..4e1d2b5ad8 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -113,16 +113,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags itemLoot.AddIf(getsGhostBracelet, ModContent.ItemType()); - // Shayy dev item - // Name specific: "Shayy" - static bool getsPunchCard(DropAttemptInfo info) - { - string playerName = info.player.name; - return playerName == "Shayy"; - } - - itemLoot.AddIf(getsPunchCard, ModContent.ItemType()); - // Xyk dev item // Name specific: "Xyk" static bool getsXyksBlessing(DropAttemptInfo info) diff --git a/Items/TreasureBags/RavagerBag.cs b/Items/TreasureBags/RavagerBag.cs index ea20f25040..3acad9e6e1 100644 --- a/Items/TreasureBags/RavagerBag.cs +++ b/Items/TreasureBags/RavagerBag.cs @@ -76,10 +76,8 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ModContent.ItemType(), 20); // Equipment - itemLoot.Add(ItemDropRule.OneFromOptionsNotScalingWithLuck(1, - ModContent.ItemType(), - ModContent.ItemType() - )); + itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType(), 2); itemLoot.AddIf(() => DownedBossSystem.downedProvidence, ModContent.ItemType()); itemLoot.AddRevBagAccessories(); itemLoot.AddIf((info) => CalamityWorld.revenge && !info.player.Calamity().rageBoostTwo, ModContent.ItemType()); diff --git a/Items/Weapons/Magic/Effervescence.cs b/Items/Weapons/Magic/Effervescence.cs index e594491c7e..515cf9267c 100644 --- a/Items/Weapons/Magic/Effervescence.cs +++ b/Items/Weapons/Magic/Effervescence.cs @@ -2,6 +2,7 @@ using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class Effervescence : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/EffervescenceFire") { PitchVariance = 0.1f }; + public static readonly SoundStyle BurstSound = new("CalamityMod/Sounds/Item/EffervescenceBurst") { PitchVariance = 0.1f }; + public static readonly SoundStyle PopSound = new("CalamityMod/Sounds/Item/EffervescencePop") { PitchVariance = 0.1f }; + public override void SetDefaults() { Item.width = 56; @@ -25,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 3.75f; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - Item.UseSound = SoundID.Item95; + Item.UseSound = FireSound; Item.autoReuse = true; Item.shootSpeed = 13f; Item.shoot = ModContent.ProjectileType(); @@ -37,9 +42,8 @@ namespace CalamityMod.Items.Weapons.Magic { for (int randomBullets = 0; randomBullets < 4; randomBullets++) { - float SpeedX = velocity.X + Main.rand.Next(-25, 26) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-25, 26) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.85f, 1.2f); + Projectile.NewProjectile(source, position, newVel, type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Melee/StormSaber.cs b/Items/Weapons/Melee/StormSaber.cs index 4df89ae204..723257bc87 100644 --- a/Items/Weapons/Melee/StormSaber.cs +++ b/Items/Weapons/Melee/StormSaber.cs @@ -14,10 +14,9 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 58; Item.height = 64; - Item.damage = 66; + Item.damage = 50; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 23; - Item.useTime = 23; + Item.useTime = Item.useAnimation = 23; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; @@ -31,17 +30,15 @@ namespace CalamityMod.Items.Weapons.Melee public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, (int)(damage * 0.8), knockback, player.whoAmI); + Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); Vector2 spawnPos = new Vector2(player.MountedCenter.X + Main.rand.Next(-200, 201), player.MountedCenter.Y - 600f); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Vector2 targetPos = Main.MouseWorld + new Vector2(Main.rand.Next(-30, 31), Main.rand.Next(-30, 31)); - velocity = targetPos - spawnPos; - velocity.Normalize(); - velocity *= 13f; + velocity = Utils.DirectionTo(spawnPos, targetPos) * Item.shootSpeed; - Projectile.NewProjectile(source, spawnPos, velocity, type, (int)(damage * 0.6), knockback, player.whoAmI); + Projectile.NewProjectile(source, spawnPos, velocity, type, (int)(damage * 0.75), knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs deleted file mode 100644 index 5ccd6b6204..0000000000 --- a/Items/Weapons/Rogue/SearedPan.cs +++ /dev/null @@ -1,78 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Rogue -{ - public class SearedPan : RogueWeapon - { - public static readonly SoundStyle SmashSound = new("CalamityMod/Sounds/Item/SearedPanSmash"); - - // Attacks must be within 40 frames of each other to count as "consecutive" hits - // This is a little less than double the use time - public static int ConsecutiveHitOpening = 40; - public override void SetDefaults() - { - Item.width = 60; - Item.height = 36; - Item.damage = 2222; - Item.DamageType = RogueDamageClass.Instance; - Item.knockBack = 10f; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = Item.useTime = 25; - Item.reuseDelay = 1; - Item.useLimitPerAnimation = 1; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; - Item.Calamity().donorItem = true; - } - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - float mode = 1f; - if (player.Calamity().searedPanCounter >= 3) - { - player.Calamity().searedPanCounter = 0; - mode = 2f; - } - if (player.Calamity().StealthStrikeAvailable()) - { - player.Calamity().searedPanCounter = 0; - mode = 3f; - } - int pan = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, mode); - if (mode > 1f && pan.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[pan].extraUpdates++; - if (mode == 3f) - Main.projectile[pan].Calamity().stealthStrike = true; - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(5). - AddIngredient(ItemID.LifeCrystal). - AddIngredient(ItemID.Bone, 92). - // AddIngredient(ItemID.Steak). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Rogue/SearedPan.png b/Items/Weapons/Rogue/SearedPan.png deleted file mode 100644 index b5bef1d2cc..0000000000 Binary files a/Items/Weapons/Rogue/SearedPan.png and /dev/null differ diff --git a/Items/Weapons/Summon/RustyBeaconPrototype.cs b/Items/Weapons/Summon/RustyBeaconPrototype.cs index 392bacbe06..b70e451dc8 100644 --- a/Items/Weapons/Summon/RustyBeaconPrototype.cs +++ b/Items/Weapons/Summon/RustyBeaconPrototype.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; + Item.sentry = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index a030e24c03..f765b703cd 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 44; Item.height = 48; - Item.damage = 60; + Item.damage = 66; Item.mana = 10; Item.useAnimation = Item.useTime = 24; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index bed501d96b..eaab8a1256 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -66,7 +66,7 @@ Nanodroid: Ambient lighting, total surveillance, instantaneous repair… With en RepairUnitCritter: These handy little helpers are the reason that Draedon's decades-old labs stand to this day. Though bulkier and less energy efficient than nanodroids, having to take what power they need from the labs' generators, they can easily clean up the dust, though struggle with the rust. //Normal Uncategorized Enemies AeroSlime: Previously mundane slimes that have absorbed trace amounts of draconic essence from the outpour of energy caused by the re-enchantment of Aerialite. They now soar the skies with their newly sprouted wings, reaching heights few of their gelatinous kind ever have. -ArmoredDigger: Despite being relatively primitive compared to Draedon's current technology, armored diggers continue to see use to this day. Though their primary directive is mining and delivering minerals, they also once cleared room for the numerous underground laboratories. +Burrower: Despite being relatively primitive compared to Draedon's current technology, Burrowers continue to see use to this day. Though their primary directive is mining and delivering minerals, they also once cleared room for the numerous underground laboratories. AuroraSpirit: Thought to be no more than an old wives' tale, sightings of aurora spirits have become commonplace since the defeat of the wall of flesh. Upon closer inspection, it appears these "spirits" are rather wisp-like entities clad in a cryonic shell, a sure sign that these were created by Archmage Permafrost. BloomSlime: Imbued with profaned energy, this slime wishes to see the world reduced to ashes to ensure the suffering it brings is no more. However, the simplicity of their form makes it difficult for the slain goddess to fully impose her will onto them. Bohldohr: Bohldohrs were made to serve the lihzahrds, being crafted from ancient stone and brought to life with magical power in the twilight of the great Lihzahrd Dynasty. But the sun sets on every civilization, and once their deity abandoned them, they were left to fend for themselves. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 73152d034c..b61a8f2699 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2,9 +2,9 @@ Abaddon: { DisplayName: Abaddon Tooltip: ''' - 8% increased critical strike chance - Critical strikes explode, causing nearby enemies to ignite with Brimstone Flames - Reduces the damage of the Brimstone Flames debuff by 50% + {$CommonItemTooltip.PercentIncreasedCritChance} + Critical strikes explode, igniting nearby foes with [cbuff:CalamityMod/BrimstoneFlames] + Reduces damage taken from [cbuff:CalamityMod/BrimstoneFlames] by {1}% ''' } @@ -29,8 +29,8 @@ AbyssalDivingSuit: { Grants the ability to swim, extends underwater breathing, emits light underwater, and improves mobility on ice Provides a moderate amount of light, reduces breath loss, and reduces damage caused by drowning 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 and Crush Depth's increased breath loss - Grants resistance to the increased breath loss caused by Hadopelagic Pressure + Grants immunity to the sulphurous waters and [cbuff:CalamityMod/CrushDepth]'s increased breath loss + Grants resistance to the increased breath loss caused by [cbuff:CalamityMod/HadopelagicPressure] ''' } @@ -39,7 +39,7 @@ AbyssalMirror: { Tooltip: ''' Enemies are less likely to target you, even in the abyss - Generate stealth 25% faster when standing still and 12% faster while moving + Generate stealth {0}% faster when standing still and {1}% faster while moving Grants the ability to dodge attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies ''' HoldShiftTooltip: @@ -54,7 +54,7 @@ AeroStone: { DisplayName: Aero Stone Tooltip: ''' - Provides an additional 50 flight time + Provides an additional {0} seconds of flight time You slowly recover flight time while in the air while not flying or gliding 'One of the ancient relics' ''' @@ -62,16 +62,16 @@ AeroStone: { Affliction: { DisplayName: Affliction - Tooltip: Gives all teammates +0.5 HP/s life regen, +10% max life, 7% damage reduction, 9 defense and 10% increased damage + Tooltip: Gives all teammates +{0} HP/s life regen, +{1}% max life, {2}% damage reduction, {3} defense and {4}% increased damage } AlchemicalFlask: { DisplayName: Alchemical Flask Tooltip: ''' - All attacks inflict the Plague and reduces damage taken from the Plague by 50% + All attacks inflict the [cbuff:CalamityMod/Plague] and reduces damage taken from the [cbuff:CalamityMod/Plague] by {0}% Projectiles spawn plague seekers on enemy hits - Releases plague bees when damaged and douses you in honey + Releases plague bees and douses you in [cbuff:Honey] when damaged ''' } @@ -79,7 +79,7 @@ AlluringBait: { DisplayName: Alluring Bait Tooltip: ''' - Increases fishing power by 10 + Increases fishing power by {0} Increases the yield of potion ingredient fish ''' } @@ -88,7 +88,7 @@ AmalgamatedBrain: { DisplayName: Amalgamated Brain Tooltip: ''' - 5% increased damage + {0}% 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 @@ -101,9 +101,9 @@ AmbrosialAmpoule: { DisplayName: Ambrosial Ampoule Tooltip: ''' - +50 max life - Grants +2 to +5 HP/s life regen based on missing health - Grants the Honey buff + +{0} max life + Grants +{1} to +{2} HP/s life regen based on missing health + Grants the [cbuff:Honey] buff Current boost: +[REGEN] HP/s Fire and sickness debuff durations are halved You emit yellow light if visibility is enabled @@ -114,7 +114,7 @@ AncientFossil: { DisplayName: Ancient Fossil Tooltip: ''' - Increases mining speed by 10% + Increases mining speed by {0}% Provides immunity to damage from falling blocks ''' } @@ -134,13 +134,13 @@ AngelicAlliance: { ''' Call upon the force of heaven to empower your attacks and minions Courage, Enlightenment, Bliss. United in Judgement - +2 max minions, 15% increased summon damage, and 8% increased damage to all other classes - +2 HP/s life regen while airborne using wings - Press [KEY] to grace yourself in divinity for 15 seconds - While Divine Bless is active, for every minion you have, an archangel shall be summoned to aid you in combat - Each spawned angel will instantly restore 2 HP - All minion attacks inflict Banishing Fire, and you are granted a flat 4 HP/s regen - This effect has a cooldown of 1 minute + +{0} max minions, {1}% increased summon damage, and {2}% increased damage to all other classes + +{3} HP/s life regen while flight time is partially or fully expended + Press [KEY] to grace yourself with the [cbuff:CalamityMod/DivineBless] buff for {4} seconds + While active, an archangel is summoned for every minion you have + Archangels vaporize foes with heavenly light and each restore {5} HP upon spawning + Minion attacks inflict [cbuff:CalamityMod/BanishingFire], and you gain a flat {6} HP/s regen + This effect has a cooldown of {7} minute ''' } @@ -162,9 +162,9 @@ AquaticEmblem: { Tooltip: ''' Most ocean enemies become friendly and allows breathing underwater - Being underwater boosts your defense over time, and slows movement speed - The defense boost and movement speed reduction slowly vanish outside of water - Maximum defense boost is 50 and movement speed reduction is 10% + Being underwater gradually increases defense but slows movement speed over {0} seconds + This effect slowly vanishes outside of water and resets while mounted + Maximum defense boost is {1} and movement speed reduction is {2}% Provides a small amount of light and moderately reduces breath loss in the abyss ''' } @@ -180,11 +180,11 @@ AquaticHeart: { FullTooltip: ''' Wow, you can swim now! - Being underwater increases max speed and acceleration by 15% + Being underwater increases max speed and acceleration by {0}% Greatly reduces breath loss and provides a small amount of light in the abyss - Attackers are inflicted with Glacial State - Gain a fragile ice barrier that grants 20% damage reduction for one hit - The ice shield regenerates after 30 seconds + Attackers are inflicted with [cbuff:CalamityMod/GlacialState] + Gain a fragile ice barrier that grants {1}% damage reduction for one hit + The ice shield regenerates after {2} seconds ''' } @@ -192,7 +192,7 @@ ArcFlashRing: { DisplayName: Arc Flash Ring Tooltip: ''' - Attacks have a 6% chance to call down a lightning bolt for 4x damage + Attacks have a {0}% chance to call down a lightning bolt for {1}x damage The chance is reduced for each enemy an attack hits The bolt's damage is based on non-crit damage, but can itself crit Bolts are transparent and silent if visibility is disabled @@ -203,9 +203,9 @@ ArchaicPowder: { DisplayName: Archaic Powder Tooltip: ''' - Increases mining speed by 25% + Increases mining speed by {0}% Provides immunity to damage from falling blocks and dart traps - 65% resistance to all damage from traps + {1}% resistance to all damage from traps Does not stack with downgrades ''' } @@ -214,9 +214,9 @@ AscendantInsignia: { DisplayName: Ascendant Insignia Tooltip: ''' - Increases wing flight time by 50%, movement and jump speed by 15%, and acceleration by 1.5x - Pressing [KEY] grants you the power of ascension, providing infinite flight time for 4 seconds - Ascension has a 40 second cooldown + Increases wing flight time by {0}%, movement and jump speed by {1}%, and acceleration by {2}x + Pressing [KEY] grants you the power of ascension, providing infinite flight time for {3} seconds + Ascension has a {4} second cooldown ''' } @@ -224,9 +224,9 @@ AsgardianAegis: { DisplayName: Asgardian Aegis Tooltip: ''' + {$Common.KnockbackImmunity} Allows the ability to dash, empowered by a cosmic inferno This dash can ram through enemies without taking damage - Grants immunity to knockback ''' } @@ -234,9 +234,9 @@ AsgardsValor: { DisplayName: Asgard's Valor Tooltip: ''' + {$Common.KnockbackImmunity} Allows the ability to ram dash This dash can ram through enemies without taking damage - Grants immunity to knockback ''' } @@ -293,7 +293,7 @@ BlazingCore: { DisplayName: Blazing Core Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} The searing core of the Profaned Goddess Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal Being hit shortly after encasement will shatter the crystal @@ -308,7 +308,7 @@ BloodflareCore: { DisplayName: Bloodflare Core Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} Recovering defense damage heals you, each defense recovered gives 1 HP Taking damage converts at least half of your total defense in defense damage ''' @@ -531,7 +531,7 @@ DarkSunRing: { DisplayName: Dark Sun Ring Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} 12% increased damage +0.5 HP/s life regen and +2 max minions Increased minion knockback @@ -615,8 +615,8 @@ DraedonsHeart: { DisplayName: Draedon's Heart Tooltip: ''' + {$Common.KnockbackImmunity} {0}% reduced contact damage from enemies - Grants immunity to knockback [NANODESC] With full Nanomachines, press [KEY] to heal {1} health over {2} {^2:second;seconds} While healing, you take [DR]% less damage @@ -716,9 +716,9 @@ ElysianAegis: { DisplayName: Elysian Aegis Tooltip: ''' + {$Common.KnockbackImmunity} Allows the ability to dash, empowered by holy fire This dash can ram through enemies without taking damage - Grants immunity to knockback 'Blessed by the Profaned Flame' ''' } @@ -787,7 +787,7 @@ FlameLickedShell: { DisplayName: Flame-Licked Shell Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} Pressing [KEY] will activate a parry, encasing you in rocks Being hit shortly after encasement will implode the rocks Upon implosion, a ring of brimstone hellfire is launched outwards and you receive 90% DR for that hit @@ -869,7 +869,7 @@ GiantTortoiseShell: { DisplayName: Giant Tortoise Shell Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} 5% increased damage reduction and 10% reduced dash velocity Taking a hit restores dash velocity and reduces defense and damage reduction for 3 seconds ''' @@ -1238,7 +1238,7 @@ OldDukeScales: { DisplayName: Old Duke's Scales Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} 10% increased damage reduction, max movement speed, and acceleration 25% increased dash velocity and length Adds a stamina tracker to the cooldown rack @@ -1417,7 +1417,7 @@ RadiantOoze: { DisplayName: Radiant Ooze Tooltip: ''' - Grants +2 to +5 HP/s life regen based on missing health + Grants +{0} to +{1} HP/s life regen based on missing health Current boost: +[REGEN] HP/s You emit yellow light if visibility is enabled ''' @@ -1432,7 +1432,7 @@ RampartofDeities: { DisplayName: Rampart of Deities Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} Releases a blast of homing star-bees[TOGGLE] and drenches you in [cbuff:Honey] after taking damage Increases the length of invincibility, with it increasing even more when at low health or taking high damage attacks Reduces damage taken by 25% when below 50% life @@ -1859,8 +1859,8 @@ TheAbsorber: { DisplayName: The Absorber Tooltip: ''' + {$Common.KnockbackImmunity} {0}% increased movement and jump speed - Grants immunity to knockback Attackers take immense damage and are afflicted with a crippling sickness debuff Using a healing potion will spawn a green aura that lasts for {1} seconds Walking into the aura removes all debuffs once and grants {2} HP/s regen, {3}% damage, and {4}% damage reduction @@ -1949,7 +1949,7 @@ TheSponge: { DisplayName: The Sponge Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} Gain a barrier with {0} health The barrier grants {1}% damage reduction while active [ADREN] @@ -2051,9 +2051,9 @@ VoidofExtinction: { DisplayName: Void of Extinction Tooltip: ''' - 13% increased critical strike chance - Critical strikes explode, igniting enemies with Brimstone Flames - Reduces the damage of the Brimstone Flames debuff by 50% + {$CommonItemTooltip.PercentIncreasedCritChance} + Critical strikes explode, igniting nearby foes with [cbuff:CalamityMod/BrimstoneFlames] + Reduces damage taken from [cbuff:CalamityMod/BrimstoneFlames] by {1}% ''' } @@ -2108,7 +2108,7 @@ YharimsGift: { DisplayName: Yharim's Gift Tooltip: ''' - Grants immunity to knockback + {$Common.KnockbackImmunity} Flaming meteors rain down after getting hit Volatile dragon dust trails behind you Increases damage and movement speed by 15% @@ -2163,15 +2163,6 @@ Popo: { ''' } -PunchCard: { - DisplayName: Punch Card - Tooltip: "[c/842593:'Please... please get world record...']" - // These are used to spawn the item via chat -- both must be all lower case for the detection to work - SpawnText1: it's late - SpawnText1Alt: its late - SpawnText2: go to bed -} - SharkyPlush: { DisplayName: Sharky Plush Tooltip: "[c/696969:'Look out, for the force without form...']" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 7b06b22a3e..5c7544f449 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -267,16 +267,6 @@ MiracleFruit: { MushroomPlasmaRoot.DisplayName: Mushroom Plasma Root -NimbleBounder: { - DisplayName: Nimble Bounder - Tooltip: - ''' - Permanently increases movement and jump speed by {0}% - Permanently increases acceleration by {1}% - [c/842593:'Might be useful for speedrunning'] - ''' -} - PhantomHeart: { DisplayName: Phantom Heart Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index f82d072a33..6f75a1b1bd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -8,7 +8,7 @@ AndroombaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AnthozoanCrabBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AquaticUrchinBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AriesBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" -ArmoredDiggerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +BurrowerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AstraglomerateBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AstralachneaBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" AstralProbeBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -510,32 +510,6 @@ BabyGhostBellJar: { Tooltip: "" } -CalamityCanvas2023: { - DisplayName: Calamity Canvas 2023 - Tooltip: - ''' - when placed to open a UI which allows customizing the focus of the painting - to make the focus follow the cursor, again to set it - Arrow keys can also be used to manually adjust the focus point - The scroll wheel zooms the focus in and out - Hold Shift to hide the UI without closing it - 'Embrace chaos' - ''' -} - -CalamityCanvas2024: { - DisplayName: Calamity Canvas 2024 - Tooltip: - ''' - when placed to open a UI which allows customizing the focus of the painting - to make the focus follow the cursor, again to set it - Arrow keys can also be used to manually adjust the focus point - The scroll wheel zooms the focus in and out - Hold Shift to hide the UI without closing it - 'Embrace havoc' - ''' -} - AquaticScourgeRelic: { DisplayName: Aquatic Scourge Relic Tooltip: A glimpse into what could have been... @@ -771,16 +745,6 @@ CrimsonEffigy: { ''' } -ThankYouPainting: { - DisplayName: Thank You - Tooltip: - ''' - Thanks to the entire team, everyone who supported, and those who all play the mod and keep it alive! - The confines of this painting is not enough to fit the entire team - Hold Shift to see a list of past and current developers - ''' -} - EffigyOfDecay: { DisplayName: Effigy of Decay Tooltip: @@ -901,6 +865,51 @@ NavyPrismTorch: { Tooltip: Can be placed in water } +AmidiasPainting: { + DisplayName: Sea King's Release + Tooltip: + ''' + 'O. Rios' + 'September-October!' + ''' +} + +CalamityCanvas2023: { + DisplayName: Calamity Canvas 2023 + Tooltip: + ''' + when placed to open a UI which allows customizing the focus of the painting + to make the focus follow the cursor, again to set it + Arrow keys can also be used to manually adjust the focus point + The scroll wheel zooms the focus in and out + Hold Shift to hide the UI without closing it + 'Embrace chaos' + ''' +} + +CalamityCanvas2024: { + DisplayName: Calamity Canvas 2024 + Tooltip: + ''' + when placed to open a UI which allows customizing the focus of the painting + to make the focus follow the cursor, again to set it + Arrow keys can also be used to manually adjust the focus point + The scroll wheel zooms the focus in and out + Hold Shift to hide the UI without closing it + 'Embrace havoc' + ''' +} + +ThankYouPainting: { + DisplayName: Thank You + Tooltip: + ''' + Thanks to the entire team, everyone who supported, and those who all play the mod and keep it alive! + The confines of this painting is not enough to fit the entire team + Hold Shift to see a list of past and current developers + ''' +} + PiggyCage: { DisplayName: Piggy Cage Tooltip: "" @@ -3977,11 +3986,6 @@ VolcanicSand: { // End of Sunken Sea -Dreadstone: { - DisplayName: Dreadstone - Tooltip: "" -} - UelibloomBrick: { DisplayName: Uelibloom Brick Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index fe583cd6b0..8f627dff88 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -36,6 +36,15 @@ BlasphemousDonut: { ''' } +BottledPanacea: { + DisplayName: Bottled Panacea + Tooltip: + ''' + Cures you of all sickness and electricity debuffs when consumed + This has a 30 second cooldown + ''' +} + BoundingPotion: { DisplayName: Bounding Potion Tooltip: "{0}% increased jump speed and {1}% increased jump height" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index cfd3dff3a6..a3d4771575 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1011,20 +1011,6 @@ SealedSingularity: { ''' } -SearedPan: { - DisplayName: Seared Pan - Tooltip: - ''' - Fires a frying pan at high velocity - Enemy hits summon fireballs that linger around the target - Landing three consecutive hits will launch a golden pan on the next throw - Golden pans cause all fireballs to aggressively home in on their target on hit - Stealth strikes act similar to golden pans but also explode into golden sparks - Stealth strikes also summon additional fireballs on hit - [c/842593:'dAMaGe iS rAthEr cOnSisTeNT'] - ''' -} - Seraphim: { DisplayName: Seraphim Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 51c57ca16b..c03a360b6d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -181,13 +181,11 @@ NanoblackSplit.DisplayName: Nanoblack Blade NanoblackStealthSplit.DisplayName: Nanoblack Afterimage NastyChollaBol.DisplayName: Nasty Cholla NastyChollaNeedle.DisplayName: Cactus Needle -NiceCock.DisplayName: Kitchen Fire NightsGazeProjectile.DisplayName: Night's Gaze NightsGazeSpark.DisplayName: Night's Gaze Spark NightsGazeStar.DisplayName: Night's Gaze Star OrichalcumSpikedGemstoneProjectile.DisplayName: Orichalcum Gemstone PalladiumJavelinProjectile.DisplayName: Palladium Javelin -PanSpark.DisplayName: Pan Spark PartisanExplosion.DisplayName: Profaned Explosion PenumbraBomb.DisplayName: Penumbra Bomb PenumbraSoul.DisplayName: Penumbra Soul @@ -242,7 +240,6 @@ SeafoamBubble.DisplayName: Seafoam Bubble SealedSingularityBlackhole.DisplayName: Sealed Blackhole SealedSingularityGore.DisplayName: Sealed Singularity Fragment SealedSingularityProj.DisplayName: Sealed Singularity -SearedPanProjectile.DisplayName: Pan SeraphimAngelicLight.DisplayName: Light Orb SeraphimAngelicLight2.DisplayName: Light Orb SeraphimBeamLarge.DisplayName: Holy Beam diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index df88751a5d..b78a858638 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -241,7 +241,6 @@ SandMark.DisplayName: Mark SandnadoMinion.DisplayName: Sandnado SandTornado.DisplayName: Tornado SarosAura.DisplayName: Saros Aura -SarosMicrosun.DisplayName: Saros Microsun SarosSunfire.DisplayName: Saros Sunfire SeashineSwordProj.DisplayName: Seashine Sword SeekerSummonProj.DisplayName: Soul Seeker @@ -274,9 +273,6 @@ MinionPlasmaBlast.DisplayName: Volatile Plasma Blast MinionPlasmaGas.DisplayName: Superheated Plasma Cloud MinionTeslaOrb.DisplayName: Tesla Sphere SmallSkeletonMinion.DisplayName: Small Skeleton -SolarBeam.DisplayName: Solar Beam -SolarGod.DisplayName: Vengeful Solar Spirit -SolarPixie.DisplayName: Solar Pixie Spikecrag.DisplayName: Spikecrag SpikecragSpike.DisplayName: Spikecrag Spike SquirrelSquireAcorn.DisplayName: Squirrel Acorn diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index d01cc8ac60..87001e5c43 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -127,6 +127,7 @@ Cooldowns: { OldDukeScalesFatigue: Stamina OmegaBlueActive: Abyssal Madness OmegaBlueCooldown: Abyssal Madness Cooldown + Panacea: Panacea Cooldown PermafrostConcoction: Permafrost's Concoction Cooldown PlagueBlackout: Plague Blackout Cooldown PotionSickness: Healing Cooldown @@ -611,13 +612,13 @@ Disenchant: Disenchant BetterUnderworld: Creating a smoother Underworld BetterShimmer: Placing shimmer in a sane location UnderworldStructures: Remnants of an Azafurian and Demonic war -UnderworldPillars: Constructing Underworld pillars UnderworldTreesAndGrass: Growing Underworld flora UnderworldGeyserTraps: Adding an Underworld minefield ShimmerShrine: Excavating an ancient shimmer well EvilIslandCorrupt: Adding a putrid floating island EvilIslandCrimson: Adding a grotesque floating island AstralChest: Placing an astral chest +LivingMahoganyTree: Growing a giant jungle tree BetterJungleTemple: Building a bigger jungle temple JungleTempleAltar: Placing the Lihzahrd altar GiantBeehive: Building a giant beehive diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index 2a3d8e8414..4814d6cee0 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -188,7 +188,7 @@ EditedTooltip: { FrogLeg: Increases jump speed by {0}% and allows auto-jump // Soaring Insignia EmpressFlightBooster1: Increases wing flight time by 33% - EmpressFlightBooster2: Increases movement and jump speed by 10% and acceleration by 1.25x + EmpressFlightBooster2: Increases movement speed by 7.5%, jump speed by 10%, and acceleration by 1.25x GravityGlobe: ''' Provides 32% increased jump speed and increased fall speed diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index 9d2985bac3..98fd3607af 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -981,8 +981,6 @@ namespace CalamityMod "TaintedCloudberry" => player.Calamity().tCloudberry, "SacredStrawberry" => player.Calamity().sStrawberry, - "NimbleBounder" => player.Calamity().nimbleBounderBoost, - "CometShard" => player.Calamity().cShard, "EtherealCore" => player.Calamity().eCore, "PhantomHeart" => player.Calamity().pHeart, @@ -1016,8 +1014,6 @@ namespace CalamityMod case "EtherealCore": player.Calamity().eCore = value; break; case "PhantomHeart": player.Calamity().pHeart = value; break; - case "NimbleBounder": player.Calamity().nimbleBounderBoost = value; break; - case "MushroomPlasmaRoot": player.Calamity().rageBoostOne = value; break; case "InfernalBlood": player.Calamity().rageBoostTwo = value; break; case "RedLightningContainer": player.Calamity().rageBoostThree = value; break; diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 90ef06dcaa..883e0fb931 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -689,7 +689,8 @@ namespace CalamityMod.NPCs.AquaticScourge normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), 10); } diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index b7ed5d4d8b..a4693e2652 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -1309,7 +1309,8 @@ namespace CalamityMod.NPCs.AstrumAureus normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Other normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 9, 12)); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index e6a3b2f9fb..b9ab4e8182 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -974,7 +974,8 @@ namespace CalamityMod.NPCs.AstrumDeus normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), 5); // Materials diff --git a/NPCs/BaseWormNPC.cs b/NPCs/BaseWormNPC.cs index 26e5538370..3535bd42d5 100644 --- a/NPCs/BaseWormNPC.cs +++ b/NPCs/BaseWormNPC.cs @@ -593,33 +593,51 @@ namespace CalamityMod.NPCs #endregion #region Draw + + public override void FindFrame(int frameHeight) + { + if (NPC.IsABestiaryIconDummy) + { + NPC.rotation = MathF.Sin(Main.GlobalTimeWrappedHourly) * 0.2f + MathHelper.PiOver2; + } + } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { + if (NPC.IsABestiaryIconDummy) + { + drawColor = Color.White; + SegmentRigidity = 0.1f; + UpdateSegments(); + } for (int i = Segments.Count - 1; i >= 0; i--) { DrawSegment(spriteBatch, screenPos, drawColor, Segments[i]); } - spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - Main.screenPosition, null, drawColor* NPC.Opacity, NPC.rotation, TextureAssets.Npc[Type].Value.Size() / 2, NPC.scale, SpriteEffects.None, 1); + spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - screenPos, null, drawColor* NPC.Opacity, NPC.rotation, TextureAssets.Npc[Type].Value.Size() / 2, NPC.scale, SpriteEffects.None, 1); if (GlowTextures.Count > 0 && GlowTextures[0] is not null) - spriteBatch.Draw(GlowTextureAssets[0].Value, NPC.Center - Main.screenPosition, null, Color.White * NPC.Opacity, NPC.rotation, GlowTextureAssets[0].Size() / 2, NPC.scale, SpriteEffects.None, 1); + spriteBatch.Draw(GlowTextureAssets[0].Value, NPC.Center - screenPos, null, Color.White * NPC.Opacity, NPC.rotation, GlowTextureAssets[0].Size() / 2, NPC.scale, SpriteEffects.None, 1); return false; } public virtual void DrawSegment(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor, BaseWormSegment segment) { var color = Lighting.GetColor(segment.Center.ToTileCoordinates()); + if (NPC.IsABestiaryIconDummy) + { + color = Color.White; + } if (!SegmentTextureAssets.IndexInRange(segment.segmentType)) { return; } var tex = SegmentTextureAssets[segment.segmentType].Value; - spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color * segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); + spriteBatch.Draw(tex, segment.Center - screenPos, null, color * segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); if (!GlowTextures.IndexInRange(segment.segmentType+1) || GlowTextures[segment.segmentType+1] is null) { return; } tex = GlowTextureAssets[segment.segmentType+1].Value; - spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, Color.White * segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); + spriteBatch.Draw(tex, segment.Center - screenPos, null, Color.White * segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); } #endregion } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index d98501fe87..35a898ecc0 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -897,7 +897,8 @@ namespace CalamityMod.NPCs.BrimstoneElemental ModContent.ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, accs)); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/Bumblebirb/Dragonfolly.cs b/NPCs/Bumblebirb/Dragonfolly.cs index b706d67a21..b9a6da5101 100644 --- a/NPCs/Bumblebirb/Dragonfolly.cs +++ b/NPCs/Bumblebirb/Dragonfolly.cs @@ -1248,7 +1248,8 @@ namespace CalamityMod.NPCs.Bumblebirb normalOnly.Add(ModContent.ItemType(), 1, 25, 30); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Vanity diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 6f8ba0ac36..6e90520411 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -1036,7 +1036,8 @@ namespace CalamityMod.NPCs.CalClone normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 4f0390cbe5..571ad01b7c 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -899,8 +899,6 @@ namespace CalamityMod.NPCs // 5-10 Nightmare Fuel @ 100% IF Devourer of Gods dead postDoG.Add(ModContent.ItemType(), 1, 5, 10); - pMoon.OnSuccess(ItemDropRule.ByCondition(new Conditions.NotExpert(), ItemID.WitchBroom, 5)); - // Master items drop in Revengeance pMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.MourningWoodMasterTrophy)); pMoon.OnSuccess(ItemDropRule.ByCondition(DropHelper.RevNoMaster, ItemID.SpookyWoodMountItem, 4)); @@ -1127,8 +1125,8 @@ namespace CalamityMod.NPCs }; npcLoot.Add(new DropOneByOne(ItemID.Gel, kingSlimeGelSpray)); - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.RoyalGel)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.RoyalGel)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.Remix, ItemID.Keybrand, DropHelper.NormalWeaponDropRateInt)); @@ -1149,8 +1147,8 @@ namespace CalamityMod.NPCs break; case NPCID.EyeofCthulhu: - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EoCShield)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EoCShield)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); @@ -1171,15 +1169,12 @@ namespace CalamityMod.NPCs case NPCID.EaterofWorldsHead: case NPCID.EaterofWorldsBody: case NPCID.EaterofWorldsTail: - // Expert+ drops are also available on Normal. Drop what would be in the bag otherwise + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic LeadingConditionRule EoWKill = new(DropHelper.If((info) => info.npc.boss)); - EoWKill.Add(DropHelper.PerPlayer(ItemID.WormScarf)); + // EoWKill.Add(DropHelper.PerPlayer(ItemID.WormScarf)); EoWKill.Add(ModContent.ItemType(), ThankYouPainting.DropInt); npcLoot.AddNormalOnly(EoWKill); - // Would be in the bag otherwise - npcLoot.AddIf((info) => info.npc.boss, ModContent.ItemType(), ThankYouPainting.DropInt); - // Master items drop in Revengeance rev.AddIf((info) => info.npc.boss, ItemID.EaterofWorldsMasterTrophy); rev.AddIf((info) => info.npc.boss, ItemID.EaterOfWorldsPetItem, 4); @@ -1203,8 +1198,8 @@ namespace CalamityMod.NPCs break; case NPCID.BrainofCthulhu: - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BrainOfConfusion)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BrainOfConfusion)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1253,8 +1248,8 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BoneHelm)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BoneHelm)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1276,8 +1271,9 @@ namespace CalamityMod.NPCs // Define a replacement rule which drops the weapons Calamity style. npcLoot.AddNormalOnly(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, ItemID.BeeKeeper, ItemID.BeesKnees, ItemID.BeeGun, ModContent.ItemType())); - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.HiveBackpack)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.HiveBackpack)); + npcLoot.AddNormalOnly(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Would be in the bag otherwise @@ -1311,8 +1307,8 @@ namespace CalamityMod.NPCs }; npcLoot.Add(new DropOneByOne(ItemID.Bone, skeletronBoneSpray)); - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BoneGlove)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.BoneGlove)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1411,12 +1407,12 @@ namespace CalamityMod.NPCs break; case NPCID.QueenSlimeBoss: - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.VolatileGelatin)); - npcLoot.AddNormalOnly(ItemID.SoulofLight, 1, 15, 20); - npcLoot.AddNormalOnly(ItemID.PinkGel, 1, 15, 20); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.VolatileGelatin)); // Would be in the bag otherwise + npcLoot.AddNormalOnly(ItemID.SoulofLight, 1, 15, 20); + npcLoot.AddNormalOnly(ItemID.PinkGel, 1, 15, 20); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); // Master items drop in Revengeance @@ -1438,8 +1434,8 @@ namespace CalamityMod.NPCs // Define a replacement rule which respects the Early Hardmode Progression Rework. npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.HallowedBarsCondition, ItemID.HallowedBar, 1, 15, 30)); - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.MechanicalWagonPiece)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.MechanicalWagonPiece)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1479,8 +1475,9 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Expert+ drops are also available on Normal. These are done manually due to Last Twin Standing. - npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ItemID.MechanicalWheelPiece); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // These are done manually due to Last Twin Standing. + // npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ItemID.MechanicalWheelPiece); // Would be in the bag otherwise npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1506,8 +1503,8 @@ namespace CalamityMod.NPCs // Define a replacement rule which respects the Early Hardmode Progression Rework. npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.HallowedBarsCondition, ItemID.HallowedBar, 1, 15, 30)); - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.MechanicalBatteryPiece)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.MechanicalBatteryPiece)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1564,8 +1561,8 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.SporeSac)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.SporeSac)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), 10); @@ -1617,9 +1614,10 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Expert+ drops are also available on Normal var normalOnly = npcLoot.DefineNormalOnlyDropSet(); - normalOnly.Add(DropHelper.PerPlayer(ItemID.ShinyStone)); + + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // normalOnly.Add(DropHelper.PerPlayer(ItemID.ShinyStone)); // Would be in the bag otherwise normalOnly.Add(ModContent.ItemType(), 1, 8, 10); @@ -1714,8 +1712,8 @@ namespace CalamityMod.NPCs catch (ArgumentNullException) { } DukeEditFailed: - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.ShrimpyTruffle)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.ShrimpyTruffle)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), 10); @@ -1788,8 +1786,8 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EmpressFlightBooster)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EmpressFlightBooster)); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1851,12 +1849,13 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Expert+ drops are also available on Normal - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.GravityGlobe)); - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.SuspiciousLookingTentacle)); - npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.LongRainbowTrailWings)); + // 16NOV2025: Ozzatron: following overwhelming dev vote, Expert+ drops are NOT available in Classic + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.GravityGlobe)); + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.SuspiciousLookingTentacle)); + // npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.LongRainbowTrailWings)); // Would be in the bag otherwise + // 16NOV2025: Ozzatron (executive decision): Celestial Onion remains available as a 6th slot in Classic. npcLoot.AddNormalOnly(DropHelper.PerPlayer(ModContent.ItemType())); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index e76d91bf1a..fbfdf1a4e2 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Placeables.Astral; using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Placeables.Furniture.Fountains; +using CalamityMod.Items.Placeables.Furniture.Paintings; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems.Invasion; @@ -209,7 +210,7 @@ namespace CalamityMod.NPCs }; private static readonly string[] SkeletonMerchantNames = { - "Sans Undertale", // <@!145379091648872450> (shayy) + "Sans Undertale", // <@!534770496038895616> (done_22_) "Papyrus Undertale", // <@!262663471189983242> (nycro) "Gaster Undertale", // <@!924706306093379614> (enamoured) "Mr. Bones", // <@!359215912856977408> (jaybones.) @@ -351,13 +352,13 @@ namespace CalamityMod.NPCs "Lucerne", // <@!271954788676141066> (lord_lucerne) "Milo", // <@!401849201597874179> (maskedmilo) "Octo", // <@!796112889353994281> (octolinggrimm) - "Hognar the Wicked", // <@!766511001356468237> (xzier_tengal) }; private static readonly string[] TownCatSiameseNames = null; private static readonly string[] TownCatBlackNames = { "Bear", // <@!183424826407518208> (lilac_vrt_olligoci) "Storm", // <@!620383533516718085> (airwaveslr) + "Hognar the Wicked", // <@!766511001356468237> (xzier_tengal) }; private static readonly string[] TownCatOrangeTabbyNames = { @@ -370,6 +371,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownCatSilverNames = { "Archie", // <@!303022375191183360> (jackshiz) + "Hognar the Wicked", // <@!766511001356468237> (xzier_tengal) }; private static readonly string[] TownCatWhiteNames = null; @@ -1235,7 +1237,8 @@ namespace CalamityMod.NPCs if (type == NPCID.Painter) { - shop.AddWithCustomValue(ItemID.PainterPaintballGun, Item.buyPrice(gold: 15)); + shop.AddWithCustomValue(ItemID.PainterPaintballGun, Item.buyPrice(gold: 15)) + .Add(ItemType(), CalamityConditions.InSunken, Condition.NpcIsPresent(NPCType())); } if (type == NPCID.Steampunker) @@ -1314,25 +1317,6 @@ namespace CalamityMod.NPCs shop.Add(); } } - - public override void ModifyActiveShop(NPC npc, string shopName, Item[] items) - { - // TODO: Uses a hardcoded string since dedicated names are currently hardcoded strings - // Will need to be changed if dedicated names are localized in the future - if (npc.type == NPCID.SkeletonMerchant && npc.GivenName == "Sans Undertale") - { - int index = 0; - for (int i = 0; i < Chest.maxItems; i++) - { - if (items[i] == null) - { - index = i; - break; - } - } - items[index] = new Item(ItemType()); - } - } #endregion } } diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 7f21657f82..3f22fc8e57 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -764,7 +764,8 @@ namespace CalamityMod.NPCs.CeaselessVoid normalOnly.Add(DropHelper.PerPlayer(ItemType(), 1, 10, 12)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ItemType())); // Vanity normalOnly.Add(ItemType(), 7); diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index 0e5f0a6128..41158c61b7 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -1185,7 +1185,8 @@ namespace CalamityMod.NPCs.Crabulon normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index d061adf8e5..63ce720037 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -1381,7 +1381,8 @@ namespace CalamityMod.NPCs.Cryogen normalOnly.Add(ModContent.ItemType(), 1, 8, 10); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); } diff --git a/NPCs/Deconstructors/Burrower.cs b/NPCs/Deconstructors/Burrower.cs index 46c35ffc76..ea4d2d5f7d 100644 --- a/NPCs/Deconstructors/Burrower.cs +++ b/NPCs/Deconstructors/Burrower.cs @@ -5,6 +5,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Effects; using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.ExoMechs.Thanatos; using CalamityMod.Particles; @@ -15,13 +16,16 @@ using CalamityMod.Tiles.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; +using Terraria.GameContent.Bestiary; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.Deconstructors { public class BurrowerHitbox : BaseWormHitboxNPC { + public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.Burrower.DisplayName"); public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { return false; @@ -46,6 +50,9 @@ namespace CalamityMod.NPCs.Deconstructors NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = false; + + Banner = ModContent.NPCType(); + BannerItem = ModContent.ItemType(); base.SetDefaults(); } public override void AI() @@ -110,7 +117,7 @@ namespace CalamityMod.NPCs.Deconstructors NPC.height = 38; NPC.lifeMax = 1000; NPC.value = Item.buyPrice(1, 0, 0, 0); - + NPC.rarity = 3; NPC.HitSound = ThanatosHead.ThanatosHitSoundClosed; NPC.DeathSound = SoundID.NPCDeath44; NPC.knockBackResist = 0f; @@ -125,6 +132,8 @@ namespace CalamityMod.NPCs.Deconstructors NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = false; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); for (var i = 0; i < SegmentCount - 1; i++) { @@ -132,6 +141,14 @@ namespace CalamityMod.NPCs.Deconstructors } Segments.Add(new BaseWormSegment(this, 3)); } + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange( + [ + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Burrower") + ]); + } #region AI Variables @@ -531,7 +548,7 @@ namespace CalamityMod.NPCs.Deconstructors npcLoot.Add(ItemID.CrimtaneOre, 5, 6, 32); var condition = npcLoot.DefineConditionalDropSet(DropHelper.PostPlant()); - condition.Add(ItemID.CobaltOre, 2, 6, 32,true); + condition.Add(ItemID.CobaltOre, 2, 6, 32); condition.Add(ItemID.PalladiumOre, 2, 6, 32); condition.Add(ItemID.MythrilOre, 3, 6, 32); condition.Add(ItemID.OrichalcumOre, 3, 6, 32); @@ -547,7 +564,7 @@ namespace CalamityMod.NPCs.Deconstructors { return 0f; } - return SpawnCondition.Cavern.Chance * (Main.projectile.Any(x=> x.active && x.type == ModContent.ProjectileType()) ? 5f : 0.1f); + return SpawnCondition.Cavern.Chance * (Main.projectile.Any(x=> x.active && x.type == ModContent.ProjectileType()) ? 5f : 0.05f); } } } diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 4bbc6757cd..8d50de290d 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -995,7 +995,8 @@ namespace CalamityMod.NPCs.DesertScourge normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index dea7b7c164..911ee1a799 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -2570,7 +2570,8 @@ namespace CalamityMod.NPCs.DevourerofGods normalOnly.Add(ModContent.ItemType(), 1, 150, 250); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); } // Relic @@ -2798,32 +2799,11 @@ namespace CalamityMod.NPCs.DevourerofGods text = headHitKeys[Main.rand.Next(0, 4)]; //DogHead1-4 } } - // Speak in Wingdings if the Punch Card is equipped - if (target.Transformation().Type == ModContent.ItemType() && FontAssetSystem.Fonts["Wingdings"] != null && System.Environment.OSVersion.Platform == PlatformID.Win32NT && !GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive && !GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) - { - Vector2 vector = FontAssetSystem.Fonts["Wingdings"].MeasureString(Language.GetTextValue(text)); - // This is how normal combat text spawn positioning is handled - float positionX = (float)location.X + (float)location.Width * 0.5f - vector.X * 0.5f + Main.rand.Next(-(int)((double)location.Width * 0.5), (int)((double)location.Width * 0.5) + 1); - float positionY = (float)location.Y + (float)location.Height * 0.25f - vector.Y * 0.5f + Main.rand.Next(-(int)((double)location.Height * 0.5), (int)((double)location.Height * 0.5) + 1); - if (target.gravDir == -1f) - { - positionY = (float)location.Y + (float)location.Height * 0.75f + vector.Y * 0.5f; - } - // Spawn a projectile that mimmicks combat text behaviour - Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromThis(), new Vector2(positionX, positionY), new Vector2((float)Main.rand.Next(-25, 26) * 0.05f, -14f * target.gravDir), ModContent.ProjectileType(), 0, 0, -1, -1); - proj.rotation = proj.velocity.X < 0 ? -0.06f : 0.06f; - // Pass the spoken dialogue into it - DoGWingdings wingdings = proj.ModProjectile(); - wingdings.dialogue = Language.GetTextValue(text); - } - else - { - var ctid = CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); - if (ctid < Main.maxCombatText) - target.Calamity().subtitletext = Main.combatText[ctid]; - target.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia }; - } + var ctid = CombatText.NewText(location, messageColor, Language.GetTextValue(text), true); + if (ctid < Main.maxCombatText) + target.Calamity().subtitletext = Main.combatText[ctid]; + target.Calamity().subtitleColors = new Color[] { Color.Cyan, Color.Fuchsia }; target.Calamity().dogTextCooldown = 60; } target.Calamity().DoGHeadHitCounter++; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index b0b3000a31..34d62e6a3e 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1650,7 +1650,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares // Equipment normalOnly.Add(ModContent.ItemType()); - normalOnly.Add(ModContent.ItemType()); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(ModContent.ItemType()); // Vanity // Higher chance due to how the drops work diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 9d61e78cf9..16e9d8986b 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -1350,7 +1350,8 @@ namespace CalamityMod.NPCs.HiveMind // Equipment normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index b35a1dbe4b..8e51696358 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -867,7 +867,8 @@ namespace CalamityMod.NPCs.Leviathan normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); normalOnly.Add(ModContent.ItemType(), 10); } diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs deleted file mode 100644 index a4a5b58ce7..0000000000 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ /dev/null @@ -1,200 +0,0 @@ -using System; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - [LongDistanceNetSync(SyncWith = typeof(ArmoredDiggerHead))] - public class ArmoredDiggerBody : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ArmoredDiggerHead.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 70; - NPC.width = 38; - NPC.height = 38; - NPC.defense = 20; - NPC.lifeMax = 20000; - NPC.knockBackResist = 0f; - NPC.aiStyle = -1; - AIType = -1; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; - NPC.netAlways = true; - NPC.dontCountMe = true; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()) - { - NPC.realLife = (int)NPC.ai[3]; - } - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { - NPC.TargetClosest(true); - } - bool shouldDie = false; - if (NPC.ai[1] <= 0f) - { - shouldDie = true; - } - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - { - shouldDie = true; - } - if (shouldDie) - { - if (!Main.zenithWorld) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - } - else - { - // find a new npc to attatch to in gfb, it's not a bug, it's a feature:tm: - foreach (NPC host in Main.ActiveNPCs) - { - if (!host.friendly && !host.dontTakeDamage && host.type != ModContent.NPCType() && host.type != ModContent.NPCType() && host.type != ModContent.NPCType()) - { - NPC.ai[1] = host.whoAmI; - NPC.ai[3] = host.whoAmI; - break; - } - } - // if it goes through the loop without finding an npc to attatch to (aka, ai[1] never changes and the head is still dead) kill as normal - if (Main.npc[(int)NPC.ai[1]].life <= 0) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - } - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] += (float)Main.rand.Next(4); - if (NPC.localAI[0] >= (float)Main.rand.Next(1800, 26000)) - { - NPC.localAI[0] = 0f; - NPC.TargetClosest(true); - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, - Main.player[NPC.target].width, Main.player[NPC.target].height)) - { - float speed = 7f; - Vector2 projFirePosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)(NPC.height / 2)); - float projTargetX = Main.player[NPC.target].position.X + (float)Main.player[NPC.target].width * 0.5f - projFirePosition.X + (float)Main.rand.Next(-20, 21); - float projTargetY = Main.player[NPC.target].position.Y + (float)Main.player[NPC.target].height * 0.5f - projFirePosition.Y + (float)Main.rand.Next(-20, 21); - float projTargetDist = (float)Math.Sqrt((double)(projTargetX * projTargetX + projTargetY * projTargetY)); - projTargetDist = speed / projTargetDist; - projTargetX *= projTargetDist; - projTargetY *= projTargetDist; - int projType = Main.zenithWorld ? ModContent.ProjectileType() : ProjectileID.SaucerScrap; - projFirePosition.X += projTargetX * 5f; - projFirePosition.Y += projTargetY * 5f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projFirePosition.X, projFirePosition.Y, projTargetX, projTargetY, projType, 30, 0f, Main.myPlayer, 0f, 0f); - NPC.netUpdate = true; - } - } - } - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = (int)(44f * NPC.scale); - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerBody2").Type, 1f); - } - } - } - - public override bool CheckActive() - { - return false; - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.MechanizedSerpent"); - } - } - - public override Color? GetAlpha(Color drawColor) - { - if (Main.zenithWorld) - { - Color lightColor = Color.Orange * drawColor.A; - return lightColor * NPC.Opacity; - } - else return null; - } - } -} diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.png b/NPCs/NormalNPCs/ArmoredDiggerBody.png deleted file mode 100644 index 6f582bdb3e..0000000000 Binary files a/NPCs/NormalNPCs/ArmoredDiggerBody.png and /dev/null differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs deleted file mode 100644 index 5b812c76be..0000000000 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ /dev/null @@ -1,505 +0,0 @@ -using System; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Summon; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - [LongDistanceNetSync] - public class ArmoredDiggerHead : ModNPC - { - bool TailSpawned = false; - - public override void SetStaticDefaults() - { - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 40 - }; - value.Position.Y += 40; - value.Position.X += 48; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override void SetDefaults() - { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = 90; - NPC.npcSlots = 10f; - NPC.width = 54; - NPC.height = 54; - NPC.defense = 10; - NPC.lifeMax = 20000; - NPC.knockBackResist = 0f; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Item.buyPrice(gold: 5); - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; - NPC.netAlways = true; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.ArmoredDigger") - }); - } - - public override void AI() - { - Point point = NPC.Center.ToTileCoordinates(); - Tile tileSafely = Framing.GetTileSafely(point); - bool createDust = tileSafely.HasUnactuatedTile && NPC.Distance(Main.player[NPC.target].Center) < 800f; - if (createDust) - { - if (Main.rand.NextBool()) - { - Dust dust = Dust.NewDustDirect(NPC.position, NPC.width, NPC.height, DustID.TreasureSparkle, 0f, 0f, 150, default(Color), 0.3f); - dust.fadeIn = 0.75f; - dust.velocity *= 0.1f; - dust.noLight = true; - } - } - - bool death = CalamityWorld.death; - if (NPC.ai[3] > 0f) - { - NPC.realLife = (int)NPC.ai[3]; - } - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { - NPC.TargetClosest(true); - } - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!TailSpawned) - { - NPC.ai[3] = (float)NPC.whoAmI; - NPC.realLife = NPC.whoAmI; - int thisSegment = NPC.whoAmI; - int segmentAmt = 30; - for (int j = 0; j <= segmentAmt; j++) - { - int segmentType = ModContent.NPCType(); - if (j == segmentAmt) - { - segmentType = ModContent.NPCType(); - } - int newSegment = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.position.X + (float)(NPC.width / 2)), (int)(NPC.position.Y + (float)NPC.height), segmentType, NPC.whoAmI, 0f, 0f, 0f, 0f, 255); - Main.npc[newSegment].ai[3] = (float)NPC.whoAmI; - Main.npc[newSegment].realLife = NPC.whoAmI; - Main.npc[newSegment].ai[1] = (float)thisSegment; - Main.npc[thisSegment].ai[0] = (float)newSegment; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, newSegment, 0f, 0f, 0f, 0, 0, 0); - thisSegment = newSegment; - } - TailSpawned = true; - } - } - int tileXPosition = (int)(NPC.position.X / 16f) - 1; - int tileWidthXPos = (int)((NPC.position.X + (float)NPC.width) / 16f) + 2; - int tileYPosition = (int)(NPC.position.Y / 16f) - 1; - int tileWidthYPos = (int)((NPC.position.Y + (float)NPC.height) / 16f) + 2; - if (tileXPosition < 0) - { - tileXPosition = 0; - } - if (tileWidthXPos > Main.maxTilesX) - { - tileWidthXPos = Main.maxTilesX; - } - if (tileYPosition < 0) - { - tileYPosition = 0; - } - if (tileWidthYPos > Main.maxTilesY) - { - tileWidthYPos = Main.maxTilesY; - } - bool flying = false; - if (!flying) - { - for (int k = tileXPosition; k < tileWidthXPos; k++) - { - for (int l = tileYPosition; l < tileWidthYPos; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[(int)Main.tile[k, l].TileType] || (Main.tileSolidTop[(int)Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - Vector2 segmentPos; - segmentPos.X = (float)(k * 16); - segmentPos.Y = (float)(l * 16); - if (NPC.position.X + (float)NPC.width > segmentPos.X && NPC.position.X < segmentPos.X + 16f && NPC.position.Y + (float)NPC.height > segmentPos.Y && NPC.position.Y < segmentPos.Y + 16f) - { - flying = true; - break; - } - } - } - } - } - if (!flying) - { - NPC.localAI[1] = 1f; - Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); - int noFlyZone = 1000; - bool outsideNoFlyZone = true; - if (NPC.position.Y > Main.player[NPC.target].position.Y) - { - foreach (Player player in Main.ActivePlayers) - { - Rectangle noFlyArea = new Rectangle((int)player.position.X - noFlyZone, (int)player.position.Y - noFlyZone, noFlyZone * 2, noFlyZone * 2); - if (rectangle.Intersects(noFlyArea)) - { - outsideNoFlyZone = false; - break; - } - } - if (outsideNoFlyZone) - { - flying = true; - } - } - } - else - { - NPC.localAI[1] = 0f; - } - float maxChaseSpeed = death ? 13.5f : 10f; - if (Main.player[NPC.target].dead || (!Main.zenithWorld && (double)Main.player[NPC.target].position.Y < Main.rockLayer * 16.0)) - { - flying = false; - NPC.velocity.Y = NPC.velocity.Y + 1f; - if ((double)NPC.position.Y > Main.rockLayer * 16.0) - { - NPC.velocity.Y = NPC.velocity.Y + 1f; - maxChaseSpeed *= 2f; - } - if ((double)NPC.position.Y > (double)(Main.UnderworldLayer * 16)) - { - for (int a = 0; a < Main.maxNPCs; a++) - { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || - Main.npc[a].type == ModContent.NPCType()) - { - Main.npc[a].active = false; - } - } - } - } - float acceleration = death ? 0.0675f : 0.05f; - float deceleration = death ? 0.10125f : 0.075f; - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (!flying) - { - NPC.TargetClosest(true); - NPC.velocity.Y = NPC.velocity.Y + 0.15f; - if (NPC.velocity.Y > maxChaseSpeed) - { - NPC.velocity.Y = maxChaseSpeed; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.4) - { - if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X - acceleration * 1.1f; - } - else - { - NPC.velocity.X = NPC.velocity.X + acceleration * 1.1f; - } - } - else if (NPC.velocity.Y == maxChaseSpeed) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + acceleration; - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - acceleration; - } - } - else if (NPC.velocity.Y > 4f) - { - if (NPC.velocity.X < 0f) - { - NPC.velocity.X = NPC.velocity.X + acceleration * 0.9f; - } - else - { - NPC.velocity.X = NPC.velocity.X - acceleration * 0.9f; - } - } - } - else - { - if (NPC.soundDelay == 0) - { - float soundDelay = targetDistance / 40f; - if (soundDelay < 10f) - { - soundDelay = 10f; - } - if (soundDelay > 20f) - { - soundDelay = 20f; - } - NPC.soundDelay = (int)soundDelay; - SoundEngine.PlaySound(SoundID.WormDig, NPC.Center); - } - targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - float absoluteTargetX = Math.Abs(targetXDist); - float absoluteTargetY = Math.Abs(targetYDist); - float timeToReachTarget = maxChaseSpeed / targetDistance; - targetXDist *= timeToReachTarget; - targetYDist *= timeToReachTarget; - if (((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f)) && ((NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f))) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + deceleration; - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - deceleration; - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + deceleration; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - deceleration; - } - } - if ((NPC.velocity.X > 0f && targetXDist > 0f) || (NPC.velocity.X < 0f && targetXDist < 0f) || (NPC.velocity.Y > 0f && targetYDist > 0f) || (NPC.velocity.Y < 0f && targetYDist < 0f)) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + acceleration; - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - acceleration; - } - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + acceleration; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - acceleration; - } - if ((double)Math.Abs(targetYDist) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.X > 0f && targetXDist < 0f) || (NPC.velocity.X < 0f && targetXDist > 0f))) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + acceleration * 2f; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - acceleration * 2f; - } - } - if ((double)Math.Abs(targetXDist) < (double)maxChaseSpeed * 0.2 && ((NPC.velocity.Y > 0f && targetYDist < 0f) || (NPC.velocity.Y < 0f && targetYDist > 0f))) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + acceleration * 2f; - } - else - { - NPC.velocity.X = NPC.velocity.X - acceleration * 2f; - } - } - } - else if (absoluteTargetX > absoluteTargetY) - { - if (NPC.velocity.X < targetXDist) - { - NPC.velocity.X = NPC.velocity.X + acceleration * 1.1f; - } - else if (NPC.velocity.X > targetXDist) - { - NPC.velocity.X = NPC.velocity.X - acceleration * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) - { - if (NPC.velocity.Y > 0f) - { - NPC.velocity.Y = NPC.velocity.Y + acceleration; - } - else - { - NPC.velocity.Y = NPC.velocity.Y - acceleration; - } - } - } - else - { - if (NPC.velocity.Y < targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y + acceleration * 1.1f; - } - else if (NPC.velocity.Y > targetYDist) - { - NPC.velocity.Y = NPC.velocity.Y - acceleration * 1.1f; - } - if ((double)(Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < (double)maxChaseSpeed * 0.5) - { - if (NPC.velocity.X > 0f) - { - NPC.velocity.X = NPC.velocity.X + acceleration; - } - else - { - NPC.velocity.X = NPC.velocity.X - acceleration; - } - } - } - } - - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; - - if (flying) - { - if (NPC.localAI[0] != 1f) - { - NPC.netUpdate = true; - } - NPC.localAI[0] = 1f; - } - else - { - if (NPC.localAI[0] != 0f) - { - NPC.netUpdate = true; - } - NPC.localAI[0] = 0f; - } - if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) - { - NPC.netUpdate = true; - } - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - Player player = spawnInfo.Player; - bool gfbCondition = Main.zenithWorld && (player.ZoneHallow || player.ZoneUnderworldHeight) && NPC.downedMoonlord; - if ((gfbCondition || (player.ZoneRockLayerHeight && !player.ZoneUnderworldHeight && !player.ZoneJungle)) && !player.ZoneDungeon && !player.Calamity().ZoneSunkenSea && !player.Calamity().ZoneAbyss) - { - if (!CalamityPlayer.areThereAnyDamnBosses && NPC.downedPlantBoss && !NPC.AnyNPCs(ModContent.NPCType())) - { - float spawnRateDivisor = CalamityWorld.revenge ? 425f : 500f; - return 1 / spawnRateDivisor; - } - } - return 0f; - } - - public override void BossLoot(ref int potionType) - { - potionType = ItemID.GreaterHealingPotion; - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerHead2").Type, 1f); - } - } - } - - public override bool SpecialOnKill() - { - int closestSegmentID = DropHelper.FindClosestWormSegment(NPC, - ModContent.NPCType(), - ModContent.NPCType(), - ModContent.NPCType()); - NPC.position = Main.npc[closestSegmentID].position; - return false; - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ModContent.ItemType(), 1, 4, 8); - npcLoot.Add(ModContent.ItemType(), 1, 4, 8); - npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 1, 3, 6, ui: false); - npcLoot.AddIf(() => Main.zenithWorld, ModContent.ItemType(), 10, ui: false); - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.MechanizedSerpent"); - } - } - - public override Color? GetAlpha(Color drawColor) - { - if (Main.zenithWorld) - { - Color lightColor = Color.Orange * drawColor.A; - return lightColor * NPC.Opacity; - } - else return null; - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.IsABestiaryIconDummy) - { - return CalamityUtils.DrawAnimatedBestiaryWorm(spriteBatch, NPC, drawColor, TextureAssets.Npc[Type].Value, TextureAssets.Npc[ModContent.NPCType()].Value, 4, 26, 0.6f, new Vector2(10, -10), 4, 16); - } - return true; - } - } -} diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.png b/NPCs/NormalNPCs/ArmoredDiggerHead.png deleted file mode 100644 index ee6a1bdf46..0000000000 Binary files a/NPCs/NormalNPCs/ArmoredDiggerHead.png and /dev/null differ diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs deleted file mode 100644 index 39359d581f..0000000000 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ /dev/null @@ -1,150 +0,0 @@ -using System; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - [LongDistanceNetSync(SyncWith = typeof(ArmoredDiggerHead))] - public class ArmoredDiggerTail : ModNPC - { - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.ArmoredDiggerHead.DisplayName"); - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.damage = 55; - NPC.width = 34; - NPC.height = 34; - NPC.defense = 30; - NPC.lifeMax = 20000; - NPC.knockBackResist = 0f; - NPC.aiStyle = -1; - AIType = -1; - NPC.behindTiles = true; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; - NPC.netAlways = true; - NPC.dontCountMe = true; - Banner = ModContent.NPCType(); - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToElectricity = true; - } - - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) - { - return false; - } - - public override void AI() - { - if (NPC.ai[3] > 0f && Main.npc[(int)NPC.ai[3]].type == ModContent.NPCType()) - { - NPC.realLife = (int)NPC.ai[3]; - } - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - { - NPC.TargetClosest(true); - } - bool shouldDie = false; - if (NPC.ai[1] <= 0f) - { - shouldDie = true; - } - else if (Main.npc[(int)NPC.ai[1]].life <= 0) - { - shouldDie = true; - } - if (shouldDie && !Main.zenithWorld) - { - NPC.life = 0; - NPC.HitEffect(0, 10.0); - NPC.checkDead(); - } - Vector2 segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - float targetXDist = Main.player[NPC.target].position.X + (float)(Main.player[NPC.target].width / 2); - float targetYDist = Main.player[NPC.target].position.Y + (float)(Main.player[NPC.target].height / 2); - targetXDist = (float)((int)(targetXDist / 16f) * 16); - targetYDist = (float)((int)(targetYDist / 16f) * 16); - segmentPosition.X = (float)((int)(segmentPosition.X / 16f) * 16); - segmentPosition.Y = (float)((int)(segmentPosition.Y / 16f) * 16); - targetXDist -= segmentPosition.X; - targetYDist -= segmentPosition.Y; - float targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - if (NPC.ai[1] > 0f && NPC.ai[1] < (float)Main.npc.Length) - { - try - { - segmentPosition = new Vector2(NPC.position.X + (float)NPC.width * 0.5f, NPC.position.Y + (float)NPC.height * 0.5f); - targetXDist = Main.npc[(int)NPC.ai[1]].position.X + (float)(Main.npc[(int)NPC.ai[1]].width / 2) - segmentPosition.X; - targetYDist = Main.npc[(int)NPC.ai[1]].position.Y + (float)(Main.npc[(int)NPC.ai[1]].height / 2) - segmentPosition.Y; - } - catch - { - } - NPC.rotation = (float)Math.Atan2((double)targetYDist, (double)targetXDist) + 1.57f; - targetDistance = (float)Math.Sqrt((double)(targetXDist * targetXDist + targetYDist * targetYDist)); - int segmentWidth = (int)(44f * NPC.scale); - targetDistance = (targetDistance - (float)segmentWidth) / targetDistance; - targetXDist *= targetDistance; - targetYDist *= targetDistance; - NPC.velocity = Vector2.Zero; - NPC.position.X = NPC.position.X + targetXDist; - NPC.position.Y = NPC.position.Y + targetYDist; - } - } - - public override bool CheckActive() - { - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 3; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail").Type, 1f); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("ArmoredDiggerTail2").Type, 1f); - } - } - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.MechanizedSerpent"); - } - } - - public override Color? GetAlpha(Color drawColor) - { - if (Main.zenithWorld) - { - Color lightColor = Color.Orange * drawColor.A; - return lightColor * NPC.Opacity; - } - else return null; - } - } -} diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.png b/NPCs/NormalNPCs/ArmoredDiggerTail.png deleted file mode 100644 index ce25bd2ffe..0000000000 Binary files a/NPCs/NormalNPCs/ArmoredDiggerTail.png and /dev/null differ diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 038a7dd847..4ba61aec24 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -2098,7 +2098,8 @@ namespace CalamityMod.NPCs.OldDuke normalOnly.Add(ModContent.ItemType(), 10); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 30856c4c53..de4c592c7f 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -686,7 +686,8 @@ namespace CalamityMod.NPCs.Perforator // Equipment normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 5056b4f28b..3c1ddadae8 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -1354,7 +1354,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 30, 40)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index b9c2689631..3b5e659e2b 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -992,7 +992,8 @@ namespace CalamityMod.NPCs.Polterghast normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 20, 25)); diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 74d2195fcc..fb99a5576a 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -23,7 +23,7 @@ using Terraria; using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; -using Terraria.Graphics.Effects; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Filters = Terraria.Graphics.Effects.Filters; @@ -1199,7 +1199,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians { npcLoot.Add(ModContent.ItemType(), 4); npcLoot.Add(ModContent.ItemType(), 7); - npcLoot.Add(ModContent.ItemType(), 4); + + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // npcLoot.Add(ModContent.ItemType(), 1); + LeadingConditionRule expert = npcLoot.DefineConditionalDropSet(new Conditions.IsExpert()); + expert.Add(ModContent.ItemType(), 1); + npcLoot.Add(expert); + npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType()); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 15, 20, 20, 25)); diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index fe971ce389..5794954d51 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -2028,7 +2028,8 @@ namespace CalamityMod.NPCs.Providence normalOnly.Add(ModContent.ItemType(), 10); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials normalOnly.Add(ModContent.ItemType(), 1, 50, 60); diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 6eea24650b..bd7552cf28 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -1014,7 +1014,8 @@ namespace CalamityMod.NPCs.Ravager normalOnly.Add(ItemDropRule.ByCondition(DropHelper.If(() => DownedBossSystem.downedProvidence), ModContent.ItemType()), hideLootReport: !DownedBossSystem.downedProvidence); // Equipment - normalOnly.Add(ModContent.ItemType(), 3); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(ModContent.ItemType(), 3); normalOnly.Add(ModContent.ItemType(), 3); normalOnly.Add(ItemDropRule.ByCondition(DropHelper.PostProv(), ModContent.ItemType())); diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index 1b1c79e4a6..21b8a4b2bf 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -924,7 +924,8 @@ namespace CalamityMod.NPCs.Signus normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity normalOnly.Add(ModContent.ItemType(), 7); diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 36c88d757b..a63f26c58d 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -754,7 +754,8 @@ namespace CalamityMod.NPCs.SlimeGod normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); // Equipment - normalOnly.Add(ModContent.ItemType()); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(ModContent.ItemType()); } npcLoot.Add(ModContent.ItemType(), 10); diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 89ec7bec83..26d5966777 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -981,7 +981,8 @@ namespace CalamityMod.NPCs.StormWeaver normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Materials normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs index 384e6de48e..8d25c15808 100644 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -16,6 +16,7 @@ using CalamityMod.Enums; using System.IO; using CalamityMod.Particles; using Terraria.Audio; +using CalamityMod.Items.Potions; namespace CalamityMod.NPCs.SunkenSea { @@ -480,8 +481,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (PanaceaTimer > 60) { - // TODO: add actual panacea item - Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ItemID.FlaskofPoison); + Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ModContent.ItemType()); PanaceaTimer = 60; } return false; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 2f169574ce..cc8becde11 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -3542,7 +3542,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // SCal vanity set (This drops all at once, or not at all) var scalVanitySet = ItemDropRule.Common(ModContent.ItemType(), 7); diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 67321609d4..b90ee34476 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -2987,7 +2987,8 @@ namespace CalamityMod.NPCs.Yharon normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 35, 40)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + // 16NOV2025: Ozzatron: item has been chosen as the "Expert gatekept" item for this Calamity boss + // normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); } diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 415b7653c4..4cf2323c8e 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -2,61 +2,75 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; -using CalamityMod.Graphics; +using CalamityMod.Enums; +using CalamityMod.Systems.Graphic.PixelationSystem; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; -using Terraria.ID; using Terraria.ModLoader; -using Terraria.ModLoader.Core; -using Terraria.ModLoader.IO; namespace CalamityMod.Particles { + // Important credits for Spirit and Luminance: + #region CREDITS + + // 06JAN2022: Iban + // This particle system was inspired by spirit mod's own particle system, with permission granted by Yuyutsu. Love you spirit mod! -Iban + + // 05NOV2025: fryzahh + // Particle drawing implementation was inspired by Luminance's ParticleManager.cs. See licensing information below: + // https://github.com/LucilleKarma/Luminance/blob/main/LICENSE + // + // MIT License + // + // Copyright(c) 2024 Dominic + // + // Permission is hereby granted, free of charge, to any person obtaining a copy + // of this software and associated documentation files (the "Software"), to deal + // in the Software without restriction, including without limitation the rights + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + // copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + // + // The above copyright notice and this permission notice shall be included in all + // copies or substantial portions of the Software. + #endregion + [Autoload(Side = ModSide.Client)] public sealed class GeneralParticleHandler : ModSystem { - private static List particles; - private static Queue particlesToSpawnNextFrame; - //List containing the particles to delete + #region Fields + /// + /// The integer ID of each particle type defined across all mods, identified by the internal type of the respective particle. + /// + internal static Dictionary particleIDsByTypes; + + /// + /// The individual, autoloaded textures of each particle type defined across all mods, identified by the ID of the respective particle. + /// + internal static Dictionary particleTexturesByIDs; + + // Collections for tracking particles active in the world. + private static List activeParticles; private static List particlesToKill; - //Static list for details concerning every particle type - internal static Dictionary particleTypes; - internal static Dictionary particleTextures; - //Lists used when drawing particles batched - private static List batchedAlphaBlendParticles; - private static List batchedNonPremultipliedParticles; - private static List batchedAdditiveBlendParticles; + private static Dictionary> particlesToSpawnNextFrame; + private static Dictionary> particlesToSpawnNextFrame_Pixelated; - private static ManagedRenderTarget PixelationTarget_AlphaBlend; - private static ManagedRenderTarget PixelationTarget_NonPremultiplied; - private static ManagedRenderTarget PixelationTarget_AdditiveBlend; - - /// - /// Whether or not the system is currently rendering any pixelated prticles to the render target or not. - /// - private static bool CurrentlyRendering { get; set; } - - /// - /// The resolution ratio at which pixelated particles should draw.
- /// 0.5f will draw at half resolution, 0.25f will draw at quarter resolution, etc. - ///
- private const float PixelationResolution = 0.5f; - - /// - /// Creates a render target at half the screen's dimensions. - /// This is done due to the fact that when the target itself drawn, it needs to be drawn at double the original scale in order to pixelate its contents - /// - private static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.instance.GraphicsDevice, (int)(width * PixelationResolution), (int)(height * PixelationResolution)); + // Collections for correctly organizing active prticles for drawing. + private static Dictionary> particlesToDraw; + private static Dictionary> particlesToDraw_Pixelated; + private static Dictionary>> particlesToDraw_CustomShader; + #endregion + #region Loading and Unloading public override void PostSetupContent() { Type baseParticleType = typeof(Particle); ReflectionHelper.IterateEveryModsTypes(action: type => { - int ID = particleTypes.Count; //Get the ID of the particle - particleTypes[type] = ID; + int ID = particleIDsByTypes.Count; //Get the ID of the particle + particleIDsByTypes[type] = ID; // Flow: 2024/09/17 // 'UnintializedObject' is allowed to use here as it's only read for Texture string Property @@ -69,294 +83,143 @@ namespace CalamityMod.Particles string texturePath = type.Namespace.Replace('.', '/') + "/" + type.Name; if (instance.Texture != "") texturePath = instance.Texture; - particleTextures[ID] = ModContent.Request(texturePath, AssetRequestMode.ImmediateLoad).Value; + particleTexturesByIDs[ID] = ModContent.Request(texturePath, AssetRequestMode.ImmediateLoad).Value; }); - - On_Main.CheckMonoliths += DrawToTarget; } public override void Load() { - particles = []; - particlesToSpawnNextFrame = []; + particleIDsByTypes = []; + particleTexturesByIDs = []; + + activeParticles = []; particlesToKill = []; - particleTypes = []; - particleTextures = []; + particlesToSpawnNextFrame = []; + particlesToSpawnNextFrame_Pixelated = []; - batchedAlphaBlendParticles = []; - batchedNonPremultipliedParticles = []; - batchedAdditiveBlendParticles = []; - - Main.QueueMainThreadAction(() => - { - PixelationTarget_AlphaBlend = new(true, CreatePixelTarget); - PixelationTarget_NonPremultiplied = new(true, CreatePixelTarget); - PixelationTarget_AdditiveBlend = new(true, CreatePixelTarget); - }); + particlesToDraw = []; + particlesToDraw_Pixelated = []; + particlesToDraw_CustomShader = []; } public override void Unload() { - particles = null; - particlesToSpawnNextFrame = null; + particleIDsByTypes = null; + particleTexturesByIDs = null; + + activeParticles = null; particlesToKill = null; - particleTypes = null; - particleTextures = null; + particlesToSpawnNextFrame = null; + particlesToSpawnNextFrame_Pixelated = null; - batchedAlphaBlendParticles = null; - batchedNonPremultipliedParticles = null; - batchedAdditiveBlendParticles = null; - - On_Main.CheckMonoliths -= DrawToTarget; + particlesToDraw = null; + particlesToDraw_Pixelated = null; + particlesToDraw_CustomShader = null; } + public override void OnWorldUnload() + { + activeParticles.Clear(); + particlesToKill.Clear(); + particlesToSpawnNextFrame.Clear(); + particlesToSpawnNextFrame_Pixelated.Clear(); + + particlesToDraw.Clear(); + particlesToDraw_Pixelated.Clear(); + particlesToDraw_CustomShader.Clear(); + } + #endregion + /// /// Spawns the particle instance provided into the world. If the particle limit is reached but the particle is marked as important, it will try to replace a non important particle. /// - public static void SpawnParticle(Particle particle) + /// Set to true to force the particle being spawned to be drawn pixelated. + /// Only set this to a non-null value if you'd like to manually override the draw layer of the particle instance you are spawning. + public static void SpawnParticle(Particle particle, bool pixelate = false, GeneralDrawLayer? manualDrawLayerOverride = null) { // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. // Don't spawn particles if on the server either, or if the particles dictionary is somehow null. - if (Main.gamePaused || Main.dedServ || particles == null) + if (Main.gamePaused || Main.dedServ || activeParticles == null) return; - if (particles.Count >= CalamityClientConfig.Instance.ParticleLimit && !particle.Important) + if (activeParticles.Count >= CalamityClientConfig.Instance.ParticleLimit && !particle.Important) return; - particles.Add(particle); - particle.Type = particleTypes[particle.GetType()]; + particle.Pixelate = pixelate; + if (manualDrawLayerOverride.HasValue) + particle.DrawLayer = manualDrawLayerOverride.Value; + + activeParticles.Add(particle); + ReturnAssociatedDrawCollection(particle).Add(particle); + particle.Type = particleIDsByTypes[particle.GetType()]; } - public static void QueueParticleForNextFrame(Particle particle) + /// + /// Queues a particle instance to be spawned from within a single frame after this is called. + ///
Should be used in cases where you need to spawn a particle type from inside the overall particle update loop, such as inside the Update method of + /// another particle type.
+ ///
The single frame buffer ensures the overall particle update loop isn't altered prematurely from within the loop itself.
+ ///
+ /// Set to true to force the particle being spawned to be drawn pixelated. + /// Only set this to a non-null value if you'd like to manually override the draw layer of the particle instance you are spawning. + public static void QueueParticleForNextFrame(Particle particle, bool pixelate = false, GeneralDrawLayer? manualDrawLayerOverride = null) { // Don't queue particles if the game is paused. // This precedent is established with how Dust instances are created. // Don't spawn particles if on the server side, or if the particles dictionary is somehow null. - if (Main.gamePaused || Main.dedServ || particles == null) + if (Main.gamePaused || Main.dedServ || activeParticles == null) return; - particlesToSpawnNextFrame.Enqueue(particle); - } - - public static void Update() - { - if (Main.dedServ) - return; - - while (particlesToSpawnNextFrame.Count > 0) - SpawnParticle(particlesToSpawnNextFrame.Dequeue()); - - foreach (Particle particle in particles) + GeneralDrawLayer actualDrawLayer = manualDrawLayerOverride ?? particle.DrawLayer; + if (pixelate) { - if (particle == null) - continue; - particle.Position += particle.Velocity; - particle.Time++; - particle.Update(); + if (!particlesToSpawnNextFrame_Pixelated.ContainsKey(actualDrawLayer)) + particlesToSpawnNextFrame_Pixelated[actualDrawLayer] = []; + particlesToSpawnNextFrame_Pixelated[actualDrawLayer].Enqueue(particle); + } + else + { + if (!particlesToSpawnNextFrame.ContainsKey(actualDrawLayer)) + particlesToSpawnNextFrame[actualDrawLayer] = []; + particlesToSpawnNextFrame[actualDrawLayer].Enqueue(particle); } - //Clear out particles whose time is up - particles.RemoveAll(particle => (particle.Time >= particle.Lifetime && particle.SetLifetime) || particlesToKill.Contains(particle)); - particlesToKill.Clear(); } + /// + /// Removes an active particle instance from the world entirely. + /// public static void RemoveParticle(Particle particle) { - if (Main.dedServ) + if (!Main.dedServ) + particlesToKill.Add(particle); + } + + /// + /// Removes all active particle instances in the world of a specified type. + /// + public static void RemoveParticlesOfType() where T : Particle + { + if (Main.dedServ || activeParticles is null || activeParticles.Count == 0) return; - particlesToKill.Add(particle); - } - - private static void DrawToTarget(On_Main.orig_CheckMonoliths orig) - { - if (Main.gameMenu) + foreach (Particle particle in activeParticles) { - orig(); - return; - } - - List pixelatedAlphaBlendParticles = []; - List pixelatedNonPremultipliedParticles = []; - List pixelatedAdditiveBlendParticles = []; - - // Add each particle to their respective lists. - foreach (Particle particle in particles) - { - if (particle != null && particle.Pixelate) - { - pixelatedAlphaBlendParticles.AddWithCondition(particle, !particle.UseAdditiveBlend && !particle.UseHalfTransparency); - pixelatedNonPremultipliedParticles.AddWithCondition(particle, !particle.UseAdditiveBlend && particle.UseHalfTransparency); - pixelatedAdditiveBlendParticles.AddWithCondition(particle, particle.UseAdditiveBlend && !particle.UseHalfTransparency); - } - } - - CurrentlyRendering = true; - - Matrix pixelationMatrix = Main.GameViewMatrix.TransformationMatrix - * Matrix.CreateScale(PixelationResolution / Main.GameViewMatrix.Zoom.X, PixelationResolution / Main.GameViewMatrix.Zoom.Y, 1f) - * Matrix.CreateTranslation(Main.GameViewMatrix.Translation.X * PixelationResolution, Main.GameViewMatrix.Translation.Y * PixelationResolution, 0f); - - DrawParticlesToRenderTarget(PixelationTarget_AlphaBlend, pixelatedAlphaBlendParticles, BlendState.AlphaBlend, pixelationMatrix); - DrawParticlesToRenderTarget(PixelationTarget_NonPremultiplied, pixelatedNonPremultipliedParticles, BlendState.NonPremultiplied, pixelationMatrix); - DrawParticlesToRenderTarget(PixelationTarget_AdditiveBlend, pixelatedAdditiveBlendParticles, BlendState.Additive, pixelationMatrix); - - Main.instance.GraphicsDevice.SetRenderTarget(null); - CurrentlyRendering = false; - - orig(); - } - - private static void DrawParticlesToRenderTarget(RenderTarget2D target, List particles, BlendState blendStateToUse, Matrix pixelationMatrix) - { - target.SwapTo(); - - if (particles.Count > 0) - { - Main.spriteBatch.Begin(SpriteSortMode.Deferred, blendStateToUse, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, pixelationMatrix); - - foreach (Particle particle in particles) - { - if (particle.UseCustomDraw) - { - particle.CustomDraw(Main.spriteBatch); - } - else - { - Color lightColor = particle.Color; - if (particle.AffectedByLight) - lightColor = particle.Color.MultiplyRGB(Lighting.GetColor((particle.Position / 16).ToPoint())); - - Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); - Main.spriteBatch.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, lightColor, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); - } - } - - Main.spriteBatch.End(); + if (particle.GetType() == typeof(T)) + particlesToKill.Add(particle); } } - private static void DrawPixelatedParticles() + /// + /// Removes ALL active particle instances in the world. + /// + public static void RemoveAllParticles() { - DrawScaledTarget(PixelationTarget_AlphaBlend, Main.spriteBatch, BlendState.AlphaBlend); - DrawScaledTarget(PixelationTarget_NonPremultiplied, Main.spriteBatch, BlendState.NonPremultiplied); - DrawScaledTarget(PixelationTarget_AdditiveBlend, Main.spriteBatch, BlendState.Additive); - } - - private static void DrawScaledTarget(ManagedRenderTarget targetToDraw, SpriteBatch spriteBatch, BlendState blendState) - { - const float inversePixelationScale = 1f / PixelationResolution; - - spriteBatch.Begin(SpriteSortMode.Deferred, blendState, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - spriteBatch.Draw(targetToDraw, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, inversePixelationScale, SpriteEffects.None, 0f); - spriteBatch.End(); - } - - public static void DrawAllParticles(SpriteBatch sb) - { - if (Main.dedServ) + if (Main.dedServ || activeParticles is null || activeParticles.Count == 0) return; - if (particles.Count == 0) - return; - - sb.End(); - var rasterizer = Main.Rasterizer; - rasterizer.ScissorTestEnable = true; - Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; - Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); - - //Batch the particles to avoid constant restarting of the spritebatch - foreach (Particle particle in particles) - { - if (particle == null) - continue; - - if (particle.Pixelate) - continue; - - if (particle.UseAdditiveBlend) - batchedAdditiveBlendParticles.Add(particle); - else if (particle.UseHalfTransparency) - batchedNonPremultipliedParticles.Add(particle); - else - batchedAlphaBlendParticles.Add(particle); - } - if (batchedAlphaBlendParticles.Count > 0) - { - sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - foreach (Particle particle in batchedAlphaBlendParticles) - { - if (particle.UseCustomDraw) - particle.CustomDraw(sb); - else - { - Color lightColor = particle.Color; - if (particle.AffectedByLight) - { - lightColor = particle.Color.MultiplyRGB(Lighting.GetColor((particle.Position / 16).ToPoint())); - } - - Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); - sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, lightColor, particle.Rotation, frame.Size() * 0.5f, - particle.Scale, SpriteEffects.None, 0f); - } - } - sb.End(); - } - - - if (batchedNonPremultipliedParticles.Count > 0) - { - rasterizer = Main.Rasterizer; - rasterizer.ScissorTestEnable = true; - Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; - Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); - sb.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - foreach (Particle particle in batchedNonPremultipliedParticles) - { - if (particle.UseCustomDraw) - particle.CustomDraw(sb); - else - { - Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); - sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, particle.Color, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); - } - } - sb.End(); - } - - if (batchedAdditiveBlendParticles.Count > 0) - { - rasterizer = RasterizerState.CullNone; - rasterizer.ScissorTestEnable = true; - Main.instance.GraphicsDevice.RasterizerState.ScissorTestEnable = true; - Main.instance.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); - sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.Default, rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - foreach (Particle particle in batchedAdditiveBlendParticles) - { - if (particle.UseCustomDraw) - particle.CustomDraw(sb); - else - { - Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); - sb.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, particle.Color, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); - } - } - sb.End(); - } - - batchedAlphaBlendParticles.Clear(); - batchedNonPremultipliedParticles.Clear(); - batchedAdditiveBlendParticles.Clear(); - - // Draw all pixelated particles. - DrawPixelatedParticles(); - - sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); + foreach (Particle particle in activeParticles) + particlesToKill.Add(particle); } /// @@ -366,10 +229,10 @@ namespace CalamityMod.Particles public static int FreeSpacesAvailable() { //Safety check - if (Main.dedServ || particles == null) + if (Main.dedServ || activeParticles == null) return 0; - return CalamityClientConfig.Instance.ParticleLimit - particles.Count(); + return CalamityClientConfig.Instance.ParticleLimit - activeParticles.Count(); } /// @@ -380,11 +243,240 @@ namespace CalamityMod.Particles if (Main.dedServ) return null; - return particleTextures[type]; + return particleTexturesByIDs[type]; } -#pragma warning disable CS0414 - private static string noteToEveryone = "This particle system was inspired by spirit mod's own particle system, with permission granted by Yuyutsu. Love you spirit mod! -Iban"; -#pragma warning restore CS0414 + public static void Update() + { + if (Main.dedServ) + return; + + // Spawn queued particles. + foreach (var collectionsByDrawLayer in particlesToSpawnNextFrame) + { + while (collectionsByDrawLayer.Value.Count > 0) + SpawnParticle(collectionsByDrawLayer.Value.Dequeue(), false, collectionsByDrawLayer.Key); + } + + foreach (var collectionsByDrawLayer in particlesToSpawnNextFrame_Pixelated) + { + while (collectionsByDrawLayer.Value.Count > 0) + SpawnParticle(collectionsByDrawLayer.Value.Dequeue(), true, collectionsByDrawLayer.Key); + } + + // Update all particle instances in the world. + foreach (Particle particle in activeParticles) + { + if (particle == null) + continue; + + particle.Position += particle.Velocity; + particle.Time++; + particle.Update(); + } + + //Clear out particles whose time is up + activeParticles.RemoveAll(particle => + { + if ((particle.Time >= particle.Lifetime && particle.SetLifetime) || particlesToKill.Contains(particle)) + { + ReturnAssociatedDrawCollection(particle).Remove(particle); + return true; + } + return false; + }); + + particlesToKill.Clear(); + } + + internal static void DrawParticleCollectionsAtSpecificLayer(GeneralDrawLayer drawLayer) + { + if (Main.dedServ) + return; + + DrawParticleCollection(particlesToDraw, drawLayer); + DrawParticleCollection(particlesToDraw_Pixelated, drawLayer, true); + DrawParticlesWithShaders(drawLayer); + } + + private static void DrawParticleInstance(Particle particle) + { + int drawIterations = Main.LocalPlayer.Calamity().trippy ? 4 : 1; + for (int i = 0; i < drawIterations; i++) + { + // If you have shrooms, manually spoof the position of the particle for each clone location + Vector2 positionSpoof = particle.Position; + Vector2 positionDiff = positionSpoof - Main.LocalPlayer.Center; + switch (i) + { + case 0: + break; + case 1: + particle.Position = Main.LocalPlayer.Center - positionDiff; + break; + case 2: + particle.Position = Main.LocalPlayer.Center - Vector2.UnitY * positionDiff.Y + Vector2.UnitX * positionDiff.X; + break; + case 3: + particle.Position = Main.LocalPlayer.Center - Vector2.UnitX * positionDiff.X + Vector2.UnitY * positionDiff.Y; + break; + } + + if (Main.LocalPlayer.Calamity().trippy) + particle.Color = Main.DiscoColor; + + // The actual drawing step + if (particle.UseCustomDraw) + { + particle.CustomDraw(Main.spriteBatch); + } + else + { + Color lightColor = particle.Color; + if (particle.AffectedByLight) + lightColor = particle.Color.MultiplyRGB(Lighting.GetColor((particle.Position / 16).ToPoint())); + + Rectangle frame = particleTexturesByIDs[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); + Main.spriteBatch.Draw(particleTexturesByIDs[particle.Type], particle.Position - Main.screenPosition, frame, lightColor, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); + } + + // Since the switch case directly modifies the particle position, this resets it to the proper location + particle.Position = positionSpoof; + } + } + + private static void DrawParticleCollection(Dictionary> drawCollection, GeneralDrawLayer drawLayer, bool pixelated = false) + { + var scissorRectRasterizer = Main.Rasterizer; + scissorRectRasterizer.ScissorTestEnable = true; + Main.graphics.GraphicsDevice.RasterizerState.ScissorTestEnable = true; + Main.graphics.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, Main.screenWidth, Main.screenHeight); + + foreach (var keyValuePair in drawCollection) + { + if (pixelated) + { + PixelationManager.AddPixelatedDrawer((pixelationMatrix) => + { + var particlesAtSpecifiedLayer = keyValuePair.Value.Where(p => p.DrawLayer == drawLayer); + if (particlesAtSpecifiedLayer.Any()) + { + foreach (Particle particle in particlesAtSpecifiedLayer) + DrawParticleInstance(particle); + } + + }, drawLayer, keyValuePair.Key); + } + else + { + Main.spriteBatch.Begin(SpriteSortMode.Deferred, keyValuePair.Key, SamplerState.LinearClamp, DepthStencilState.None, scissorRectRasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + var particlesAtSpecifiedLayer = keyValuePair.Value.Where(p => p.DrawLayer == drawLayer); + if (particlesAtSpecifiedLayer.Any()) + { + foreach (Particle particle in particlesAtSpecifiedLayer) + DrawParticleInstance(particle); + } + + Main.spriteBatch.End(); + } + } + } + + private static void DrawParticlesWithShaders(GeneralDrawLayer drawLayer) + { + foreach (var shaderDrawCollectionPair in particlesToDraw_CustomShader) + { + foreach (var blendStateParticleListPair in shaderDrawCollectionPair.Value) + { + if (blendStateParticleListPair.Value.Count == 0) + return; + + Main.spriteBatch.Begin(SpriteSortMode.Immediate, blendStateParticleListPair.Key, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, shaderDrawCollectionPair.Key, Main.GameViewMatrix.TransformationMatrix); + + var particlesAtDrawLayer = blendStateParticleListPair.Value.Where(p => p.DrawLayer == drawLayer); + foreach (Particle particle in particlesAtDrawLayer) + { + particle.PrepareCustomShader(shaderDrawCollectionPair.Key); + DrawParticleInstance(particle); + } + + Main.spriteBatch.End(); + } + } + } + + private static List ReturnAssociatedDrawCollection(Particle particle) + { + // Particles with custom shaders. + if (particle.CustomShader != null) + { + if (!particlesToDraw_CustomShader.ContainsKey(particle.CustomShader)) + particlesToDraw_CustomShader[particle.CustomShader] = []; + + if (particle.UseAdditiveBlend) + { + if (!particlesToDraw_CustomShader[particle.CustomShader].ContainsKey(BlendState.Additive)) + particlesToDraw_CustomShader[particle.CustomShader][BlendState.Additive] = []; + return particlesToDraw_CustomShader[particle.CustomShader][BlendState.Additive]; + } + else if (particle.UseHalfTransparency) + { + if (!particlesToDraw_CustomShader[particle.CustomShader].ContainsKey(BlendState.NonPremultiplied)) + particlesToDraw_CustomShader[particle.CustomShader][BlendState.NonPremultiplied] = []; + return particlesToDraw_CustomShader[particle.CustomShader][BlendState.NonPremultiplied]; + } + else + { + if (!particlesToDraw_CustomShader[particle.CustomShader].ContainsKey(BlendState.AlphaBlend)) + particlesToDraw_CustomShader[particle.CustomShader][BlendState.AlphaBlend] = []; + return particlesToDraw_CustomShader[particle.CustomShader][BlendState.AlphaBlend]; + } + } + // Pixelated particles. + else if (particle.Pixelate) + { + if (particle.UseAdditiveBlend) + { + if (!particlesToDraw_Pixelated.ContainsKey(BlendState.Additive)) + particlesToDraw_Pixelated[BlendState.Additive] = []; + return particlesToDraw_Pixelated[BlendState.Additive]; + } + else if (particle.UseHalfTransparency) + { + if (!particlesToDraw_Pixelated.ContainsKey(BlendState.NonPremultiplied)) + particlesToDraw_Pixelated[BlendState.NonPremultiplied] = []; + return particlesToDraw_Pixelated[BlendState.NonPremultiplied]; + } + else + { + if (!particlesToDraw_Pixelated.ContainsKey(BlendState.AlphaBlend)) + particlesToDraw_Pixelated[BlendState.AlphaBlend] = []; + return particlesToDraw_Pixelated[BlendState.AlphaBlend]; + } + } + // Non-pixelated particles (regular). + else + { + if (particle.UseAdditiveBlend) + { + if (!particlesToDraw.ContainsKey(BlendState.Additive)) + particlesToDraw[BlendState.Additive] = []; + return particlesToDraw[BlendState.Additive]; + } + else if (particle.UseHalfTransparency) + { + if (!particlesToDraw.ContainsKey(BlendState.NonPremultiplied)) + particlesToDraw[BlendState.NonPremultiplied] = []; + return particlesToDraw[BlendState.NonPremultiplied]; + } + else + { + if (!particlesToDraw.ContainsKey(BlendState.AlphaBlend)) + particlesToDraw[BlendState.AlphaBlend] = []; + return particlesToDraw[BlendState.AlphaBlend]; + } + } + } } } diff --git a/Particles/Particle.cs b/Particles/Particle.cs index 0681436106..7e82f578cf 100644 --- a/Particles/Particle.cs +++ b/Particles/Particle.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Enums; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Particles @@ -6,18 +7,81 @@ namespace CalamityMod.Particles public class Particle { /// - /// The ID of the particle inside of the general particle handler's array. This is set automatically when the particle is created - /// - public int ID; - /// - /// The ID of the particle type as registered by the general particle handler. This is set automatically when the particle handler loads + /// The ID of the particle type as registered by when the mod loads. + ///
This field is set automatically when a particle instance is spawned in the world. This should NOT be set outside of that context.
///
public int Type; + /// /// The amount of frames this particle has existed for. You shouldn't have to touch this manually. /// public int Time; + /// + /// The maximum amount of frames a particle may stay alive if Particle.SetLifeTime is set to true + /// + public int Lifetime = 0; + + /// + /// The offset of the particle in relation to the origin of the set it belongs to. This is only used in the context of a . + /// + public Vector2 RelativeOffset; + + /// + /// The inworld position of a particle. Keep in mind this isn't used in the context of a , since all the particles work off their relative position to the set's origin + /// + public Vector2 Position; + + public Vector2 Velocity; + + public Vector2 Origin; + + public Color Color; + + public float Rotation; + + public float Scale; + + /// + /// The current Y-frame of this particle's spritesheet. + /// + public int Variant = 0; + + /// + /// Whether your particle is affected by light levels. + /// + public bool AffectedByLight = false; + + /// + /// Whether or not your particle should be drawn with a pixelated effect to match Terraria's pixel size. + ///
Defaults to false.
+ ///
+ public bool Pixelate = false; + + /// + /// The "layer" or point at which you'd like your particle to draw in Terraria's internal draw order. + ///
Defaults to .
+ ///
+ public GeneralDrawLayer DrawLayer = GeneralDrawLayer.AfterDusts; + + /// + /// An 0-1 interpolant representing how close this particle is from its . + /// + public float LifetimeCompletion => Lifetime != 0 ? Time / (float)Lifetime : 0; + + /// + /// The path to this particle's autoloaded texture. + /// + /// + /// Can be accessed via . + /// + public virtual string Texture => ""; + + /// + /// The maximum amount of frames this particle's spritesheet has vertically. + /// + public virtual int FrameVariants => 1; + /// /// Set this to true if you NEED the particle to render even if the particle cap is reached. /// @@ -27,58 +91,6 @@ namespace CalamityMod.Particles /// Set this to true if you want your particle to automatically get removed when its time reaches its maximum lifetime ///
public virtual bool SetLifetime => false; - /// - /// The maximum amount of frames a particle may stay alive if Particle.SetLifeTime is set to true - /// - public int Lifetime = 0; - - public float LifetimeCompletion => Lifetime != 0 ? Time / (float)Lifetime : 0; - - /// - /// The offset of the particle in relation to the origin of the set it belongs to. This is only used in the context of a Particle Set - /// - public Vector2 RelativeOffset; - /// - /// The inworld position of a particle. Keep in mind this isn't used in the context of a Particle Set, since all the particles work off their relative position to the set's origin - /// - public Vector2 Position; - public Vector2 Velocity; - - public Vector2 Origin; - public Color Color; - public float Rotation; - public float Scale; - - /// - /// Whether your particle is affected by light levels. - /// - public bool AffectedByLight = false; - - public virtual int FrameVariants => 1; - public int Variant = 0; - public virtual string Texture => ""; - - /// - /// Whether or not your particle should be drawn slightly pixelated to match Terraria's pixel size. - /// - public virtual bool Pixelate => false; - - /// - /// Set this to true to disable default particle drawing, thus calling Particle.CustomDraw() instead. - /// - public virtual bool UseCustomDraw => false; - - /// - /// Use this method if you want to handle the particle drawing yourself. Only called if Particle.UseCustomDraw is set to true. - /// - public virtual void CustomDraw(SpriteBatch spriteBatch) { } - - public virtual void CustomDraw(SpriteBatch spriteBatch, Vector2 basePosition) { } - /// - /// Called for every update of the particle handler. - /// The particle's velocity gets automatically added to its position, and its time automatically increases. - /// - public virtual void Update() { } /// /// Set this to true to make your particle use additive blending instead of alphablend. @@ -90,11 +102,42 @@ namespace CalamityMod.Particles /// public virtual bool UseHalfTransparency => false; + /// + /// Set this to true to disable default particle drawing, thus calling Particle.CustomDraw() instead. + /// + public virtual bool UseCustomDraw => false; + + /// + /// An optional shader parameter for this paricle to be drawn with. + /// Use to set shader parameters accordingly. + /// + public virtual Effect CustomShader => null; + + /// + /// Use this method if you want to handle the particle drawing yourself. Only called if is set to true. + /// + public virtual void CustomDraw(SpriteBatch spriteBatch) { } + + /// + /// Use this method if you want to handle particle drawing yourself in the context of a . + /// + /// The base position of the particle set. + public virtual void CustomDraw(SpriteBatch spriteBatch, Vector2 basePosition) { } + + /// + /// Use this method if you're using a custom shader effect with this particle type to set shader parameters accordingly. + /// + public virtual void PrepareCustomShader(Effect shader) { } + + /// + /// Called every frame in . + /// The particle's velocity gets automatically added to its position, and its time automatically increases. + /// + public virtual void Update() { } /// /// Removes the particle from the handler /// public void Kill() => GeneralParticleHandler.RemoveParticle(this); - } } diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 5ee4f66faa..9b0b0d7c43 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -4,6 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.DataStructures; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria.DataStructures; @@ -12,6 +13,7 @@ using Terraria.Audio; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Boss { public class DoGFire : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer @@ -160,7 +162,7 @@ namespace CalamityMod.Projectiles.Boss return Color.Lerp(fullBodyColor, Color.White, 0.175f); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { // Render the main trail for the body for the flame. GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index e9e6b69a59..93689b44fe 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4748,8 +4748,9 @@ namespace CalamityMod.Projectiles { if (projectile.ModProjectile is null || (projectile.ModProjectile != null && projectile.ModProjectile.CanHitPlayer(Main.LocalPlayer) && (projectile.ModProjectile.CanDamage() ?? true))) { - Color mainColor = Color.Lerp(Color.Crimson with { A = 0 }, Color.OrangeRed with { A = 0 }, ((Main.GlobalTimeWrappedHourly * 2) % 1f)); - return mainColor; + Color mainColor = Color.Lerp(Color.Crimson with { A = 0 }, Color.OrangeRed with { A = 0 }, (Main.GlobalTimeWrappedHourly * 2) % 1f); + Color actualDisplayColor = new Color(Math.Max(mainColor.R, lightColor.R), Math.Max(mainColor.G, lightColor.G), Math.Max(mainColor.B, lightColor.B)); + return actualDisplayColor; } } diff --git a/Projectiles/Magic/AerSigilMissile.cs b/Projectiles/Magic/AerSigilMissile.cs index f58b2ccb57..c3fa5fdccb 100644 --- a/Projectiles/Magic/AerSigilMissile.cs +++ b/Projectiles/Magic/AerSigilMissile.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 40; Projectile.height = 40; Projectile.friendly = true; - Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.DamageType = DamageClass.Magic; Projectile.ignoreWater = true; Projectile.tileCollide = true; Projectile.penetrate = 1; diff --git a/Projectiles/Magic/BlueBubble.cs b/Projectiles/Magic/BlueBubble.cs index e54b7b72f7..9d95003c4c 100644 --- a/Projectiles/Magic/BlueBubble.cs +++ b/Projectiles/Magic/BlueBubble.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -83,7 +84,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item54, Projectile.Center); + SoundEngine.PlaySound(Effervescence.PopSound, Projectile.Center); Particle Star = new CritSpark(Projectile.Center, Vector2.Zero, Color.SkyBlue, Color.DeepSkyBlue, Main.rand.NextFloat(1f, 1.1f), 30, 0.1f, 3f); GeneralParticleHandler.SpawnParticle(Star); int num190 = Main.rand.Next(5, 9); diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index 8e37b4b884..9b2448527d 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -2,6 +2,7 @@ using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -13,7 +14,7 @@ namespace CalamityMod.Projectiles.Magic { public class SHPB : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { - public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles; + public GeneralDrawLayer LayerToRenderTo => GeneralDrawLayer.BeforeProjectiles; public ref float ExplodeTimer => ref Projectile.ai[2]; @@ -377,7 +378,7 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(endColor, Color.White, deathInterpolant); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PlasmaBallWidthFunction, PlasmaBallColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index 055311f127..2d704a38a0 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -2,6 +2,7 @@ using System.Linq; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -22,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles; + public GeneralDrawLayer LayerToRenderTo => GeneralDrawLayer.BeforeProjectiles; public override void SetStaticDefaults() { @@ -137,7 +138,7 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(startColor, bodyColor, completion); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { // Render the main trail for the body for the laser. GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); diff --git a/Projectiles/Magic/SHPS.cs b/Projectiles/Magic/SHPS.cs index bd02542b8b..d4d256b49c 100644 --- a/Projectiles/Magic/SHPS.cs +++ b/Projectiles/Magic/SHPS.cs @@ -3,6 +3,7 @@ using System.Linq; using CalamityMod.DataStructures; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -234,7 +235,7 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(Color.White, tipColor, completion); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { // Render the main trail for the body for the soul. GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); diff --git a/Projectiles/Magic/SylvestaffHoldout.cs b/Projectiles/Magic/SylvestaffHoldout.cs index 4b9a08efb5..998f41df0e 100644 --- a/Projectiles/Magic/SylvestaffHoldout.cs +++ b/Projectiles/Magic/SylvestaffHoldout.cs @@ -2,6 +2,7 @@ using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Physics; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -14,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic { public class SylvestaffHoldout : ModProjectile, IPixelatedPrimitiveRenderer { - public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles | PixelationPrimitiveLayer.AfterPlayers; + public GeneralDrawLayer LayerToRenderTo => GeneralDrawLayer.BeforeProjectiles | GeneralDrawLayer.AfterPlayers; public override LocalizedText DisplayName => CalamityUtils.GetItemName(); @@ -186,9 +187,9 @@ namespace CalamityMod.Projectiles.Magic } } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { - bool backLayer = layer == PixelationPrimitiveLayer.BeforeProjectiles; + bool backLayer = layer == GeneralDrawLayer.BeforeProjectiles; RenderRibbon(LeftRibbon, -1, backLayer); RenderRibbon(RightRibbon, 1, backLayer); } diff --git a/Projectiles/Magic/UberBubble.cs b/Projectiles/Magic/UberBubble.cs index 36f9ad6e48..6af07a9d9d 100644 --- a/Projectiles/Magic/UberBubble.cs +++ b/Projectiles/Magic/UberBubble.cs @@ -1,10 +1,12 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Particles; -using CalamityMod.Dusts; + namespace CalamityMod.Projectiles.Magic { public class UberBubble : ModProjectile, ILocalizedModType @@ -63,7 +65,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item96, Projectile.Center); + SoundEngine.PlaySound(Effervescence.BurstSound, Projectile.Center); Particle Star = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.Purple, Color.PeachPuff, Main.rand.NextFloat(0.5f, 0.6f), 30, 0.1f, 3f); GeneralParticleHandler.SpawnParticle(Star); Star = new GenericSparkle(Projectile.Center + Projectile.velocity, Vector2.Zero, Color.MediumPurple, Color.LightPink, Main.rand.NextFloat(0.5f, 0.6f), 20, 0.1f, 3f); @@ -80,7 +82,7 @@ namespace CalamityMod.Projectiles.Magic if (Projectile.owner == Main.myPlayer) { for (int numBubbles = 0; numBubbles < 3; numBubbles++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * (Main.rand.NextFloat() * 2f), Projectile.velocity.Y * (Main.rand.NextFloat() * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(20f)) * Main.rand.NextFloat(0.5f, 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs index 796b9d43b2..b4cdf66a10 100644 --- a/Projectiles/Melee/ArkoftheCosmos_Constellation.cs +++ b/Projectiles/Melee/ArkoftheCosmos_Constellation.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee if (!Main.dedServ) { Particles.Add(particle); - particle.Type = GeneralParticleHandler.particleTypes[particle.GetType()]; + particle.Type = GeneralParticleHandler.particleIDsByTypes[particle.GetType()]; } } diff --git a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs index f28406a3ee..fb8dcc5914 100644 --- a/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs +++ b/Projectiles/Melee/Galaxia_AriesWrathConstellation.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee if (!Main.dedServ) { Particles.Add(particle); - particle.Type = GeneralParticleHandler.particleTypes[particle.GetType()]; + particle.Type = GeneralParticleHandler.particleIDsByTypes[particle.GetType()]; } } diff --git a/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs index 90f305fa35..9bc3a59757 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs @@ -2,6 +2,7 @@ using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Enums; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -81,7 +82,7 @@ namespace CalamityMod.Projectiles.Melee public float WidthFunction(float completionRatio) => MathF.Max(50f * Scale * (MathF.Pow(1f - completionRatio, 2) * 2.75f), 0.35f); public Color ColorFunction(float completionRatio) => Color.Orange * (completionRatio > 0.1f ? 1f : completionRatio * 10f); - public void RenderPixelatedPrimitives(SpriteBatch spritebatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spritebatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); GameShaders.Misc["CalamityMod:Bordernado"].UseOpacity(fadeOut); diff --git a/Projectiles/Rogue/NiceCock.cs b/Projectiles/Rogue/NiceCock.cs deleted file mode 100644 index 51360e48a2..0000000000 --- a/Projectiles/Rogue/NiceCock.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System.IO; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Rogue -{ - // The file name is a specific request from the patron - public class NiceCock : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public bool homing = false; - public int Timer = 0; - private bool initialized = false; - private Color[] colors = new Color[] - { - new Color(255, 0, 0, 50), //Red - new Color(255, 128, 0, 50), //Orange - new Color(255, 255, 0, 50), //Yellow - new Color(128, 255, 0, 50), //Lime - new Color(0, 255, 0, 50), //Green - new Color(0, 255, 128, 50), //Turquoise - new Color(0, 255, 255, 50), //Cyan - new Color(0, 128, 255, 50), //Light Blue - new Color(0, 0, 255, 50), //Blue - new Color(128, 0, 255, 50), //Purple - new Color(255, 0, 255, 50), //Fuschia - new Color(255, 0, 128, 50) //Hot Pink - }; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 5; - } - - public override void SetDefaults() - { - Projectile.width = 44; - Projectile.height = 70; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.timeLeft = 180; - Projectile.alpha = 255; - } - - public override void SendExtraAI(BinaryWriter writer) => writer.Write(homing); - - public override void ReceiveExtraAI(BinaryReader reader) => homing = reader.ReadBoolean(); - - public override bool? CanHitNPC(NPC target) - { - // Do not deal damage before fully opaque - if (Projectile.alpha >= 10) - return false; - int index = (int)Projectile.ai[1]; - if (Main.npc[index] is null || !Main.npc[index].active || Main.npc[index].life < 0) - return false; - // Do not deal damage to any NPC that isn't the specified target - if (index != target.whoAmI) - return false; - return null; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - // Fireballs disappear if you can't stealth strike - if (!modPlayer.wearingRogueArmor || modPlayer.rogueStealthMax <= 0) - Projectile.Kill(); - - Projectile.alpha -= 5; - - if (!initialized) - { - // Pick a random frame to start on - Projectile.frame = Main.rand.Next(Main.projFrames[Type]); - initialized = true; - } - - Projectile.frameCounter++; - if (Projectile.frameCounter > 8) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.frame = 0; - - int index = (int)Projectile.ai[1]; - - // If the target doesn't exist or is dead, spontaneously combust - if (Main.npc[index] is null || !Main.npc[index].active || Main.npc[index].life < 0) - Projectile.Kill(); - - // Decrement the timer. This should last a second as stealth strikes will initialize this at 61. - if (Timer > 1) - Timer--; - if (Timer == 1) - homing = true; - - NPC target = Main.npc[index]; - - if (homing) - { - // Home in on the target - Vector2 moveDirection = Projectile.SafeDirectionTo(target.Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * 20f + moveDirection * 15f) / 21f; - } - else - { - // Circle around the target counter-clockwise at 4 radians per frame - float height = target.getRect().Height; - float width = target.getRect().Width; - float circleDist = MathHelper.Min((height > width ? height : width) * 3f, (Main.LogicCheckScreenWidth * Main.LogicCheckScreenHeight) / 2); - if (circleDist > Main.LogicCheckScreenWidth / 3) - circleDist = Main.LogicCheckScreenWidth / 3; - Projectile.Center = target.Center + Projectile.ai[0].ToRotationVector2() * circleDist; - Projectile.ai[0] -= MathHelper.ToRadians(4f); - } - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - Projectile.ExpandHitboxBy(50); - - // Create into some rainbow-colored dust when dead - for (int d = 0; d < 5; d++) - { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 150, Main.rand.Next(colors), 2f); - Main.dust[idx].velocity *= 3f; - Main.dust[idx].noGravity = true; - if (Main.rand.NextBool()) - { - Main.dust[idx].scale = 0.5f; - Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; - } - } - for (int d = 0; d < 8; d++) - { - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 150, Main.rand.Next(colors), 3f); - Main.dust[idx].noGravity = true; - Main.dust[idx].velocity *= 5f; - idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.RainbowMk2, 0f, 0f, 150, Main.rand.Next(colors), 2f); - Main.dust[idx].velocity *= 2f; - Main.dust[idx].noGravity = true; - } - } - } -} diff --git a/Projectiles/Rogue/NiceCock.png b/Projectiles/Rogue/NiceCock.png deleted file mode 100644 index 8881462c5c..0000000000 Binary files a/Projectiles/Rogue/NiceCock.png and /dev/null differ diff --git a/Projectiles/Rogue/PanSpark.cs b/Projectiles/Rogue/PanSpark.cs deleted file mode 100644 index 941dae41cc..0000000000 --- a/Projectiles/Rogue/PanSpark.cs +++ /dev/null @@ -1,139 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class PanSpark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - private bool initialized = false; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 3; - ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 120; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.ignoreWater = true; - } - - public override void AI() - { - //make it face the way it's going - if (Projectile.ai[1] > 0f) - { - Projectile.rotation = -Projectile.velocity.X * 0.05f + MathHelper.PiOver2; - } - else - { - Projectile.rotation = Projectile.velocity.ToRotation(); - } - Projectile.ai[1]--; - - //frames - if (!initialized) - { - initialized = true; - Projectile.frame = Main.rand.Next(Main.projFrames[Type]); - } - Projectile.frameCounter++; - if (Projectile.frameCounter > 6) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame >= Main.projFrames[Type]) - { - Projectile.frame = 0; - } - - //movement - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X *= -0.1f; - } - if (Projectile.velocity.X != Projectile.velocity.X) - { - Projectile.velocity.X *= -0.5f; - } - if (Projectile.velocity.Y != Projectile.velocity.Y && Projectile.velocity.Y > 1f) - { - Projectile.velocity.Y *= -0.5f; - } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] > 5f) - { - Projectile.ai[0] = 5f; - if (Projectile.velocity.Y == 0f && Projectile.velocity.X != 0f) - { - Projectile.velocity.X *= 0.97f; - if (Projectile.velocity.X > -0.01f && Projectile.velocity.X < 0.01f) - { - Projectile.velocity.X = 0f; - Projectile.netUpdate = true; - } - } - Projectile.velocity.Y += 0.2f; - } - if (Projectile.velocity.Y < 0.25f && Projectile.velocity.Y > 0.15f) - { - Projectile.velocity.X *= 0.8f; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - - //dust - if (Main.rand.NextBool(4)) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[fire]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += (float)Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity.Y -= 2f; - } - if (Main.rand.NextBool(10)) - { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); - Dust dust = Main.dust[fire]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += 0.3f + (float)Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity *= 0.1f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.ai[1] = 10f; - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Daybreak, 90); - - public override Color? GetAlpha(Color lightColor) => new Color(255, 230, 130); - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/PanSpark.png b/Projectiles/Rogue/PanSpark.png deleted file mode 100644 index c74b2ed1a7..0000000000 Binary files a/Projectiles/Rogue/PanSpark.png and /dev/null differ diff --git a/Projectiles/Rogue/SearedPanProjectile.cs b/Projectiles/Rogue/SearedPanProjectile.cs deleted file mode 100644 index 11e591ffc0..0000000000 --- a/Projectiles/Rogue/SearedPanProjectile.cs +++ /dev/null @@ -1,206 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.NormalNPCs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class SearedPanProjectile : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - internal enum SearedPanTypes - { - VenLocket = 0, - Normal = 1, - Golden = 2, - StealthStrike = 3 - } - - internal SearedPanTypes PanType - { - get => (SearedPanTypes)(int)Projectile.ai[0]; - set => Projectile.ai[0] = (int)value; - } - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 6; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 20; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 420; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.extraUpdates = 2; - } - - public override void AI() - { - if (Main.rand.NextBool(5)) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Blood, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); - } - Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // Don't increment the Seared Pan counter when hitting dummies - //&& target.type != ModContent.NPCType() this is here just in case its needed again - bool dummy = target.type != NPCID.TargetDummy; - OnHitEffects(target.whoAmI, target.life, dummy); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(BuffID.Bleeding, 300); - OnHitEffects(-1, target.statLife, true); - } - - private void OnHitEffects(int targetIndex, int health, bool specialEffects) - { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - // Don't spawn fireballs or increment the special effects counter if you can't even stealth strike - bool playerCanStealthStrike = modPlayer.wearingRogueArmor && modPlayer.rogueStealthMax > 0; - if (!playerCanStealthStrike) - return; - - // Increment the seared pan counter. Pans summoned via the Venerated Locket shouldn't increment the counter. - // See CalamityPlayerMiscEffects.cs for code that resets the counter after 40 frames - modPlayer.searedPanTimer = 0; - if (specialEffects && PanType != SearedPanTypes.VenLocket) - modPlayer.searedPanCounter++; - - // Pans summoned via the Venerated Locket have zero special effects - if (PanType == SearedPanTypes.StealthStrike) - { - modPlayer.searedPanCounter = 0; - // Stealth strikes spawn four golden sparks on hit - for (int t = 0; t < 4; t++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.2), 0f, Projectile.owner); - } - SoundEngine.PlaySound(SearedPan.SmashSound, Projectile.position); - // Stealth strikes also cause any existing fireballs to home in on their targets - FireballStuff(true); - - if (!specialEffects) - return; - // Stealth strikes then summon five fireballs to circle the hit enemy, they will home in on their own after a second. - for (int t = 0; t < 5; t++) - { - int i = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, targetIndex); - Main.projectile[i].ModProjectile().Timer = 61; - } - FireballPositions(targetIndex); - } - else if (PanType == SearedPanTypes.Golden) - { - modPlayer.searedPanCounter = 0; - SoundEngine.PlaySound(SearedPan.SmashSound, Projectile.position); - // Golden pans simply cause all fireballs to home in on their targets - FireballStuff(true); - } - else if (PanType == SearedPanTypes.Normal && targetIndex != -1 && health > 0 && specialEffects) - { - // Summon three fireballs to circle the hit enemy - for (int t = 0; t < 3; t++) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, targetIndex); - } - FireballPositions(targetIndex); - } - } - - private void FireballStuff(bool activate) - { - if (Projectile.owner == Main.myPlayer) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner != Projectile.owner) - continue; - if (p.ModProjectile is NiceCock) - { - if (!activate) - p.Kill(); - else - { - p.ModProjectile().homing = true; - p.extraUpdates += 2; - } - } - } - } - } - - private void FireballPositions(int targetIndex) - { - int fireballCount = 0; - // Count how many fireballs exist already around the given target - foreach (Projectile p in Main.ActiveProjectiles) - { - // Keep the loop as short as possible - if (p.owner != Projectile.owner || !p.CountsAsClass() || targetIndex != (int)p.ai[1]) - continue; - if (p.ModProjectile is NiceCock) - { - if (p.ModProjectile().homing) - continue; - fireballCount++; - } - } - // Adjust the angle of the existing fireballs around a target - float angleVariance = MathHelper.TwoPi / fireballCount; - float angle = 0f; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.owner != Projectile.owner || !p.CountsAsClass() || targetIndex != (int)p.ai[1]) - continue; - if (p.ModProjectile is NiceCock) - { - if (p.ModProjectile().homing) - continue; - p.ai[0] = angle; - p.netUpdate = true; - angle += angleVariance; - } - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - // Kill all fireballs if you miss a stealth strike or golden pan - if (PanType == SearedPanTypes.Golden || PanType == SearedPanTypes.StealthStrike) - FireballStuff(false); - return true; - } - - public override Color? GetAlpha(Color lightColor) - { - // Stealth strikes and golden pans are golden colored - if (PanType == SearedPanTypes.Golden || PanType == SearedPanTypes.StealthStrike) - return new Color(255, 222, 0); - return null; - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - } -} diff --git a/Projectiles/Rogue/SearedPanProjectile.png b/Projectiles/Rogue/SearedPanProjectile.png deleted file mode 100644 index 559b586cb8..0000000000 Binary files a/Projectiles/Rogue/SearedPanProjectile.png and /dev/null differ diff --git a/Projectiles/Summon/LiliesOfEternityBullet.cs b/Projectiles/Summon/LiliesOfEternityBullet.cs index d87e226da0..d60b3bb10a 100644 --- a/Projectiles/Summon/LiliesOfEternityBullet.cs +++ b/Projectiles/Summon/LiliesOfEternityBullet.cs @@ -1,4 +1,5 @@ -using CalamityMod.Graphics.Primitives; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); diff --git a/Projectiles/Summon/LiliesOfFinalityBullet.cs b/Projectiles/Summon/LiliesOfFinalityBullet.cs index 19a527e5d2..b969ecd814 100644 --- a/Projectiles/Summon/LiliesOfFinalityBullet.cs +++ b/Projectiles/Summon/LiliesOfFinalityBullet.cs @@ -1,4 +1,5 @@ -using CalamityMod.Graphics.Primitives; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Summon private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); diff --git a/Projectiles/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index f05d8c81a4..9fa4c87c29 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -2,9 +2,12 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using rail; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -153,12 +156,13 @@ namespace CalamityMod.Projectiles.Summon public static Asset circle; public override bool PreDraw(ref Color lightColor) { - //Sigil - var spTex = TextureAssets.Projectile[Type].Value; - Main.spriteBatch.Draw(spTex, Projectile.Center - Main.screenPosition, null, Color.White, Main.GlobalTimeWrappedHourly, spTex.Size() * 0.5f, 0.75f, SpriteEffects.None, 0); - //Sunlines + Main.spriteBatch.SafeBegin(SpriteSortMode.Deferred, BatchSetting.Additive, null, Main.GameViewMatrix.TransformationMatrix, () => { + //Sigil + var spTex = TextureAssets.Projectile[Type].Value; + Main.spriteBatch.Draw(spTex, Projectile.Center - Main.screenPosition, null, Color.White, Main.GlobalTimeWrappedHourly, spTex.Size() * 0.5f, 0.75f, SpriteEffects.None, 0); + //Sunlines int count = (int)((Projectile.minionSlots - 1) / 3) * 2 + 2; for (var i = 0; i < count; i++) { diff --git a/Projectiles/Summon/SarosEclipseBeam.cs b/Projectiles/Summon/SarosEclipseBeam.cs index 5e4fa5edea..3daab84071 100644 --- a/Projectiles/Summon/SarosEclipseBeam.cs +++ b/Projectiles/Summon/SarosEclipseBeam.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -103,7 +104,7 @@ namespace CalamityMod.Projectiles.Summon return Color.Black * MathF.Pow(1 - completion, 0.5f); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { List posList = []; //For the prim to render properly I need to divide the distance between the positions into a couple points. Just using start and end doesn't render. diff --git a/Projectiles/Summon/SarosSunfire.cs b/Projectiles/Summon/SarosSunfire.cs index 3965be9cca..082e53b32a 100644 --- a/Projectiles/Summon/SarosSunfire.cs +++ b/Projectiles/Summon/SarosSunfire.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -171,7 +172,7 @@ namespace CalamityMod.Projectiles.Summon return mainColor; } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { //Flame body GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); diff --git a/Projectiles/Summon/SunSpiritBeam.cs b/Projectiles/Summon/SunSpiritBeam.cs index 5f7394ccd6..f94a544ac7 100644 --- a/Projectiles/Summon/SunSpiritBeam.cs +++ b/Projectiles/Summon/SunSpiritBeam.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -118,7 +119,7 @@ namespace CalamityMod.Projectiles.Summon return Color.Lerp(fullBodyColor, Color.White, 0.175f) * Projectile.Opacity; } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FireWidthFunction, FireColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length + 32); diff --git a/Projectiles/Summon/VengefulSunBeam.cs b/Projectiles/Summon/VengefulSunBeam.cs index dd8c925f13..22d49d0e69 100644 --- a/Projectiles/Summon/VengefulSunBeam.cs +++ b/Projectiles/Summon/VengefulSunBeam.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; using CalamityMod.Graphics.Primitives; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -156,7 +157,7 @@ namespace CalamityMod.Projectiles.Summon return fullBodyColor; } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer) { GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(FireWidthFunction, FireColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length + 32); diff --git a/Projectiles/Typeless/FestiveWingsOrnament.cs b/Projectiles/Typeless/FestiveWingsOrnament.cs index f502cd8046..9190221ad3 100644 --- a/Projectiles/Typeless/FestiveWingsOrnament.cs +++ b/Projectiles/Typeless/FestiveWingsOrnament.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "Terraria/Images/Projectile_" + ProjectileID.OrnamentFriendly; - internal static readonly SoundStyle JingleSound = new("CalamityMod/Sounds/Item/FestiveJingle") { Volume = 0.5f, PitchVariance = 0.5f }; + internal static readonly SoundStyle JingleSound = new("CalamityMod/Sounds/Item/FestiveJingle") { Volume = 0.25f, PitchVariance = 0.5f }; public override void SetStaticDefaults() => Main.projFrames[Type] = Main.projFrames[ProjectileID.OrnamentFriendly]; @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Typeless if (Vector2.Distance(player.Center, Projectile.Bottom) < 32f && player.wingTimeMax > 0f) { player.wingTime = MathHelper.Clamp(player.wingTime + 75f, 0f, player.wingTimeMax); - SoundEngine.PlaySound(SoundID.Item29, player.Center); + SoundEngine.PlaySound(SoundID.Item29 with { Volume = 0.25f }, player.Center); Projectile.Kill(); int dustType = DustID.GemRuby - Projectile.frame; diff --git a/Rarities/CosmicPurple.cs b/Rarities/CosmicPurple.cs index a30636dfdc..34602f8965 100644 --- a/Rarities/CosmicPurple.cs +++ b/Rarities/CosmicPurple.cs @@ -30,6 +30,9 @@ namespace CalamityMod.Rarities var fontSize = font.MeasureString(text); var center = fontSize / 2f; + if (Item.expert) + textColor = Main.DiscoColor; + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); textColor.A = 0; float pulsing = 2.5f + (float)Math.Sin(time * 5f); diff --git a/Sounds/Custom/BEES/Names.txt b/Sounds/Custom/BEES/Names.txt index 5645ea0a79..0ddbdd5284 100644 --- a/Sounds/Custom/BEES/Names.txt +++ b/Sounds/Custom/BEES/Names.txt @@ -6,7 +6,7 @@ Names: 5 - moonburn 6 - Ozzatron 7 - Rebecca -8 - Shayy +8 - Unused 9 - StipulatedVenus 10 - Xyk 11 - Shade diff --git a/Sounds/Custom/BEES/bees8.ogg b/Sounds/Custom/BEES/bees8.ogg deleted file mode 100644 index 677b47fc65..0000000000 Binary files a/Sounds/Custom/BEES/bees8.ogg and /dev/null differ diff --git a/Sounds/Item/EffervescenceBurst.ogg b/Sounds/Item/EffervescenceBurst.ogg new file mode 100644 index 0000000000..bdffb45db5 Binary files /dev/null and b/Sounds/Item/EffervescenceBurst.ogg differ diff --git a/Sounds/Item/EffervescenceFire.ogg b/Sounds/Item/EffervescenceFire.ogg new file mode 100644 index 0000000000..585f359f12 Binary files /dev/null and b/Sounds/Item/EffervescenceFire.ogg differ diff --git a/Sounds/Item/EffervescencePop.ogg b/Sounds/Item/EffervescencePop.ogg new file mode 100644 index 0000000000..9f8889d1bb Binary files /dev/null and b/Sounds/Item/EffervescencePop.ogg differ diff --git a/Sounds/Item/SearedPanSmash.ogg b/Sounds/Item/SearedPanSmash.ogg deleted file mode 100644 index c39b602f29..0000000000 Binary files a/Sounds/Item/SearedPanSmash.ogg and /dev/null differ diff --git a/Systems/Collections/CalamityBuffSets.cs b/Systems/Collections/CalamityBuffSets.cs index 35a8b9fd1f..4a1b8a821d 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -49,23 +49,6 @@ namespace CalamityMod.Systems.Collections BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType(), BuffType(), BuffType()); - /// - /// If for a buff type, then that buff is considered to be a sickness debuff.
- /// Used for reducing buff duration with Honey Dew and its upgrades.
- /// Defaults to . - ///
- public static bool[] IsSicknessDebuff = Factory.CreateBoolSet(BuffID.Poisoned, BuffID.Venom, BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); - - /// - /// If for a buff type, then that buff is considered to be a fire debuff.
- /// Used for reducing buff duration with Living Dew and its upgrades, and providing Permafrost's Concoction's life regeneration boost.
- /// Defaults to . - ///
- public static bool[] IsFireDebuff = Factory.CreateBoolSet(BuffID.OnFire, BuffID.OnFire3, BuffID.Burning, BuffID.CursedInferno, BuffID.ShadowFlame, BuffType(), - BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), - BuffType(), BuffType(), BuffType()); - /// /// If for a buff type, then that buff is considered to be a debuff.
/// This general-purpose set has several different uses, including reducing buff duration with Radiance, Crown Jewel and its upgrades' debuff effects, and removing debuffs with Cleansing Jelly and its upgrades' auras.
diff --git a/Systems/Collections/DonatorsNameList.cs b/Systems/Collections/DonatorsNameList.cs index 6c15797589..58f140c34d 100644 --- a/Systems/Collections/DonatorsNameList.cs +++ b/Systems/Collections/DonatorsNameList.cs @@ -101,7 +101,6 @@ namespace CalamityMod.Systems.Collections "Salted Warlock", "schmoovi", "Sharktank6", - "Shayy", // Current dev. Listed as "Shay" on Patreon. "SirChaos189", "SkeletonHunter96", "Taelishe", @@ -619,7 +618,7 @@ namespace CalamityMod.Systems.Collections "Shadoku", "SharZz", "Shaun", - "Shay", // There were two "Shay"s on the old list + //"Shayy", // Removed from circulation as the user in question committed acts undeserving of recognition "sherk", "Shifter", "Shiny", diff --git a/Systems/Graphic/PixelationSystem/PixelatedDrawer.cs b/Systems/Graphic/PixelationSystem/PixelatedDrawer.cs new file mode 100644 index 0000000000..52c5295b11 --- /dev/null +++ b/Systems/Graphic/PixelationSystem/PixelatedDrawer.cs @@ -0,0 +1,15 @@ +using System; +using CalamityMod.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Systems.Graphic.PixelationSystem +{ + /// + /// Contains a singular Action function which is used to draw any relevant asset(s) automatically with a pixelated effect based on the specified . + /// + public record class PixelatedDrawer(Action DrawAction, GeneralDrawLayer DrawLayer, BlendState DefaultBlendState) + { + + } +} diff --git a/Systems/Graphic/PixelationSystem/PixelationManager.cs b/Systems/Graphic/PixelationSystem/PixelationManager.cs new file mode 100644 index 0000000000..24b243a8dd --- /dev/null +++ b/Systems/Graphic/PixelationSystem/PixelationManager.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Enums; +using CalamityMod.Graphics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Graphic.PixelationSystem +{ + public class PixelationManager : ModSystem + { + private static Dictionary PixelTargets_BeforeAllTiles; + private static Dictionary PixelTargets_BeforeSolidTiles; + private static Dictionary PixelTargets_BeforeNPCs; + private static Dictionary PixelTargets_AfterNPCs; + private static Dictionary PixelTargets_BeforeProjectiles; + private static Dictionary PixelTargets_AfterProjectiles; + private static Dictionary PixelTargets_AfterPlayers; + private static Dictionary PixelTargets_AfterDusts; + private static Dictionary PixelTargets_AfterEverything; + + private static List ActivePixelatedDrawers_BeforeAllTiles; + private static List ActivePixelatedDrawers_BeforeSolidTiles; + private static List ActivePixelatedDrawers_BeforeNPCs; + private static List ActivePixelatedDrawers_AfterNPCs; + private static List ActivePixelatedDrawers_BeforeProjectiles; + private static List ActivePixelatedDrawers_AfterProjectiles; + private static List ActivePixelatedDrawers_AfterPlayers; + private static List ActivePixelatedDrawers_AfterDusts; + private static List ActivePixelatedDrawers_AfterEverything; + + /// + /// The resolution ratio at which pixelated drawers should draw.
+ /// 0.5f will draw at half resolution, 0.25f will draw at quarter resolution, etc. + ///
+ internal const float PixelationResolution = 0.5f; + + /// + /// The transformation matrix used by to draw pixelated assets. + /// + internal static Matrix PixelationMatrix + { + get + { + return Main.GameViewMatrix.TransformationMatrix + * Matrix.CreateScale(PixelationResolution / Main.GameViewMatrix.Zoom.X, PixelationResolution / Main.GameViewMatrix.Zoom.Y, 1f) + * Matrix.CreateTranslation(Main.GameViewMatrix.Translation.X * PixelationResolution, Main.GameViewMatrix.Translation.Y * PixelationResolution, 0f); + } + } + + /// + /// Creates a render target at a ratio of the screen's current dimensions based on . + /// + internal static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.graphics.GraphicsDevice, (int)(width * PixelationResolution), (int)(height * PixelationResolution)); + + public override void Load() + { + if (Main.dedServ) + return; + + PixelTargets_BeforeAllTiles = []; + PixelTargets_BeforeSolidTiles = []; + PixelTargets_BeforeNPCs = []; + PixelTargets_AfterNPCs = []; + PixelTargets_BeforeProjectiles = []; + PixelTargets_AfterProjectiles = []; + PixelTargets_AfterPlayers = []; + PixelTargets_AfterDusts = []; + PixelTargets_AfterEverything = []; + + ActivePixelatedDrawers_BeforeAllTiles = []; + ActivePixelatedDrawers_BeforeSolidTiles = []; + ActivePixelatedDrawers_BeforeNPCs = []; + ActivePixelatedDrawers_AfterNPCs = []; + ActivePixelatedDrawers_BeforeProjectiles = []; + ActivePixelatedDrawers_AfterProjectiles = []; + ActivePixelatedDrawers_AfterPlayers = []; + ActivePixelatedDrawers_AfterDusts = []; + ActivePixelatedDrawers_AfterEverything = []; + + On_Main.CheckMonoliths += PrepareTargets; + } + + public override void Unload() + { + if (Main.dedServ) + return; + + PixelTargets_BeforeAllTiles = null; + PixelTargets_BeforeSolidTiles = null; + PixelTargets_BeforeNPCs = null; + PixelTargets_AfterNPCs = null; + PixelTargets_BeforeProjectiles = null; + PixelTargets_AfterProjectiles = null; + PixelTargets_AfterPlayers = null; + PixelTargets_AfterDusts = null; + PixelTargets_AfterEverything = null; + + ActivePixelatedDrawers_BeforeAllTiles = null; + ActivePixelatedDrawers_BeforeSolidTiles = null; + ActivePixelatedDrawers_BeforeNPCs = null; + ActivePixelatedDrawers_AfterNPCs = null; + ActivePixelatedDrawers_BeforeProjectiles = null; + ActivePixelatedDrawers_AfterProjectiles = null; + ActivePixelatedDrawers_AfterPlayers = null; + ActivePixelatedDrawers_AfterDusts = null; + ActivePixelatedDrawers_AfterEverything = null; + } + + public override void OnWorldUnload() + { + if (Main.dedServ) + return; + + ActivePixelatedDrawers_BeforeAllTiles.Clear(); + ActivePixelatedDrawers_BeforeSolidTiles.Clear(); + ActivePixelatedDrawers_BeforeNPCs.Clear(); + ActivePixelatedDrawers_AfterNPCs.Clear(); + ActivePixelatedDrawers_BeforeProjectiles.Clear(); + ActivePixelatedDrawers_AfterProjectiles.Clear(); + ActivePixelatedDrawers_AfterPlayers.Clear(); + ActivePixelatedDrawers_AfterDusts.Clear(); + ActivePixelatedDrawers_AfterEverything.Clear(); + } + + + /// + /// Queues a instance to draw pixelated assets. + /// + /// All relevant drawing code should be written here. + /// The layer at which you'd like these assets to be drawn on.
e.g. will make all drawn assets render behind all projectiles.
+ /// The default that your pixelated assets will be rendered in. + ///
Leave as null to render them using .
+ public static void AddPixelatedDrawer(Action drawAction, GeneralDrawLayer drawLayer, BlendState defaultBlendState = null) + { + if (Main.dedServ || Main.gameMenu) + return; + + BlendState blendState = defaultBlendState ?? BlendState.AlphaBlend; + + // Check if the associated render target for this drawer exists and create it if necessary. + VerifyTargetExistence(drawLayer, blendState); + + PixelatedDrawer drawer = new(drawAction, drawLayer, blendState); + ReturnAssociatedDrawerCollection(drawLayer).Add(drawer); + } + + private static void PrepareTargets(On_Main.orig_CheckMonoliths orig) + { + if (!Main.gameMenu && !Main.dedServ) + { + // Draw all collections to their respctive render targets. + DrawCollectionsToTarget(PixelTargets_BeforeAllTiles, PixelationMatrix, ActivePixelatedDrawers_BeforeAllTiles); + DrawCollectionsToTarget(PixelTargets_BeforeSolidTiles, PixelationMatrix, ActivePixelatedDrawers_BeforeSolidTiles); + DrawCollectionsToTarget(PixelTargets_BeforeNPCs, PixelationMatrix, ActivePixelatedDrawers_BeforeNPCs); + DrawCollectionsToTarget(PixelTargets_AfterNPCs, PixelationMatrix, ActivePixelatedDrawers_AfterNPCs); + DrawCollectionsToTarget(PixelTargets_BeforeProjectiles, PixelationMatrix, ActivePixelatedDrawers_BeforeProjectiles); + DrawCollectionsToTarget(PixelTargets_AfterProjectiles, PixelationMatrix, ActivePixelatedDrawers_AfterProjectiles); + DrawCollectionsToTarget(PixelTargets_AfterPlayers, PixelationMatrix, ActivePixelatedDrawers_AfterPlayers); + DrawCollectionsToTarget(PixelTargets_AfterDusts, PixelationMatrix, ActivePixelatedDrawers_AfterDusts); + DrawCollectionsToTarget(PixelTargets_AfterEverything, PixelationMatrix, ActivePixelatedDrawers_AfterEverything); + + Main.graphics.GraphicsDevice.SetRenderTarget(null); + } + + orig(); + } + + private static void DrawCollectionsToTarget(Dictionary targetCollection, Matrix pixelationMatrix, List drawerCollection) + { + foreach (var blendStateTargetPair in targetCollection) + { + blendStateTargetPair.Value.SwapTo(); + + Main.spriteBatch.Begin(default, blendStateTargetPair.Key, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, pixelationMatrix); + + // Select only drawers who match this target's BlendState. + var drawersByBlendState = drawerCollection.Where(d => d.DefaultBlendState == blendStateTargetPair.Key).ToList(); + if (drawersByBlendState.Count > 0) + { + foreach (PixelatedDrawer drawer in drawersByBlendState) + drawer.DrawAction.Invoke(pixelationMatrix); + } + + Main.spriteBatch.End(); + } + + drawerCollection.Clear(); + } + + internal static void DrawPixelatedTargets(GeneralDrawLayer drawLayer) + { + var targetCollection = ReturnAssociatedTargetCollection(drawLayer); + Main.spriteBatch.SafeAction(() => + { + foreach (var keyValuePair in targetCollection) + { + Main.spriteBatch.TryEnd(); + Main.spriteBatch.TryBegin(default, keyValuePair.Key, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + float targetScale = 1f / PixelationResolution; + Main.spriteBatch.Draw(keyValuePair.Value, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, targetScale, SpriteEffects.None, 0f); + } + }); + } + + private static List ReturnAssociatedDrawerCollection(GeneralDrawLayer drawLayer) + { + List drawerCollection = drawLayer switch + { + GeneralDrawLayer.BeforeAllTiles => ActivePixelatedDrawers_BeforeAllTiles, + GeneralDrawLayer.BeforeSolidTiles => ActivePixelatedDrawers_BeforeSolidTiles, + GeneralDrawLayer.BeforeNPCs => ActivePixelatedDrawers_BeforeNPCs, + GeneralDrawLayer.AfterNPCs => ActivePixelatedDrawers_AfterNPCs, + GeneralDrawLayer.BeforeProjectiles => ActivePixelatedDrawers_BeforeProjectiles, + GeneralDrawLayer.AfterProjectiles => ActivePixelatedDrawers_AfterProjectiles, + GeneralDrawLayer.AfterPlayers => ActivePixelatedDrawers_AfterPlayers, + GeneralDrawLayer.AfterDusts => ActivePixelatedDrawers_AfterDusts, + _ => ActivePixelatedDrawers_AfterEverything, + }; + + return drawerCollection; + } + + private static Dictionary ReturnAssociatedTargetCollection(GeneralDrawLayer drawLayer) + { + Dictionary targetCollection = drawLayer switch + { + GeneralDrawLayer.BeforeAllTiles => PixelTargets_BeforeAllTiles, + GeneralDrawLayer.BeforeSolidTiles => PixelTargets_BeforeSolidTiles, + GeneralDrawLayer.BeforeNPCs => PixelTargets_BeforeNPCs, + GeneralDrawLayer.AfterNPCs => PixelTargets_AfterNPCs, + GeneralDrawLayer.BeforeProjectiles => PixelTargets_BeforeProjectiles, + GeneralDrawLayer.AfterProjectiles => PixelTargets_AfterProjectiles, + GeneralDrawLayer.AfterPlayers => PixelTargets_AfterPlayers, + GeneralDrawLayer.AfterDusts => PixelTargets_AfterDusts, + _ => PixelTargets_AfterEverything, + }; + + return targetCollection; + } + + private static void VerifyTargetExistence(GeneralDrawLayer drawLayer, BlendState blendState) + { + switch (drawLayer) + { + case GeneralDrawLayer.BeforeAllTiles: + if (!PixelTargets_BeforeAllTiles.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_BeforeAllTiles[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.BeforeSolidTiles: + if (!PixelTargets_BeforeSolidTiles.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_BeforeSolidTiles[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.BeforeNPCs: + if (!PixelTargets_BeforeNPCs.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_BeforeNPCs[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.AfterNPCs: + if (!PixelTargets_AfterNPCs.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_AfterNPCs[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.BeforeProjectiles: + if (!PixelTargets_BeforeProjectiles.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_BeforeProjectiles[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.AfterProjectiles: + if (!PixelTargets_AfterProjectiles.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_AfterProjectiles[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.AfterPlayers: + if (!PixelTargets_AfterPlayers.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_AfterPlayers[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.AfterDusts: + if (!PixelTargets_AfterDusts.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_AfterDusts[blendState] = new(true, CreatePixelTarget)); + break; + + case GeneralDrawLayer.AfterEverything: + if (!PixelTargets_AfterEverything.ContainsKey(blendState)) + Main.QueueMainThreadAction(() => PixelTargets_AfterEverything[blendState] = new(true, CreatePixelTarget)); + break; + } + } + } +} diff --git a/Systems/Graphic/TempParticleSystem/TempParticle.cs b/Systems/Graphic/TempParticleSystem/TempParticle.cs new file mode 100644 index 0000000000..c73b3f8027 --- /dev/null +++ b/Systems/Graphic/TempParticleSystem/TempParticle.cs @@ -0,0 +1,71 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; + +namespace CalamityMod.Systems.Graphic.TempParticleSystem +{ + public class TempParticle + { + public Asset StoredTexture; + + public Vector2 Position; + + public Vector2 StoredPosition; + + public Vector2 Velocity; + + public Vector2 Scale; + + public Color DrawColor; + + public float Rotation; + + public float Opacity; + + public float ParallaxStrength; + + public int Lifetime; + + public int Time; + + public int FrameX; + + public int FrameY; + + public int MaxVerticalFrames; + + public int MaxHorizontalFrames; + + public float[] ExtraData; + + /// + /// An 0-1 interpolant representing how close this particle is from its . + /// + public float LifetimeCompletionRatio => MathHelper.Clamp(Time / (float)Lifetime, 0f, 1f); + + public void SetBasicParticleData(Asset storedTexture, Vector2 position, Vector2 storedPosition, Vector2 velocity, Vector2 scale, Color drawColor, float rotation, float opacity, float parallaxStrength, int lifetime, int frameX, int frameY, int maxHorizontalFrames, int maxVerticalFrames, float extraData0, float extraData1, float extraData2, float extraData3) + { + Time = 0; + ExtraData = new float[4]; + + StoredTexture = storedTexture; + Position = position; + StoredPosition = storedPosition; + Velocity = velocity; + Scale = scale; + DrawColor = drawColor; + Rotation = rotation; + Opacity = opacity; + ParallaxStrength = parallaxStrength; + Lifetime = lifetime; + FrameX = frameX; + FrameY = frameY; + MaxHorizontalFrames = maxHorizontalFrames; + MaxVerticalFrames = maxVerticalFrames; + ExtraData[0] = extraData0; + ExtraData[1] = extraData1; + ExtraData[2] = extraData2; + ExtraData[3] = extraData3; + } + } +} diff --git a/Systems/Graphic/TempParticleSystem/TempParticleManager.cs b/Systems/Graphic/TempParticleSystem/TempParticleManager.cs new file mode 100644 index 0000000000..495226760d --- /dev/null +++ b/Systems/Graphic/TempParticleSystem/TempParticleManager.cs @@ -0,0 +1,181 @@ +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using ReLogic.Threading; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems.Graphic.TempParticleSystem +{ + public class TempParticleManager + { + public delegate void ParticleUpdateFunctionDelegate(TempParticle tempParticle); + + public delegate void ParticleDrawFunctionDelegate(TempParticle tempParticle, SpriteBatch spriteBatch, Vector2 drawOffset); + + public readonly List ActiveParticles; + + public readonly int MaxParticles; + + public readonly Asset BaseParticleTexture; + + public readonly ParticleUpdateFunctionDelegate ParticleUpdateFunction; + + public readonly ParticleDrawFunctionDelegate ParticleDrawingOverride; + + private readonly Queue ParticlePool; + + /// + /// A temporary particle handler made for the typically short-term creation and manipulation of particle effects done by instances of a generic particle object . + ///
Should typically be used in areas where is less practical or cannot work at all.
+ ///
+ /// The maximum amount of particles that can exist at a time in this manager. + /// The base texture that particles spawned by this manager will use when drawn. + /// An additional update function to control how particles spawned by this manager are updated. + /// Set this parameter to override how particles spawned by this manager are drawn. + public TempParticleManager(int maxParticles, string baseParticleTexturePath, ParticleUpdateFunctionDelegate particleUpdateFunction = null, ParticleDrawFunctionDelegate particleDrawingOverride = null) + { + if (Main.dedServ) + return; + + MaxParticles = maxParticles; + BaseParticleTexture = ModContent.Request(baseParticleTexturePath); + ParticleUpdateFunction = particleUpdateFunction; + ParticleDrawingOverride = particleDrawingOverride; + + ActiveParticles = []; + if (ParticlePool is null) + { + ParticlePool = []; + for (int i = 0; i < maxParticles; i++) + ParticlePool.Enqueue(new TempParticle()); + } + } + + /// + /// Spawns a instance attached to a . + ///
The "extraData" parameters exist so that you can store any additional data for this manager's particles in up to four additional slots.
+ ///
+ /// The initial spawn position of this particle. + /// The initial velocity of this particle. + /// The initial scale of this particle. + /// The base color this particle is drawn in. + /// The maximum amount of time this particle can be alive for. + /// The initial rotation of this particle. + /// The initial opacity of this particle. + /// The depth at which this particle appears. Should only be used in cases where particles need to be drawn in the foreground or background. + /// The initial X-frame of this particle on its spritesheet. + /// The initial Y-frame of this particle on its spritesheet. + /// The maximum amount of horizontal frames this particle has on its spritesheet. + /// The maximum amount of horizontal frames this particle has on its spritesheet. + /// An optional position which can be stored for this particle to attach to. + public void SpawnParticle(Vector2 position, Vector2 velocity, Vector2 scale, Color drawColor, int lifetime, float rotation = 0f, float opacity = 1f, float parallaxStrength = 0f, int frameX = 0, int frameY = 0, int maxHorizontalFrames = 1, int maxVerticalFrames = 1, float extraData0 = 0f, float extraData1 = 0f, float extraData2 = 0f, float extraData3 = 0f, Vector2? storedPosition = null) + { + if (ActiveParticles.Count >= MaxParticles || ActiveParticles.Count >= CalamityClientConfig.Instance.ParticleLimit || Main.dedServ) + return; + + if (ParticlePool.Count > 0) + { + TempParticle pooledParticle = ParticlePool.Dequeue(); + pooledParticle.SetBasicParticleData(BaseParticleTexture, position, storedPosition ?? Vector2.Zero, velocity, scale, drawColor, rotation, opacity, parallaxStrength, lifetime, frameX, frameY, maxHorizontalFrames, maxVerticalFrames, extraData0, extraData1, extraData2, extraData3); + ActiveParticles.Add(pooledParticle); + } + } + + /// + /// Spawns a instance attached to a . + ///
The "extraData" parameters exist so that you can store any additional data for this manager's particles in up to four additional slots.
+ ///
+ /// The initial spawn position of this particle. + /// The initial velocity of this particle. + /// The initial scale of this particle. + /// The base color this particle is drawn in. + /// The maximum amount of time this particle can be alive for. + /// The initial rotation of this particle. + /// The initial opacity of this particle. + /// The depth at which this particle appears. Should only be used in cases where particles need to be drawn in the foreground or background. + /// The initial X-frame of this particle on its spritesheet. + /// The initial Y-frame of this particle on its spritesheet. + /// The maximum amount of horizontal frames this particle has on its spritesheet. + /// The maximum amount of horizontal frames this particle has on its spritesheet. + /// An optional position which can be stored for this particle to attach to. + public void SpawnParticle(Vector2 position, Vector2 velocity, float scale, Color drawColor, int lifetime, float rotation = 0f, float opacity = 1f, float parallaxStrength = 0f, int frameX = 0, int frameY = 0, int maxHorizontalFrames = 1, int maxVerticalFrames = 1, float extraData0 = 0f, float extraData1 = 0f, float extraData2 = 0f, float extraData3 = 0f, Vector2? storedPosition = null) + => SpawnParticle(position, velocity, new Vector2(scale), drawColor, lifetime, rotation, opacity, parallaxStrength, frameX, frameY, maxHorizontalFrames, maxVerticalFrames, extraData0, extraData1, extraData2, extraData3, storedPosition); + + /// + /// Updates all active particles attached to this . + /// + public void Update() + { + if (ActiveParticles.Count == 0) + return; + + FastParallel.For(0, ActiveParticles.Count, (start, end, context) => + { + for (int i = start; i < end; i++) + { + ActiveParticles[i].Time++; + ActiveParticles[i].Position += ActiveParticles[i].Velocity; + ParticleUpdateFunction.Invoke(ActiveParticles[i]); + } + }); + + // Return the particle to the pool upon death. + ActiveParticles.RemoveAll(p => + { + if (p.Time >= p.Lifetime) + { + ParticlePool.Enqueue(p); + return true; + } + return false; + }); + } + + /// + /// Draws all active particles attached to this . + /// + /// + /// Note you will need to start the spritebatch manually before calling this. + /// + public void DrawAllParticles(SpriteBatch spriteBatch, Vector2? baseOffset = null) + { + if (ActiveParticles.Count == 0) + return; + + Vector2 drawOffset = baseOffset ?? -Main.screenPosition; + if (ParticleDrawingOverride != null) + { + foreach (TempParticle tempParticle in ActiveParticles) + ParticleDrawingOverride.Invoke(tempParticle, spriteBatch, drawOffset); + } + else + { + foreach (TempParticle tempParticle in ActiveParticles) + { + Vector2 drawPosition = tempParticle.Position + drawOffset + tempParticle.StoredPosition; + Rectangle frame = BaseParticleTexture.Frame(tempParticle.MaxHorizontalFrames, tempParticle.MaxVerticalFrames, tempParticle.FrameX, tempParticle.FrameY); + Vector2 origin = frame.Size() * 0.5f; + + spriteBatch.Draw(BaseParticleTexture.Value, drawPosition, frame, tempParticle.DrawColor * tempParticle.Opacity, tempParticle.Rotation, origin, tempParticle.Scale, SpriteEffects.None, 0f); + } + } + } + + /// + /// Returns all active particles back to the particle pool. + /// + public void ReturnAll() + { + if (ActiveParticles.Count == 0) + return; + + ActiveParticles.RemoveAll(p => + { + ParticlePool.Enqueue(p); + return true; + }); + } + } +} diff --git a/Systems/TileMerging/TileBlendMergeSystem_TileData.cs b/Systems/TileMerging/TileBlendMergeSystem_TileData.cs index 5cded28957..6f602c76f2 100644 --- a/Systems/TileMerging/TileBlendMergeSystem_TileData.cs +++ b/Systems/TileMerging/TileBlendMergeSystem_TileData.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Concurrent; using Terraria; using Terraria.ModLoader; @@ -7,7 +7,7 @@ namespace CalamityMod.Systems public sealed partial class TileBlendMergeSystem : ModSystem { // Blending Refs for every tiles - private static readonly Dictionary _TileBlendingRefs = []; + private static readonly ConcurrentDictionary _TileBlendingRefs = []; public override void ClearWorld() { @@ -20,7 +20,7 @@ namespace CalamityMod.Systems return; var tileIdx = tileX + (Main.tile.Width * tileY); - _TileBlendingRefs.Remove(tileIdx); + _TileBlendingRefs.TryRemove(tileIdx, out _); } public static void SetBlendingRefData(int tileX, int tileY, TileBlendingRef[] blendingRef) diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index f88fefc31f..e3ce05b694 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -67,9 +67,6 @@ namespace CalamityMod.Systems progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; CustomUnderworld.NewUnderworldStructures(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldPillars").Value; - CustomUnderworld.NewUnderworldPillars(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; CustomUnderworld.AshTreesAndGrass(); @@ -107,6 +104,24 @@ namespace CalamityMod.Systems })); } + // Generate a large Living Mahogany tree on the surface of the jungle (or anywhere in Drunk world) + int livingTreeIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Living Trees")); + if (livingTreeIndex != -1) + { + tasks.Insert(livingTreeIndex + 1, new PassLegacy("Living Mahogany Tree", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.LivingMahoganyTree").Value; + int attempts = 0; + while (attempts < 1000) + { + attempts++; + Point origin = WorldGen.RandomWorldPoint((int)Main.worldSurface + 25, 100, Main.maxTilesY - (int)Main.worldSurface - 125, 100); + if (GiantHive.GrowLivingJungleTree(origin, GenVars.structures)) + break; + } + })); + } + // Larger Jungle Temple int jungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); if (jungleTempleIndex != -1) @@ -162,7 +177,7 @@ namespace CalamityMod.Systems while (attempts < 1000) { attempts++; - Point origin = WorldGen.RandomWorldPoint((int)Main.worldSurface + 25, 20, Main.maxTilesY - (int)Main.worldSurface - 125, 20); + Point origin = WorldGen.RandomWorldPoint((int)Main.worldSurface + 25, 100, Main.maxTilesY - (int)Main.UnderworldLayer + 125, 100); if (GiantHive.CanPlaceGiantHive(origin, GenVars.structures)) break; } diff --git a/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs b/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs new file mode 100644 index 0000000000..cd203d22fe --- /dev/null +++ b/Tiles/Furniture/Paintings/AmidiasPaintingTile.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Paintings +{ + public class AmidiasPaintingTile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileSpelunker[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + TileObjectData.newTile.Width = 6; + TileObjectData.newTile.Height = 4; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; + TileObjectData.newTile.LavaDeath = true; + TileObjectData.addTile(Type); + + TileID.Sets.DisableSmartCursor[Type] = true; + TileID.Sets.FramesOnKillWall[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + DustType = DustID.WoodFurniture; + AddMapEntry(new Color(99, 50, 30), Language.GetText("MapObject.Painting")); + } + } +} diff --git a/Tiles/Furniture/Paintings/AmidiasPaintingTile.png b/Tiles/Furniture/Paintings/AmidiasPaintingTile.png new file mode 100644 index 0000000000..b2f4c1b913 Binary files /dev/null and b/Tiles/Furniture/Paintings/AmidiasPaintingTile.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index 80e501748d..d4b21318ae 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -4,6 +4,7 @@ using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Deconstructors; using CalamityMod.NPCs.DraedonLabThings; using CalamityMod.NPCs.Leviathan; using CalamityMod.NPCs.NormalNPCs; @@ -306,7 +307,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 77: - npc = NPCType(); + npc = NPCType(); break; case 78: npc = NPCType(); diff --git a/Tiles/Underworld/Dreadstone.cs b/Tiles/Underworld/Dreadstone.cs deleted file mode 100644 index 8d8a70bc47..0000000000 --- a/Tiles/Underworld/Dreadstone.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Underworld -{ - public class Dreadstone : ModTile - { - public override void SetStaticDefaults() - { - Main.tileSolid[Type] = true; - Main.tileBlockLight[Type] = true; - Main.tileBrick[Type] = true; - - CalamityUtils.MergeWithGeneral(Type); - CalamityUtils.MergeWithHell(Type); - - TileID.Sets.ChecksForMerge[Type] = true; - HitSound = SoundID.Tink; - MineResist = 2f; - MinPick = 65; - AddMapEntry(new Color(102, 65, 65)); - - this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/AshMerge"); - } - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, Main.rand.NextBool(4) ? DustID.Torch : DustID.RichMahogany, 0f, 0f, 1, default, 1f); - return false; - } - } -} diff --git a/Tiles/Underworld/Dreadstone.png b/Tiles/Underworld/Dreadstone.png deleted file mode 100644 index 47e2b916d8..0000000000 Binary files a/Tiles/Underworld/Dreadstone.png and /dev/null differ diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 119239acb0..167a5018ac 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -279,7 +279,6 @@ namespace CalamityMod.UI NPCType(), NPCType(), NPCType(), - NPCType(), NPCType(), //Clone's brothers NPCType(), diff --git a/UI/PunchCardGUI.cs b/UI/PunchCardGUI.cs deleted file mode 100644 index 3dbe2fac1a..0000000000 --- a/UI/PunchCardGUI.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.UI -{ - public class PunchCardGUI : PopupGUI - { - public bool HoveringOverBook = false; - - public override void Update() - { - if (Active) - { - if (FadeTime < FadeTimeMax) - FadeTime++; - } - else if (FadeTime > 0) - { - FadeTime--; - } - - if (Main.mouseLeft && !HoveringOverBook && FadeTime >= 30) - { - Active = false; - } - - HoveringOverBook = false; - } - - public override void Draw(SpriteBatch spriteBatch) - { - Texture2D pageTexture = ModContent.Request("CalamityMod/UI/MiscTextures/PunchCardPopup").Value; - float xScale = MathHelper.Lerp(0.004f, 1f, FadeTime / (float)FadeTimeMax); - Vector2 scale = new Vector2(xScale, 1f) * new Vector2(Main.screenWidth, Main.screenHeight) / pageTexture.Size(); - scale.Y *= 1.5f; - scale *= 0.5f; - - float bookScale = 0.5f; - scale *= bookScale; - - float yPageTop = MathHelper.Lerp(Main.screenHeight * 2, Main.screenHeight * 0.5f, FadeTime / (float)FadeTimeMax); - - Rectangle mouseRectangle = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 2, 2); - float drawPositionX = Main.screenWidth * 0.5f; - Vector2 drawPosition = new Vector2(drawPositionX, yPageTop); - Rectangle pageRectangle = new Rectangle((int)drawPosition.X - (int)(pageTexture.Width * 0.5f * scale.X), (int)drawPosition.Y - (int)(pageTexture.Height * 0.5f * scale.Y), (int)(pageTexture.Width * scale.X), (int)(pageTexture.Height * scale.Y)); - - spriteBatch.Draw(pageTexture, drawPosition, null, Color.White, 0f, pageTexture.Size() / 2, scale, SpriteEffects.None, 0f); - - if (!HoveringOverBook) - HoveringOverBook = mouseRectangle.Intersects(pageRectangle); - } - } -} diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index e801c90b54..f1ea89bed9 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -680,16 +680,16 @@ namespace CalamityMod return shader; } - public static void EnterShaderRegion(this SpriteBatch spriteBatch, BlendState newBlendState = null, Effect effect = null) + public static void EnterShaderRegion(this SpriteBatch spriteBatch, BlendState newBlendState = null, Effect effect = null, Matrix? matrix = null) { spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Immediate, newBlendState ?? BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, effect, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.Begin(SpriteSortMode.Immediate, newBlendState ?? BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, effect, matrix ?? Main.GameViewMatrix.TransformationMatrix); } - public static void ExitShaderRegion(this SpriteBatch spriteBatch) + public static void ExitShaderRegion(this SpriteBatch spriteBatch, Matrix? matrix = null) { spriteBatch.End(); - spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, matrix ?? Main.GameViewMatrix.TransformationMatrix); } /// diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index f9a001ad6f..bc6f2278bd 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -403,9 +403,6 @@ namespace CalamityMod { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, - { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), immuneToEverything }, - { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), immuneToEverything }, { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { BuffID.Poisoned, BuffID.Venom }) }, diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs index 3271f7e3f4..21608b0539 100644 --- a/World/CustomUnderworld.cs +++ b/World/CustomUnderworld.cs @@ -1,14 +1,11 @@ using System; using System.Collections.Generic; -using CalamityMod.Tiles.Underworld; using CalamityMod.Schematics; using Microsoft.Xna.Framework; -using ReLogic.Utilities; using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Generation; using Terraria.ID; -using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.Schematics.SchematicManager; @@ -30,10 +27,10 @@ namespace CalamityMod.World private const int SmallWorldOuterIslands = 1; private const int MediumAndLargeWorldOuterIslands = 2; - // Pillar variables - private const int MaxPillarHeight = 68; - private const int RandomizedPillarSectionHeight = 4; - private const int MaxPillarDepthAboveTheUnderworldFloor = 40; + // Wall variables + private const int MaxWallHeight = 68; + private const int RandomizedWallSectionHeight = 4; + private const int MaxWallDepthAboveUnderworldFloor = 40; public static void NewUnderworld() { @@ -433,11 +430,11 @@ namespace CalamityMod.World } // Generate a line of background walls from the approximate underworld lava line and down - int maxWallHeight = MaxPillarHeight; - int randomizedWallSectionsHeight = RandomizedPillarSectionHeight; + int maxWallHeight = MaxWallHeight; + int randomizedWallSectionsHeight = RandomizedWallSectionHeight; int maxWallTypes = 4; int newWallTypeStart = maxWallHeight / maxWallTypes; - int maxWallDepth = Main.maxTilesY - MaxPillarDepthAboveTheUnderworldFloor; + int maxWallDepth = Main.maxTilesY - MaxWallDepthAboveUnderworldFloor; int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; int cinderWallStartDepth = smoulderingStoneWallStartDepth + newWallTypeStart; int emberWallStartDepth = cinderWallStartDepth + newWallTypeStart; @@ -1276,190 +1273,6 @@ namespace CalamityMod.World } } - public static void NewUnderworldPillars() - { - int maxWallHeight = MaxPillarHeight; - int randomizedWallSectionsHeight = RandomizedPillarSectionHeight; - int maxWallDepth = Main.maxTilesY - MaxPillarDepthAboveTheUnderworldFloor; - int smoulderingStoneWallStartDepth = maxWallDepth - maxWallHeight; - - // Generate after houses to avoid complications - // Place pillars of walls to show that the roof of the underworld is being held up - // Do not place any pillars in the Brimstone Crags - bool cragsLocationIsLeft = GenVars.dungeonLocation < Main.maxTilesX / 2; - int brimstoneCragsSize = Main.maxTilesX / 5; - int brimstoneCragsLocationStart = cragsLocationIsLeft ? (25 + brimstoneCragsSize) : ((Main.maxTilesX - brimstoneCragsSize) - 25); - int pillarDistanceFromCragsLimit = 160; - int pillarIndexStartX = (cragsLocationIsLeft ? brimstoneCragsLocationStart : 0) + pillarDistanceFromCragsLimit; - int pillarIndexEndX = (cragsLocationIsLeft ? Main.maxTilesX : brimstoneCragsLocationStart) - pillarDistanceFromCragsLimit; - int pillarIndexStarY = Main.maxTilesY - 200; - int pillarIndexEndY = smoulderingStoneWallStartDepth + randomizedWallSectionsHeight; - int pillarMidPointY = pillarIndexStarY + (pillarIndexEndY - pillarIndexStarY) / 2; - int pillarCutOffCheckStart = pillarMidPointY - 10; - int pillarMinWidth = 6; - int pillarMinWidthPerSide = pillarMinWidth / 2; - int pillarMinStartingWidth = 18; - int pillarMaxWidth = 24; - int pillarMaxWidthPerSide = pillarMaxWidth / 2; - int pillarY = 0; - int pillarLeftSize = 0; - int pillarRightSize = 0; - int topTileSectionSize = 10; - int pillarTopTileSectionCutOff = pillarIndexStarY + topTileSectionSize; - ushort pillarTileID = Main.zenithWorld ? TileID.PoopBlock : (ushort)ModContent.TileType(); - ushort pillarWallID = Main.zenithWorld ? WallID.PoopWall : WallID.RocksUnsafe3; - - // Use the x tile index to find pillar locations - for (int x = pillarIndexStartX; x < pillarIndexEndX; x += WorldGen.genRand.Next(80, pillarDistanceFromCragsLimit + 1)) - { - int pillarStartingWidth = WorldGen.genRand.Next(pillarMinStartingWidth, pillarMaxWidth + 1); - pillarLeftSize = pillarStartingWidth / 2; - pillarRightSize = pillarStartingWidth / 2; - if (pillarStartingWidth % 2 != 0) - { - if (WorldGen.genRand.NextBool()) - pillarLeftSize++; - else - pillarRightSize++; - } - - int startOfPillarX = x - pillarMaxWidthPerSide; - int endOfPillarX = x + pillarMaxWidthPerSide; - int wallsDetected = 0; - bool tooManyWallsToPlacePillarRow = false; - - // Start the pillar at the top of the underworld and extend down to the hellstone wall - for (int y = pillarIndexStarY; y <= pillarIndexEndY; y++) - { - // The amount of walls required to stop generating the pillar when it's deeper than pillarCutoffCheckStart - int pillarCutOffSize = pillarLeftSize + pillarRightSize + 2; - - // Get the amount of empty space on the left and right of the pillar's X mid point - int emptySpaceOnLeft = pillarMaxWidthPerSide - pillarLeftSize; - int emptySpaceOnRight = pillarMaxWidthPerSide - pillarRightSize; - - // Used for wall cleanup around top tile section - int topTileSectionWallCleanupLeft = startOfPillarX + emptySpaceOnLeft + 1; - int topTileSectionWallCleanupRight = endOfPillarX - emptySpaceOnRight - 1; - - // Create sections of pillar - for (int x2 = startOfPillarX; x2 <= endOfPillarX; x2++) - { - // Check if there are too many walls in a line (this ends the current pillar generation and moves to the next) - if (Main.tile[x2, y].WallType != WallID.None) - { - // Only try to kill further pillar gen if the gen is beyond the pillar's mid point minus 10 tiles - if (y > pillarCutOffCheckStart) - wallsDetected++; - - if (wallsDetected > pillarCutOffSize) - { - tooManyWallsToPlacePillarRow = true; - break; - } - } - else - { - if (x2 >= startOfPillarX + emptySpaceOnLeft && x2 <= endOfPillarX - emptySpaceOnRight) - { - Main.tile[x2, y].WallType = pillarWallID; - - // Blocks on top to hold the pillars - if (y < pillarTopTileSectionCutOff) - { - // Clean up walls at the top so it doesn't look ugly - if (x2 <= topTileSectionWallCleanupLeft || x2 >= topTileSectionWallCleanupRight || y == pillarIndexStarY) - Main.tile[x2, y].WallType = WallID.None; - - Main.tile[x2, y].Get().HasTile = true; - Main.tile[x2, y].TileType = pillarTileID; - } - } - } - } - - // Break out if too many walls are already in place - if (tooManyWallsToPlacePillarRow) - break; - else - wallsDetected = 0; - - if (y < pillarMidPointY) - { - // Becomes more likely to become thinner the further down the pillar is before the mid point - pillarY++; - int chance = pillarY / 3; - if (chance < 2) - chance = 2; - - if (!WorldGen.genRand.NextBool(chance)) - { - switch (WorldGen.genRand.Next(4)) - { - default: - break; - - case 0: - pillarLeftSize--; - break; - - case 1: - pillarRightSize--; - break; - - case 2: - pillarLeftSize--; - pillarRightSize--; - break; - } - - // Cap the min width of each side of the pillar - if (pillarLeftSize < pillarMinWidthPerSide) - pillarLeftSize = pillarMinWidthPerSide; - if (pillarRightSize < pillarMinWidthPerSide) - pillarRightSize = pillarMinWidthPerSide; - } - } - else - { - // Becomes more likely to become thicker the further down the pillar is beyond the mid point - pillarY -= 2; - int chance = pillarY; - if (chance < 2) - chance = 2; - - if (WorldGen.genRand.NextBool(chance)) - { - switch (WorldGen.genRand.Next(4)) - { - default: - break; - - case 0: - pillarLeftSize++; - break; - - case 1: - pillarRightSize++; - break; - - case 2: - pillarLeftSize++; - pillarRightSize++; - break; - } - - // Cap the max width of each side of the pillar - if (pillarLeftSize > pillarMaxWidthPerSide) - pillarLeftSize = pillarMaxWidthPerSide; - if (pillarRightSize > pillarMaxWidthPerSide) - pillarRightSize = pillarMaxWidthPerSide; - } - } - } - } - } - public static void AshTreesAndGrass() { // Start generating islands at this point diff --git a/World/GiantHive.cs b/World/GiantHive.cs index b5fbcbd987..faeea12c16 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -31,8 +31,21 @@ namespace CalamityMod.World { public class GiantHive { - public static bool GrowLivingJungleTree(Point origin) + public static bool GrowLivingJungleTree(Point origin, StructureMap structures) { + if (!structures.CanPlace(new Rectangle(origin.X - 50, origin.Y - 50, 100, 100))) + return false; + + if (TooCloseToImportantLocations(origin)) + return false; + + Ref ref1 = new Ref(0); + Ref ref2 = new Ref(0); + Ref ref3 = new Ref(0); + WorldUtils.Gen(origin, new Shapes.Circle(15), Actions.Chain(new Modifiers.IsSolid(), new Actions.Scanner(ref1), new Modifiers.OnlyTiles(TileID.JungleGrass, TileID.Mud), new Actions.Scanner(ref2), new Modifiers.OnlyTiles(TileID.JungleGrass), new Actions.Scanner(ref3))); + if ((ref2.Value / (float)ref1.Value < 0.75f || ref3.Value < 2) && !WorldGen.drunkWorldGen) + return false; + int treeHeight = (int)Main.worldSurface - (Main.maxTilesY / 10); //start here to not touch floating islands bool validHeightFound = false; int attempts = 0; @@ -220,8 +233,6 @@ namespace CalamityMod.World } } - GrowLivingJungleTree(new Point(origin.X, origin.Y)); - CreateStandForLarva(larvaLocation); // Generate a second larva stand