diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 55d431690a..3ad266c8db 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -361,7 +361,6 @@ namespace CalamityMod.CalPlayer public int murasamaHitCooldown = 0; public int giantShellPostHit = 0; public int tortShellPostHit = 0; - public int RustyMedallionCooldown = 0; public int MiniSwarmerCooldown = 0; public float SulphWaterPoisoningLevel; public float holyInfernoFadeIntensity; @@ -1021,6 +1020,9 @@ namespace CalamityMod.CalPlayer public bool veneratedLocket = false; public bool camper = false; public bool corrosiveSpine = false; + public bool scionsCurio = false; + public bool scionsCurioGotHit = false; + public bool scionsCurioVisuals = false; public bool miniOldDuke = false; public bool miniOldDukeVanity = false; public bool starbusterCore = false; @@ -1037,7 +1039,6 @@ namespace CalamityMod.CalPlayer public int phantomicHeartRegen = 0; /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Tattered Fairy Wings, and Festive Wings. public int wingProjectileCooldown = 0; - public bool RustyMedallionDroplets = false; public bool noStupidNaturalARSpawns = false; /// Used for animating Void Concentration Staff's draw layer. public int voidFrameCounter = 0; @@ -2318,7 +2319,7 @@ namespace CalamityMod.CalPlayer starTaintedGenerator = false; camper = false; corrosiveSpine = false; - RustyMedallionDroplets = false; + scionsCurio = false; rottenDogTooth = false; angelicAlliance = false; BloomStoneRegen = false; @@ -2871,7 +2872,6 @@ namespace CalamityMod.CalPlayer bloomStoneHealTimer = 0; bloomStoneDR = 0; murasamaHitCooldown = 0; - RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; holyInfernoFadeIntensity = 0f; spiritOriginCritBoost = 0; @@ -4862,21 +4862,6 @@ namespace CalamityMod.CalPlayer } } } - - if (RustyMedallionDroplets && RustyMedallionCooldown <= 0) - { - if (item.CountsAsClass()) - { - var MedallionSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - int d = (int)Player.GetTotalDamage().ApplyTo(RustyMedallion.AcidDropBaseDamage); - - Vector2 mouse = Player.ClampedMouseWorld(); - Vector2 startingPosition = mouse - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; - Vector2 directionToMouse = (mouse - startingPosition).SafeNormalize(Vector2.UnitX); - Projectile.NewProjectile(MedallionSource, startingPosition, directionToMouse * 15f, ProjectileType(), d, 0f, Player.whoAmI, 3); - RustyMedallionCooldown = RustyMedallion.AcidCreationCooldown; - } - } return true; } #endregion diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 5e2e14824d..51a94a1d11 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -536,6 +536,9 @@ namespace CalamityMod.CalPlayer if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) modifiers.ModifyHitInfo += YellowCandleBuff.ModifyHitInfo_Spite; + if (Player.Calamity().scionsCurio && item.CountsAsClass()) + target.Calamity().scionsCurioEffected = true; + // Frost Armor's rework gives +X% melee damage and +Y% ranged damage based on distance, where X+Y = 15. if (frostSet) { @@ -637,6 +640,9 @@ namespace CalamityMod.CalPlayer if (proj.type == ProjectileID.InfernoFriendlyBlast) modifiers.SourceDamage *= 1.2f; + if (Player.Calamity().scionsCurio && proj.CountsAsClass()) + target.Calamity().scionsCurioEffected = true; + // Frost Armor's rework gives +X% melee damage and +Y% ranged damage based on distance, where X+Y = 15. if (frostSet) { @@ -717,7 +723,7 @@ namespace CalamityMod.CalPlayer // Enemies deal less contact damage while sick, due to being weakened. if (npc.poisoned) { - float damageReductionFromPoison = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromPoison = (float)((npc.Calamity().irradiated > 0 ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -732,7 +738,7 @@ namespace CalamityMod.CalPlayer if (npc.venom) { - float damageReductionFromVenom = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromVenom = (float)((npc.Calamity().irradiated > 0 ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -747,7 +753,7 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().astralInfection > 0) { - float damageReductionFromAstralInfection = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromAstralInfection = (float)((npc.Calamity().irradiated > 0 ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -762,7 +768,7 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().pFlames > 0) { - float damageReductionFromPlague = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromPlague = (float)((npc.Calamity().irradiated > 0 ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -777,7 +783,7 @@ namespace CalamityMod.CalPlayer if (npc.Calamity().wDeath > 0) { - float damageReductionFromWhisperingDeath = npc.Calamity().irradiated > 0 ? 0.15f : 0.1f; + float damageReductionFromWhisperingDeath = (float)((npc.Calamity().irradiated > 0 ? npc.Calamity().irradiatedContactBoost : 1) * 0.1f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -1917,6 +1923,9 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean"); ShieldoftheOcean.ActivateParry(Player); } + + if (Player.Calamity().scionsCurio) + scionsCurioGotHit = true; } private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 2842bd89a1..bbbc40946b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2288,8 +2288,6 @@ namespace CalamityMod.CalPlayer if (miningSetCooldown > 0) miningSetCooldown--; - if (RustyMedallionCooldown > 0) - RustyMedallionCooldown--; if (MiniSwarmerCooldown > 0) MiniSwarmerCooldown--; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index e6f58e072d..31b9ec0761 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -144,7 +144,6 @@ namespace CalamityMod.CalPlayer if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); - if (generalBandCooldown == 0) { int cooldown = 0; diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs deleted file mode 100644 index b7d0e8f3a1..0000000000 --- a/Items/Accessories/RustyMedallion.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class RustyMedallion : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public const int AcidDropBaseDamage = 9; - - // BAD Minishark! You will NOT become stupid sleeper agent item! - public const int AcidCreationCooldown = 25; - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 32; - Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.RustyMedallionDroplets = true; - player.buffImmune[ModContent.BuffType()] = true; - } - } -} diff --git a/Items/Accessories/RustyMedallion.png b/Items/Accessories/RustyMedallion.png deleted file mode 100644 index 398cd2132d..0000000000 Binary files a/Items/Accessories/RustyMedallion.png and /dev/null differ diff --git a/Items/Accessories/ScionsCurio.cs b/Items/Accessories/ScionsCurio.cs new file mode 100644 index 0000000000..8cad959d1f --- /dev/null +++ b/Items/Accessories/ScionsCurio.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + public class ScionsCurio : ModItem, ILocalizedModType + { + public static int postHitDamage = 45; + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 32; + Item.height = 38; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.scionsCurio = true; + modPlayer.scionsCurioVisuals = !hideVisual; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !player.dead) + { + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + } + } +} diff --git a/Items/Accessories/ScionsCurio.png b/Items/Accessories/ScionsCurio.png new file mode 100644 index 0000000000..2cfb850e84 Binary files /dev/null and b/Items/Accessories/ScionsCurio.png differ diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index 8aa67f0bd6..8cc50d26bd 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() )); // Ancient Treasure Chest Loot @ 100%; Individually 10% diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 692e01abdb..91a129cab5 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() )); itemLoot.AddBiomeCrateLootRules(false); diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 33cfa1017b..72f16a8569 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1554,6 +1554,17 @@ SandSharkToothNecklace: { ''' } +ScionsCurio: { + DisplayName: Scions Curio + Tooltip: + ''' + Ranged hits increase the effectiveness of the Irradiated debuff + Irradiated damage over time scales off of your ranged damage and crit chance + On kill, enemies burst, spreading Irradiated + Taking damage causes the curio to explode in retaliation + ''' +} + ScuttlersJewel: { DisplayName: Scuttler's Jewel Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 95cd1221f7..9ba745308c 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -80,6 +80,47 @@ Empress1: A fine day for mana consumption. Empress2: That's quite enough mana... Empress3: OH GREAT HEAVENS! Empress4: A +SwineSecret0: Hey +SwineSecret1: You know, swine like us tend to keep our secrets. +SwineSecret2: I once drank a gallon of molten pig iron. +SwineSecret3: Pay me 10 Ozzacoins and I'll hack in some Miracle Matter for ya, c'mon trust me! +SwineSecret4: I've heard tales of a palace somewhere... +SwineSecret5: Swine. +SwineSecret6: There once was a duke who was old, he sat on a throne made of gold, he ate up a treat, gave his kids spoiled meat, and sang tales of great swine never told. +SwineSecret7: WAIT WAIT A GOLDEN CRITTER JUST SPAWNE- aww you missed it... +SwineSecret8: Fishrons? Who calls them that? +SwineSecret9: Why the hell is everything always blowing up?! You're gonna start a fire you know, and I'm not a fan of flames! +SwineSecret10: HELP ME +SwineSecret11: Saying that someone 'eats babies' is stereotypically evil, but I'm a good guy and I eat babies! I mean surely it's not THAT bad. People who don't eat babies are just wusses. +SwineSecret12: Phalostion ale bonei wha treaites gon bardo galan ale gorve frus frum galibon! +SwineSecret13: My soul is made of jade, it's unbreakable! Just like the palace. You should go there sometime. +SwineSecret14: CAAAAAAARRRRLLLL! You must finish your work Carl. +SwineSecret15: Before gods quarreled or stars wept, it was the Old Duke's hunger that tore the first wound in the deep. +SwineSecret16: When the Third Moon drowned, the Old Duke wept salt into the jade chalice, and the coral gates first bled. +SwineSecret17: The Old Duke's hunger was not for flesh, but for the silence between tides that he called the Eel Hour. +SwineSecret18: The jade palace does not sink, it re-aligns beneath the fins of royal shame. +SwineSecret19: The duke never died. He just changed tides. +SwineSecret20: The Old Duke struck the reefclock thrice, and time drowned in brine-glass. Since then, no hour has been true. +SwineSecret21: There were once seven Duke-Born. then there were six, then there were five, then there were four, then there were three, then there were two, then there was one... +SwineSecret22: No one built the jade palace, the world simply uncoiled its seventh spine. +SwineSecret23: When the true fishron arises, the glorious jade palace shall rise once more from the sea and the ocean will kneel. +SwineSecret24: What mortals call the Old Duke is a mere echo of the pristine swine, the sovereign who ruled the sulphuric seas. +SwineSecret25: Gods speak in radiance. But the Old Duke? He chewed on their syllables and spat out storms. +SwineSecret26: Those who enter the Old Duke's stomach will learn what it means to be truly erased from samsara. +SwineSecret27: The great jade swine once whispered into Polterghast's ear, and that is why the moon forgot its face. +SwineSecret28: They say the Old Duke had no lungs. That's wrong, he had five. +SwineSecret29: The palace still sinks. It has not stopped sinking since the first sin. +SwineSecret30: The village people saw the fishron trade his draconic roar for silence. It was louder this way. +SwineSecret31: @everyone Please do not announce to the sever when you are going to fight Old Duke. This has been a recurring issue... +SwineSecret32: No, I have never played Undertale. +SwineSecret33: These sprites look like they were drawn by a four-year-old with the talents of Pablo Picasso in his prime. Which is what I would have said if I liked the sprites. Which I do. Not. +SwineSecret34: Who are you dressed as... your OC? That's cringe. +SwineSecret35: Watch out for Polymorphine, that stuff sucks. Trust me I know. +SwineSecret36: Many say to keep the greatest swine secret on the down low. I disagree, We cannot shh it. +SwineSecret37: Let me know when it's 7 PM, I've got to tweak something before some poor soul falls off of it! +SwineSecret38: Thank Xeroc I don't have any of that 'Pathfinding' garbage, whatever the hell that is. +SwineSecret39: If you think the Sulphur Sea smells bad, just wait til' you're near a nohitter! +SwineSecret40: Did you know there's 40 of these damn things? // Point Blank PointBlank: Does extra damage to enemies shot at point-blank range // Charge diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 51da0c41f9..b13780d0a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -160,3 +160,4 @@ VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation XykWings.DisplayName: Xyk Wings BatholithBangleProjectile.DisplayName: Batholith Bangle Projectile +ScionsCurioMini.DisplayName: Scions Curio Mini diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index de28c11370..68ee28826c 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -73,9 +73,7 @@ using CalamityMod.UI; using CalamityMod.UI.DebuffSystem; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; -using Microsoft.Build.Evaluation; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Operations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoMod.Utils; @@ -319,6 +317,7 @@ namespace CalamityMod.NPCs public int marked = 0; public int absorberAffliction = 0; public int irradiated = 0; + public double irradiatedContactBoost = 1.5; public int bFlames = 0; public int demonicFlames = 0; public int demonicFlamesBonusDamage = 0; @@ -329,6 +328,7 @@ namespace CalamityMod.NPCs public int crumble = 0; public int antlionCloudDebuffTimer = 0; + public bool scionsCurioEffected = false; public int warbannerBurnTime = 0; // Determines the rate that the enemy is damaged public int warbannerBurnTimer = 0; // The duration of the debuff public int warbannerBurnStacks = 0; // The stacks increase how fast the debuff hits @@ -605,6 +605,7 @@ namespace CalamityMod.NPCs myClone.marked = marked; myClone.absorberAffliction = absorberAffliction; myClone.irradiated = irradiated; + myClone.irradiatedContactBoost = irradiatedContactBoost; myClone.bFlames = bFlames; myClone.demonicFlames = demonicFlames; myClone.demonicFlamesBonusDamage = demonicFlamesBonusDamage; @@ -614,6 +615,7 @@ namespace CalamityMod.NPCs myClone.crumble = crumble; myClone.antlionCloudDebuffTimer = antlionCloudDebuffTimer; + myClone.scionsCurioEffected = scionsCurioEffected; myClone.warbannerBurnTime = warbannerBurnTime; myClone.warbannerBurnTimer = warbannerBurnTimer; myClone.warbannerBurnStacks = warbannerBurnStacks; @@ -901,11 +903,26 @@ namespace CalamityMod.NPCs projectileCount++; } } - + int baseIrradiatedDoTValue = (int)(scionsCurioEffected ? 30 : 20); + if (scionsCurioEffected) + { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + if (player.active) + { + float playerRangedDamage = player.GetTotalDamage(DamageClass.Ranged).ApplyTo(baseIrradiatedDoTValue * (1 + player.GetTotalCritChance(DamageClass.Ranged) * 0.01f)); + if (playerRangedDamage > baseIrradiatedDoTValue && player.Calamity().scionsCurio) + { + baseIrradiatedDoTValue = (int)playerRangedDamage; + } + } + } + } if (projectileCount > 0) - ApplyDPSDebuff(projectileCount * 20, projectileCount * 4, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(projectileCount * baseIrradiatedDoTValue, projectileCount * 4, ref npc.lifeRegen, ref damage); else - ApplyDPSDebuff(20, 4, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(baseIrradiatedDoTValue, baseIrradiatedDoTValue / 20, ref npc.lifeRegen, ref damage); } #endregion @@ -939,15 +956,14 @@ namespace CalamityMod.NPCs coldDamageMult *= ResistantToDoTDamageMult; } - double sicknessDamageMult = irradiated > 0 ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; + double sicknessDamageMult = BaseDoTDamageMult; if (VulnerableToSickness.HasValue) { if (VulnerableToSickness.Value) - sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); + sicknessDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; + sicknessDamageMult *= ResistantToDoTDamageMult; } - bool increasedElectricityDamage = npc.wet || npc.honeyWet || npc.lavaWet || npc.dripping; double electricityDamageMult = increasedElectricityDamage ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; if (VulnerableToElectricity.HasValue) @@ -957,7 +973,6 @@ namespace CalamityMod.NPCs else electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; } - double waterDamageMult = BaseDoTDamageMult; if (VulnerableToWater.HasValue) { @@ -1001,6 +1016,12 @@ namespace CalamityMod.NPCs waterDamageMult += EvergreenGin.SicknessWaterDebuffBoost; } + if (irradiated > 0) + { + double irradiatedBoost = scionsCurioEffected ? 1.75 : 1; + sicknessDamageMult += irradiatedBoost; + } + //Amalgam triples all elemental debuff damage. Ironically this excludes Elemental Mix if (IncreasedDebuffEffects_Amalgam) { @@ -5599,6 +5620,8 @@ namespace CalamityMod.NPCs absorberAffliction--; if (irradiated > 0) irradiated--; + if (scionsCurioEffected) + irradiatedContactBoost = 2f; if (bFlames > 0) bFlames--; if (demonicFlames > 0) @@ -6865,6 +6888,148 @@ namespace CalamityMod.NPCs } } } + + if (scionsCurioEffected && npc.life <= 0 && npc.realLife == -1) + { + for (int g = 0; g < 17; g++) + { + int DustID = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(npc.Center, DustID); + dust.scale = Main.rand.NextFloat(1.1f, 1.35f); + dust.velocity = new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.9f) + Vector2.UnitY * -10; + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.Green : Color.Chartreuse; + dust.fadeIn = Main.rand.NextFloat(0.2f, 2f); + } + Particle blastvfx = new CustomPulse(npc.Center, Vector2.Zero, Color.Chartreuse * 0.9f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f, 0.15f, 10, true); + GeneralParticleHandler.SpawnParticle(blastvfx); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.5f, 0.7f), MaxInstances = 6 }, npc.Center); + + int explosionDamage = 12; + float highestDamage = 0; + Player Owner = null; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + + float playerRangedDamage = player.GetTotalDamage(DamageClass.Ranged).ApplyTo(explosionDamage); + if (playerRangedDamage > highestDamage && player.Calamity().scionsCurio) + { + highestDamage = playerRangedDamage; + Owner = player; + } + } + + // Create Blast + float blastSize = 115; + float minMultiplier = 0.5f; + int hitsToMinMult = 5; + int debuff = ModContent.BuffType(); + int debuffTime = 300; + Projectile blast = Projectile.NewProjectileDirect((Owner != null ? Owner.GetSource_FromThis() : npc.GetSource_FromThis()), npc.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(highestDamage), 7, (Owner != null ? Owner.whoAmI : -1), blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Ranged; + } + + bool fakeAbbadon = false; // Will be used for abbadon revamp + if (fakeAbbadon && npc.life <= 0 && npc.realLife == -1) + { + float areaOfEffect = 500; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Color color1 = Color.Crimson; + Color color2 = Color.OrangeRed; + for (int r = 0; r < Main.maxNPCs; r++) + { + NPC target = Main.npc[r]; + + if (target != null && target.IsAnEnemy(true, true) && Vector2.Distance(target.Center, npc.Center) <= areaOfEffect) + { + if (target.life <= 0) + { + target.Calamity().scionsCurioEffected = true; + } + else + { + for (int g = 0; g < 7; g++) + { + int DustID = ModContent.DustType(); + Dust dust2 = Dust.NewDustDirect(target.Center, target.width, target.height, DustID); + dust2.scale = Main.rand.NextFloat(0.6f, 0.75f); + dust2.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 0.8f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color2 : color1; + } + + Vector2 start = npc.Center; + Vector2 end = target.Center; + Color color = Main.rand.NextBool() ? color2 : color1; + + Vector2 lerpVel = Vector2.Lerp(start, end, 0.5f); + float scale = 0.015f; + Particle spark = new CustomSpark(lerpVel, npc.SafeDirectionTo(target.Center), "CalamityMod/Particles/BloomLineThick", false, 18, scale, color, new Vector2(1.2f, (Utils.Distance(start, end) * 0.034f)), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + for (int u = 0; u < 2; u++) + { + Vector2 pos = start; + if (u == 0) pos = end; + Particle spark2 = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 18, 0.55f, color, Vector2.One, true, true, glowOpacity: 0.85f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + float distance = Vector2.Distance(target.Center, npc.Center); + int maxDusts = (int)distance; + int dustCaper = 60; + int dustDivisor = maxDusts / dustCaper; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 dustLineStart = target.Center; + Vector2 dustLineEnd = npc.Center; + Vector2 currentDustPos = default; + Vector2 dustVel = npc.Center.DirectionTo(target.Center); + int startingPoint = Main.rand.Next(0, 400 + 1); + Vector2 lastDustPos = default; + for (int i = 0; i < maxDusts; i++) + { + float sine = (float)Math.Sin((i + startingPoint) * 0.425f / MathHelper.Pi); + float endStartFade = Math.Min(Utils.GetLerpValue(maxDusts * 0.8f, 0, i), Utils.GetLerpValue(0 + maxDusts * 0.2f, maxDusts, i)); + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDusts) + dustVel.RotatedBy(MathHelper.PiOver2) * 6 * sine * endStartFade; + if (i == 0) + lastDustPos = currentDustPos; + + /*Dust dustLine = Dust.NewDustPerfect(currentDustPos, ModContent.DustType()); + dustLine.position = currentDustPos; + dustLine.velocity = Vector2.Zero; + dustLine.noGravity = true; + dustLine.scale = 1.5f * Math.Max(endStartFade, 0.7f); + dustLine.fadeIn = Main.rand.NextFloat() * 2f; + dustLine.color = Color.Lerp(color1, color2, Utils.GetLerpValue(0, maxDusts, i));*/ + + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDusts) + dustVel.RotatedBy(MathHelper.PiOver2) * 55 * sine * endStartFade; + Dust dustLinger = Dust.NewDustPerfect(currentDustPos, ModContent.DustType()); + dustLinger.position = currentDustPos; + dustLinger.velocity = currentDustPos.DirectionTo(lastDustPos) * (Main.rand.NextBool(5) ? 4f : Main.rand.NextFloat(0.2f, 0.8f)); + dustLinger.noGravity = true; + dustLinger.scale = Main.rand.NextFloat(0.8f, 1f) * 1.5f; + dustLinger.fadeIn = Main.rand.NextFloat(0.6f, 1f) * 4; + dustLinger.color = Color.Lerp(color1, color2, Utils.GetLerpValue(0, maxDusts, i)); + + lastDustPos = currentDustPos; + } + + target.Calamity().scionsCurioEffected = true; + if (target.Calamity().irradiated > 0) + target.Calamity().irradiated += 90; + else + target.AddBuff(BuffType(), 180); + } + } + } + } + } } #endregion diff --git a/Projectiles/Typeless/ScionsCurioMini.cs b/Projectiles/Typeless/ScionsCurioMini.cs new file mode 100644 index 0000000000..84f0569b10 --- /dev/null +++ b/Projectiles/Typeless/ScionsCurioMini.cs @@ -0,0 +1,258 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ScionsCurioMini : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public Color usedColor = Color.Chartreuse; + public ref float time => ref Projectile.ai[0]; + public ref float attackTimer => ref Projectile.ai[1]; + public ref float idleTimer => ref Projectile.localAI[0]; + + public float fxFade = 0; // The glow visuals multiplier + public float followSpeed = 12; // The speed it follows you, lower is faster + public float lerpDir = 0; + public float facing = 0; + public Vector2 savedPos; + public bool sharingSwineSecrets => idleTimer >= idleMax; + public int swineSecretTimer = 0; + public int swineText = 1; + public float actionSpeed = 1; + public int chosenSecret = 0; + public int idleMax = 18000; // 5 minutes + Vector2 goalPosition; + public List listNumbers = new List(); + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 38; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + if (Main.zenithWorld) idleMax = 301; + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.Chartreuse, + Color.LimeGreen + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f); + + float sine = (float)Math.Sin(time * 0.1f * actionSpeed / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.15f * actionSpeed / MathHelper.Pi); + + Vector2 baseDestination = Owner.Center - Vector2.UnitY * (20 + 5 * sine2) - Vector2.UnitX * 30 * lerpDir; + + if (Owner.Calamity().scionsCurioGotHit) + { + if (attackTimer == 0) + savedPos = baseDestination; + if (attackTimer == 30) + { + float blastScale = 1.6f; + for (int g = 0; g < 17; g++) + { + int DustID = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID); + dust.scale = Main.rand.NextFloat(1.1f, 1.35f) * blastScale; + dust.velocity = new Vector2(9, 9).RotatedByRandom(100) * blastScale * Main.rand.NextFloat(0.4f, 0.9f) + Vector2.UnitY * -10; + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.Green : Color.Chartreuse; + dust.fadeIn = Main.rand.NextFloat(0.2f, 2f); + } + Particle blastvfx = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse * 0.9f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f * blastScale, 0.15f * blastScale, 10, true); + GeneralParticleHandler.SpawnParticle(blastvfx); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 0.5f * blastScale, Pitch = Main.rand.NextFloat(0.5f, 0.7f), MaxInstances = 6 }, Projectile.Center); + + // Create Blast + float blastSize = 115 * blastScale; + float minMultiplier = 0.5f; + int hitsToMinMult = 5; + int debuff = ModContent.BuffType(); + int debuffTime = 300; + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), ScionsCurio.postHitDamage, 7, (Owner != null ? Owner.whoAmI : -1), blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Ranged; + attackTimer = -1; + Owner.Calamity().scionsCurioGotHit = false; + } + baseDestination = savedPos + new Vector2(4, 4).RotatedBy(sine2 * 0.02f); + attackTimer++; + } + + facing = Math.Sign(Projectile.Center.X == Owner.Center.X ? Owner.direction : Projectile.Center.DirectionTo(Owner.Center).X); + + Vector2 speakingDestination = Owner.Center - Vector2.UnitY * (10 + 3 * sine2) + Vector2.UnitX * 45 * lerpDir; + if (time == 0) + goalPosition = baseDestination; + goalPosition = Vector2.Lerp(goalPosition, swineSecretTimer > 0 ? speakingDestination : baseDestination, 0.08f); + lerpDir = MathHelper.Lerp(Owner.direction, facing, 0.04f); + + Projectile.velocity = (goalPosition - Projectile.Center) / (followSpeed * (swineSecretTimer > 0 ? 0.5f : 1)); + + Projectile.rotation = 0.2f * sine; + + if (Owner.Calamity().scionsCurioVisuals) + Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.3f); + + // Swine Secrets + int textSpeed = 5; + if (swineSecretTimer > 0) + { + if (swineSecretTimer % textSpeed == 0 && swineSecretTimer > 30) + { + int originalLength = CalamityUtils.GetTextValue(("Misc.SwineSecret" + chosenSecret.ToString())).Length + 1; + string text = CalamityUtils.GetTextValue(("Misc.SwineSecret" + chosenSecret.ToString())); + int charstoRemove = (text.Length - (int)swineText); + if (charstoRemove > -1) + { + text = text.Remove(swineText, charstoRemove); + if (swineSecretTimer >= 2) + text = text.Remove(0, swineText - 1); + } + if (swineText <= originalLength) + swineText++; + float textSpacing = Utils.Remap(originalLength, 5, 190, 20, 9, true); + Vector2 position = Owner.Center - (Vector2.UnitX * originalLength * (textSpacing / 2)) + (Vector2.UnitX * originalLength * textSpacing / originalLength * swineText); + CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, 1, 1), usedColor, text, false, false); + } + if (swineSecretTimer % 6 == 0 && swineSecretTimer > 30) + { + SoundStyle snort = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(snort with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.35f, 0.55f) }, Projectile.Center); + actionSpeed = Main.rand.NextFloat(0.5f, 1.5f); + } + swineSecretTimer--; + fxFade = MathHelper.Lerp(fxFade, 1, 0.08f); + if (swineSecretTimer == 0) + time = 120; + } + else + { + swineText = 1; + fxFade = MathHelper.Lerp(fxFade, 0, 0.08f); + } + + if (idleTimer % 90 == 0 && swineSecretTimer == 0 && idleTimer > idleMax - 300) + { + CombatText.NewText(Projectile.Hitbox, usedColor, CalamityUtils.GetTextValue("Misc.SwineSecret0"), false, true); + actionSpeed = 1.1f; + SoundStyle snort = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(snort with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.35f, 0.55f) }, Projectile.Center); + } + + + actionSpeed = MathHelper.Lerp(actionSpeed, 1, 0.08f); + if (Owner.Calamity().scionsCurio) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + time++; + if (sharingSwineSecrets && swineSecretTimer == 0) + { + int number = 0; + for (int i = 0; i < 1; i++) + { + int attemptNumber = Main.rand.Next(1, 40 + 1); + if (listNumbers.Contains(attemptNumber)) + { + if (listNumbers.Count >= 40) // Once all options have been exhausted, reset + { + listNumbers.Clear(); + listNumbers.Add(attemptNumber); + number = attemptNumber; + } + else + i--; + } + else + { + listNumbers.Add(attemptNumber); + number = attemptNumber; + } + } + chosenSecret = number; + int originalLength = CalamityUtils.GetTextValue(("Misc.SwineSecret" + chosenSecret.ToString())).Length; + swineSecretTimer = originalLength * textSpeed + 30; + idleTimer = idleMax - 300 - swineSecretTimer; + } + if (Owner.velocity.Length() < 2 && Owner.Calamity().scionsCurioVisuals) + idleTimer++; + else + { + idleTimer = 0; + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D cTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Color drawColor = usedColor * Utils.GetLerpValue(0, 100, time, true); + Color bodyColor = lightColor; + float drawMult = 1; + float attackFade = (float)Math.Pow(1 + (float)Math.Pow(Utils.GetLerpValue(0, 30, attackTimer, true), 4), 3); + + Vector2 shake = Main.rand.NextVector2Circular((attackFade - 1) * 5, (attackFade - 1) * 5); + + for (int i = 0; i < 18; i++) // Backglow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 2 * drawMult * attackFade; + if (attackFade > 1 || Owner.Calamity().scionsCurioVisuals) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + shake, null, Color.Lerp(drawColor, Color.Chartreuse, attackFade - 1) with { A = 0 } * 0.2f * drawMult, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, facing == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + + // Main body + if (Owner.Calamity().scionsCurioVisuals) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + shake, null, Color.Lerp(bodyColor, Color.Chartreuse with { A = 0 }, attackFade - 1), Projectile.rotation, tex.Size() * 0.5f, new Vector2(1f, 1f) * Projectile.scale, facing == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + // Eye Shine + for (int j = -1; j <= 1; j += 2) + { + for (int i = -4; i <= 4; i++) + { + Vector2 pos = (Vector2.UnitX * 3 * facing + Vector2.UnitY * -2).RotatedBy(Projectile.rotation); + float scale = 1; + if (i == 0) i++; + if (i > 0) + { + scale = 0.9f; + pos = (Vector2.UnitX * 10 * facing + Vector2.UnitY * -2).RotatedBy(Projectile.rotation); + } + Main.EntitySpriteDraw(cTexture, Projectile.Center - Main.screenPosition + pos + shake, null, Color.Lerp(Color.Red, Color.White, Math.Abs(i) * 0.05f) with { A = 0 } * 0.7f * fxFade, Projectile.rotation + (j == -1 ? MathHelper.PiOver2 : 0), cTexture.Size() * 0.5f, new Vector2(2f - 0.1f * Math.Abs(i), 1f + 0.4f * Math.Abs(i)) * Projectile.scale * 0.35f * scale * Main.rand.NextFloat(0.65f, 1.25f), SpriteEffects.None); + } + } + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/ScionsCurioMini.png b/Projectiles/Typeless/ScionsCurioMini.png new file mode 100644 index 0000000000..cd143eae5a Binary files /dev/null and b/Projectiles/Typeless/ScionsCurioMini.png differ diff --git a/Sounds/Item/Swine1.ogg b/Sounds/Item/Swine1.ogg new file mode 100644 index 0000000000..1dea0682ff Binary files /dev/null and b/Sounds/Item/Swine1.ogg differ diff --git a/Sounds/Item/Swine2.ogg b/Sounds/Item/Swine2.ogg new file mode 100644 index 0000000000..9b6bf3f57f Binary files /dev/null and b/Sounds/Item/Swine2.ogg differ diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index c396017248..7d8174109c 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -1402,7 +1402,7 @@ namespace CalamityMod.World Chest chest = MiscWorldgenRoutines.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); if (chest != null) { - chest.item[0].SetDefaults(ModContent.ItemType()); + chest.item[0].SetDefaults(ModContent.ItemType()); chest.item[0].Prefix(-1); break; }