diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 583986729d..7d846efaeb 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -patreon: Fabsol +patreon: CalamityMod \ No newline at end of file diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index 8b62bf1917..f03fc82fa4 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -17,7 +17,12 @@ namespace CalamityMod.BiomeManagers { if (CalamityPlayer.areThereAnyDamnBosses) return Main.curMusic; - return CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3") ?? MusicID.Hell; + + int? musicSlot = CalamityClientConfig.Instance.AbyssLayer3Alt ? + CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3Alt") : + CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3"); + + return musicSlot ?? MusicID.Hell; } } diff --git a/BiomeManagers/BasaltGullyBiome.cs b/BiomeManagers/BasaltGullyBiome.cs index e2ce89ae56..1fe9fa066a 100644 --- a/BiomeManagers/BasaltGullyBiome.cs +++ b/BiomeManagers/BasaltGullyBiome.cs @@ -21,9 +21,12 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { + bool MoreThanShores = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaShoresTiles; + bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; - return BiomeTileCounterSystem.SunkenSeaBasaltTiles > 1000 && MoreThanBurrows; + return BiomeTileCounterSystem.SunkenSeaBasaltTiles > 1000 && MoreThanShores && MoreThanReefs && MoreThanPolyp && MoreThanBurrows; } } } diff --git a/BiomeManagers/RadiantReefsBiome.cs b/BiomeManagers/RadiantReefsBiome.cs index 7dd90a03fb..600ce769d2 100644 --- a/BiomeManagers/RadiantReefsBiome.cs +++ b/BiomeManagers/RadiantReefsBiome.cs @@ -21,10 +21,11 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanShores = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaShoresTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; - return BiomeTileCounterSystem.SunkenSeaReefsTiles > 1000 && MoreThanBurrows && MoreThanPolyp; + return ((BiomeTileCounterSystem.SunkenSeaReefsTiles > 500) || (BiomeTileCounterSystem.SunkenSeaBasaltTiles + BiomeTileCounterSystem.SunkenSeaReefsTiles > 500)) && MoreThanBurrows && MoreThanPolyp && MoreThanShores; } } } diff --git a/BiomeManagers/TimelessShoresBiome.cs b/BiomeManagers/TimelessShoresBiome.cs index cb44c6cdc8..56a3399ffb 100644 --- a/BiomeManagers/TimelessShoresBiome.cs +++ b/BiomeManagers/TimelessShoresBiome.cs @@ -21,10 +21,10 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanBasalt = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaBasaltTiles; - return BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000 && MoreThanPolyp && MoreThanReefs; + return BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000 && MoreThanReefs && MoreThanBasalt; } } } diff --git a/Buffs/Alcohol/BloodyMaryBuff.png b/Buffs/Alcohol/BloodyMaryBuff.png index 46cf3a0b57..40355f1d96 100644 Binary files a/Buffs/Alcohol/BloodyMaryBuff.png and b/Buffs/Alcohol/BloodyMaryBuff.png differ diff --git a/Buffs/Alcohol/CaribbeanRumBuff.png b/Buffs/Alcohol/CaribbeanRumBuff.png index c3e5464b05..3996666a07 100644 Binary files a/Buffs/Alcohol/CaribbeanRumBuff.png and b/Buffs/Alcohol/CaribbeanRumBuff.png differ diff --git a/Buffs/Alcohol/CinnamonRollBuff.png b/Buffs/Alcohol/CinnamonRollBuff.png index 8d9ff66e26..a1a2c0ae34 100644 Binary files a/Buffs/Alcohol/CinnamonRollBuff.png and b/Buffs/Alcohol/CinnamonRollBuff.png differ diff --git a/Buffs/Alcohol/EverclearBuff.png b/Buffs/Alcohol/EverclearBuff.png index fde2031fa3..3f275ba54f 100644 Binary files a/Buffs/Alcohol/EverclearBuff.png and b/Buffs/Alcohol/EverclearBuff.png differ diff --git a/Buffs/Alcohol/EvergreenGinBuff.png b/Buffs/Alcohol/EvergreenGinBuff.png index 5e41d87eb6..f7e2133cd3 100644 Binary files a/Buffs/Alcohol/EvergreenGinBuff.png and b/Buffs/Alcohol/EvergreenGinBuff.png differ diff --git a/Buffs/Alcohol/FireballBuff.png b/Buffs/Alcohol/FireballBuff.png index 8887354d3f..a81dcc472f 100644 Binary files a/Buffs/Alcohol/FireballBuff.png and b/Buffs/Alcohol/FireballBuff.png differ diff --git a/Buffs/Alcohol/GrapeBeerBuff.png b/Buffs/Alcohol/GrapeBeerBuff.png index d951249d12..258910c643 100644 Binary files a/Buffs/Alcohol/GrapeBeerBuff.png and b/Buffs/Alcohol/GrapeBeerBuff.png differ diff --git a/Buffs/Alcohol/MargaritaBuff.png b/Buffs/Alcohol/MargaritaBuff.png index 068aebf1e0..94de724886 100644 Binary files a/Buffs/Alcohol/MargaritaBuff.png and b/Buffs/Alcohol/MargaritaBuff.png differ diff --git a/Buffs/Alcohol/MoonshineBuff.png b/Buffs/Alcohol/MoonshineBuff.png index b079231309..028834ea24 100644 Binary files a/Buffs/Alcohol/MoonshineBuff.png and b/Buffs/Alcohol/MoonshineBuff.png differ diff --git a/Buffs/Alcohol/MoscowMuleBuff.png b/Buffs/Alcohol/MoscowMuleBuff.png index 4ba5245776..a9cf2f5a18 100644 Binary files a/Buffs/Alcohol/MoscowMuleBuff.png and b/Buffs/Alcohol/MoscowMuleBuff.png differ diff --git a/Buffs/Alcohol/OldFashionedBuff.png b/Buffs/Alcohol/OldFashionedBuff.png index 2b6e8fdaf0..a3ba916b88 100644 Binary files a/Buffs/Alcohol/OldFashionedBuff.png and b/Buffs/Alcohol/OldFashionedBuff.png differ diff --git a/Buffs/Alcohol/CirrusVodkaBuff.cs b/Buffs/Alcohol/PurpleHazeBuff.cs similarity index 83% rename from Buffs/Alcohol/CirrusVodkaBuff.cs rename to Buffs/Alcohol/PurpleHazeBuff.cs index cf33f6dd41..9ef31ce2b1 100644 --- a/Buffs/Alcohol/CirrusVodkaBuff.cs +++ b/Buffs/Alcohol/PurpleHazeBuff.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { - public class CirrusVodkaBuff : ModBuff + public class PurpleHazeBuff : ModBuff { public override void SetStaticDefaults() { @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { - player.Calamity().cirrusVodka = true; + player.Calamity().purpleHaze = true; } } } diff --git a/Buffs/Alcohol/CirrusVodkaBuff.png b/Buffs/Alcohol/PurpleHazeBuff.png similarity index 100% rename from Buffs/Alcohol/CirrusVodkaBuff.png rename to Buffs/Alcohol/PurpleHazeBuff.png diff --git a/Buffs/Alcohol/RedWineBuff.png b/Buffs/Alcohol/RedWineBuff.png index a3e116c717..556b48d8fc 100644 Binary files a/Buffs/Alcohol/RedWineBuff.png and b/Buffs/Alcohol/RedWineBuff.png differ diff --git a/Buffs/Alcohol/RumBuff.png b/Buffs/Alcohol/RumBuff.png index 29f7cd9fda..e43b540c7a 100644 Binary files a/Buffs/Alcohol/RumBuff.png and b/Buffs/Alcohol/RumBuff.png differ diff --git a/Buffs/Alcohol/ScrewdriverBuff.png b/Buffs/Alcohol/ScrewdriverBuff.png index 2c0984bc98..4d24f45ebd 100644 Binary files a/Buffs/Alcohol/ScrewdriverBuff.png and b/Buffs/Alcohol/ScrewdriverBuff.png differ diff --git a/Buffs/Alcohol/StarBeamRyeBuff.png b/Buffs/Alcohol/StarBeamRyeBuff.png index e678986953..f93dc9cfec 100644 Binary files a/Buffs/Alcohol/StarBeamRyeBuff.png and b/Buffs/Alcohol/StarBeamRyeBuff.png differ diff --git a/Buffs/Alcohol/TequilaBuff.png b/Buffs/Alcohol/TequilaBuff.png index a6c233e3d1..ea4d7ed14a 100644 Binary files a/Buffs/Alcohol/TequilaBuff.png and b/Buffs/Alcohol/TequilaBuff.png differ diff --git a/Buffs/Alcohol/TequilaSunriseBuff.png b/Buffs/Alcohol/TequilaSunriseBuff.png index ef5bee8678..9d36c9250e 100644 Binary files a/Buffs/Alcohol/TequilaSunriseBuff.png and b/Buffs/Alcohol/TequilaSunriseBuff.png differ diff --git a/Buffs/Alcohol/VodkaBuff.png b/Buffs/Alcohol/VodkaBuff.png index 485745f805..ba5666ddbc 100644 Binary files a/Buffs/Alcohol/VodkaBuff.png and b/Buffs/Alcohol/VodkaBuff.png differ diff --git a/Buffs/Alcohol/WhiskeyBuff.png b/Buffs/Alcohol/WhiskeyBuff.png index 56f2662420..fce1a5403b 100644 Binary files a/Buffs/Alcohol/WhiskeyBuff.png and b/Buffs/Alcohol/WhiskeyBuff.png differ diff --git a/Buffs/Alcohol/WhiteWineBuff.png b/Buffs/Alcohol/WhiteWineBuff.png index 548844ed08..bfa64feecc 100644 Binary files a/Buffs/Alcohol/WhiteWineBuff.png and b/Buffs/Alcohol/WhiteWineBuff.png differ diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index f2ef8dfbb5..f893df6689 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -14,6 +14,24 @@ namespace CalamityMod.Buffs public override void Update(int type, Player player, ref int buffIndex) { + // Globally remove summon tag buff stacking + // Other mods need to add to this list because we genuinely don't have any way to tell this + if (SummonTagBuffList.Includes(type) && buffIndex > 0) + { + for (int i = buffIndex; i >= 0; i--) + { + if (player.buffTime[i] > 0) + { + int buffID = player.buffType[i]; + if (SummonTagBuffList.Includes(buffID) && buffID != type) + { + player.DelBuff(i); + break; + } + } + } + } + if (type == BuffID.Archery) { player.arrowDamage *= 0.955f; @@ -106,6 +124,24 @@ namespace CalamityMod.Buffs public override void Update(int type, NPC npc, ref int buffIndex) { + // Globally remove summon tag debuff stacking, unless allowed in the SummonTag + // Other mods need to add to this list because otherwise we can't tell which IsATag buff is actually for whips + if (SummonTagDebuffDict.TryGet(type, out var tag1) && !tag1.AllowsWhipStacking && buffIndex > 0) + { + for (int i = buffIndex; i >= 0; i--) + { + if (npc.buffTime[i] > 0) + { + int buffID = npc.buffType[i]; + if (SummonTagDebuffDict.TryGet(buffID, out var tag2) && !tag2.AllowsWhipStacking && buffID != type) + { + npc.DelBuff(i); + break; + } + } + } + } + if (type == BuffID.Webbed) { if (npc.Calamity().webbed < npc.buffTime[buffIndex]) diff --git a/Buffs/Mounts/AlicornBuff.cs b/Buffs/Mounts/AlicornBuff.cs deleted file mode 100644 index 34dad87b5a..0000000000 --- a/Buffs/Mounts/AlicornBuff.cs +++ /dev/null @@ -1,21 +0,0 @@ -using CalamityMod.Items.Mounts; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Buffs.Mounts -{ - public class AlicornBuff : ModBuff - { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.mount.SetMount(ModContent.MountType(), player); - player.buffTime[buffIndex] = 10; - player.Calamity().fab = true; - } - } -} diff --git a/Buffs/Mounts/AlicornBuff.png b/Buffs/Mounts/AlicornBuff.png deleted file mode 100644 index f821a3a2bb..0000000000 Binary files a/Buffs/Mounts/AlicornBuff.png and /dev/null differ diff --git a/Buffs/Mounts/BrimroseMount.cs b/Buffs/Mounts/BrimroseMount.cs index 787bc90c18..9b8cdac784 100644 --- a/Buffs/Mounts/BrimroseMount.cs +++ b/Buffs/Mounts/BrimroseMount.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.Mounts public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(ModContent.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; } } diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.cs b/Buffs/Placeables/BlueCandleBuff.cs similarity index 95% rename from Buffs/Placeables/CirrusBlueCandleBuff.cs rename to Buffs/Placeables/BlueCandleBuff.cs index 96900379fe..a505abfa28 100644 --- a/Buffs/Placeables/CirrusBlueCandleBuff.cs +++ b/Buffs/Placeables/BlueCandleBuff.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { - public class CirrusBlueCandleBuff : ModBuff + public class BlueCandleBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.png b/Buffs/Placeables/BlueCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusBlueCandleBuff.png rename to Buffs/Placeables/BlueCandleBuff.png diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/PinkCandleBuff.cs similarity index 95% rename from Buffs/Placeables/CirrusPinkCandleBuff.cs rename to Buffs/Placeables/PinkCandleBuff.cs index 9701a42348..5bdbbb661b 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/PinkCandleBuff.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { - public class CirrusPinkCandleBuff : ModBuff + public class PinkCandleBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.png b/Buffs/Placeables/PinkCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusPinkCandleBuff.png rename to Buffs/Placeables/PinkCandleBuff.png diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.cs b/Buffs/Placeables/PurpleCandleBuff.cs similarity index 96% rename from Buffs/Placeables/CirrusPurpleCandleBuff.cs rename to Buffs/Placeables/PurpleCandleBuff.cs index 1ac263a413..e4d54e4bee 100644 --- a/Buffs/Placeables/CirrusPurpleCandleBuff.cs +++ b/Buffs/Placeables/PurpleCandleBuff.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { - public class CirrusPurpleCandleBuff : ModBuff + public class PurpleCandleBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.png b/Buffs/Placeables/PurpleCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusPurpleCandleBuff.png rename to Buffs/Placeables/PurpleCandleBuff.png diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/YellowCandleBuff.cs similarity index 96% rename from Buffs/Placeables/CirrusYellowCandleBuff.cs rename to Buffs/Placeables/YellowCandleBuff.cs index 8728f074dc..eee56221ff 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/YellowCandleBuff.cs @@ -6,7 +6,8 @@ using static Terraria.NPC; namespace CalamityMod.Buffs.Placeables { - public class CirrusYellowCandleBuff : ModBuff + public class YellowCandleBuff + : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.png b/Buffs/Placeables/YellowCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusYellowCandleBuff.png rename to Buffs/Placeables/YellowCandleBuff.png diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs deleted file mode 100644 index 1f0a06c940..0000000000 --- a/Buffs/StatBuffs/KamiBuff.cs +++ /dev/null @@ -1,27 +0,0 @@ -using CalamityMod.Items.Weapons.Typeless; -using Terraria; -using Terraria.Audio; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class KamiBuff : ModBuff - { - public override LocalizedText Description => base.Description.WithFormatArgs(YanmeisKnife.RunSpeedBoost.ToPercent()); - - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().kamiBoost = true; - if (player.buffTime[buffIndex] == 1) - SoundEngine.PlaySound(YanmeisKnife.ExpireSound, player.Center); - } - } -} diff --git a/Buffs/StatBuffs/KamiBuff.png b/Buffs/StatBuffs/KamiBuff.png deleted file mode 100644 index 4fdc0fff94..0000000000 Binary files a/Buffs/StatBuffs/KamiBuff.png and /dev/null differ diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs deleted file mode 100644 index a4f3908529..0000000000 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ /dev/null @@ -1,27 +0,0 @@ -using CalamityMod.NPCs; -using CalamityMod.Systems.Collections; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatDebuffs -{ - public class KamiFlu : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) - npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().kamiFlu; - npc.DelBuff(buffIndex); - buffIndex--; - } - } -} diff --git a/Buffs/StatDebuffs/KamiFlu.png b/Buffs/StatDebuffs/KamiFlu.png deleted file mode 100644 index df7af84f98..0000000000 Binary files a/Buffs/StatDebuffs/KamiFlu.png and /dev/null differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 46444fdd99..87c630d176 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -116,7 +116,6 @@ namespace CalamityMod.CalPlayer public int searedPanTimer = 0; /// Used to get around the hardcoded Potion Sickness duration to allow Hadal Stew's reduced duration. public int potionTimer = 0; - public bool cirrusDress = false; /// If set to true, prevents all player dashes. Used by Ball and Chain, and Stygian Shield. public bool blockAllDashes = false; /// Used by Flamsteed Ring to reset the player's hitbox size after dismounting. @@ -244,7 +243,6 @@ namespace CalamityMod.CalPlayer public bool newPrincessInventory = false; public bool newSkeletonMerchantInventory = false; public bool newPermafrostInventory = false; - public bool newCirrusInventory = false; public bool newAmidiasInventory = false; public bool newBanditInventory = false; public bool newCalamitasInventory = false; @@ -363,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; @@ -466,7 +463,6 @@ namespace CalamityMod.CalPlayer #region Mount public bool onyxExcavator = false; public bool rimehound = false; - public bool fab = false; public bool crysthamyr = false; public bool ExoChair = false; public AndromedaPlayerState andromedaState; @@ -847,7 +843,7 @@ namespace CalamityMod.CalPlayer public int raiderCritLifespan = 0; public int raiderSoundCooldown = 0; public bool gSabaton = false; - public int gSabatonHotkeyHoldTime = 0; + public int gSabatonHotkeyFallWindup = -1; public int gSabatonFall = 0; public bool gSabatonFalling = false; public int gSabatonTempJumpSpeed = 0; @@ -963,6 +959,7 @@ namespace CalamityMod.CalPlayer public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; public Color XykFXColor = Color.Black; + public int XykWingTimer = 0; public bool manaOverloader = false; /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; @@ -1026,6 +1023,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; @@ -1042,7 +1042,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; @@ -1329,7 +1328,7 @@ namespace CalamityMod.CalPlayer public bool zen = false; public bool isNearbyBoss = false; public bool flaskBrimstone = false; - public bool cirrusVodka = false; + public bool purpleHaze = false; public bool mushy = false; public bool PinkJellyRegen = false; public bool GreenJellyRegen = false; @@ -1391,7 +1390,6 @@ namespace CalamityMod.CalPlayer public int bloodfinTimer = 30; public bool hallowedRegen = false; public bool hallowedPower = false; - public bool kamiBoost = false; public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; @@ -1542,6 +1540,16 @@ namespace CalamityMod.CalPlayer public bool AmphibiansGuitarBool = false; #endregion + #region Whip + public bool forceSummonTagCrit = false; //Forces whip multiplicative effects to function as crit chance + public bool forceSummonTagMultiplicative = false; //Forces whip multiplicative effects to function as multiplicative damage + + //Allows providing flat, crit, and multiplicative tag values on gear. These will apply on *any* minion or sentry hit, not just if the target is tagged. + public int bonusFlatTag = 0; + public float bonusCritTag = 0; + public float bonusMultTag = 0; + #endregion + #region Biome public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneClamDen || ZoneBasaltGully; public bool ZoneTimelessShores => Player.InModBiome(); @@ -1775,7 +1783,6 @@ namespace CalamityMod.CalPlayer newPrincessInventory = false; newSkeletonMerchantInventory = false; newPermafrostInventory = false; - newCirrusInventory = false; newAmidiasInventory = false; newBanditInventory = false; newCalamitasInventory = false; @@ -1829,7 +1836,6 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newPrincessInventory", newPrincessInventory); boost.AddWithCondition("newSkeletonMerchantInventory", newSkeletonMerchantInventory); boost.AddWithCondition("newPermafrostInventory", newPermafrostInventory); - boost.AddWithCondition("newCirrusInventory", newCirrusInventory); boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); boost.AddWithCondition("newBanditInventory", newBanditInventory); boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); @@ -1921,7 +1927,6 @@ namespace CalamityMod.CalPlayer newPrincessInventory = boost.Contains("newPrincessInventory"); newSkeletonMerchantInventory = boost.Contains("newSkeletonMerchantInventory"); newPermafrostInventory = boost.Contains("newPermafrostInventory"); - newCirrusInventory = boost.Contains("newCirrusInventory"); newAmidiasInventory = boost.Contains("newAmidiasInventory"); newBanditInventory = boost.Contains("newBanditInventory"); newCalamitasInventory = boost.Contains("newCalamitasInventory"); @@ -2096,7 +2101,6 @@ namespace CalamityMod.CalPlayer onyxExcavator = false; rimehound = false; - fab = false; crysthamyr = false; ExoChair = false; miniOldDuke = false; @@ -2160,7 +2164,6 @@ namespace CalamityMod.CalPlayer shadowSpeed = false; dsSetBonus = false; wearingRogueArmor = false; - cirrusDress = false; blockAllDashes = false; blazingCursorDamage = false; @@ -2303,7 +2306,6 @@ namespace CalamityMod.CalPlayer phantomicArtifact = false; hallowedRegen = false; hallowedPower = false; - kamiBoost = false; tracersDust = false; tracersCelestial = false; tracersElysian = false; @@ -2321,7 +2323,7 @@ namespace CalamityMod.CalPlayer starTaintedGenerator = false; camper = false; corrosiveSpine = false; - RustyMedallionDroplets = false; + scionsCurio = false; rottenDogTooth = false; angelicAlliance = false; BloomStoneRegen = false; @@ -2544,7 +2546,7 @@ namespace CalamityMod.CalPlayer trippy = false; amidiasBlessing = false; flaskBrimstone = false; - cirrusVodka = false; + purpleHaze = false; shine = false; anechoicCoating = false; mushy = false; @@ -2711,6 +2713,13 @@ namespace CalamityMod.CalPlayer AmphibiansGuitarBool = false; #endregion + //On GFB both are enabled to cause the game to pick between multiplicative and crit at random + forceSummonTagMultiplicative = (Main.zenithWorld ? true : false); + forceSummonTagCrit = (Main.zenithWorld ? true : false); + bonusFlatTag = 0; + bonusCritTag = 0; + bonusMultTag = 0; + /* Spawn blockers from back when they used to work by being favorited and not a toggleable item noStupidNaturalARSpawns = false disableVoodooSpawns = false; @@ -2867,7 +2876,6 @@ namespace CalamityMod.CalPlayer bloomStoneHealTimer = 0; bloomStoneDR = 0; murasamaHitCooldown = 0; - RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; holyInfernoFadeIntensity = 0f; spiritOriginCritBoost = 0; @@ -2876,7 +2884,7 @@ namespace CalamityMod.CalPlayer adrenaline = 0f; raiderCritLifespan = 0; raiderSoundCooldown = 0; - gSabatonHotkeyHoldTime = 0; + gSabatonHotkeyFallWindup = -1; gSabatonFall = 0; gSabatonFalling = false; gSabatonTempJumpSpeed = 0; @@ -3004,7 +3012,6 @@ namespace CalamityMod.CalPlayer hallowedPower = false; onyxExcavator = false; rimehound = false; - fab = false; crysthamyr = false; ExoChair = false; abyssalDivingSuitPlates = false; @@ -3018,7 +3025,6 @@ namespace CalamityMod.CalPlayer crimEffigy = false; rRage = false; xWrath = false; - kamiBoost = false; graxDefense = false; encased = false; brutalCarnage = false; @@ -3042,7 +3048,7 @@ namespace CalamityMod.CalPlayer sulphurskin = false; baguette = false; flaskBrimstone = false; - cirrusVodka = false; + purpleHaze = false; shine = false; anechoicCoating = false; mushy = false; @@ -3337,18 +3343,20 @@ namespace CalamityMod.CalPlayer } - //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero - if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) + //Only increment the slam if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset slam time to zero + if (CalamityKeybinds.GravistarSabatonHotkey.JustPressed && gSabatonHotkeyFallWindup < 0) + gSabatonHotkeyFallWindup = 0; + if (gSabaton && gSabatonHotkeyFallWindup >= 0 && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { - gSabatonHotkeyHoldTime++; - if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime % 3f == 0) + gSabatonHotkeyFallWindup++; + if (gSabatonHotkeyFallWindup < 20 && gSabatonHotkeyFallWindup % 2f == 0) { SpawnGravistarParticle(); } } else if (Main.myPlayer == Player.whoAmI) { - gSabatonHotkeyHoldTime = 0; + gSabatonHotkeyFallWindup = -1; } if (CalamityKeybinds.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == Player.whoAmI) @@ -4124,16 +4132,16 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer) { - // While holding hotkey, but before slam, bring Y velocity closer to 0 - if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) - Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 2f)) / 60f; + // While preparing slam, bring Y velocity closer to 0 + if (gSabatonHotkeyFallWindup < 20 && gSabatonHotkeyFallWindup != 0 && !gSabatonFalling) + Player.velocity.Y *= (60 - (gSabatonHotkeyFallWindup * 0.75f)) / 60f; // Play sound a bit early so it goes in time with the fall - if (gSabatonHotkeyHoldTime == 15 && !gSabatonFalling) + if (gSabatonHotkeyFallWindup == 5 && !gSabatonFalling) SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); // 0.5 seconds passed, falling time - if (gSabatonHotkeyHoldTime == 30) + if (gSabatonHotkeyFallWindup == 20) { gSabatonFalling = true; Player.velocity.Y = 0.01f; @@ -4145,6 +4153,7 @@ namespace CalamityMod.CalPlayer { gSabatonFall = 0; gSabatonFalling = false; + gSabatonHotkeyFallWindup = -1; } if (gSabatonFalling) @@ -4172,6 +4181,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); gSabatonFall = 0; gSabatonFalling = false; + gSabatonHotkeyFallWindup = -1; // Temporary jump speed is granted for 40 frames gSabatonTempJumpSpeed = 40; @@ -4183,6 +4193,7 @@ namespace CalamityMod.CalPlayer { gSabatonFall = 0; gSabatonFalling = false; + gSabatonHotkeyFallWindup = -1; } // Reset The Evolution's same projectile DR if unequipped or the cooldown ends @@ -4462,7 +4473,6 @@ namespace CalamityMod.CalPlayer (laudanum && Player.HasBuff(BuffID.VortexDebuff) ? 0.15f : 0f) + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + - (kamiBoost ? YanmeisKnife.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (getSandCloakAccelBoost ? 0.75f : 0f) + @@ -4483,7 +4493,6 @@ namespace CalamityMod.CalPlayer (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + - (kamiBoost ? YanmeisKnife.RunSpeedBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + @@ -4857,21 +4866,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 @@ -4916,8 +4910,6 @@ namespace CalamityMod.CalPlayer abyssalDivingSuitForce = true; if (vanity.type == ModContent.ItemType()) aquaticHeartForce = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; if (vanity.type == ModContent.ItemType()) ghostBracelet = true; if (vanity.type == ModContent.ItemType()) @@ -5321,7 +5313,7 @@ namespace CalamityMod.CalPlayer public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) { // Remove excess alcohol - if (removeDebuffs && alcoholPoisonLevel > (cirrusDress ? 5 : 3)) + if (removeDebuffs && alcoholPoisonLevel > 3) { List Alcohol = new List(); for (int i = 0; i < Player.MaxBuffs; i++) @@ -5340,7 +5332,7 @@ namespace CalamityMod.CalPlayer poison -= relation[1]; // Cancel the poison level Alcohol.RemoveAt(0); } - while (poison > (cirrusDress ? 5 : 3)); + while (poison > 3); } } #endregion diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 426cf2c311..7a911dbef1 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -506,21 +506,6 @@ namespace CalamityMod.CalPlayer public void ModHorizontalMovement() { - if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.DashSpeed - Player.mount.RunSpeed / 2f) - { - Rectangle damageHitbox = Player.getRect(); - - if (Player.direction == 1) - damageHitbox.Offset(Player.width - 1, 0); - - damageHitbox.Width = 2; - damageHitbox.Inflate(6, 12); - float damage = Player.GetTotalDamage().ApplyTo(800f); - float knockback = 10f; - int NPCImmuneTime = 30; - int playerImmuneTime = 6; - DoMountDashDamage(damageHitbox, damage, knockback, NPCImmuneTime, playerImmuneTime); - } if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed) { diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 185a44e5dd..31111a3de1 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -535,7 +535,10 @@ namespace CalamityMod.CalPlayer // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit CalamityGlobalNPC cgn = target.Calamity(); if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) - modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + 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) @@ -619,7 +622,7 @@ namespace CalamityMod.CalPlayer // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit CalamityGlobalNPC cgn = target.Calamity(); if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) - modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + modifiers.ModifyHitInfo += YellowCandleBuff.ModifyHitInfo_Spite; // Stealth strike damage multipliers are applied here. // TODO -- stealth should be its own damage class and this should be applied as player StealthDamage *= XYZ @@ -638,6 +641,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) { @@ -718,7 +724,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) @@ -733,7 +739,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) @@ -748,7 +754,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) @@ -763,7 +769,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) @@ -778,7 +784,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) @@ -1780,7 +1786,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise hurtSoundTimer = 10; } - else if (((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) || Player.GetModPlayer().vanityEquipped) + else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) { modifiers.DisableSound(); SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise @@ -1913,6 +1919,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/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 3432974a04..65019aed05 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -234,7 +234,7 @@ namespace CalamityMod.CalPlayer Player.fishingSkill += 5; } - if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) + if (alcoholPoisonLevel > 3) { // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. Player.nebulaLevelLife = 0; @@ -251,12 +251,6 @@ namespace CalamityMod.CalPlayer } #endregion - if (manaOverloader) - { - if (Player.statMana > (int)(Player.statManaMax2 * 0.5)) - totalNegativeLifeRegen += 3; - } - if (brimflameFrenzy) { Player.manaRegen = 0; @@ -398,7 +392,7 @@ namespace CalamityMod.CalPlayer { float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / (float)Player.statLifeMax2; //Ambrosial Ampule and ooze give between 2 and 6 hp/s - int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp((purity || aAmpoule? 2f : 4f), (purity || aAmpoule ? 8f : 12f), missingLifeRatio));//Rounding is needed for it to ever actually give +6 hp/s, as the integer conversion would otherwise floor it. + int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp((purity || aAmpoule? 2f : 4f), (purity || aAmpoule ? 10f : 12f), missingLifeRatio));//Rounding is needed for it to ever actually give +6 hp/s, as the integer conversion would otherwise floor it. Player.lifeRegen += lifeRegenToGive; radiantOozeRegen += lifeRegenToGive / 2f; ambrosialAmpouleRegen += lifeRegenToGive / 2f; @@ -715,13 +709,19 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += (int)MathHelper.Lerp(2f, 6f, regenBenefitFactor); Player.lifeRegenTime += (int)MathHelper.Lerp(1f, 3f, regenBenefitFactor); } + + if (manaOverloader) + { + float manaRatio = Player.statMana / (float)Player.statManaMax2; + Player.lifeRegen += (int)(MathF.Round(MathHelper.Lerp(4f, -4f, manaRatio)) * (Player.HasBuff(BuffID.ManaSickness) ? 0.5f : 1f)); + } #region Standing Still Life Regen // Standing still healing bonuses (all are exclusive with vanilla Shiny Stone, but all function similarly) if (!Player.shinyStone && Player.StandingStill() && Player.velocity.Y == 0 && Player.itemAnimation == 0) { bool honeyDewWorking = honeyTurboRegen && Player.honeyWet; - bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || aAmpoule || purity; + bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || aAmpoule || purity; // Divides all negative life regen by two before applying any other effects. if (anyStandingStillLifeRegen && Player.lifeRegen < 0) @@ -759,8 +759,8 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += turboRegenPower; Player.lifeRegenTime += turboRegenPower; - purityRegen += turboRegenPower/2f; - if (!shadeRegen || cFreeze || purity) ambrosialAmpouleRegen += turboRegenPower/2f; + purityRegen += turboRegenPower / 2f; + if (!shadeRegen || cFreeze || purity) ambrosialAmpouleRegen += turboRegenPower / 2f; } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 662c14b0ac..a9a450e91a 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -254,12 +254,21 @@ namespace CalamityMod.CalPlayer foreach (Projectile p in Main.ActiveProjectiles) if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI && p.ai[1] == 0) numOfActiveWings++; - bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && !(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0; + bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && ((!(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0) || XykWingTimer >= 3); if (spawnWings) { - int wingCount = numOfActiveWings; - Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + if (XykWingTimer >= 3) + { + int wingCount = numOfActiveWings; + Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + if (numOfActiveWings + 1 == maxWingPieces) + XykWingTimer = 0; + } + else + XykWingTimer++; } + else + XykWingTimer = 0; } // First Frame dash effects @@ -293,16 +302,6 @@ namespace CalamityMod.CalPlayer Player.velocity.X *= 0.9f; } } - - if (Player.Calamity().statisNinjaBelt) - { - Player.Calamity().DashID = StatisNinjaBeltDash.ID; - } - if (Player.Calamity().statisVoidSash) - { - Player.Calamity().DashID = StatisVoidSashDash.ID; - } - if ((devilsDevastationKillMode || exaltedKillMode) && !Player.mount.Active) { float fxScale = 1; @@ -1296,8 +1295,6 @@ namespace CalamityMod.CalPlayer { if (!Player.wet) { - if (cirrusDress) - Player.maxFallSpeed = 12f; if (aeroSet) Player.maxFallSpeed = 15f; if (Player.PortalPhysicsEnabled) @@ -2300,8 +2297,6 @@ namespace CalamityMod.CalPlayer if (miningSetCooldown > 0) miningSetCooldown--; - if (RustyMedallionCooldown > 0) - RustyMedallionCooldown--; if (MiniSwarmerCooldown > 0) MiniSwarmerCooldown--; @@ -2516,9 +2511,6 @@ namespace CalamityMod.CalPlayer if (vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) Player.GetCritChance() += VampiricTalisman.RaiderBonus; - if (kamiBoost) - Player.GetDamage() += YanmeisKnife.DamageBoost; - if (avertorBonus) Player.GetDamage() += 0.1f; @@ -3521,11 +3513,8 @@ namespace CalamityMod.CalPlayer if (Player.chilled) Player.moveSpeed *= 1f + (1f / 6f); - if (cirrusDress) - Player.moveSpeed -= 0.2f; - - if (cirrusVodka) - Player.GetDamage() += CirrusVodka.DamageBoost; + if (purpleHaze) + Player.GetDamage() += PurpleHaze.DamageBoost; if (vodka) { @@ -3805,7 +3794,10 @@ namespace CalamityMod.CalPlayer } if (manaOverloader) - Player.GetDamage() += 0.06f; + { + float manaRatio = Player.statMana / (float)Player.statManaMax2; + Player.GetDamage() += MathHelper.Lerp(0.05f,0.15f,manaRatio); + } if (bloodyWormTooth) { @@ -4828,10 +4820,10 @@ namespace CalamityMod.CalPlayer // Multiplicative defense reductions. // These are done last because they need to be after the defense lower cap at 0. - if (cirrusVodka) + if (purpleHaze) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * CirrusVodka.DefenseLossPercent); + Player.statDefense -= (int)(Player.statDefense * PurpleHaze.DefenseLossPercent); } if (vodka) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index f91dcf823d..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; @@ -1402,9 +1401,9 @@ namespace CalamityMod.CalPlayer { if (manaOverloader) { - double healMult = 0.2; + double healMult = 0.1; healMult -= proj.numHits * healMult * 0.25; - int heal = (int)Math.Round(damage * healMult * (Player.statMana / (double)Player.statManaMax2)); + int heal = (int)Math.Round(damage * healMult); if (heal > BalancingConstants.LifeStealCap) heal = BalancingConstants.LifeStealCap; diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs index 9c0196c584..30bc2a144d 100644 --- a/CalPlayer/Dashes/StatisNinjaBeltDash.cs +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -17,7 +17,7 @@ namespace CalamityMod.CalPlayer.Dashes public int Time = 0; public int lastDashDir = 0; - public override float CalculateDashSpeed(Player player) => (50f * player.moveSpeed); + public override float CalculateDashSpeed(Player player) => (55f * player.moveSpeed); public override void OnDashEffects(Player player) { @@ -69,6 +69,17 @@ namespace CalamityMod.CalPlayer.Dashes dust2.fadeIn = 0.5f; player.velocity.X *= 0.93f; + + if (player.velocity.X > 140) + { + player.velocity.X = 140; + } + if (player.velocity.X < -140) + { + player.velocity.X = -140; + } + if (Time > 6) + player.velocity.X *= 0.5f; } } } diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index 35de1b7772..05cb3aaf9e 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -110,6 +110,16 @@ namespace CalamityMod.CalPlayer.Dashes } } player.velocity.X *= 0.912f; + if (player.velocity.X > 140) + { + player.velocity.X = 140; + } + if (player.velocity.X < -140) + { + player.velocity.X = -140; + } + if (Time > 8) + player.velocity.X *= 0.5f; } } } diff --git a/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs b/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs index d0c1cdcc9b..06a652df22 100644 --- a/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs +++ b/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs @@ -13,7 +13,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { Player drawPlayer = drawInfo.drawPlayer; CalamityPlayer modPlayer = drawPlayer.Calamity(); - return drawPlayer.mount != null && (modPlayer.fab || modPlayer.crysthamyr || modPlayer.onyxExcavator); + return drawPlayer.mount != null && (modPlayer.crysthamyr || modPlayer.onyxExcavator); } protected override void Draw(ref PlayerDrawSet drawInfo) diff --git a/CalPlayer/DrawLayers/WingsofRebirthLayer.cs b/CalPlayer/DrawLayers/WingsofRebirthLayer.cs new file mode 100644 index 0000000000..f4bd60bbb3 --- /dev/null +++ b/CalPlayer/DrawLayers/WingsofRebirthLayer.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Accessories.Wings; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class WingsofRebirthLayer : PlayerDrawLayer + { + public static Asset yharwingTexture; + + public override void Load() + { + yharwingTexture = ModContent.Request("CalamityMod/Items/Accessories/Wings/WingsofRebirth_Wings_Real"); + } + + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.Wings); + + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.drawPlayer.wings == EquipLoader.GetEquipSlot(Mod, "WingsofRebirth", EquipType.Wings); + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + + if (drawPlayer.dead) + return; + Texture2D texture = yharwingTexture.Value; + Vector2 Position = drawInfo.Position; + Vector2 pos = new Vector2((int)(Position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (2 * drawPlayer.direction)), (int)(Position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) - 2f * drawPlayer.gravDir)); + Color lightColor = Lighting.GetColor((int)drawPlayer.Center.X / 16, (int)drawPlayer.Center.Y / 16, Color.White); + Color color = lightColor * (1 - drawInfo.shadow); + DrawData d = new DrawData(texture, pos, texture.Frame(1, 9, 0, drawInfo.drawPlayer.wingFrame), color, 0f, new Vector2(texture.Width / 2, texture.Height / 18), 1f, drawInfo.playerEffect, 0); + d.shader = drawInfo.drawPlayer.cWings; + drawInfo.DrawDataCache.Add(d); + } + } +} \ No newline at end of file diff --git a/CalamityConditions.cs b/CalamityConditions.cs index 13b295e844..b402f2a872 100644 --- a/CalamityConditions.cs +++ b/CalamityConditions.cs @@ -23,13 +23,6 @@ namespace CalamityMod public static readonly Condition PlayerHasWings = Create("HasWings", () => Main.LocalPlayer.wingTimeMax > 0); public static readonly Condition PlayerAlcoholPoisoned = Create("AlcoholPoison", () => Main.LocalPlayer.Calamity().alcoholPoisoning); - // - // NPC conditions - // - - /// Don't use this. It's always `true`. - public static readonly Condition TrasherTextCondition = Create("Drops.TrasherKill", () => true); - // // Calamity Event Flag conditions // diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 82b26299a2..50d1ea2d39 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -64,6 +64,10 @@ namespace CalamityMod [DefaultValue(false)] public bool DisableGravityScreenSwap { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool TextEffects { get; set; } + [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool Afterimages { get; set; } @@ -262,8 +266,8 @@ namespace CalamityMod public float FlightBarPosY { get; set; } #endregion - #region Music Events - [Header("MusicEvents")] + #region Music Toggles + [Header("MusicToggles")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] @@ -281,6 +285,10 @@ namespace CalamityMod [DefaultValue(true)] public bool DevourerofGodsEulogy { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool AbyssLayer3Alt { get; set; } + #endregion #region General Gameplay Changes diff --git a/CalamityMod.cs b/CalamityMod.cs index 04444e41f5..6a5df844d4 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using CalamityMod.FluidSimulation; using CalamityMod.Items; +using CalamityMod.MainMenu; using CalamityMod.Particles; using CalamityMod.Projectiles; using Microsoft.Xna.Framework; @@ -19,10 +20,6 @@ namespace CalamityMod public class CalamityMod : Mod { #region External Flags - // External flag to disable non-Revengeance boss AI edits - // This can be edited by other mods using reflection to prevent compatibility issues - public static bool ExternalFlag_DisableNonRevBossAI = false; - // External flag to disable Defense Damage // This can be edited by other mods using reflection if desired // Note that this flag trumps Bloodflare Core and will stop that accessory from working properly. @@ -50,6 +47,12 @@ namespace CalamityMod Main.QueueMainThreadAction(() => Main.OnPreDraw += PrepareRenderTargets); } } + + public override void PostSetupContent() + { + // Force open certain ModMenus for various reasons and the added flair of "Hey! Something big has happened! Check it out!" + CalamityMainMenu_Sunken.ForceMenuStyle(); + } #endregion #region Unload diff --git a/DataStructures/SummonTag.cs b/DataStructures/SummonTag.cs new file mode 100644 index 0000000000..61c2540ab0 --- /dev/null +++ b/DataStructures/SummonTag.cs @@ -0,0 +1,184 @@ +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; + +namespace CalamityMod.DataStructures +{ + /// + /// This is used to store summon tag stats so they can be applied automatically. + /// + public class SummonTag + { + #region SummonTag data + /// + /// Flat tag damage from this summon tag + /// + public int FlatTagDamage = 0; + + /// + /// This is tag damage that isn't added to the tooltip. Used for removing Vanilla whip tag damage. + /// + public int UnlistedTagDamage = 0; + + /// + /// Multiplicative tag damage from this summon tag. Stacks additively with other tags. + /// + public float MultiplicativeTagDamage = 0; + + /// + /// This is tag damage that isn't added to the tooltip. Used for removing Firecracker whip damage. + /// + public float UnlistedMultiplicativeTagDamage = 0; + + /// + /// Tag critical strike chance from this stummon tag. Stacks additively with other tags. + /// + public float TagCritChance = 0; + + /// + /// How much the Critical Strike damage multiplier should be adjusted with this tag. Stacks additively with other tags. + /// + public float TagCritDamage = 0; + + /// + /// UNIMPLEMENTED. Need to add animation frame support before using. + /// What the texture for the tag effect should be. + /// + public Asset TagTexture; + + /// + /// What item inflicted this tag + /// + public int TagItem = -1; + + /// + /// The ModifyHitByProjectileTag code to run. Defaults to just applying the tag effects. + /// + public ModifyHitByProjectileTag TagModifyHitEffects; + + /// + /// Disable to stop tooltips from drawing automatically, for things that change TagModifyHitEffects + /// + public bool AutoDrawTooltip = true; + + /// + /// Setting to true allows this tag to be used alongside other tag effects. + /// + public bool AllowsWhipStacking = false; + + /// + /// The OnHitByProjectile code to run when this tag is applied. Defaults to nothing. + /// + public OnHitByProjectile TagOnHit = BlankOnHit; + public SummonTag() + { + TagModifyHitEffects = ApplyTagModifyHit; + } + + public SummonTag(int itemType) + { + TagItem = itemType; + TagModifyHitEffects = ApplyTagModifyHit; + } + + /// + /// A modified version of ModifyHitByProjectile that incorporates tag damage multipliers and tag critical chance. + /// This delegate is used for TagModifyHitEffects + /// + /// + /// + /// + /// + /// + public delegate void ModifyHitByProjectileTag(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance); + + /// + /// This delegate is used for TagOnHit + /// + /// + /// + /// + /// + public delegate void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone); + + /// + /// The default tag damage functionality + /// + public void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + modifiers.FlatBonusDamage += (FlatTagDamage + UnlistedTagDamage) * tagDamageMult; + modifiers.ScalingBonusDamage += (MultiplicativeTagDamage + UnlistedMultiplicativeTagDamage) * tagDamageMult; + critChance += TagCritChance; + modifiers.CritDamage += TagCritDamage; + } + /// + /// Due to how Firecracker works, this allows it to work with crit accessories. + /// + public static void FirecrackerModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + modifiers.ScalingBonusDamage += (Firecracker.MultiplicativeTagDamage + Firecracker.UnlistedMultiplicativeTagDamage) * tagDamageMult; + modifiers.CritDamage += Firecracker.TagCritDamage; + } + /// + /// This is replaced by custom tag on hit effects. Does nothing. + /// + public static void BlankOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { } + #endregion + + #region Vanilla whip stats + public static SummonTag LeatherWhip = new SummonTag(ItemID.BlandWhip) + { + FlatTagDamage = 4, + UnlistedTagDamage = -4 //Negative value cancels out vanilla tag damage + }; + public static SummonTag Snapthorn = new SummonTag(ItemID.ThornWhip) + { + FlatTagDamage = 4, + UnlistedTagDamage = -6 //Negative value cancels out vanilla tag damage + }; + public static SummonTag SpinalTap = new SummonTag(ItemID.BoneWhip) + { + FlatTagDamage = 5, + UnlistedTagDamage = -7 //Negative value cancels out vanilla tag damage + }; + public static SummonTag Firecracker = new SummonTag(ItemID.FireWhip) + { + MultiplicativeTagDamage = 1f, + TagCritDamage = -1f, + TagModifyHitEffects = FirecrackerModifyHit, + UnlistedMultiplicativeTagDamage = -1.75f, //Cancels out the vanilla firecracker tag damage + AutoDrawTooltip = false + }; + public static SummonTag CoolWhip = new SummonTag(ItemID.CoolWhip) + { + FlatTagDamage = 8, + UnlistedTagDamage = -6 //Negative value cancels out vanilla tag damage + }; + public static SummonTag Durendal = new SummonTag(ItemID.SwordWhip) + { + FlatTagDamage = 5, + TagCritChance = 0.05f, + UnlistedTagDamage = -9 //Negative value cancels out vanilla tag damage + }; + public static SummonTag MorningStar = new SummonTag(ItemID.MaceWhip) + { + TagCritChance = 0.13f, + UnlistedTagDamage = -8 //Negative value cancels out vanilla tag damage + }; + public static SummonTag DarkHarvest = new SummonTag(ItemID.ScytheWhip) + { + FlatTagDamage = 14, + UnlistedTagDamage = -10, //Negative value cancels out vanilla tag damage + //This has a unique on hit effect from vanilla. + }; + public static SummonTag Kaleidoscope = new SummonTag(ItemID.RainbowWhip) + { + FlatTagDamage = 10, + TagCritChance = 0.10f, + UnlistedTagDamage = -20 //Negative value cancels out vanilla tag damage + }; + #endregion + } +} diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 1b283d531c..9325d64cfd 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Effects internal static Effect AstralFogShader; // - // All below shaders created by Dominic Karma + // All below shaders created by Lucille Karma // - #region Dominic's Shaders + #region Lucille's Shaders // The Dance of Light's Blinding Light internal static Effect DanceOfLightBlindingShader; @@ -50,7 +50,7 @@ namespace CalamityMod.Effects // Generic solid trail shader. Used by many things? internal static Effect FadingSolidTrailShader; - // Scarlet Devil main spear glowing trail. BEWARE: Is reused by many other items! + // Typical projectile javelin glowing trail. BEWARE: Is used by many items! internal static Effect ScarletDevilShader; // Yharon border flame pillar trail. @@ -92,7 +92,7 @@ namespace CalamityMod.Effects // Was previously used by Dom's Bladecrest Oathsword. Appears to govern the swing animation. internal static Effect LocalLinearTransformationShader; - // UNUSED -- Probably leftover from Dominic's experiments with applying shaders to primitives (arbitrary GPU-rendered triangles) + // UNUSED -- Probably leftover from Lucille's experiments with applying shaders to primitives (arbitrary GPU-rendered triangles) internal static Effect BasicPrimitiveShader; // Artemis Ohio Beam. Also used by get fixed boi Nuclear Terror's "G-FUEL BEAM" @@ -145,6 +145,12 @@ namespace CalamityMod.Effects // Used to render the results of Navier-Stokes fluid simulations. internal static Effect FluidShaders; + + // Used by projectiles fired by the Sylvestaff. + internal static Effect SylvestaffProjectileShader; + + // Used by the ribbons on the Sylvestaff. + internal static Effect SylvestaffRibbonShader; #endregion // @@ -216,6 +222,9 @@ namespace CalamityMod.Effects #region fryzahh's Shaders // A simple shader which distorts an image using a provided texture of choice. internal static Effect BasicTextureDistortionShader; + + // The underwater rays seen at the top of the Sunken Sea Mod Menu. + internal static Effect UnderwaterRaysShader; #endregion public override void PostSetupContent() @@ -234,7 +243,7 @@ namespace CalamityMod.Effects var astralPassReg = new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f); RegisterSceneFilter(astralPassReg, "Astral", EffectPriority.VeryHigh); - #region Loading Dominic's Shaders + #region Loading Lucille's Shaders DanceOfLightBlindingShader = LoadShader("LightBurstShader"); RegisterScreenShader(DanceOfLightBlindingShader, "BurstPass", "LightBurst"); @@ -357,6 +366,12 @@ namespace CalamityMod.Effects // This shader is not registered with the game but is invoked directly to render the results of fluid simulation. FluidShaders = LoadShader("FluidShaders"); + + SylvestaffProjectileShader = LoadShader("SylvestaffProjectileShader"); + RegisterMiscShader(SylvestaffProjectileShader, "TrailPass", "SylvestaffProjectile"); + + SylvestaffRibbonShader = LoadShader("SylvestaffRibbonShader"); + RegisterMiscShader(SylvestaffRibbonShader, "AutoloadPass", "SylvestaffRibbon"); #endregion #region Loading Iban's Shaders @@ -429,6 +444,9 @@ namespace CalamityMod.Effects #region Loading fryzahh's Shaders BasicTextureDistortionShader = LoadShader("BasicTextureDistortionShader"); RegisterMiscShader(BasicTextureDistortionShader, "DistortionPass", "BasicTextureDistortion"); + + UnderwaterRaysShader = LoadShader("UnderwaterRaysShader"); + RegisterMiscShader(UnderwaterRaysShader, "UnderwaterRayPass", "UnderwaterRays"); #endregion } diff --git a/Effects/SylvestaffProjectileShader.fx b/Effects/SylvestaffProjectileShader.fx new file mode 100644 index 0000000000..728a0f6a9a --- /dev/null +++ b/Effects/SylvestaffProjectileShader.fx @@ -0,0 +1,76 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Account for texture distortion artifacts. + coords.y = (coords.y - 0.5) / input.TextureCoordinates.z + 0.5; + + float bump = sin(coords.y * 3.141); + + // Calculate the amount of additive glow for this pixel, using a combination of a scrolling texture and an extreme + // exponential squash of the prior 0-1-0 bump, creating a "center" to the glow and ensuring that the + // ray doesn't look like just a scrolling gradient. + float streakColor = tex2D(uImage1, coords + float2(uTime * -2.75, 0)); + float glow = streakColor.r + pow(bump, 20) * 0.4; + + // Determine opacity based on a weaker exponential squash of the bump in order to create faded horizontal edges. + float opacity = pow(bump, 5); + + // Apply glow. + opacity += glow * opacity; + + return color * opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/SylvestaffProjectileShader.xnb b/Effects/SylvestaffProjectileShader.xnb new file mode 100644 index 0000000000..06bc3ffb44 Binary files /dev/null and b/Effects/SylvestaffProjectileShader.xnb differ diff --git a/Effects/SylvestaffRibbonShader.fx b/Effects/SylvestaffRibbonShader.fx new file mode 100644 index 0000000000..3474df6d49 --- /dev/null +++ b/Effects/SylvestaffRibbonShader.fx @@ -0,0 +1,89 @@ +sampler noiseTextureA : register(s1); + +float pixelationFactor; +float uSaturation; +float4 uShaderSpecificData; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float QuadraticBump(float x) +{ + return x * (4 - x * 4); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = 1; + float2 coords = input.TextureCoordinates; + coords.y = (coords.y - 0.5) / input.TextureCoordinates.z + 0.5; + + float feelerColorStart = 0.61; + float colorSpacingFactor = 1.9; + float4 outlineColor = float4(91, 114, 119, 255) / 255; + + float erasePixelInterpolant = coords.x - 0.9 - distance(coords.y, 0.5) * 0.1; + + // Band 1: Outline color. + color = lerp(color, outlineColor, coords.x >= feelerColorStart); + + // Band 2: Pink. + float pinkStart = feelerColorStart + colorSpacingFactor * 0.01; + color = lerp(color, float4(221, 150, 179, 255) / 255, coords.x >= pinkStart); + + // Band 3: Outline color. + float outlineAStart = pinkStart + colorSpacingFactor * 0.04; + color = lerp(color, outlineColor, coords.x >= outlineAStart); + + // Band 4: Blue. + float blueStart = outlineAStart + colorSpacingFactor * 0.01; + color = lerp(color, float4(48, 117, 222, 255) / 255, coords.x >= blueStart); + + // Band 5: Baby blue. + float babyBlueStart = blueStart + colorSpacingFactor * 0.04; + color = lerp(color, float4(167, 222, 255, 255) / 255, coords.x >= babyBlueStart); + + // Add an outline to the ends of the feeler. + float horizontalDistanceFromCenter = distance(coords.y, 0.5); + color = lerp(color, outlineColor, horizontalDistanceFromCenter >= 0.3); + color = lerp(color, outlineColor, erasePixelInterpolant >= -0.02); + + float permittedDirection = sign(uSaturation); + float direction = sign(dot(input.Position.xy - uShaderSpecificData.xy, uShaderSpecificData.zw)); + erasePixelInterpolant *= direction == permittedDirection || coords.x < 0.5; + + return color * (erasePixelInterpolant < 0) * input.Color; +} + +technique Technique1 +{ + pass AutoloadPass + { + VertexShader = compile vs_3_0 VertexShaderFunction(); + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} diff --git a/Effects/SylvestaffRibbonShader.xnb b/Effects/SylvestaffRibbonShader.xnb new file mode 100644 index 0000000000..d6848767d4 Binary files /dev/null and b/Effects/SylvestaffRibbonShader.xnb differ diff --git a/Effects/UnderwaterRaysShader.fx b/Effects/UnderwaterRaysShader.fx new file mode 100644 index 0000000000..652afbcca4 --- /dev/null +++ b/Effects/UnderwaterRaysShader.fx @@ -0,0 +1,48 @@ +sampler baseTexture : register(s0); + +float time; +float fadeOutMargin; +float overallOpacity; +float pixelationAmount; +float scrollSpeedX; +float scrollSpeedY; +float2 noiseScale; +float3 rayColor; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // Pixelation. + coords = round(coords * pixelationAmount) / pixelationAmount; + + // Distort the coords into a sine wave. + coords.y += sin(coords.x + time * 0.25) * 0.05; + + // Get the correct scale for our two noise maps. + float2 scaledCoords = coords * noiseScale; + + // Calculate the offsets for each noise map. + float2 noiseOffset1 = float2(time * scrollSpeedX, time * scrollSpeedY); + float2 noiseOffset2 = float2(time * -scrollSpeedX, time * -scrollSpeedY); + + // Calculate the colors of the two noise maps. + float4 noiseTexture1 = tex2D(baseTexture, scaledCoords + noiseOffset1); + float4 noiseTexture2 = tex2D(baseTexture, scaledCoords + noiseOffset2); + + // Add the noise maps together to layer them over each other. + // Ensure to add them at 50% intensity to avoid making a super bright effect. + float combinedNoise = (noiseTexture1.r * 0.5) + (noiseTexture2.r * 0.5); + + // Fade out at a certain margin. + float opacity = (1 - (coords.y * 2 - fadeOutMargin)); + + return (float4(rayColor, 1) * combinedNoise * opacity) * overallOpacity; + +} + +technique Technique1 +{ + pass UnderwaterRayPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/UnderwaterRaysShader.xnb b/Effects/UnderwaterRaysShader.xnb new file mode 100644 index 0000000000..9faf1094f5 Binary files /dev/null and b/Effects/UnderwaterRaysShader.xnb differ diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 5963ba605b..fbe6d72f3a 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -243,7 +243,6 @@ namespace CalamityMod.Events if (inNaturalSeaPosition && player.Calamity().ZoneSulphur) { // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) - // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! HasStartedAcidicDownpour = true; CalamityNetcode.SyncWorld(); break; diff --git a/ExtraTextures/BloomCirclePinpoint.png b/ExtraTextures/BloomCirclePinpoint.png new file mode 100644 index 0000000000..49c2dcdb60 Binary files /dev/null and b/ExtraTextures/BloomCirclePinpoint.png differ diff --git a/ExtraTextures/Trails/FabstaffStreak.png b/ExtraTextures/Trails/SylvestaffStreak.png similarity index 100% rename from ExtraTextures/Trails/FabstaffStreak.png rename to ExtraTextures/Trails/SylvestaffStreak.png diff --git a/ExtraTextures/UI/CrystalTextGlow.png b/ExtraTextures/UI/CrystalTextGlow.png new file mode 100644 index 0000000000..e4dd498b65 Binary files /dev/null and b/ExtraTextures/UI/CrystalTextGlow.png differ diff --git a/ExtraTextures/UI/CrystalTextSparkle.png b/ExtraTextures/UI/CrystalTextSparkle.png new file mode 100644 index 0000000000..7703b63a83 Binary files /dev/null and b/ExtraTextures/UI/CrystalTextSparkle.png differ diff --git a/ExtraTextures/UI/Glint.png b/ExtraTextures/UI/Glint.png new file mode 100644 index 0000000000..9d0ed2aebd Binary files /dev/null and b/ExtraTextures/UI/Glint.png differ diff --git a/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs b/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs index 59631603b2..8a5ce7ae63 100644 --- a/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs +++ b/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs @@ -12,6 +12,14 @@ using Terraria.ModLoader; namespace CalamityMod.ForegroundDrawing.LoopingTextures { + public class NuclearTorrentPlayer : ModPlayer + { + public bool ShouldDisplayTorrentMonolith = false; + public override void ResetEffects() + { + ShouldDisplayTorrentMonolith = false; + } + } public class NuclearTorrentForeground : LoopingTextureForeground { public override Vector2 ParallaxDepth => new Vector2(1f, 1f); @@ -59,7 +67,9 @@ namespace CalamityMod.ForegroundDrawing.LoopingTextures Raindrops.Remove(drop); } - public override bool DoesThisShow() => NPC.CountNPCS(ModContent.NPCType()) > 0 && Main.LocalPlayer.Calamity().ZoneSulphur && !CalamityServerConfig.Instance.BossesStopWeather; + public bool ShouldDisplayDuringOldDuke() => NPC.CountNPCS(ModContent.NPCType()) > 0 && Main.LocalPlayer.Calamity().ZoneSulphur && !CalamityServerConfig.Instance.BossesStopWeather; + + public override bool DoesThisShow() => ShouldDisplayDuringOldDuke() || Main.LocalPlayer.GetModPlayer().ShouldDisplayTorrentMonolith; public override void Update() { diff --git a/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs b/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs index 7270d3e93a..14edbcb506 100644 --- a/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs +++ b/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs @@ -15,6 +15,6 @@ namespace CalamityMod.Graphics.Primitives /// /// Render primitives that use pixelation here. /// - void RenderPixelatedPrimitives(SpriteBatch spriteBatch); + void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer); } } diff --git a/Graphics/Primitives/PixelationPrimitiveLayer.cs b/Graphics/Primitives/PixelationPrimitiveLayer.cs index 1ed0348bc8..4f05c51ef2 100644 --- a/Graphics/Primitives/PixelationPrimitiveLayer.cs +++ b/Graphics/Primitives/PixelationPrimitiveLayer.cs @@ -1,15 +1,17 @@ -using Microsoft.Xna.Framework.Graphics; +using System; namespace CalamityMod.Graphics.Primitives { /// /// Controls what layer the renders to. /// + [Flags] public enum PixelationPrimitiveLayer { - BeforeNPCs, - AfterNPCs, - BeforeProjectiles, - AfterProjectiles + BeforeNPCs = 1, + AfterNPCs = 2, + BeforeProjectiles = 4, + AfterProjectiles = 8, + AfterPlayers = 16 } } diff --git a/Graphics/Primitives/PrimitivePixelationSystem.cs b/Graphics/Primitives/PrimitivePixelationSystem.cs index 19d5fb1b5c..4d2bc635de 100644 --- a/Graphics/Primitives/PrimitivePixelationSystem.cs +++ b/Graphics/Primitives/PrimitivePixelationSystem.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Graphics.Primitives private static ManagedRenderTarget PixelationTarget_AfterProjectiles; + private static ManagedRenderTarget PixelationTarget_AfterPlayers; + private static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.instance.GraphicsDevice, width / 2, height / 2); /// @@ -36,11 +38,13 @@ namespace CalamityMod.Graphics.Primitives On_Main.CheckMonoliths += DrawToTargets; On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs; On_Main.DrawProjectiles += DrawTarget_Projectiles; + On_Main.DrawPlayers_AfterProjectiles += DrawTarget_Players; 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); } public override void Unload() @@ -63,6 +67,7 @@ namespace CalamityMod.Graphics.Primitives var afterNPCs = new List(); var beforeProjectiles = new List(); var afterProjectiles = new List(); + var afterPlayers = new List(); // Check every active projectile. foreach (Projectile projectile in Main.ActiveProjectiles) @@ -70,14 +75,14 @@ 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) { - var listToUse = pixelPrimitiveProjectile.LayerToRenderTo switch - { - PixelationPrimitiveLayer.BeforeNPCs => beforeNPCs, - PixelationPrimitiveLayer.AfterNPCs => afterNPCs, - PixelationPrimitiveLayer.BeforeProjectiles => beforeProjectiles, - _ => afterProjectiles - }; - listToUse.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs)) + beforeNPCs.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs)) + afterNPCs.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles)) + beforeProjectiles.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers)) + afterPlayers.Add(pixelPrimitiveProjectile); } } @@ -87,23 +92,24 @@ 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) { - var listToUse = pixelPrimitiveNPC.LayerToRenderTo switch - { - PixelationPrimitiveLayer.BeforeNPCs => beforeNPCs, - PixelationPrimitiveLayer.AfterNPCs => afterNPCs, - PixelationPrimitiveLayer.BeforeProjectiles => beforeProjectiles, - _ => afterProjectiles - }; - listToUse.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs)) + beforeNPCs.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs)) + afterNPCs.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles)) + beforeProjectiles.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers)) + afterPlayers.Add(pixelPrimitiveNPC); } } CurrentlyRendering = true; - DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, beforeNPCs); - DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, afterNPCs); - DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, beforeProjectiles); - DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, afterProjectiles); + 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); Main.instance.GraphicsDevice.SetRenderTarget(null); @@ -111,7 +117,7 @@ namespace CalamityMod.Graphics.Primitives orig(); } - private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, List pixelPrimitives) + private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, PixelationPrimitiveLayer 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(); @@ -121,7 +127,7 @@ namespace CalamityMod.Graphics.Primitives Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null); foreach (var pixelPrimitiveDrawer in pixelPrimitives) - pixelPrimitiveDrawer.RenderPixelatedPrimitives(Main.spriteBatch); + pixelPrimitiveDrawer.RenderPixelatedPrimitives(Main.spriteBatch, layer); Main.spriteBatch.End(); } @@ -143,6 +149,12 @@ namespace CalamityMod.Graphics.Primitives 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); diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index fcf29214a6..e8dd980253 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -213,7 +213,7 @@ namespace CalamityMod.ILEditing On_Player.ItemCheck_CheckCanUse += RemoveUseLocks; On_Player.ItemCheck_UseEventItems += ApplyCelestialSigilChanges; IL_Main.DrawInfoAccs += RemoveDamageConditionFromRadar; - On_ShopHelper.ApplyNpcRelationshipEffect += AllowMultipleLikedNPCs; + //On_ShopHelper.ApplyNpcRelationshipEffect += AllowMultipleLikedNPCs; On_Player.UpdateControlHolds += DelayGravity; On_PlayerInput.SetZoom_MouseInWorld += GravityMouse; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 8a2646cc41..ac861e5df4 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -1764,27 +1764,8 @@ namespace CalamityMod.ILEditing #region Shimmer effect edits public static void ShimmerEffectEdits(Terraria.On_Item.orig_GetShimmered orig, Item self) { - // Don't keep the original stack amount when shimmering Cirrus' Vodka into Crystal Heart Vodka - if (self.type == ModContent.ItemType()) - { - self.SetDefaults(ModContent.ItemType()); - self.shimmered = true; - self.shimmerWet = true; - self.wet = true; - self.velocity *= 0.1f; - if (Main.netMode == 0) - { - Item.ShimmerEffect(self.Center); - } - else - { - NetMessage.SendData(146, -1, -1, null, 0, (int)self.Center.X, (int)self.Center.Y); - NetMessage.SendData(145, -1, -1, null, self.whoAmI, 1f); - } - AchievementsHelper.NotifyProgressionEvent(27); - } // Make Plagued Containment Bricks turn into Plagued Nanodroids if shimmered before defeating Golem - else if (self.type == ModContent.ItemType()) + if (self.type == ModContent.ItemType()) { if (NPC.downedGolemBoss) orig(self); diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index a7c1ac0020..80c15173f8 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -174,7 +174,7 @@ namespace CalamityMod.ILEditing } // Remove the Expert Mode check, and in its place put a check for the Zenith seed (Get fixed boi). - // Note from CIT: I originally removed these entirely; restoring it in GFB was Fabsol's idea. + // Note from CIT: I originally removed these entirely; cursor.Emit(OpCodes.Pop); cursor.Emit(OpCodes.Ldsfld, typeof(Main).GetField("zenithWorld")); } @@ -1153,14 +1153,17 @@ namespace CalamityMod.ILEditing } #endregion - #region Multiple NPC Happiness support for Cirrus - private static void AllowMultipleLikedNPCs(On_ShopHelper.orig_ApplyNpcRelationshipEffect orig, ShopHelper self, int npcType, AffectionLevel affectionLevel) + #region Multiple NPC Happiness support + // Currently unused as the one NPC who used it was removed. However it is very likely it'll be used again in the future, so this code is being kept. + /*private static void AllowMultipleLikedNPCs(On_ShopHelper.orig_ApplyNpcRelationshipEffect orig, ShopHelper self, int npcType, AffectionLevel affectionLevel) { FieldInfo npcTalkField = typeof(ShopHelper).GetField("_currentNPCBeingTalkedTo", BindingFlags.Instance | BindingFlags.NonPublic); NPC talkedNPC = (NPC)npcTalkField.GetValue(self); - // Allow Cirrus to have things to say about multiple NPCs with the same happiness level - if (talkedNPC.type == ModContent.NPCType()) + int npcTypee = 0; + + // Allow the given NPC to have things to say about multiple NPCs with the same happiness level + if (talkedNPC.type == npcTypee) { MethodInfo addReportField = typeof(ShopHelper).GetMethod("AddHappinessReportText", BindingFlags.Instance | BindingFlags.NonPublic); @@ -1182,7 +1185,7 @@ namespace CalamityMod.ILEditing { orig(self, npcType, affectionLevel); } - } + }*/ #endregion #region Allow disabling gravity swap visual && allow gravity keybind diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 6ada54ffe2..8e71f92a39 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 12; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/AuricSoulArtifact.cs b/Items/Accessories/AuricSoulArtifact.cs index 794f987a70..ae34ce45ab 100644 --- a/Items/Accessories/AuricSoulArtifact.cs +++ b/Items/Accessories/AuricSoulArtifact.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 28; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 3499c1c552..e192f93b37 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 44; Item.height = 108; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index 9a72bf77c4..60bd140a45 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories Item.width = Item.height = 32; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index ab510a8525..361bf550d6 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories Item.defense = 10; Item.lifeRegen = 1; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 434063f4be..426a874351 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 28; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index 356c9384cb..8825c99c92 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.defense = 48; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 766939ee78..cd5f548400 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.width = 32; Item.height = 34; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 056d43cdfc..ac0edf72ef 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.width = 30; Item.height = 46; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index d28518d7fb..325a79a392 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.height = 38; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 84cb1fa4bb..5179e46fcb 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index f37b4fbf5f..d2137c38ed 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Accessories Item.height = 46; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index fe23201469..103e179a93 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.height = 14; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 229c3e33fe..1f3dfd4288 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories Item.height = 52; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 60b9a16ca6..d5d4f8a7f0 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories Item.width = 82; Item.height = 62; Item.defense = 5; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.SetRevExclusive(); diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 5bd2fdf625..045939782c 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 546e685553..a62a6fa4f7 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -6,6 +6,8 @@ using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Items.Materials; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -14,6 +16,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -31,6 +34,26 @@ namespace CalamityMod.Items.Accessories public const int maxMinionRequirement = 10; public const int maxPscAnimTime = 120; + public static SummonTag SummonTag = new() { MultiplicativeTagDamage = 0.2f, TagModifyHitEffects = ApplyTagModifyHit, AutoDrawTooltip = false }; + + public static void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + if (Main.player[proj.owner].Calamity().pscState >= (int)ProfanedSoulCrystalState.Buffs) + { + var empowered = Main.player[proj.owner].Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered; + //20% is balanced for non empowered, while 40% helps ensure psc remains balanced at empowered tier + //Some PSC projectiles receive a reduced amount of benefit from this, for balancing purposes + modifiers.ScalingBonusDamage += (empowered ? 0.4f : SummonTag.MultiplicativeTagDamage) * tagDamageMult; + if (!Main.dedServ) + { + var color = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0); + float power = Math.Min(npc.height / 100f, 3f); + var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); + var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); + GeneralParticleHandler.SpawnParticle(particle); + } + } + } // Interface stuff. public int OwnerPlayer { get; set; } @@ -192,6 +215,8 @@ namespace CalamityMod.Items.Accessories public override void SetDefaults() { + SummonTag.TagItem = Item.type; + SummonTag.TagTexture = TextureAssets.Item[Type]; Item.width = 50; Item.height = 50; Item.accessory = true; diff --git a/Items/Accessories/Radiance.cs b/Items/Accessories/Radiance.cs index 355fd413a3..5389af0bc6 100644 --- a/Items/Accessories/Radiance.cs +++ b/Items/Accessories/Radiance.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories Item.defense = 8; Item.accessory = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 2ac41f439d..9e98211a44 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 12; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) 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/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 743bc9b28d..062c5d0a14 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index d91883d50b..4755aa2218 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Accessories Item.height = 34; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index 7aeffc057c..5d819c8cc9 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -109,6 +109,10 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { + var ThankYouTooltip = list.FirstOrDefault(x => x.Name == "Tooltip2" && x.Mod == "Terraria"); + if (ThankYouTooltip != null) + ThankYouTooltip.OverrideColor = Main.DiscoColor; + float power = CalculatePower(); string statList = this.GetLocalization("StatsList").Format( (DamageMultiplier * power * 100).ToString("N1"), diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index 6b7a9e6cae..92895e1f74 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Items.Accessories Item.height = 20; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs deleted file mode 100644 index 4067719941..0000000000 --- a/Items/Accessories/Vanity/CrystalHeartVodka.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories.Vanity -{ - public class CrystalHeartVodka : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Legs", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Back", EquipType.Back, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } - - public override void SetDefaults() - { - Item.width = 22; - Item.height = 30; - Item.accessory = true; - - // Same as Cirrus' Vodka, due to the obtainment method being shimmering Cirrus' Vodka. - Item.value = Item.sellPrice(silver: 30); - Item.rare = ItemRarityID.LightRed; - - Item.vanity = true; - Item.Calamity().devItem = true; - } - - public override void UpdateVanity(Player player) - { - player.GetModPlayer().vanityEquipped = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - player.GetModPlayer().vanityEquipped = true; - } - } - - public class CrystalHeartVodkaPlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); - Player.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); - - //Player.HideAccessories(); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } - } -} diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.png b/Items/Accessories/Vanity/CrystalHeartVodka.png deleted file mode 100644 index d0faf45977..0000000000 Binary files a/Items/Accessories/Vanity/CrystalHeartVodka.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Back.png b/Items/Accessories/Vanity/Fabsol_Back.png deleted file mode 100644 index 1563280bdc..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Back.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Body.png b/Items/Accessories/Vanity/Fabsol_Body.png deleted file mode 100644 index d98fdec79c..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Body.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Head.png b/Items/Accessories/Vanity/Fabsol_Head.png deleted file mode 100644 index bf96b48a95..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Legs.png b/Items/Accessories/Vanity/Fabsol_Legs.png deleted file mode 100644 index 1156798b60..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Legs.png and /dev/null differ diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 7df7a6b928..0ebe73db84 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Items.Accessories.Vanity EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this); } } - public override void SetStaticDefaults() { if (Main.dedServ) @@ -44,17 +43,15 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 36; Item.height = 34; Item.accessory = true; - Item.consumable = true; Item.vanity = true; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) + public override void RightClick(Player player) { - itemLoot.Add(ModContent.ItemType()); + player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); } public override void UpdateVanity(Player player) { diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index 29f2d69f89..9e20a49940 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -44,17 +44,15 @@ namespace CalamityMod.Items.Accessories.Vanity Item.width = 36; Item.height = 34; Item.accessory = true; - Item.consumable = true; Item.vanity = true; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) + public override void RightClick(Player player) { - itemLoot.Add(ModContent.ItemType()); + player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); } public override void UpdateVanity(Player player) { diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 6be445c5ee..f1e3766be8 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Item.width = 50; Item.height = 58; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs deleted file mode 100644 index fb3855fe8d..0000000000 --- a/Items/Accessories/Wings/DrewsWings.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories.Wings -{ - [AutoloadEquip(EquipType.Wings)] - public class DrewsWings : BaseWings - { - public override float BonusAscentWhileFalling => 1f; - public override float BonusAscentWhileRising => 0.17f; - public override float RisingSpeedThreshold => 1.2f; - public override float MaxAscentSpeed => 3.25f; - public override float BaseAscent => 0.15f; - - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(361, 11.5f, 2.9f); - - public override void SetDefaults() - { - base.SetDefaults(); - Item.width = 22; - Item.height = 20; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int dustXOffset = 4; - if (player.direction == 1) - { - dustXOffset = -40; - } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.GemDiamond, 0f, 0f, 100, default, 2.4f); - Main.dust[flightDust].noGravity = true; - Main.dust[flightDust].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[flightDust].fadeIn = 2f; - } - Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - } - } -} diff --git a/Items/Accessories/Wings/DrewsWings.png b/Items/Accessories/Wings/DrewsWings.png deleted file mode 100644 index bd8707e1c3..0000000000 Binary files a/Items/Accessories/Wings/DrewsWings.png and /dev/null differ diff --git a/Items/Accessories/Wings/DrewsWings_Wings.png b/Items/Accessories/Wings/DrewsWings_Wings.png deleted file mode 100644 index 131487a6d7..0000000000 Binary files a/Items/Accessories/Wings/DrewsWings_Wings.png and /dev/null differ diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index fde8d8345e..8efb22fb23 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index 918a418280..f203b59f54 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index 2c42494f78..1e27c261a9 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -68,7 +68,7 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(5). AddTile(). Register(); diff --git a/Items/Accessories/Wings/WingsofRebirth.cs b/Items/Accessories/Wings/WingsofRebirth.cs new file mode 100644 index 0000000000..8f372bc6ba --- /dev/null +++ b/Items/Accessories/Wings/WingsofRebirth.cs @@ -0,0 +1,92 @@ +using CalamityMod.Dusts; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Wings +{ + // The equip sprite is actually blank as a custom draw layer is used to draw the real sprites without any base sprites conflicting + [LegacyName("DrewsWings")] + [AutoloadEquip(EquipType.Wings)] + public class WingsofRebirth : BaseWings + { + public override float BonusAscentWhileFalling => 1f; + public override float BonusAscentWhileRising => 0.17f; + public override float RisingSpeedThreshold => 1.2f; + public override float MaxAscentSpeed => 3.25f; + public override float BaseAscent => 0.15f; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(360, 11.5f, 2.9f); + + public override void SetDefaults() + { + base.SetDefaults(); + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ModContent.RarityType(); + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int dustXOffset = 4; + if (player.direction == 1) + { + dustXOffset = -40; + } + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2.4f); + Main.dust[flightDust].noGravity = true; + Main.dust[flightDust].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[flightDust].fadeIn = 2f; + } + Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + } + + public override bool WingUpdate(Player player, bool inUse) + { + if (player.controlJump && player.wingTime > 0 && player.velocity.Y != 0) + { + int frameRate = 5; // FPS + int maxFrames = 9; // Total frames + player.wingFrameCounter++; + // Start flight animation with frame 7 + if (player.wingFrame == 0) + { + player.wingFrame = 7; + } + // Reset frames + if (player.wingFrame >= maxFrames) + { + player.wingFrameCounter = 0; + player.wingFrame = 1; + } + // Animation + if (player.wingFrameCounter % frameRate == 0) + { + player.wingFrame++; + } + } + else + { + player.wingFrameCounter = 0; + player.wingFrame = 0; // On ground + if (player.velocity.Y != 0) + { + player.wingFrame = 2; // Falling + if (player.controlJump && player.velocity.Y > 0) + player.wingFrame = 1; // Gliding + } + } + return true; + } + } +} diff --git a/Items/Accessories/Wings/WingsofRebirth.png b/Items/Accessories/Wings/WingsofRebirth.png new file mode 100644 index 0000000000..ee575d23ab Binary files /dev/null and b/Items/Accessories/Wings/WingsofRebirth.png differ diff --git a/Items/Accessories/Wings/WingsofRebirth_Wings.png b/Items/Accessories/Wings/WingsofRebirth_Wings.png new file mode 100644 index 0000000000..08ddcaa27a Binary files /dev/null and b/Items/Accessories/Wings/WingsofRebirth_Wings.png differ diff --git a/Items/Accessories/Wings/WingsofRebirth_Wings_Real.png b/Items/Accessories/Wings/WingsofRebirth_Wings_Real.png new file mode 100644 index 0000000000..df66a0fb83 Binary files /dev/null and b/Items/Accessories/Wings/WingsofRebirth_Wings_Real.png differ diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 700c009808..7f541ea531 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Accessories Item.defense = 15; // Why did this give 30 defense? This thing really needs a rework lol Item.accessory = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/AlicornonaStick.png b/Items/AlicornonaStick.png deleted file mode 100644 index b09e99c934..0000000000 Binary files a/Items/AlicornonaStick.png and /dev/null differ diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index e12165c861..e815c4d747 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 10f; Item.value = Item.buyPrice(gold: 1); // Sold by Archmage - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0f; diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index 8b25b3ab3b..7c2e134d17 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 3f; Item.value = Item.sellPrice(copper: 28); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; Item.ammo = ItemID.MusketBall; diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index ea06605ea6..e530952681 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Ammo Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.1f; Item.ammo = AmmoID.Arrow; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index f3b1a5205e..f35231fbaf 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 34; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 48; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaCuisses.cs b/Items/Armor/Auric/AuricTeslaCuisses.cs index 267e888e12..fc02b0dc0e 100644 --- a/Items/Armor/Auric/AuricTeslaCuisses.cs +++ b/Items/Armor/Auric/AuricTeslaCuisses.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 44; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs index 70979a5a03..061585b631 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 40; //132 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs index 9be81d8673..e7bc207d37 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaPlumedHelm.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 34; //132 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs index 9a66c641ab..ce0b3e9aae 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaRoyalHelm.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 54; //132 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs index cc8ea6a873..b15fc1f6fd 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 12; //132 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs index 0f8e4acdbb..aa367ba49a 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Armor.Auric Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.defense = 24; //132 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs deleted file mode 100644 index 4436d3cea4..0000000000 --- a/Items/Armor/CirrusDress.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class CirrusDress : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.Hardmode"; - /* How to obtain - * 1 - Have alcohol poisoning - * 2 - Visit the Stylist while Cirrus is alive in the world - * 3 - Open her shop to find the dress - */ - - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/CirrusDress_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - - if (Main.dedServ) - return; - int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesHands[equipSlot] = true; - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().devItem = true; - Item.defense = 8; - } - - public override void UpdateEquip(Player player) - { - player.Calamity().cirrusDress = true; - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - } - - public override void SetMatch(bool male, ref int equipSlot, ref bool robes) - { - robes = true; - equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - } - } -} diff --git a/Items/Armor/CirrusDress.png b/Items/Armor/CirrusDress.png deleted file mode 100644 index 8bd29e2f48..0000000000 Binary files a/Items/Armor/CirrusDress.png and /dev/null differ diff --git a/Items/Armor/CirrusDress_Body.png b/Items/Armor/CirrusDress_Body.png deleted file mode 100644 index 779ae0e094..0000000000 Binary files a/Items/Armor/CirrusDress_Body.png and /dev/null differ diff --git a/Items/Armor/CirrusDress_Legs.png b/Items/Armor/CirrusDress_Legs.png deleted file mode 100644 index 42e4842b43..0000000000 Binary files a/Items/Armor/CirrusDress_Legs.png and /dev/null differ diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 180a8fbbbd..27838ccc22 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.Fearmonger Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 38; // 132 total - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Fearmonger/FearmongerGreaves.cs b/Items/Armor/Fearmonger/FearmongerGreaves.cs index 027cf9af45..37a4444b3c 100644 --- a/Items/Armor/Fearmonger/FearmongerGreaves.cs +++ b/Items/Armor/Fearmonger/FearmongerGreaves.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Fearmonger Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 44; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Fearmonger/FearmongerPlateMail.cs b/Items/Armor/Fearmonger/FearmongerPlateMail.cs index 5226b1d0d7..12cdb7a6fb 100644 --- a/Items/Armor/Fearmonger/FearmongerPlateMail.cs +++ b/Items/Armor/Fearmonger/FearmongerPlateMail.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Armor.Fearmonger Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 50; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index 7b76249015..c1ac53153c 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 31; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index b35d684234..eaebeaac2c 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 14; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index cc5f3f3323..2d404dbd19 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 26; Item.defense = 24; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index cbf664f6a8..7c21d4aa79 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.GodSlayer Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 41; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index f03824f29d..f1dbb56762 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.GodSlayer Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 48; //96 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index 0807eb0f7a..45e96894a1 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.GodSlayer Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 35; //96 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index a83dde4503..630ec80251 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Armor.GodSlayer Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 29; //96 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index 8e6b92d140..d713af7df5 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.GodSlayer Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 35; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index c9ae9d2ca9..28c354ad14 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Silva Item.height = 24; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 44; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index 468d54a814..bd16f1c2ad 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Armor.Silva Item.height = 22; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 21; //110 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index d6d3c29800..fde79e89cf 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Armor.Silva Item.height = 24; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 13; //110 - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 2ee193c596..5aa164bd65 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.Silva Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.defense = 39; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs index 448662c671..114cf3b989 100644 --- a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.sellPrice(gold: 12); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs index 04f3f01831..d1f4295763 100644 --- a/Items/Armor/Vanity/AncientGodSlayerHelm.cs +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.sellPrice(gold: 15); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs index 58956bdeed..f36ed19d5a 100644 --- a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs +++ b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.sellPrice(gold: 9); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Armor/Vanity/GodSlayerHornedHelm.cs b/Items/Armor/Vanity/GodSlayerHornedHelm.cs index 0a003faafb..9c7ec9190b 100644 --- a/Items/Armor/Vanity/GodSlayerHornedHelm.cs +++ b/Items/Armor/Vanity/GodSlayerHornedHelm.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 18; Item.vanity = true; Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/GodSlayerVisage.cs b/Items/Armor/Vanity/GodSlayerVisage.cs index 1c42f8c041..70e25934fb 100644 --- a/Items/Armor/Vanity/GodSlayerVisage.cs +++ b/Items/Armor/Vanity/GodSlayerVisage.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 18; Item.vanity = true; Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaHelm.cs b/Items/Armor/Vanity/SilvaHelm.cs index b5875fd67e..bf60aa6d1b 100644 --- a/Items/Armor/Vanity/SilvaHelm.cs +++ b/Items/Armor/Vanity/SilvaHelm.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaHornedHelm.cs b/Items/Armor/Vanity/SilvaHornedHelm.cs index 7440f939ce..a5f5bbd114 100644 --- a/Items/Armor/Vanity/SilvaHornedHelm.cs +++ b/Items/Armor/Vanity/SilvaHornedHelm.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 24; Item.vanity = true; Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/SilvaMask.cs b/Items/Armor/Vanity/SilvaMask.cs index ad4ec9902f..0b57bd0662 100644 --- a/Items/Armor/Vanity/SilvaMask.cs +++ b/Items/Armor/Vanity/SilvaMask.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 26; Item.vanity = true; Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs index cb7ab3a98b..b1b7641013 100644 --- a/Items/BrimstoneLocus.cs +++ b/Items/BrimstoneLocus.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items { Item.width = 20; Item.height = 20; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = 0; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 55cb33990f..f8aee874d4 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -255,7 +255,7 @@ namespace CalamityMod.Items // Zenith rarity if (item.type == ItemID.Zenith) - item.rare = ModContent.RarityType(); + item.rare = ModContent.RarityType(); // Make most expert items no longer expert because they drop in all modes now. switch (item.type) @@ -996,7 +996,6 @@ namespace CalamityMod.Items // 10% charge = 83% damage // 0% charge = 41.33% damage // - // Fabsol - I changed this formula because it was bad and confusing, and I had promised to do so a while ago. internal float ChargeDamageFormula() { float x = MathHelper.Clamp(ChargeRatio, 0f, 1f); @@ -1142,7 +1141,7 @@ namespace CalamityMod.Items player.endurance -= 0.12f; // Solar Flare armor dash overrides modded dashes by default - if (player.solarShields > 0) + if (player.solarShields > 0 || player.wingsLogic == (int)VanillaWingID.WingsSolar) modPlayer.DashID = string.Empty; } } @@ -1867,9 +1866,9 @@ namespace CalamityMod.Items return RarityTurquoiseBuyPrice; if (rarity == ModContent.RarityType()) return RarityPureGreenBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == ModContent.RarityType()) return RarityDarkBlueBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == ModContent.RarityType()) return RarityVioletBuyPrice; if (rarity == ModContent.RarityType()) return RarityHotPinkBuyPrice; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index bbe4afbd13..5cd62ffeb2 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -4,7 +4,9 @@ using System.Linq; using System.Text; using CalamityMod.Balancing; using CalamityMod.CustomRecipes; +using CalamityMod.DataStructures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.Demonshade; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Tools; @@ -15,6 +17,7 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Prefixes; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -154,6 +157,7 @@ namespace CalamityMod.Items // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the tooltip list. EnchantmentTooltips(item, tooltips); + WhipAutomaticTooltips(item, tooltips, ref lastTooltipIndex); // In GFB, replace all instances of "rogue" with "rouge". string[] rogueKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRogueUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRogueLowercase") }; string[] rougeKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRougeUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRougeLowercase") }; @@ -286,14 +290,12 @@ namespace CalamityMod.Items #region Rarity Coloration private static void ApplyRarityColor(Item item, TooltipLine nameLine) { - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = Color.Lerp(Color.Red, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); // Developer items - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(Main.DiscoR, 100, 255); + if (item.type == ModContent.ItemType()) + nameLine.OverrideColor = new Color(249, 197, 255); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(0, 0, 255); if (item.type == ModContent.ItemType()) @@ -302,6 +304,8 @@ namespace CalamityMod.Items nameLine.OverrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); if (item.type == ModContent.ItemType()) 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()) @@ -411,6 +415,47 @@ namespace CalamityMod.Items } #endregion + #region Whip Tooltips + private void WhipAutomaticTooltips(Item item, IList tooltips, ref int lastTooltipIndex) + { + // Multiplicative tag changes + string FlatTagTooltip(int dmg) => (CalamityUtils.GetText($"Common.SummonTagDamageFlat").Format(dmg.ToString())); + string MultTagTooltip(float mult) => (CalamityUtils.GetText($"Common.SummonTagDamageMult").Format((mult + 1).ToString("0.##"))); + string CritTagTooltip(float crit) => (CalamityUtils.GetText($"Common.SummonTagCrit").Format((crit * 100).ToString("0.#"))); + + Dictionary TagByItem = new(); + foreach (SummonTag tag1 in SummonTagDebuffDict.Dict.Values) + { + if (tag1.TagItem > -1) TagByItem.Add(tag1.TagItem, tag1); + } + if (TagByItem.TryGetValue(item.type, out SummonTag tag)) + { + if (!tag.AutoDrawTooltip) return; + var modPlayer = Main.LocalPlayer.Calamity(); + if (tag.FlatTagDamage != 0) + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:FlatSummonTag", FlatTagTooltip(tag.FlatTagDamage)); + tooltips.Insert(++lastTooltipIndex, line); + } + if (!modPlayer.forceSummonTagCrit && (tag.MultiplicativeTagDamage != 0 || (modPlayer.forceSummonTagMultiplicative && tag.TagCritChance != 0))) + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:MultiplicativeSummonTag", MultTagTooltip(tag.MultiplicativeTagDamage + (modPlayer.forceSummonTagMultiplicative ? tag.TagCritChance : 0))); + tooltips.Insert(++lastTooltipIndex, line); + } + if (!modPlayer.forceSummonTagMultiplicative && (tag.TagCritChance != 0 || (modPlayer.forceSummonTagCrit && tag.MultiplicativeTagDamage != 0))) + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:CritSummonTag", CritTagTooltip(tag.TagCritChance + (modPlayer.forceSummonTagCrit ? tag.MultiplicativeTagDamage : 0))); + tooltips.Insert(++lastTooltipIndex, line); + } + if (modPlayer.forceSummonTagMultiplicative && modPlayer.forceSummonTagCrit) //when both tag and crit are forced, swaps between the two + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:CritSummonTag", ((int)(Main.GlobalTimeWrappedHourly / 5) % 2 == 0 ? CritTagTooltip(tag.MultiplicativeTagDamage + tag.TagCritChance) : MultTagTooltip(tag.MultiplicativeTagDamage + tag.TagCritChance))); + tooltips.Insert(++lastTooltipIndex, line); + } + } + } + #endregion + #region Vanilla Item Tooltip Modification private static void ModifyVanillaTooltips(Item item, IList tooltips) { @@ -493,10 +538,6 @@ namespace CalamityMod.Items // Numerous random tooltip edits which don't fit into another category #region Various Tooltip Edits - // Lilies of Finality 512 edit - if (item.type == ModContent.ItemType()) - EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + Language.GetTextValue("LegacyTooltip.53")); - // Apparently 612 is a homestuck reference if (item.type == ModContent.ItemType()) EditTooltipByName("AxePower", (line) => line.Text = line.Text.Replace("610%", "612%")); @@ -636,8 +677,33 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BrainDodgeCooldownMin / 60, BalancingConstants.BrainDodgeCooldownMax / 60)); #endregion - // Weapon changes - #region Weapon changes + // Whip tag is dynamically generated for all whips based on the SummonTagDebuffDict, so we'll remove the vanilla tag tootlips. + #region Whip Tag removal + // Additive tag changes + if (item.type == ItemID.BlandWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.ThornWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.BoneWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.CoolWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.SwordWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.MaceWhip) + { + EditTooltipByNum(0, (line) => line.Text = string.Empty); + EditTooltipByNum(1, (line) => line.Text = string.Empty); + } + if (item.type == ItemID.RainbowWhip) + { + EditTooltipByNum(0, (line) => line.Text = string.Empty); + EditTooltipByNum(1, (line) => line.Text = string.Empty); + } + #endregion + + // Other weapon changes + #region Other weapon changes // Aerial Bane is no longer the real bane of aerial enemies (50% dmg bonus removed) if (item.type == ItemID.DD2BetsyBow) EditTooltipByNum(0, (line) => line.Text = EditedTooltip("DD2BetsyBow")); @@ -1568,6 +1634,128 @@ namespace CalamityMod.Items #region Enchanted Rarity Text Drawing public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 6; + List eColors = new List() + { + Color.DodgerBlue, + Color.Cyan, + Color.RoyalBlue + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D square = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + int length = line.Text.Length; + for (int i = 0; i < 8; i++) + { + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + for (int i = 0; i < 10; i++) + { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi); + float sine2 = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (5) / MathHelper.Pi); + float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); + Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * -23 * squareSine * sine2 + new Vector2(5, 10); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 6; + List eColors = new List() + { + new Color(248, 117, 52), + Color.Gold, + Color.Orange + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + int length = line.Text.Length; + for (int i = 0; i < 8; i++) + { + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + for (int i = 0; i < 10; i++) + { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi); + float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); + Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * 23 * squareSine + Vector2.UnitY * 5.5f * sine + new Vector2(5, 10); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } // Special enchantment line color. if (line.Name == "ItemName" && line.Mod == "Terraria" && item.IsEnchanted()) { diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index ccac4c3858..6352984b55 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -113,7 +113,6 @@ namespace CalamityMod.Items { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow { ItemID.FalconBlade, Do(UseTurn, UseExact(13)) }, { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration - { ItemID.Flairon, Do(DamageExact(65)) }, { ItemID.Flamarang, Do(DamageExact(40)) }, { ItemID.Flamelash, Do(DamageExact(40)) }, { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, diff --git a/Items/AlicornonaStick.cs b/Items/ColdheartIcicle.cs similarity index 87% rename from Items/AlicornonaStick.cs rename to Items/ColdheartIcicle.cs index 1a0dda3f93..8ddd344abd 100644 --- a/Items/AlicornonaStick.cs +++ b/Items/ColdheartIcicle.cs @@ -5,12 +5,12 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items { - public class AlicornonaStick : ModItem, ILocalizedModType + [LegacyName("AlicornonaStick")] + public class ColdheartIcicle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() @@ -22,6 +22,17 @@ namespace CalamityMod.Items Item.rare = ModContent.RarityType(); } + public override void HoldStyle(Player player, Rectangle heldItemFrame) + { + player.itemRotation = player.direction == -1 ? -MathHelper.PiOver4 : MathHelper.PiOver4; + player.itemLocation = player.GetBackHandPosition(Player.CompositeArmStretchAmount.Full, player.direction * MathHelper.PiOver4) + Vector2.UnitX * player.direction * 14; + } + + public override void HoldItemFrame(Player player) + { + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, -player.direction * MathHelper.PiOver4); + } + public override void HoldItem(Player player) { int offset = player.direction == 1 ? 5 : -Item.width - 5; diff --git a/Items/ColdheartIcicle.png b/Items/ColdheartIcicle.png new file mode 100644 index 0000000000..a8efd6e769 Binary files /dev/null and b/Items/ColdheartIcicle.png differ diff --git a/Items/Critters/PearlpodBlackItem.png b/Items/Critters/PearlpodBlackItem.png index e12ceb5a8a..892ff72678 100644 Binary files a/Items/Critters/PearlpodBlackItem.png and b/Items/Critters/PearlpodBlackItem.png differ diff --git a/Items/Critters/PearlpodGoldItem.cs b/Items/Critters/PearlpodGoldItem.cs deleted file mode 100644 index fb84d69a99..0000000000 --- a/Items/Critters/PearlpodGoldItem.cs +++ /dev/null @@ -1,24 +0,0 @@ -using CalamityMod.NPCs.SunkenSea; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Critters -{ - public class PearlpodGoldItem : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Misc"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 5; - } - - public override void SetDefaults() - { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 10); - Item.rare = ItemRarityID.Green; - } - } -} diff --git a/Items/Critters/PearlpodGoldItem.png b/Items/Critters/PearlpodGoldItem.png deleted file mode 100644 index b4813c7bd3..0000000000 Binary files a/Items/Critters/PearlpodGoldItem.png and /dev/null differ diff --git a/Items/Critters/PearlpodItem.png b/Items/Critters/PearlpodItem.png index abddeb22ff..bd60b5c6ad 100644 Binary files a/Items/Critters/PearlpodItem.png and b/Items/Critters/PearlpodItem.png differ diff --git a/Items/Critters/PearlpodPinkItem.png b/Items/Critters/PearlpodPinkItem.png index 20bf35cddd..c65355ec5e 100644 Binary files a/Items/Critters/PearlpodPinkItem.png and b/Items/Critters/PearlpodPinkItem.png differ diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index fd51d616ec..4e12c8de55 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.DraedonMisc Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = Item.useTime = 15; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5, true); diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index f328847496..9fda84daff 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index a322c53232..3b43b85ee2 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs index 01312c1b6d..0fd524c8ac 100644 --- a/Items/Dyes/CalamitousDye.cs +++ b/Items/Dyes/CalamitousDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index c881cde6b3..c5cf8deda6 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 036526c584..efe65180e4 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 169a151228..27c04a71bf 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index ec2b61ece3..2852aa4ce0 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 7687519061..058f3df1ff 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index 0c89581f22..fc0e577827 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs index 1fcab18fea..afc9fb83a2 100644 --- a/Items/Dyes/SwirlingCosmicFlameDye.cs +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index c05b8bb2ec..9ab034fd53 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void HoldItem(Player player) 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/Items/LoreItems/LoreCalamitas.cs b/Items/LoreItems/LoreCalamitas.cs index d6631d6b8c..eefec1d3e2 100644 --- a/Items/LoreItems/LoreCalamitas.cs +++ b/Items/LoreItems/LoreCalamitas.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreCynosure.cs b/Items/LoreItems/LoreCynosure.cs index a3bcad0756..314bb4f7ea 100644 --- a/Items/LoreItems/LoreCynosure.cs +++ b/Items/LoreItems/LoreCynosure.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreExoMechs.cs b/Items/LoreItems/LoreExoMechs.cs index caeab5e015..15b8c0e3c5 100644 --- a/Items/LoreItems/LoreExoMechs.cs +++ b/Items/LoreItems/LoreExoMechs.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } diff --git a/Items/LoreItems/LoreYharon.cs b/Items/LoreItems/LoreYharon.cs index 274e3a1d2c..ee0dc0feab 100644 --- a/Items/LoreItems/LoreYharon.cs +++ b/Items/LoreItems/LoreYharon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index de3467dd4f..4a4e6c3f24 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 54; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 6); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { diff --git a/Items/Materials/AshesofAnnihilation.cs b/Items/Materials/AshesofAnnihilation.cs index 5b3565422d..38efcdd53a 100644 --- a/Items/Materials/AshesofAnnihilation.cs +++ b/Items/Materials/AshesofAnnihilation.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials Item.height = 56; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 6, silver: 66, copper: 66); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index fd301108ee..9f69b8caf7 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.SortingPriorityMaterials[Type] = 120; ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Type] = true; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 12)); + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 4)); } public override void Unload() @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Materials { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 7); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Materials/AuricBar.png b/Items/Materials/AuricBar.png index 3f6b3f271a..80a05befba 100644 Binary files a/Items/Materials/AuricBar.png and b/Items/Materials/AuricBar.png differ diff --git a/Items/Materials/AuricBar_Glow.png b/Items/Materials/AuricBar_Glow.png index d80546d13a..fb946adc28 100644 Binary files a/Items/Materials/AuricBar_Glow.png and b/Items/Materials/AuricBar_Glow.png differ diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index d402b78f8e..65a85a7e88 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Materials { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 3); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index 902ceb0fa1..b0b48fd1d6 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 32; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 60); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 27a69c8c20..955f818970 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 38; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 40); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index 732cae5900..5b8c11ad99 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Materials Item.height = 52; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 7); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 18963320e2..4f7392b898 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials Item.height = 80; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(platinum: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, Vector2 origin, float baseScale) diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 01c020e757..883a1541a4 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 36; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 40); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/YharonSoulFragment.cs b/Items/Materials/YharonSoulFragment.cs index 542fe37019..f6e256e3c5 100644 --- a/Items/Materials/YharonSoulFragment.cs +++ b/Items/Materials/YharonSoulFragment.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 14; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 5); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs deleted file mode 100644 index 195d4ab52a..0000000000 --- a/Items/Mounts/AlicornMount.cs +++ /dev/null @@ -1,152 +0,0 @@ -using CalamityMod.Buffs.Mounts; -using CalamityMod.CalPlayer; -using CalamityMod.NPCs.TownNPCs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Mounts -{ - public class AlicornMount : ModMount - { - public override void SetStaticDefaults() - { - MountData.spawnDust = 234; - MountData.spawnDustNoGravity = true; - MountData.buff = ModContent.BuffType(); - - // Horizontal movement - MountData.runSpeed = 5.6f; - MountData.dashSpeed = 17.6f; - MountData.swimSpeed = 4f; - MountData.acceleration = 0.4f; - - // Vertical movement - MountData.fallDamage = 0f; - MountData.fatigueMax = int.MaxValue; - MountData.flightTimeMax = int.MaxValue; - MountData.jumpSpeed = 9.21f; - - // Frames and offsets - MountData.totalFrames = 15; - MountData.heightBoost = 34; - int baseYOffset = 30; - int[] array = new int[MountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - array[l] = baseYOffset; - - array[1] = array[3] = array[5] = array[7] = array[12] = baseYOffset - 2; - MountData.playerYOffsets = array; - MountData.playerHeadOffset = 36; - MountData.bodyFrame = 3; - MountData.xOffset = -4; - MountData.yOffset = 6; - MountData.standingFrameCount = 1; - MountData.standingFrameDelay = 12; - MountData.standingFrameStart = 0; - MountData.runningFrameCount = 8; - MountData.runningFrameDelay = 42; - MountData.runningFrameStart = 1; - MountData.flyingFrameCount = 6; - MountData.flyingFrameDelay = 4; - MountData.flyingFrameStart = 9; - MountData.inAirFrameCount = 1; - MountData.inAirFrameDelay = 12; - MountData.inAirFrameStart = 10; - MountData.idleFrameCount = 1; - MountData.idleFrameDelay = 12; - MountData.idleFrameStart = 5; - MountData.idleFrameLoop = true; - MountData.swimFrameCount = MountData.inAirFrameCount; - MountData.swimFrameDelay = MountData.inAirFrameDelay; - MountData.swimFrameStart = MountData.inAirFrameStart; - if (!Main.dedServ) - { - MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/AlicornMountExtra"); - MountData.textureWidth = MountData.backTexture.Width(); - MountData.textureHeight = MountData.backTexture.Height(); - } - } - - public override void SetMount(Player player, ref bool skipDust) - { - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.type == ModContent.NPCType()) - { - npc.active = false; - npc.netUpdate = true; - break; - } - } - } - - public override void Dismount(Player player, ref bool skipDust) - { - bool anyPlayerOnFabMount = false; - foreach (Player player2 in Main.ActivePlayers) - { - // The player that is dismounting is technically not on the mount anymore. - if (player2.Calamity().fab && player2.whoAmI != player.whoAmI) - { - anyPlayerOnFabMount = true; - break; - } - } - - // Spawn Cirrus if no other players are on the Alicorn mount. - if (!anyPlayerOnFabMount) - { - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_TownSpawn(), (int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); - } - } - } - - public override void UpdateEffects(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.cirrusVodka) - player.GetDamage() += 0.1f; - - if (player.velocity.Length() > 9f) - { - int rand = Main.rand.Next(2); - bool momo = false; - if (rand == 1) - { - momo = true; - } - Color meme; - if (momo) - { - meme = new Color(255, 68, 242); - } - else - { - meme = new Color(25, 105, 255); - } - Rectangle rect = player.getRect(); - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.BoneTorch, 0, 0, 0, meme); - Main.dust[dust].noGravity = true; - } - - if (player.velocity.Y != 0f) - { - if (player.mount.PlayerOffset == 28) - { - if (!player.flapSound) - SoundEngine.PlaySound(SoundID.Item32, player.Center); - player.flapSound = true; - } - else - player.flapSound = false; - } - } - } -} diff --git a/Items/Mounts/AlicornMountExtra.png b/Items/Mounts/AlicornMountExtra.png deleted file mode 100644 index b544a94ba8..0000000000 Binary files a/Items/Mounts/AlicornMountExtra.png and /dev/null differ diff --git a/Items/Mounts/AlicornMount_Back.png b/Items/Mounts/AlicornMount_Back.png deleted file mode 100644 index fcb20c4308..0000000000 Binary files a/Items/Mounts/AlicornMount_Back.png and /dev/null differ diff --git a/Items/Mounts/AlicornMount_Front.png b/Items/Mounts/AlicornMount_Front.png deleted file mode 100644 index 821fd8bbfc..0000000000 Binary files a/Items/Mounts/AlicornMount_Front.png and /dev/null differ diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index ce4728ef24..0368904f0e 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Mounts Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item3; Item.noMelee = true; - Item.mountType = ModContent.MountType(); + Item.mountType = ModContent.MountType(); Item.value = Item.sellPrice(gold: 5); Item.rare = ItemRarityID.Yellow; diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/BrimroseChair.cs similarity index 98% rename from Items/Mounts/PhuppersChair.cs rename to Items/Mounts/BrimroseChair.cs index ba514b1f01..ad201606b0 100644 --- a/Items/Mounts/PhuppersChair.cs +++ b/Items/Mounts/BrimroseChair.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { - public class PhuppersChair : ModMount + public class BrimroseChair : ModMount { public override void SetStaticDefaults() { diff --git a/Items/Mounts/PhuppersChair_Back.png b/Items/Mounts/BrimroseChair_Back.png similarity index 100% rename from Items/Mounts/PhuppersChair_Back.png rename to Items/Mounts/BrimroseChair_Back.png diff --git a/Items/Mounts/PhuppersChair_Front.png b/Items/Mounts/BrimroseChair_Front.png similarity index 100% rename from Items/Mounts/PhuppersChair_Front.png rename to Items/Mounts/BrimroseChair_Front.png diff --git a/Items/Mounts/Minecarts/TheCartofGods.cs b/Items/Mounts/Minecarts/TheCartofGods.cs index ae22235184..28178c0b3f 100644 --- a/Items/Mounts/Minecarts/TheCartofGods.cs +++ b/Items/Mounts/Minecarts/TheCartofGods.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Mounts.Minecarts Item.mountType = ModContent.MountType(); Item.value = Item.sellPrice(gold: 30); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Mounts/PrincessSpiritinaBottle.cs b/Items/Mounts/PrincessSpiritinaBottle.cs deleted file mode 100644 index 26dec65edd..0000000000 --- a/Items/Mounts/PrincessSpiritinaBottle.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Mounts -{ - [LegacyName("Fabsol")] - public class PrincessSpiritinaBottle : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Mounts"; - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.useAnimation = Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item3; - Item.noMelee = true; - Item.mountType = ModContent.MountType(); - - Item.value = Item.sellPrice(gold: 5); - Item.rare = ItemRarityID.Yellow; - Item.Calamity().devItem = true; - } - } -} diff --git a/Items/Mounts/PrincessSpiritinaBottle.png b/Items/Mounts/PrincessSpiritinaBottle.png deleted file mode 100644 index 485a6245d0..0000000000 Binary files a/Items/Mounts/PrincessSpiritinaBottle.png and /dev/null differ diff --git a/Items/PermanentBoosters/SacredStrawberry.cs b/Items/PermanentBoosters/SacredStrawberry.cs index d6e040021e..e22276385a 100644 --- a/Items/PermanentBoosters/SacredStrawberry.cs +++ b/Items/PermanentBoosters/SacredStrawberry.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.PermanentBoosters Item.UseSound = UseSound; Item.useStyle = ItemUseStyleID.HoldUp; Item.value = Item.sellPrice(gold: 48); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax; diff --git a/Items/Pets/BrimstoneJewel.cs b/Items/Pets/BrimstoneJewel.cs index 0156aab59e..a35a259e70 100644 --- a/Items/Pets/BrimstoneJewel.cs +++ b/Items/Pets/BrimstoneJewel.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 8de7642381..67f8e4a4c2 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Pets Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Meowmere; Item.value = Item.sellPrice(gold: 7); // Terry reference - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/ForgottenDragonEgg.cs b/Items/Pets/ForgottenDragonEgg.cs index ef80bee193..4d37be5ff7 100644 --- a/Items/Pets/ForgottenDragonEgg.cs +++ b/Items/Pets/ForgottenDragonEgg.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index bdd6efc790..b09ca81710 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Pets Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.expert = true; Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index 567418d2f4..14cf954d0e 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/McNuggets.cs b/Items/Pets/McNuggets.cs index 9ec90e2e81..44a0907073 100644 --- a/Items/Pets/McNuggets.cs +++ b/Items/Pets/McNuggets.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Placeables/Furniture/CirrusCouch.cs b/Items/Placeables/Furniture/CirrusCouch.cs deleted file mode 100644 index c2b66c79ed..0000000000 --- a/Items/Placeables/Furniture/CirrusCouch.cs +++ /dev/null @@ -1,18 +0,0 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class CirrusCouch : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 2, silver: 50); - } - } -} diff --git a/Items/Placeables/Furniture/CirrusCouch.png b/Items/Placeables/Furniture/CirrusCouch.png deleted file mode 100644 index 3d0e1a4ba3..0000000000 Binary files a/Items/Placeables/Furniture/CirrusCouch.png and /dev/null differ diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index f1afd84641..02e98bce76 100644 --- a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 40); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 585d31e782..d1b80fa264 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 60); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index b7a9a85f65..6c812e8cfd 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(platinum: 4); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index fccabfaca5..073307f246 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -51,13 +51,13 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings public static IList devList = new List() { - "Fabsol, the mod's founder and owner", // Fabsol gets a line to himself "Altix", "Angel", "apotofkoolaid", "AquaSG", "Atalya", "Ben-TK", + "CDMusic", "Cei", "CongratsIsTrash", "Cooper", @@ -67,7 +67,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Dia", "dozezoze", "Eddie Spaghetti", - "enamoured", "ENNWAY", "Flowaria", "Fluffy", @@ -88,10 +87,10 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Raesh", "Sagittariod", "Shade", - "SharZz", "Shayy", "Spider Prov", "StipulateVenus", + "Tobias", "Triangle", "TYESKI (Universe)", "Uncle Danny", @@ -111,7 +110,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Blockaroz", "Boffin", "Bravioli", - "CDMusic", "Chetto", "Chill Dude", "Cobalion", @@ -127,6 +125,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Earth", "EchoDuck", "Ein", + "enamoured", "Enreden", "Epsilon", "Fargowilta", @@ -166,7 +165,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Phantasmal Deathray", "Phupperbat", "Pinkie Poss", - "pixlgray", "Poly", "Popo", "President Waluigi", @@ -176,6 +174,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Runefield", "Sargassum", "sentri", + "SharZz", "Shucks", "Silver-Lord of Ash", "SixteenInMono", diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png index 87e86d9bcb..157df9cb45 100644 Binary files a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png and b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png differ diff --git a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs index 62d4f385a0..c74e0940e0 100644 --- a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 45); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs index ece5bf1f44..8ebb0de7b9 100644 --- a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs +++ b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 75); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs index f06a7b6e33..71c984ba02 100644 --- a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs +++ b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs new file mode 100644 index 0000000000..4d3d7874cd --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs @@ -0,0 +1,35 @@ +using CalamityMod.ForegroundDrawing.LoopingTextures; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class OldDukeMonolith : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 25); // Sold by Archmage + Item.rare = ItemRarityID.Pink; + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.GetModPlayer().ShouldDisplayTorrentMonolith = true; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.GetModPlayer().ShouldDisplayTorrentMonolith = true; + } + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png new file mode 100644 index 0000000000..8d4672a17e Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png differ diff --git a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs index c5b5d93424..e074b01fce 100644 --- a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 45); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/ResilientCandle.cs b/Items/Placeables/Furniture/ResilientCandle.cs index 49ee32a22d..65bc15e3db 100644 --- a/Items/Placeables/Furniture/ResilientCandle.cs +++ b/Items/Placeables/Furniture/ResilientCandle.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/Furniture/SpitefulCandle.cs b/Items/Placeables/Furniture/SpitefulCandle.cs index 8f8eee2c9a..a47f64652c 100644 --- a/Items/Placeables/Furniture/SpitefulCandle.cs +++ b/Items/Placeables/Furniture/SpitefulCandle.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index c5934ebc44..79d46acd0a 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Placeables.Furniture { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 10); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Placeables/Furniture/VigorousCandle.cs b/Items/Placeables/Furniture/VigorousCandle.cs index 8d8408d64d..6de8e51070 100644 --- a/Items/Placeables/Furniture/VigorousCandle.cs +++ b/Items/Placeables/Furniture/VigorousCandle.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/Furniture/WeightlessCandle.cs b/Items/Placeables/Furniture/WeightlessCandle.cs index 7edb2ebd30..b6ba17a590 100644 --- a/Items/Placeables/Furniture/WeightlessCandle.cs +++ b/Items/Placeables/Furniture/WeightlessCandle.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(gold: 20); Item.rare = ItemRarityID.Pink; } diff --git a/Items/Placeables/Furniture/ZenithThrone.cs b/Items/Placeables/Furniture/ZenithThrone.cs index 4f09cfeb9d..cd98471793 100644 --- a/Items/Placeables/Furniture/ZenithThrone.cs +++ b/Items/Placeables/Furniture/ZenithThrone.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.Furniture { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 10); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Placeables/FurnitureAuric/AuricToilet.cs b/Items/Placeables/FurnitureAuric/AuricToilet.cs index 9e2c3ef59f..c283d801d8 100644 --- a/Items/Placeables/FurnitureAuric/AuricToilet.cs +++ b/Items/Placeables/FurnitureAuric/AuricToilet.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 40); - Item.rare = ModContent.RarityType(); // Most special shitter gets most preferential treatment + Item.rare = ModContent.RarityType(); // Most special shitter gets most preferential treatment } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs index 5e31836e98..48187c6da2 100644 --- a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs +++ b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index e4d55a7f3f..2fcf606930 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.Ores { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 50); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Placeables/Underworld/Dreadstone.cs b/Items/Placeables/Underworld/Dreadstone.cs new file mode 100644 index 0000000000..1927f25e75 --- /dev/null +++ b/Items/Placeables/Underworld/Dreadstone.cs @@ -0,0 +1,17 @@ +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 new file mode 100644 index 0000000000..3ad756b5e3 Binary files /dev/null and b/Items/Placeables/Underworld/Dreadstone.png differ diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index b9a40e4147..3a59eb34c0 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index 2d0df11fd0..df99ce342a 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index ada553d5dc..1fa9e4c36f 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,9 +33,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddIngredient(ItemID.LivingFireBlock). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 1a79a28375..5b8801d87e 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,9 +30,28 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(1), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(ItemID.Glass, 10). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(ItemID.Glass, 5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e3ac50f3ee..50a3593439 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,9 +30,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index c5c3326bdb..8b8aac8cfc 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,9 +29,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(16, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(ItemID.LivingFireBlock). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(ItemID.LivingFireBlock). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 5a6ecfe28c..3326c62a28 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToHealingPotion(12, 28, 100); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.LightRed; } @@ -37,5 +38,23 @@ namespace CalamityMod.Items.Potions.Alcohol { player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(SecondDuration)); } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(ItemID.Bottle, 10). + AddIngredient(ItemID.Grapes). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index fef39cfa86..dc85eaba0f 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToHealingPotion(28, 40, 200); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } @@ -39,5 +40,21 @@ namespace CalamityMod.Items.Potions.Alcohol { player.AddBuff(BuffType, CalamityUtils.MinutesToFrames(MinuteDuration)); } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index bbe98be132..023184739f 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index e3de1158d0..ab298437e2 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,9 +33,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(32, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index 39c9dc8190..494d19a656 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(38, 50, ModContent.BuffType(), CalamityUtils.MinutesToFrames(60)); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 10); Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 8240710765..f0a99febe6 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,9 +29,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(30, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(ItemID.Ectoplasm). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(ItemID.Ectoplasm). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/OldFashioned.png b/Items/Potions/Alcohol/OldFashioned.png index fddbd65368..c46adf86ba 100644 Binary files a/Items/Potions/Alcohol/OldFashioned.png and b/Items/Potions/Alcohol/OldFashioned.png differ diff --git a/Items/Potions/Alcohol/CirrusVodka.cs b/Items/Potions/Alcohol/PurpleHaze.cs similarity index 83% rename from Items/Potions/Alcohol/CirrusVodka.cs rename to Items/Potions/Alcohol/PurpleHaze.cs index 4b59118bae..16b2e0d0ab 100644 --- a/Items/Potions/Alcohol/CirrusVodka.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { [LegacyName("FabsolsVodka")] - public class CirrusVodka : ModItem, ILocalizedModType + public class PurpleHaze : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(239, 123, 202), new Color(187, 56, 158), @@ -31,8 +30,8 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { - Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Potions/Alcohol/CirrusVodka.png b/Items/Potions/Alcohol/PurpleHaze.png similarity index 100% rename from Items/Potions/Alcohol/CirrusVodka.png rename to Items/Potions/Alcohol/PurpleHaze.png diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index df301e6121..be7ea64e52 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToHealingPotion(14, 48, HealValue); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +44,22 @@ namespace CalamityMod.Items.Potions.Alcohol { player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(SecondDuration)); } + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(ItemID.Bottle, 10). + AddIngredient(ItemID.Grapes). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index ec9ac8cb46..157feb9e2b 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,9 +30,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(24, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 7324ec7709..84111eb272 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,9 +30,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightPurple; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index a2db1c7ac3..70c37e28a6 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -32,9 +33,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(20, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index c423400e0a..a458e21c69 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(16, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 3a65d32387..21f4125b1e 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +32,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(22, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index b1b0ef79ca..81f53c8799 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +32,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 36, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightPurple; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index eed0d9f389..103f21d3be 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 7e5249978d..396bc4b338 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameInput; @@ -32,7 +34,7 @@ namespace CalamityMod.Items.Potions.Alcohol { Item.DefaultToFood(14, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(5), true); Item.healMana = 300; - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightPurple; } @@ -54,5 +56,21 @@ namespace CalamityMod.Items.Potions.Alcohol } player.AddBuff(Item.buffType, Item.buffTime); } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Fabsoup.cs b/Items/Potions/LavaChickenBroth.cs similarity index 92% rename from Items/Potions/Fabsoup.cs rename to Items/Potions/LavaChickenBroth.cs index 91e98d12c6..edc633381e 100644 --- a/Items/Potions/Fabsoup.cs +++ b/Items/Potions/LavaChickenBroth.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class Fabsoup : ModItem, ILocalizedModType + [LegacyName("Fabsoup")] + public class LavaChickenBroth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/SoupConsumption"); @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Potions public override void UseItemFrame(Player player) { - int time = CalamityUtils.MinutesToFrames(33); + int time = CalamityUtils.MinutesToFrames(25) + CalamityUtils.SecondsToFrames(25); if (player.itemAnimation == 180) { player.AddBuff(BuffID.WellFed3, time); diff --git a/Items/Potions/Fabsoup.png b/Items/Potions/LavaChickenBroth.png similarity index 100% rename from Items/Potions/Fabsoup.png rename to Items/Potions/LavaChickenBroth.png diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index a4e28baa46..e145c6d146 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Potions { Item.DefaultToHealingPotion(24, 32, 300); Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/SummonItems/CeremonialUrn.cs b/Items/SummonItems/CeremonialUrn.cs index b3dcdb5e58..d0e5bfa47e 100644 --- a/Items/SummonItems/CeremonialUrn.cs +++ b/Items/SummonItems/CeremonialUrn.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.SummonItems { Item.width = 34; Item.height = 54; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/SummonItems/NO.cs b/Items/SummonItems/NO.cs index 6578012f85..b51b1d575d 100644 --- a/Items/SummonItems/NO.cs +++ b/Items/SummonItems/NO.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { Item.width = Item.height = 32; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.useAnimation = 10; Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/SummonItems/YharonEgg.cs b/Items/SummonItems/YharonEgg.cs index 2a91bbe100..3bfa7a76c3 100644 --- a/Items/SummonItems/YharonEgg.cs +++ b/Items/SummonItems/YharonEgg.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 0398fbda0c..84fe1334f6 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -146,16 +146,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags } itemLoot.AddIf(getsOracleHeadphones, ModContent.ItemType()); - - // Fabsol dev item - // Name specific: "Fabsol" or "Cirrus" - static bool getsCrystalHeartVodka(DropAttemptInfo info) - { - string playerName = info.player.name; - return playerName is "Fabsol" or "Cirrus"; - } - - itemLoot.AddIf(getsCrystalHeartVodka, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 5af40c3c7c..60ec10a868 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ModContent.ItemType(), 10); // Equipment - itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); itemLoot.Add(ModContent.ItemType()); itemLoot.AddRevBagAccessories(); diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index d177e4d0b0..b3ebf087f6 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 1a3f98583d..cd86a01810 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 5c2902b993..8a64ec9c5b 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item15; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 0f0ad89be9..202ced18ce 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 1388f7623a..e8c399d95f 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 475c24e69e..d739d964f7 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); modItem.donorItem = true; modItem.UsesCharge = true; diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 77be95907f..7223d35dbe 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index 36dd27dd3b..c06f2343cd 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item12; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs deleted file mode 100644 index c45ed84228..0000000000 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class DivineRetribution : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 66; - Item.height = 88; - Item.damage = 48; - Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 12; - Item.useAnimation = 12; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.5f; - - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; - - Item.UseSound = SoundID.Item73; - Item.autoReuse = true; - Item.shootSpeed = 25f; - Item.shoot = ModContent.ProjectileType(); - } - - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - // 5 projectiles total - Vector2 mouse = player.ClampedMouseWorld(); - for (int i = -2; i < 3; i++) - { - Vector2 newPos = new Vector2(mouse.X + Main.rand.NextFloat(8f, 64f) * i, player.MountedCenter.Y + Main.rand.NextFloat(640f, 800f)); - Vector2 newVel = (mouse + Main.rand.NextVector2CircularEdge(4f, 4f) - newPos).SafeNormalize(Vector2.Zero) * velocity.Length() * Main.rand.NextFloat(1f, 1.25f); - float velScale = 1f + Main.rand.NextFloat(0.02f, 0.08f) * i; - Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, velScale); - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(8). - AddIngredient(10). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/DivineRetribution.png b/Items/Weapons/Magic/DivineRetribution.png deleted file mode 100644 index 4a5c496127..0000000000 Binary files a/Items/Weapons/Magic/DivineRetribution.png and /dev/null differ diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs deleted file mode 100644 index cde4852367..0000000000 --- a/Items/Weapons/Magic/Fabstaff.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class Fabstaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 84; - Item.height = 84; - Item.damage = 140; - Item.DamageType = DamageClass.Magic; - Item.mana = 35; - Item.useAnimation = Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5f; - - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().devItem = true; - - Item.UseSound = SoundID.Item60; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13.5f; - } - - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.RainbowRod). - AddIngredient(5). - AddIngredient(10). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/Fabstaff.png b/Items/Weapons/Magic/Fabstaff.png deleted file mode 100644 index 6658464065..0000000000 Binary files a/Items/Weapons/Magic/Fabstaff.png and /dev/null differ diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 1148903310..fd2a7bd48b 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index e4a64b95a0..2e56c3fd15 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 4344a34749..2d293f49c8 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index 2349832e9d..5b215872ec 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 90f046f193..6f414a611d 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = CastSound; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.damage = 2300; diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index d43e562b13..04b8be0ba8 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index 9ba21a61be..cb55c2f942 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.knockBack = 6f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 3f; diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 5b920b4c1a..a2ad1e66c9 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 2; diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 1921f78eeb..9e50922cde 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index adcc961a6c..8da0f86ef4 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index f69ac44ac2..c18625be66 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index c7c48d362a..5b897e00e0 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 84db87a52f..cea133c69b 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item84; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Magic/Sylvestaff.cs b/Items/Weapons/Magic/Sylvestaff.cs new file mode 100644 index 0000000000..f34f2af785 --- /dev/null +++ b/Items/Weapons/Magic/Sylvestaff.cs @@ -0,0 +1,121 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + [LegacyName("Fabstaff")] + public class Sylvestaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + + /// + /// The amount by which the staff recoils after firing. + /// + public static float StaffRecoilForce => 0.04f; + + /// + /// The rate at which rays from the staff can release bolts. + /// + public static int RayBoltShootRate => CalamityUtils.SecondsToFrames(0.0667f); + + /// + /// The distance range that targets need to be within relative to a ray's evaluation points in order to shoot bolts. + /// + public static float RayBoltTargetingRange => 272f; + + /// + /// The turn speed interpolant that dictates how fast or slow the staff can move to aim towards the mouse. + /// + public static float TurnSpeedInterpolant => 0.276f; + + /// + /// The sound played when Sylvestaff rays are fired. + /// + public static readonly SoundStyle FireSound = new SoundStyle("CalamityMod/Sounds/Item/SylvestaffFire", 3) with { MaxInstances = 5 }; + + /// + /// The sound played when Sylvestaff rays bounce off of tiles. + /// + public static readonly SoundStyle BounceSound = new SoundStyle("CalamityMod/Sounds/Item/SylvestaffProjectileBounce", 3) with { MaxInstances = 5 }; + + public override string Texture + { + get + { + if (WorldGen.SavedOreTiers.Gold == TileID.Gold || Main.gameMenu) + return "CalamityMod/Items/Weapons/Magic/SylvestaffGold"; + + return "CalamityMod/Items/Weapons/Magic/SylvestaffPlatinum"; + } + } + + public override void SetStaticDefaults() + { + Item.staff[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 84; + Item.height = 84; + Item.damage = 125; + Item.DamageType = DamageClass.Magic; + Item.mana = 50; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + Item.knockBack = 5f; + + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().devItem = true; + + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13.5f; + } + + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + mult *= 0; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.RainbowRod). + AddIngredient(ItemID.GenderChangePotion). + AddRecipeGroup("AnyGoldBar", 5). + AddIngredient(10). + AddIngredient(5). + AddTile(). + Register(); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, position, frame, drawColor, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Items/Weapons/Magic/SylvestaffGold.png b/Items/Weapons/Magic/SylvestaffGold.png new file mode 100644 index 0000000000..2cd1d31e38 Binary files /dev/null and b/Items/Weapons/Magic/SylvestaffGold.png differ diff --git a/Items/Weapons/Magic/SylvestaffPlatinum.png b/Items/Weapons/Magic/SylvestaffPlatinum.png new file mode 100644 index 0000000000..c611c58ea1 Binary files /dev/null and b/Items/Weapons/Magic/SylvestaffPlatinum.png differ diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index cb2dcf2656..4a02a8674c 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index 00f8970db7..25da1eb71e 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16.5f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 5aabf36d9d..b4ea614361 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index abd18f69a4..8c0e9cfa2a 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 5cd70a1c53..7cc6371ec6 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index 79f6ee338e..b5939f4622 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 905ec0cf9c..127c76be64 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; - Item.rare = RarityType(); + Item.rare = RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index 62bc330370..49cf9686b6 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index f27421e8d2..937b7f4615 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index e8e5ba8113..507e91f4a2 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; // revertusernamechange on Discord (Yatagarasu) } diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 6d1c3063e9..2086ec42c8 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.channel = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool MeleePrefix() => true; public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 41; diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 9b2ca8504b..d1e27ec1d4 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.channel = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index dc5f9e1f86..3b7300228c 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 790801310d..8a1a1303fa 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 21f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 8c5022575a..ad3d886059 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index e13b50b5e5..177303a7cd 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileType(); Item.shootSpeed = 9f; - Item.rare = RarityType(); + Item.rare = RarityType(); } public override bool CanShoot(Player player) diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 4d78166bc2..eeeb006558 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GalaxySmasher.cs b/Items/Weapons/Melee/GalaxySmasher.cs index 4181e6db0e..02ba2e6b70 100644 --- a/Items/Weapons/Melee/GalaxySmasher.cs +++ b/Items/Weapons/Melee/GalaxySmasher.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index 4cd3bc4a78..08ad1543fe 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -55,7 +55,6 @@ namespace CalamityMod.Items.Weapons.Melee public override bool CanUseItem(Player player) { - Item.UseSound = player.altFunctionUse == 2 ? null : SoundID.Item71; return base.CanUseItem(player); } @@ -84,6 +83,7 @@ namespace CalamityMod.Items.Weapons.Melee if (shardCount > 0) { SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath,player.Center); } if (shardCount >= 10) { @@ -101,8 +101,6 @@ namespace CalamityMod.Items.Weapons.Melee proj2.netUpdate = true; } } - if (shardCount > 0) - SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath,player.Center); reflectTimer = 0; return; } diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index aec2123d1a..d1e93094a9 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 4ba4e5d206..e8edf14bad 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index 6a835e742a..58a906a399 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,8 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 70; - Item.height = 70; + Item.width = 76; + Item.height = 76; Item.damage = 195; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow @@ -31,6 +33,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordClaymoreGlow").Value); + } public override bool MeleePrefix() => true; public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 11; } diff --git a/Items/Weapons/Melee/OldLordClaymore.png b/Items/Weapons/Melee/OldLordClaymore.png index 9326b47f1e..3ac3266613 100644 Binary files a/Items/Weapons/Melee/OldLordClaymore.png and b/Items/Weapons/Melee/OldLordClaymore.png differ diff --git a/Items/Weapons/Melee/OldLordClaymoreGlow.png b/Items/Weapons/Melee/OldLordClaymoreGlow.png new file mode 100644 index 0000000000..1dc3c129f5 Binary files /dev/null and b/Items/Weapons/Melee/OldLordClaymoreGlow.png differ diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 4672492beb..4bcfb4b25b 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.5f; } diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Ozzathoth.cs similarity index 92% rename from Items/Weapons/Melee/Azathoth.cs rename to Items/Weapons/Melee/Ozzathoth.cs index 2dd12c9fb4..78255997e8 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Ozzathoth.cs @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Azathoth : ModItem, ILocalizedModType + [LegacyName("Azathoth")] + public class Ozzathoth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/Azathoth.png b/Items/Weapons/Melee/Ozzathoth.png similarity index 100% rename from Items/Weapons/Melee/Azathoth.png rename to Items/Weapons/Melee/Ozzathoth.png diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index 067ee83e3b..8faaf618d0 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index cf8f7e9eba..48811ff007 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 3eaaa817b5..8976d32019 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; } diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index 6b9de5cab9..aeeb946f60 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = Item.height = 28; Item.damage = 128; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index f8c25997b1..8efaa7e44f 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 118; - Item.damage = 98; + Item.damage = 110; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 33; diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index 7358ae671f..1fca1c976e 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index a4e26ae751..88597dead0 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 61674ef152..07c02ed83e 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); } diff --git a/Items/Weapons/Melee/TheOracle.cs b/Items/Weapons/Melee/TheOracle.cs index 7bf5027c5c..8b0ed24ce0 100644 --- a/Items/Weapons/Melee/TheOracle.cs +++ b/Items/Weapons/Melee/TheOracle.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index 1d0ded5ccb..a5c14dd92e 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.channel = true; diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 02b9c4d72b..d7eb0ca17d 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 6f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item36; diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 43927c6267..ce16dc0604 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index f777603609..37a94ce794 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index ffb8e030fb..825b90649f 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 68; Item.height = 36; - Item.damage = 89; + Item.damage = 80; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 1382b7b071..2300098a78 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); // No use sound is intentional Item.autoReuse = true; Item.shootSpeed = 14.5f; diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 5e0af0c3f6..02a82cb3a7 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 11f; Item.useAmmo = AmmoID.Gel; Item.consumeAmmoOnFirstShotOnly = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request(Texture + "Glow").Value); diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 96d14370c5..8132546927 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 3bdb517214..9632dcfee7 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs deleted file mode 100644 index 5e7c814098..0000000000 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class DodusHandcannon : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 62; - Item.height = 34; - Item.damage = 1020; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 30; - Item.useAnimation = 30; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 6f; - - // Reduce volume to 30% so it stops destroying people's ears. - Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound with { Volume = 0.3f }; - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; - Item.useAmmo = AmmoID.Bullet; - - Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; - } - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - type = Item.shoot; - } - - public override Vector2? HoldoutOffset() => new Vector2(-17, 5); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.LunarBar, 15). - AddIngredient(5). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/DodusHandcannon.png b/Items/Weapons/Ranged/DodusHandcannon.png deleted file mode 100644 index d78a7a37f7..0000000000 Binary files a/Items/Weapons/Ranged/DodusHandcannon.png and /dev/null differ diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index df0e1a9c79..f313c05955 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 3.5f; Item.useAmmo = AmmoID.Gel; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 45496b42b1..8367b13cea 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.useAmmo = AmmoID.Arrow; Item.autoReuse = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 3c3643b112..57c046422b 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; Item.useTurn = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index a636a0b041..8a164a88ae 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index cbcef379cc..0bc52e0523 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index 9a942794f6..234809a4de 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2f; Item.useAmmo = AmmoID.Bullet; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0; diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index c329d10c8c..0dfb90b621 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Rocket; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index ab4a0922b6..46d0fbe03a 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = null; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 9acf97013b..f24d83f173 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 4.5f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item36; Item.autoReuse = true; Item.shoot = ProjectileID.BlackBolt; diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 1b25904346..068fee8ded 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.noUseGraphic = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Ranged/Riftburst.cs b/Items/Weapons/Ranged/Riftburst.cs index bb67b81471..bbd5ba795b 100644 --- a/Items/Weapons/Ranged/Riftburst.cs +++ b/Items/Weapons/Ranged/Riftburst.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 797b938ae8..b5568938c2 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index 57a93203f4..e5645f4876 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 8.7f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shootSpeed = 12.6f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index 20425ca0c6..2db3e341ec 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.useAmmo = AmmoID.FallenStar; Item.autoReuse = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/Starmageddon.cs b/Items/Weapons/Ranged/Starmageddon.cs index a2c2cd6707..0d1bbf25ea 100644 --- a/Items/Weapons/Ranged/Starmageddon.cs +++ b/Items/Weapons/Ranged/Starmageddon.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.useTurn = false; Item.autoReuse = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index 45a7d7984d..37e84fff5d 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -1,4 +1,5 @@ -using CalamityMod.Cooldowns; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; @@ -21,9 +22,12 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public const float ShootSpeed = 24f; - public const int DashCooldown = 360; + public bool hasDashed = false; + public int rightClickDelay = 0; + public static int doubleRightFrameWindow = 23; + public override void ModifyTooltips(List tooltips) { if (tooltips == null) @@ -55,10 +59,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 84; Item.height = 46; - Item.damage = 127; + Item.damage = 97; Item.DamageType = DamageClass.Ranged; - Item.useTime = 30; - Item.useAnimation = 30; + Item.useTime = 10; + Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; @@ -75,13 +79,7 @@ namespace CalamityMod.Items.Weapons.Ranged // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21; public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2 && player.HasCooldown(SuperradiantSawBoost.ID)) - return false; - else - return player.ownedProjectileCounts[Item.shoot] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void HoldItem(Player player) { @@ -91,6 +89,11 @@ namespace CalamityMod.Items.Weapons.Ranged player.Calamity().mouseWorldListener = true; player.Calamity().rightClickListener = true; + if (rightClickDelay > 0) + rightClickDelay--; + if (!player.HasCooldown(SuperradiantSawBoost.ID)) + hasDashed = false; + // Right-click channeling if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse && !player.HasCooldown(SuperradiantSawBoost.ID)) { @@ -108,9 +111,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // The holdout will initially double up when right clicking otherwise + // Handles allowing the dash if (player.altFunctionUse == 2) + { + bool doubleRightClick = rightClickDelay > 0 && !hasDashed; + bool canDash = doubleRightClick && player.Calamity().DashID != SuperradiantSawDash.ID; + + // If you hit the right-click window, dash + if (canDash) + { + hasDashed = true; + player.Calamity().sBlasterDashActivated = true; + } + + // Set the double right-click frames + rightClickDelay = doubleRightFrameWindow; + // The holdout will initially double up when right clicking otherwise return false; + } // The holdout deals 2x base damage. Projectile.NewProjectile(source, position, velocity, Item.shoot, damage * 2, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index a344d60962..702c3531da 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 79bdaba8f6..11e6a60c75 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index 3ada4994ca..138350b602 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 74344b0764..3625172b9f 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index ced1680bb9..b3cb9c5e31 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index d26c0be45e..289d0d026f 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.UseSound = SoundID.Item38; Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.Calamity().canFirePointBlankShots = true; } diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 113f7e24a7..2af3d2b3dc 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.autoReuse = true; Item.noMelee = true; diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index 7bce69a725..7154af929f 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 66e11cf25d..556ee58087 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 7d6589d230..e9d74d021e 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 1692e04126..2ca189198f 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index b76b2ab6d9..91097539e0 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Rogue public class Glaive : RogueWeapon { //These 2 are used on the Projectile AI and thus remain here - public static float Speed = 10f; - public static float StealthSpeedMult = 1.8f; + public static float Speed = 13f; + public static float StealthSpeedMult = 1.3f; public override void SetDefaults() { @@ -29,29 +29,23 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.shootSpeed = 10; + Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthVelocityMultiplier => StealthSpeedMult; + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float ai1 = 0f; - if (player.Calamity().StealthStrikeAvailable()) - { - ai1 = 1f; - } - - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai1); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, -1f); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) + { Main.projectile[p].Calamity().stealthStrike = true; + Main.projectile[p].penetrate = 4; + } return false; } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; } } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 617ddddddc..35a5e65a3c 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index c219d0b749..5cb23c0ae9 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index e933be5740..97da26e19b 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 4d9491c548..6004817676 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override float StealthDamageMultiplier => 0.3f; diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index d13814e54e..5d8628eb35 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index b7cc902959..5ccd6b6204 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index 70f1b3c210..c55b583ae2 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = SeraphimProjectile.InitialSpeed; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index d6bef9b091..73e4551819 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override float StealthDamageMultiplier => 0.7f; diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index 10cbf7a310..7372b085b7 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/TheFinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs index beb247c99c..e85e7b59a3 100644 --- a/Items/Weapons/Rogue/TheFinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; Item.autoReuse = false; diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index 1e974a818b..649e31cfba 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index f3c3d7e3fc..3af96062b3 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item117; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index 0706ca78d9..f2a0c22d88 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.noUseGraphic = true; Item.DamageType = DamageClass.Summon; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.sentry = true; } diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 6d7d05659f..ebaba97f0c 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 781e063250..7445a85016 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index d555808fda..3209dce26f 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 10; diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index ce0fd4f2de..522c320cfe 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 477f451751..147aaa5450 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.DD2_DarkMageHealImpact; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 127; + Item.damage = 43; Item.knockBack = 2f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 15; diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 3b64d117d0..393642dfbb 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs index 6f30839132..968e79bbe8 100644 --- a/Items/Weapons/Summon/LiliesOfFinality.cs +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -32,16 +32,13 @@ namespace CalamityMod.Items.Weapons.Summon public static int Ariane_AoESize = 1050; public static float Ariane_AoEDMGMultiplier = 0.4f; - // Do not change this number, ever. - Fabsol - public const int TheNumber = 512; - #endregion public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; public override void SetDefaults() { - Item.damage = TheNumber; + Item.damage = 512; Item.DamageType = DamageClass.Summon; Item.shoot = ProjectileType(); Item.knockBack = 5f; @@ -52,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = new("CalamityMod/Sounds/Item/LiliesOfFinalitySummonSpawn"); } diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index ce288d7a8b..dce121d6b1 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 431dfd4d0f..f1ee79c0fc 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index 038c64ae12..d4c7b5947f 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item4; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index 9db7a9910e..e610e10089 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_EtherianPortalOpen; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index cb7411cbcc..e70b846278 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_BetsyFlameBreath; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.noMelee = true; } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index d6bee5eefe..bbd57dae6f 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item113; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index a1bb127949..99845a7cb9 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } 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/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index dc09c1c246..104e4933e0 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.FlareSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs deleted file mode 100644 index 9aa8579d24..0000000000 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ /dev/null @@ -1,76 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless -{ - public class YanmeisKnife : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/YanmeiKnifeHit"); - public static readonly SoundStyle ExpireSound = new("CalamityMod/Sounds/Custom/YanmeiKnifeExpire"); - - public static int DebuffDuration = 600; - public static int DebuffDoT = 250; - public static float DebuffDamageReductionMult = 0.8f; - public static float DebuffNPCSpeedCap = 16f; - - public static int BoostDuration = 600; - public static float RunSpeedBoost = 0.15f; - public static float RunAccelerationBoost = 0.15f; - public static float DamageBoost = 0.15f; // All 15% so we only need just one in the tooltip -- Same for the respective buff - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RunSpeedBoost.ToPercent(), BoostDuration.FramesToSeconds()); - - public override void SetDefaults() - { - Item.width = 48; - Item.height = 44; - Item.damage = 8; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 32; - Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 4.5f; - Item.autoReuse = false; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.Calamity().donorItem = true; - Item.UseSound = SoundID.Item71; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 24f; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; - - public override bool CanUseItem(Player player) - { - if (player.Calamity().KameiBladeUseDelay > 0) - return false; - return base.CanUseItem(player); - } - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => player.Calamity().KameiBladeUseDelay = 180; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.PsychoKnife). - AddIngredient(ItemID.Obsidian, 10). - AddRecipeGroup("IronBar", 20). - AddIngredient(50). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/YanmeisKnife.png b/Items/Weapons/Typeless/YanmeisKnife.png deleted file mode 100644 index b7f214f8f4..0000000000 Binary files a/Items/Weapons/Typeless/YanmeisKnife.png and /dev/null differ diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index d2476f0841..7d5a7a6af1 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -143,7 +143,7 @@ SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things on Searslug: A distant cousin of the Slugbuns which can withstand the extreme heat of molten basalt. Their skin is scalding to the touch, a side effect of their adaptations to the many lava dips needed to squirm around the regions it lives in. Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Sea. It retaliates against threats through the unusual method of exploding a sac on its body that stores highly reactive chemicals, fleeing in the confusion caused by its shockwave. Slugbun: The name of these cute sea dwellers is actually a misnomer given to them by outside visitors of the sea kingdom, who often sold them as exotic pets. In fact, their "bunny ear" appendages are actually their antennae taking on the appearance of the various sea prisms scattered throughout their home. -Steampod: Distant relatives of the Pearlpods, adapted to the searing hot temperatures of the basalt caverns. Steampods harness pressurized water vapor to dash through the air, curled up into a deadly airborne boulder. +Steampod: These distant relatives of the Pearlpods possess a powerful environmental adaptation. Their ability to eject steam propels themselves through the air as a deadly pneumatic boulder that packs quite a punch. Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. StormlionSentry: Some Ilmeran survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. //Town NPCs @@ -151,7 +151,6 @@ AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to s Archmage: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. Bandit: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. -Cirrus: A princess from an unknown land. She drinks constantly in a vain attempt to escape the memories of her past, but is practically immune to alcohol. She makes a business of selling her mixtures, alcoholic and alchemic alike. SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index d9e582bda8..aa350e2e62 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -19,9 +19,9 @@ CinnamonRollBuff: { Description: Mana regen rate and fire debuff damage increased, defense reduced } -CirrusVodkaBuff: { - DisplayName: Fab - Description: You feel fabulous +PurpleHazeBuff: { + DisplayName: Purple Haze + Description: Damage and invulnerability frames increased, defense reduced } EverclearBuff: { @@ -287,10 +287,6 @@ WeakBrimstoneFlames: { } // Mounts -AlicornBuff: { - DisplayName: Alicorn - Description: You beat DoG while drunk, you are truly fabulous! -} AndromedaBuff: { DisplayName: Andromeda @@ -509,22 +505,22 @@ ChaosCandleBuff: { Description: Spawn rates around the candle are boosted! } -CirrusBlueCandleBuff: { +BlueCandleBuff: { DisplayName: Limber Description: The floating flame seems to uplift your very spirit } -CirrusPinkCandleBuff: { +PinkCandleBuff: { DisplayName: Vigor Description: The brilliant light suffuses you with hope } -CirrusPurpleCandleBuff: { +PurpleCandleBuff: { DisplayName: Resilience Description: Neither rain nor wind can snuff your undying flame } -CirrusYellowCandleBuff: { +YellowCandleBuff: { DisplayName: Spite Description: The hateful, flickering glow fuels your ire } @@ -562,7 +558,7 @@ AstralInjectionBuff: { BaguetteBuff: { DisplayName: Baguette - Description: "[c/B00BA5:'If only I knew...' ~Cirrus]" + Description: Goes well with Red Wine } BloodfinBoost: { @@ -764,11 +760,6 @@ DivineBless: { Description: Increased health regen and minions inflict Banishing Fire } -EmpyreanRage: { - DisplayName: Empyrean Rage - Description: Rage of the cosmos -} - EmpyreanWrath: { DisplayName: Empyrean Wrath Description: Wrath of the cosmos @@ -814,11 +805,6 @@ IceShieldBuff: { Description: Absorbs {0}% damage from the next hit you take, then shatters } -KamiBuff: { - DisplayName: Kami Injection - Description: "{0}% increased max movement speed, acceleration and damage" -} - Mushy: { DisplayName: Mushy Description: Increased defense by {0} and life regen by {1} HP/s @@ -1027,11 +1013,6 @@ Irradiated: { Description: Your skin is burning off } -KamiFlu: { - DisplayName: Kami Flu - Description: Defenseless and dying -} - MarkedforDeath: { DisplayName: Marked for Death Description: Damage reduction reduced diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index c083073773..413fa82e21 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -11,6 +11,9 @@ NotConsumable: Not consumable RogueDamage: "{0}% increased rogue damage" RogueCrit: "{0}% increased rogue critical strike chance" RogueVelocity: "{0}% increased rogue velocity" +SummonTagDamageFlat: "{0} summon tag damage" +SummonTagDamageMult: "{0}x summon tag damage" +SummonTagCrit: "{0}% summon tag critcal strike chance" DodgeInformation: ''' Attacks that deal less than 5% of your max life in damage will not be dodged diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index 99fdd6fa50..f9e209883b 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -47,7 +47,6 @@ Drops: { Drops if Providence was defeated only with the [i:CalamityMod/ProfanedSoulArtifact] Profaned Soul Artifact {$Bestiary_ItemDropConditions.IsExpert} ''' - TrasherKill: Drops if fed to a Trasher } // Other conditions diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index e1ae0e199d..89b05f4298 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -6,10 +6,15 @@ CalamityClientConfig: { Graphics: Graphics Changes UI: UI Changes MeterPositions: Meter Positions - MusicEvents: In-Game Music Events + MusicToggles: Music Toggles Multithreading: Multi-Threading } + AbyssLayer3Alt: { + Label: "[i:CalamityModMusic/AbyssLayer3AltMusicBox] Abyss Layer 3 Alt" + Tooltip: Plays Calamity Mod OST - "R'lyehian Depths", while in the Thermal Vents layer of the Abyss. + } + AdrenalineMeterPosX: { Label: "[i:LaserRuler] Adrenaline Meter X Position" Tooltip: @@ -139,7 +144,7 @@ CalamityClientConfig: { } FlightBar: { - Label: "[i:CalamityMod/DrewsWings] Display Flight Bar" + Label: "[i:AngelWings] Display Flight Bar" Tooltip: ''' Enables the Flight Bar UI, which shows the player's remaining wing flight time. @@ -322,10 +327,10 @@ CalamityClientConfig: { Label: "[i:TrifoldMap] Enable Stutter Fix" Tooltip: ''' - When enabled, upon entering a world, the entire world will be loaded at once. - This config causes Terraria to stop responding while the world is being loaded, do NOT close the game while this is occurring. - Once the game starts responding again, you will enter the world and be able to play without random stutters. - This config option is only recommended for players who can't stand random stutters while playing. + When enabled, upon entering a world, the entire world will be loaded at once. + This config causes Terraria to stop responding while the world is being loaded, do NOT close the game while this is occurring. + Once the game starts responding again, you will enter the world and be able to play without random stutters. + This config option is only recommended for players who can't stand random stutters while playing. ''' } @@ -351,9 +356,18 @@ CalamityClientConfig: { Label: "[i:CalamityMod/SeaRemains] Sunken Sea Background Distortion" Tooltip: ''' - Whether or not the Sunken Sea's custom backgrounds should have an additional distortion shader applied to them to give the - illusion of underwater distortion. - [c/FF232C:Note that this will ONLY work if your "Wave Quality" setting is turned off.] + Whether or not the Sunken Sea's custom backgrounds should have an additional distortion shader applied to them. + This will give the illusion of underwater distortion. + [c/FF232C:Note that this will ONLY work if your "Wave Quality" setting is turned off.] + ''' + } + + TextEffects: { + Label: "[i:LeinforsAccessory] Extra Text Effects" + Tooltip: + ''' + When enabled, certain Calamity rarities will display extra visual effects within item names. + Disable if reduced visual clutter is desired. ''' } diff --git a/Localization/en-US/Mods.CalamityMod.GameTips.hjson b/Localization/en-US/Mods.CalamityMod.GameTips.hjson index 9d69d69161..3d5faa25c4 100644 --- a/Localization/en-US/Mods.CalamityMod.GameTips.hjson +++ b/Localization/en-US/Mods.CalamityMod.GameTips.hjson @@ -4,7 +4,6 @@ PlanetoidTip: You can find Planetoids high up in Space! AbyssTip: The Abyss can be found deep below the Sulphurous Sea. Be sure to have proper diving gear when exploring it. BanditTip: The Bandit won't steal from the poor. If you want to see them, you will need a lot of money to pique their attention. RefundTip: If you've been reforging a lot with the Goblin Tinkerer, it might pay off to give the Bandit a visit. -DrunkPrincessTip: The Drunk Princess is great to party with. If you carry her favorite vodka, she might move in. SeaKingTip: The Sea King used to like clams. He changed his mind when he got eaten by one. AmidiasBlessingTip: The Sea King can provide a bubble to aid with breathing underwater to any who ask for help. ArchmageTip: The Archmage can be freed if you manage to destroy the cell he was imprisoned in. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 1d3d11350b..574e9cfe10 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -8,15 +8,6 @@ AureateBooster: { ''' } -DrewsWings: { - DisplayName: Drew's Wings - Tooltip: - ''' - {$CommonItemTooltip.FlightAndSlowfall} - 'Absolutely Fabulous' - ''' -} - ElysianWings: { DisplayName: Elysian Wings Tooltip: @@ -31,7 +22,7 @@ ExodusWings: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - Grants permanent Empyrean Wrath and Empyrean Rage while wearing the Empyrean armor + Grants permanent Empyrean Wrath while wearing the Empyrean armor Pulsing with an alien heartbeat ''' } @@ -142,3 +133,12 @@ TracersSeraph: { 'Taking speed EVEN FURTHER BEYOND!' ''' } + +WingsofRebirth: { + DisplayName: Wings of Rebirth + Tooltip: + ''' + {$CommonItemTooltip.FlightAndSlowfall} + 'Resplendent to the very end' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index ea891ff29d..b5f420adc1 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -106,7 +106,7 @@ AmbrosialAmpoule: { Tooltip: ''' +50 max life - Grants +2 to +5 HP/s life regen based on missing health + Grants +2 to +6 HP/s life regen based on missing health Standing still grants +1.5 HP/s life regen and +1 HP/s life regen when inflicted with a damage debuff Current boost: +[REGEN] HP/s Fire and sickness debuff durations are halved @@ -1017,7 +1017,7 @@ InterstellarStompers: { ''' 6% increased movement speed, 20% increased jump speed, and negates fall damage Hold DOWN to increase your maximum fall speed - Hold [KEY] for 0.5 seconds while midair to charge up a superspeed slam + Pressing [KEY] while midair charges up a superspeed slam over 0.33 seconds While falling, you ram through enemies and don't take contact damage Once you hit the ground, you create an explosion at your feet The explosion scales in both damage and size the longer you slam for @@ -1120,10 +1120,12 @@ ManaPolarizer: { DisplayName: Mana Polarizer Tooltip: ''' - Increases max mana by 50 and magic damage by 6% - -1.5 HP/s life regen if mana is above 50% of its maximum + Increases max mana by 50 + Provides life regeneration and magic damage that scales based on how much mana you have + Lower mana means more life regeneration, but less magic damage + These scale from -2 to 2 HP/sec, and 5% to 15% damage + The provided regeneration is halved when under Mana Sickness Magic projectiles steal enemy life while holding a magic weapon - The more mana you have, the more you heal ''' } @@ -1419,7 +1421,7 @@ Radiance: { ''' HoldShiftTooltip: ''' - [c/CDF69C:Grants +2 to +5 HP/s life regen based on missing health] + [c/CDF69C:Grants +2 to +6 HP/s life regen based on missing health] [c/CDF69C:Recover an additional 6 HP/s while inflicted with a debuff] [c/CDF69C:This eventually slows to 1.33 HP/s when debuffed for an extended time period] [c/CDF69C:Standing still provides +2 HP/s life regen and faster natural regen recovery] @@ -1527,15 +1529,6 @@ RuinMedallion: { ''' } -RustyMedallion: { - DisplayName: Rusty Medallion - Tooltip: - ''' - Causes most ranged weapons to release acid droplets from the sky - Grants immunity to Irradiated - ''' -} - SandCloak: { DisplayName: Sand Cloak Tooltip: @@ -1556,6 +1549,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: @@ -1876,7 +1880,7 @@ TheAmalgam: { Tooltip: ''' 10% increased damage - All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3.5x + All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3x Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds @@ -1916,7 +1920,7 @@ TheCommunity: { ''' [STATS] 'The heart of (most of) the Terraria community' - [c/B00BA5:Thank you to all of my supporters who made this mod a reality!] + Thank you to all of our supporters who made this mod a reality! ''' StatsList: ''' @@ -2146,11 +2150,6 @@ AbandonedWulfrumHelmet: { ''' } -CrystalHeartVodka: { - DisplayName: Crystal Heart Vodka - Tooltip: "'Tastes like strawberry cream liqueur (and estrogen)'" -} - GhostBracelet: { DisplayName: Ghost Bracelet Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity @@ -2208,7 +2207,7 @@ XyksBlessingBlue: { DisplayName: Xyk's Blessing (Blue) Tooltip: ''' - Applies visual effects to your dashes and deaths + Applies visual effects to your dashes, wings, and deaths to transform 'It's simply too much to turn back now; passion and time have long since stained it. [c/5f8ae1:Have I always been so selfish?'] @@ -2219,7 +2218,7 @@ XyksBlessingOrange: { DisplayName: Xyk's Blessing (Orange) Tooltip: ''' - Applies visual effects to your dashes and deaths + Applies visual effects to your dashes, wings, and deaths to transform 'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world. [c/E1B65F:Prove that it was never a waste.'] diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 08fb1ba71e..23e2a20942 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -61,18 +61,6 @@ BrimflameScowl: { ''' } -CirrusDress: { - DisplayName: Cirrus' Dress - Tooltip: - ''' - 5% increased magic damage and critical strike chance - 20% decreased movement speed and increases maximum fall speed to 61 mph - Allows for drinking 5 alcohols before your liver is poisoned - [c/B00BA5:'Here, this should help you drink a lot more than usual!'] - 'You feel thick...' - ''' -} - DaedalusBreastplate: { DisplayName: Daedalus Breastplate Tooltip: 3% increased damage and critical strike chance diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index acf38e0bb2..3f5b3eb4a3 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -328,7 +328,7 @@ EmpyreanMask: { 9% increased rogue damage and velocity +115 maximum stealth Rogue projectiles have special effects on enemy hits - Imbued with cosmic wrath and rage when you are damaged + Imbued with cosmic wrath when you are damaged ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index 0b2be8b795..670ed554a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -83,11 +83,6 @@ PearlpodItem: { Tooltip: "" } -PearlpodGoldItem: { - DisplayName: "{$NPCs.PearlpodGold.DisplayName}" - Tooltip: "" -} - PearlpodPinkItem: { DisplayName: Pink Pearlpod Tooltip: "" @@ -396,11 +391,6 @@ LegendaryShortTooltip: [c/BABABA:Press "Left Shift" to listen closer] ''' -AlicornonaStick: { - DisplayName: Alicorn on a Stick - Tooltip: "'Congratulations, you're winner! Here's my head on a stick.'" -} - BallAndChain: { DisplayName: Ball and Chain Tooltip: @@ -420,6 +410,11 @@ BrimstoneLocus: { ''' } +ColdheartIcicle: { + DisplayName: Coldheart Icicle + Tooltip: "'N(ice) work'" +} + MomentumCapacitor: { DisplayName: Momentum Capacitor GFBName: Burden Breaker diff --git a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson index 609f6d8a11..bedd4c182b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson @@ -53,15 +53,6 @@ OnyxExcavatorKey: { ''' } -PrincessSpiritinaBottle: { - DisplayName: Princess Spirit in a Bottle - Tooltip: - ''' - Summons the spirit of Cirrus, the Drunk Princess, in her alicorn form - Mounting will transform Cirrus, dismounting transforms her back - ''' -} - SuspiciousLookingJellyBean: { DisplayName: Suspicious Looking Jelly Bean Tooltip: JELLY BEAN diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index afef9d3c6a..cf192272c0 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -517,11 +517,6 @@ CalamityCanvas2024: { ''' } -CirrusCouch: { - DisplayName: Cirrus Couch - Tooltip: This shouldn't exist... -} - AquaticScourgeRelic: { DisplayName: Aquatic Scourge Relic Tooltip: A glimpse into what could have been... @@ -938,7 +933,7 @@ ResilientCandle: { ''' when placed to make defense block {0}% more damage ({1}% in Classic, {2}% in Expert, and {3}% in Master) - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'Neither rain nor wind can snuff its undying flame' ''' } @@ -959,7 +954,7 @@ SpitefulCandle: { ''' when placed to deal {0}x damage to all enemies The extra {1}x damage bypasses enemy defense and damage reduction - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'Its hateful glow flickers with ire' ''' } @@ -1200,7 +1195,7 @@ VigorousCandle: { ''' when placed to regenerate {0}% of your maximum health per second This regeneration is at full power even while moving and bypasses Revengeance Mode caps - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'Its brilliant light suffuses those nearby with hope' ''' } @@ -1210,7 +1205,7 @@ WeightlessCandle: { Tooltip: ''' when placed to gain {0}% increased movement speed, wing time and acceleration - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'The floating flame seems to uplift your very spirit' ''' } @@ -4329,3 +4324,13 @@ EutrophicGlassWall: { DisplayName: Eutrophic Glass Wall Tooltip: "" } + +Dreadstone: { + DisplayName: Dreadstone + Tooltip: "" +} + +OldDukeMonolith: { + DisplayName: Elden Diorama + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 051ecad1a8..52367ac720 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -60,15 +60,6 @@ DeliciousMeat: { ''' } -Fabsoup: { - DisplayName: Pot of Pain - Tooltip: - ''' - {$CommonItemTooltip.MajorStats} - 'hrngh, soup' - ''' -} - FlaskOfBrimstone: { DisplayName: Flask of Brimstone Tooltip: Melee, Whip, and Rogue attacks inflict {$Buffs.BrimstoneFlames.DisplayName} @@ -99,6 +90,15 @@ HadalStew: { ''' } +LavaChickenBroth: { + DisplayName: Lava Chicken Broth + Tooltip: + ''' + {$CommonItemTooltip.MajorStats} + 'It's tasty as hell' + ''' +} + OmegaHealingPotion: { DisplayName: Omega Healing Potion Tooltip: "" @@ -158,7 +158,7 @@ ZergPotion: { Tooltip: Vastly increases enemy spawn rate } -// Drunk Princess Shop Items +// Very normal Keg crafts BloodyMary: { DisplayName: Bloody Mary Tooltip: @@ -166,7 +166,6 @@ BloodyMary: { {0}% increased damage and movement speed during a Blood Moon Reduces life regen by {1} HP/s and defense by {2}% {$Common.AlcoholWarning} - [c/B00BA5:'Extra spicy... and bloody!'] ''' } @@ -177,7 +176,6 @@ CaribbeanRum: { Increases life regen by {0} HP/s, movement speed by {1}% Makes you floaty and reduces defense by {2}% {$Common.AlcoholWarning} - [c/B00BA5:'Why is the rum gone?'] ''' } @@ -188,18 +186,16 @@ CinnamonRoll: { Multiplies all fire-based debuff damage by {0}x and increases mana regeneration Reduces defense by {1}% {$Common.AlcoholWarning} - [c/B00BA5:'A great-tasting cinnamon whiskey with a touch of cream soda.'] ''' } -CirrusVodka: { - DisplayName: Cirrus' Vodka +PurpleHaze: { + DisplayName: purpleHaze Tooltip: ''' {0}% increased damage, but lowers defense by {1}% Increases immune time after being struck {$Common.AlcoholWarning} - This magical liquor is highly sought by those with a refined palate ''' } @@ -211,7 +207,6 @@ Everclear: { Reduces life regen by {1} HP/s and defense by {2}% Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} {$Common.AlcoholWarning} - [c/B00BA5:'This is the most potent booze I have, be careful with it.'] ''' } @@ -222,7 +217,6 @@ EvergreenGin: { Multiplies all sickness and water-related debuff damage by {0}x Reduces life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'It tastes like a Christmas tree, if you can imagine that.'] ''' } @@ -233,7 +227,6 @@ Fireball: { Multiplies all fire-based debuff damage by {0}x Reduces life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'A great-tasting cinnamon whiskey.'] ''' } @@ -243,7 +236,6 @@ GrapeBeer: { ''' Reduces defense by {0}% for {1} seconds {$Common.AlcoholWarning} - [c/B00BA5:'This crap is abhorrent, but you might like it.'] ''' } @@ -254,7 +246,6 @@ Margarita: { Halves the duration of most harmful debuffs Reduces defense by {0}% and life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'One of the best drinks ever created, enjoy it while it lasts.'] {$CommonItemTooltip.MinuteDuration@2} ''' } @@ -266,7 +257,6 @@ Moonshine: { Increases defense by {0} and damage reduction by {1}% Reduces life regen by {2} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'This stuff is pretty strong, but I'm sure you can handle it.'] ''' } @@ -277,7 +267,6 @@ MoscowMule: { Increases damage by {0}%, knockback by {1}% and critical strike chance by {2}% Reduces life regen by {3} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'I once heard the copper mug can be toxic and I told 'em, 'listen, dummy, I'm already poisoning myself!''] ''' } @@ -299,7 +288,6 @@ OldFashioned: { Multiplies most non-weapon, non-debuff damage by {0}x Multiplies all weapon damage by {1}x {$Common.AlcoholWarning} - [c/B00BA5:'An old favorite of mine.'] ''' } @@ -309,7 +297,6 @@ RedWine: { ''' Reduces life regen by {0} HP/s for {1} seconds {$Common.AlcoholWarning} - [c/B00BA5:'Too dry for my taste.'] ''' } @@ -320,7 +307,6 @@ Rum: { Increases life regen by {0} HP/s and movement speed by {1}% Reduces defense by {2}% {$Common.AlcoholWarning} - [c/B00BA5:'Sweet and potent, just how I like it.'] ''' } @@ -331,7 +317,6 @@ Screwdriver: { Multiplies piercing projectile damage by {0}x Reduces life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'Do you have a screw loose?'] ''' } @@ -343,7 +328,6 @@ StarBeamRye: { and reduces mana usage by {2}% Reduces defense by {3}% and life regen by {4} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'Made from some stuff I found near the Astral Meteor crash site. Don't worry, it's safe, trust me...'] ''' } @@ -354,7 +338,6 @@ Tequila: { Increases knockback by {0}%, crit chance by {1}% and defense by {2} during daytime Reduces life regen by {3} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'Great for mixing up daytime drinks.'] ''' } @@ -365,7 +348,6 @@ TequilaSunrise: { Increases knockback by {0}%, crit chance by {1}% and defense by {2} during daytime Reduces life regen by {3} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'The greatest daytime drink I've ever had.'] ''' } @@ -376,7 +358,6 @@ Vodka: { Increases damage by {0}% and critical strike chance by {1}% Reduces life regen by {2} HP/s and defense by {3}% {$Common.AlcoholWarning} - [c/B00BA5:'The number one alcohol for creating great mixed drinks.'] ''' } @@ -387,7 +368,6 @@ Whiskey: { Increases damage by {0}%, knockback by {1}% and critical strike chance by {2}% Reduces defense by {3}% {$Common.AlcoholWarning} - [c/B00BA5:'The burning sensation makes it tastier.'] ''' } @@ -398,7 +378,6 @@ WhiteWine: { Increases magic damage by {0}% Reduces defense by {1}% and life regen by {2} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 8886653a5d..427c9585ef 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -250,11 +250,6 @@ DeathValleyDuster: { ''' } -DivineRetribution: { - DisplayName: Divine Retribution - Tooltip: Mage is superior to rogue; look, we got a donor weapon to prove it! -} - Downpour: { DisplayName: Downpour Tooltip: @@ -313,11 +308,6 @@ EvergladeSpray: { Tooltip: Fires a stream of burning green ichor } -Fabstaff: { - DisplayName: Fabstaff - Tooltip: Casts a bouncing beam that splits when enemies are near it -} - FaceMelter: { DisplayName: Face Melter Tooltip: @@ -861,6 +851,15 @@ SubsumingVortex: { ''' } +Sylvestaff: { + DisplayName: Sylvestaff + Tooltip: + ''' + Casts a bouncing beam that splits when enemies are near it + 'Also known as the Karma Staff!' + ''' +} + TacticiansTrumpCard: { DisplayName: Tactician's Trump Card Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 20691f070f..223e79060f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -135,16 +135,6 @@ Avalanche: { ''' } -Azathoth: { - DisplayName: Azathoth - Tooltip: - ''' - {$Common.YoyoStatsInfinite} - Fires cosmic orbs that blast nearby enemies with lasers - 'Destroy the universe in the blink of an eye' - ''' -} - BalefulHarvester: { DisplayName: Baleful Harvester Tooltip: @@ -974,6 +964,16 @@ Orderbringer: { ''' } +Ozzathoth: { + DisplayName: Ozzathoth + Tooltip: + ''' + {$Common.YoyoStatsInfinite} + Fires cosmic orbs that blast nearby enemies with lasers + 'Destroy the universe in the blink of an eye' + ''' +} + Pandemic: { DisplayName: Pandemic Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 1350fd856a..319dace1d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -398,15 +398,6 @@ DeepcoreGK2: { ''' } -DodusHandcannon: { - DisplayName: Dodu's Handcannon - Tooltip: - ''' - Fires high explosive peanut shells, literally - 'The power of the nut rests in your hands' - ''' -} - DragonsBreath: { DisplayName: Dragon's Breath Tooltip: @@ -1249,17 +1240,14 @@ SuperradiantSlaughterer: { MainInfo: ''' Hold to rev up an elemental buzzsaw that deals close-range damage - Release to fire the buzzsaw to pierce through and lacerate foes - Fired buzzsaws bounce off tiles and return to the player after winding down - When returning, the saws release extra homing bolts depending on the number of enemy and tile hits - Revving up the saws increases their damage and allows them to pierce more enemies + Release to fire the buzzsaw which bounces off tiles, releasing homing bolts when returning depending on hits + Revving up the saw increases its damage and allows it to pierce more enemies ''' AltInfo: ''' - Press to eject a lingering buzzsaw towards the cursor that fires homing bolts - Using this ability rapidly propels you in the direction you are moving - This ability has a {0} second cooldown - During this cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning + Press to eject a lingering buzzsaw towards the cursor on a {0} second cooldown + Double to rapidly propel yourself in the direction you are moving + During the cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 7274743e98..2037158363 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -504,8 +504,8 @@ Glaive: { DisplayName: Glaive Tooltip: ''' - Tosses up to 3 sharp returning glaives - Stealth strikes are super fast and pierce infinitely + Tosses a very fast and sharp returning glaive + Stealth strikes are faster and can ricochet between enemies, or stick into a single enemy ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 5af63cdf49..e7cde29eeb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -69,15 +69,3 @@ StarStruckWater: { DisplayName: Star Struck Water Tooltip: Spreads the Astral Infection to some blocks } - -YanmeisKnife: { - DisplayName: Yanmei's Knife - Tooltip: - ''' - Enemies you hit are crippled - Hits will also give you {0}% increased movement speed and damage for {1} seconds - 'A knife from an unknown world - An owner whose heart is pure and free of taint - A heart of iron and valor' - ''' -} 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.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 41ed31356c..88ed6fb8e1 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -189,12 +189,7 @@ Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater ShockstormShuttle.DisplayName: Shockstorm Shuttle Shroomble.DisplayName: Shroomble -SkeletronOmega.DisplayName: Skeletron Omega -OmegaSaw.DisplayName: Omega Saw -OmegaLaser.DisplayName: Omega Laser -SkeletronPrime2.DisplayName: Skeletron Alpha -AlphaVice.DisplayName: Alpha Vice -AlphaCannon.DisplayName: Alpha Cannon +SkeletronPrime2.DisplayName: Skeletron Prime Stormlion.DisplayName: Stormlion StormlionSentry.DisplayName: Stormlion Sentry Sunskater.DisplayName: Sunskater @@ -289,7 +284,6 @@ LazarusLampfish.DisplayName: Lazarus Lampfish Leerslug.DisplayName: Leerslug LostShoal.DisplayName: Lost Shoal PearlpodBlack.DisplayName: Pearlpod -PearlpodGold.DisplayName: Gold Pearlpod PearlpodPink.DisplayName: Pearlpod PearlpodWhite.DisplayName: Pearlpod PodobooKoi.DisplayName: Podoboo Koi @@ -317,7 +311,7 @@ BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker SupremeCalamitas.DisplayName: Supreme Witch, Calamitas -SupremeCirrus: Supreme Alchemist, Cirrus +SupremePermafrost: Supreme Ultramage, Permafrost SupremeCataclysm.DisplayName: Cataclysm SupremeCatastrophe.DisplayName: Catastrophe Yharon.DisplayName: Yharon, Dragon of Rebirth @@ -404,7 +398,6 @@ Bandit: { Night1: Hm, the stars are too bright tonight. Makes sneaking around a little more difficult. Night2: You think those stars that fall occasionally would make good throwing weapons? BrimstoneWitch: Hey, hey, has {0} seriously moved in here with us? Why??? - DrunkPrincess: I learned never to steal {0}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding. Merchant: Don't tell {0}, but I took some of his stuff and replaced it with Angel Statues. NurseArmsDealer: Don't tell {0} that I was responsible for {1}'s injuries. NamedLaura: The nice thing about maps is I can track anything that has fallen. @@ -463,12 +456,13 @@ BrimstoneWitch: { BloodMoon2: I can't work with nights like these. The stars seem to have shrunk away in fear. Night1: These undead are horrific, I can't stand to look at them. How could anyone be satisfied with such amateur work? Night2: I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby of mine once. - DrunkPrincess: I wonder if {0} ever feels cold given how revealing her dress is. Perhaps she should cover up a bit more. SeaKing: I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion I just can't understand. Party: If another person asks me if I can dance or not, I will light their hat on fire. } EnchantButton: Enchant + DonorButton: Donors + DonorShoutout: Hey {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23} and {24}. You guys are good people. TownNPCMood: { Content: I can't complain, really. @@ -487,118 +481,6 @@ BrimstoneWitch: { } } -Cirrus: { - DisplayName: Drunk Princess - Census.SpawnCondition: Have {$Items.Potions.CirrusVodka.DisplayName} [i:CalamityMod/CirrusVodka] in your inventory in Hardmode or defeat Calamitas Clone/Plantera - Name.Cirrus: Cirrus - - Chat: { - BossAlive: Why are you talking to me right now? Shouldn't you be bumbling about and dying for my amusement? - BossAliveAlt: You must be joking! Get back out there and FINISH THE FIGHT! - Homeless1: I could smell my vodka from MILES away! - Homeless2: Have any spare rooms available? Preferably candle-lit with a hefty supply of booze? - BloodMoon1: I'm gonna make some Bloody Marys to relax, celery included. Want one? - BloodMoon2: If you're too lazy to craft potions normally, try Blood Orbs. Blood is fuel, dumbass. - BloodMoon3: I'm trying to not be bitchy tonight, but it's hard when everyone else won't shut up. - BloodMoonSlap1: Sorry, I have no moral compass at the moment. - BloodMoonSlap2: I could slap you... but you've done more for me than most. What do you need? - Normal1: What do you want this time? I have an appointment to get my nails done in 5 minutes, make it quick. - Normal1Alt: Whaddya need? I have candles and alcohols galore! - Normal2: Maybe you should drink something that turns you into a magical flying unicorn, so you can be just like me. - Normal2Alt: Sometimes, I think about returning to nature for a while, to escape from all of this chaos. - Normal3: Deals so good I'll [$$!$] myself! ...Sorry, I may have just had a minor stroke! - Normal3Alt: I've been thinking more about the future lately. I can't say I'm not worried, but I'll be trying my best to make it better. - Normal4: Did anyone ever tell you that large assets cause back pain? Well, they were right. - Normal4Alt: Do you have any idea how much extra money I make so {0} can afford her super-fancy hair products? Heh, the back pain is worth it. - Archmage: "{0} can share a drink with me any time! ...Or maybe not, I'm not sure his old heart could take it." - BrimstoneWitch: The abuse {0} endured is something I can scarcely comprehend. I'd offer her a drink, but I don't think she'd enjoy it. - Tavernkeep1: My booze will always be better than {0}'s, and nobody can convince me otherwise. - Tavernkeep2: Tell {0} to stop calling me. He's not wanted. - Tavernkeep3: I've had to tell baldie where my eyes are so many times that I've lost count. - Stylist1: Ever since {0} moved in I haven't been drinking as much... a strange, but not unwelcome, feeling. - Stylist1Alt: I've stopped drinking almost entirely, thanks to {0} and... you. Thank you, for making this world a safer place. - Stylist2: You can't stop me from trying to move in with {0}. - Stylist2Alt: If you have {0} and I housed in one of those so-called 'NPC prisons'... we WILL find you, and we WILL bring the scissors... - Stylist3: I love it when {0}'s hands get sticky from all that... wax. - Stylist3Alt: "{0} and I will be building wax figures tonight. And no, there's nothing weird about that." - Day1: I'm literally balls drunk off my sass right now, what do you want? - Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? - Day2: I'm either laughing because I'm drunk or because I've lost my mind, probably both. - Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them suit me. - Day3: When I'm drunk I'm way happier... at least until the talking worms start to appear. - Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. - Day4: I should go fishing... while drunk, and jump into the ocean to spare myself {0}'s annoying naivety... - Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. - DayStylist1: "{0} helped me accept my past. It's been tough, but I think I'm on the right path now." - DayStylist2: Might go out for a jog later with {0}. Nice day for it. - DayDrunk1: I drink to forget... What am I trying to forget, you might ask? Well, the point is to FORGET, not RECALL, isn't it? - DayDrunk2: What a great day! Might just drink so much that I get poisoned again. - Night1: A perfect night to light some candles, drink some wine, and relax. - Night2: Here's a challenge, take a shot for every time you've had to use the wiki. Oh wait, you'd die. - Night2Alt: There's more to life than challenge, y'know. Be sure to sit back and treat yourself once in a while. - Night3: You lost or something? I don't mind company, but I'd rather be left alone at night. - Night3Alt: I do love gazing at the stars. You could join me, if you like. - Night4: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. - NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks. - Party: You'll always find me at parties where booze is involved... well, you'll always find BOOZE where I'M involved! - PartyAlt: Y'know... this is fun and all, but I can't wait for the festivities to be over. - AcidRain: I'm melting! Put a stop to this inclement weather before it ruins my hair! - Martians: You should probably deal with those 'ayy lmaos' before doing anything else, but whatever. - CryogenDefeated: God, I can't wait to smash some ice again! ...For drinks, of course. - LeviathanDefeated: How could you murder such a beautiful creature!? ...The blue one, not the obese cucumber. - MoonLordDefeated: Ever wondered why the Moon Lord needed so many tentacles? Uhm... on second thought, I won't answer that. - PolterghastDefeated: I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads... frightening times those were. - DoGDefeated: I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61! - HasChibii: The hell is that? Looks like something I'd carry around if I was 5 years old. - HasChibiiAlt: I won't judge you for having that creature in tow... but keep it the hell away from me. - HasAnahitaTrans: Nice scales... Is it hot in here, or is it just me? - HasVodka: Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat, and other magical crap. - HasAlicorn1: So... you found my special bottle. Hope you enjoy it, I know I will. - HasAlicorn2: Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean, offer you excellent deals you won't find anywhere else, if you're riding me 24/7. - HasAlicorn3: Before you ask, no, I do NOT have a heart on my butt while in human form. Don't question my transformation preferences! - NewOutfit: It's so refreshing to finally wear something else. I still love my dress, of course, but it's not exactly ideal for exercising. - } - - // Death Count stuffs - DeathCountButton: Death Count + Donors - DeathCount: You have failed {0} {^0:time;times}. - Death10000: Congratulations! You are now, officially, the biggest loser in Terraria's history! - Death5000: I'm not sure what to say this time... perhaps, that you're bad and should feel bad? - Death2500: I could dodge better than you even if I was blackout drunk. - Death1000: It is said that the average Terrarian has a lifespan of 2 minutes or less... well, not really, but I feel like you'd be part of that statistic. - Death500: Your inability to avoid dying to even the most basic of attacks is astonishing to me. - Death250: I admire your tenacity. Keep it up, your enemies are racking up quite the kill count! - Death100: Consider lowering the difficulty. If you found that statement irritating, good. - DonorShoutout: Hey {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23} and {24}! You're all pretty good! - - TownNPCMood: { - Content: It's 5 o'clock somewhere. - NoHome: I need a place to crash! My drinks MUST be properly cooled before they can be served! - LoveSpace: Finally, some peace and quiet. Large quantities of people tend to piss me off. - FarFromHome: Don't get me wrong, I'm used to running away from home, but this is a little ridiculous. - DislikeCrowded: If one more person tells me 'it's happy hour somewhere', I'm going to snap! - HateCrowded: No amount of alcohol can drown out the noise these people make! - LoveBiome: Other unicorns? I never thought I'd see the day... this place is incredible! - LikeBiome: Ah, a soothing breeze and a gorgeous view; a great way to calm some of my more 'unpleasant' patrons. - DislikeBiome: This dry air and heat isn't good for my hair, or my drinks. - HateBiome: You think I can fix this place with a magical friendship rainbow? That's not how it works, so get me out of here already! - LoveNPC_Stylist: "{NPCName} works wonders for my hair... among other things, hehe." - LoveNPC_BestiaryGirl: "{NPCName} is so fluffy and squishy! She also says my alicorn form is 'mega rad'." - LikeNPC_DyeTrader: I tried inviting {NPCName} over for drinks a while back, but he didn't seem interested... oh well, his loss. - LikeNPC_PartyGirl: "{NPCName} would make for a great bartender some day. She really knows how to liven the mood!" - DislikeNPC_DD2Bartender: "{NPCName} is so bald. The sheen reflecting off his dome could legit blind someone, like, oh my god." - DislikeNPC_TaxCollector: "{NPCName} had best keep his distance... he wouldn't want to wake up one morning with a pipe bomb in his mailbox." - HateNPC_GoblinTinkerer: "{NPCName} was so terrible that I had to FORCE him to stop ripping off his customers... why would you house me next to him!?" - HateNPC_Angler: "{NPCName} never stops blabbering about his inane fishing quests. Get me away from him before I punt him into the sulphurous sea!" - LikeNPC_Princess: You think I'd dislike {NPCName} because we're too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks, of course. - Princess_LovesNPC: "{NPCName} has some fascinating stories to tell, I've learned quite a lot from her already." - HateNPC: I hate {NPCName}. - DislikeNPC: I dislike {NPCName}. - LikeNPC: I like {NPCName}. - LoveNPC: I love {NPCName}. - } -} - SeaKing: { DisplayName: Sea King Census.SpawnCondition: Defeat a Giant Clam after defeating the Desert Scourge @@ -614,10 +496,8 @@ SeaKing: { Night1: There lurk horrifying creatures beyond the light of our homes. You should take care. Night2: My eyes are not well suited to bright lights after so many years of darkness. The peace of the night is welcome. Night3: Oh, me? I do not sleep, it is part of my nature. - Angler1: Meet me at {0}'s house at night. We will throw him to the Trashers. - Angler2: Not sure how {0} has not been roasted and digested by now, hanging around the sulphuric seas for so long. Perhaps it got to his head. + Angler: Not sure how {0} has not been roasted and digested by now, hanging around the sulphuric seas for so long. Perhaps it got to his head. BrimstoneWitch: I must admit, the Witch's presence is unsettling to me. But so many years have passed, and she too has suffered much. - DrunkPrincess: Rumor has it {0} drinks to forget her troubled past. PartyGirl: "{0} asked if my nose could be used as a vuvuzela. What is a vuvuzela?" BloodMoon1: Since ancient times people have said that deities cause celestial events. Which one then, is the cause for these? BloodMoon2: I've never been keen on these nights. Such violence. diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index 2171aaeb0e..7947c1ccf2 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -36,11 +36,6 @@ BrimstoneTargetRay.DisplayName: Brimstone Target Ray BrimstoneWave.DisplayName: Brimstone Flame Skull BrokenApolloLens.DisplayName: Lens BrokenArtemisLens.DisplayName: Lens -CirrusBlast.DisplayName: Cirrus Mushroom Blast -CirrusBlaster.DisplayName: Cirrus Mushroom -CirrusPhotonRipperPrismTooth.DisplayName: Cirrus Photon Ripper Tooth -CirrusPhotonRipperProjectile.DisplayName: Cirrus Photon Ripper -CirrusVolatileVodkaBottle.DisplayName: Volatile Vodka Bottle CrimulanSpike.DisplayName: Crimulan Spike CursedFire.DisplayName: Eye Fire DarkEnergyBall.DisplayName: Dark Energy @@ -111,6 +106,11 @@ OldDukeToothBallSpike.DisplayName: Spike OldDukeVortex.DisplayName: Sulphurous Vortex OverlyDramaticDukeSummoner.DisplayName: Old Duke Summoner PeanutRocket.DisplayName: High Explosive Peanut Shell +PermafrostAbsoluteZeroProjectile.DisplayName: Absolute Ultra Zero +PermafrostBlast.DisplayName: Permafrost's Gigablast +PermafrostBlaster.DisplayName: Blaster of Unlimited Air Conditioning +PermafrostColdheartIcicle.DisplayName: Coldheart Icicle +PermafrostMeat.DisplayName: Cool Meat PhantomBlast.DisplayName: Phantom Blast PhantomBlast2.DisplayName: Potent Phantom Blast PhantomGhostShot.DisplayName: Potent Phantom Spirit Shot diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 22e87af2d1..36587fad27 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -53,7 +53,6 @@ DarkSparkBeam.DisplayName: Dark Spark Beam DarkSparkPrism.DisplayName: Dark Crystal DeathhailBeam.DisplayName: Deathhail DeathValleyDusterProjectile.DisplayName: Death Valley Duster -DivineRetributionSpear.DisplayName: Divine Retribution EelDrop.DisplayName: Acid Eel Drop EidolicWailSoundwave.DisplayName: Eidolic Wail EldritchTentacle.DisplayName: Eldritch Tentacle @@ -67,8 +66,6 @@ EventHorizonStar.DisplayName: Event Horizon Star EvergladeSprayProjectile.DisplayName: Everglade Spray ExoVortex.DisplayName: Subsuming Vortex ExoVortex2.DisplayName: Subsuming Vortex -FabBolt.DisplayName: Fab Bolt -FabRay.DisplayName: Fab Ray FatesRevealFlame.DisplayName: Fate's Reveal FireImplosion.DisplayName: Swirling Backdraft FlareBoltProjectile.DisplayName: Flare Bolt @@ -217,6 +214,8 @@ SpiritDust.DisplayName: Spirit Dust Starblast.DisplayName: Star StardustElementalBeam.DisplayName: Stardust Beam StickyFeather.DisplayName: Feather +SylveBolt.DisplayName: Sylv Bolt +SylveRay.DisplayName: Sylv Ray TacticiansElectricBoom.DisplayName: Electric Explosion TacticiansTrumpCardProj.DisplayName: Trump Beam TearsofHeavenProjectile.DisplayName: Tears of Heaven @@ -263,3 +262,5 @@ WyvernProjectile.DisplayName: Wyvern YharimsCrystalBeam.DisplayName: Yharim's Beam YharimsCrystalPrism.DisplayName: Yermes Christal FleshTotemMinion.DisplayName: Flesh Totem Minion +SylvBolt.DisplayName: Sylv Bolt +SylvRay.DisplayName: Sylv Ray diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index f1b18a5670..5533381a9d 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -99,7 +99,6 @@ GodSlayerSlugProj.DisplayName: God Slayer Slug HalleysComet.DisplayName: Halley's Comet HandheldTankShell.DisplayName: Tank Shell HeavenlyGaleProj.DisplayName: Heavenly Gale -HighExplosivePeanutShell.DisplayName: High Explosive Peanut Shell HiveMissile.DisplayName: Hive Missile HiveNuke.DisplayName: Hive Nuke HolyFireBulletProj.DisplayName: Holy Fire Bullet diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index ec59c3406c..b13780d0a6 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -155,9 +155,9 @@ WulfrumBobber.DisplayName: Wulfrum Bobber WulfrumDiggingTurtleProjectile.DisplayName: Digging Turtle WulfrumHook.DisplayName: Wulfrum Slingshot WulfrumLureSignal.DisplayName: Signal -YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism 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/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson index 05300a04a6..474e9bf5e0 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson @@ -105,20 +105,20 @@ SCalDesparationText1Rematch: A terrific display, I concede this match to you. SCalDesparationText2Rematch: No doubt you will face enemies stronger than I. SCalDesparationText3Rematch: I trust you will not make the same mistakes he did. SCalDesparationText4Rematch: I can't imagine what your future holds now. -// Cirrus (GFB) -CirrusSummonText: Are you prepared for a task most Sisyphean? -CirrusBirbSwarmText: Those hearts are a bit too edgy. How about a swarm of birbs instead? -CirrusBH2Text: Feelin' thirsty? I can fix that! -CirrusBH3Text: Check out this cool toy I found! -CirrusDoGText: I told you the talking worms were real! But you didn't believe me! -CirrusPhase2Text: Time for a transformation! -CirrusBH4Text: It's HAGE time! -CirrusHallowBossSpamText: I have more friends than you could possibly imagine! -CirrusBH5Text: Hah! You're good, but I'm better! -CirrusSecondBirbSwarmText: Time for another swarm! -CirrusNonchalantText: I'm getting tired... -CirrusBruhText: Just kidding! Time for my special attack! -CirrusGiveUpText: Meh, whatever, I'm a bit tired of this. +// Permafrost (GFB) +PermafrostSummonText: Are you prepared for a task most Sisyphean? +PermafrostBirbSwarmText: Those hearts were a bit too brutal for my taste. How about some lovely birds instead? +PermafrostBH2Text: Getting tired from the battle, adventurer? Hungry? How does some Delicious Meat sound? +PermafrostBH3Text: Suprised at how I am holding my own again you? I did train Calamitas, after all! +PermafrostDoGText: The serpent!? How!? What is HE doing here!? Is he here to torment me further!? Kill it, adventurer! +PermafrostPhase2Text: Ha! I suppose I can no longer be "chill" about this duel! Get it? +PermafrostBH4Text: Need a break? Can you not even keep up with an old man? +PermafrostHallowBossSpamText: You truly have grown strong! Thankfully, I and Calamitas reconstructed this to assist me. +PermafrostBH5Text: Why, it has been quite long since I have had an excuse to use these magics! +PermafrostSecondBirbSwarmText: I must say, those birds earlier were rather cute! Do some more not sound nice? +PermafrostNonchalantText: I must say, I am not the mage I used to be. This is starting to tire my old body... +PermafrostBruhText: Ha! Just kidding! Watch what happens when I cast a spell I know! +PermafrostGiveUpText: Gah, I think I pulled a muscle! Ah, well. I seems that I must concede. Well fought! // April Fools AprilFools: The LORDE is approaching... AprilFoolsGFB: La Ruga is approaching... diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 472bb07020..60f47f43c5 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -46,8 +46,6 @@ ChaliceOfTheBloodGod18: "{0} was reduced to a dry husk by the Chalice of the Blo ChaliceOfTheBloodGodClose: "{0} almost made it. Almost." ChaliceOfTheBloodGodUnequip: "{0} violated their pact with the Blood God." ChibiiDoggo: "{0} couldn't stand the sharp objects." -CirrusSlap1: "{0} was slapped too hard." -CirrusSlap2: "{0} forked around and found out." CorpusAvertor: "{0} became the Blood God's sacrifice." CrushDepth1: "{0} was crushed by the pressure." CrushDepth2: "{0}'s lungs collapsed." diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 0691f76312..a3db5b2517 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -2,6 +2,7 @@ SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" // Main Menu Name MainMenu: Calamity Style MainMenuClassic: Calamity Style - Classic +MainMenuSunken: Calamity Style - Sunken // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines @@ -591,10 +592,12 @@ Lecherous: { Disenchant: Disenchant // Worldgen Tasks 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 diff --git a/MainMenu/CalamityMainMenu_Sunken.cs b/MainMenu/CalamityMainMenu_Sunken.cs new file mode 100644 index 0000000000..984ae491b6 --- /dev/null +++ b/MainMenu/CalamityMainMenu_Sunken.cs @@ -0,0 +1,358 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.MainMenu.SunkenFishBoid; + +namespace CalamityMod.MainMenu +{ + public class CalamityMainMenu_Sunken : ModMenu + { + public class Bubble + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float StoredScale; + public float Rotation; + public float RotationSpeed; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + + public Asset BubbleTexture; + + public Bubble(int lifetime, int identity, float depth, float storedScale, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + StoredScale = storedScale; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + + Rotation = Main.rand.NextFloat(MathF.Tau); + RotationSpeed = Main.rand.NextFloat(0.01f, 0.04f) * Main.rand.NextBool().ToDirectionInt(); + BubbleTexture = ModContent.Request("CalamityMod/Particles/Bubble"); + } + + public void Update() + { + // Sway from side to side. + Velocity.X = MathHelper.Lerp(-1f, 1f, CalamityUtils.SineBumpEasing((Time / 60f), 1)); + Scale = MathHelper.Lerp(StoredScale, 0f, Time / (float)Lifetime); + + // Rotate. + Rotation += RotationSpeed * MathHelper.TwoPi * 0.1f; + + Time++; + Center += Velocity; + } + + public void Draw(SpriteBatch spriteBatch) + { + Vector2 depthFactor = new(1f / Depth, 1.1f / Depth); + Vector2 parallaxedPosition = Center * depthFactor; + var scaleByDepth = Scale * Utils.Remap(Depth, 1, 5, 1f, 0.4f, true); + spriteBatch.Draw(BubbleTexture.Value, parallaxedPosition, null, DrawColor, Rotation, BubbleTexture.Value.Size() * 0.5f, scaleByDepth, 0, 0f); + } + } + + public static List Bubbles { get; private set; } = []; + + public static List Fishes { get; private set; } = []; + + public static Asset LogoWater => ModContent.Request("CalamityMod/MainMenu/LogoSunken_Water"); + + public int MaxBoids = 120; + + public float remixLogoRotation = 0f; + + /// + /// The global save data key which dictates whether or not the player is opening the Sunken Sea Overhaul update for the first time. + /// + public const string FirstTimeOpeningSunkenSeaOverhaulKey = "HasOpenedTheSunkenSeaOverhaulForTheFirstTime"; + + public override string DisplayName => CalamityUtils.GetTextValue("UI.MainMenuSunken"); + + public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/LogoSunken"); + + public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + + public override Asset MoonTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + + public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance(); + + public static void ForceMenuStyle() + { + // Forcefully open this ModMenu if it's the player's first time opening the Sunken Sea Overhaul update. + if (GlobalSaveDataSystem.IsKeyAlreadySaved(FirstTimeOpeningSunkenSeaOverhaulKey)) + return; + + FieldInfo menusInfo = typeof(MenuLoader).GetField("menus", BindingFlags.Static | BindingFlags.NonPublic); + List modMenus = (List)menusInfo.GetValue(null); + + var sunkenMenu = ModContent.GetInstance(); + if (modMenus.Contains(sunkenMenu)) + { + FieldInfo lastSelectedMenuInfo = typeof(MenuLoader).GetField("LastSelectedModMenu", BindingFlags.Static | BindingFlags.NonPublic); + int sunkenSeaMenuIndex = modMenus.IndexOf(sunkenMenu); + lastSelectedMenuInfo.SetValue(null, modMenus[sunkenSeaMenuIndex].FullName); + } + } + + public override void Update(bool isOnTitleScreen) + { + if (!GlobalSaveDataSystem.IsKeyAlreadySaved(FirstTimeOpeningSunkenSeaOverhaulKey)) + GlobalSaveDataSystem.SaveKey(FirstTimeOpeningSunkenSeaOverhaulKey); + } + + public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) + { + // Draw the main background for the menu. + DrawMenuBackground(spriteBatch); + + // Draw the fish boids passively swimming around the menu. + DrawFishes(spriteBatch); + + // Draw the bubbles rising from the bottom of the screen. + DrawBubbles(spriteBatch); + + // Draw the light rays at the top of the screen. + DrawLightRays(spriteBatch); + + // Draw the logo. + DrawLogo(spriteBatch, ref logoDrawCenter, ref logoRotation, ref logoScale, ref drawColor); + + return false; + } + + private void DrawMenuBackground(SpriteBatch spriteBatch) + { + Texture2D backgroundTexture = ModContent.Request("CalamityMod/MainMenu/SunkenMenuBackground").Value; + + // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor + Vector2 drawOffset = Vector2.Zero; + float xScale = (float)Main.screenWidth / backgroundTexture.Width; + float yScale = (float)Main.screenHeight / backgroundTexture.Height; + float scale = xScale; + + // if someone's monitor isn't in wacky dimensions, no calculations need to be performed at all + if (xScale != yScale) + { + // If someone's monitor is tall, it needs to be shifted to the left so that it's still centered on screen + // Additionally the Y scale is used so that it still covers the entire screen + if (yScale > xScale) + { + scale = yScale; + drawOffset.X -= (backgroundTexture.Width * scale - Main.screenWidth) * 0.5f; + } + else + // The opposite is true if someone's monitor is widescreen + drawOffset.Y -= (backgroundTexture.Height * scale - Main.screenHeight) * 0.5f; + } + + // Distort the background slightly to make it appear as if it's properly underwater. + MiscShaderData distortionShader = GameShaders.Misc["CalamityMod:BasicTextureDistortion"]; + Asset distortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Swirls"); + + spriteBatch.End(); // BLESS THIS. + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + + const float distortionXSpeed = -0.012f; + const float distortionYSpeed = 0.015f; + const float noiseScale = 0.75f; + const float noiseStrength = 0.02f; + Vector2 timeOffset = new Vector2(distortionXSpeed, distortionYSpeed) * Main.GlobalTimeWrappedHourly * noiseScale; + Vector2 noiseScaleStrength = new Vector2(noiseScale, noiseStrength); + distortionShader.Shader.Parameters["timeOffset"].SetValue(timeOffset); + distortionShader.Shader.Parameters["noiseScaleStrength"].SetValue(noiseScaleStrength); + distortionShader.SetShaderTexture(distortionTexture); + distortionShader.Apply(); + + spriteBatch.Draw(backgroundTexture, drawOffset, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + } + + private void DrawLightRays(SpriteBatch spriteBatch) + { + // Draw rays shining down from the top of the screen. + MiscShaderData underwaterRaysShader = GameShaders.Misc["CalamityMod:UnderwaterRays"]; + Asset underwaterRayTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Pebbles"); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + + underwaterRaysShader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + underwaterRaysShader.Shader.Parameters["fadeOutMargin"].SetValue(0.58f); + underwaterRaysShader.Shader.Parameters["overallOpacity"].SetValue(1f); + underwaterRaysShader.Shader.Parameters["pixelationAmount"].SetValue(Main.screenWidth * 0.5f); + underwaterRaysShader.Shader.Parameters["scrollSpeedX"].SetValue(0.013f); + underwaterRaysShader.Shader.Parameters["scrollSpeedY"].SetValue(0.006f); + underwaterRaysShader.Shader.Parameters["noiseScale"].SetValue(new Vector2(1.25f, 0.25f)); + underwaterRaysShader.Shader.Parameters["rayColor"].SetValue(Color.LightSkyBlue.ToVector3()); + underwaterRaysShader.Apply(); + + spriteBatch.Draw(underwaterRayTexture.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + } + + private void DrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) + { + // Set the logo draw color to be white and the time to be noon + // This is because there is not a day/night cycle in this menu, and changing colors would look bad + drawColor = Color.White; + Main.time = 27000; + Main.dayTime = true; + + // Adjust rotation based on secret seeds; only Drunk world and Remix touch this, with GFB leeching off those two + // Standard rotation is none; Drunk world makes it spin out, so it can use the vanilla rotation due to disappearing + // Remix makes it flip upside down, and in GFB it will spin forever + if (WorldGen.remixWorldGen) + { + remixLogoRotation += MathHelper.Pi / 50f; + if (remixLogoRotation >= MathHelper.Pi && !WorldGen.everythingWorldGen) + remixLogoRotation = MathHelper.Pi; + } + else + remixLogoRotation = 0f; + float rotationSecretSeedAdjusted = WorldGen.remixWorldGen ? remixLogoRotation : WorldGen.drunkWorldGen ? logoRotation : 0f; + + // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow + Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(LogoWater.Value, drawPos, null, new Color(255, 255, 255, 0.5f) * 0.7f, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + } + + private void DrawBubbles(SpriteBatch spriteBatch) + { + // Randomly add bubbles. + for (int i = 0; i < 3; i++) + { + if (Main.rand.NextBool(4)) + { + int lifetime = Main.rand.NextBool(5) ? Main.rand.Next(400, 500) : Main.rand.Next(200, 250); + float depth = Main.rand.NextFloat(1f, 5f); + float scale = Main.rand.NextFloat(0.2f, 0.8f); + Vector2 startingPosition = new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f) * depth; + Vector2 startingVelocity = -Vector2.UnitY.RotatedBy(Main.rand.NextFloat(-0.4f, 0.4f)) * 6f; + Color bubbleColor = Color.Lerp(SelectBubbleColor(), Color.White, 0.6f); + + Bubbles.Add(new Bubble(lifetime, Bubbles.Count, depth, scale, bubbleColor, startingPosition, startingVelocity)); + } + } + + // Update all bubbles. + for (int i = 0; i < Bubbles.Count; i++) + { + Bubbles[i].Update(); + + Bubbles[i].DrawColor.A = 180; + if (Bubbles[i].IdentityIndex % 13 == 12) + Bubbles[i].Scale *= 0.5f; + } + + // Clear away all dead bubbles. + Bubbles.RemoveAll(c => c.Time >= c.Lifetime); + + // Draw bubbles. + var bubblesByDepth = Bubbles.OrderByDescending(b => b.Depth).ToList(); + foreach (Bubble bubble in bubblesByDepth) + bubble.Draw(spriteBatch); + } + + /// + /// Selects a random color for the bubbles which rise from the bottom of the screen. + /// + private static Color SelectBubbleColor() + => Color.Lerp(Color.Lerp(Color.MediumSlateBlue, Color.DarkBlue, 0.3f), Color.Lerp(Color.MediumTurquoise, Color.PaleTurquoise, Main.rand.NextFloat()), Main.rand.NextFloat()); + + private void DrawFishes(SpriteBatch spriteBatch) + { + // Generate random fishes. + if (Main.rand.NextBool(14) && Fishes.Count < MaxBoids) + { + int schoolCount = Main.rand.Next(2, 9); + for (int i = 0; i < schoolCount; i++) + { + int depth = Main.rand.Next(1, 4); + int lifetime = Main.rand.Next(1200, 1800); + float scale = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 spawnPosition = new(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f) * depth, Main.screenHeight * Main.rand.NextFloat(-0.1f, 1.1f) * depth); + SunkenFishBoid fish = new(spawnPosition, scale, depth); + Fishes.Add(fish); + } + } + + // Remove fish when they are offscreen. + Rectangle outOfBoundsRectangle = new(-50, -50, Main.screenWidth + 100, Main.screenHeight + 100); + Fishes.RemoveAll(f => + { + Vector2 depthFactor = new(1f / f.Depth, 1.1f / f.Depth); + Vector2 parallaxedPosition = f.Position * depthFactor; + return !outOfBoundsRectangle.Contains((int)parallaxedPosition.X, (int)parallaxedPosition.Y); + }); + + // Update all fish. + for (int i = 0; i < Fishes.Count; i++) + { + // Alpha Sea Minnows and Prismatic Guppies can spawn in schools. + bool canSpawnSchool = Fishes[i].SelectedFishType == FishType.AlphaSeaMinnow || Fishes[i].IsAPrismaticGuppy; + if (canSpawnSchool && !Fishes[i].HasSpawnedSchool) + { + int fishCount = Main.rand.Next(3, 8); + for (int fishes = 0; fishes < fishCount; fishes++) + { + Vector2 spawnPosition = Fishes[i].Position + Main.rand.NextVector2Circular(50f, 50f) * Fishes[i].Depth; + float scale = Main.rand.NextFloat(0.8f, 1.2f); + FishType typeToSpawn = Fishes[i].IsAPrismaticGuppy ? (FishType)Main.rand.Next(3, 6) : FishType.SeaMinnow; + + SunkenFishBoid schoolingFish = new(spawnPosition, scale, Fishes[i].Depth, typeToSpawn) + { + HasSpawnedSchool = true + }; + + if (Fishes[i].SelectedFishType == FishType.AlphaSeaMinnow) + { + Fishes[i].SeaMinnowSchoolMembers.Add(schoolingFish); + schoolingFish.SeaMinnowSchoolMembers.Add(schoolingFish); + schoolingFish.SeaMinnowSchoolMembers.Add(Fishes[i]); + } + + Fishes.Add(schoolingFish); + } + + Fishes[i].HasSpawnedSchool = true; + } + + Fishes[i].Update(); + } + + // Draw all fish in an order based on their depth. + var fishesByDepth = Fishes.OrderByDescending(f => f.Depth).ToList(); + foreach (SunkenFishBoid fish in fishesByDepth) + fish.Draw(spriteBatch); + } + } +} diff --git a/MainMenu/LogoSunken.png b/MainMenu/LogoSunken.png new file mode 100644 index 0000000000..29f8b05cc2 Binary files /dev/null and b/MainMenu/LogoSunken.png differ diff --git a/MainMenu/LogoSunken_Water.png b/MainMenu/LogoSunken_Water.png new file mode 100644 index 0000000000..670fffe66b Binary files /dev/null and b/MainMenu/LogoSunken_Water.png differ diff --git a/MainMenu/SunkenFishBoid.cs b/MainMenu/SunkenFishBoid.cs new file mode 100644 index 0000000000..1dd3cfa715 --- /dev/null +++ b/MainMenu/SunkenFishBoid.cs @@ -0,0 +1,349 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.MainMenu +{ + public class SunkenFishBoid + { + // -- GENERAL VARIABLES FOR DEFINING GENERAL BEHAVIOR AND FUNCTIONALITY FOR THE FISH ENTITIES -- + + public enum FishType + { + SeaMinnow, + AlphaSeaMinnow, + PolypPanasea, + PrismaticGuppy1, + PrismaticGuppy2, + PrismaticGuppy3, + } + + public string[] SeaMinnowTextureNames = + [ + "SeaMinnow", + "AlphaSeaMinnow", + ]; + + public string[] PolypPanaseaTextureNames = + [ + "PolypPanasea", + "PolypPanaseaGreen", + "PolypPanaseaPurple", + "PolypPanaseaRadiant", + "PolypPanaseaTurquoise", + "PolypPanaseaGreenCoated", + "PolypPanaseaPurpleCoated", + "PolypPanaseaRadiantCoated", + "PolypPanaseaRedCoated", + "PolypPanaseaTurquoiseCoated", + ]; + + public string[] PrismaticGuppyTextureNames_1 = + [ + "PrismaticGuppy", + "PrismaticGuppyGreen", + "PrismaticGuppyPink", + "PrismaticGuppyRadiant", + ]; + + public string[] PrismaticGuppyTextureNames_2 = + [ + "PrismaticGuppy2", + "PrismaticGuppyGreen2", + "PrismaticGuppyPink2", + "PrismaticGuppyRadiant2", + ]; + + public string[] PrismaticGuppyTextureNames_3 = + [ + "PrismaticGuppy3", + "PrismaticGuppyGreen3", + "PrismaticGuppyPink3", + "PrismaticGuppyRadiant3", + ]; + + public int Time; + + public int Depth; + + public int CurrentFrame; + + public int MaxFrames; + + public int FrameSpeed; + + public Vector2 Position; + + public Vector2 Velocity; + + public Vector2 StretchFactor; + + public float Scale; + + public float StoredScale; + + public float Rotation; + + public float Opacity; + + public float PassiveMovementTimer; + + public Vector2 PassiveMovementVector; + + public float PassiveMovementSpeed; + + public float MaxSpeed_Default = 3f; + + public float MaxSpeed_SwimAwayFromCursor = 4.25f; + + public FishType SelectedFishType; + + public FishType? FishTypeOverride; + + public WeightedRandom RandomFishType = new(); + + public int FishTextureIndex = -1; + + public bool Initialized = false; + + public bool HasSpawnedSchool = false; + + public List SeaMinnowSchoolMembers = []; + + public Asset FishTexture; + + // -- BOID ALOGORITHM SPECIFIC VARIABLES -- + + // 19MAY2025: fryzahh: + // Coefficients to control how strongly each of the Boid Algos affect the movement of each boid. + // Higher values will lead to sharper flocking AI, but movement might be a little choppier. + // Please beware of this if you ever change these values. + public float CohesionCoefficient = 0.075f; + + public float AlignmentCoefficient = 0.12f; + + public float SeparationCoefficient = 0.03f; + + public float MaxRadiusFromOtherFish = 125f; + + public float MaxDetectionRadius = 200f; + + /// + /// Whether or not this fish boid is any of the Prismatic Guppy variants. Used for allowing Prismatic Guppies to school with each other. + /// + public bool IsAPrismaticGuppy => SelectedFishType == FishType.PrismaticGuppy1 || SelectedFishType == FishType.PrismaticGuppy2 || SelectedFishType == FishType.PrismaticGuppy3; + + /// + /// Whether or not this fish boid is any one of the Sea Minnow variants. Used for allowing Sea Minnows to school with Alphas properly. + /// + public bool IsASeaMinnow => SelectedFishType == FishType.SeaMinnow || SelectedFishType == FishType.AlphaSeaMinnow; + + public SunkenFishBoid(Vector2 position, float scale, int depth, FishType? fishTypeOverride = null) + { + Position = position; + StoredScale = scale; + Depth = depth; + FishTypeOverride = fishTypeOverride; + + FrameSpeed = Main.rand.Next(6, 11); + StretchFactor = Vector2.One; + RandomFishType.Add(FishType.AlphaSeaMinnow, 0.7f); + RandomFishType.Add(FishType.PolypPanasea, 0.6f); + RandomFishType.Add(FishType.PrismaticGuppy1, 0.1f); + RandomFishType.Add(FishType.PrismaticGuppy2, 0.1f); + RandomFishType.Add(FishType.PrismaticGuppy3, 0.1f); + } + + public void Update() + { + if (!Initialized) + { + // Select the appropriate fish type. + SelectedFishType = FishTypeOverride ?? RandomFishType; + + // Select the correct texture index for the different types of fish textures. + if (SelectedFishType == FishType.SeaMinnow) + FishTextureIndex = 0; + if (SelectedFishType == FishType.AlphaSeaMinnow) + FishTextureIndex = 1; + if (SelectedFishType == FishType.PolypPanasea) + FishTextureIndex = Main.rand.Next(PolypPanaseaTextureNames.Length); + if (IsAPrismaticGuppy) + FishTextureIndex = Main.rand.Next(PrismaticGuppyTextureNames_1.Length); + + // Select the correct amount of animation frames each texture has based on the fish type. + if (IsASeaMinnow) + MaxFrames = 8; + if (SelectedFishType == FishType.PolypPanasea) + MaxFrames = 6; + if (SelectedFishType == FishType.PrismaticGuppy1) + MaxFrames = 6; + if (SelectedFishType == FishType.PrismaticGuppy2) + MaxFrames = 4; + if (SelectedFishType == FishType.PrismaticGuppy3) + MaxFrames = 5; + + CurrentFrame = Main.rand.Next(MaxFrames); + FishTexture = GetCorrectFishTexture(); + Initialized = true; + } + + if (!Initialized) + return; + + if (Scale < StoredScale) + { + Scale = MathHelper.Clamp(Scale + 0.05f, 0f, StoredScale); + Opacity = MathHelper.Clamp(Opacity + 0.05f, 0f, 1f); + } + + // Perform all Boids Behavior. + DoBoidsBehavior(); + + // Move and swim around idly. + PassiveMovementTimer--; + if (PassiveMovementTimer <= 0f) + { + PassiveMovementSpeed = Main.rand.NextFloat(0.25f, MaxSpeed_Default); + PassiveMovementVector.X = Main.rand.NextFloat(-100f, 101f); + PassiveMovementVector.Y = Main.rand.NextFloat(-100f, 101f); + PassiveMovementTimer = Main.rand.Next(120, 180); + } + + var moveSpeed = PassiveMovementSpeed / PassiveMovementVector.Length(); + Velocity = Vector2.Lerp(Velocity, PassiveMovementVector * moveSpeed, 0.01f); + + // Make fishes closest to the screen swim away from the mouse cursor if it's nearby. + var distanceFromCursor = Vector2.Distance(Position, Main.MouseScreen); + var shouldSwimAway = distanceFromCursor < 100f && Depth <= 1; + if (shouldSwimAway) + { + var distanceInterpolant = Utils.GetLerpValue(175f, 0f, distanceFromCursor, true); + Velocity += Position.DirectionTo(Main.MouseScreen).SafeNormalize(Vector2.UnitY) * distanceInterpolant * -0.46f; + + // Stretch a little while swimming away from danger for additional silliness :D + float stretch = MathHelper.Clamp(Velocity.Length() / MaxSpeed_SwimAwayFromCursor * 0.1f, 1f, 1.65f); + Vector2 stretchedVector = new(Scale * stretch, Scale - Scale * stretch * 0.3f); + StretchFactor = Vector2.Lerp(StretchFactor, stretchedVector, 0.15f); + } + else + { + if (Velocity.Length() > MaxSpeed_Default) + Velocity *= 0.7f; + StretchFactor = Vector2.Lerp(StretchFactor, Vector2.One, 0.15f); + } + + Velocity = Velocity.ClampMagnitude(0.25f, MaxSpeed_SwimAwayFromCursor); + Position += Velocity; + + Rotation = Velocity.ToRotation(); + if (Time % FrameSpeed == 0) + CurrentFrame = (CurrentFrame + 1) % MaxFrames; + + Time++; + } + + public void DoBoidsBehavior() + { + // Polyp Panaseas do not travel in schools. + if (SelectedFishType == FishType.PolypPanasea) + return; + + var cohesion = Vector2.Zero; + var alignment = Vector2.Zero; + var separation = Vector2.Zero; + var totalSchoolMembers = 0; + + var detetctionRadiusSquared = MathF.Pow(MaxDetectionRadius, 2f); + var separationDistanceSquared = MathF.Pow(MaxRadiusFromOtherFish, 2f); + var allOtherFishes = CalamityMainMenu_Sunken.Fishes; + + // Alpha Sea Minnows spawn a school of Sea Minnows manually and stick with it. + if (IsASeaMinnow && SeaMinnowSchoolMembers.Count > 0) + { + foreach (var minnow in SeaMinnowSchoolMembers) + { + var distance = Vector2.DistanceSquared(Position, minnow.Position); + var separationFactor = Utils.GetLerpValue(separationDistanceSquared, 0f, distance, true); + separation += (Position - minnow.Position) * separationFactor * 0.7f; + + cohesion += minnow.Position; + alignment += minnow.Velocity; + totalSchoolMembers++; + } + } + else + { + foreach (var other in allOtherFishes) + { + // Only school with other fishes that are nearby, of the same type and within the same depth. + var isPrismaticGuppy = IsAPrismaticGuppy && other.IsAPrismaticGuppy; + var schoolByFishType = isPrismaticGuppy || SelectedFishType == other.SelectedFishType; + + var distance = Vector2.DistanceSquared(Position, other.Position); + if (distance < detetctionRadiusSquared && other != this && schoolByFishType && other.Depth == Depth) + { + var separationFactor = Utils.GetLerpValue(separationDistanceSquared, 0f, distance, true); + separation += (Position - other.Position) * separationFactor * 0.7f; + + cohesion += other.Position; + alignment += other.Velocity; + totalSchoolMembers++; + } + } + } + + if (totalSchoolMembers == 0) + return; + + // Add all boids algorithm factors into the velocity. + cohesion /= totalSchoolMembers; + var schoolCenterInterpolant = Utils.GetLerpValue(0f, 80f, Position.Distance(cohesion), true); + Velocity += (cohesion - Position).SafeNormalize(-Vector2.UnitY) * schoolCenterInterpolant * CohesionCoefficient; + + alignment /= totalSchoolMembers; + Velocity += Velocity.ToRotation().AngleLerp(alignment.ToRotation(), 0.06f).ToRotationVector2() * Velocity.Length() * AlignmentCoefficient; + + separation /= totalSchoolMembers; + Velocity += separation.SafeNormalize(-Vector2.UnitY) * SeparationCoefficient; + } + + public void Draw(SpriteBatch spriteBatch) + { + if (!Initialized) + return; + + Vector2 depthFactor = new(1f / Depth, 1.1f / Depth); + Vector2 parallaxedPosition = Position * depthFactor; + + var frame = FishTexture.Frame(1, MaxFrames, 0, CurrentFrame); + var origin = frame.Size() * 0.5f; + + var scaleByDepth = Scale / Depth; + var drawRotaton = Rotation + MathHelper.Pi; + var colorByDepth = Color.Lerp(Color.White, Color.Black, Utils.Remap(Depth, 1, 4, 0f, 0.8f, true)); + + var effects = Velocity.X > 0f ? SpriteEffects.FlipVertically : SpriteEffects.None; + spriteBatch.Draw(FishTexture.Value, parallaxedPosition, frame, colorByDepth * Opacity, drawRotaton, origin, StretchFactor * scaleByDepth, effects, 0f); + } + + private Asset GetCorrectFishTexture() + { + var sunkenSeaPath = "CalamityMod/NPCs/SunkenSea/"; + var returnTexture = SelectedFishType switch + { + FishType.PolypPanasea => ModContent.Request(sunkenSeaPath + PolypPanaseaTextureNames[FishTextureIndex]), + FishType.PrismaticGuppy1 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_1[FishTextureIndex]), + FishType.PrismaticGuppy2 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_2[FishTextureIndex]), + FishType.PrismaticGuppy3 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_3[FishTextureIndex]), + _ => ModContent.Request(sunkenSeaPath + SeaMinnowTextureNames[FishTextureIndex]), + }; + return returnTexture; + } + } +} diff --git a/MainMenu/SunkenMenuBackground.png b/MainMenu/SunkenMenuBackground.png new file mode 100644 index 0000000000..6df4caab99 Binary files /dev/null and b/MainMenu/SunkenMenuBackground.png differ diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index ab27b1d31a..ceada7f56a 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -433,8 +433,6 @@ namespace CalamityMod.NPCs.AstrumAureus CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAstrumAureus); - // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops if (!DownedBossSystem.downedAstrumAureus) { diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs index b4b7b4b27b..a8f6e79f8c 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs @@ -213,7 +213,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs index 6762f39117..e7e3f546bb 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs @@ -41,7 +41,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Variables bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -76,10 +75,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (dontAttack) { npc.localAI[3] -= 1f; - if (npc.justHit && masterMode) - npc.localAI[3] -= 3f; if (npc.Distance(player.Center) < 240f) - npc.localAI[3] -= masterMode ? 4f : expertMode ? 2f : 1f; + npc.localAI[3] -= death ? 4f : expertMode ? 2f : 1f; } float enrageScale = bossRush ? 1f : 0f; @@ -343,10 +340,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Stay vulnerable for 3 seconds npc.ai[1] += 1f; - if (npc.justHit && masterMode) - npc.ai[1] += 3f; if (npc.Distance(player.Center) < 240f) - npc.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + npc.ai[1] += death ? 4f : expertMode ? 2f : 1f; if (npc.ai[1] >= 180f || bossRush) { @@ -457,7 +452,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs { npc.ai[1] += 1f; if (npc.Distance(player.Center) < 240f) - npc.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + npc.ai[1] += death ? 4f : expertMode ? 2f : 1f; } if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs index 3719557ee3..2134f154b2 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs @@ -84,7 +84,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs // Variables for buffing the AI bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -239,10 +238,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f; - if (npc.justHit) - npc.localAI[1] += masterMode ? 7f : expertMode ? 5f : 3f; if (npc.Distance(player.Center) < 160f) - npc.localAI[1] += masterMode ? 4f : expertMode ? 2f : 1f; + npc.localAI[1] += death ? 4f : expertMode ? 2f : 1f; if (npc.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f)) { diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs index 7ee45394c2..15d826ab41 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs @@ -57,7 +57,6 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.2f; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 8e81031fe3..900cd940e9 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -10,6 +10,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.ExtraTextures; @@ -72,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; @@ -318,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; @@ -328,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 @@ -404,7 +405,6 @@ namespace CalamityMod.NPCs public int sulphurPoison = 0; /// If greater than 0, makes this NPC constantly spawn heart gores. public int ladHearts = 0; - public int kamiFlu = 0; public int relicOfResilienceWeakness = 0; /// Cooldown variable for spawning Gauss Dagger's gauss flux projectiles. public int GaussFluxTimer = 0; @@ -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; @@ -662,7 +664,6 @@ namespace CalamityMod.NPCs myClone.clamDebuff = clamDebuff; myClone.sulphurPoison = sulphurPoison; myClone.ladHearts = ladHearts; - myClone.kamiFlu = kamiFlu; myClone.relicOfResilienceWeakness = relicOfResilienceWeakness; myClone.GaussFluxTimer = GaussFluxTimer; myClone.sagePoisonTime = sagePoisonTime; @@ -902,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 @@ -940,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) @@ -958,7 +973,6 @@ namespace CalamityMod.NPCs else electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; } - double waterDamageMult = BaseDoTDamageMult; if (VulnerableToWater.HasValue) { @@ -1002,14 +1016,20 @@ 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) { - heatDamageMult += 3.5; - coldDamageMult += 3.5; - waterDamageMult += 3.5; - sicknessDamageMult += 3.5; - electricityDamageMult += 3.5; + heatDamageMult += 2; + coldDamageMult += 2; + waterDamageMult += 2; + sicknessDamageMult += 2; + electricityDamageMult += 2; } // Subtract 1 for the vanilla damage multiplier because it's already dealing DoT in the vanilla regen code. @@ -1286,13 +1306,6 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(baseSulphurPoisonDoTValue, baseSulphurPoisonDoTValue / 5, ref npc.lifeRegen, ref damage); } - // Kami Debuff from Yanmei's Knife - if (kamiFlu > 0) - { - int baseKamiFluDoTValue = (int)(YanmeisKnife.DebuffDoT * sicknessDamageMult); - ApplyDPSDebuff(baseKamiFluDoTValue, baseKamiFluDoTValue / 10, ref npc.lifeRegen, ref damage); - } - //Absorber Affliction if (absorberAffliction > 0) { @@ -1514,7 +1527,7 @@ namespace CalamityMod.NPCs { NPCID.TheHungry, 0.1f }, { NPCID.UndeadViking, 0.1f }, { NPCID.WalkingAntlion, 0.1f }, - { NPCID.WallofFlesh, 0.5f }, + { NPCID.WallofFlesh, 0.15f }, }; #endregion @@ -1899,8 +1912,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) { - // HP boosted in Master Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar) - npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.masterMode ? 1.7 : 1.2)); + // HP boosted in Death Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar) + npc.lifeMax = (int)Math.Round(npc.lifeMax * (CalamityWorld.death ? 1.7 : 1.2)); npc.npcSlots = 12f; } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) @@ -2003,8 +2016,8 @@ namespace CalamityMod.NPCs #region Vulnerabilities and Resistances private void VulnerabilitiesAndResistances(NPC npc) { - // These enemies are categorized in such a way to make them easy to understand. - // Do not mess with these categories unless you ask me for permission - Fab. + // These enemies are categorized in such a way to make them easy to understand + // Regroup these if necessary, reminder to keep it comprehensive switch (npc.type) { // Regular organic desert enemies. @@ -3810,17 +3823,9 @@ namespace CalamityMod.NPCs effectiveDR = 0f; // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac - // Cirrus being active makes the extra DR cease to function - bool cirrusBossActive = false; - if (SCal != -1) - { - if (Main.npc[SCal].active) - cirrusBossActive = Main.npc[SCal].ModNPC().cirrus; - } - bool enragedProvi = npc.type == NPCType() && !ProvUtils.StandardAI(); bool dayEmpress = npc.type == NPCID.HallowBoss && NPC.ShouldEmpressBeEnraged(); - if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (enragedProvi || dayEmpress)) + if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && (enragedProvi || dayEmpress)) { // Set the DR scaling factor float DRScalar = 10f; @@ -3856,8 +3861,6 @@ namespace CalamityMod.NPCs calcDR *= 0.5f; if (absorberAffliction > 0) calcDR *= 0.8f; - if (npc.Calamity().kamiFlu > 0) - calcDR *= YanmeisKnife.DebuffDamageReductionMult; if (npc.Calamity().aCrunch > 0) calcDR *= ArmorCrunch.MultiplicativeDamageReductionEnemy; if (npc.Calamity().crumble > 0) @@ -3934,14 +3937,14 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime && (Main.masterMode || BossRushEvent.BossRushActive)) + if (npc.type == NPCID.SkeletronPrime && (CalamityWorld.death || BossRushEvent.BossRushActive)) index = ExtraTextureRefs.BossHeadIndex_ChadPrime; if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive)) { float lifeRatio = npc.life / (float)npc.lifeMax; - float mapIconVanishValue = Main.masterMode ? 0.3f : 0.4f; - if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && (Main.masterMode || BossRushEvent.BossRushActive))) + float mapIconVanishValue = CalamityWorld.death ? 0.3f : 0.4f; + if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && (CalamityWorld.death || BossRushEvent.BossRushActive))) index = -1; } } @@ -4142,7 +4145,7 @@ namespace CalamityMod.NPCs { npc.TargetClosest(); - float velocity = Main.getGoodWorld ? 12f : (Main.masterMode || BossRushEvent.BossRushActive) ? 10.5f : 9f; + float velocity = Main.getGoodWorld ? 12f : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 10.5f : 9f; if (npc.ai[1] == 70f) velocity *= 0.4f; @@ -4236,6 +4239,10 @@ namespace CalamityMod.NPCs case NPCID.QueenSlimeBoss: return QueenSlimeAI.BuffedQueenSlimeAI(npc, Mod); + case NPCID.QueenSlimeMinionBlue: + return QueenSlimeAI.BuffedQueenSlimeCrystalSlimeAI(npc, Mod); + case NPCID.QueenSlimeMinionPink: + return QueenSlimeAI.BuffedQueenSlimeBouncySlimeAI(npc, Mod); case NPCID.TheDestroyer: case NPCID.TheDestroyerBody: @@ -4335,106 +4342,6 @@ namespace CalamityMod.NPCs } } - // Adjust vanilla AI in Classic, Expert and Master - // Fair contact damage and a few Expert/Master AI edits happen here - // Deerclops doesn't deserve love so he's not here - else if (!CalamityMod.ExternalFlag_DisableNonRevBossAI) - { - switch (npc.type) - { - case NPCID.KingSlime: - return KingSlimeAI.VanillaKingSlimeAI(npc, Mod); - - case NPCID.EyeofCthulhu: - return EyeOfCthulhuAI.VanillaEyeofCthulhuAI(npc, Mod); - - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - return EaterOfWorldsAI.VanillaEaterofWorldsAI(npc, Mod); - - case NPCID.BrainofCthulhu: - return BrainOfCthulhuAI.VanillaBrainofCthulhuAI(npc, Mod); - case NPCID.Creeper: - return BrainOfCthulhuAI.VanillaCreeperAI(npc, Mod); - - case NPCID.QueenBee: - return QueenBeeAI.VanillaQueenBeeAI(npc, Mod); - - case NPCID.SkeletronHand: - return SkeletronAI.VanillaSkeletronHandAI(npc, Mod); - case NPCID.SkeletronHead: - return SkeletronAI.VanillaSkeletronAI(npc, Mod); - - case NPCID.WallofFlesh: - return WallOfFleshAI.VanillaWallofFleshAI(npc, Mod); - case NPCID.WallofFleshEye: - return WallOfFleshAI.VanillaWallofFleshEyeAI(npc, Mod); - - case NPCID.QueenSlimeBoss: - return QueenSlimeAI.VanillaQueenSlimeAI(npc, Mod); - - case NPCID.TheDestroyer: - case NPCID.TheDestroyerBody: - case NPCID.TheDestroyerTail: - return DestroyerAI.VanillaDestroyerAI(npc, Mod); - case NPCID.Probe: - return DestroyerAI.VanillaProbeAI(npc, Mod); - - case NPCID.Retinazer: - return TwinsAI.VanillaRetinazerAI(npc, Mod); - case NPCID.Spazmatism: - return TwinsAI.VanillaSpazmatismAI(npc, Mod); - - case NPCID.SkeletronPrime: - return SkeletronPrimeAI.VanillaSkeletronPrimeAI(npc, Mod); - case NPCID.PrimeLaser: - return SkeletronPrimeAI.VanillaPrimeLaserAI(npc, Mod); - case NPCID.PrimeCannon: - return SkeletronPrimeAI.VanillaPrimeCannonAI(npc, Mod); - case NPCID.PrimeVice: - return SkeletronPrimeAI.VanillaPrimeViceAI(npc, Mod); - case NPCID.PrimeSaw: - return SkeletronPrimeAI.VanillaPrimeSawAI(npc, Mod); - - case NPCID.Plantera: - return PlanteraAI.VanillaPlanteraAI(npc, Mod); - - case NPCID.HallowBoss: - return EmpressofLightAI.VanillaEmpressofLightAI(npc, Mod); - - case NPCID.Golem: - return GolemAI.VanillaGolemAI(npc, Mod); - case NPCID.GolemFistLeft: - case NPCID.GolemFistRight: - return GolemAI.VanillaGolemFistAI(npc, Mod); - case NPCID.GolemHead: - return GolemAI.VanillaGolemHeadAI(npc, Mod); - case NPCID.GolemHeadFree: - return GolemAI.VanillaGolemHeadFreeAI(npc, Mod); - - case NPCID.DukeFishron: - return DukeFishronAI.VanillaDukeFishronAI(npc, Mod); - - case NPCID.CultistBoss: - case NPCID.CultistBossClone: - return CultistAI.VanillaCultistAI(npc, Mod); - case NPCID.AncientLight: - return CultistAI.VanillaAncientLightAI(npc, Mod); - case NPCID.AncientDoom: - return CultistAI.VanillaAncientDoomAI(npc, Mod); - - /*case NPCID.MoonLordCore: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: - case NPCID.MoonLordFreeEye: - return MoonLordAI.VanillaMoonLordAI(npc, Mod);*/ - - default: - break; - } - } - if (CalamityWorld.revenge) { switch (npc.aiStyle) @@ -5059,12 +4966,6 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.QueenSlimeMinionBlue) - return QueenSlimeAI.QueenSlimeCrystalSlimeAI(npc, Mod); - - if (npc.type == NPCID.QueenSlimeMinionPink) - return QueenSlimeAI.QueenSlimeBouncySlimeAI(npc, Mod); - if (npc.type == NPCID.FungiBulb) return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod); @@ -5687,8 +5588,6 @@ namespace CalamityMod.NPCs webbed--; if (slowed > 0) slowed--; - if (kamiFlu > 0) - kamiFlu--; if (vaporfied > 0) vaporfied--; @@ -5721,6 +5620,8 @@ namespace CalamityMod.NPCs absorberAffliction--; if (irradiated > 0) irradiated--; + if (scionsCurioEffected) + irradiatedContactBoost = 2f; if (bFlames > 0) bFlames--; if (demonicFlames > 0) @@ -6023,8 +5924,6 @@ namespace CalamityMod.NPCs // Slowing debuffs which set a velocity hard cap take priority first. if (vulnerabilityHex > 0) npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-Calamity.MaxNPCSpeed), new Vector2(Calamity.MaxNPCSpeed, 10f)); - else if (kamiFlu > 360) - npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-YanmeisKnife.DebuffNPCSpeedCap), new Vector2(YanmeisKnife.DebuffNPCSpeedCap)); // Then debuffs which apply a multiplier to velocity. // These multipliers can stack with each other, even if you'll rarely see this on a boss. @@ -6494,8 +6393,9 @@ namespace CalamityMod.NPCs #region Modify Hit By Projectile public static bool DisableMultWhipTag = false; - //this bool does nothing on this branch, its just here so that CalTestHelpers doesn't crash searching for it - //if you want to mess with this, please do so in the summoner branch - Shade + //this bool does nothing on the main branch, its just here so that CalTestHelpers doesn't crash searching for it + //if you want to mess with this to test whips, please do so in the summoner branch - Shade + public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref NPC.HitModifiers modifiers) { Player player = Main.player[projectile.owner]; @@ -6673,14 +6573,36 @@ namespace CalamityMod.NPCs if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ProjectileType()] > 0 || player.ownedProjectileCounts[ProjectileType()] > 0 || (player.Calamity().rOfResilienceCooldown == 0 && player.HeldItem.type == ItemType()))) modifiers.SourceDamage *= 0.1f; + //Doze apr-6-2025: with the summon tag system we now have this is unnececcessary and very likely causes issues on MP, so i'm commenting it out for the time being. Once further testing is done, delete it entirely. + //Delete ardor blososm sparks and buff if hit by something that isnt a minion or sentry while not having Ardor Blossom Star in hand + /*if (npc.HasBuff() && player.HeldItem.type != ModContent.ItemType() && !projectile.minion && !ProjectileID.Sets.MinionShot[projectile.type] && !projectile.sentry) + { + npc.RequestBuffRemoval(ModContent.BuffType()); + //Remove all embers from this enemy + for (int k = 0; k < Main.maxProjectiles; k++) + { + if (Main.projectile[k].active && Main.projectile[k].type == ModContent.ProjectileType() && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI && Main.projectile[k].owner == player.whoAmI) + Main.projectile[k].Kill(); + } + }*/ + //Handle summon tag effects if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) - EditWhipTagDamage(projectile, npc, ref modifiers); + { + EditSummonTagDamage(projectile, npc, ref modifiers); + } + + } - #endregion + #endregion #region OnHitBy overrides public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { + if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) + { + SummonTagOnHitEffects(npc, projectile, hit, damagedone); + } + if (IsArmored()) { CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); @@ -6705,75 +6627,89 @@ namespace CalamityMod.NPCs } } + #endregion - #region Whip Tag - // Make whip tags multiplicative, by effectively reversing the process done to it - private void EditWhipTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) + + #region Summon Tag + //doze 03-15-2025: A full refactor of the summon tag system to make it easier to use and more flexible. Ping me with any questions. + private void EditSummonTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) { - // Don't make it run through the index if it's a trap - if (proj.npcProj || proj.trap) + if (proj.npcProj || proj.trap || proj.owner == -1) // don't run on non-player-owned projectiles. return; + var player = Main.player[proj.owner]; + var modPlayer = player.Calamity(); + + float critChance = modPlayer.bonusCritTag; float TagDamageMult = ProjectileID.Sets.SummonTagDamageMultiplier[proj.type]; + + TagDamageMult += modPlayer.bonusMultTag; + modifiers.FlatBonusDamage += modPlayer.bonusFlatTag; + for (int i = 0; i < NPC.maxBuffs; i++) { if (npc.buffTime[i] >= 1) { - switch (npc.buffType[i]) + int type = npc.buffType[i]; + if (SummonTagDebuffDict.TryGet(type, out SummonTag tag)) { - case BuffID.BlandWhipEnemyDebuff: // Leather Whip - modifiers.FlatBonusDamage += -4f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.DurendalTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.ThornWhipNPCDebuff: // Snapthorn - modifiers.FlatBonusDamage += -6f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.SnapthornTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.BoneWhipNPCDebuff: // Spinal Tap - modifiers.FlatBonusDamage += -7f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.SpinalTapTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.FlameWhipEnemyDebuff: // Firecracker - modifiers.ScalingBonusDamage += (BalancingConstants.FirecrackerExplosionDamageMultiplier - 2.75f) * TagDamageMult; - break; - case BuffID.CoolWhipNPCDebuff: // Cool Whip - modifiers.FlatBonusDamage += -6f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.CoolWhipTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.SwordWhipNPCDebuff: // Durendal - modifiers.FlatBonusDamage += -9f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.DurendalTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.ScytheWhipEnemyDebuff: // Dark Harvest - modifiers.FlatBonusDamage += -10f * TagDamageMult; - break; - case BuffID.MaceWhipNPCDebuff: // Morning Star - modifiers.FlatBonusDamage += -8f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.MorningStarTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.RainbowWhipNPCDebuff: // Kaleidoscope - modifiers.FlatBonusDamage += -20f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.KaleidoscopeTagDamageMultiplier - 1f) * TagDamageMult; - break; + tag.TagModifyHitEffects(proj, npc, ref modifiers, ref TagDamageMult, ref critChance); } } } - //BuffType cannot be used in switch case, so that has to be handled outside of it - //Verify that the owner of the proj has psc state higher or equal to psc buffs - if (npc.HasBuff() && Main.player[proj.owner].Calamity().pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs) + + //For the vanilla Monk/Shinobi armor critting with Lightning Auras. In vanilla it doesn't stack additively but frankly I do not care. It's not like aura is that good anyway. + if (proj.type == ProjectileID.DD2LightningAuraT1 || proj.type == ProjectileID.DD2LightningAuraT2 || proj.type == ProjectileID.DD2LightningAuraT3) { - var empowered = Main.player[proj.owner].Calamity().pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; - //20% is balanced for non empowered, while 40% helps ensure psc remains balanced at empowered tier - //Some PSC projectiles receive a reduced amount of benefit from this, for balancing purposes - modifiers.ScalingBonusDamage += (empowered ? 0.4f : 0.2f) * TagDamageMult; - if (!Main.dedServ) + if (player.setMonkT3) { - var color = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0); - float power = Math.Min(npc.height / 100f, 3f); - var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); - var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); - GeneralParticleHandler.SpawnParticle(particle); + critChance += 0.25f; // 1/4 chance to crit with Shinobi + } + else if (player.setMonkT2) + { + critChance += 0.166f; // 1/6 chance to crit with Monk + } + } + + //Used to convert all multiplicative tag into crit chance and vice-versa. If both force tag crit and multiplicative are applied, chooses one at random. + if (modPlayer.forceSummonTagCrit && !(modPlayer.forceSummonTagMultiplicative && Main.rand.NextBool())) + { + critChance += modifiers.ScalingBonusDamage.Value; + modifiers.ScalingBonusDamage += -modifiers.ScalingBonusDamage.Value; + + } + else if (modPlayer.forceSummonTagMultiplicative) + { + + modifiers.ScalingBonusDamage += critChance; + critChance = 0; + } + + //currently doesn't support more than 100% crit chance, todo if something does more than +100% tag damage + if (Main.rand.NextFloat() < critChance) + modifiers.SetCrit(); + else + modifiers.DisableCrit(); //This is to prevent Morning Star and Kalei from critting with their vanilla tag effect. If you want a minion/sentry to crit, you *must* make sure to change critChance in this function. + } + + //This is for whip tag effects that run on hit and don't modify the damage of the hit. + private void SummonTagOnHitEffects(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) + { + if (projectile.npcProj || projectile.trap || projectile.owner == -1) // don't run on non-player-owned projectiles. + return; + + Player player = Main.player[projectile.owner]; + + for (int i = 0; i < NPC.maxBuffs; i++) + { + if (npc.buffTime[i] >= 1) + { + int type = npc.buffType[i]; + if (SummonTagDebuffDict.TryGet(type, out SummonTag tag)) + { + tag.TagOnHit(npc, projectile, hit, damagedone); + } } } } @@ -6784,7 +6720,7 @@ namespace CalamityMod.NPCs { if (npc.type == NPCID.SkeletronPrime) { - if ((Main.masterMode || BossRushEvent.BossRushActive) && CalamityWorld.revenge) + if (CalamityWorld.death || BossRushEvent.BossRushActive) { // Kill the other head if he's still alive when this head dies for (int i = 0; i < Main.maxNPCs; i++) @@ -6952,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 @@ -7293,8 +7371,7 @@ namespace CalamityMod.NPCs } } - // 12JUL2023: Ozzatron: what does this do - // 27SEP2023: Fabsol: disables vanilla spawns "a pool of [0] indicates vanilla spawning" + // Disable vanilla spawns while in the Brimstone Crag if (calamityBiomeZone) { pool[0] = 0f; @@ -7765,9 +7842,6 @@ namespace CalamityMod.NPCs if (npc.HasBuff()) return new Color(200, 50, 50, 255 - npc.alpha); - if (npc.Calamity().kamiFlu > 0 && !KamiDebuffColorImmuneList.Includes(npc.type)) - return new Color(51, 197, 108, 255 - npc.alpha); - if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) return new Color(150, 200, 0, npc.alpha); @@ -7819,7 +7893,6 @@ namespace CalamityMod.NPCs ("CalamityMod/Buffs/StatDebuffs/GalvanicCorrosion", NPC => NPC.Calamity().tesla > 0), ("CalamityMod/Buffs/StatDebuffs/GlacialState", NPC => NPC.Calamity().gState > 0), ("CalamityMod/Buffs/StatDebuffs/Irradiated", NPC => NPC.Calamity().irradiated > 0), - ("CalamityMod/Buffs/StatDebuffs/KamiFlu", NPC => NPC.Calamity().kamiFlu > 0), ("CalamityMod/Buffs/StatDebuffs/MarkedforDeath", NPC => NPC.Calamity().marked > 0), ("CalamityMod/Buffs/StatDebuffs/PearlAura", NPC => NPC.Calamity().pearlAura > 0), ("CalamityMod/Buffs/StatDebuffs/ProfanedWeakness", NPC => NPC.Calamity().relicOfResilienceWeakness > 0), @@ -7930,8 +8003,6 @@ namespace CalamityMod.NPCs currentDebuffs.Add(TextureAssets.Buff[BuffID.Slimed].Value); if (npc.drippingSparkleSlime) currentDebuffs.Add(TextureAssets.Buff[BuffID.GelBalloonBuff].Value); - if (npc.markedByScytheWhip) // Dark Harvest whip, the only Whip debuff that has an NPC bool - currentDebuffs.Add(TextureAssets.Buff[BuffID.ScytheWhipEnemyDebuff].Value); // Total amount of elements in the buff list int buffTextureListLength = currentDebuffs.Count(); @@ -7975,6 +8046,33 @@ namespace CalamityMod.NPCs if (currentDebuffs[i] == TextureAssets.Buff[BuffType()].Value) ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } + + + // Draw summon tag display. TODO: make it use custom textures provided by SummonTag. + int yOffset = 0; + for (int i = NPC.maxBuffs - 1; i >= 0; i--) + { + if (npc.buffTime[i] > 0) + { + if (SummonTagDebuffDict.TryGet(npc.buffType[i], out SummonTag tag)) + { + // Fetch the item and its frames + var tex = TextureAssets.Item[tag.TagItem].Value; + Rectangle frame = (Main.itemAnimations[tag.TagItem] == null) ? tex.Frame() : Main.itemAnimations[tag.TagItem].GetFrame(tex); + if (tag.TagTexture != null) + { + tex = tag.TagTexture.Value; + frame = tex.Frame(); + } + + // Draw it accordingly + // This is drawn below the NPC as opposed to above to differentiate from regular debuffs + Vector2 drawPos = npc.Center - screenPos + Vector2.UnitY * (drawPosY + frame.Height * 0.5f + yOffset); + spriteBatch.Draw(tex, drawPos, frame, Color.White, 0f, frame.Size() * 0.5f, 0.75f, SpriteEffects.None, 0f); + yOffset += frame.Height + 4; + } + } + } } } @@ -8341,8 +8439,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.TheDestroyerBody && revenge) { - float shootProjectileTime = death ? (masterMode ? (phase5 ? 30f : phase4 ? 60f : 90f) : 270f) : (masterMode ? (phase5 ? 90f : phase4 ? 120f : 150f) : 450f); - float bodySegmentTime = npc.ai[0] * (masterMode ? 15f : 30f); + float shootProjectileTime = death ? (phase5 ? 120f : phase4 ? 150f : 180f) : 450f; + float bodySegmentTime = npc.ai[0] * (death ? 20f : 30f); float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; if (newAI[0] > telegraphGateValue) @@ -8364,15 +8462,6 @@ namespace CalamityMod.NPCs telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); } } - else if (npc.type == NPCID.TheDestroyerBody) - { - float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; - if (npc.localAI[0] > telegraphGateValue) - telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); - } } Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerHeadGlowmask.Value : TextureAssets.Dest[0].Value; @@ -10106,34 +10195,5 @@ namespace CalamityMod.NPCs return result; } #endregion - - #region Type Name Changes - public override void ModifyTypeName(NPC npc, ref string typeName) - { - if ((Main.masterMode && CalamityWorld.death) || BossRushEvent.BossRushActive) - { - if (npc.type == NPCID.SkeletronPrime) - { - typeName = CalamityUtils.GetTextValue("NPCs.SkeletronOmega.DisplayName"); - } - if (npc.type == NPCID.PrimeSaw) - { - typeName = CalamityUtils.GetTextValue("NPCs.OmegaSaw.DisplayName"); - } - if (npc.type == NPCID.PrimeLaser) - { - typeName = CalamityUtils.GetTextValue("NPCs.OmegaLaser.DisplayName"); - } - if (npc.type == NPCID.PrimeVice) - { - typeName = CalamityUtils.GetTextValue("NPCs.AlphaVice.DisplayName"); - } - if (npc.type == NPCID.PrimeCannon) - { - typeName = CalamityUtils.GetTextValue("NPCs.AlphaCannon.DisplayName"); - } - } - } - #endregion } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 159d4cd730..cb31ae999e 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1115,14 +1115,9 @@ namespace CalamityMod.NPCs break; // Angler - // Golden Fishing Rod @ 100% IF fed to a Trasher - // OTHERWISE, // Golden Fishing Rod @ 8.33% IF Hardmode case NPCID.Angler: - LeadingConditionRule trasherLCR = new LeadingConditionRule(DropHelper.AnglerFedToTrasherCondition); - trasherLCR.Add(ItemDropRule.ByCondition(DropHelper.TrasherText, ItemID.GoldenFishingRod)); - trasherLCR.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.GoldenFishingRod, 12)); - npcLoot.Add(trasherLCR); + hardmode.Add(ItemID.GoldenFishingRod, 12, 1, 1); break; #endregion @@ -1815,8 +1810,8 @@ namespace CalamityMod.NPCs rev.Add(ItemID.FairyQueenMasterTrophy); rev.Add(ItemID.FairyQueenPetItem, 4); - // GFB Cirrus' Vodka and Terraformer drop - GFB.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 1, 9999), true); + // GFB Purple Haze and Terraformer drop + GFB.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 1, 9999), true); GFB.Add(DropHelper.PerPlayer(ItemID.Clentaminator2), hideLootReport: true); // Lore @@ -2090,7 +2085,7 @@ namespace CalamityMod.NPCs case NPCID.TheDestroyer: SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss1 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -2102,7 +2097,7 @@ namespace CalamityMod.NPCs if (lastTwinStanding) { SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss2 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -2112,7 +2107,7 @@ namespace CalamityMod.NPCs case NPCID.SkeletronPrime: SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss3 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -2120,7 +2115,7 @@ namespace CalamityMod.NPCs break; case NPCID.Plantera: - SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); + SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType() }, NPC.downedPlantBoss); SetNewBossJustDowned(npc); // Spawn Perennial Ore if Plantera has never been killed @@ -2156,7 +2151,7 @@ namespace CalamityMod.NPCs break; case NPCID.Golem: - SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); + SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType() }, NPC.downedGolemBoss); SetNewBossJustDowned(npc); // If Golem has never been killed, send a message about the Plague. diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index c50caa0208..330a259a1a 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -14,6 +14,7 @@ using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -92,13 +93,14 @@ namespace CalamityMod.NPCs private static readonly string[] CyborgNames = { "Sylux", // <@!331812782183809025> (gonkachino) - "XL-39 Nemesis", // <@!1104036024063107082> (yashimayamanata) + "Nemesis", // <@!1104036024063107082> (yashimayamanata) }; private static readonly string[] DemolitionistNames = { "Tavish DeGroot", // <@!442447226992721930> (magicoal) "Fimmy", // <@!407348617079160832> (darkmega5) "Dorira", // <@!215269032360804352> (crimsoncb) + "John Helldiver", // <@!614126424751603714> (exellent.) }; private static readonly string[] DryadNames = { @@ -121,6 +123,9 @@ namespace CalamityMod.NPCs "Him", // <@!931019614958256139> (himtheguy1) "Tooshiboots", // <@!333532730593771522> (ulmod) "Neesh", // <@!175803493464932352> (xjetty) + "Bars Boldia", // <@!332989575708540939> (careless_imp) + "Basel Raiden John Clive Fantasy 16", // <@!529392083136413696> (raiden_ii) + "Gobby, Destroyer of Wallets", // <@!429024941296582658> (bwlstorm) }; private static readonly string[] GolferNames = null; private static readonly string[] GuideNames = @@ -140,9 +145,9 @@ namespace CalamityMod.NPCs "Alfred Rend", // <@!606301806481375255> (deadsqurp300) "Leeman", // <@!281999243168841728> (tweee) "Mihai", // <@!373941893467209730> (cmihaii.) - "Cooler Kevin", // <@!614126424751603714> (exellent.) "Dinkleberg", // <@!581993958037520404> (hyperionzx) - "Wamy", + "Wamy", // Fab added this name with no Discord ID. May be a donor who has no Discord account. + "Baggute", // <@!535140564174110720> (thebaggutegamer) }; private static readonly string[] MechanicNames = { @@ -155,6 +160,7 @@ namespace CalamityMod.NPCs private static readonly string[] MerchantNames = { "Morshu", // <@!194931581826236416> (uberransy) + "Spamton G. Spamton", // <@!497146350438318101> (j.u.n.e.s) }; private static readonly string[] NurseNames = { @@ -180,6 +186,7 @@ namespace CalamityMod.NPCs "Captain Billy Bones", // <@!699589229507772416> (djackv) "Captain J. Crackers", // <@!233232602994049024> (qyuuno) "Gol D. Roger", // <@!256228859110752257> (xtra3678) + "Yarrim", // <@!290061123137306624> (borb9834) }; private static readonly string[] PrincessNames = { @@ -191,6 +198,7 @@ namespace CalamityMod.NPCs "Gwynevere", // <@!142752927348424704> (nuclearchaosazathoth) "Hael", // <@!641747280944431156> (kalebtull) "Yumesaki Mirrin", // <@!100235144744415232> (milinen) + "Vela", // <@!208719047146209281> (nyxxynightstar) }; private static readonly string[] SantaClausNames = { @@ -200,7 +208,9 @@ namespace CalamityMod.NPCs { "Sans Undertale", // <@!145379091648872450> (shayy) "Papyrus Undertale", // <@!262663471189983242> (nycro) + "Gaster Undertale", // <@!924706306093379614> (enamoured) "Mr. Bones", // <@!359215912856977408> (jaybones.) + "Freakbob", // <@!377863128140087296> (jevilamv) }; private static readonly string[] SteampunkerNames = { @@ -209,6 +219,7 @@ namespace CalamityMod.NPCs "Mòrag Ladair", // <@!161893929485074432> (jalapeno9) "Linn", // <@!277983612383526913> (duckycolors) "Eira", // <@!1166136068408623234> (taela_gemetha) + "Kreutz", // <@!553445849149997056> (red_r_kreutz) }; private static readonly string[] StylistNames = { @@ -239,18 +250,17 @@ namespace CalamityMod.NPCs private static readonly string[] TruffleNames = { "Aldrimil", // <@!413719640238194689> (Thorioum#2475) + "Wonton", // <@!1198092982923043040> (imonthatgudkush) }; private static readonly string[] WitchDoctorNames = { "Sok'ar", "Aeroni", // <@!348174404984766465> (aeroni) (previously: toxin) "Mixcoatl", // <@!284775927294984203> (.sharzz) - "Khatunz", // <@!303022375191183360> (jackshiz) "Amnesia Wapers", // <@!326821498323075073> (retardedadvicefromaretard) }; private static readonly string[] WizardNames = { - "Mage One-Trick", // <@!340996105460514816> (pixlgray) "Inorim, son of Ivukey", "Jensen", "Merasmus", // <@!288066987819663360> (spiderprovidence) @@ -266,6 +276,8 @@ namespace CalamityMod.NPCs "Lacuna", // <@!790746689211203604> (_lacuna_) "Mae Borowski", //<@!219158690433990656> (justakkolite) "Fera", // <@!195850711567826945> (juneark_) + "Gwenhwyvar", // <@!291342874497515531> (diamondnife) + "Daxie", // <@!465438861103988737> (daxie626) }; // The following sets are for the 1.4 Town Pets: Town Dogs, Cats and Bunnies. @@ -281,6 +293,8 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogNames = { "Ozymandias", // <@!146333264871686145> (ozzatron) + "Miss Throws a Lot", // <@!799345607847182400> (oakhamsam) + "Brikwilla", // <@!543803736909414438> (lavendercobra) }; private static readonly string[] TownDogLabradorNames = { @@ -321,6 +335,7 @@ namespace CalamityMod.NPCs private static readonly string[] TownCatBlackNames = { "Bear", // <@!183424826407518208> (lilac_vrt_olligoci) + "Storm", // <@!620383533516718085> (airwaveslr) }; private static readonly string[] TownCatOrangeTabbyNames = { @@ -328,7 +343,10 @@ namespace CalamityMod.NPCs "Tardo", // <@!739343546867384391> (midnight295) }; private static readonly string[] TownCatRussianBlueNames = null; - private static readonly string[] TownCatSilverNames = null; + private static readonly string[] TownCatSilverNames = + { + "Archie", // <@!303022375191183360> (jackshiz) + }; private static readonly string[] TownCatWhiteNames = null; private const int TownBunnyWhiteVanillaNames = 14; @@ -337,7 +355,10 @@ namespace CalamityMod.NPCs private const int TownBunnyFlemishVanillaNames = 12; private const int TownBunnyLopVanillaNames = 13; private const int TownBunnySilverVanillaNames = 13; - private static readonly string[] TownBunnyNames = null; + private static readonly string[] TownBunnyNames = + { + "Poco", // <@!1192261996146593872> (tostitomuncher33) + }; private static readonly string[] TownBunnyWhiteNames = null; private static readonly string[] TownBunnyAngoraNames = null; private static readonly string[] TownBunnyDutchNames = null; @@ -689,7 +710,6 @@ namespace CalamityMod.NPCs (NPCID.SkeletonMerchant, (Player player) => player.Calamity().newSkeletonMerchantInventory, (Player player, bool enabled) =>{ player.Calamity().newSkeletonMerchantInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newAmidiasInventory,(Player player, bool enabled) =>{ player.Calamity().newAmidiasInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newBanditInventory,(Player player, bool enabled) =>{ player.Calamity().newBanditInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newCirrusInventory,(Player player, bool enabled) =>{ player.Calamity().newCirrusInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newPermafrostInventory,(Player player, bool enabled) =>{ player.Calamity().newPermafrostInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newCalamitasInventory,(Player player, bool enabled) =>{ player.Calamity().newCalamitasInventory = enabled; }) // lol }; @@ -769,7 +789,6 @@ namespace CalamityMod.NPCs #region NPC Chat public override void GetChat(NPC npc, ref string chat) { - int cirrus = NPC.FindFirstNPC(NPCType()); int permadong = NPC.FindFirstNPC(NPCType()); int seahorse = NPC.FindFirstNPC(NPCType()); int thief = NPC.FindFirstNPC(NPCType()); @@ -825,9 +844,6 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse"); else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom) { - if (Main.rand.NextBool() && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.DryadChat.DrunkPrincessShroom").Format(Main.npc[cirrus].GivenName); - else chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom"); } else if (Main.rand.NextBool(5) && Main.LocalPlayer.Calamity().ZoneSulphur) @@ -868,8 +884,6 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.Eclipse"); else if (Main.rand.NextBool(5) && AcidRainEvent.AcidRainEventIsOngoing) chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.AcidRain"); - else if (Main.rand.NextBool(5) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.MechanicChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Merchant: @@ -918,8 +932,6 @@ namespace CalamityMod.NPCs case NPCID.PartyGirl: if (Main.rand.NextBool(4) && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.PartyGirlChat.Eclipse" + Main.rand.Next(1, 2 + 1)); - else if (Main.rand.NextBool(10) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.PartyGirlChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Pirate: @@ -927,8 +939,6 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.PreLeviathan"); else if (Main.rand.NextBool(5) && DownedBossSystem.downedAquaticScourge) chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.WetScourgeDefeated"); - else if (Main.rand.NextBool(5) && cirrus != -1) - chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.DrunkPrincess"); else if (Main.rand.NextBool(5) && seahorse != -1) chat = CalamityUtils.GetText("Vanilla.PirateChat.SeaKing").Format(Main.npc[seahorse].GivenName); else if (Main.rand.NextBool(5) && Main.LocalPlayer.Center.ToTileCoordinates().X < 380 && !Main.LocalPlayer.Calamity().ZoneSulphur) @@ -955,12 +965,6 @@ namespace CalamityMod.NPCs string worldEvil = Language.GetTextValue("LegacyMisc." + (WorldGen.crimson ? 102 : 101)); if (Main.rand.NextBool(15) && Main.hardMode) chat = CalamityUtils.GetText("Vanilla.StylistChat.Hardmode").Format(worldEvil); - if (Main.rand.NextBool(15) && cirrus != -1) - { - int noChildSafetyCirrusLines = NPC.downedMoonlord ? Main.rand.Next(2, 3 + 1) : Main.rand.Next(1, 2 + 1); - int childSafetyCirrusLines = NPC.downedMoonlord ? 3 : 1; - chat = CalamityUtils.GetText("Vanilla.StylistChat.DrunkPrincess" + (ChildSafety.Disabled ? noChildSafetyCirrusLines : childSafetyCirrusLines)).Format(Main.npc[cirrus].GivenName); - } if ((Main.rand.NextBool(npc.GivenName == "Amber" ? 10 : 15)) && Main.LocalPlayer.Calamity().pSoulArtifact) { if (Main.LocalPlayer.Calamity().profanedCrystalBuffs) @@ -973,8 +977,6 @@ namespace CalamityMod.NPCs case NPCID.DD2Bartender: if (Main.rand.NextBool(5) && !Main.dayTime && Main.moonPhase == 0) chat = CalamityUtils.GetTextValue("Vanilla.TavernkeepChat.FullMoon"); - else if (Main.rand.NextBool(10) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.TavernkeepChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.TaxCollector: @@ -1003,15 +1005,8 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.Has100Plat"); break; - case NPCID.TravellingMerchant: - if (Main.rand.NextBool(5) && cirrus != -1 && angelstatue != -1) - chat = CalamityUtils.GetText("Vanilla.TravellingMerchantChat.DrunkPrincessMerchant").Format(Main.npc[cirrus].GivenName, Main.npc[angelstatue].GivenName); - break; - case NPCID.Truffle: - if (Main.rand.NextBool(4) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.TruffleChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); - else if (Main.rand.NextBool(8)) + if (Main.rand.NextBool(8)) chat = CalamityUtils.GetTextValue("Vanilla.TruffleChat.Normal"); break; @@ -1157,9 +1152,7 @@ namespace CalamityMod.NPCs .Add(ItemType(), wingedPlayer) .Add(ItemType(), revengeance) .Add(ItemType(), revengeance) - .AddWithCustomValue(ItemID.StylistKilLaKillScissorsIWish, Item.buyPrice(gold: 15)) - .Add(ItemType(), Condition.NpcIsPresent(NPCType()), drunk) - .AddWithCustomValue(ItemID.ChocolateChipCookie, Item.buyPrice(gold: 3), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCType())); + .AddWithCustomValue(ItemID.StylistKilLaKillScissorsIWish, Item.buyPrice(gold: 15)); } if (type == NPCID.Cyborg) @@ -1224,7 +1217,11 @@ namespace CalamityMod.NPCs .AddWithCustomValue(ItemID.SpectreStaff, Item.buyPrice(gold: 25), Condition.DownedGolem) .AddWithCustomValue(ItemID.InfernoFork, Item.buyPrice(gold: 25), Condition.DownedGolem) .AddWithCustomValue(ItemID.ShadowbeamStaff, Item.buyPrice(gold: 25), Condition.DownedGolem) - .AddWithCustomValue(ItemID.MagnetSphere, Item.buyPrice(gold: 25), Condition.DownedGolem); + .AddWithCustomValue(ItemID.MagnetSphere, Item.buyPrice(gold: 25), Condition.DownedGolem) + .Add(ItemType()) + .Add(ItemType()) + .Add(ItemType()) + .Add(ItemType()); } if (type == NPCID.WitchDoctor) @@ -1247,14 +1244,19 @@ namespace CalamityMod.NPCs if (type == NPCID.Princess) { + Mod musicMod = ExternalMods.musicMod; + musicMod.TryFind("Interlude1MusicBox", out ModItem interlude1Box); + musicMod.TryFind("Interlude2MusicBox", out ModItem interlude2Box); + musicMod.TryFind("Interlude3MusicBox", out ModItem interlude3Box); + musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); + shop.AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(gold: 50), Condition.Hardmode) + .AddWithCustomValue(ItemID.EmpressButterfly, Item.buyPrice(gold: 15), Condition.InHallow) .Add(ItemType()) - .Add(ItemID.AppleJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.FruitJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.Lemonade, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.PrismaticPunch, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.SmoothieofDarkness, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.TropicalSmoothie, Condition.NpcIsPresent(NPCType())); + .AddWithCustomValue(interlude1Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedCalamitasClone) + .AddWithCustomValue(interlude2Box.Type, Item.buyPrice(gold: 10), Condition.DownedMoonLord) + .AddWithCustomValue(interlude3Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedYharon) + .AddWithCustomValue(eulogyBox.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedDevourerOfGods); } if (type == NPCID.SkeletonMerchant) @@ -1275,6 +1277,11 @@ namespace CalamityMod.NPCs { shop.AddWithCustomValue(ItemID.Steak, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.Hardmode); } + + if (type == NPCID.Truffle) + { + shop.Add(ItemType()); + } } #endregion } diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index e14dd79c61..fedab5f87a 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -136,7 +136,6 @@ namespace CalamityMod.NPCs.Crabulon bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; NPC.spriteDirection = NPC.direction; @@ -146,7 +145,7 @@ namespace CalamityMod.NPCs.Crabulon // Phases bool phase2 = lifeRatio < 0.66f && expertMode; bool phase3 = lifeRatio < 0.33f && expertMode; - bool phase4 = lifeRatio < 0.15f && masterMode; + bool phase4 = lifeRatio < 0.15f && death; int despawnDistanceInTiles = 500; @@ -259,9 +258,9 @@ namespace CalamityMod.NPCs.Crabulon if (phase3) NPC.ai[1] += 1f; if (NPC.Distance(player.Center) < 160f) - NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; - // Gets tired easily in final phase. - Fabsol + // Gets tired easily in final phase. float idleTime = phase4 ? 480f : death ? 60f : expertMode ? 90f : 120f; if (NPC.ai[1] >= idleTime) { @@ -355,7 +354,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (NPC.Distance(player.Center) < 160f) - NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f); if (NPC.ai[1] >= stompPhaseGateValue) @@ -530,7 +529,7 @@ namespace CalamityMod.NPCs.Crabulon destination.Normalize(); destination *= projectileVelocity; - // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol + // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. int numProj = bossRush ? 24 : phase4 ? 14 : CalamityWorld.death ? (phase3 ? 10 : 16) : 12; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) @@ -555,7 +554,7 @@ namespace CalamityMod.NPCs.Crabulon destination.Normalize(); destination *= projectileVelocity; - // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol + // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. int numProj = bossRush ? 16 : phase4 ? 8 : (phase3 && death) ? 6 : 8; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index fad5059241..c5c3c4229e 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; if (NPC.ai[3] > 0f) { @@ -174,10 +174,10 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHead.SegmentVelocity_Master : + death ? DesertNuisanceHead.SegmentVelocity_Death : DesertNuisanceHead.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs index e82400e730..fc10337135 100644 --- a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -75,7 +75,7 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; if (NPC.ai[3] > 0f) { @@ -182,10 +182,10 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHeadYoung.SegmentVelocity_Master : + death ? DesertNuisanceHeadYoung.SegmentVelocity_Death : DesertNuisanceHeadYoung.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index b12922cb56..f1bc6a6ad5 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge private bool tailSpawned = false; public const float SegmentVelocity_Expert = 11f; - public const float SegmentVelocity_Master = 13.5f; + public const float SegmentVelocity_Death = 13.5f; public const float SegmentVelocity_GoodWorld = 19f; public const float SegmentVelocity_ZenithSeed = 22f; @@ -112,7 +112,6 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -274,10 +273,10 @@ namespace CalamityMod.NPCs.DesertScourge float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : Main.getGoodWorld ? SegmentVelocity_GoodWorld : - masterMode ? SegmentVelocity_Master : + death ? SegmentVelocity_Death : SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); if (Main.player[NPC.target].dead) diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 69bd6158db..58cd825560 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge private bool tailSpawned = false; public const float SegmentVelocity_Expert = 10f; - public const float SegmentVelocity_Master = 12f; + public const float SegmentVelocity_Death = 12f; public const float SegmentVelocity_GoodWorld = 16f; public const float SegmentVelocity_ZenithSeed = 18f; @@ -108,7 +108,6 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -172,12 +171,7 @@ namespace CalamityMod.NPCs.DesertScourge { Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (revenge ? 10f : 8f); int numProj = death ? 6 : getMad ? 4 : 3; - int spread = masterMode ? 28 : getMad ? 22 : 20; - if (masterMode) - { - numProj += 2; - spread += 8; - } + int spread = death ? 28 : getMad ? 22 : 20; float rotation = MathHelper.ToRadians(spread); int type = ModContent.ProjectileType(); @@ -318,10 +312,10 @@ namespace CalamityMod.NPCs.DesertScourge float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : Main.getGoodWorld ? SegmentVelocity_GoodWorld : - masterMode ? SegmentVelocity_Master : + death ? SegmentVelocity_Death : SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); if (Main.player[NPC.target].dead) diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 8b8bc97303..6769923e9b 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -138,10 +138,10 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHead.SegmentVelocity_Master : + death ? DesertNuisanceHead.SegmentVelocity_Death : DesertNuisanceHead.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs index 193643be96..8b502c0df0 100644 --- a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -146,10 +146,10 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHeadYoung.SegmentVelocity_Master : + death ? DesertNuisanceHeadYoung.SegmentVelocity_Death : DesertNuisanceHeadYoung.SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 522dbcd0ef..23d2a5c5a6 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -49,7 +49,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense = 6; NPC.DR_NERD(0.05f); - NPC.LifeMaxNERB(4200, 5000, 1400000); + NPC.LifeMaxNERB(4200, 5000, 1150000); if (Main.getGoodWorld) NPC.lifeMax *= 4; NPC.aiStyle = -1; @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; if (NPC.ai[3] > 0f) { @@ -218,7 +218,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : - masterMode ? DesertScourgeHead.SegmentVelocity_Master : + death ? DesertScourgeHead.SegmentVelocity_Death : expertMode ? DesertScourgeHead.SegmentVelocity_Expert : DesertScourgeHead.SegmentVelocity_Normal; if (burrow || lungeUpward) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 3659112078..de32d8946f 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.DesertScourge public const float SegmentVelocity_Normal = 10f; public const float SegmentVelocity_Expert = 12.5f; - public const float SegmentVelocity_Master = 15f; + public const float SegmentVelocity_Death = 15f; public const float SegmentVelocity_GoodWorld = 21f; public const float SegmentVelocity_ZenithSeed = 24f; @@ -94,7 +94,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.width = 104; NPC.height = 104; - NPC.LifeMaxNERB(4200, 5000, 1400000); + NPC.LifeMaxNERB(4200, 5000, 1150000); if (Main.getGoodWorld) NPC.lifeMax *= 4; NPC.aiStyle = -1; @@ -126,7 +126,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void BossHeadSlot(ref int index) { - if ((NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !Main.masterMode) + if ((NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !CalamityWorld.death) index = -1; } @@ -167,12 +167,11 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; // Check for Nuisances - bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !masterMode; + bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !death; if (hide) { NPC.Calamity().newAI[0] = 0f; @@ -544,7 +543,7 @@ namespace CalamityMod.NPCs.DesertScourge float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : Main.getGoodWorld ? SegmentVelocity_GoodWorld : - masterMode ? SegmentVelocity_Master : + death ? SegmentVelocity_Death : expertMode ? SegmentVelocity_Expert : SegmentVelocity_Normal; if (burrow || lungeUpward) diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index b969562016..5415c8e938 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense = 9; NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(4200, 5000, 1400000); + NPC.LifeMaxNERB(4200, 5000, 1150000); if (Main.getGoodWorld) NPC.lifeMax *= 4; NPC.aiStyle = -1; @@ -74,7 +74,7 @@ namespace CalamityMod.NPCs.DesertScourge { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || bossRush; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -180,7 +180,7 @@ namespace CalamityMod.NPCs.DesertScourge // Calculate contact damage based on velocity float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : - masterMode ? DesertScourgeHead.SegmentVelocity_Master : + death ? DesertScourgeHead.SegmentVelocity_Death : expertMode ? DesertScourgeHead.SegmentVelocity_Expert : DesertScourgeHead.SegmentVelocity_Normal; if (burrow || lungeUpward) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 232c5b3899..2d1b9fc913 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -2603,9 +2603,6 @@ namespace CalamityMod.NPCs.DevourerofGods // Extraneous potions npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary - // Alicorn Mount - npcLoot.AddIf((info) => info.player.Calamity().cirrusVodka, ModContent.ItemType()); - // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index e78f4f714b..b00a9ac876 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -1180,7 +1180,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.ForceNetUpdate(); // Plasma bolts on charge - if (Main.netMode != NetmodeID.MultiplayerClient && (!(Main.zenithWorld && !exoMechdusa) || (CalamityWorld.LegendaryMode && revenge))) // I'm not that evil (you aren't, but I am - Fab) + if (Main.netMode != NetmodeID.MultiplayerClient && (!(Main.zenithWorld && !exoMechdusa) || (CalamityWorld.LegendaryMode && revenge))) { int totalProjectiles = bossRush ? 16 : death ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 0ba70930b6..167ada2582 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -1625,7 +1625,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npcLoot.Add(ItemDropRule.BossBagByCondition(DropHelper.If(CanDropLoot), ModContent.ItemType())); // Legendary seed soup - mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().exoMechdusa), ModContent.ItemType()), hideLootReport: true); + mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().exoMechdusa), ModContent.ItemType()), hideLootReport: true); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 758f6cac73..9e5ae8406a 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -65,9 +65,9 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - bool masterMode = Main.masterMode; + bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; - float speed = masterMode ? 15f : revenge ? 13f : 11f; + float speed = death ? 15f : revenge ? 13f : 11f; if (BossRushEvent.BossRushActive) speed = 18f; diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 56c9153f18..e44757e78c 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -63,7 +63,6 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -77,12 +76,6 @@ namespace CalamityMod.NPCs.HiveMind float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : death ? 7f : revenge ? 6f : 4f; float acceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.5f : death ? 0.35f : revenge ? 0.3f : 0.2f; float deceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.9f : death ? 0.95f : revenge ? 0.96f : 0.98f; - if (masterMode) - { - velocity += 2f; - acceleration += 0.2f; - deceleration -= 0.05f; - } if (BossRushEvent.BossRushActive) { velocity *= 2f; @@ -105,7 +98,7 @@ namespace CalamityMod.NPCs.HiveMind } bool dropRain = NPC.Bottom.Y < Main.player[NPC.target].position.Y - 350f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); - float distanceX = masterMode ? 200f : 400f; + float distanceX = death ? 200f : 400f; if (NPC.Center.X > Main.player[NPC.target].Center.X + distanceX) { dropRain = false; diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 195befe9ea..e3bcc35ee9 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -62,7 +62,6 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -171,7 +170,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.localAI[1] += 1f; if (NPC.localAI[1] < ShowTelegraphValue) NPC.localAI[1] += Main.rand.Next(2); - if (masterMode) + if (death) NPC.localAI[1] += 1f; } @@ -184,8 +183,6 @@ namespace CalamityMod.NPCs.HiveMind if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (masterMode) - projSpeed += 2f; if (Main.getGoodWorld) projSpeed *= 1.5f; diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs index 0587b8edb2..47acb7e3dc 100644 --- a/NPCs/HiveMind/HiveBlob2.cs +++ b/NPCs/HiveMind/HiveBlob2.cs @@ -56,7 +56,6 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -165,7 +164,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.localAI[1] += 1f; if (NPC.localAI[1] < ShowTelegraphValue) NPC.localAI[1] += Main.rand.Next(2); - if (masterMode) + if (death) NPC.localAI[1] += 1f; } @@ -178,8 +177,6 @@ namespace CalamityMod.NPCs.HiveMind if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (masterMode) - projSpeed += 2f; if (Main.getGoodWorld) projSpeed *= 1.5f; diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 8e18fc78ad..dac83e0034 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -159,7 +159,6 @@ namespace CalamityMod.NPCs.HiveMind bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -204,17 +203,6 @@ namespace CalamityMod.NPCs.HiveMind vileSpitFireRate = 12; } - if (masterMode) - { - lungeRots += 0.1; - minimumDriftTime /= 2; - reelbackFade *= 2; - lungeTime -= 5; - driftSpeed += ((death && !bossRush) ? 0.5f : 1f); - driftBoost += ((death && !bossRush) ? 0.5f : 1f); - vileSpitFireRate -= 6; - } - if (Main.getGoodWorld) { reelbackFade *= 10; @@ -370,15 +358,14 @@ namespace CalamityMod.NPCs.HiveMind { bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; int maxSpawns = death ? Main.rand.Next(3, 5) : revenge ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; for (int i = 0; i < maxSpawns; i++) { - int type = 0; - int choice = masterMode ? 1 : -1; + int type; + int choice = -1; do { choice++; @@ -459,7 +446,6 @@ namespace CalamityMod.NPCs.HiveMind bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -886,7 +872,7 @@ namespace CalamityMod.NPCs.HiveMind phase2timer--; - if (masterMode) + if (death) { // Use an attack sooner if being hit if (NPC.justHit) @@ -934,7 +920,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.Y = NPC.ai[2] * 16 - NPC.height / 2; } - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); NPC.ForceNetUpdate(); } else if (NPC.ai[1] == 0f && NPC.ai[2] == 0f) @@ -1003,7 +989,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - if (masterMode) + if (death) { NPC.localAI[2] += 1f; if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) @@ -1042,7 +1028,7 @@ namespace CalamityMod.NPCs.HiveMind { NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - if (masterMode) + if (death) { NPC.localAI[2] += 1f; if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) @@ -1086,7 +1072,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.Y += teleportRadius; } - NPC.alpha -= masterMode ? 10 : 5; + NPC.alpha -= 5; if (NPC.alpha < 0) NPC.alpha = 0; @@ -1148,7 +1134,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.X += (death ? (teleportRadius * 1.5f) : teleportRadius) * (rainDashesPerformed == 0 ? rotationDirection : -rotationDirection); } - NPC.alpha -= masterMode ? 10 : 5; + NPC.alpha -= 5; if (NPC.alpha < 0) NPC.alpha = 0; @@ -1217,7 +1203,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); performingRainDashCombo = false; rainDashesPerformed = 0; state = 0; @@ -1232,7 +1218,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); performingLungeCombo = false; lungesPerformed = 0; state = 0; @@ -1240,7 +1226,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); state = 0; } diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 04d468c868..c1d15e08a3 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -166,7 +166,6 @@ namespace CalamityMod.NPCs.Leviathan bool death = CalamityWorld.death || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); // Enrage diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 6bc4f523b7..5a301b94a5 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -224,7 +224,6 @@ namespace CalamityMod.NPCs.Leviathan bool immuneToSlowingDebuffs = NPC.ai[0] == 2f; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index a1455124e3..56a6b55f02 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -98,14 +98,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { Player player = Main.player[NPC.target]; - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; float movementSpeed = 1f; NPC.TargetClosest(true); bool stopMoving = false; int offsetX = 80; - int projectileDamage = masterMode ? 8 : expertMode ? 9 : 12; + int projectileDamage = Main.masterMode ? 8 : Main.expertMode ? 9 : 12; if (NPC.life < NPC.lifeMax * 0.33 && CalamityWorld.death) { movementSpeed = 2f; diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs index 9a644aa5ae..4e3236cde9 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs @@ -55,6 +55,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + bool bossRush = BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || bossRush; // Despawn if (!CalamityPlayer.areThereAnyDamnBosses) @@ -124,7 +126,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Fire projectiles NPC.ai[0] += 1f; - if (NPC.ai[0] >= (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) + if (NPC.ai[0] >= (bossRush ? BoltShootGateValue_BossRush : death ? BoltShootGateValue_Death : BoltShootGateValue)) { NPC.ai[0] = 0f; @@ -134,7 +136,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 projVector = new Vector2(xDist, yDist); float projLength = projVector.Length(); - float speed = Main.masterMode ? 12f : 10f; + float speed = death ? 12f : 10f; int type = ModContent.ProjectileType(); projLength = speed / projLength; @@ -152,9 +154,9 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.netMode != NetmodeID.MultiplayerClient) { int damage = NPC.GetProjectileDamage(type); - if (CalamityWorld.death || BossRushEvent.BossRushActive) + if (death) { - int numProj = Main.masterMode ? 5 : 4; + int numProj = 4; float rotation = MathHelper.ToRadians(18); for (int i = 0; i < numProj; i++) { diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs index dcbd25f0ae..76ea9c25c2 100644 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ b/NPCs/NormalNPCs/SkeletronPrime2.cs @@ -264,7 +264,6 @@ namespace CalamityMod.NPCs.NormalNPCs bool immuneToSlowingDebuffs = NPC.ai[1] == 5f; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 8a18300de4..79c8333645 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -186,7 +186,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool immuneToSlowingDebuffs = NPC.ai[0] == 0f || NPC.ai[0] == 4f; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 3e312cbf39..81ecc448d3 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -340,7 +340,6 @@ namespace CalamityMod.NPCs.PrimordialWyrm bool immuneToSlowingDebuffs = AIState == (float)Phase.FinalPhase || AIState == (float)Phase.ShadowFireballSpin; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index 6865a35376..07b540a747 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -650,6 +650,9 @@ namespace CalamityMod.NPCs.SlimeGod float jumpSpeedX = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 10f) + distanceSpeedBoost) * NPC.direction; float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -16f) + jumpSpeedY = -16f; + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); NPC.ai[2] += 1f; diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 53b640896e..c366736034 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -493,6 +493,9 @@ namespace CalamityMod.NPCs.SlimeGod // Distance required to charge float minChargeSafeDistance = 650f; + // Duration for slow down after charging + float slowDownDurationAfterCharge = revenge ? 90f : 120f; + // Charge variables float chargeVelocityMult = 0.1f; float maxChargeVelocity = (bossRush || enraged) ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; @@ -545,7 +548,6 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[2] >= phaseGateValue) { NPC.ai[1] = 2f; - float slowDownDurationAfterCharge = revenge ? 90f : 120f; NPC.ai[2] = slowDownDurationAfterCharge; NPC.localAI[2] = 0f; NPC.velocity *= 0.5f; @@ -597,7 +599,19 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] -= 1f; + // Fly to a location that the player can hit + bool flyToHittableLocation = NPC.ai[2] == slowDownDurationAfterCharge && !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); + if (flyToHittableLocation) + { + Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; + NPC.SimpleFlyMovement(velocity, 0.25f); + } + else + { + NPC.velocity *= 0.95f; + NPC.ai[2] -= 1f; + } + if (NPC.ai[2] <= 0f) { NPC.Calamity().newAI[0] = NPC.ai[0]; @@ -609,8 +623,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(); NPC.netUpdate = true; } - - NPC.velocity *= 0.95f; } } @@ -752,7 +764,6 @@ namespace CalamityMod.NPCs.SlimeGod { // Difficulty bools bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode; bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; bool ableToDropSlime = npc.ai[1] == 1f; @@ -771,7 +782,7 @@ namespace CalamityMod.NPCs.SlimeGod } float slimeBombardmentDistance = 720f; - float flyDistanceY = slimeBombardment ? -450f : masterMode ? -360f : -405f; + float flyDistanceY = slimeBombardment ? -450f : death ? -360f : -405f; float flyDistanceX = slimeBombardment ? (ableToDropSlime ? (slimeBombardmentDistance * -npc.ai[2]) : (slimeBombardmentDistance * npc.ai[2])) : 0f; Vector2 destination = Main.player[npc.target].Center + new Vector2(flyDistanceX, flyDistanceY); diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index 9ea656170d..dfd3f73e7d 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -590,6 +590,9 @@ namespace CalamityMod.NPCs.SlimeGod float jumpSpeedX = ((death ? 16.25f : revenge ? 14.5f : expertMode ? 13.5f : 11.5f) + distanceSpeedBoost) * NPC.direction; float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -16f) + jumpSpeedY = -16f; + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); NPC.ai[2] += 1f; diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 0879e1ec26..bbbd3c5e50 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -124,6 +124,10 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + + // How fast the slime slams down + float slamVelocity = bossRush ? 20f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -167,6 +171,17 @@ namespace CalamityMod.NPCs.SlimeGod hyperMode = true; } + // Slow down dramatically while teleporting + if (NPC.ai[0] == 5f || NPC.ai[0] == 6f) + { + if (Math.Abs(NPC.velocity.X) > 0.1f) + { + NPC.velocity.X *= 0.8f; + if (Math.Abs(NPC.velocity.X) <= 0.1f) + NPC.velocity.X = 0f; + } + } + // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -174,10 +189,7 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - // Slow down dramatically - NPC.velocity.X *= 0.5f; - - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -235,31 +247,27 @@ namespace CalamityMod.NPCs.SlimeGod // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - NPC.ai[3] += death ? 3f : 2f; + // Teleport very soon if too far away + float catchUpDistance = 1500f; + bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; + if (fastTeleport) + { + NPC.ai[3] += 10f; + } else - NPC.ai[3] += 1f; + { + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) + NPC.ai[3] += death ? 3f : 2f; + else + NPC.ai[3] += 1f; + } } - float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); + float distanceSpeedBoost = NPC.Distance(player.Center) * (bossRush ? 0.008f : 0.005f); if (NPC.ai[0] == 0f) { - // Catch up to the target if too far away - float catchUpDistance = 1600f; - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[0] = 5f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit @@ -288,7 +296,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += hyperMode ? 2f : 1f; float jumpGateValue = 45f; - float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + float velocityX = death ? 13f : revenge ? 12f : expertMode ? 11f : 9f; if (revenge) { float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); @@ -297,7 +305,7 @@ namespace CalamityMod.NPCs.SlimeGod velocityX += speedBoost; } - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); float speedMult = 1f; if (distanceBelowTarget > 0f) speedMult += distanceBelowTarget * 0.002f; @@ -306,9 +314,6 @@ namespace CalamityMod.NPCs.SlimeGod speedMult = 2f; float velocityY = 10f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; if (NPC.ai[1] > jumpGateValue) { @@ -377,7 +382,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; + NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; } NPC.ai[1] = 0f; @@ -404,7 +409,7 @@ namespace CalamityMod.NPCs.SlimeGod float slimeShotVelocity = 6f; Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; float minFiringDistance = 160f; // 10 tile distance - if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) + if (NPC.Distance(player.Center) > minFiringDistance) { SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -442,37 +447,40 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 targetCenter = player.Center; - targetCenter.Y -= 350f; - Vector2 targetDist = targetCenter - NPC.Center; + + float distanceAboveTarget = 350f; + Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; + float moveSpeed = slamVelocity - 6f; + float inertia = 5f; + velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; - if (NPC.ai[1] > 12f) + float delayBeforeSlamming = 12f; + if (NPC.ai[1] > delayBeforeSlamming) { NPC.ai[1] = 0f; NPC.ai[0] = 2.1f; NPC.ai[2] = 0f; - NPC.velocity = targetDist; + NPC.velocity = velocity; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - targetDist = targetDist.SafeNormalize(Vector2.UnitY); - targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; + float moveSpeed = (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) + distanceSpeedBoost; + float inertia = 6f; + velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; } } else if (NPC.ai[0] == 2.1f) @@ -480,7 +488,7 @@ namespace CalamityMod.NPCs.SlimeGod // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -588,9 +596,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; NPC.velocity.Y += 0.5f; - float velocityLimit = bossRush ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; + if (NPC.velocity.Y > slamVelocity) + NPC.velocity.Y = slamVelocity; } else if (NPC.ai[0] == 3f) { @@ -603,30 +610,21 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - if (NPC.ai[1] > 15f) + float jumpGateValue = 15f; + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - NPC.velocity.Y -= 6f; - if (player.position.Y + player.height < NPC.Center.Y) - NPC.velocity.Y -= 1.2f; - if (player.position.Y + player.height < NPC.Center.Y - 40f) - NPC.velocity.Y -= 1.4f; - if (player.position.Y + player.height < NPC.Center.Y - 80f) - NPC.velocity.Y -= 1.7f; - if (player.position.Y + player.height < NPC.Center.Y - 120f) - NPC.velocity.Y -= 2f; - if (player.position.Y + player.height < NPC.Center.Y - 160f) - NPC.velocity.Y -= 2.2f; - if (player.position.Y + player.height < NPC.Center.Y - 200f) - NPC.velocity.Y -= 2.4f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - NPC.velocity.Y -= 2f; + float jumpSpeedX = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 8f) + distanceSpeedBoost) * NPC.direction; + float jumpSpeedY = -6f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -18f) + jumpSpeedY = -18f; + + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); - NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else @@ -638,7 +636,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); + float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -682,43 +680,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } + // Teleport shit else if (NPC.ai[0] == 5f) - { - // Set damage - NPC.damage = setDamage; - - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.spriteDirection = NPC.direction; - - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.knockBackResist = 0f; - - Vector2 distanceFromTarget = player.Center - NPC.Center; - distanceFromTarget.Y -= 16f; - if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - - float movementSpeed = 16f; - if (distanceFromTarget.Length() > movementSpeed) - { - distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); - distanceFromTarget *= movementSpeed; - } - - float inertia = 25f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; - } - else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; @@ -731,14 +694,14 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 7f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 7f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; } @@ -752,7 +715,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[corruptDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 7f) + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs index bc5c435076..6bc7d9c2be 100644 --- a/NPCs/SunkenSea/AlphaSeaMinnow.cs +++ b/NPCs/SunkenSea/AlphaSeaMinnow.cs @@ -27,13 +27,15 @@ namespace CalamityMod.NPCs.SunkenSea public ref float CurrentBehavior => ref NPC.ai[1]; public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 600; + public static int IdleMinPathDistance = 100; public static int IdleMaxPathDistance = 1200; public static int FleeTileAnticipationDistance = 64; public Vector2 randomPathPoint; + public bool instantiated = false; + protected override List PreyIDs => new List(); protected override List PredatorIDs => new List() { @@ -95,12 +97,12 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.TargetClosest(false); // Spawn a shoal of minnows - int fishCount = Main.rand.Next(5, 10); + int fishCount = Main.rand.Next(2, 7); // More spawn in the Radiant Reefs if (NPC.HasPlayerTarget) { if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - fishCount += 5; + fishCount += 3; } for (int i = 0; i < fishCount; i++) { @@ -109,15 +111,18 @@ namespace CalamityMod.NPCs.SunkenSea int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, minnowtype); Main.npc[n].ai[2] = NPC.whoAmI; // makes the spawned minnow recognize this one as the alpha } - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.6f, - MaxSpeed = 4f, - }; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.6f, + MaxSpeed = 4f, + }; + } if (NPC.wet) { switch (CurrentBehavior) @@ -241,7 +246,11 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + if (spawnInfo.Player.Calamity().ZoneRadiantReefs) + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } return 0f; } @@ -284,7 +293,11 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.03f; + if (spawnInfo.Player.Calamity().ZoneRadiantReefs) + return SpawnCondition.CaveJellyfish.Chance * 0.2f; + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.05f; + } return 0f; } diff --git a/NPCs/SunkenSea/CarrionSwallower.cs b/NPCs/SunkenSea/CarrionSwallower.cs index c54ee4a301..82f8a7ca67 100644 --- a/NPCs/SunkenSea/CarrionSwallower.cs +++ b/NPCs/SunkenSea/CarrionSwallower.cs @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.Cavern.Chance * 0.6f; + return SpawnCondition.Cavern.Chance * 0.4f; } return 0f; } diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 5b125e4a25..ce3fe26a48 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -130,6 +130,14 @@ namespace CalamityMod.NPCs.SunkenSea #region AI Functions public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + MaxSpeed = 4.85f, + Acceleration = 0.5f + }; + } CurrentBehavior?.Invoke(); // If out of water, act like you're out of water. diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs index 9cb8a96ac1..971696be5d 100644 --- a/NPCs/SunkenSea/FesteringRemains.cs +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -142,7 +142,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.Cavern.Chance * 0.6f; + return SpawnCondition.Cavern.Chance * 0.4f; } return 0f; } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 57804f5167..5c7057d29f 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -130,13 +130,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { - Variant = Main.rand.Next(0, 3); - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.1f, - MaxSpeed = 1f, - }; NPC.TargetClosest(); + Variant = Main.rand.Next(0, 3); if (Phase == (int)PhaseType.Idle) { // 1-3 in the Polyp Forest, 3-4 in the burrows @@ -166,6 +161,15 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.1f, + MaxSpeed = 1f, + }; + } + CreateTentacles(); NPC.ai[2]++; @@ -338,9 +342,13 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; + if (spawnInfo.Player.Calamity().ZonePolypForest) + return SpawnCondition.CaveJellyfish.Chance * 0.5f; + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } return 0f; } diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs index 4f12c5fe82..22d502e83c 100644 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ b/NPCs/SunkenSea/Jellyghoul.cs @@ -1,14 +1,15 @@ -using CalamityMod.BiomeManagers; +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; using CalamityMod.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Systems; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -16,6 +17,7 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { @@ -82,7 +84,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { - NPC.Center -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); + NPC.position -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); } public override void AI() { @@ -162,16 +164,11 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Framing.GetTileSafely(spawnInfo.SpawnTileX, spawnInfo.SpawnTileY); - - return !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType() ? 0.05f : 0f; - - //fuck this - //if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType()) - //{ - // return 0.05f; - //} - //return 0f; + if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.Cavern.Chance * 0.9f; + } + return 0f; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs index 7e6a105fab..74c29cbde3 100644 --- a/NPCs/SunkenSea/KelpieSeadragon.cs +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -93,17 +93,16 @@ namespace CalamityMod.NPCs.SunkenSea }); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.3f, - MaxSpeed = 3f, - }; - } - public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.3f, + MaxSpeed = 3f, + }; + } if (NPC.direction == 0) { NPC.TargetClosest(); @@ -359,7 +358,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; + return SpawnCondition.CaveJellyfish.Chance * 0.7f; } return 0f; } diff --git a/NPCs/SunkenSea/LazarusLampfish.cs b/NPCs/SunkenSea/LazarusLampfish.cs index 80576536d1..7106f1ef69 100644 --- a/NPCs/SunkenSea/LazarusLampfish.cs +++ b/NPCs/SunkenSea/LazarusLampfish.cs @@ -115,17 +115,16 @@ namespace CalamityMod.NPCs.SunkenSea }); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.2f, - MaxSpeed = 3f, - }; - } - public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.2f, + MaxSpeed = 3f, + }; + } if (NPC.direction == 0) { NPC.TargetClosest(); diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs index f26a3954a1..007a96a9bd 100644 --- a/NPCs/SunkenSea/LostShoal.cs +++ b/NPCs/SunkenSea/LostShoal.cs @@ -188,7 +188,7 @@ namespace CalamityMod.NPCs.SunkenSea if (Role == 0) { // the amount of fish to spawn - int fishCount = 5; + int fishCount = Main.rand.Next(3, 6); for (int i = 0; i < fishCount; i++) { int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs index 65a9369fd2..0bad944772 100644 --- a/NPCs/SunkenSea/Pearlpod.cs +++ b/NPCs/SunkenSea/Pearlpod.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.SunkenSea protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - public abstract int PearlType { get; } public abstract float SpawnRate { get; } public abstract int ItemType { get; } @@ -53,8 +52,8 @@ namespace CalamityMod.NPCs.SunkenSea base.SetDefaults(); NPC.aiStyle = NPCAIStyleID.Snail; NPC.damage = 0; - NPC.width = 24; - NPC.height = 24; + NPC.width = 30; + NPC.height = 30; NPC.defense = 0; NPC.lifeMax = 20; NPC.knockBackResist = 0f; @@ -243,10 +242,6 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.dontTakeDamage = false; } - if (NPC.type == ModContent.NPCType()) - { - NPC.ProduceGoldCritterDust(); - } } /// @@ -337,15 +332,16 @@ namespace CalamityMod.NPCs.SunkenSea { return !(CurrentPhase == (int)PhaseType.Hiding && !IsClamValid()) && (base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); } + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); public override void FindFrame(int frameHeight) { NPC.frameCounter++; - if (NPC.frameCounter > 8) + if (NPC.frameCounter > 6) { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 5) + if (NPC.frame.Y > frameHeight * 3) { NPC.frame.Y = 0; } @@ -368,11 +364,6 @@ namespace CalamityMod.NPCs.SunkenSea Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); } } - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(PearlType); - } } public class PearlpodWhite : Pearlpod @@ -380,9 +371,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 6; + Main.npcFrameCount[Type] = 4; } - public override int PearlType => ItemID.WhitePearl; public override float SpawnRate => 0.6f; public override int ItemType => ModContent.ItemType(); } @@ -392,10 +382,9 @@ namespace CalamityMod.NPCs.SunkenSea { base.SetStaticDefaults(); this.HideFromBestiary(); - Main.npcFrameCount[Type] = 6; + Main.npcFrameCount[Type] = 4; } - public override int PearlType => ItemID.PinkPearl; public override float SpawnRate => 0.05f; public override int ItemType => ModContent.ItemType(); } @@ -405,37 +394,9 @@ namespace CalamityMod.NPCs.SunkenSea { base.SetStaticDefaults(); this.HideFromBestiary(); - Main.npcFrameCount[Type] = 6; + Main.npcFrameCount[Type] = 4; } - public override int PearlType => ItemID.BlackPearl; public override float SpawnRate => 0.2f; public override int ItemType => ModContent.ItemType(); } - public class PearlpodGold : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - Main.npcFrameCount[Type] = 6; - } - public override void SetDefaults() - { - base.SetDefaults(); - NPC.value = 120000; - NPC.catchItem = ItemType; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - NPC.rarity = 3; - } - public override int PearlType => ItemID.GoldCoin; - public override float SpawnRate => 0.0005f; - public override int ItemType => ModContent.ItemType(); - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } - } - } } diff --git a/NPCs/SunkenSea/PearlpodBlack.png b/NPCs/SunkenSea/PearlpodBlack.png index d5712b33f6..405f8278dd 100644 Binary files a/NPCs/SunkenSea/PearlpodBlack.png and b/NPCs/SunkenSea/PearlpodBlack.png differ diff --git a/NPCs/SunkenSea/PearlpodGold.png b/NPCs/SunkenSea/PearlpodGold.png deleted file mode 100644 index e6e92061d2..0000000000 Binary files a/NPCs/SunkenSea/PearlpodGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/PearlpodPink.png b/NPCs/SunkenSea/PearlpodPink.png index 3c54290643..65ffef0598 100644 Binary files a/NPCs/SunkenSea/PearlpodPink.png and b/NPCs/SunkenSea/PearlpodPink.png differ diff --git a/NPCs/SunkenSea/PearlpodWhite.png b/NPCs/SunkenSea/PearlpodWhite.png index 97ccc73385..b23e06f817 100644 Binary files a/NPCs/SunkenSea/PearlpodWhite.png and b/NPCs/SunkenSea/PearlpodWhite.png differ diff --git a/NPCs/SunkenSea/PodobooKoi.cs b/NPCs/SunkenSea/PodobooKoi.cs index 10be89287f..a390f864b8 100644 --- a/NPCs/SunkenSea/PodobooKoi.cs +++ b/NPCs/SunkenSea/PodobooKoi.cs @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 1; + Main.npcFrameCount[Type] = 15; base.SetStaticDefaults(); } @@ -88,7 +88,7 @@ namespace CalamityMod.NPCs.SunkenSea base.SetDefaults(); NPC.noGravity = true; NPC.damage = 30; - NPC.width = 40; + NPC.width = 32; NPC.height = 32; NPC.defense = 10; NPC.lifeMax = 1000; @@ -124,15 +124,18 @@ namespace CalamityMod.NPCs.SunkenSea { CurrentVariant = Main.rand.Next(1, 4); } - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.5f, - MaxSpeed = 4f, - }; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.5f, + MaxSpeed = 4f, + }; + } if (NPC.ai[3] <= 0) { lavaLine = FindLavaLine(); @@ -173,12 +176,21 @@ namespace CalamityMod.NPCs.SunkenSea public void IdleBehavior() { // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), LavaTileValiditySizeless)); + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), LavaTileValidityLenient)); } - public bool LavaTileValiditySizeless(Point point) + /// + /// Same as LavaTileValidity but without the requirement for a full tile of lava + /// + /// + /// + public bool LavaTileValidityLenient(Point point) { - return !(Main.tile[point].IsTileSolidGround() || Main.tile[point].LiquidAmount < 255 || Main.tile[point].LiquidType != LiquidID.Lava); + Point actualFuckingPoint = new Point(point.X * 16, point.Y * 16); + + return NPC.Hitbox.Contains(actualFuckingPoint) + || !NPC.GetIntersectingHitboxPoints( + actualFuckingPoint, 10, 10).Any(a => Main.tile[a].IsTileSolidGround() || Main.tile[a].LiquidAmount < 25 || Main.tile[a].LiquidType != LiquidID.Lava); } public void FleeBehavior() @@ -209,7 +221,7 @@ namespace CalamityMod.NPCs.SunkenSea float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); NPC.netUpdate = true; - pathfinding.DoPathfinding(new(NPC.Center, randomPathPoint, LavaTileValidity)); + pathfinding.DoPathfinding(new(NPC.Center, randomPathPoint, LavaTileValidityLenient)); } } @@ -223,7 +235,7 @@ namespace CalamityMod.NPCs.SunkenSea return; } pathfinding.MaxSpeed = 8; - pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, LavaTileValidity)); + pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, LavaTileValidityLenient)); } public void HostileBehavior() @@ -286,7 +298,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.velocity.Y = 4; } pathfinding.MaxSpeed = 6; - pathfinding.DoPathfinding(new(NPC.Center, CurrentPlayer.Center, LavaTileValiditySizeless)); + pathfinding.DoPathfinding(new(NPC.Center, CurrentPlayer.Center, LavaTileValidityLenient)); // Mark the fish as currently trying to chase the player NPC.Calamity().newAI[0] = 1; } @@ -361,7 +373,7 @@ namespace CalamityMod.NPCs.SunkenSea pathfinding.MaxSpeed = 4; ShootTimer--; - if (ShootTimer <= -30) + if (ShootTimer <= -40) { ShootTimer = fireRate; @@ -469,12 +481,35 @@ namespace CalamityMod.NPCs.SunkenSea if (!NPC.wet && !NPC.IsABestiaryIconDummy) { NPC.frameCounter = 0.0; + NPC.frame.Y = 0; return; } - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; + bool shooting = ShootTimer <= -1; + int interval = shooting ? 12 : 6; + NPC.frameCounter++; + if (NPC.frameCounter > interval) + { + NPC.frame.Y++; + NPC.frameCounter = 0; + } + if (shooting) + { + if (NPC.frame.Y < 9) + { + NPC.frame.Y = 9; + } + if (NPC.frame.Y > 14) + { + NPC.frame.Y = 14; + } + } + else + { + if (NPC.frame.Y >= 9) + { + NPC.frame.Y = 0; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -492,9 +527,9 @@ namespace CalamityMod.NPCs.SunkenSea tex = bubbleEyedTex.Value; break; } - float animSped = MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, -30, ShootTimer, true)); + float animSped = MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, -40, ShootTimer, true)); Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.05f; - spriteBatch.Draw(tex, NPC.Center - screenPos, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(tex, NPC.Center - screenPos, tex.Frame(1, 15, 0, NPC.frame.Y), NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 30), scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } diff --git a/NPCs/SunkenSea/PodobooKoi.png b/NPCs/SunkenSea/PodobooKoi.png index e8b7fcedc2..a917e63dc3 100644 Binary files a/NPCs/SunkenSea/PodobooKoi.png and b/NPCs/SunkenSea/PodobooKoi.png differ diff --git a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png b/NPCs/SunkenSea/PodobooKoiBubbleEyed.png index 10c5578fee..ca341e7ea7 100644 Binary files a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png and b/NPCs/SunkenSea/PodobooKoiBubbleEyed.png differ diff --git a/NPCs/SunkenSea/PodobooKoiComet.png b/NPCs/SunkenSea/PodobooKoiComet.png index cb0a01e071..85350e418e 100644 Binary files a/NPCs/SunkenSea/PodobooKoiComet.png and b/NPCs/SunkenSea/PodobooKoiComet.png differ diff --git a/NPCs/SunkenSea/PodobooKoiOranda.png b/NPCs/SunkenSea/PodobooKoiOranda.png index 0fc87f9ec2..1f11720fca 100644 Binary files a/NPCs/SunkenSea/PodobooKoiOranda.png and b/NPCs/SunkenSea/PodobooKoiOranda.png differ diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs index 0d32065499..e4a4fa9c1c 100644 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -126,11 +126,6 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.5f, - MaxSpeed = 4f, - }; // Panaseas released by the player do not randomize when spawned if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) { @@ -182,6 +177,14 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.5f, + MaxSpeed = 4f, + }; + } // Reset polyp index in case the polyp dies if (PolypIndex > -1) { diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index d984bd780c..3b23f038bb 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -103,16 +103,16 @@ namespace CalamityMod.NPCs.SunkenSea NPC.chaseable = reader.ReadBoolean(); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(NPC) - { - MaxSpeed = 1.8f - }; - } - public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + MaxSpeed = 1.8f + }; + } + NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); @@ -239,7 +239,7 @@ namespace CalamityMod.NPCs.SunkenSea { if ((spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; + return SpawnCondition.CaveJellyfish.Chance * 0.7f; } return 0f; } diff --git a/NPCs/SunkenSea/PrismaticGuppy.cs b/NPCs/SunkenSea/PrismaticGuppy.cs index a5263ac657..79e948cf17 100644 --- a/NPCs/SunkenSea/PrismaticGuppy.cs +++ b/NPCs/SunkenSea/PrismaticGuppy.cs @@ -197,11 +197,6 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { NPC.frameCounter = Main.rand.NextFloat(FrameCount); - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.5f, - MaxSpeed = 4f, - }; CurrentShape = Main.rand.Next(0, 3); // Guppies released by the player do not randomize when spawned if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) @@ -247,6 +242,14 @@ namespace CalamityMod.NPCs.SunkenSea } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.5f, + MaxSpeed = 4f, + }; + } // Spawn more guppies if a leader/naturally spawned guppy if (Role == 0 && NPC.releaseOwner == 255) { @@ -630,7 +633,7 @@ namespace CalamityMod.NPCs.SunkenSea if (spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) return SpawnCondition.CaveJellyfish.Chance * 0.2f; if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; + return SpawnCondition.CaveJellyfish.Chance * 0.1f; } return 0f; } diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs index 67af701c6a..f65242bb4b 100644 --- a/NPCs/SunkenSea/Probesnout.cs +++ b/NPCs/SunkenSea/Probesnout.cs @@ -131,20 +131,29 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { - CurrentBehavior = IdlingBehavior; - NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); - NPC.GravityMultiplier *= 2f; - NPC.MaxFallSpeedMultiplier *= 2f; pathfinding = new PathfindingManager(NPC) { Acceleration = 0.4f, MaxSpeed = 8f, MinimumPointDistance = 60f }; + CurrentBehavior = IdlingBehavior; + NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + NPC.GravityMultiplier *= 2f; + NPC.MaxFallSpeedMultiplier *= 2f; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.4f, + MaxSpeed = 8f, + MinimumPointDistance = 60f + }; + } CurrentBehavior?.Invoke(); NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); @@ -487,7 +496,7 @@ namespace CalamityMod.NPCs.SunkenSea if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.015f; + return SpawnCondition.CaveJellyfish.Chance * 0.05f; } return 0f; } diff --git a/NPCs/SunkenSea/Scavenger.cs b/NPCs/SunkenSea/Scavenger.cs index 5939ce766e..b021457490 100644 --- a/NPCs/SunkenSea/Scavenger.cs +++ b/NPCs/SunkenSea/Scavenger.cs @@ -41,6 +41,9 @@ namespace CalamityMod.NPCs.SunkenSea { ItemID.WhitePearl, new WeightedRandom() }, { ItemID.BlackPearl, new WeightedRandom() }, { ItemID.PinkPearl, new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, { ItemID.GalaxyPearl, new WeightedRandom() }, { ModContent.ItemType(), new WeightedRandom() }, }; @@ -196,6 +199,11 @@ namespace CalamityMod.NPCs.SunkenSea AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); + // Pearlpods can be used as a substitute for pearls + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[white]; + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[black]; + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; + ScavengerLoot[ItemID.GalaxyPearl] = ScavengerLoot[white]; // Gives 1-2x the amount of white items ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; // Gives 2 pink items diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index c114d45ea8..7c841a74a1 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -71,14 +71,17 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.6f, - MaxSpeed = 5f, - }; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.6f, + MaxSpeed = 5f, + }; + } NPC owner = Main.npc[(int)NPC.ai[2]]; if (NPC.wet) { diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs index c4857a199b..7b967eb4e4 100644 --- a/NPCs/SunkenSea/Sharkoon.cs +++ b/NPCs/SunkenSea/Sharkoon.cs @@ -234,6 +234,14 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.3f, + MaxSpeed = 6f, + }; + } CurrentBehavior?.Invoke(); // Leans the Sharkoon towards the direction it's going. diff --git a/NPCs/SunkenSea/StormlionSentry.cs b/NPCs/SunkenSea/StormlionSentry.cs index 7dc8459e11..d99d6832ea 100644 --- a/NPCs/SunkenSea/StormlionSentry.cs +++ b/NPCs/SunkenSea/StormlionSentry.cs @@ -295,7 +295,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.Cavern.Chance * 0.5f; + return SpawnCondition.Cavern.Chance * 0.7f; } return 0f; } diff --git a/NPCs/SupremeCalamitas/CirrusHeadIcon.png b/NPCs/SupremeCalamitas/CirrusHeadIcon.png deleted file mode 100644 index b322de98ea..0000000000 Binary files a/NPCs/SupremeCalamitas/CirrusHeadIcon.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/CirrusHeadIcon2.png b/NPCs/SupremeCalamitas/CirrusHeadIcon2.png deleted file mode 100644 index 2052f7d75f..0000000000 Binary files a/NPCs/SupremeCalamitas/CirrusHeadIcon2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 6849d231a9..bf97d47107 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -70,10 +70,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas public const int ThirdBulletHellEndValue = BulletHellDuration * 3; public const int FourthBulletHellEndValue = BulletHellDuration * 4; public const int FifthBulletHellEndValue = BulletHellDuration * 5; - public const int CirrusPhotonRipperDamage = 3725; - private const float CirrusPhotonRipperDashVelocity = 6f; - private const float CirrusPhotonRipperMinDistanceFromTarget = 64f; - private const float CirrusPhotonRipperDashAcceleration = 0.3f; + public const int PermafrostAbsoluteZeroDamage = 3725; + private const float PermafrostPhotonRipperDashVelocity = 6f; + private const float PermafrostPhotonRipperMinDistanceFromTarget = 64f; + private const float PermafrostPhotonRipperDashAcceleration = 0.3f; public float bossLife; public float uDieLul = 1f; @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool spawnArena = false; public bool enteredBrothersPhase = false; public bool hasSummonedBrothers = false; - public bool cirrus = false; + public bool permafrost = false; public bool hasDoneDeathAnim = false; public bool postMusicHit = false; @@ -124,8 +124,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas public int bulletHellCounter2 = 0; public int attackCastDelay = 0; public int hitTimer = 0; - public int alicornFrame = 0; - public int alicornFrameCounter = 0; public int dashVisualCounter = 0; public int preventionPause = 15; // Helps prevent telefragging public int attackPause = 0; @@ -191,17 +189,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static int hoodedHeadIconP2Index; public static int hoodlessHeadIconIndex; public static int hoodlessHeadIconP2Index; - public static int cirrusHeadIconIndex; - public static int cirrusHeadIconP2Index; + public static int permafrostHeadIconIndex; public static float normalDR = 0.25f; public static float enragedDR = 0.9999f; public static readonly Color textColor = Color.Orange; - public static readonly Color cirrusTextColor = Color.Pink; + public static readonly Color permafrostTextColor = Color.LightCyan; public const int sepulcherSpawnCastTime = 75; public const int brothersSpawnCastTime = 150; - public const int MaxCirrusAlcohols = 20; - public const int MaxCirrusAlcoholDebuffDuration = 1500; // Sounds. public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SupremeCalamitasSpawn") { Volume = 1.2f }; @@ -220,8 +215,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public SlotId BulletHellRumbleSlot; public static Asset HoodedTexture; - public static Asset CirrusTexture; - public static Asset CirrusTexture2; + public static Asset PermafrostTexture; public static Asset ShieldTopTexture; public static Asset ShieldBottomTexture; public static Asset ForcefieldTexture; @@ -231,13 +225,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; - string cirrusIconPath = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon"; - string cirrusIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon2"; + string permafrostIconPath = "CalamityMod/NPCs/TownNPCs/Archmage_Head"; hoodedHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); hoodlessHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); - cirrusHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(cirrusIconPath, -1); - cirrusHeadIconP2Index = CalamityMod.Instance.AddBossHeadTexture(cirrusIconP2Path, -1); + permafrostHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(permafrostIconPath, -1); } public override void SetStaticDefaults() @@ -254,8 +246,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!Main.dedServ) { HoodedTexture = ModContent.Request(Texture + "Hooded", AssetRequestMode.AsyncLoad); - CirrusTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus", AssetRequestMode.AsyncLoad); - CirrusTexture2 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered", AssetRequestMode.AsyncLoad); + PermafrostTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremePermafrost", AssetRequestMode.AsyncLoad); ShieldTopTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop", AssetRequestMode.AsyncLoad); ShieldBottomTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom", AssetRequestMode.AsyncLoad); ForcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture", AssetRequestMode.AsyncLoad); @@ -300,9 +291,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void BossHeadSlot(ref int index) { bool inPhase2 = NPC.ai[0] == 3f; - if (cirrus) + if (permafrost) { - index = inPhase2 ? cirrusHeadIconP2Index : cirrusHeadIconIndex; + index = permafrostHeadIconIndex; } else { @@ -315,8 +306,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void ModifyTypeName(ref string typeName) { - if (cirrus) - typeName = CalamityUtils.GetTextValue("NPCs.SupremeCirrus"); + if (permafrost) + typeName = CalamityUtils.GetTextValue("NPCs.SupremePermafrost"); } public override void SendExtraAI(BinaryWriter writer) @@ -344,7 +335,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(spawnArena); writer.Write(hasSummonedBrothers); writer.Write(enteredBrothersPhase); - writer.Write(cirrus); + writer.Write(permafrost); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.chaseable); @@ -396,7 +387,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnArena = reader.ReadBoolean(); hasSummonedBrothers = reader.ReadBoolean(); enteredBrothersPhase = reader.ReadBoolean(); - cirrus = reader.ReadBoolean(); + permafrost = reader.ReadBoolean(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); @@ -462,8 +453,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Used for Scal's teleport at the start of brothers phase bool teleport = false; - // cirrus and zenith scal are mutually exclusive unless it's legendary - bool zenithAI = Main.zenithWorld && (!cirrus || (CalamityWorld.LegendaryMode && revenge && cirrus)); + // permafrost and zenith scal are mutually exclusive unless it's legendary + bool zenithAI = Main.zenithWorld && (!permafrost || (CalamityWorld.LegendaryMode && revenge && permafrost)); // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -518,11 +509,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalSummonText"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusSummonText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostSummonText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startText = true; } @@ -557,7 +548,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.Size != hitboxSize) NPC.Size = hitboxSize; bool shouldNotUseShield = bulletHellCounter2 % BulletHellDuration != 0 || attackCastDelay > 0 || - (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) || + (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) || NPC.ai[0] == 1f || NPC.ai[0] == 2f; // Make the shield and forcefield fade away in SCal's acceptance phase. @@ -582,7 +573,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); } } - else if (!cirrus) + else if (!permafrost) { // Emit dust off the skull at the position of its eye socket. for (float num6 = 1f; num6 < 16f; num6 += 1f) @@ -708,8 +699,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } NPC.Calamity().CurrentlyEnraged = !player.Hitbox.Intersects(safeBox); - // Cirrus fucks mounts if you exit her arena. - if (cirrus) + // Permafrost fucks mounts if you exit his arena. + if (permafrost) { if (!player.Hitbox.Intersects(safeBox) && player.mount.Active) { @@ -789,12 +780,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (DownedBossSystem.downedCalamitas && !bossRush) { // Create a teleport line effect - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, permafrost ? Color.Cyan : Color.Red); NPC.Center = initialRitualPosition; // Make the town NPC spawn. if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, permafrost ? ModContent.NPCType() : ModContent.NPCType()); } NPC.active = false; @@ -804,7 +795,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < MathHelper.Lerp(2f, 6f, 1f - NPC.Opacity); i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.color = permafrost ? Color.Cyan : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.noGravity = true; @@ -900,9 +891,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { attackCastDelay = sepulcherSpawnCastTime; - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); for (int i = 0; i < 100; i++) { @@ -948,9 +939,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); @@ -962,14 +953,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - // Cirrus throws alcohol bottles that explode into Fabstaff Rays - if (cirrus) + // Permafrost throws delicious meat that explode into more meat which doesn't split + if (permafrost) { if (bulletHellCounter2 % 90 == 0) { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 2f); } } @@ -1023,7 +1014,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startSecondAttack && lifeRatio <= 0.75f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1038,12 +1029,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalBH2Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH2Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH2Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startSecondAttack = true; @@ -1079,23 +1070,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); } #endregion - if (cirrus) + if (permafrost) { Vector2 destination = player.Center; Vector2 distanceFromDestination = destination - NPC.Center; - Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * CirrusPhotonRipperDashVelocity; + Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * PermafrostPhotonRipperDashVelocity; - if (Vector2.Distance(NPC.Center, destination) > CirrusPhotonRipperMinDistanceFromTarget) - NPC.SimpleFlyMovement(desiredVelocity * uDieLul, CirrusPhotonRipperDashAcceleration * uDieLul); + if (Vector2.Distance(NPC.Center, destination) > PermafrostPhotonRipperMinDistanceFromTarget) + NPC.SimpleFlyMovement(desiredVelocity * uDieLul, PermafrostPhotonRipperDashAcceleration * uDieLul); else NPC.velocity *= 0.9f; } @@ -1104,9 +1095,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - // Cirrus uses Photon Ripper - if (bulletHellCounter2 == SecondBulletHellEndValue + 1 && cirrus) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), CirrusPhotonRipperDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); + // Permafrost uses Absolute Zero which acts like Photon Ripper + if (bulletHellCounter2 == SecondBulletHellEndValue + 1 && permafrost) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), PermafrostAbsoluteZeroDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); if (bulletHellCounter2 % 180 == 0) // Blasts from top Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); @@ -1148,7 +1139,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startThirdAttack && lifeRatio <= 0.5f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1163,12 +1154,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalBH3Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH3Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH3Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startThirdAttack = true; @@ -1191,9 +1182,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (musicSyncCounter == 0 && !postMusicHit) { - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 4f, 17); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 4f, 17); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 3f, 19); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 3f, 19); GeneralParticleHandler.SpawnParticle(pulse2); for (int i = 0; i < 30; i++) { @@ -1255,9 +1246,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); @@ -1269,14 +1260,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) // More clustered attack { - // Cirrus throws alcohol bottles that explode into Fabstaff Rays - if (cirrus) + // Permafrost throws Delicious Meat that explodes into more meat that splits + if (permafrost) { if (bulletHellCounter2 % 90 == 0) { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer, 0f, 2f); } } @@ -1305,14 +1296,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 90; i++) { - Dust spawnDust = Dust.NewDustPerfect(safeBox.Center(), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + Dust spawnDust = Dust.NewDustPerfect(safeBox.Center(), permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); spawnDust.noGravity = true; spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } for (int i = 0; i < 40; i++) { Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(safeBox.Center() + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(safeBox.Center() + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), permafrost ? Color.DarkCyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); GeneralParticleHandler.SpawnParticle(orb); } @@ -1353,7 +1344,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startFourthAttack && lifeRatio <= 0.3f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1368,12 +1359,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalBH4Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH4Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH4Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startFourthAttack = true; @@ -1409,23 +1400,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); } #endregion - if (cirrus) + if (permafrost) { Vector2 destination = player.Center; Vector2 distanceFromDestination = destination - NPC.Center; - Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * CirrusPhotonRipperDashVelocity; + Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * PermafrostPhotonRipperDashVelocity; - if (Vector2.Distance(NPC.Center, destination) > CirrusPhotonRipperMinDistanceFromTarget) - NPC.SimpleFlyMovement(desiredVelocity * uDieLul, CirrusPhotonRipperDashAcceleration * uDieLul); + if (Vector2.Distance(NPC.Center, destination) > PermafrostPhotonRipperMinDistanceFromTarget) + NPC.SimpleFlyMovement(desiredVelocity * uDieLul, PermafrostPhotonRipperDashAcceleration * uDieLul); else NPC.velocity *= 0.9f; } @@ -1434,18 +1425,18 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - // Cirrus throws alcohol bottles that explode into Fabstaff Rays - if (cirrus) + // Permafrost throws delicious meat that explode into more delicious meat that doesn't split + if (permafrost) { - // Cirrus uses Photon Ripper + // Permafrost uses Absolute Zero similarly to Photon Ripper if (bulletHellCounter2 == FourthBulletHellEndValue + 1) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), CirrusPhotonRipperDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), PermafrostAbsoluteZeroDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); if (bulletHellCounter2 % 90 == 0) { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer); } } @@ -1500,7 +1491,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startFifthAttack && lifeRatio <= 0.1f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1513,15 +1504,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } string key = "Mods.CalamityMod.Status.Boss.SCalBH5Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH5Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH5Text"; if (!bossRush) { - if (DownedBossSystem.downedCalamitas && !cirrus) + if (DownedBossSystem.downedCalamitas && !permafrost) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startFifthAttack = true; @@ -1533,7 +1524,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (gettingTired5) { - if (cirrus) + if (permafrost) { if (giveUpCounter > 1) { @@ -1546,7 +1537,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (blasterTimer % blasterDivisor == 0) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), circleOffset, player.Center, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), circleOffset, player.Center, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 1f); } int beamDivisor = 60; @@ -1561,12 +1552,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < totalProjectiles; k++) { Vector2 rayVelocity = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (rayVelocity).SafeNormalize(Vector2.UnitY) * 16f, rayVelocity, ModContent.ProjectileType(), 250, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (rayVelocity).SafeNormalize(Vector2.UnitY) * 16f, rayVelocity, ModContent.ProjectileType(), 250, 0f, Main.myPlayer); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].DamageType = DamageClass.Default; Main.projectile[proj].friendly = false; Main.projectile[proj].hostile = true; + Main.projectile[proj].tileCollide = false; } } } @@ -1581,8 +1573,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (giveUpCounter == 1) { NPC.velocity = Vector2.Zero; - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.CirrusGiveUpText", cirrusTextColor); - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Pink); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.PermafrostGiveUpText", permafrostTextColor); + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Cyan); NPC.Center = initialRitualPosition; giveUpCounter--; } @@ -1600,7 +1592,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.active = false; NPC.netUpdate = true; - NPC.NPCLoot(); + + NPC.NPCLoot(); int cryo = NPC.FindFirstNPC(ModContent.NPCType()); + if (cryo > -1) + { + Main.npc[cryo].active = false; + Main.npc[cryo].netUpdate = true; + } } return; @@ -1623,7 +1621,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!hasDoneDeathAnim && !bossRush) // Scrapped death animation for Scal { attackPause = 5; - Dust.QuickDustLine(NPC.Center, safeBox.Center() + new Vector2(0, -30), 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, safeBox.Center() + new Vector2(0, -30), 500f, permafrost ? Color.Cyan : Color.Red); NPC.Center = safeBox.Center() + new Vector2(0, -30); NPC.velocity = new Vector2(10 * NPC.spriteDirection, -7); hasDoneDeathAnim = true; @@ -1635,7 +1633,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Teleport back to the arena on defeat if (giveUpCounter == GiveUpCounterMax) { - Dust.QuickDustLine(NPC.Center, initialRitualPosition + new Vector2(0, -30), 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, initialRitualPosition + new Vector2(0, -30), 500f, permafrost ? Color.Cyan : Color.Red); NPC.Center = initialRitualPosition + new Vector2(0, -30); NPC.noTileCollide = false; NPC.noGravity = false; @@ -1732,7 +1730,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.color = permafrost ? Color.Cyan : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1762,7 +1760,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.color = permafrost ? Color.Cyan : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1815,12 +1813,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText4"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBruhText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBruhText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } gettingTired5 = true; @@ -1828,7 +1826,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (!gettingTired4 && lifeRatio <= 0.02f) { - if (!bossRush && !cirrus) + if (!bossRush && !permafrost) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText3"; if (DownedBossSystem.downedCalamitas) @@ -1842,7 +1840,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (!gettingTired3 && lifeRatio <= 0.04f) { - if (!bossRush && !cirrus) + if (!bossRush && !permafrost) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText2"; if (DownedBossSystem.downedCalamitas) @@ -1859,12 +1857,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText1"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusNonchalantText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostNonchalantText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } gettingTired2 = true; @@ -1875,7 +1873,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas attackCastDelay = sepulcherSpawnCastTime; for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), permafrost ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -1884,7 +1882,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), permafrost ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -1925,17 +1923,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) + if (!halfLife && lifeRatio <= 0.45f && hasSummonedBrothers && (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalPhase2Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusPhase2Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostPhase2Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } halfLife = true; @@ -1948,57 +1946,26 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!bossRush) { string key = "Mods.CalamityMod.Status.Boss.SCalSeekerRingText"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusHallowBossSpamText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostHallowBossSpamText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (cirrus) + if (permafrost) { - // Spawn 1 Providence, 2 Queen Slimes and 2 Empress of Lights - int maximumBullshit = 5; - int angleFromCirrus = 360 / maximumBullshit; - int distanceFromCirrus = 300; - for (int i = 0; i < maximumBullshit; i++) - { - switch (i) - { - case 0: - int npc = NPC.NewNPC(NPC.GetSource_FromAI(), - (int)(vectorCenter.X + (Math.Sin(i * angleFromCirrus) * distanceFromCirrus)), - (int)(vectorCenter.Y + (Math.Cos(i * angleFromCirrus) * distanceFromCirrus)), - ModContent.NPCType(), NPC.whoAmI); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - break; - - case 1: - case 2: - int npc2 = NPC.NewNPC(NPC.GetSource_FromAI(), - (int)(vectorCenter.X + (Math.Sin(i * angleFromCirrus) * distanceFromCirrus)), - (int)(vectorCenter.Y + (Math.Cos(i * angleFromCirrus) * distanceFromCirrus)), - NPCID.HallowBoss, NPC.whoAmI); - Main.npc[npc2].timeLeft *= 20; - break; - - case 3: - case 4: - int npc3 = NPC.NewNPC(NPC.GetSource_FromAI(), - (int)(vectorCenter.X + (Math.Sin(i * angleFromCirrus) * distanceFromCirrus)), - (int)(vectorCenter.Y + (Math.Cos(i * angleFromCirrus) * distanceFromCirrus)), - NPCID.QueenSlimeBoss, NPC.whoAmI); - Main.npc[npc3].timeLeft *= 20; - break; - - default: - break; - } - } + // Spawn a buffed Pyrogen + int npc = NPC.NewNPC(NPC.GetSource_FromAI(), + (int)(vectorCenter.X), + (int)(vectorCenter.Y), + ModContent.NPCType(), NPC.whoAmI); + Main.npc[npc].timeLeft *= 20; + Main.npc[npc].lifeMax = Main.npc[npc].life *= 22; + CalamityUtils.BossAwakenMessage(npc); } else { @@ -2040,7 +2007,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; if (!teleport) { - Dust.QuickDustLine(NPC.Center, player.Center + new Vector2(0, -155), 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, player.Center + new Vector2(0, -155), 500f, permafrost ? Color.Cyan : Color.Red); NPC.velocity = Vector2.Zero; NPC.Center = player.Center + new Vector2(0, -175); Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); @@ -2263,7 +2230,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 9; i++) // fireblasts pre laugh { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.7f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.7f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.LightBlue : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } @@ -2282,7 +2249,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 9; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.8f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.8f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.LightBlue : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } @@ -2304,7 +2271,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 6; i++) // Spread dust for pre laugh floating { Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); - GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.65f, 0.9f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.65f, 0.9f), permafrost ? Color.Cyan : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f)); GeneralParticleHandler.SpawnParticle(orb); } @@ -2341,13 +2308,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; SoundEngine.PlaySound(DashSound, NPC.Center); - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundID.Item60, NPC.Center); float velocity = 8; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = (int)(NPC.damage / 3); Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; float rotation = MathHelper.ToRadians(22); @@ -2361,6 +2328,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.projectile[p].DamageType = DamageClass.Default; Main.projectile[p].friendly = false; Main.projectile[p].hostile = true; + Main.projectile[p].tileCollide = true; } } } @@ -2476,7 +2444,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 6; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 18, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 18, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.Cyan : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } @@ -2494,7 +2462,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.rand.NextBool()) // Hand spray magic { - GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.85f, 1.2f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.85f, 1.2f), permafrost ? Color.LightBlue : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); GeneralParticleHandler.SpawnParticle(orb); } @@ -2545,7 +2513,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 25; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - GlowOrbParticle spark2 = new GlowOrbParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GlowOrbParticle spark2 = new GlowOrbParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.Cyan : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } NPC.localAI[1] = 0f; @@ -2572,7 +2540,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } // Previously the 0.4% health threshold transition - if (lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) + if (lifeRatio <= 0.45f && hasSummonedBrothers && (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -2617,17 +2585,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 90; i++) { - Dust spawnDust = Dust.NewDustPerfect(NPC.Center, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + Dust spawnDust = Dust.NewDustPerfect(NPC.Center, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); spawnDust.noGravity = true; spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } for (int i = 0; i < 40; i++) { Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Red, true, true); + GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), permafrost ? Color.LightBlue : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 1.1f, 25); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.LightBlue : Color.Red, new Vector2(2f, 2f), 0, 0f, 1.1f, 25); GeneralParticleHandler.SpawnParticle(pulse); SoundEngine.PlaySound(SpawnSound, NPC.Center); @@ -2636,7 +2604,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 4; i++) { - Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone); brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2.75f, 4.25f); brimstoneFire.noGravity = true; } @@ -2662,7 +2630,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else { - if (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : NPC.AnyNPCs(ModContent.NPCType())) + if (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : NPC.AnyNPCs(ModContent.NPCType())) { NPC.dontTakeDamage = true; NPC.chaseable = false; @@ -2825,9 +2793,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas canFireSplitingFireball = false; randomShot = gigablast; - Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.92f, 0f, 55); + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, permafrost ? Color.Cyan : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.92f, 0f, 55); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0.4f, 55); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, permafrost ? Color.Cyan : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0.4f, 55); GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2843,9 +2811,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas canFireSplitingFireball = false; randomShot = fireblast; - Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0f, 55); + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, permafrost ? Color.Cyan : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0f, 55); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.98f, 0.4f, 55); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, permafrost ? Color.Cyan : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.98f, 0.4f, 55); GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -2866,7 +2834,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 7; i++) // Spred dust while floating post laugh { Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); - GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.75f, 1f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.75f, 1f), permafrost ? Color.LightBlue : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); GeneralParticleHandler.SpawnParticle(orb); } @@ -3009,7 +2977,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 9; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.5f, 0.75f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.5f, 0.75f), permafrost ? Color.Cyan : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } @@ -3027,7 +2995,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.rand.NextBool()) // Hand visual post laugh { - GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.95f, 1.45f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.95f, 1.45f), permafrost ? Color.LightBlue : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); GeneralParticleHandler.SpawnParticle(orb); } Dust fust = Dust.NewDustPerfect(handPosition, Main.rand.NextBool(3) ? 60 : 114); @@ -3085,9 +3053,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; // Release a burst of magic dust when punching. - Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 9, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.9f, 0f, 60); + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 9, permafrost ? Color.Cyan : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.9f, 0f, 60); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 8, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.93f, 0.4f, 60); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 8, permafrost ? Color.Cyan : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.93f, 0.4f, 60); GeneralParticleHandler.SpawnParticle(pulse2); NPC.localAI[1] = 0f; @@ -3170,31 +3138,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas castMagicDust.scale = 1.67f; castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); castMagicDust.fadeIn = 0.67f; - castMagicDust.color = cirrus ? Color.Pink : Color.Red; + castMagicDust.color = permafrost ? Color.Cyan : Color.Red; castMagicDust.noGravity = true; } if (attackCastDelay == 0) { - string key = cirrus ? "Mods.CalamityMod.Status.Boss.CirrusBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalStartText"; + string key = permafrost ? "Mods.CalamityMod.Status.Boss.PermafrostBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalStartText"; if (NPC.life <= NPC.lifeMax * 0.08) - key = cirrus ? "Mods.CalamityMod.Status.Boss.CirrusSecondBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalSepulcher2Text"; + key = permafrost ? "Mods.CalamityMod.Status.Boss.PermafrostSecondBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalSepulcher2Text"; if (!BossRushEvent.BossRushActive) { - if (DownedBossSystem.downedCalamitas && !cirrus) + if (DownedBossSystem.downedCalamitas && !permafrost) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } foreach (Vector2 heartSpawnPosition in heartSpawnPositions) { // Make the hearts appear in a burst of flame. - // Spawn Dragonfollies if Cirrus exists. + // Spawn Dragonfollies if Permfroast exists. for (int i = 0; i < 20; i++) { - Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), cirrus ? (int)CalamityDusts.Necroplasm : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), permafrost ? (int)CalamityDusts.Necroplasm : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -3208,7 +3176,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - if (cirrus) + if (permafrost) { for (int x = 0; x < 5; x++) { @@ -3276,9 +3244,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 leftDustPosition = Vector2.CatmullRom(leftOfCircle + Vector2.UnitY * 1000f, leftOfCircle, catastropheSpawnPosition, catastropheSpawnPosition + Vector2.UnitY * 1000f, castCompletion); Vector2 rightDustPosition = Vector2.CatmullRom(rightOfCircle + Vector2.UnitY * 1000f, rightOfCircle, cataclysmSpawnPosition, cataclysmSpawnPosition + Vector2.UnitY * 1000f, castCompletion); - GlowOrbParticle orb = new GlowOrbParticle(leftDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GlowOrbParticle orb = new GlowOrbParticle(leftDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, permafrost ? Color.Cyan : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb); - GlowOrbParticle orb2 = new GlowOrbParticle(rightDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GlowOrbParticle orb2 = new GlowOrbParticle(rightDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, permafrost ? Color.Cyan : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb2); } @@ -3338,19 +3306,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBrothersText"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusDoGText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostDoGText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { bool broDirection = Main.rand.NextBool(); - CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == false ? 1 : -1); - CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == true ? 1 : -1); + CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, permafrost ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == false ? 1 : -1); + if (!permafrost) + CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, ModContent.NPCType(), null, broDirection == true ? 1 : -1); } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath1") with { Pitch = -0.2f }, cataclysmSpawnPosition); @@ -3447,7 +3416,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Spawn the SCal NPC directly where the boss was if (!BossRushEvent.BossRushActive) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, permafrost ? ModContent.NPCType() : ModContent.NPCType()); // Mark Calamitas as defeated DownedBossSystem.downedCalamitas = true; @@ -3506,8 +3475,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); } - // Legendary seed pony on a stick upgrade - npcLoot.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().cirrus, false), ModContent.ItemType())); + // Legendary seed Coldheart Icicle + npcLoot.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().permafrost, false), ModContent.ItemType())); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType(), desc: DropHelper.FirstKillText); @@ -3589,19 +3558,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.frameCounter %= 6; NPC.frame.Y = (int)NPC.frameCounter + (int)FrameType * 6; } - if (cirrus) - { - alicornFrameCounter++; - if (alicornFrameCounter > 6) - { - alicornFrame++; - alicornFrameCounter = 0; - } - if (alicornFrame > 14 || alicornFrame < 9) - { - alicornFrame = 9; - } - } } public override Color? GetAlpha(Color drawColor) => willCharge ? Color.Lerp(Color.Red, drawColor, 0.7f) * NPC.Opacity * 0.45f : null; @@ -3613,23 +3569,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[Type].Value : HoodedTexture.Value; - Texture2D pony = ModContent.Request("CalamityMod/Items/Mounts/AlicornMount_Front").Value; - bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || cirrus); + bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || permafrost); - if (cirrus) - texture2D15 = inPhase2 ? CirrusTexture2.Value : CirrusTexture.Value; + if (permafrost) + texture2D15 = PermafrostTexture.Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type] / 2f); - Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); int afterimageAmt = 7; Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[Type], NPC.frame.Y / Main.npcFrameCount[Type], NPC.frame.Y % Main.npcFrameCount[Type]); - Rectangle ponyFrame = pony.Frame(1, 15, 0, alicornFrame); - Vector2 ponyPos = NPC.Center - screenPos; - ponyPos -= new Vector2(pony.Width / 2f, pony.Height / 15) * NPC.scale / 2f; - ponyPos += ponyOrigin * NPC.scale + new Vector2(-20, NPC.gfxOffY); - if (CalamityClientConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) + if (CalamityClientConfig.Instance.Afterimages && !(permafrost && NPC.ai[1] == 2f)) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -3648,7 +3598,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - if (!(cirrus && NPC.ai[1] == 2f)) + if (!(permafrost && NPC.ai[1] == 2f)) { if (inPhase2) { @@ -3657,7 +3607,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation += Main.rand.NextVector2Circular(0.25f, 0.7f); // And gain a flaming aura. - Color auraColor = NPC.GetAlpha(cirrus ? Color.Pink : Color.Red) * 0.4f; + Color auraColor = NPC.GetAlpha(permafrost ? Color.Cyan : Color.Red) * 0.4f; for (int i = 0; i < 7; i++) { Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 4f).ToRotationVector2(); @@ -3671,17 +3621,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!NPC.IsABestiaryIconDummy) { DrawForcefield(spriteBatch); - if (cirrus) - { - if (NPC.ai[1] == 2f) - { - spriteBatch.Draw(pony, ponyPos, ponyFrame, NPC.GetAlpha(drawColor), NPC.rotation, ponyOrigin, NPC.scale, spriteEffects, 0f); - } - } - else - { - DrawShield(spriteBatch); - } + DrawShield(spriteBatch); } return false; } @@ -3736,7 +3676,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/Perlin"); Color forcefieldColor = Color.DarkViolet; - Color secondaryForcefieldColor = (cirrus ? Color.HotPink : Color.Red) * 1.4f; + Color secondaryForcefieldColor = (permafrost ? Color.Cyan : Color.Red) * 1.4f; if (!NPC.dontTakeDamage && willCharge && NPC.ai[1] != 2f) { @@ -3815,7 +3755,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -3825,7 +3765,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int onHitDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int onHitDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[onHitDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -3835,10 +3775,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int j = 0; j < 70; j++) { - int onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[onHitDust2].noGravity = true; Main.dust[onHitDust2].velocity *= 5f; - onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[onHitDust2].velocity *= 2f; } } @@ -3855,80 +3795,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (hurtInfo.Damage > 0) { target.AddBuff(ModContent.BuffType(), 600); - InflictCirrusDebuffs(target); - } - } - - public void InflictCirrusDebuffs(Player target) - { - if (cirrus) - { - switch (Main.rand.Next(MaxCirrusAlcohols)) - { - case 0: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 1: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 2: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 3: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 4: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 5: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 6: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 7: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 8: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 9: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 10: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 11: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 12: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 13: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 14: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 15: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 16: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 17: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 18: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 19: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 20: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - } } } } diff --git a/NPCs/SupremeCalamitas/SupremeCirrus.png b/NPCs/SupremeCalamitas/SupremeCirrus.png deleted file mode 100644 index 4412c1c02b..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCirrus.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered.png b/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered.png deleted file mode 100644 index 1ce3adfdf2..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremePermafrost.png b/NPCs/SupremeCalamitas/SupremePermafrost.png new file mode 100644 index 0000000000..4e75ae0b28 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremePermafrost.png differ diff --git a/NPCs/TownNPCs/Archmage.cs b/NPCs/TownNPCs/Archmage.cs index 1be98d5a41..de022694e1 100644 --- a/NPCs/TownNPCs/Archmage.cs +++ b/NPCs/TownNPCs/Archmage.cs @@ -84,7 +84,13 @@ namespace CalamityMod.NPCs.TownNPCs } } - public override bool CanTownNPCSpawn(int numTownNPCs) => DownedBossSystem.downedCryogen; + public override bool CanTownNPCSpawn(int numTownNPCs) + { + if (NPC.AnyNPCs(ModContent.NPCType()) && Main.zenithWorld) + return false; + + return DownedBossSystem.downedCryogen; + } public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Permafrost") }; diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index b102150c3c..f843890b83 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -114,6 +114,8 @@ namespace CalamityMod.NPCs.TownNPCs "Jackson", // <@!525827730646892549> (chowchow360) "Altarca", // <@!1140673052108128337> (altarca_27226_49175) "Jackie", // <@!353241811717718016> (jackalchan) + "Ishmael", // <@!840416568000381046> (vanillaoyster) + "Ariallis", // <@!518231218806980609> (ariallis) // Original names this.GetLocalizedValue("Name.Laura"), @@ -161,11 +163,6 @@ namespace CalamityMod.NPCs.TownNPCs if (witch != -1) dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); - //please help me I'm stuck in a children's video game - Fabsol - int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); - if (cirrusIndex != -1) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrusIndex].GivenName)); - int merchantIndex = NPC.FindFirstNPC(NPCID.Merchant); if (merchantIndex != -1) dialogue.Add(this.GetLocalization("Chat.Merchant").Format(Main.npc[merchantIndex].GivenName)); diff --git a/NPCs/TownNPCs/BrimstoneWitch.cs b/NPCs/TownNPCs/BrimstoneWitch.cs index 29717bcce1..2657f75b43 100644 --- a/NPCs/TownNPCs/BrimstoneWitch.cs +++ b/NPCs/TownNPCs/BrimstoneWitch.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using CalamityMod.UI.CalamitasEnchants; using Microsoft.Xna.Framework; using Terraria; @@ -673,10 +674,6 @@ namespace CalamityMod.NPCs.TownNPCs } } - int cirrus = NPC.FindFirstNPC(NPCType()); - if (cirrus != -1 && ChildSafety.Disabled) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName), 1.45); - if (NPC.AnyNPCs(NPCType())) dialogue.Add(this.GetLocalizedValue("Chat.SeaKing"), 1.45); @@ -686,7 +683,11 @@ namespace CalamityMod.NPCs.TownNPCs return dialogue; } - public override void SetChatButtons(ref string button, ref string button2) => button = this.GetLocalizedValue("EnchantButton"); + public override void SetChatButtons(ref string button, ref string button2) + { + button = this.GetLocalizedValue("EnchantButton"); + button2 = this.GetLocalizedValue("DonorButton"); + } public override void OnChatButtonClicked(bool firstButton, ref string shopName) { @@ -702,6 +703,29 @@ namespace CalamityMod.NPCs.TownNPCs Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; } } + else + { + Main.npcChatText = GetRandomDonors(25); + } + } + + /// + /// Returns 25 random donator usernames. + /// + public string GetRandomDonors(int numDonors) + { + IList pickingList = [..DonatorsNameList.List]; + + string[] pickedDonors = new string[numDonors]; + for (int i = 0; i < numDonors; ++i) + { + int idxSelected = Main.rand.Next(pickingList.Count); + pickedDonors[i] = pickingList[idxSelected]; + pickingList.RemoveAt(idxSelected); + } + + string text = this.GetLocalization("DonorShoutout").Format(pickedDonors); + return text; } // Make this Town NPC teleport to the Queen statue when triggered. diff --git a/NPCs/TownNPCs/Cirrus.cs b/NPCs/TownNPCs/Cirrus.cs deleted file mode 100644 index cc9e7b0623..0000000000 --- a/NPCs/TownNPCs/Cirrus.cs +++ /dev/null @@ -1,1074 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Events; -using CalamityMod.Items.Mounts; -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Systems.Collections; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.Events; -using Terraria.GameContent.Personalities; -using Terraria.GameContent.UI; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.Utilities; - -namespace CalamityMod.NPCs.TownNPCs -{ - [AutoloadHead] - [LegacyName("FAP")] - public class Cirrus : ModNPC - { - public static Asset AltTexture; - public static Asset WorkoutTexture; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 27; - NPCID.Sets.ExtraFramesCount[Type] = 9; - NPCID.Sets.AttackFrameCount[Type] = 4; - NPCID.Sets.DangerDetectRange[Type] = 400; - NPCID.Sets.AttackType[Type] = 0; - NPCID.Sets.AttackTime[Type] = 60; - NPCID.Sets.AttackAverageChance[Type] = 15; - NPCID.Sets.ShimmerTownTransform[Type] = false; - // Happiness is so fucking dogshit, I swear to christ. - Fabsol - NPC.Happiness - .SetBiomeAffection(AffectionLevel.Love) - .SetBiomeAffection(AffectionLevel.Like) - .SetBiomeAffection(AffectionLevel.Dislike) - .SetBiomeAffection(AffectionLevel.Hate) - .SetNPCAffection(NPCID.Stylist, AffectionLevel.Love) - .SetNPCAffection(NPCID.BestiaryGirl, AffectionLevel.Love) - .SetNPCAffection(NPCID.DyeTrader, AffectionLevel.Like) - .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Like) - .SetNPCAffection(NPCID.DD2Bartender, AffectionLevel.Dislike) - .SetNPCAffection(NPCID.TaxCollector, AffectionLevel.Dislike) - .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Hate) - .SetNPCAffection(NPCID.Angler, AffectionLevel.Hate); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); - if (!Main.dedServ) - { - AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); - WorkoutTexture = ModContent.Request(Texture + "_Workout", AssetRequestMode.AsyncLoad); - } - } - - public override void SetDefaults() - { - NPC.townNPC = true; - NPC.friendly = true; - NPC.lavaImmune = true; - NPC.width = 18; - NPC.height = 40; - NPC.aiStyle = NPCAIStyleID.Passive; - NPC.damage = 10; - NPC.defense = 15; - NPC.lifeMax = 20000; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath6; - NPC.knockBackResist = 0.5f; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cirrus") - }); - } - - public override void FindFrame(int frameHeight) - { - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - bool workoutOutfit = Main.dayTime && beLessDrunk; - if (workoutOutfit) - frameHeight = 50; - - int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); - if (NPC.velocity.Y == 0f) - { - if (NPC.direction == 1) - NPC.spriteDirection = 1; - - if (NPC.direction == -1) - NPC.spriteDirection = -1; - - int nonAttackFrames = Main.npcFrameCount[Type] - NPCID.Sets.AttackFrameCount[Type]; - if (NPC.ai[0] == 23f) - { - NPC.frameCounter += 1D; - int currentFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - currentFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && currentFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num239 = ((!(NPC.frameCounter < 6D)) ? (nonAttackFrames - 4) : (nonAttackFrames - 5)); - if (NPC.ai[1] < 6f) - num239 = nonAttackFrames - 5; - - NPC.frame.Y = frameHeight * num239; - } - else if (NPC.ai[0] >= 20f && NPC.ai[0] <= 22f) - { - int num240 = NPC.frame.Y / frameHeight; - switch ((int)NPC.ai[0]) - { - case 20: - case 21: - case 22: - break; - } - - NPC.frame.Y = num240 * frameHeight; - } - else if (NPC.ai[0] == 2f) - { - NPC.frameCounter += 1D; - if (NPC.frame.Y / frameHeight == nonAttackFrames - 1 && NPC.frameCounter >= 5D) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - else if (NPC.frame.Y / frameHeight == 0 && NPC.frameCounter >= 40D) - { - NPC.frame.Y = frameHeight * (nonAttackFrames - 1); - NPC.frameCounter = 0D; - } - else if (NPC.frame.Y != 0 && NPC.frame.Y != frameHeight * (nonAttackFrames - 1)) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - } - else if (NPC.ai[0] == 5f) // Sitting - { - NPC.frame.Y = frameHeight * (nonAttackFrames - 3); - NPC.frameCounter = 0D; - } - else if (NPC.ai[0] == 6f) // Throwing confetti - { - NPC.frameCounter += 1D; - int confettiFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - confettiFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && confettiFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int confettiFrame = ((!(NPC.frameCounter < 10D)) ? - ((NPC.frameCounter < 16D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 46D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 60D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 66D)) ? - ((NPC.frameCounter < 72D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 102D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 108D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 114D)) ? - ((NPC.frameCounter < 120D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 150D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 156D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 162D)) ? - ((NPC.frameCounter < 168D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 198D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 204D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 210D)) ? - ((NPC.frameCounter < 216D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 246D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 252D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 258D)) ? - ((NPC.frameCounter < 264D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 294D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 300D) ? - (nonAttackFrames - 5) : 0))) : 0)))) : 0)))) : 0)))) : 0)))) : 0)))) : 0); - - if (confettiFrame == nonAttackFrames - 4 && confettiFrameHeight == nonAttackFrames - 5) - { - Vector2 vector4 = NPC.Center + new Vector2(10 * NPC.direction, -4f); - for (int n = 0; n < 8; n++) - { - int confettiDust = Main.rand.Next(139, 143); - int partyTime = Dust.NewDust(vector4, 0, 0, confettiDust, NPC.velocity.X + (float)NPC.direction, NPC.velocity.Y - 2.5f, 0, default(Color), 1.2f); - Main.dust[partyTime].velocity.X += (float)NPC.direction * 1.5f; - Dust dust = Main.dust[partyTime]; - dust.position -= new Vector2(4f); - dust = Main.dust[partyTime]; - dust.velocity *= 2f; - Main.dust[partyTime].scale = 0.7f + Main.rand.NextFloat() * 0.3f; - } - } - - NPC.frame.Y = frameHeight * confettiFrame; - if (NPC.frameCounter >= 300D) - NPC.frameCounter = 0D; - } - else if (NPC.ai[0] == 7f || NPC.ai[0] == 19f) // Talking to the player - { - NPC.frameCounter += 1D; - int playerTalkFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - playerTalkFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && playerTalkFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int playerTalkFrame = 0; - if (NPC.frameCounter < 16D) - playerTalkFrame = 0; - else if (NPC.frameCounter == 16D) - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), 112); - else if (NPC.frameCounter < 128D) - playerTalkFrame = ((NPC.frameCounter % 16D < 8D) ? (nonAttackFrames - 2) : 0); - else if (NPC.frameCounter < 160D) - playerTalkFrame = 0; - else if (NPC.frameCounter != 160D) - playerTalkFrame = ((NPC.frameCounter < 220D) ? ((NPC.frameCounter % 12D < 6D) ? (nonAttackFrames - 2) : 0) : 0); - else - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), 60); - - NPC.frame.Y = frameHeight * playerTalkFrame; - if (NPC.frameCounter >= 220D) - NPC.frameCounter = 0D; - } - else if (NPC.ai[0] == 9f) - { - NPC.frameCounter += 1D; - int num251 = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - num251; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && num251 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num252 = ((!(NPC.frameCounter < 10D)) ? ((!(NPC.frameCounter < 16D)) ? (nonAttackFrames - 4) : (nonAttackFrames - 5)) : 0); - if (NPC.ai[1] < 16f) - num252 = nonAttackFrames - 5; - - if (NPC.ai[1] < 10f) - num252 = 0; - - NPC.frame.Y = frameHeight * num252; - } - else if (NPC.ai[0] == 18f) - { - NPC.frameCounter += 1D; - int num253 = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - num253; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && num253 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num254 = 0; - if (NPC.frameCounter < 10D) - num254 = 0; - else if (NPC.frameCounter < 16D) - num254 = nonAttackFrames - 1; - else - num254 = nonAttackFrames - 2; - - if (NPC.ai[1] < 16f) - num254 = nonAttackFrames - 1; - - if (NPC.ai[1] < 10f) - num254 = 0; - - num254 = Main.npcFrameCount[Type] - 2; - NPC.frame.Y = frameHeight * num254; - } - else if (NPC.ai[0] == 10f || NPC.ai[0] == 13f) // Attacking - { - NPC.frameCounter += 1D; - int attackFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = attackFrameHeight - nonAttackFrames; - if ((uint)currentFrame > 3u && attackFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int attackTimingStart = 10; - int attackFrameTiming = 6; - int attackFrame = ((!(NPC.frameCounter < (double)attackTimingStart)) ? - ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming)) ? - nonAttackFrames : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 2)) ? - (nonAttackFrames + 1) : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 3)) ? - (nonAttackFrames + 2) : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 4)) ? - (nonAttackFrames + 3) : 0)))) : 0); - - NPC.frame.Y = frameHeight * attackFrame; - } - else if (NPC.ai[0] == 15f) - { - NPC.frameCounter += 1D; - int num259 = NPC.frame.Y / frameHeight; - int currentFrame = num259 - nonAttackFrames; - if ((uint)currentFrame > 3u && num259 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - float num260 = NPC.ai[1] / (float)NPCID.Sets.AttackTime[Type]; - int num261 = 0; - num261 = ((num260 > 0.65f) ? - nonAttackFrames : ((num260 > 0.5f) ? - (nonAttackFrames + 1) : ((num260 > 0.35f) ? - (nonAttackFrames + 2) : ((num260 > 0f) ? - (nonAttackFrames + 3) : 0)))); - - NPC.frame.Y = frameHeight * num261; - } - else if (NPC.ai[0] == 25f) - { - NPC.frame.Y = frameHeight; - } - else if (NPC.ai[0] == 12f) - { - NPC.frameCounter += 1D; - int num262 = NPC.frame.Y / frameHeight; - int currentFrame = num262 - nonAttackFrames; - if ((uint)currentFrame > 4u && num262 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num263 = nonAttackFrames + NPC.GetShootingFrame(NPC.ai[2]); - NPC.frame.Y = frameHeight * num263; - } - else if (NPC.ai[0] == 14f || NPC.ai[0] == 24f) - { - NPC.frameCounter += 1D; - int num264 = NPC.frame.Y / frameHeight; - int currentFrame = num264 - nonAttackFrames; - if ((uint)currentFrame > 1u && num264 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num265 = 12; - int num266 = ((NPC.frameCounter % (double)num265 * 2D < (double)num265) ? nonAttackFrames : (nonAttackFrames + 1)); - NPC.frame.Y = frameHeight * num266; - if (NPC.ai[0] == 24f) - { - if (NPC.frameCounter == 60D) - EmoteBubble.NewBubble(EmoteID.EmoteConfused, new WorldUIAnchor(NPC), 60); - - if (NPC.frameCounter == 150D) - EmoteBubble.NewBubble(EmoteID.EmotionAlert, new WorldUIAnchor(NPC), 90); - - if (NPC.frameCounter >= 240D) - NPC.frame.Y = 0; - } - } - else if (NPC.ai[0] == 1001f) - { - NPC.frame.Y = frameHeight * (nonAttackFrames - 1); - NPC.frameCounter = 0D; - } - else if (NPC.CanTalk && (NPC.ai[0] == 3f || NPC.ai[0] == 4f)) // Talking to another NPC - { - NPC.frameCounter += 1D; - int npcTalkFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - npcTalkFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && npcTalkFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - bool displayEmote = NPC.ai[0] == 3f; - int npcTalkFrame = 0; - int npcTalkHandFrame = 0; - int emoteDisplayTime = -1; - int emoteDisplayTime2 = -1; - if (NPC.frameCounter < 10D) - npcTalkFrame = 0; - else if (NPC.frameCounter < 16D) - npcTalkFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 46D) - npcTalkFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 60D) - npcTalkFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 216D) - npcTalkFrame = 0; - else if (NPC.frameCounter == 216D && Main.netMode != NetmodeID.MultiplayerClient) - emoteDisplayTime = 70; - else if (NPC.frameCounter < 286D) - npcTalkFrame = ((NPC.frameCounter % 12D < 6D) ? (nonAttackFrames - 2) : 0); - else if (NPC.frameCounter < 320D) - npcTalkFrame = 0; - else if (NPC.frameCounter != 320D || Main.netMode == NetmodeID.MultiplayerClient) - npcTalkFrame = ((NPC.frameCounter < 420D) ? ((NPC.frameCounter % 16D < 8D) ? (nonAttackFrames - 2) : 0) : 0); - else - emoteDisplayTime = 100; - - if (NPC.frameCounter < 70D) - { - npcTalkHandFrame = 0; - } - else if (NPC.frameCounter != 70D || Main.netMode == NetmodeID.MultiplayerClient) - { - npcTalkHandFrame = ((NPC.frameCounter < 160D) ? - ((NPC.frameCounter % 16D < 8D) ? - (nonAttackFrames - 2) : 0) : ((NPC.frameCounter < 166D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 186D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 200D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 320D)) ? - ((NPC.frameCounter < 326D) ? - (nonAttackFrames - 1) : 0) : 0))))); - } - else - emoteDisplayTime2 = 90; - - if (displayEmote) - { - NPC nPC = Main.npc[(int)NPC.ai[2]]; - if (emoteDisplayTime != -1) - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), emoteDisplayTime, new WorldUIAnchor(nPC)); - - if (emoteDisplayTime2 != -1 && nPC.CanTalk) - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(nPC), emoteDisplayTime2, new WorldUIAnchor(NPC)); - } - - NPC.frame.Y = frameHeight * (displayEmote ? npcTalkFrame : npcTalkHandFrame); - if (NPC.frameCounter >= 420D) - NPC.frameCounter = 0D; - } - else if (NPC.CanTalk && (NPC.ai[0] == 16f || NPC.ai[0] == 17f)) // Rock Paper Scissors - { - NPC.frameCounter += 1D; - int rpsFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - rpsFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && rpsFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - bool controlsRPS = NPC.ai[0] == 16f; - int rpsFrame = 0; - int emoteDisplayTime = -1; - if (NPC.frameCounter < 10D) - rpsFrame = 0; - else if (NPC.frameCounter < 16D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 22D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 28D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 34D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 40D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter == 40D && Main.netMode != NetmodeID.MultiplayerClient) - emoteDisplayTime = 45; - else if (NPC.frameCounter < 70D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 76D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 82D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 88D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 94D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 100D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter == 100D && Main.netMode != NetmodeID.MultiplayerClient) - emoteDisplayTime = 45; - else if (NPC.frameCounter < 130D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 136D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 142D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 148D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 154D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 160D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter != 160D || Main.netMode == NetmodeID.MultiplayerClient) - rpsFrame = ((NPC.frameCounter < 220D) ? (nonAttackFrames - 4) : ((NPC.frameCounter < 226D) ? (nonAttackFrames - 5) : 0)); - else - emoteDisplayTime = 75; - - if (controlsRPS && emoteDisplayTime != -1) - { - int npcPick = (int)NPC.localAI[2]; - int npcWins = (int)NPC.localAI[3]; - int opponentWins = (int)Main.npc[(int)NPC.ai[2]].localAI[3]; - int opponentPick = (int)Main.npc[(int)NPC.ai[2]].localAI[2]; - int rpsGameEnder = 3 - npcPick - npcWins; - int numGamesPlayed = 0; - if (NPC.frameCounter == 40D) - numGamesPlayed = 1; - - if (NPC.frameCounter == 100D) - numGamesPlayed = 2; - - if (NPC.frameCounter == 160D) - numGamesPlayed = 3; - - int gameCountdown = 3 - numGamesPlayed; - int rockPaperScissorsResultType = -1; - int gameFrameTimer = 0; - while (rockPaperScissorsResultType < 0) - { - currentFrame = gameFrameTimer + 1; - gameFrameTimer = currentFrame; - if (currentFrame >= 100) - break; - - rockPaperScissorsResultType = Main.rand.Next(2); - if (rockPaperScissorsResultType == 0 && opponentPick >= npcWins) - rockPaperScissorsResultType = -1; - - if (rockPaperScissorsResultType == 1 && opponentWins >= npcPick) - rockPaperScissorsResultType = -1; - - if (rockPaperScissorsResultType == -1 && gameCountdown <= rpsGameEnder) - rockPaperScissorsResultType = 2; - } - - if (rockPaperScissorsResultType == 0) - { - Main.npc[(int)NPC.ai[2]].localAI[3] += 1f; - opponentWins++; - } - - if (rockPaperScissorsResultType == 1) - { - Main.npc[(int)NPC.ai[2]].localAI[2] += 1f; - opponentPick++; - } - - int emoteType = Utils.SelectRandom(Main.rand, EmoteID.RPSPaper, EmoteID.RPSRock, EmoteID.RPSScissors); - int emoteType2 = emoteType; - switch (rockPaperScissorsResultType) - { - case 0: - switch (emoteType) - { - case EmoteID.RPSPaper: - emoteType2 = EmoteID.RPSRock; - break; - case EmoteID.RPSRock: - emoteType2 = EmoteID.RPSScissors; - break; - case EmoteID.RPSScissors: - emoteType2 = EmoteID.RPSPaper; - break; - } - break; - case 1: - switch (emoteType) - { - case EmoteID.RPSPaper: - emoteType2 = EmoteID.RPSScissors; - break; - case EmoteID.RPSRock: - emoteType2 = EmoteID.RPSPaper; - break; - case EmoteID.RPSScissors: - emoteType2 = EmoteID.RPSRock; - break; - } - break; - } - - if (gameCountdown == 0) - { - if (opponentWins >= 2) - emoteType -= 3; - - if (opponentPick >= 2) - emoteType2 -= 3; - } - - EmoteBubble.NewBubble(emoteType, new WorldUIAnchor(NPC), emoteDisplayTime); - EmoteBubble.NewBubble(emoteType2, new WorldUIAnchor(Main.npc[(int)NPC.ai[2]]), emoteDisplayTime); - } - - NPC.frame.Y = frameHeight * (controlsRPS ? rpsFrame : rpsFrame); - if (NPC.frameCounter >= 420D) - NPC.frameCounter = 0D; - } - else if (NPC.velocity.X == 0f) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - else // Walking - { - NPC.frameCounter += Math.Abs(NPC.velocity.X) * 2f; - NPC.frameCounter += 1D; - - int walkFrameHeightLimit = frameHeight * 2; - if (NPC.frame.Y < walkFrameHeightLimit) - NPC.frame.Y = walkFrameHeightLimit; - - int walkFrameTimer = 6; - if (NPC.frameCounter > (double)walkFrameTimer) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0D; - } - - if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - extraFrameAmt) - NPC.frame.Y = walkFrameHeightLimit; - } - - return; - } - - NPC.frameCounter = 0D; - NPC.frame.Y = frameHeight; - } - - public override void AI() - { - if (!CalamityWorld.spawnedCirrus) - CalamityWorld.spawnedCirrus = true; - } - - // I'm not sure what to do here, because she's always called Cirrus. - Fabsol - /*public override void ModifyTypeName(ref string typeName) - { - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - - if (beLessDrunk) - typeName = "Cirrus"; - }*/ - - public override bool CanTownNPCSpawn(int numTownNPCs) - { - if (NPC.AnyNPCs(ModContent.NPCType()) && Main.zenithWorld) - return false; - - if (CalamityWorld.spawnedCirrus) - return true; - - foreach (Player player in Main.ActivePlayers) - { - bool hasVodka = player.InventoryHas(ModContent.ItemType()) || player.PortableStorageHas(ModContent.ItemType()); - if (hasVodka) - return Main.hardMode; - else - return DownedBossSystem.downedCalamitasClone || NPC.downedPlantBoss; - } - return false; - } - - public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Cirrus") }; - - public override string GetChat() - { - Player player = Main.LocalPlayer; - if (Main.zenithWorld) - { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); - } - - bool worldIsSafer = NPC.downedMoonlord; - - if (CalamityUtils.AnyBossNPCS()) - { - if (!worldIsSafer) - return this.GetLocalizedValue("Chat.BossAlive"); - else - return this.GetLocalizedValue("Chat.BossAliveAlt"); - } - - if (NPC.homeless) - return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); - - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool isHappy = Main.ShopHelper.GetShoppingSettings(player, NPC).PriceAdjustment < 1D; - bool wifeIsAround = wife != -1; - bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; - bool beLessDrunk = wifeIsAround && worldIsSafer; - bool workoutOutfit = Main.dayTime && beLessDrunk; - - if (Main.bloodMoon) - { - if (Main.rand.NextBool(4)) - { - if (!beLessDrunk) - { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); ; - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); - return this.GetLocalizedValue("Chat.BloodMoonSlap1"); - } - else - return this.GetLocalizedValue("Chat.BloodMoonSlap2"); - } - return this.GetLocalizedValue("Chat.BloodMoon" + Main.rand.Next(1, 3 + 1)); - } - - WeightedRandom dialogue = new WeightedRandom(); - - if (!beLessDrunk) - { - dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); - - if (Main.zenithWorld) - dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); - - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Normal1Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal2Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal3Alt")); - - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalization("Chat.Normal4Alt").Format(Main.npc[wife].GivenName)); - - if (workoutOutfit) - dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); - } - - int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); - if (tavernKeep != -1) - { - dialogue.Add(this.GetLocalization("Chat.Tavernkeep1").Format(Main.npc[tavernKeep].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Tavernkeep2").Format(Main.npc[tavernKeep].GivenName)); - - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.Tavernkeep3")); - } - - int permadong = NPC.FindFirstNPC(ModContent.NPCType()); - if (permadong != -1) - dialogue.Add(this.GetLocalization("Chat.Archmage").Format(Main.npc[permadong].GivenName)); - - int witch = NPC.FindFirstNPC(ModContent.NPCType()); - if (witch != -1) - dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); - - if (wifeIsAround) - { - if (worldIsSafer) - { - if (wifeIsHappy && isHappy) - dialogue.Add(this.GetLocalization("Chat.Stylist1Alt").Format(Main.npc[wife].GivenName)); - - if (ChildSafety.Disabled) - { - if (!wifeIsHappy || !isHappy) - dialogue.Add(this.GetLocalization("Chat.Stylist2Alt").Format(Main.npc[wife].GivenName)); - - dialogue.Add(this.GetLocalization("Chat.Stylist3Alt").Format(Main.npc[wife].GivenName)); - } - } - else - { - dialogue.Add(this.GetLocalization("Chat.Stylist1").Format(Main.npc[wife].GivenName)); - if (ChildSafety.Disabled) - { - dialogue.Add(this.GetLocalization("Chat.Stylist2").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Stylist3").Format(Main.npc[wife].GivenName)); - } - } - } - - if (Main.dayTime) - { - if (!beLessDrunk) - { - dialogue.Add(this.GetLocalizedValue("Chat.Day1")); - dialogue.Add(this.GetLocalizedValue("Chat.Day2")); - dialogue.Add(this.GetLocalizedValue("Chat.Day3")); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Day1Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Day2Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Day3Alt")); - } - - if (!isHappy) - { - int annoyingChild = NPC.FindFirstNPC(NPCID.Angler); - if (annoyingChild != -1) - dialogue.Add(this.GetLocalization("Chat.Day4").Format(Main.npc[annoyingChild].GivenName)); - } - else - dialogue.Add(this.GetLocalizedValue("Chat.Day4Alt")); - - if (beLessDrunk) - { - dialogue.Add(this.GetLocalization("Chat.DayStylist1").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalization("Chat.DayStylist2").Format(Main.npc[wife].GivenName)); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.DayDrunk1")); - dialogue.Add(this.GetLocalizedValue("Chat.DayDrunk2")); - } - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Night1")); - - if (!isHappy) - { - if (Main.zenithWorld) - dialogue.Add(this.GetLocalizedValue("Chat.Night2")); - - dialogue.Add(this.GetLocalizedValue("Chat.Night3")); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Night2Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Night3Alt")); - } - - dialogue.Add(this.GetLocalizedValue("Chat.Night4")); - - if (wifeIsAround) - dialogue.Add(this.GetLocalization("Chat.NightStylist").Format(Main.npc[wife].GivenName)); - } - - // She needs to be drunk to enjoy festive events, otherwise, she dislikes them. - Fabsol - if (BirthdayParty.PartyIsUp) - { - if (!beLessDrunk) - dialogue.Add(this.GetLocalizedValue("Chat.Party")); - else - dialogue.Add(this.GetLocalizedValue("Chat.PartyAlt")); - } - - // She loves her hair and freaks out if it's threatened. Also a reference to the wicked witch of the west. - Fabsol - if (AcidRainEvent.AcidRainEventIsOngoing) - dialogue.Add(this.GetLocalizedValue("Chat.AcidRain")); - - // ayy lmao meme reference (this isn't 4th-wall breaking enough to be put in GFB-only imo). - Fabsol - if (Main.invasionType == InvasionID.MartianMadness) - dialogue.Add(this.GetLocalizedValue("Chat.Martians")); - - // Reference to insane thoughts I had years ago. - Fabsol - if (DownedBossSystem.downedCryogen && ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.CryogenDefeated")); - - // Reference to the old Leviathan sprite. - Fabsol - if (DownedBossSystem.downedLeviathan) - dialogue.Add(this.GetLocalizedValue("Chat.LeviathanDefeated")); - - // Risque tentacle implication... - Fabsol - if (NPC.downedMoonlord && ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.MoonLordDefeated")); - - // Reference to some crazy shit I thought up at one point. - Fabsol - if (DownedBossSystem.downedPolterghast) - dialogue.Add(this.GetLocalizedValue("Chat.PolterghastDefeated")); - - // MGS2 meme line. - Fabsol - if (DownedBossSystem.downedDoG && Main.zenithWorld) - dialogue.Add(this.GetLocalizedValue("Chat.DoGDefeated")); - - // Cirrus doesn't like the creature. - Fabsol - if (player.Calamity().chibii) - { - if (!isHappy) - dialogue.Add(this.GetLocalizedValue("Chat.HasChibii")); - else - dialogue.Add(this.GetLocalizedValue("Chat.HasChibiiAlt")); - } - - // She likes fish people (including Amidias, but she has no comments for him yet). - Fabsol - if (player.Calamity().aquaticHeart && !player.Calamity().aquaticHeartHide && ChildSafety.Disabled && isHappy) - dialogue.Add(this.GetLocalizedValue("Chat.HasAnahitaTrans")); - - if (player.Calamity().cirrusVodka) - dialogue.Add(this.GetLocalizedValue("Chat.HasVodka")); - - // These are all a bit too risque for children to be seeing lol - Fabsol - if (player.HasItem(ModContent.ItemType()) && ChildSafety.Disabled) - { - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn1")); - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn2")); - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn3")); - } - - return dialogue; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (Main.LocalPlayer.Calamity().trippy) - return false; - - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - bool workoutOutfit = Main.dayTime && beLessDrunk; - var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - Rectangle frame = NPC.frame; - if (workoutOutfit && !BirthdayParty.PartyIsUp) - frame = new Rectangle(0, NPC.frame.Y, WorkoutTexture.Width(), WorkoutTexture.Height() / Main.npcFrameCount[Type]); - - spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : workoutOutfit ? WorkoutTexture.Value : TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, workoutOutfit ? 3f : 6f), frame, drawColor, NPC.rotation, frame.Size() / 2, NPC.scale, something, 0); - return false; - } - - public string Death() - { - int deaths = Main.LocalPlayer.numberOfDeathsPVE; - - string text = this.GetLocalization("DeathCount").Format(deaths); - - if (deaths > 10000) - text += " " + this.GetLocalizedValue("Death10000"); - else if (deaths > 5000) - text += " " + this.GetLocalizedValue("Death5000"); - else if (deaths > 2500) - text += " " + this.GetLocalizedValue("Death2500"); - else if (deaths > 1000) - text += " " + this.GetLocalizedValue("Death1000"); - else if (deaths > 500) - text += " " + this.GetLocalizedValue("Death500"); - else if (deaths > 250) - text += " " + this.GetLocalizedValue("Death250"); - else if (deaths > 100) - text += " " + this.GetLocalizedValue("Death100"); - - text += "\n\n" + this.GetLocalization("DonorShoutout").Format(DonatorsNameList.GetRandomDonors()); - - return text; - } - - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - button2 = this.GetLocalizedValue("DeathCountButton"); - } - - public override void OnChatButtonClicked(bool firstButton, ref string shopName) - { - if (firstButton) - { - shopName = "Shop"; - } - else - { - Main.npcChatText = Death(); - } - } - - public override void AddShops() - { - Mod musicMod = ExternalMods.musicMod; - musicMod.TryFind("Interlude1MusicBox", out ModItem interlude1Box); - musicMod.TryFind("Interlude2MusicBox", out ModItem interlude2Box); - musicMod.TryFind("Interlude3MusicBox", out ModItem interlude3Box); - musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); - - NPCShop shop = new(Type); - shop.AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(silver: 30)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ItemID.EmpressButterfly, Item.buyPrice(gold: 10), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus, Condition.BloodMoon) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus, Condition.TimeNight) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ItemID.BloodyMoscato, Item.buyPrice(gold: 1), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ItemID.BananaDaiquiri, Item.buyPrice(silver: 75), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ItemID.PeachSangria, Item.buyPrice(silver: 50), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ItemID.PinaColada, Item.buyPrice(gold: 1), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1)) - .AddWithCustomValue(interlude1Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedCalamitasClone) - .AddWithCustomValue(interlude2Box.Type, Item.buyPrice(gold: 10), Condition.DownedMoonLord) - .AddWithCustomValue(interlude3Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedYharon) - .AddWithCustomValue(eulogyBox.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedDevourerOfGods) - .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnoughToSellPylons, Condition.InHallow) - .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) - .Register(); - } - - // Make this Town NPC teleport to the Queen statue when triggered. - public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue; - - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 60; - knockback = 2f; - } - - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 60; - randExtraCooldown = 15; - } - - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = ModContent.ProjectileType(); - attackDelay = 1; - } - - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 11.5f; - } - } -} diff --git a/NPCs/TownNPCs/Cirrus.png b/NPCs/TownNPCs/Cirrus.png deleted file mode 100644 index adf1db2d15..0000000000 Binary files a/NPCs/TownNPCs/Cirrus.png and /dev/null differ diff --git a/NPCs/TownNPCs/CirrusAlt.png b/NPCs/TownNPCs/CirrusAlt.png deleted file mode 100644 index 45895728f7..0000000000 Binary files a/NPCs/TownNPCs/CirrusAlt.png and /dev/null differ diff --git a/NPCs/TownNPCs/CirrusShimmered_Head.png b/NPCs/TownNPCs/CirrusShimmered_Head.png deleted file mode 100644 index 2de143f847..0000000000 Binary files a/NPCs/TownNPCs/CirrusShimmered_Head.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Head.png b/NPCs/TownNPCs/Cirrus_Head.png deleted file mode 100644 index d4b8a7cb82..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Head.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Head_Alt.png b/NPCs/TownNPCs/Cirrus_Head_Alt.png deleted file mode 100644 index ceb019d692..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Head_Alt.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Shimmered.png b/NPCs/TownNPCs/Cirrus_Shimmered.png deleted file mode 100644 index 14c9b9f3a0..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Shimmered.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Workout.png b/NPCs/TownNPCs/Cirrus_Workout.png deleted file mode 100644 index f657fe0c7c..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Workout.png and /dev/null differ diff --git a/NPCs/TownNPCs/SeaKing.cs b/NPCs/TownNPCs/SeaKing.cs index 9e2c6cd3e8..3c39586f46 100644 --- a/NPCs/TownNPCs/SeaKing.cs +++ b/NPCs/TownNPCs/SeaKing.cs @@ -103,21 +103,16 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Night3")); } - int lilBitch = NPC.FindFirstNPC(NPCID.Angler); - if (lilBitch != -1) + int angler = NPC.FindFirstNPC(NPCID.Angler); + if (angler != -1) { - dialogue.Add(this.GetLocalization("Chat.Angler1").Format(Main.npc[lilBitch].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Angler2").Format(Main.npc[lilBitch].GivenName)); + dialogue.Add(this.GetLocalization("Chat.Angler").Format(Main.npc[angler].GivenName)); } int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalizedValue("Chat.BrimstoneWitch")); - int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); - if (cirrus != -1) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName)); - int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); if (partyGirl != -1) dialogue.Add(this.GetLocalization("Chat.PartyGirl").Format(Main.npc[partyGirl].GivenName)); diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index be01b55807..7847c6a171 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -151,26 +151,26 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Super fast spin and charges phase bool phase7 = lifeRatio < 0.1f; - // Spawn Creepers in Master Mode + // Spawn Creepers in Death Mode if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && death && phase3) { npc.localAI[0] = 2f; - SpawnMasterModeCreepers(); + SpawnDeathModeCreepers(); } if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && death && phase5) { npc.localAI[0] = 3f; - SpawnMasterModeCreepers(); + SpawnDeathModeCreepers(); } if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && death && phase7) { npc.localAI[0] = 4f; - SpawnMasterModeCreepers(); + SpawnDeathModeCreepers(); } - void SpawnMasterModeCreepers() + void SpawnDeathModeCreepers() { int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath() / 4; float attackTimerIncrement = 15f * 4; @@ -1050,442 +1050,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaBrainofCthulhuAI(NPC npc, Mod mod) - { - NPC.crimsonBoss = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountVanilla(); - for (int num837 = 0; num837 < brainOfCthuluCreepersCount; num837++) - { - float x2 = npc.Center.X; - float y4 = npc.Center.Y; - x2 += (float)Main.rand.Next(-npc.width, npc.width); - y4 += (float)Main.rand.Next(-npc.height, npc.height); - int num838 = NPC.NewNPC(npc.GetSource_FromAI(), (int)x2, (int)y4, NPCID.Creeper); - Main.npc[num838].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); - Main.npc[num838].netUpdate = true; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - int num839 = 6000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num839) - { - npc.active = false; - npc.life = 0; - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - } - } - - if (npc.ai[0] < 0f) - { - // Set damage - npc.damage = npc.defDamage; - - if (Main.getGoodWorld) - NPC.brainOfGravity = npc.whoAmI; - - if (npc.localAI[2] == 0f) - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - npc.localAI[2] = 1f; - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395); - for (int num840 = 0; num840 < 20; num840++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - npc.dontTakeDamage = false; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - Vector2 vector104 = npc.Center; - float num841 = Main.player[npc.target].Center.X - vector104.X; - float num842 = Main.player[npc.target].Center.Y - vector104.Y; - float num843 = (float)Math.Sqrt(num841 * num841 + num842 * num842); - float num844 = Main.masterMode ? 12f : 8f; - num843 = num844 / num843; - num841 *= num843; - num842 *= num843; - float inertia = Main.masterMode ? 40f : 50f; - npc.velocity.X = (npc.velocity.X * inertia + num841) / (inertia + 1f); - npc.velocity.Y = (npc.velocity.Y * inertia + num842) / (inertia + 1f); - if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.justHit) - npc.localAI[1] -= Main.rand.Next(Main.masterMode ? 3 : 5); - - int num845 = 60 + Main.rand.Next(Main.masterMode ? 60 : 120); - if (Main.netMode != NetmodeID.SinglePlayer) - num845 += Main.rand.Next(Main.masterMode ? 15 : 30, Main.masterMode ? 45 : 90); - - if (npc.localAI[1] >= (float)num845) - { - npc.localAI[1] = 0f; - - CalamityUtils.CalamityTargeting(npc, options); - - int num846 = 0; - Player player2 = Main.player[npc.target]; - do - { - num846++; - int num847 = (int)player2.Center.X / 16; - int num848 = (int)player2.Center.Y / 16; - int minValue = 10; - int num849 = 12; - float num850 = 16f; - int num851 = Main.rand.Next(minValue, num849 + 1); - int num852 = Main.rand.Next(minValue, num849 + 1); - if (Main.rand.NextBool()) - num851 *= -1; - - if (Main.rand.NextBool()) - num852 *= -1; - - Vector2 v = new Vector2(num851 * 16, num852 * 16); - if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), v.SafeNormalize(Vector2.UnitY)) > 0f) - v += v.SafeNormalize(Vector2.Zero) * num850 * player2.velocity.Length(); - - num847 += (int)(v.X / 16f); - num848 += (int)(v.Y / 16f); - if (num846 > 100 || !WorldGen.SolidTile(num847, num848)) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[3] = 0f; - npc.ai[0] = -2f; - npc.ai[1] = num847; - npc.ai[2] = num848; - npc.ForceNetUpdate(); - break; - } - } - while (num846 <= 100); - } - } - } - else if (npc.ai[0] == -2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.9f; - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] += 15f; - else - npc.ai[3] += 25f; - - if (npc.ai[3] >= 255f) - { - npc.ai[3] = 255f; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.ai[0] = -3f; - npc.ForceNetUpdate(); - } - - npc.alpha = (int)npc.ai[3]; - } - else if (npc.ai[0] == -3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] -= 15f; - else - npc.ai[3] -= 25f; - - if (npc.ai[3] <= 0f) - { - npc.ai[3] = 0f; - npc.ai[0] = -1f; - npc.ForceNetUpdate(); - } - - npc.alpha = (int)npc.ai[3]; - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - Vector2 vector105 = npc.Center; - float num853 = Main.player[npc.target].Center.X - vector105.X; - float num854 = Main.player[npc.target].Center.Y - vector105.Y; - float num855 = (float)Math.Sqrt(num853 * num853 + num854 * num854); - float num856 = Main.masterMode ? 2.5f : 1.5f; - if (Main.getGoodWorld) - num856 *= 3f; - - if (num855 < num856) - { - npc.velocity.X = num853; - npc.velocity.Y = num854; - } - else - { - num855 = num856 / num855; - npc.velocity.X = num853 * num855; - npc.velocity.Y = num854 * num855; - } - - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num857 = 0; - for (int num858 = 0; num858 < Main.maxNPCs; num858++) - { - if (Main.npc[num858].active && Main.npc[num858].type == NPCID.Creeper) - num857++; - } - - if (num857 == 0) - { - npc.ai[0] = -1f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (float)(120 + Main.rand.Next(Main.masterMode ? 150 : 300))) - { - npc.localAI[1] = 0f; - - CalamityUtils.CalamityTargeting(npc, options); - - int num859 = 0; - Player player3 = Main.player[npc.target]; - do - { - num859++; - int num860 = (int)player3.Center.X / 16; - int num861 = (int)player3.Center.Y / 16; - int minValue2 = 12; - int num862 = 40; - float num863 = 16f; - int num864 = Main.rand.Next(minValue2, num862 + 1); - int num865 = Main.rand.Next(minValue2, num862 + 1); - if (Main.rand.NextBool()) - num864 *= -1; - - if (Main.rand.NextBool()) - num865 *= -1; - - Vector2 v2 = new Vector2(num864 * 16, num865 * 16); - if (Vector2.Dot(player3.velocity.SafeNormalize(Vector2.UnitY), v2.SafeNormalize(Vector2.UnitY)) > 0f) - v2 += v2.SafeNormalize(Vector2.Zero) * num863 * player3.velocity.Length(); - - num860 += (int)(v2.X / 16f); - num861 += (int)(v2.Y / 16f); - if (num859 > 100 || (!WorldGen.SolidTile(num860, num861) && (num859 > 75 || Collision.CanHit(new Vector2(num860 * 16, num861 * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)))) - { - npc.ai[0] = 1f; - npc.ai[1] = num860; - npc.ai[2] = num861; - npc.netUpdate = true; - break; - } - } - while (num859 <= 100); - } - } - } - else if (npc.ai[0] == 1f) - { - npc.alpha += 5; - if (npc.alpha >= 255) - { - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 5; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[0] = 0f; - } - } - } - - if (Main.player[npc.target].dead || !Main.player[npc.target].ZoneCrimson) - { - if (npc.localAI[3] < 120f) - npc.localAI[3]++; - - if (npc.localAI[3] > 60f) - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; - - npc.ai[0] = 2f; - npc.alpha = 10; - } - else if (npc.localAI[3] > 0f) - npc.localAI[3]--; - - return false; - } - - public static bool VanillaCreeperAI(NPC npc, Mod mod) - { - if (NPC.crimsonBoss < 0) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - - if (Main.masterMode) - npc.knockBackResist = 0f; - - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[1] = 0f; - float maxVelocity = Main.masterMode ? 10f : 8f; - Vector2 vector106 = npc.Center; - float num866 = Main.npc[NPC.crimsonBoss].Center.X - vector106.X; - float num867 = Main.npc[NPC.crimsonBoss].Center.Y - vector106.Y; - float num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); - if (num868 > 90f) - { - num868 = maxVelocity / num868; - num866 *= num868; - num867 *= num868; - npc.velocity.X = (npc.velocity.X * 15f + num866) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num867) / 16f; - return false; - } - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < maxVelocity) - { - float velocityMult = Main.masterMode ? 1.07f : 1.05f; - npc.velocity.Y *= velocityMult; - npc.velocity.X *= velocityMult; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && ((Main.expertMode && Main.rand.NextBool(Main.masterMode ? 50 : 100)) || Main.rand.NextBool(200))) - { - CalamityUtils.CalamityTargeting(npc, default); - - vector106 = npc.Center; - num866 = Main.player[npc.target].Center.X - vector106.X; - num867 = Main.player[npc.target].Center.Y - vector106.Y; - num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); - num868 = maxVelocity / num868; - npc.velocity.X = num866 * num868; - npc.velocity.Y = num867 * num868; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - - return false; - } - - // Set damage - npc.damage = npc.defDamage; - - if (Main.expertMode) - { - Vector2 vector107 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - if (Main.getGoodWorld) - { - vector107 *= 12f; - npc.velocity = (npc.velocity * 49f + vector107) / 50f; - } - else - { - float chargeVelocity = Main.masterMode ? 10f : 9f; - vector107 *= chargeVelocity; - float inertia = Main.masterMode ? 75f : 100f; - npc.velocity = (npc.velocity * (inertia - 1f) + vector107) / inertia; - } - } - - Vector2 vector108 = npc.Center; - float num869 = Main.npc[NPC.crimsonBoss].Center.X - vector108.X; - float num870 = Main.npc[NPC.crimsonBoss].Center.Y - vector108.Y; - float num871 = (float)Math.Sqrt(num869 * num869 + num870 * num870); - if (num871 > 700f) - { - npc.ai[0] = 0f; - } - else - { - if (!npc.justHit) - return false; - - if (npc.knockBackResist == 0f) - { - npc.ai[1] += 1f; - float returnToBrainGateValue = Main.masterMode ? 35f : 5f; - if (npc.ai[1] > returnToBrainGateValue) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 0f; - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 0f; - } - } - - return false; - } - public static int GetBrainOfCthuluCreepersCountRevDeath() { return CalamityWorld.LegendaryMode ? 40 : Main.getGoodWorld ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; } - public static int GetBrainOfCthuluCreepersCountVanilla() - { - return Main.getGoodWorld ? 40 : Main.masterMode ? 30 : 20; - } - private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) { float balance = 1f; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 2e195a2c06..4f716d58db 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -1229,1196 +1229,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaCultistAI(NPC npc, Mod mod) - { - // Chant sound - if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) - { - SoundStyle chantSound = Utils.SelectRandom(Main.rand, new SoundStyle[] - { - SoundID.Zombie88, - SoundID.Zombie89, - SoundID.Zombie90, - SoundID.Zombie91 - }); - - SoundEngine.PlaySound(chantSound, npc.Center); - } - - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; - - bool phase2 = npc.life <= npc.lifeMax / 2; - - int iceMistPhaseTime = masterMode ? 60 : expertMode ? 90 : 120; - if (Main.getGoodWorld) - iceMistPhaseTime -= 30; - - int fireballPhaseTime = Main.getGoodWorld ? 8 : masterMode ? 10 : expertMode ? 12 : 18; - int fireballAmount = Main.getGoodWorld ? 6 : masterMode ? 5 : expertMode ? 4 : 3; - - int lightningOrbPhaseTime = masterMode ? 30 : expertMode ? 40 : 80; - if (Main.getGoodWorld) - lightningOrbPhaseTime -= 20; - - int ancientLightPhaseTime = masterMode ? 40 : expertMode ? 30 : 20; - int ancientLightAmount = masterMode ? 4 : expertMode ? 3 : 2; - - int ancientDoomPhaseTime = masterMode ? 30 : 20; - int ancientDoomAmount = masterMode ? 5 : 3; - - int ritualTimeMax = phase2 ? 240 : 300; - - bool flag2 = npc.type == NPCID.CultistBoss; - bool flag3 = false; - bool flag4 = false; - if (phase2) - npc.defense = (int)Math.Round(npc.defDefense * 0.65); - - if (!flag2) - { - if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - return false; - } - - npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; - npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; - if (npc.ai[0] == 5f) - { - if (npc.justHit) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - - NPC obj = Main.npc[(int)npc.ai[3]]; - obj.ai[0] = 6f; - obj.ai[1] = 0f; - obj.netUpdate = true; - } - } - else - { - flag3 = true; - flag4 = true; - } - } - else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax && npc.justHit) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - List list = new List(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == (float)npc.whoAmI) - list.Add(i); - } - - int num9 = expertMode ? 3 : 10; - foreach (int item in list) - { - NPC nPC = Main.npc[item]; - if (nPC.localAI[1] == npc.localAI[1] && num9 > 0) - { - num9--; - nPC.life = 0; - nPC.HitEffect(); - nPC.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, item); - } - else if (num9 > 0) - { - num9--; - nPC.life = 0; - nPC.HitEffect(); - nPC.active = false; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (expertMode) - { - if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); - } - } - - Main.projectile[(int)npc.ai[2]].ai[1] = -1f; - Main.projectile[(int)npc.ai[2]].netUpdate = true; - } - - Vector2 center = npc.Center; - Player player = Main.player[npc.target]; - float num10 = 5600f; - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - if (player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - - new List().Add(npc.whoAmI); - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == (float)npc.whoAmI) - { - Main.npc[j].life = 0; - Main.npc[j].HitEffect(); - Main.npc[j].active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - } - } - } - - float num11 = npc.ai[3]; - if (npc.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Zombie89, npc.Center); - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - if (npc.ai[0] == -1f) - { - npc.alpha -= 5; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 420f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[1] > 360f) - { - npc.velocity *= 0.95f; - if (npc.localAI[2] != 13f) - SoundEngine.PlaySound(SoundID.Zombie105, npc.Center); - - npc.localAI[2] = 13f; - } - else if (npc.ai[1] > 300f) - { - npc.velocity = -Vector2.UnitY; - npc.localAI[2] = 10f; - } - else if (npc.ai[1] > 120f) - npc.localAI[2] = 1f; - else - npc.localAI[2] = 0f; - - flag3 = true; - flag4 = true; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - } - - npc.localAI[2] = 10f; - int num12 = Math.Sign(player.Center.X - center.X); - if (num12 != 0) - npc.direction = (npc.spriteDirection = num12); - - npc.ai[1] += 1f; - if (npc.ai[1] >= 40f && flag2) - { - int num13 = 0; - if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num13 = 0; - break; - case 1: - num13 = 1; - break; - case 2: - num13 = 0; - break; - case 3: - num13 = 5; - break; - case 4: - num13 = 0; - break; - case 5: - num13 = 3; - break; - case 6: - num13 = 0; - break; - case 7: - num13 = 5; - break; - case 8: - num13 = 0; - break; - case 9: - num13 = 2; - break; - case 10: - num13 = 0; - break; - case 11: - num13 = 3; - break; - case 12: - num13 = 0; - break; - case 13: - num13 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num13 = 0; - break; - case 1: - num13 = 1; - break; - case 2: - num13 = 0; - break; - case 3: - num13 = 2; - break; - case 4: - num13 = 0; - break; - case 5: - num13 = 3; - break; - case 6: - num13 = 0; - break; - case 7: - num13 = 1; - break; - case 8: - num13 = 0; - break; - case 9: - num13 = 2; - break; - case 10: - num13 = 0; - break; - case 11: - num13 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - - int maxValue = 6; - if (npc.life < npc.lifeMax / 3) - maxValue = 4; - if (npc.life < npc.lifeMax / 4) - maxValue = 3; - if (masterMode) - maxValue--; - - if (expertMode && phase2 && Main.rand.NextBool(maxValue) && num13 != 0 && num13 != 4 && num13 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) - num13 = 6; - - if (num13 == 0) - { - float num14 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); - if (num14 == 0f) - num14 = 1f; - - List list2 = new List(); - int num15 = 0; - list2.Add(npc.whoAmI); - for (int k = 0; k < Main.maxNPCs; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) - list2.Add(k); - } - - bool flag5 = list2.Count % 2 == 0; - foreach (int item2 in list2) - { - NPC nPC2 = Main.npc[item2]; - Vector2 center2 = nPC2.Center; - float num16 = (float)((num15 + flag5.ToInt() + 1) / 2) * MathHelper.TwoPi * 0.4f / (float)list2.Count; - if (num15 % 2 == 1) - num16 *= -1f; - - if (list2.Count == 1) - num16 = 0f; - - Vector2 vector = new Vector2(0f, -1f).RotatedBy(num16) * new Vector2(300f, 200f); - Vector2 vector2 = player.Center + vector - center2; - nPC2.ai[0] = 1f; - nPC2.ai[1] = num14 * 2f; - nPC2.velocity = vector2 / num14; - if (npc.whoAmI >= nPC2.whoAmI) - nPC2.position -= nPC2.velocity; - - nPC2.netUpdate = true; - num15++; - } - } - - switch (num13) - { - case 1: - npc.ai[0] = 3f; - npc.ai[1] = 0f; - break; - case 2: - npc.ai[0] = 2f; - npc.ai[1] = 0f; - break; - case 3: - npc.ai[0] = 4f; - npc.ai[1] = 0f; - break; - case 4: - npc.ai[0] = 5f; - npc.ai[1] = 0f; - break; - } - - if (num13 == 5) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - } - - if (num13 == 6) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - flag3 = true; - npc.localAI[2] = 10f; - if ((float)(int)npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) - npc.position -= npc.velocity; - - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.localAI[2] = 11f; - Vector2 vec = Vector2.Normalize(player.Center - center); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % iceMistPhaseTime == 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - List list3 = new List(); - for (int l = 0; l < Main.maxNPCs; l++) - { - if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) - list3.Add(l); - } - - foreach (int item3 in list3) - { - NPC nPC3 = Main.npc[item3]; - Vector2 center3 = nPC3.Center; - int num17 = Math.Sign(player.Center.X - center3.X); - if (num17 != 0) - nPC3.direction = (nPC3.spriteDirection = num17); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec = Vector2.Normalize(player.Center - center3); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - Vector2 vector3 = center3 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - Vector2 spinninpoint = vec * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint = spinninpoint.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector3, spinninpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec = Vector2.Normalize(player.Center - center); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - Vector2 vector4 = npc.Center + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossIceMist; - int numIceMists = masterMode ? 3 : expertMode ? 2 : 1; - float iceMistVelocity = masterMode ? 8f : expertMode ? 6f : 4f; - for (int n = 0; n < numIceMists; n++) - { - Vector2 vector5 = vec * (iceMistVelocity - n * 2f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector4, vector5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 1f); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + iceMistPhaseTime)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.localAI[2] = 11f; - Vector2 vec2 = Vector2.Normalize(player.Center - center); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % fireballPhaseTime == 0) - { - if ((int)(npc.ai[1] - 4f) / fireballPhaseTime == 2) - { - List list4 = new List(); - for (int num18 = 0; num18 < Main.maxNPCs; num18++) - { - if (Main.npc[num18].active && Main.npc[num18].type == NPCID.CultistBossClone && Main.npc[num18].ai[3] == (float)npc.whoAmI) - list4.Add(num18); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - foreach (int item4 in list4) - { - NPC nPC4 = Main.npc[item4]; - Vector2 center4 = nPC4.Center; - int num19 = Math.Sign(player.Center.X - center4.X); - if (num19 != 0) - nPC4.direction = (nPC4.spriteDirection = num19); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec2 = Vector2.Normalize(player.Center - center4); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); - - Vector2 vector6 = center4 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - Vector2 spinninpoint2 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint2 = spinninpoint2.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector6, spinninpoint2, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - } - - int num21 = Math.Sign(player.Center.X - center.X); - if (num21 != 0) - npc.direction = (npc.spriteDirection = num21); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec2 = Vector2.Normalize(player.Center - center); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); - - Vector2 vector7 = npc.Center + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBall; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - double spread = Math.PI / (masterMode ? 4D : expertMode ? 5D : 6D); - Vector2 spinninpoint3 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint3 = spinninpoint3.RotatedByRandom(spread); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7, spinninpoint3, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + fireballPhaseTime * fireballAmount)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - if (flag2) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 11f; - - if (npc.ai[1] == 20f && flag2 && Main.netMode != NetmodeID.MultiplayerClient) - { - List list5 = new List(); - for (int num23 = 0; num23 < Main.maxNPCs; num23++) - { - if (Main.npc[num23].active && Main.npc[num23].type == NPCID.CultistBossClone && Main.npc[num23].ai[3] == (float)npc.whoAmI) - list5.Add(num23); - } - - foreach (int item5 in list5) - { - NPC nPC5 = Main.npc[item5]; - Vector2 center5 = nPC5.Center; - int num24 = Math.Sign(player.Center.X - center5.X); - if (num24 != 0) - nPC5.direction = (nPC5.spriteDirection = num24); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector8 = Vector2.Normalize(player.Center - center5); - if (vector8.HasNaNs()) - vector8 = new Vector2(npc.direction, 0f); - - Vector2 vector9 = center5 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - Vector2 spinninpoint4 = vector8 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint4 = spinninpoint4.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector9, spinninpoint4, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - int type2 = ProjectileID.CultistBossLightningOrb; - if ((int)(npc.ai[1] - 20f) % lightningOrbPhaseTime == 0) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - - if (masterMode) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - } - else if (expertMode) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(20 + lightningOrbPhaseTime)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f) - { - npc.localAI[2] = 10f; - if (Vector2.Normalize(player.Center - center).HasNaNs()) - new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 0f && npc.ai[1] < 30f) - { - flag3 = true; - flag4 = true; - float num26 = (npc.ai[1] - 0f) / 30f; - npc.alpha = (int)(num26 * 255f); - } - else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) - { - if (npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient && flag2) - { - npc.localAI[1] += 1f; - Vector2 spinningpoint = new Vector2(180f, 0f); - List list6 = new List(); - for (int num27 = 0; num27 < Main.maxNPCs; num27++) - { - if (Main.npc[num27].active && Main.npc[num27].type == NPCID.CultistBossClone && Main.npc[num27].ai[3] == (float)npc.whoAmI) - list6.Add(num27); - } - - int num28 = 6 - list6.Count; - if (num28 > 2) - num28 = 2; - - int num29 = list6.Count + num28 + 1; - float[] array = new float[num29]; - for (int num30 = 0; num30 < array.Length; num30++) - array[num30] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((float)num30 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f), player.Center); - - int num31 = 0; - for (int num32 = 1; num32 < array.Length; num32++) - { - if (array[num31] > array[num32]) - num31 = num32; - } - - num31 = ((num31 >= num29 / 2) ? (num31 - num29 / 2) : (num31 + num29 / 2)); - int num33 = num28; - for (int num34 = 0; num34 < array.Length; num34++) - { - if (num31 != num34) - { - Vector2 center6 = npc.Center + spinningpoint.RotatedBy((float)num34 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); - if (num33-- > 0) - { - int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)center6.X, (int)center6.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); - Main.npc[num35].ai[3] = npc.whoAmI; - Main.npc[num35].netUpdate = true; - Main.npc[num35].localAI[1] = npc.localAI[1]; - } - else - { - int num36 = list6[-num33 - 1]; - Main.npc[num36].Center = center6; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num36); - } - } - } - - npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - npc.Center += spinningpoint.RotatedBy((float)num31 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); - npc.netUpdate = true; - list6.Clear(); - } - - flag3 = true; - flag4 = true; - npc.alpha = 255; - if (flag2) - { - Vector2 vector10 = Main.projectile[(int)npc.ai[2]].Center; - vector10 -= npc.Center; - if (vector10 == Vector2.Zero) - vector10 = -Vector2.UnitY; - - vector10.Normalize(); - if (Math.Abs(vector10.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector10.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num37 = Math.Sign(vector10.X); - if (num37 != 0) - npc.direction = (npc.spriteDirection = num37); - } - else - { - Vector2 vector11 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector11 -= npc.Center; - if (vector11 == Vector2.Zero) - vector11 = -Vector2.UnitY; - - vector11.Normalize(); - if (Math.Abs(vector11.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector11.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num38 = Math.Sign(vector11.X); - if (num38 != 0) - npc.direction = (npc.spriteDirection = num38); - } - } - else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) - { - flag3 = true; - flag4 = true; - float num39 = (npc.ai[1] - 90f) / 30f; - npc.alpha = 255 - (int)(num39 * 255f); - } - else if (npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax) - { - flag4 = true; - npc.alpha = 0; - if (flag2) - { - Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; - vector12 -= npc.Center; - if (vector12 == Vector2.Zero) - vector12 = -Vector2.UnitY; - - vector12.Normalize(); - if (Math.Abs(vector12.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector12.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num40 = Math.Sign(vector12.X); - if (num40 != 0) - npc.direction = (npc.spriteDirection = num40); - } - else - { - Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector13 -= npc.Center; - if (vector13 == Vector2.Zero) - vector13 = -Vector2.UnitY; - - vector13.Normalize(); - if (Math.Abs(vector13.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector13.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num41 = Math.Sign(vector13.X); - if (num41 != 0) - npc.direction = (npc.spriteDirection = num41); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= ritualTimeMax) - { - flag4 = true; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 6f) - { - npc.localAI[2] = 13f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 7f) - { - npc.localAI[2] = 11f; - Vector2 vec3 = Vector2.Normalize(player.Center - center); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientLightPhaseTime == 0) - { - if ((int)(npc.ai[1] - 4f) / ancientLightPhaseTime == 2) - { - List list7 = new List(); - for (int num42 = 0; num42 < Main.maxNPCs; num42++) - { - if (Main.npc[num42].active && Main.npc[num42].type == NPCID.CultistBossClone && Main.npc[num42].ai[3] == (float)npc.whoAmI) - list7.Add(num42); - } - - foreach (int item6 in list7) - { - NPC nPC6 = Main.npc[item6]; - Vector2 center7 = nPC6.Center; - int num43 = Math.Sign(player.Center.X - center7.X); - if (num43 != 0) - nPC6.direction = (nPC6.spriteDirection = num43); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec3 = Vector2.Normalize(player.Center - center7); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); - - Vector2 vector14 = center7 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - for (int num44 = 0; (float)num44 < 5f; num44++) - { - Vector2 spinninpoint5 = vec3 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint5 = spinninpoint5.RotatedByRandom(MathHelper.TwoPi / 5D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector14, spinninpoint5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - } - - int num45 = Math.Sign(player.Center.X - center.X); - if (num45 != 0) - npc.direction = (npc.spriteDirection = num45); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec3 = Vector2.Normalize(player.Center - center); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); - - Vector2 vector15 = npc.Center + new Vector2(npc.direction * 30, 12f); - float velocity = masterMode ? 14f : expertMode ? 12f : 10f; - float spread = MathHelper.ToRadians(masterMode ? 15f : expertMode ? 20f : 25f); - float ancientLightLimit = 5f; - for (int i = 0; (float)i < ancientLightLimit; i++) - { - Vector2 spinningpoint2 = vec3 * velocity; - spinningpoint2 = spinningpoint2.RotatedBy(spread * (float)i - (MathHelper.TwoPi / ancientLightLimit - spread) / 2f); - float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int num49 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector15.X, (int)vector15.Y + 7, NPCID.AncientLight, 0, 0f, ai, spinningpoint2.X, spinningpoint2.Y); - Main.npc[num49].velocity = spinningpoint2; - Main.npc[num49].netUpdate = true; - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + ancientLightPhaseTime * ancientLightAmount)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 8f) - { - npc.localAI[2] = 13f; - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientDoomPhaseTime == 0) - { - List list8 = new List(); - for (int num50 = 0; num50 < Main.maxNPCs; num50++) - { - if (Main.npc[num50].active && Main.npc[num50].type == NPCID.CultistBossClone && Main.npc[num50].ai[3] == (float)npc.whoAmI) - list8.Add(num50); - } - - int num51 = list8.Count + 1; - if (num51 > 3) - num51 = 3; - - int num52 = Math.Sign(player.Center.X - center.X); - if (num52 != 0) - npc.direction = (npc.spriteDirection = num52); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int num53 = 0; num53 < num51; num53++) - { - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector16 = Main.player[npc.target].Center - npc.Center; - int num54 = 20; - int num55 = 3; - int num56 = 7; - int num57 = 2; - int num58 = 0; - bool flag6 = false; - if (vector16.Length() > 2000f) - flag6 = true; - - while (!flag6 && num58 < 100) - { - num58++; - int num59 = Main.rand.Next(point2.X - num54, point2.X + num54 + 1); - int num60 = Main.rand.Next(point2.Y - num54, point2.Y + num54 + 1); - if ((num60 < point2.Y - num56 || num60 > point2.Y + num56 || num59 < point2.X - num56 || num59 > point2.X + num56) && (num60 < point.Y - num55 || num60 > point.Y + num55 || num59 < point.X - num55 || num59 > point.X + num55) && !Main.tile[num59, num60].HasUnactuatedTile) - { - bool flag7 = true; - if (flag7 && Collision.SolidTiles(num59 - num57, num59 + num57, num60 - num57, num60 + num57)) - flag7 = false; - - if (flag7) - { - NPC.NewNPC(npc.GetSource_FromAI(), num59 * 16 + 8, num60 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); - flag6 = true; - break; - } - } - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + ancientDoomPhaseTime * ancientDoomAmount)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - if (!flag2) - npc.ai[3] = num11; - - npc.dontTakeDamage = flag3; - npc.chaseable = !flag4; - - return false; - } - - public static bool VanillaAncientLightAI(NPC npc, Mod mod) - { - npc.dontTakeDamage = true; - - // Slow and kill code - if (npc.ai[0] == -1f) - { - // Slow down over time - if (npc.velocity.Length() >= 0.2f) - { - npc.velocity *= 0.96f; - } - else - { - npc.velocity = Vector2.Zero; - npc.position = npc.oldPosition; - - // Kill after 2 seconds - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - } - - return false; - } - - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - // Set velocity and emit dust when spawned - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.X = npc.ai[2]; - npc.velocity.Y = npc.ai[3]; - for (int i = 0; i < 13; i++) - { - int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[ancientLight].noGravity = true; - Main.dust[ancientLight].fadeIn = 1f; - Dust dust = Main.dust[ancientLight]; - dust.velocity *= 4f; - Main.dust[ancientLight].noLight = true; - } - } - - // Spawn dust - for (int j = 0; j < 2; j++) - { - if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) - { - int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[ancientLight2].noGravity = true; - Dust dust = Main.dust[ancientLight2]; - dust.velocity *= 0.2f; - Main.dust[ancientLight2].fadeIn = 0.4f; - if (Main.rand.NextBool(6)) - { - dust = Main.dust[ancientLight2]; - dust.velocity *= 5f; - Main.dust[ancientLight2].noLight = true; - } - else - Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); - } - } - - if (npc.ai[0] >= 0f) - { - npc.ai[0] += 1f; - - float duration = 120f; - - // Increase velocity for 1 second - if (npc.ai[0] < duration - 60f) - { - if (npc.velocity.Length() < 16f) - npc.velocity *= 1.005f; - } - - // Intersect velocity paths with other Ancient Lights for 1 second - if (npc.ai[0] >= duration - 60f) - npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); - - // Engage slow code - if (npc.ai[0] >= duration) - npc.ai[0] = -1f; - } - - return false; - } - - public static bool VanillaAncientDoomAI(NPC npc, Mod mod) - { - npc.damage = npc.defDamage = 0; - float duration = 420f; - float spawnAnimTime = 120f; - int rateOfChange = 1; - float splitProjVelocity = Main.masterMode ? 10f : Main.expertMode ? 8f : 6f; - - // Percent life remaining for Cultist or Eidolon Wyrm - float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; - - bool phase2 = lifeRatio < 0.7f && Main.expertMode; - bool phase3 = lifeRatio < 0.4f && Main.masterMode; - - bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; - int target = Main.maxPlayers; - if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) - { - if (target == Main.maxPlayers) - target = Main.npc[(int)npc.ai[0]].target; - - if (phase2) - rateOfChange = 2; - - if (phase3) - rateOfChange = 3; - } - else - kill = true; - - npc.ai[1] += rateOfChange; - float growthRate = npc.ai[1] / spawnAnimTime; - growthRate = MathHelper.Clamp(growthRate, 0f, 1f); - npc.position = npc.Center; - npc.scale = MathHelper.Lerp(0f, 1f, growthRate); - npc.Center = npc.position; - npc.alpha = (int)(255f - growthRate * 255f); - - if (Main.rand.NextBool(6)) - { - Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, DustID.Shadowflame, 0f, 0f, 0, default, 1f)]; - shadowflameDust.noGravity = true; - shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; - shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; - shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); - shadowflameDust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; - darkDust.noGravity = true; - darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; - darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; - darkDust.scale = 0.5f + Main.rand.NextFloat(); - darkDust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; - darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; - darkDust2.velocity = Vector2.Zero; - darkDust2.scale = 0.5f + Main.rand.NextFloat(); - darkDust2.fadeIn = 0.5f; - darkDust2.noLight = true; - } - - if (npc.ai[1] >= duration) - { - int type = ProjectileID.AncientDoomProjectile; - int damage = npc.GetProjectileDamage(type); - - kill = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = phase3 ? 6 : phase2 ? 5 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); - } - } - } - - if (kill) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 2d1b34725c..c26be9d26d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -151,8 +151,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Check if other segments are still alive, if not, die - // Check for Oblivion too, since having a max power Destroyer during that fight would be turbo cancer - bool oblivionAlive = false; if (npc.type > NPCID.TheDestroyer) { bool shouldDespawn = true; @@ -179,27 +177,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.active = false; } } - else - { - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - } // Total segment variable int totalSegments = Main.getGoodWorld ? 100 : 80; // Calculate aggression based on how many broken segments there are float brokenSegmentAggressionMultiplier = 1f; - if (npc.type == NPCID.TheDestroyer && !oblivionAlive) + if (npc.type == NPCID.TheDestroyer) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -225,51 +209,39 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Increase velocity based on distance float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - // If Oblivion is alive, don't fly, don't spit laser spreads, use the default vanilla no fly zone, reduce segment count to 60, use base speed and use base turn speed - if (oblivionAlive) + float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); + float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); + float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + + segmentVelocity += segmentVelocityBoost; + speed += speedBoost; + turnSpeed += turnSpeedBoost; + + segmentVelocity += 5f * enrageScale; + speed += 0.05f * enrageScale; + turnSpeed += 0.075f * enrageScale; + + if (flyAtTarget) { - calamityGlobalNPC.newAI[3] = 0f; - totalSegments = Main.getGoodWorld ? 75 : 60; - spitLaserSpreads = false; - noFlyZoneBoxHeight = 2000; + float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; + speed *= speedMultiplier; } - else + + segmentVelocity *= velocityMultiplier; + speed *= velocityMultiplier; + turnSpeed *= velocityMultiplier; + + segmentVelocity *= brokenSegmentAggressionMultiplier; + speed *= brokenSegmentAggressionMultiplier; + turnSpeed *= brokenSegmentAggressionMultiplier; + + if (Main.getGoodWorld) { - noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - - float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); - float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); - float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); - - segmentVelocity += segmentVelocityBoost; - speed += speedBoost; - turnSpeed += turnSpeedBoost; - - segmentVelocity += 5f * enrageScale; - speed += 0.05f * enrageScale; - turnSpeed += 0.075f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; - speed *= speedMultiplier; - } - - segmentVelocity *= velocityMultiplier; - speed *= velocityMultiplier; - turnSpeed *= velocityMultiplier; - - segmentVelocity *= brokenSegmentAggressionMultiplier; - speed *= brokenSegmentAggressionMultiplier; - turnSpeed *= brokenSegmentAggressionMultiplier; - - if (Main.getGoodWorld) - { - segmentVelocity *= 1.2f; - speed *= 1.2f; - turnSpeed *= 1.2f; - } + segmentVelocity *= 1.2f; + speed *= 1.2f; + turnSpeed *= 1.2f; } bool probeLaunched = npc.ai[2] == 1f; @@ -287,9 +259,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.newAI[2] -= 1f; } - // Regenerate Probes in Master Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) - // This doesn't happen if Oblivion is alive - if (death && probeLaunched && !oblivionAlive) + // Regenerate Probes in Death Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) + if (death && probeLaunched) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 600f) @@ -770,8 +741,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Despawn - bool oblivionFightDespawn = (oblivionAlive && lifeRatio < 0.8f) && npc.localAI[3] == 1f; - if (player.dead || oblivionFightDespawn) + if (player.dead) { shouldFly = false; npc.velocity.Y += 2f; @@ -1034,12 +1004,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Force the fucker to turn around in ground phase in Master - // Turns slower if Oblivion is alive, for fairness + // Force the fucker to turn around in ground phase in Death if (npc.type == NPCID.TheDestroyer && death && !flyAtTarget) { if (npc.Distance(player.Center) > 2000f) - npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? speed : turnSpeed); + npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; } if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) @@ -1092,652 +1061,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaDestroyerAI(NPC npc, Mod mod) - { - int num = 0; - int num2 = 10; - if (NPC.IsMechQueenUp && npc.type != NPCID.TheDestroyer) - { - int num3 = (int)npc.ai[1]; - while (num3 > 0 && num3 < Main.maxNPCs) - { - if (Main.npc[num3].active && Main.npc[num3].type >= NPCID.TheDestroyer && Main.npc[num3].type <= NPCID.TheDestroyerTail) - { - num++; - if (Main.npc[num3].type == NPCID.TheDestroyer) - break; - - if (num >= num2) - { - num = 0; - break; - } - - num3 = (int)Main.npc[num3].ai[1]; - continue; - } - - num = 0; - break; - } - } - - npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.Calamity().newAI[1] < DRIncreaseTime; - - 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) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (npc.type >= NPCID.TheDestroyer && npc.type <= NPCID.TheDestroyerTail) - { - if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) - { - if (npc.alpha != 0) - { - for (int i = 0; i < 2; i++) - { - int num4 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TheDestroyer, 0f, 0f, 100, default(Color), 2f); - Main.dust[num4].noGravity = true; - Main.dust[num4].noLight = true; - } - } - - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - } - - if (npc.type > NPCID.TheDestroyer) - { - bool flag = false; - if (npc.ai[1] <= 0f) - flag = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - flag = true; - - if (flag) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - } - } - - int destroyerSegmentsCount = NPC.GetDestroyerSegmentsCount(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) - { - npc.ai[3] = npc.whoAmI; - npc.realLife = npc.whoAmI; - int num5 = 0; - int num6 = npc.whoAmI; - for (int j = 0; j <= destroyerSegmentsCount; j++) - { - int num7 = NPCID.TheDestroyerBody; - if (j == destroyerSegmentsCount) - num7 = NPCID.TheDestroyerTail; - - num5 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), num7, npc.whoAmI); - Main.npc[num5].ai[3] = npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = num6; - Main.npc[num6].ai[0] = num5; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5); - num6 = num5; - } - } - } - - if (npc.type == NPCID.TheDestroyerBody) - { - bool probeLaunched = npc.ai[2] == 1f; - bool ableToFireLaser = npc.Calamity().destroyerLaserColor != -1; - - if (npc.Calamity().destroyerLaserColor == -1 && !probeLaunched && Main.rand.NextBool(OneInXChanceToFireLaser)) - { - npc.Calamity().destroyerLaserColor = 0; - npc.SyncDestroyerLaserColor(); - } - - if (probeLaunched && ableToFireLaser) - { - npc.Calamity().destroyerLaserColor = -1; - npc.SyncDestroyerLaserColor(); - } - - float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - - float laserTimerIncrement = (npc.localAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; - if (ableToFireLaser) - npc.localAI[0] += laserTimerIncrement; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Sync newAI every 20 frames for the new telegraph - if (npc.localAI[0] % 20f == 10f && ableToFireLaser) - npc.SyncVanillaLocalAI(); - } - - Color telegraphColor = Color.Transparent; - switch (npc.Calamity().destroyerLaserColor) - { - case 0: - telegraphColor = Color.Red; - break; - case 1: - telegraphColor = Color.Green; - break; - case 2: - telegraphColor = Color.Cyan; - break; - } - - if (npc.localAI[0] == shootProjectileGateValue - LaserTelegraphTime) - { - Particle telegraph = new DestroyerReticleTelegraph( - npc, - telegraphColor, - 1.5f, - 0.15f, - (int)LaserTelegraphTime); - GeneralParticleHandler.SpawnParticle(telegraph); - } - - if (npc.localAI[0] == shootProjectileGateValue - SparkTelegraphTime) - { - Particle spark = new DestroyerSparkTelegraph( - npc, - telegraphColor * 2f, - Color.White, - 3f, - 30, - Main.rand.NextFloat(MathHelper.ToRadians(3f)) * Main.rand.NextBool().ToDirectionInt()); - GeneralParticleHandler.SpawnParticle(spark); - } - - if (npc.localAI[0] >= shootProjectileGateValue && ableToFireLaser) - { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) - numProbeSegments++; - } - float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f); - float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); - npc.localAI[0] = laserShootTimeBonus; - npc.SyncVanillaLocalAI(); - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - 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 laserVelocity = (Main.masterMode ? 3.5f : Main.expertMode ? 3f : 2.5f) + Main.rand.NextFloat() * 1.5f; - Vector2 vector = npc.Center; - float num8 = Main.player[npc.target].Center.X - vector.X + (float)Main.rand.Next(-2, 3); - float num9 = Main.player[npc.target].Center.Y - vector.Y + (float)Main.rand.Next(-2, 3); - float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); - num10 = laserVelocity / num10; - num8 *= num10; - num9 *= num10; - num8 += (float)Main.rand.Next(-2, 3) * 0.05f; - num9 += (float)Main.rand.Next(-2, 3) * 0.05f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 laserVelocityActual = new Vector2(num8, num9); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num12 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector + laserVelocityActual.SafeNormalize(Vector2.UnitY) * 100f, laserVelocityActual, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[num12].timeLeft = 1200; - } - - npc.netUpdate = true; - } - - npc.Calamity().destroyerLaserColor = -1; - npc.SyncDestroyerLaserColor(); - } - } - - if (npc.type == NPCID.TheDestroyer) - { - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - else - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - // Calculate aggression based on how many broken segments there are - float brokenSegmentAggressionMultiplier = 1f; - if (npc.type == NPCID.TheDestroyer) - { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyerBody && Main.npc[i].ai[2] == 0f) - numProbeSegments++; - } - brokenSegmentAggressionMultiplier += (1f - MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f)) * 0.25f; - } - - int num13 = (int)(npc.position.X / 16f) - 1; - int num14 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num15 = (int)(npc.position.Y / 16f) - 1; - int num16 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num13 < 0) - num13 = 0; - - if (num14 > Main.maxTilesX) - num14 = Main.maxTilesX; - - if (num15 < 0) - num15 = 0; - - if (num16 > Main.maxTilesY) - num16 = Main.maxTilesY; - - bool flag2 = false; - if (!flag2) - { - Vector2 vector2 = default(Vector2); - for (int k = num13; k < num14; k++) - { - for (int l = num15; l < num16; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - vector2.X = k * 16; - vector2.Y = l * 16; - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } - - if (!flag2) - { - if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) - { - Vector3 lightColor = Color.Red.ToVector3(); - - // Light colors - Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); - Vector3 segmentColor = groundColor; - Vector3 telegraphColor = groundColor; - - // Telegraph for the laser breath and body lasers - float telegraphProgress = 0f; - if (npc.Calamity().destroyerLaserColor != -1) - { - if (npc.type == NPCID.TheDestroyerBody) - { - float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; - if (npc.localAI[0] > telegraphGateValue) - telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); - } - } - - Lighting.AddLight(npc.Center, Vector3.Lerp(segmentColor, telegraphColor * 2f, telegraphProgress)); - } - - npc.localAI[1] = 1f; - if (npc.type == NPCID.TheDestroyer) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num17 = 1000; - int height = (num17 * 2) - (Main.masterMode ? 700 : Main.expertMode ? 400 : 0); - bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int m = 0; m < Main.maxPlayers; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num17, (int)Main.player[m].position.Y - num17, num17 * 2, height); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - - if (flag3) - flag2 = true; - } - } - } - else - npc.localAI[1] = 0f; - - float num18 = (Main.masterMode ? 24f : Main.expertMode ? 20f : 16f) * brokenSegmentAggressionMultiplier; - if (Main.IsItDay() || Main.player[npc.target].dead) - { - flag2 = false; - npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16D) - { - npc.velocity.Y += 1f; - num18 *= 2f; - } - - if ((double)npc.position.Y > Main.rockLayer * 16D) - { - for (int n = 0; n < Main.maxNPCs; n++) - { - if (Main.npc[n].aiStyle == npc.aiStyle) - Main.npc[n].active = false; - } - } - } - - float num19 = 0.1f; - float num20 = 0.15f; - if (Main.expertMode) - { - num19 = Main.masterMode ? 0.2f : 0.15f; - num20 = Main.masterMode ? 0.3f : 0.225f; - } - - if (Main.getGoodWorld) - { - num19 *= 1.2f; - num20 *= 1.2f; - } - - num19 *= brokenSegmentAggressionMultiplier; - num20 *= brokenSegmentAggressionMultiplier; - - Vector2 vector3 = npc.Center; - float num21 = Main.player[npc.target].Center.X; - float num22 = Main.player[npc.target].Center.Y; - num21 = (int)(num21 / 16f) * 16; - num22 = (int)(num22 / 16f) * 16; - vector3.X = (int)(vector3.X / 16f) * 16; - vector3.Y = (int)(vector3.Y / 16f) * 16; - num21 -= vector3.X; - num22 -= vector3.Y; - float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - int num24 = (int)(44f * npc.scale); - try - { - vector3 = npc.Center; - num21 = Main.npc[(int)npc.ai[1]].Center.X - vector3.X; - num22 = Main.npc[(int)npc.ai[1]].Center.Y - vector3.Y; - } - catch - { - } - - if (num > 0) - { - float num25 = (float)num24 - (float)num24 * (((float)num - 1f) * 0.1f); - if (num25 < 0f) - num25 = 0f; - - if (num25 > (float)num24) - num25 = num24; - - num22 = Main.npc[(int)npc.ai[1]].Center.Y + num25 - vector3.Y; - } - - npc.rotation = (float)Math.Atan2(num22, num21) + MathHelper.PiOver2; - num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); - if (num > 0) - num24 = num24 / num2 * num; - - num23 = (num23 - (float)num24) / num23; - num21 *= num23; - num22 *= num23; - npc.velocity = Vector2.Zero; - npc.position.X += num21; - npc.position.Y += num22; - num21 = Main.npc[(int)npc.ai[1]].Center.X - vector3.X; - num22 = Main.npc[(int)npc.ai[1]].Center.Y - vector3.Y; - npc.rotation = (float)Math.Atan2(num22, num21) + MathHelper.PiOver2; - } - else - { - if (!flag2) - { - npc.velocity.Y += 0.15f; - if (Main.masterMode && npc.velocity.Y > 0f) - npc.velocity.Y += 0.05f; - - if (npc.velocity.Y > num18) - npc.velocity.Y = num18; - - // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > num19; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= num19 * 1.1f; - else - npc.velocity.X += num19 * 1.1f; - } - else if (npc.velocity.Y == num18) - { - if (slowXVelocity) - { - if (npc.velocity.X < num21) - npc.velocity.X += num19; - else if (npc.velocity.X > num21) - npc.velocity.X -= num19; - } - else - npc.velocity.X = 0f; - } - else if (npc.velocity.Y > 4f) - { - if (slowXVelocity) - { - if (npc.velocity.X < 0f) - npc.velocity.X += num19 * 0.9f; - else - npc.velocity.X -= num19 * 0.9f; - } - else - npc.velocity.X = 0f; - } - } - else - { - if (npc.soundDelay == 0) - { - float num26 = num23 / 40f; - if (num26 < 10f) - num26 = 10f; - - if (num26 > 20f) - num26 = 20f; - - npc.soundDelay = (int)num26; - SoundEngine.PlaySound(SoundID.WormDig, npc.Center); - } - - num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); - float num27 = Math.Abs(num21); - float num28 = Math.Abs(num22); - float num29 = num18 / num23; - num21 *= num29; - num22 *= num29; - if (((npc.velocity.X > 0f && num21 > 0f) || (npc.velocity.X < 0f && num21 < 0f)) && ((npc.velocity.Y > 0f && num22 > 0f) || (npc.velocity.Y < 0f && num22 < 0f))) - { - if (npc.velocity.X < num21) - npc.velocity.X += num20; - else if (npc.velocity.X > num21) - npc.velocity.X -= num20; - - if (npc.velocity.Y < num22) - npc.velocity.Y += num20; - else if (npc.velocity.Y > num22) - npc.velocity.Y -= num20; - } - - if ((npc.velocity.X > 0f && num21 > 0f) || (npc.velocity.X < 0f && num21 < 0f) || (npc.velocity.Y > 0f && num22 > 0f) || (npc.velocity.Y < 0f && num22 < 0f)) - { - if (npc.velocity.X < num21) - npc.velocity.X += num19; - else if (npc.velocity.X > num21) - npc.velocity.X -= num19; - - if (npc.velocity.Y < num22) - npc.velocity.Y += num19; - else if (npc.velocity.Y > num22) - npc.velocity.Y -= num19; - - if ((double)Math.Abs(num22) < (double)num18 * 0.2 && ((npc.velocity.X > 0f && num21 < 0f) || (npc.velocity.X < 0f && num21 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num19 * 2f; - else - npc.velocity.Y -= num19 * 2f; - } - - if ((double)Math.Abs(num21) < (double)num18 * 0.2 && ((npc.velocity.Y > 0f && num22 < 0f) || (npc.velocity.Y < 0f && num22 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num19 * 2f; - else - npc.velocity.X -= num19 * 2f; - } - } - else if (num27 > num28) - { - if (npc.velocity.X < num21) - npc.velocity.X += num19 * 1.1f; - else if (npc.velocity.X > num21) - npc.velocity.X -= num19 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num19; - else - npc.velocity.Y -= num19; - } - } - else - { - if (npc.velocity.Y < num22) - npc.velocity.Y += num19 * 1.1f; - else if (npc.velocity.Y > num22) - npc.velocity.Y -= num19 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num19; - else - npc.velocity.X -= num19; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - if (npc.type == NPCID.TheDestroyer) - { - if (flag2) - { - 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; - } - } - - if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 vector4 = new Vector2(0f, 100f); - Vector2 spinningpoint = mechQueenCenter + vector4; - float num30 = nPC.velocity.X * 0.025f; - spinningpoint = spinningpoint.RotatedBy(num30, mechQueenCenter); - npc.position = spinningpoint - npc.Size / 2f + nPC.velocity; - npc.velocity.X = 0f; - npc.velocity.Y = 0f; - npc.rotation = num30 * 0.75f + (float)Math.PI; - } - - // 10 seconds of resistance to prevent spawn killing - if (npc.Calamity().newAI[1] < DRIncreaseTime && ((npc.position - npc.oldPosition).Length() > 2f || npc.Calamity().newAI[1] > 0f)) - npc.Calamity().newAI[1] += 1f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = num18 * 0.25f; - float minimalDamageVelocity = num18 * 0.5f; - if (npc.type == NPCID.TheDestroyer) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - - return false; - } - public static bool BuffedProbeAI(NPC npc, Mod mod) { bool bossRush = BossRushEvent.BossRushActive; @@ -1940,173 +1263,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaProbeAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target <= Main.maxPlayers || Main.player[npc.target].dead) - CalamityUtils.CalamityTargeting(npc, default); - - NPCAimedTarget targetData = npc.GetTargetData(); - bool targetDead = false; - if (targetData.Type == NPCTargetType.Player) - targetDead = Main.player[npc.target].dead; - - float velocity = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; - float acceleration = Main.expertMode ? 0.06f : 0.05f; - float deceleration = 1f - acceleration; - - if (targetDead || Main.IsItDay()) - { - Vector2 destination = npc.Center - Vector2.UnitY; - Vector2 idealVelocity = npc.SafeDirectionTo(destination) * velocity * 0.5f; - idealVelocity.X *= npc.direction; - idealVelocity.Y *= 2.5f; - npc.SimpleFlyMovement(idealVelocity, acceleration); - npc.EncourageDespawn(10); - } - else if (npc.Distance(targetData.Center) > 400f) - { - Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; - npc.SimpleFlyMovement(idealVelocity, acceleration); - } - else - { - if (npc.Distance(targetData.Center) < 160f) - { - Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; - npc.SimpleFlyMovement(-idealVelocity, acceleration); - } - else - npc.velocity *= deceleration; - } - - if (npc.ai[3] != 0f) - { - if (NPC.IsMechQueenUp) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 vector2 = new Vector2(26f * npc.ai[3], 0f); - int num9 = (int)npc.ai[2]; - if (num9 < 0 || num9 >= Main.maxNPCs) - { - num9 = NPC.FindFirstNPC(NPCID.TheDestroyer); - npc.ai[2] = num9; - npc.netUpdate = true; - } - - if (num9 > -1) - { - NPC nPC2 = Main.npc[num9]; - if (!nPC2.active || nPC2.type != NPCID.TheDestroyer) - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - else - { - Vector2 spinningpoint = nPC2.Center + vector2; - spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center); - npc.Center = spinningpoint; - npc.velocity = nPC.velocity; - npc.dontTakeDamage = true; - } - } - else - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - else - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - else - npc.dontTakeDamage = false; - - npc.localAI[0] += 1f; - if (npc.ai[3] != 0f) - npc.localAI[0] += 2f; - - if ((npc.justHit && !Main.masterMode) || targetDead) - npc.localAI[0] = 0f; - - float num10 = ProbeLaserGateValue; - if (NPC.IsMechQueenUp) - num10 = ProbeLaserGateValue_Mechdusa; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= num10) - { - npc.localAI[0] = 0f; - if (targetData.Type != 0 && Collision.CanHit(npc, targetData)) - { - int type = ProjectileID.PinkLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - if (NPC.IsMechQueenUp) - { - Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - projectileVelocity = v.SafeNormalize(Vector2.UnitY) * 8f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); - } - } - - int num13 = (int)npc.Center.X; - int num14 = (int)npc.Center.Y; - num13 /= 16; - num14 /= 16; - if (WorldGen.InWorld(num13, num14) && !WorldGen.SolidTile(num13, num14)) - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); - - if (targetData.Center.X - npc.Center.X > 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); - } - else - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; - } - - if (NPC.IsMechQueenUp && npc.ai[2] == 0f) - { - Vector2 center = npc.GetTargetData().Center; - Vector2 v2 = center - npc.Center; - int num28 = 120; - if (v2.Length() < (float)num28) - npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28; - } - - 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; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 744526387f..05ba82522b 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Variables bool bossRush = BossRushEvent.BossRushActive; bool death = CalamityWorld.death || bossRush; - bool masterModeSurprise = lifeRatio >= 0.9f && death; + bool deathModeSurprise = lifeRatio >= 0.9f && death; bool phase2 = lifeRatio < (death ? 0.6f : 0.7f); bool phase3 = lifeRatio < (death ? 0.3f : 0.4f); bool phase4 = lifeRatio < (death ? 0.1f : 0.2f); @@ -192,7 +192,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeTime += Main.rand.Next(5, 66); // Spawn cthulhunadoes in phase 3 - if (phase3AI && ((!phase4 && !masterModeSurprise) || Main.getGoodWorld)) + if (phase3AI && ((!phase4 && !deathModeSurprise) || Main.getGoodWorld)) { calamityGlobalNPC.newAI[0] += 1f; float timeGateValue = 600f; @@ -215,7 +215,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = masterModeSurprise ? 9f : -1f; + npc.ai[0] = deathModeSurprise ? 9f : -1f; npc.netUpdate = true; } } @@ -949,7 +949,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Go back to normalcy after dropping below 90% HP - if (!masterModeSurprise && !phase3) + if (!deathModeSurprise && !phase3) phase3AttackPicker = 3; // Set velocity for charge @@ -1234,986 +1234,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaDukeFishronAI(NPC npc, Mod mod) - { - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; - - double damageScale = expertMode ? 1.2 : 1D; - float phase2LifeRatio = masterMode ? 0.6f : 0.5f; - float phase3LifeRatio = masterMode ? 0.25f : 0.15f; - bool flag = npc.life <= npc.lifeMax * phase2LifeRatio; - bool flag2 = expertMode && npc.life <= npc.lifeMax * phase3LifeRatio; - bool flag3 = npc.ai[0] > 4f; - bool flag4 = npc.ai[0] > 9f; - bool flag5 = npc.ai[3] < 10f; - - int setDamage = npc.defDamage; - if (flag4) - { - setDamage = (int)Math.Round(setDamage * 1.1 * damageScale); - npc.defense = 0; - } - else if (flag3) - { - setDamage = (int)Math.Round(setDamage * 1.2 * damageScale); - npc.defense = (int)Math.Round(npc.defDefense * 0.8); - } - else - npc.defense = npc.defDefense; - - int num2 = (masterMode ? 30 : expertMode ? 40 : 60); - float num3 = (masterMode ? 0.65f : expertMode ? 0.55f : 0.45f); - float num4 = (masterMode ? 9.5f : expertMode ? 8.5f : 7.5f); - if (flag4) - { - num3 = masterMode ? 0.8f : 0.7f; - num4 = masterMode ? 13f : 12f; - num2 = masterMode ? 20 : 30; - } - else if (flag3 && flag5) - { - num3 = (masterMode ? 0.7f : expertMode ? 0.6f : 0.5f); - num4 = (masterMode ? 12f : expertMode ? 10f : 8f); - num2 = (masterMode ? 35 : expertMode ? 40 : 20); - } - else if (flag5 && !flag3 && !flag4) - num2 = masterMode ? 25 : 30; - - int num5 = (masterMode ? 25 : expertMode ? 28 : 30); - float num6 = (masterMode ? 18f : expertMode ? 17f : 16f); - if (flag4) - { - num5 = masterMode ? 20 : 25; - num6 = masterMode ? 29f : 27f; - } - else if (flag5 && flag3) - { - num5 = (masterMode ? 24 : expertMode ? 27 : 30); - if (expertMode) - num6 = masterMode ? 24f : 21f; - } - - int num7 = masterMode ? 40 : 80; - int num8 = masterMode ? 2 : 4; - float num9 = masterMode ? 0.5f : 0.3f; - float num10 = masterMode ? 8f : 5f; - int num11 = masterMode ? 60 : 90; - int num12 = 180; - int num13 = 180; - int num14 = 30; - int num15 = masterMode ? 60 : 120; - int num16 = masterMode ? 2 : 4; - float num17 = masterMode ? 9f : 6f; - float num18 = 20f; - float num19 = MathHelper.TwoPi / (float)(num15 / 2); - int num20 = masterMode ? 50 : 75; - Vector2 center = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > 5600f) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - if (player.dead || Vector2.Distance(player.Center, center) > 5600f) - { - npc.velocity.Y -= 0.4f; - npc.EncourageDespawn(10); - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - bool enrage = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); - - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrage; - - // Increased DR during phase transitions - npc.Calamity().DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (BossRushEvent.BossRushActive ? 0.99f : 0.625f) : 0.15f; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - - if (enrage) - { - num2 = masterMode ? 5 : 10; - setDamage *= 2; - npc.defense = npc.defDefense * 2; - num6 += (masterMode ? 12f : 6f); - } - - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - float num21 = (float)Math.Atan2(player.Center.Y - center.Y, player.Center.X - center.X); - if (npc.spriteDirection == 1) - num21 += (float)Math.PI; - - if (num21 < 0f) - num21 += MathHelper.TwoPi; - - if (num21 > MathHelper.TwoPi) - num21 -= MathHelper.TwoPi; - - if (npc.ai[0] == -1f) - num21 = 0f; - - if (npc.ai[0] == 3f) - num21 = 0f; - - if (npc.ai[0] == 4f) - num21 = 0f; - - if (npc.ai[0] == 8f) - num21 = 0f; - - float num22 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f) - num22 = 0f; - - if (npc.ai[0] == 7f) - num22 = 0f; - - if (npc.ai[0] == 3f) - num22 = 0.01f; - - if (npc.ai[0] == 4f) - num22 = 0.01f; - - if (npc.ai[0] == 8f) - num22 = 0.01f; - - if (npc.rotation < num21) - { - if ((double)(num21 - npc.rotation) > Math.PI) - npc.rotation -= num22; - else - npc.rotation += num22; - } - - if (npc.rotation > num21) - { - if ((double)(npc.rotation - num21) > Math.PI) - npc.rotation += num22; - else - npc.rotation -= num22; - } - - if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) - npc.rotation = num21; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) - npc.rotation = num21; - - if (npc.ai[0] != -1f && npc.ai[0] < 9f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - - if (npc.alpha > 150) - npc.alpha = 150; - } - - if (npc.ai[0] == -1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - int num23 = Math.Sign(player.Center.X - center.X); - if (num23 != 0) - { - npc.direction = num23; - npc.spriteDirection = -npc.direction; - } - - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - - if (npc.alpha < 0) - npc.alpha = 0; - - if (npc.alpha > 150) - npc.alpha = 150; - } - - if (npc.ai[2] == (float)(num11 - 30)) - { - int num24 = 36; - for (int i = 0; i < num24; i++) - { - Vector2 vector = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((float)(i - (num24 / 2 - 1)) * MathHelper.TwoPi / (float)num24) + npc.Center; - Vector2 vector2 = vector - npc.Center; - int num25 = Dust.NewDust(vector + vector2, 0, 0, DustID.DungeonWater, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity = Vector2.Normalize(vector2) * 3f; - } - - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num20) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 0f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= num3; - } - - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= num3; - } - - int num26 = Math.Sign(player.Center.X - center.X); - if (num26 != 0) - { - if (npc.ai[2] == 0f && num26 != npc.direction) - npc.rotation += (float)Math.PI; - - npc.direction = num26; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num27 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - num27 = 1; - break; - case 10: - npc.ai[3] = 1f; - num27 = 2; - break; - case 11: - npc.ai[3] = 0f; - num27 = 3; - break; - } - - if (enrage && num27 == 2) - num27 = 3; - - if (flag) - num27 = 4; - - switch (num27) - { - case 1: - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - center) * num6; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num26 != 0) - { - npc.direction = num26; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - break; - - case 2: - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 3: - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - if (enrage) - npc.ai[2] = num11 - 40; - break; - - case 4: - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - // Set damage - npc.damage = setDamage; - - int num28 = 7; - for (int j = 0; j < num28; j++) - { - Vector2 vector4 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(j - (num28 / 2 - 1)) * Math.PI / (double)(float)num28) + center; - Vector2 vector5 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num29 = Dust.NewDust(vector4 + vector5, 0, 0, DustID.DungeonWater, vector5.X * 2f, vector5.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num29].noGravity = true; - Main.dust[num29].noLight = true; - Main.dust[num29].velocity /= 4f; - Main.dust[num29].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num5) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector6 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num10; - if (npc.velocity.X < vector6.X) - { - npc.velocity.X += num9; - if (npc.velocity.X < 0f && vector6.X > 0f) - npc.velocity.X += num9; - } - else if (npc.velocity.X > vector6.X) - { - npc.velocity.X -= num9; - if (npc.velocity.X > 0f && vector6.X < 0f) - npc.velocity.X -= num9; - } - - if (npc.velocity.Y < vector6.Y) - { - npc.velocity.Y += num9; - if (npc.velocity.Y < 0f && vector6.Y > 0f) - npc.velocity.Y += num9; - } - else if (npc.velocity.Y > vector6.Y) - { - npc.velocity.Y -= num9; - if (npc.velocity.Y > 0f && vector6.Y < 0f) - npc.velocity.Y -= num9; - } - - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (npc.ai[2] % (float)num8 == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector7 = Vector2.Normalize(player.Center - center) * (npc.width + 20) / 2f + center; - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector7.X, (int)vector7.Y + 45, NPCID.DetonatingBubble); - } - } - - int num30 = Math.Sign(player.Center.X - center.X); - if (num30 != 0) - { - npc.direction = num30; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num7) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num11 - 30)) - SoundEngine.PlaySound(SoundID.Zombie9, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) - { - Vector2 vector8 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + center; - Vector2 sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? 12f : 8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); - sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? 12f : 8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); - if (masterMode) - { - sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? -12f : -8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); - sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? -12f : -8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num12 - 60)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num12) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector9 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; - if (npc.velocity.X < vector9.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector9.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector9.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector9.X < 0f) - npc.velocity.X -= num3; - } - - if (npc.velocity.Y < vector9.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector9.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector9.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector9.Y < 0f) - npc.velocity.Y -= num3; - } - - int num31 = Math.Sign(player.Center.X - center.X); - if (num31 != 0) - { - if (npc.ai[2] == 0f && num31 != npc.direction) - npc.rotation += (float)Math.PI; - - npc.direction = num31; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num32 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - num32 = 1; - break; - case 6: - npc.ai[3] = 1f; - num32 = 2; - break; - case 7: - npc.ai[3] = 0f; - num32 = 3; - break; - } - - if (flag2) - num32 = 4; - - if (enrage && num32 == 2) - num32 = 3; - - switch (num32) - { - case 1: - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - center) * num6; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num31 != 0) - { - npc.direction = num31; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - break; - - case 2: - npc.velocity = Vector2.Normalize(player.Center - center) * num18; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num31 != 0) - { - npc.direction = num31; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 3: - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 4: - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 6f) - { - // Set damage - npc.damage = setDamage; - - int num33 = 7; - for (int k = 0; k < num33; k++) - { - Vector2 vector10 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(k - (num33 / 2 - 1)) * Math.PI / (double)(float)num33) + center; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num34 = Dust.NewDust(vector10 + vector11, 0, 0, DustID.DungeonWater, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num34].noGravity = true; - Main.dust[num34].noLight = true; - Main.dust[num34].velocity /= 4f; - Main.dust[num34].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num5) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 7f) - { - // Set damage - npc.damage = 0; - - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (npc.ai[2] % (float)num16 == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector12 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + center; - int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector12.X, (int)vector12.Y + 45, NPCID.DetonatingBubble); - Main.npc[num35].target = npc.target; - Main.npc[num35].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * (float)npc.direction) * num17; - Main.npc[num35].netUpdate = true; - Main.npc[num35].ai[3] = (float)Main.rand.Next(80, 121) / 100f; - } - } - - npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); - npc.rotation -= num19 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num15) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 8f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num11 - 30)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) - Projectile.NewProjectile(npc.GetSource_FromAI(), center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 9f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[2] < (float)(num13 - 90)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - - if (npc.alpha > 150) - npc.alpha = 150; - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - if (npc.alpha > 255) - npc.alpha = 255; - } - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num13 - 60)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 10f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - npc.alpha = 255; - } - - if (npc.ai[1] == 0f) - npc.ai[1] = 360 * Math.Sign((center - player.Center).X); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; - npc.SimpleFlyMovement(desiredVelocity, num3); - int num36 = Math.Sign(player.Center.X - center.X); - if (num36 != 0) - { - if (npc.ai[2] == 0f && num36 != npc.direction) - { - npc.rotation += (float)Math.PI; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = num36; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num37 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - num37 = 1; - break; - case 1: - case 4: - case 8: - num37 = 2; - break; - } - - switch (num37) - { - case 1: - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - center) * num6; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num36 != 0) - { - npc.direction = num36; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - break; - - case 2: - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 3: - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 11f) - { - // Set damage - npc.damage = setDamage; - - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - int num38 = 7; - for (int m = 0; m < num38; m++) - { - Vector2 vector13 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(m - (num38 / 2 - 1)) * Math.PI / (double)(float)num38) + center; - Vector2 vector14 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num39 = Dust.NewDust(vector13 + vector14, 0, 0, DustID.DungeonWater, vector14.X * 2f, vector14.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num39].noGravity = true; - Main.dust[num39].noLight = true; - Main.dust[num39].velocity /= 4f; - Main.dust[num39].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num5) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 12f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num14 / 2)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num14 / 2)) - { - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector15 = player.Center + new Vector2(0f - npc.ai[1], -200f); - Vector2 vector17 = (npc.Center = vector15); - center = vector17; - int num40 = Math.Sign(player.Center.X - center.X); - if (num40 != 0) - { - if (npc.ai[2] == 0f && num40 != npc.direction) - { - npc.rotation += (float)Math.PI; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = num40; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num14) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 13f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); - npc.rotation -= num19 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num15) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - - // Make him always able to take damage - npc.dontTakeDamage = false; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index 8794a125ec..50a819dfd8 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -14,7 +14,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static class EaterOfWorldsAI { private const float ProjectileTelegraphDuration = 30f; - private const int TotalMasterModeWorms = 4; + private const int TotalDeathModeWorms = 4; public const float DRIncreaseTime = 600f; public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) @@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.type == NPCID.EaterofWorldsHead) { // Amount of segments to spawn. - int segmentSpawnAmount = (int)(death ? (totalSegments / TotalMasterModeWorms) : totalSegments); + int segmentSpawnAmount = (int)(death ? (totalSegments / TotalDeathModeWorms) : totalSegments); // Spawn additional worms of reduced length in Master Mode. if (death) @@ -209,7 +209,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 additionalWormSpawnLocation = new Vector2(spawnX, spawnY); int randomXLimit = 80; int randomYLimit = 80; - for (int i = 1; i < TotalMasterModeWorms; i++) + for (int i = 1; i < TotalDeathModeWorms; i++) { additionalWormSpawnLocation += new Vector2((Main.rand.Next(randomXLimit + 1) + randomXLimit) * (Main.rand.NextBool() ? -1f : 1f), Main.rand.Next(randomYLimit + 1) + randomYLimit); int wormHead = NPC.NewNPC(npc.GetSource_FromAI(), (int)additionalWormSpawnLocation.X, (int)additionalWormSpawnLocation.Y, NPCID.EaterofWorldsHead, npc.whoAmI + segmentSpawnAmount * i + 1); @@ -773,554 +773,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaEaterofWorldsAI(NPC npc, Mod mod) - { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.expertMode) - { - if (npc.type == NPCID.EaterofWorldsBody && ((double)(npc.position.Y / 16f) < Main.worldSurface || Main.getGoodWorld)) - { - int num7 = (int)(npc.Center.X / 16f); - int num8 = (int)(npc.Center.Y / 16f); - if (WorldGen.InWorld(num7, num8) && Main.tile[num7, num8].WallType == WallID.None) - { - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.localAI[1] += 1f; - else - npc.localAI[1] -= 1f; - - int vileSpitGateValue = Main.masterMode ? 600 : 900; - if (Main.getGoodWorld) - vileSpitGateValue = (int)(vileSpitGateValue * 0.5f); - - Vector2 vileSpitShootLocation = npc.Center + npc.velocity; - if (npc.localAI[1] >= vileSpitGateValue) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vileSpitShootLocation.X, (int)vileSpitShootLocation.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); - - npc.localAI[1] = 0f; - } - - if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) - { - Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); - Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); - dust.noGravity = true; - dust.velocity *= 0.3f; - } - } - } - else if (npc.type == NPCID.EaterofWorldsHead) - { - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.localAI[1] += 1f; - else - npc.localAI[1] -= 1f; - - int vileSpitGateValue = Main.masterMode ? 45 : 90; - vileSpitGateValue += (int)((float)npc.life / (float)npc.lifeMax * 300f); - - Vector2 vileSpitShootLocation = npc.Center + npc.velocity; - if (npc.localAI[1] >= vileSpitGateValue) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vileSpitShootLocation.X, (int)vileSpitShootLocation.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); - - npc.localAI[1] = 0f; - } - - if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) - { - Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); - Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); - dust.noGravity = true; - dust.velocity *= 0.3f; - } - } - } - - npc.realLife = -1; - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Main.player[npc.target].dead) - npc.EncourageDespawn(300); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - if (npc.type == NPCID.EaterofWorldsHead) - { - npc.ai[2] = GetEaterOfWorldsSegmentsCountVanilla(); - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI); - Main.npc[(int)npc.ai[0]].CopyInteractions(npc); - } - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - { - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI); - Main.npc[(int)npc.ai[0]].CopyInteractions(npc); - } - else - { - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI); - Main.npc[(int)npc.ai[0]].CopyInteractions(npc); - } - - Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; - } - - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - return false; - } - - if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - return false; - } - - if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - return false; - } - - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsHead; - int num38 = npc.whoAmI; - float num39 = (float)npc.life / (float)npc.lifeMax; - float num40 = npc.ai[0]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num39); - npc.ai[0] = num40; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - npc.whoAmI = num38; - npc.alpha = 0; - } - - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsTail; - int num41 = npc.whoAmI; - float num42 = (float)npc.life / (float)npc.lifeMax; - float num43 = npc.ai[1]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num42); - npc.ai[1] = num43; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - npc.whoAmI = num41; - npc.alpha = 0; - } - - if (!npc.active && Main.dedServ) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - } - - int num44 = (int)(npc.position.X / 16f) - 1; - int num45 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num46 = (int)(npc.position.Y / 16f) - 1; - int num47 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num44 < 0) - num44 = 0; - - if (num45 > Main.maxTilesX) - num45 = Main.maxTilesX; - - if (num46 < 0) - num46 = 0; - - if (num47 > Main.maxTilesY) - num47 = Main.maxTilesY; - - bool flag2 = false; - - if (!flag2) - { - Vector2 vector2 = default(Vector2); - for (int num48 = num44; num48 < num45; num48++) - { - for (int num49 = num46; num49 < num47; num49++) - { - if (Main.tile[num48, num49] == null || ((!Main.tile[num48, num49].HasUnactuatedTile || (!Main.tileSolid[Main.tile[num48, num49].TileType] && (!Main.tileSolidTop[Main.tile[num48, num49].TileType] || Main.tile[num48, num49].TileFrameY != 0))) && Main.tile[num48, num49].LiquidAmount <= 64)) - continue; - - vector2.X = num48 * 16; - vector2.Y = num49 * 16; - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - if (Main.rand.NextBool(100) && Main.tile[num48, num49].HasUnactuatedTile && Main.tileSolid[Main.tile[num48, num49].TileType]) - WorldGen.KillTile(num48, num49, fail: true, effectOnly: true); - } - } - } - } - - if (!flag2 && npc.type == NPCID.EaterofWorldsHead) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num50 = Main.masterMode ? 750 : 1000; - bool flag3 = true; - for (int num51 = 0; num51 < Main.maxPlayers; num51++) - { - if (Main.player[num51].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[num51].position.X - num50, (int)Main.player[num51].position.Y - num50, num50 * 2, num50 * 2); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - - if (flag3) - flag2 = true; - } - - float num52 = 10f; - float num53 = 0.07f; - if (Main.expertMode) - { - num52 = Main.masterMode ? 15f : 12f; - num53 = Main.masterMode ? 0.2f : 0.15f; - } - - if (Main.getGoodWorld) - { - num52 += 4f; - num53 += 0.05f; - } - - Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num55 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num56 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num55 = (int)(num55 / 16f) * 16; - num56 = (int)(num56 / 16f) * 16; - vector5.X = (int)(vector5.X / 16f) * 16; - vector5.Y = (int)(vector5.Y / 16f) * 16; - num55 -= vector5.X; - num56 -= vector5.Y; - float num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num55 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector5.X; - num56 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector5.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(num56, num55) + MathHelper.PiOver2; - num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); - int num69 = npc.width; - num69 = (int)((float)num69 * npc.scale); - - if (Main.getGoodWorld) - num69 = 62; - - num68 = (num68 - (float)num69) / num68; - num55 *= num68; - num56 *= num68; - npc.velocity = Vector2.Zero; - npc.position.X += num55; - npc.position.Y += num56; - } - else - { - if (!flag2) - { - npc.velocity.Y += 0.11f; - if (Main.masterMode && npc.velocity.Y > 0f) - npc.velocity.Y += 0.07f; - - if (npc.velocity.Y > num52) - npc.velocity.Y = num52; - - // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > num53; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= num53 * 1.1f; - else - npc.velocity.X += num53 * 1.1f; - } - else if (npc.velocity.Y == num52) - { - if (slowXVelocity) - { - if (npc.velocity.X < num55) - npc.velocity.X += num53; - else if (npc.velocity.X > num55) - npc.velocity.X -= num53; - } - else - npc.velocity.X = 0f; - } - else if (npc.velocity.Y > 4f) - { - if (slowXVelocity) - { - if (npc.velocity.X < 0f) - npc.velocity.X += num53 * 0.9f; - else - npc.velocity.X -= num53 * 0.9f; - } - else - npc.velocity.X = 0f; - } - } - else - { - if (npc.soundDelay == 0) - { - float num70 = num68 / 40f; - if (num70 < 10f) - num70 = 10f; - - if (num70 > 20f) - num70 = 20f; - - npc.soundDelay = (int)num70; - SoundEngine.PlaySound(SoundID.WormDig, npc.Center); - } - - num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); - float num71 = Math.Abs(num55); - float num72 = Math.Abs(num56); - float num73 = num52 / num68; - num55 *= num73; - num56 *= num73; - bool flag4 = false; - if (npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead)) - flag4 = true; - - if (flag4) - { - bool flag5 = true; - for (int num74 = 0; num74 < Main.maxPlayers; num74++) - { - if (Main.player[num74].active && !Main.player[num74].dead && Main.player[num74].ZoneCorrupt) - flag5 = false; - } - - if (flag5) - { - if (Main.netMode != NetmodeID.MultiplayerClient && (double)(npc.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) - { - npc.active = false; - int num75 = (int)npc.ai[0]; - while (num75 > 0 && num75 < Main.maxNPCs && Main.npc[num75].active && Main.npc[num75].aiStyle == npc.aiStyle) - { - int num76 = (int)Main.npc[num75].ai[0]; - Main.npc[num75].active = false; - npc.life = 0; - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num75); - - num75 = num76; - } - - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - } - - num55 = 0f; - num56 = num52; - } - } - - if ((npc.velocity.X > 0f && num55 > 0f) || (npc.velocity.X < 0f && num55 < 0f) || (npc.velocity.Y > 0f && num56 > 0f) || (npc.velocity.Y < 0f && num56 < 0f)) - { - if (npc.velocity.X < num55) - npc.velocity.X += num53; - else if (npc.velocity.X > num55) - npc.velocity.X -= num53; - - if (npc.velocity.Y < num56) - npc.velocity.Y += num53; - else if (npc.velocity.Y > num56) - npc.velocity.Y -= num53; - - if ((double)Math.Abs(num56) < (double)num52 * 0.2 && ((npc.velocity.X > 0f && num55 < 0f) || (npc.velocity.X < 0f && num55 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num53 * 2f; - else - npc.velocity.Y -= num53 * 2f; - } - - if ((double)Math.Abs(num55) < (double)num52 * 0.2 && ((npc.velocity.Y > 0f && num56 < 0f) || (npc.velocity.Y < 0f && num56 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num53 * 2f; - else - npc.velocity.X -= num53 * 2f; - } - } - else if (num71 > num72) - { - if (npc.velocity.X < num55) - npc.velocity.X += num53 * 1.1f; - else if (npc.velocity.X > num55) - npc.velocity.X -= num53 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num53; - else - npc.velocity.Y -= num53; - } - } - else - { - if (npc.velocity.Y < num56) - npc.velocity.Y += num53 * 1.1f; - else if (npc.velocity.Y > num56) - npc.velocity.Y -= num53 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num53; - else - npc.velocity.X -= num53; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - if (npc.type == NPCID.EaterofWorldsHead) - { - if (flag2) - { - 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; - } - } - - // 10 seconds of resistance to prevent spawn killing - if (npc.Calamity().newAI[1] < DRIncreaseTime && ((npc.position - npc.oldPosition).Length() > 2f || npc.Calamity().newAI[1] > 0f)) - npc.Calamity().newAI[1] += 1f; - - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float minimalContactDamageHeadVelocity = num52 * 0.25f; - float minimalDamageHeadVelocity = num52 * 0.5f; - float minimalContactDamageBodyVelocity = num52 * 0.4f; - float minimalDamageBodyVelocity = num52 * 0.8f; - if (npc.type == NPCID.EaterofWorldsHead) - { - if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - - if (npc.type == NPCID.EaterofWorldsHead || (npc.type != NPCID.EaterofWorldsHead && Main.npc[(int)npc.ai[1]].alpha >= 85)) - { - if (npc.alpha > 0 && npc.life > 0) - { - for (int num80 = 0; num80 < 2; num80++) - { - int num81 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default, 2f); - Main.dust[num81].noGravity = true; - Main.dust[num81].noLight = true; - } - } - - if ((npc.position - npc.oldPosition).Length() > 2f) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - } - else if (npc.type > NPCID.EaterofWorldsHead && npc.alpha > 0) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - return false; - } - public static int GetEaterOfWorldsSegmentsCountRevDeath() { - return CalamityWorld.LegendaryMode ? 100 : - (CalamityWorld.death || BossRushEvent.BossRushActive) ? ((Main.masterMode || BossRushEvent.BossRushActive) ? 60 : 57) : - ((Main.masterMode || BossRushEvent.BossRushActive) ? 68 : 62); - } - - public static int GetEaterOfWorldsSegmentsCountVanilla() - { - return (Main.masterMode || BossRushEvent.BossRushActive) ? 75 : Main.expertMode ? 70 : 65; + return CalamityWorld.LegendaryMode ? 100 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 57 : 62; } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 778d63ffa4..96ddd8c381 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -1293,1054 +1293,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaEmpressofLightAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - Vector2 stopMovingLocation = new Vector2(-250f, -350f); - Vector2 stopMovingLocation3 = new Vector2(0f, -450f); - Vector2 stopMovingLocation4 = new Vector2(0f, -450f); - Vector2 stopMovingLocation5 = new Vector2(-80f, -500f); - - // Rotation - npc.rotation = npc.velocity.X * 0.005f; - - // Reset DR every frame - calamityGlobalNPC.DR = 0.15f; - - bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; - bool expertModePhase2 = phase2 && expertMode; - bool masterModePhase2 = phase2 && masterMode; - float phase2LifeRatio = masterMode ? 0.7f : expertMode ? 0.6f : 0.5f; - float phase3LifeRatio = masterMode ? 0.3f : 0.15f; - bool genuinePhase2 = npc.life / (float)npc.lifeMax <= phase2LifeRatio; - bool phase3 = npc.life / (float)npc.lifeMax <= phase3LifeRatio && expertMode; - - bool shouldBeInPhase2ButIsStillInPhase1 = npc.life / (float)npc.lifeMax <= phase2LifeRatio && !phase2; - if (shouldBeInPhase2ButIsStillInPhase1) - calamityGlobalNPC.DR = 0.99f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = shouldBeInPhase2ButIsStillInPhase1 || npc.ai[0] == 6f; - - bool enraged = NPC.ShouldEmpressBeEnraged(); - if (npc.life == npc.lifeMax && enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - npc.ai[3] += 2f; - - calamityGlobalNPC.CurrentlyEnraged = !BossRushEvent.BossRushActive && enraged; - - int projectileDamageMultiplier = enraged ? 2 : 1; - - bool becomeVisible = true; - - float moveSpeed = masterMode ? 0.6f : expertMode ? 0.55f : 0.5f; - float desiredVelocity = masterMode ? 14.4f : expertMode ? 13.2f : 12f; - float stopMovingDistance = 40f; - float despawnDistance = 6400f; - int lanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenLance); - int rainbowStreakDamage = npc.GetProjectileDamage(ProjectileID.HallowBossRainbowStreak); - int lastingRainbowDamage = npc.GetProjectileDamage(ProjectileID.HallowBossLastingRainbow); - int sunDanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenSunDance); - - lanceDamage *= projectileDamageMultiplier; - rainbowStreakDamage *= projectileDamageMultiplier; - lastingRainbowDamage *= projectileDamageMultiplier; - sunDanceDamage *= projectileDamageMultiplier; - - if (enraged) - expertMode = true; - - bool takeDamage = true; - int reducedAttackCooldown = 0; - if (phase2) - reducedAttackCooldown += 15; - if (expertMode) - reducedAttackCooldown += 5; - - // Variables for dust visuals on spawn and in phase 3 - float playSpawnSoundTime = 10f; - float stopSpawningDustTime = 150f; - float spawnTime = 180f; - - // Do visual stuff in phase 3 - float maxOpacity = phase3 ? 0.7f : 1f; - int minAlpha = 255 - (int)(255 * maxOpacity); - if (phase3) - { - if (calamityGlobalNPC.newAI[0] == playSpawnSoundTime) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - if (calamityGlobalNPC.newAI[0] > playSpawnSoundTime && calamityGlobalNPC.newAI[0] < stopSpawningDustTime) - CreateSpawnDust(npc, false); - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= stopSpawningDustTime) - { - calamityGlobalNPC.newAI[0] = playSpawnSoundTime + 1f; - npc.SyncExtraAI(); - } - } - - switch ((int)npc.ai[0]) - { - case 0: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - npc.velocity = new Vector2(0f, 5f); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + new Vector2(0f, -80f), Vector2.Zero, ProjectileID.HallowBossDeathAurora, 0, 0f, Main.myPlayer); - } - - if (npc.ai[1] == playSpawnSoundTime) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - npc.velocity *= 0.95f; - if (npc.ai[1] > playSpawnSoundTime && npc.ai[1] < stopSpawningDustTime) - CreateSpawnDust(npc); - - npc.ai[1] += 1f; - becomeVisible = false; - takeDamage = false; - npc.Opacity = MathHelper.Clamp(npc.ai[1] / spawnTime, 0f, 1f); - if (npc.ai[1] >= spawnTime) - { - if (enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - npc.ai[3] += 2f; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - - break; - - case 1: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float phaseTime = (phase2 ? 20f : 45f); - if (masterMode) - phaseTime /= 2f; - if (Main.getGoodWorld) - phaseTime /= 2f; - if (phaseTime < 10f) - phaseTime = 10f; - - if (npc.ai[1] <= 10f) - { - if (npc.ai[1] == 0f) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - NPCAimedTarget targetData = npc.GetTargetData(); - if (targetData.Invalid) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.velocity /= 4f; - npc.netUpdate = true; - break; - } - - Vector2 center = targetData.Center; - npc.DirectionTo(center); - center += new Vector2(0f, -300f); - if (npc.Distance(center) > 200f) - center -= npc.DirectionTo(center) * 100f; - - Vector2 distanceFromTarget = center - npc.Center; - float lerpValue = Utils.GetLerpValue(100f, 600f, distanceFromTarget.Length(), clamped: true); - float movementVelocity = distanceFromTarget.Length(); - if (movementVelocity > 18f) - movementVelocity = 18f; - - npc.velocity = Vector2.Lerp(distanceFromTarget.SafeNormalize(Vector2.Zero) * movementVelocity, distanceFromTarget / 6f, lerpValue); - - npc.netUpdate = true; - } - - if (npc.velocity.Length() > 16f && npc.ai[1] > 10f) - npc.velocity /= 2f; - - npc.velocity *= 0.92f; - npc.ai[1] += 1f; - if (!(npc.ai[1] >= phaseTime)) - break; - - int phaseIncrement = (int)npc.ai[2]; - int phase = 2; - int phaseDivisor = 0; - if (!phase2) - { - int num38 = phaseDivisor++; - int num39 = phaseDivisor++; - int num40 = phaseDivisor++; - int num41 = phaseDivisor++; - int num42 = phaseDivisor++; - int num43 = phaseDivisor++; - int num44 = phaseDivisor++; - int num45 = phaseDivisor++; - int num46 = phaseDivisor++; - int num47 = phaseDivisor++; - if (phaseIncrement % phaseDivisor == num38) - phase = 2; - - if (phaseIncrement % phaseDivisor == num39) - phase = 8; - - if (phaseIncrement % phaseDivisor == num40) - phase = 6; - - if (phaseIncrement % phaseDivisor == num41) - phase = 8; - - if (phaseIncrement % phaseDivisor == num42) - phase = 5; - - if (phaseIncrement % phaseDivisor == num43) - phase = 2; - - if (phaseIncrement % phaseDivisor == num44) - phase = 8; - - if (phaseIncrement % phaseDivisor == num45) - phase = 4; - - if (phaseIncrement % phaseDivisor == num46) - phase = 8; - - if (phaseIncrement % phaseDivisor == num47) - phase = 5; - - if (genuinePhase2) - phase = 10; - } - - if (phase2) - { - int num48 = phaseDivisor++; - int num49 = phaseDivisor++; - int num50 = phaseDivisor++; - int num51 = -1; - if (expertMode) - num51 = phaseDivisor++; - - int num52 = phaseDivisor++; - int num53 = phaseDivisor++; - int num54 = phaseDivisor++; - int num55 = phaseDivisor++; - int num56 = phaseDivisor++; - int num57 = phaseDivisor++; - if (phaseIncrement % phaseDivisor == num48) - phase = 7; - - if (phaseIncrement % phaseDivisor == num49) - phase = phase3 ? 8 : 2; - - if (phaseIncrement % phaseDivisor == num50) - phase = 8; - - if (phaseIncrement % phaseDivisor == num52) - phase = 5; - - if (phaseIncrement % phaseDivisor == num53) - phase = 2; - - if (phaseIncrement % phaseDivisor == num54) - phase = phase3 ? 4 : 6; - - if (phaseIncrement % phaseDivisor == num54) - phase = phase3 ? 7 : 6; - - if (phaseIncrement % phaseDivisor == num55) - phase = 4; - - if (phaseIncrement % phaseDivisor == num56) - phase = 8; - - if (phaseIncrement % phaseDivisor == num51) - phase = 11; - - if (phaseIncrement % phaseDivisor == num57) - phase = 12; - } - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - NPCAimedTarget targetData2 = npc.GetTargetData(); - bool transitionToEnrage = false; - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - { - if (!Main.dayTime) - transitionToEnrage = true; - - if (Main.dayTime && Main.time >= 53400D) - transitionToEnrage = true; - } - - if (targetData2.Invalid || npc.Distance(targetData2.Center) > despawnDistance || transitionToEnrage) - phase = 13; - - if (phase == 8 && targetData2.Center.X > npc.Center.X) - phase = 9; - - if (expertMode && phase != 5 && phase != 12) - npc.velocity = npc.DirectionFrom(targetData2.Center).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * (float)(targetData2.Center.X > npc.Center.X).ToDirectionInt()) * 20f; - - npc.ai[0] = phase; - npc.ai[1] = 0f; - - int oneInXChance = masterMode ? 3 : 4; - if (phase3) - oneInXChance--; - - float numPhaseIncrements = expertMode ? (Main.rand.NextBool(oneInXChance) ? 2f : 1f) : 1f; - npc.ai[2] += numPhaseIncrements; - npc.netUpdate = true; - - break; - } - - case 2: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item164, npc.Center); - - float extraPhaseTime = (masterMode ? 30f : expertMode ? 60f : 90f) - (float)reducedAttackCooldown; - Vector2 offset = new Vector2(-55f, -30f); - NPCAimedTarget targetData11 = npc.GetTargetData(); - Vector2 targetCenter = (targetData11.Invalid ? npc.Center : targetData11.Center); - if (npc.Distance(targetCenter + stopMovingLocation) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + stopMovingLocation).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - if (npc.ai[1] < 60f) - AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - - int rainbowStreakGateValue = 3; - if (expertMode) - rainbowStreakGateValue = 2; - if (phase3) - rainbowStreakGateValue *= 2; - - if ((int)npc.ai[1] % rainbowStreakGateValue == 0 && npc.ai[1] < 60f) - { - float ai3 = npc.ai[1] / 60f; - Vector2 rainbowStreakVelocity = new Vector2(0f, -6f - (masterMode ? (ai3 * 4f) : expertMode ? (ai3 * 2f) : 0f)).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); - if (expertModePhase2) - rainbowStreakVelocity = new Vector2(0f, -10f - (masterMode ? (ai3 * 5f) : expertMode ? (ai3 * 2.5f) : 0f)).RotatedBy(MathHelper.TwoPi * Main.rand.NextFloat()); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, ai3); - if (phase3) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, -rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, 1f - ai3); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num92 = (int)(npc.ai[1] / (float)rainbowStreakGateValue); - for (int num93 = 0; num93 < Main.maxPlayers; num93++) - { - if (npc.Boss_CanShootExtraAt(num93, num92 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, num93, ai3); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - /*case 3: - { - npc.ai[1] += 1f; - NPCAimedTarget targetData8 = npc.GetTargetData(); - Vector2 vector23 = (targetData8.Invalid ? npc.Center : targetData8.Center); - if (npc.Distance(vector23 + vector2) > num3) - npc.SimpleFlyMovement(npc.DirectionTo(vector23 + vector2).SafeNormalize(Vector2.Zero) * num2, num); - - if ((int)npc.ai[1] % 180 == 0) - { - Vector2 vector24 = new Vector2(0f, -100f); - Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + vector24, Vector2.Zero, ProjectileID.HallowBossDeathAurora, num5, 0f, Main.myPlayer); - } - - if (npc.ai[1] >= 120f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - }*/ - - case 4: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = 20 - reducedAttackCooldown; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - float lanceGateValue = masterMode ? 75f : 100f; - if (npc.ai[1] >= 6f && npc.ai[1] < 54f) - { - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - } - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation3) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation3).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - int radialSpawnOffset = masterMode ? 6 : expertMode ? 5 : 4; - int lanceSpawnGateValue = masterMode ? 3 : 4; - if ((int)npc.ai[1] % lanceSpawnGateValue == 0 && npc.ai[1] < lanceGateValue) - { - int lanceAmount = phase3 ? 2 : 1; - for (int i = 0; i < lanceAmount; i++) - { - int num85 = (int)npc.ai[1] / lanceSpawnGateValue; - radialSpawnOffset += (masterMode ? 3 : 2) * i; - Vector2 radialOffset = Vector2.UnitX.RotatedBy((float)Math.PI / (float)(radialSpawnOffset * 2) + (float)num85 * ((float)Math.PI / (float)radialSpawnOffset) + 0f); - if (masterMode) - radialOffset.X += (radialOffset.X > 0f ? -0.5f : 0.5f); - else if (!expertMode) - radialOffset.X += (radialOffset.X > 0f ? 0.5f : -0.5f); - - radialOffset = radialOffset.SafeNormalize(Vector2.UnitY); - float lanceSpawnDistance = 300f; - if (expertMode) - lanceSpawnDistance = 450f; - - Vector2 targetCenter = targetData.Center; - if (npc.Distance(targetCenter) > 2400f) - continue; - - if (Vector2.Dot(targetData.Velocity.SafeNormalize(Vector2.UnitY), radialOffset) > 0f) - radialOffset *= -1f; - - int targetVelocityOffset = 90; - Vector2 vector31 = targetCenter + targetData.Velocity * targetVelocityOffset; - Vector2 vector32 = targetCenter + radialOffset * lanceSpawnDistance - targetData.Velocity * 30f; - if (vector32.Distance(targetCenter) < lanceSpawnDistance) - { - Vector2 vector33 = targetCenter - vector32; - if (vector33 == Vector2.Zero) - vector33 = radialOffset; - - vector32 = targetCenter - vector33.SafeNormalize(Vector2.UnitY) * lanceSpawnDistance; - } - - Vector2 v3 = vector31 - vector32; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector32, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); - - if (Main.netMode == NetmodeID.MultiplayerClient) - continue; - - int num88 = (int)(npc.ai[1] / (float)lanceSpawnGateValue); - for (int num89 = 0; num89 < Main.maxPlayers; num89++) - { - if (!npc.Boss_CanShootExtraAt(num89, num88 % 3, 3, 2400f)) - continue; - - Player player2 = Main.player[num89]; - targetCenter = player2.Center; - if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), radialOffset) > 0f) - radialOffset *= -1f; - - Vector2 vector34 = targetCenter + player2.velocity * targetVelocityOffset; - vector32 = targetCenter + radialOffset * lanceSpawnDistance - player2.velocity * 30f; - if (vector32.Distance(targetCenter) < lanceSpawnDistance) - { - Vector2 vector35 = targetCenter - vector32; - if (vector35 == Vector2.Zero) - vector35 = radialOffset; - - vector32 = targetCenter - vector35.SafeNormalize(Vector2.UnitY) * lanceSpawnDistance; - } - - v3 = vector34 - vector32; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector32, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lanceGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 5: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item163, npc.Center); - - float extraPhaseTime = masterMode ? 22f : 30f; - extraPhaseTime -= (float)reducedAttackCooldown; - - Vector2 offset = new Vector2(55f, -30f); - Vector2 lastingRainbowInitialSpawnLocation = npc.Center + offset; - - float lastingRainbowGateValue = 42f; - if (npc.ai[1] < lastingRainbowGateValue) - AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 3, Utils.GetLerpValue(0f, lastingRainbowGateValue, npc.ai[1], clamped: true), npc); - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation4) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation4).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - if ((int)npc.ai[1] % (int)lastingRainbowGateValue == 0 && npc.ai[1] < lastingRainbowGateValue) - { - float lastingRainbowRandomRotation = MathHelper.TwoPi * Main.rand.NextFloat(); - float numLastingRainbows = 13f; - for (float i = 0f; i < 1f; i += 1f / numLastingRainbows) - { - float ai1 = i; - Vector2 lastingRainbowVelocity = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 + MathHelper.TwoPi * ai1 + lastingRainbowRandomRotation); - Vector2 lastingRainbowSpawnLocation = lastingRainbowInitialSpawnLocation + lastingRainbowVelocity.RotatedBy(-MathHelper.PiOver2) * 30f; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), lastingRainbowSpawnLocation, lastingRainbowVelocity * (masterMode ? 10f : 8f), ProjectileID.HallowBossLastingRainbow, lastingRainbowDamage, 0f, Main.myPlayer, 0f, ai1); - - if (phase3) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), lastingRainbowSpawnLocation, lastingRainbowVelocity * (masterMode ? 12f : 10f), ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, ai1); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lastingRainbowGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 6: - { - // Avoid cheap bullshit. - npc.damage = 0; - - // Increase durability. - calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (BossRushEvent.BossRushActive ? 0.99f : 0.575f); - - float extraPhaseTime = (masterMode ? 105 : expertMode ? 120 : 135) - reducedAttackCooldown; - Vector2 offset = new Vector2(0f, -100f); - Vector2 sunDanceSpawnLocation = npc.Center + offset; - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation5) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation5).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.3f, moveSpeed * 0.7f); - - float phaseGateValue = masterMode ? 120f : 180f; - int sunDanceGateValue = 60; - if ((int)npc.ai[1] % sunDanceGateValue == 0 && npc.ai[1] < phaseGateValue) - { - int sunDanceSpawnOffset = (int)npc.ai[1] / sunDanceGateValue; - int targetLocationX = ((targetData.Center.X > npc.Center.X) ? 1 : 0); - float numSunDancePetals = masterMode ? 9f : expertMode ? 8f : 6f; - float sunDanceIncrement = 1f / numSunDancePetals; - for (float i = 0f; i < 1f; i += sunDanceIncrement) - { - float radialOffset = (i + sunDanceIncrement * 0.5f + (float)sunDanceSpawnOffset * sunDanceIncrement * 0.5f) % 1f; - float ai = MathHelper.TwoPi * (radialOffset + (float)targetLocationX); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), sunDanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenSunDance, sunDanceDamage, 0f, Main.myPlayer, ai, npc.whoAmI); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 7: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = masterMode ? 34f : expertMode ? 40f : 20f; - float lanceGateValue = masterMode ? 34f : expertMode ? 40f : 60f; - float totalLanceWalls = expertMode ? 6f : 4f; - float lancePhaseTime = lanceGateValue * totalLanceWalls; - - extraPhaseTime -= (float)reducedAttackCooldown; - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 vector25 = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(vector25 + stopMovingLocation4) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(vector25 + stopMovingLocation4).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.4f, moveSpeed); - - if ((float)(int)npc.ai[1] % lanceGateValue == 0f && npc.ai[1] < lancePhaseTime) - { - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - Main.rand.NextFloat(); - int lanceWallType = (int)npc.ai[1] / (int)lanceGateValue; - float numLances = phase3 ? (masterMode ? 18f : 15f) : 13f; - float distanceBetweenLances = phase3 ? (masterMode ? 125f : 135f) : 150f; - float lanceWallLength = numLances * distanceBetweenLances; - Vector2 lanceSpawnOffset = targetData.Center; - if (npc.Distance(lanceSpawnOffset) <= 3200f) - { - Vector2 vector26 = Vector2.Zero; - Vector2 lanceDirection = Vector2.UnitY; - float num77 = 0.4f; - float num78 = 1.4f; - float num79 = 1f; - if (expertMode) - { - numLances += 5f; - distanceBetweenLances += 50f; - lanceWallLength *= (masterMode ? 0.75f : 0.5f); - } - - switch (lanceWallType) - { - case 0: - lanceSpawnOffset += new Vector2((0f - lanceWallLength) / 2f, 0f) * num79; - vector26 = new Vector2(0f, lanceWallLength); - lanceDirection = Vector2.UnitX; - break; - case 1: - lanceSpawnOffset += new Vector2(lanceWallLength / 2f, distanceBetweenLances / 2f) * num79; - vector26 = new Vector2(0f, lanceWallLength); - lanceDirection = -Vector2.UnitX; - break; - case 2: - lanceSpawnOffset += new Vector2(0f - lanceWallLength, 0f - lanceWallLength) * num77 * num79; - vector26 = new Vector2(lanceWallLength * num78, 0f); - lanceDirection = new Vector2(1f, 1f); - break; - case 3: - lanceSpawnOffset += new Vector2(lanceWallLength * num77 + distanceBetweenLances / 2f, (0f - lanceWallLength) * num77) * num79; - vector26 = new Vector2((0f - lanceWallLength) * num78, 0f); - lanceDirection = new Vector2(-1f, 1f); - break; - case 4: - lanceSpawnOffset += new Vector2(0f - lanceWallLength, lanceWallLength) * num77 * num79; - vector26 = new Vector2(lanceWallLength * num78, 0f); - lanceDirection = lanceSpawnOffset.DirectionTo(targetData.Center); - break; - case 5: - lanceSpawnOffset += new Vector2(lanceWallLength * num77 + distanceBetweenLances / 2f, lanceWallLength * num77) * num79; - vector26 = new Vector2((0f - lanceWallLength) * num78, 0f); - lanceDirection = lanceSpawnOffset.DirectionTo(targetData.Center); - break; - } - - for (float lance = 0f; lance <= 1f; lance += 1f / numLances) - { - Vector2 origin = lanceSpawnOffset + vector26 * (lance - 0.5f); - Vector2 lanceRotation = lanceDirection; - if (expertMode) - { - Vector2 predictionVector = targetData.Velocity * 20f * lance; - Vector2 value2 = origin.DirectionTo(targetData.Center + predictionVector); - lanceRotation = Vector2.Lerp(lanceDirection, value2, 0.75f).SafeNormalize(Vector2.UnitY); - } - - float ai2 = lance; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), origin, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, lanceRotation.ToRotation(), ai2); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lancePhaseTime + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 8: - case 9: - { - float extraPhaseTime = 20 - reducedAttackCooldown; - float startDashTime = 40f; - float playDashSoundTime = 20f; - float endDashTime = phase3 ? 75f : 90f; - int dashStartDistance = phase3 ? 750 : 550; - int dashVelocity = phase3 ? 80 : 50; - float dashAcceleration = phase3 ? 0.08f : 0.05f; - - int dashDirection = (npc.ai[0] != 8f ? 1 : -1); - AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(startDashTime, endDashTime, npc.ai[1], clamped: true), npc); - - if (npc.ai[1] <= startDashTime) - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == playDashSoundTime) - SoundEngine.PlaySound(SoundID.Item160, npc.Center); - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 destination = (targetData.Invalid ? npc.Center : targetData.Center) + new Vector2(dashDirection * -dashStartDistance, 0f); - npc.SimpleFlyMovement(npc.DirectionTo(destination).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed * 2f); - if (npc.ai[1] == startDashTime) - npc.velocity *= 0.3f; - } - else if (npc.ai[1] <= endDashTime) - { - npc.velocity = Vector2.Lerp(value2: new Vector2(dashDirection * dashVelocity, 0f), value1: npc.velocity, amount: dashAcceleration); - if (npc.ai[1] == endDashTime) - npc.velocity *= 0.7f; - - npc.damage = (int)Math.Round(npc.defDamage * (enraged ? 3D : 1.5)); - } - else - { - // Avoid cheap bullshit. - npc.damage = 0; - - npc.velocity *= 0.92f; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= endDashTime + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 10: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = 20 - reducedAttackCooldown; - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - takeDamage = !(npc.ai[1] >= 30f) || !(npc.ai[1] <= 170f); - npc.velocity *= 0.95f; - if (npc.ai[1] == 90f) - { - if (npc.ai[3] == 0f) - npc.ai[3] = 1f; - - if (npc.ai[3] == 2f) - npc.ai[3] = 3f; - - npc.Center = npc.GetTargetData().Center + new Vector2(0f, -250f); - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 180f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 11: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - float extraPhaseTime = 20 - reducedAttackCooldown; - float lanceGateValue = masterMode ? 75f : 100f; - if (npc.ai[1] >= 6f && npc.ai[1] < 54f) - { - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - } - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation3) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation3).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - if ((int)npc.ai[1] % 3 == 0 && npc.ai[1] < lanceGateValue) - { - int numLances = phase3 ? 2 : 1; - for (int i = 0; i < numLances; i++) - { - // Spawn another lance in the opposite location - bool oppositeLance = i == 1; - - Vector2 vector13 = oppositeLance ? targetData.Velocity : -targetData.Velocity; - vector13.SafeNormalize(-Vector2.UnitY); - float lanceSpawnOffset = 100f; - Vector2 targetCenter = targetData.Center; - if (npc.Distance(targetCenter) > 2400f) - continue; - - int targetVelocityOffset = 90; - Vector2 vector14 = targetCenter + (oppositeLance ? -targetData.Velocity : targetData.Velocity) * targetVelocityOffset; - Vector2 lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; - if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) - { - Vector2 vector16 = targetCenter - lanceSpawnLocation; - if (vector16 == Vector2.Zero) - vector16 = vector13; - - lanceSpawnLocation = targetCenter - vector16.SafeNormalize(Vector2.UnitY) * lanceSpawnOffset; - } - - Vector2 rotationVector = vector14 - lanceSpawnLocation; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), lanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, rotationVector.ToRotation(), npc.ai[1] / lanceGateValue); - - if (Main.netMode == NetmodeID.MultiplayerClient) - continue; - - int rotationIndex = (int)(npc.ai[1] / 3f); - for (int l = 0; l < Main.maxPlayers; l++) - { - if (!npc.Boss_CanShootExtraAt(l, rotationIndex % 3, 3, 2400f)) - continue; - - Player player = Main.player[l]; - vector13 = oppositeLance ? player.velocity : -player.velocity; - vector13.SafeNormalize(-Vector2.UnitY); - lanceSpawnOffset = 100f; - targetCenter = player.Center; - targetVelocityOffset = 90; - Vector2 lanceDestination = targetCenter + (oppositeLance ? -player.velocity : player.velocity) * targetVelocityOffset; - lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; - if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) - { - Vector2 vector18 = targetCenter - lanceSpawnLocation; - if (vector18 == Vector2.Zero) - vector18 = vector13; - - lanceSpawnLocation = targetCenter - vector18.SafeNormalize(Vector2.UnitY) * lanceSpawnOffset; - } - - rotationVector = lanceDestination - lanceSpawnLocation; - Projectile.NewProjectile(npc.GetSource_FromAI(), lanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, rotationVector.ToRotation(), npc.ai[1] / lanceGateValue); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lanceGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 12: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = (masterMode ? 30f : expertMode ? 60f : 90f) - (float)reducedAttackCooldown; - Vector2 offset = new Vector2(-55f, -30f); - if (npc.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item165, npc.Center); - npc.velocity = new Vector2(0f, -12f); - } - - npc.velocity *= 0.95f; - bool shootRainbowStreaks = npc.ai[1] < 60f && npc.ai[1] >= 10f; - if (shootRainbowStreaks) - AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - - int rainbowStreakGateValue = 6; - if (expertMode) - rainbowStreakGateValue = 4; - if (phase3) - rainbowStreakGateValue *= 2; - - float radialOffset = (npc.ai[1] - 10f) / 50f; - if ((int)npc.ai[1] % rainbowStreakGateValue == 0 && shootRainbowStreaks) - { - Vector2 rainbowStreakVelocity = (rainbowStreakVelocity = new Vector2(0f, -20f - (phase3 ? ((masterMode ? 10f : 5f) * radialOffset) : 0f)).RotatedBy(MathHelper.TwoPi * radialOffset)); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, radialOffset); - if (phase3) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, -rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, 1f - radialOffset); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num24 = (int)(npc.ai[1] % (float)rainbowStreakGateValue); - for (int j = 0; j < Main.maxPlayers; j++) - { - if (npc.Boss_CanShootExtraAt(j, num24 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, j, radialOffset); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 13: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item165, npc.Center); - npc.velocity = new Vector2(0f, -7f); - } - - npc.velocity *= 0.95f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - NPCAimedTarget targetData = npc.GetTargetData(); - becomeVisible = false; - bool turnInvisible = false; - bool despawn = false; - if (!turnInvisible) - { - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - { - if (!Main.dayTime) - despawn = true; - - if (Main.dayTime && Main.time >= 53400D) - despawn = true; - } - - turnInvisible = turnInvisible || despawn; - } - - if (!turnInvisible) - { - bool noValidTarget = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistance; - turnInvisible = turnInvisible || noValidTarget; - } - - npc.alpha = Utils.Clamp(npc.alpha + turnInvisible.ToDirectionInt() * 5, 0, 255); - bool flag10 = npc.alpha == 0 || npc.alpha == 255; - int totalDust = 5; - for (int i = 0; i < totalDust; i++) - { - float num19 = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); - Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); - int num20 = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, DustID.RainbowMk2, 0f, 0f, 0, newColor); - Main.dust[num20].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); - Main.dust[num20].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num20].noGravity = true; - Main.dust[num20].scale = 0.9f + Main.rand.NextFloat() * 1.2f; - Main.dust[num20].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * num19; - Main.dust[num20].velocity += Vector2.UnitY * -2f; - Main.dust[num20].scale = 0.35f; - if (num20 != Main.maxDust) - { - Dust dust = Dust.CloneDust(num20); - dust.scale /= 2f; - dust.fadeIn *= 0.85f; - dust.color = new Color(255, 255, 255, 255); - } - } - - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 20f && flag10)) - break; - - if (npc.alpha == 255) - { - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - - return false; - } - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - break; - } - } - - npc.dontTakeDamage = !takeDamage; - - if (phase3) - npc.defense = (int)Math.Round(npc.defDefense * 0.8); - else if (phase2) - npc.defense = (int)Math.Round(npc.defDefense * 1.2); - else - npc.defense = npc.defDefense; - - if ((npc.localAI[0] += 1f) >= 44f) - npc.localAI[0] = 0f; - - if (becomeVisible) - npc.alpha = Utils.Clamp(npc.alpha - 5, minAlpha, 255); - - Lighting.AddLight(npc.Center, Vector3.One * npc.Opacity); - - return false; - } - private static void CreateSpawnDust(NPC npc, bool useAI = true) { int spawnDustAmount = 2; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index 4d6bd4d2b2..81121e90df 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -929,823 +929,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - // If you think for a fucking second that I'm going to refactor this... - public static bool VanillaEyeofCthulhuAI(NPC npc, Mod mod) - { - Lighting.AddLight(npc.Center, 0.5f, 0.5f, 0.5f); - - bool flag2 = false; - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.2 : 0.12)) - flag2 = true; - - bool flag3 = false; - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.08 : 0.04)) - flag3 = true; - - float num4 = Main.masterMode ? 15f : 20f; - if (flag3) - num4 = Main.masterMode ? 8f : 10f; - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - bool dead = Main.player[npc.target].dead; - float num5 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num6 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num7 = (float)Math.Atan2(num6, num5) + MathHelper.PiOver2; - if (num7 < 0f) - num7 += MathHelper.TwoPi; - else if ((double)num7 > MathHelper.TwoPi) - num7 -= MathHelper.TwoPi; - - float num8 = 0f; - if (npc.ai[0] == 0f && npc.ai[1] == 0f) - num8 = 0.02f; - - if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num8 = 0.05f; - - if (npc.ai[0] == 3f && npc.ai[1] == 0f) - num8 = 0.05f; - - if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num8 = 0.08f; - - if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num4) - num8 = 0.15f; - - if (npc.ai[0] == 3f && npc.ai[1] == 5f) - num8 = 0.05f; - - if (Main.expertMode) - num8 *= (Main.masterMode ? 2f : 1.5f); - - if (flag3 && Main.expertMode) - num8 = 0f; - - if (npc.rotation < num7) - { - if ((double)(num7 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num8; - else - npc.rotation += num8; - } - else if (npc.rotation > num7) - { - if ((double)(npc.rotation - num7) > MathHelper.Pi) - npc.rotation += num8; - else - npc.rotation -= num8; - } - - if (npc.rotation > num7 - num8 && npc.rotation < num7 + num8) - npc.rotation = num7; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if ((double)npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num7 - num8 && npc.rotation < num7 + num8) - npc.rotation = num7; - - if (Main.rand.NextBool(5)) - { - int num9 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); - Main.dust[num9].velocity.X *= 0.5f; - Main.dust[num9].velocity.Y *= 0.1f; - } - - npc.reflectsProjectiles = false; - if (Main.IsItDay() || dead) - { - npc.velocity.Y -= 0.04f; - npc.EncourageDespawn(10); - return false; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float num10 = 5f; - float num11 = 0.04f; - if (Main.expertMode) - { - num11 = Main.masterMode ? 0.2f : 0.15f; - num10 = Main.masterMode ? 9f : 7f; - } - - if (Main.getGoodWorld) - { - num11 += 0.05f; - num10 += 1f; - } - - Vector2 vector = npc.Center; - float num12 = Main.player[npc.target].Center.X - vector.X; - float num13 = Main.player[npc.target].Center.Y - 200f - vector.Y; - float num14 = (float)Math.Sqrt(num12 * num12 + num13 * num13); - float num15 = num14; - num14 = num10 / num14; - num12 *= num14; - num13 *= num14; - if (npc.velocity.X < num12) - { - npc.velocity.X += num11; - if (npc.velocity.X < 0f && num12 > 0f) - npc.velocity.X += num11; - } - else if (npc.velocity.X > num12) - { - npc.velocity.X -= num11; - if (npc.velocity.X > 0f && num12 < 0f) - npc.velocity.X -= num11; - } - - if (npc.velocity.Y < num13) - { - npc.velocity.Y += num11; - if (npc.velocity.Y < 0f && num13 > 0f) - npc.velocity.Y += num11; - } - else if (npc.velocity.Y > num13) - { - npc.velocity.Y -= num11; - if (npc.velocity.Y > 0f && num13 < 0f) - npc.velocity.Y -= num11; - } - - npc.ai[2] += 1f; - float num16 = Main.masterMode ? 400f : 600f; - if (Main.expertMode) - num16 *= 0.35f; - - if (npc.ai[2] >= num16) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - } - else if ((npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num15 < 500f) || (Main.expertMode && num15 < (Main.masterMode ? 750f : 500f))) - { - if (!Main.player[npc.target].dead) - npc.ai[3] += 1f; - - float num17 = Main.masterMode ? 70f : 110f; - if (Main.expertMode) - num17 *= 0.4f; - - if (Main.getGoodWorld) - num17 *= 0.8f; - - if (npc.ai[3] >= num17) - { - npc.ai[3] = 0f; - npc.rotation = num7; - float num18 = 5f; - if (Main.expertMode) - num18 = 6f; - if (Main.masterMode) - num18 = 9f; - - float num19 = Main.player[npc.target].Center.X - vector.X; - float num20 = Main.player[npc.target].Center.Y - vector.Y; - float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); - num21 = num18 / num21; - Vector2 vector2 = vector; - Vector2 vector3 = default(Vector2); - vector3.X = num19 * num21; - vector3.Y = num20 * num21; - vector2.X += vector3.X * 10f; - vector2.Y += vector3.Y * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num22 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu); - Main.npc[num22].velocity.X = vector3.X; - Main.npc[num22].velocity.Y = vector3.Y; - if (Main.dedServ && num22 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num22); - } - - SoundEngine.PlaySound(SoundID.NPCHit1, vector2); - for (int m = 0; m < 10; m++) - Dust.NewDust(vector2, 20, 20, DustID.Blood, vector3.X * 0.4f, vector3.Y * 0.4f); - } - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.rotation = num7; - float num23 = 6f; - if (Main.expertMode) - num23 = 7f; - if (Main.masterMode) - num23 = 9f; - - if (Main.getGoodWorld) - num23 += 1f; - - Vector2 vector4 = npc.Center; - float num24 = Main.player[npc.target].Center.X - vector4.X; - float num25 = Main.player[npc.target].Center.Y - vector4.Y; - float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); - num26 = num23 / num26; - npc.velocity.X = num24 * num26; - npc.velocity.Y = num25 * num26; - npc.ai[1] = 2f; - npc.ForceNetUpdate(false); - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - if (npc.ai[2] >= 40f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - if (Main.expertMode) - npc.velocity *= 0.985f; - if (Main.masterMode) - npc.velocity *= 0.99f; - - if (Main.getGoodWorld) - npc.velocity *= 0.99f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - int num27 = 150; - if (Main.expertMode) - num27 = 100; - if (Main.masterMode) - num27 = 80; - - if (Main.getGoodWorld) - num27 -= 15; - - if (npc.ai[2] >= (float)num27) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num7; - if (npc.ai[3] >= (Main.masterMode ? 4f : 3f)) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - float num28 = 0.5f; - if (Main.expertMode) - num28 = 0.65f; - if (Main.masterMode) - num28 = 0.75f; - - if ((float)npc.life < (float)npc.lifeMax * num28) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.ForceNetUpdate(false); - } - - return false; - } - - if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[0] == 1f || npc.ai[3] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (Main.getGoodWorld) - npc.reflectsProjectiles = true; - - int num29 = 20; - if (Main.getGoodWorld && npc.life < npc.lifeMax / 3) - num29 = 10; - - if (Main.expertMode && npc.ai[1] % (float)num29 == 0f) - { - float num30 = Main.masterMode ? 8f : 5f; - Vector2 vector5 = npc.Center; - float num31 = Main.rand.Next(-200, 200); - float num32 = Main.rand.Next(-200, 200); - if (Main.getGoodWorld) - { - num31 *= 3f; - num32 *= 3f; - } - - float num33 = (float)Math.Sqrt(num31 * num31 + num32 * num32); - num33 = num30 / num33; - Vector2 vector6 = vector5; - Vector2 vector7 = default(Vector2); - vector7.X = num31 * num33; - vector7.Y = num32 * num33; - vector6.X += vector7.X * 10f; - vector6.Y += vector7.Y * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num34 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y, NPCID.ServantofCthulhu); - Main.npc[num34].velocity.X = vector7.X; - Main.npc[num34].velocity.Y = vector7.Y; - if (Main.dedServ && num34 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34); - } - - for (int n = 0; n < 10; n++) - Dust.NewDust(vector6, 20, 20, DustID.Blood, vector7.X * 0.4f, vector7.Y * 0.4f); - } - - if (npc.ai[1] >= 100f) - { - if (npc.ai[3] == 1f) - { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - } - else - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - for (int num35 = 0; num35 < 2; num35++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); - } - - for (int num36 = 0; num36 < 20; num36++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - - return false; - } - - npc.defense = 0; - if (Main.expertMode) - { - if (flag2) - npc.defense = -(Main.masterMode ? 10 : 15); - if (flag3) - npc.defense = -(Main.masterMode ? 20 : 30); - } - - double phase2DamageMultiplier = 1.5; - npc.damage = (int)Math.Round(npc.defDamage * phase2DamageMultiplier); - int reducedSetDamage = (int)Math.Round(npc.damage * 0.5); - - if (npc.ai[1] == 0f && flag2) - npc.ai[1] = 5f; - - if (npc.ai[1] == 0f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - float num39 = Main.masterMode ? 8f : 6f; - float num40 = Main.masterMode ? 0.1f : 0.07f; - Vector2 vector8 = npc.Center; - float num41 = Main.player[npc.target].Center.X - vector8.X; - float num42 = Main.player[npc.target].Center.Y - 120f - vector8.Y; - float num43 = (float)Math.Sqrt(num41 * num41 + num42 * num42); - float distanceVelocityIncrease = Main.masterMode ? 1.5f : 1f; - float distanceAccelerationIncrease = Main.masterMode ? 0.08f : 0.05f; - if (num43 > 400f && Main.expertMode) - { - num39 += distanceVelocityIncrease; - num40 += distanceAccelerationIncrease; - if (num43 > 600f) - { - num39 += distanceVelocityIncrease; - num40 += distanceAccelerationIncrease; - if (num43 > 800f) - { - num39 += distanceVelocityIncrease; - num40 += distanceAccelerationIncrease; - } - } - } - - if (Main.getGoodWorld) - { - num39 += 1f; - num40 += 0.1f; - } - - num43 = num39 / num43; - num41 *= num43; - num42 *= num43; - if (npc.velocity.X < num41) - { - npc.velocity.X += num40; - if (npc.velocity.X < 0f && num41 > 0f) - npc.velocity.X += num40; - } - else if (npc.velocity.X > num41) - { - npc.velocity.X -= num40; - if (npc.velocity.X > 0f && num41 < 0f) - npc.velocity.X -= num40; - } - - if (npc.velocity.Y < num42) - { - npc.velocity.Y += num40; - if (npc.velocity.Y < 0f && num42 > 0f) - npc.velocity.Y += num40; - } - else if (npc.velocity.Y > num42) - { - npc.velocity.Y -= num40; - if (npc.velocity.Y > 0f && num42 < 0f) - npc.velocity.Y -= num40; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (Main.masterMode ? 120f : 200f)) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.45 : 0.35)) - npc.ai[1] = 3f; - - npc.netUpdate = true; - } - - if (Main.expertMode && flag3) - { - npc.netUpdate = true; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.ai[3] -= 1000f; - } - } - else if (npc.ai[1] == 1f) - { - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - npc.rotation = num7; - float num44 = Main.masterMode ? 8f : 6.8f; - if (Main.expertMode && npc.ai[3] == 1f) - num44 *= 1.15f; - - if (Main.expertMode && npc.ai[3] == 2f) - num44 *= 1.3f; - - if (Main.getGoodWorld) - num44 *= 1.2f; - - Vector2 vector9 = npc.Center; - float num45 = Main.player[npc.target].Center.X - vector9.X; - float num46 = Main.player[npc.target].Center.Y - vector9.Y; - float num47 = (float)Math.Sqrt(num45 * num45 + num46 * num46); - num47 = num44 / num47; - npc.velocity.X = num45 * num47; - npc.velocity.Y = num46 * num47; - npc.ai[1] = 2f; - npc.ForceNetUpdate(false); - } - else if (npc.ai[1] == 2f) - { - float num48 = 40f; - npc.ai[2] += 1f; - if (Main.expertMode) - num48 = 50f; - if (Main.masterMode) - num48 = 60f; - - if (npc.ai[2] >= num48) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.velocity *= 0.97f; - if (Main.expertMode) - npc.velocity *= 0.98f; - if (Main.masterMode) - npc.velocity *= 0.99f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - int num49 = 130; - if (Main.expertMode) - num49 = 90; - if (Main.masterMode) - num49 = 80; - - if (npc.ai[2] >= (float)num49) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num7; - if (npc.ai[3] >= 3f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.6 : 0.5)) - { - npc.ai[1] = 3f; - npc.ai[3] += Main.rand.Next(1, 4); - } - - npc.ForceNetUpdate(false); - } - else - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 3f) - { - if (npc.ai[3] == 4f && flag2 && npc.Center.Y > Main.player[npc.target].Center.Y) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.ForceNetUpdate(false); - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num50 = Main.masterMode ? 24f : 20f; - Vector2 vector10 = npc.Center; - float num51 = Main.player[npc.target].Center.X - vector10.X; - float num52 = Main.player[npc.target].Center.Y - vector10.Y; - float num53 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; - num53 += 10f - num53; - if (num53 < 5f) - num53 = 5f; - - if (num53 > 15f) - num53 = 15f; - - if (npc.ai[2] == -1f && !flag3) - { - num53 *= 4f; - num50 *= 1.3f; - } - - if (flag3) - num53 *= 2f; - - num51 -= Main.player[npc.target].velocity.X * num53; - num52 -= Main.player[npc.target].velocity.Y * num53 / 4f; - num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - if (flag3) - { - num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - } - - float num54 = (float)Math.Sqrt(num51 * num51 + num52 * num52); - float num55 = num54; - num54 = num50 / num54; - npc.velocity.X = num51 * num54; - npc.velocity.Y = num52 * num54; - npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; - if (flag3) - { - npc.velocity.X += (float)Main.rand.Next(-50, 51) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.1f; - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); - if (npc.Center.X > Main.player[npc.target].Center.X) - num57 *= -1f; - - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num56 *= -1f; - - npc.velocity.X = num57 + npc.velocity.X; - npc.velocity.Y = num56 + npc.velocity.Y; - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= num50; - npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; - } - else if (num55 < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num58 = Math.Abs(npc.velocity.X); - float num59 = Math.Abs(npc.velocity.Y); - if (npc.Center.X > Main.player[npc.target].Center.X) - num59 *= -1f; - - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num58 *= -1f; - - npc.velocity.X = num59; - npc.velocity.Y = num58; - } - } - else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num60 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; - float num61 = num60; - if (npc.Center.X > Main.player[npc.target].Center.X) - num61 *= -1f; - - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num60 *= -1f; - - npc.velocity.X = num61; - npc.velocity.Y = num60; - } - - npc.ai[1] = 4f; - npc.ForceNetUpdate(false); - } - } - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); - - float num62 = num4; - npc.ai[2] += 1f; - if (npc.ai[2] == num62 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - npc.ai[2] -= 1f; - - if (npc.ai[2] >= num62) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float num63 = num62 + 13f; - if (npc.ai[2] >= num63) - { - npc.ForceNetUpdate(false); - - npc.ai[3] += 1f; - npc.ai[2] = 0f; - if (npc.ai[3] >= 5f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (npc.target >= 0 && Main.getGoodWorld && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, npc.width, npc.height)) - { - SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; - } - } - else - npc.ai[1] = 3f; - } - } - else if (npc.ai[1] == 5f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - float num64 = 600f; - float num65 = Main.masterMode ? 12f : 9f; - float num66 = Main.masterMode ? 0.4f : 0.3f; - Vector2 vector11 = npc.Center; - float num67 = Main.player[npc.target].Center.X - vector11.X; - float num68 = Main.player[npc.target].Center.Y + num64 - vector11.Y; - float num69 = (float)Math.Sqrt(num67 * num67 + num68 * num68); - num69 = num65 / num69; - num67 *= num69; - num68 *= num69; - if (npc.velocity.X < num67) - { - npc.velocity.X += num66; - if (npc.velocity.X < 0f && num67 > 0f) - npc.velocity.X += num66; - } - else if (npc.velocity.X > num67) - { - npc.velocity.X -= num66; - if (npc.velocity.X > 0f && num67 < 0f) - npc.velocity.X -= num66; - } - - if (npc.velocity.Y < num68) - { - npc.velocity.Y += num66; - if (npc.velocity.Y < 0f && num68 > 0f) - npc.velocity.Y += num66; - } - else if (npc.velocity.Y > num68) - { - npc.velocity.Y -= num66; - if (npc.velocity.Y > 0f && num68 < 0f) - npc.velocity.Y -= num66; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (Main.masterMode ? 40f : 70f)) - { - npc.ai[1] = 3f; - npc.ai[2] = -1f; - npc.ai[3] = Main.rand.Next(-3, 1); - npc.netUpdate = true; - } - } - - if (flag3 && npc.ai[1] == 5f) - npc.ai[1] = 3f; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index e75fd3ccdd..b7bc32aaa0 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -1547,966 +1547,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaGolemAI(NPC npc, Mod mod) - { - NPC.golemBoss = npc.whoAmI; - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 0.5f; - if (Main.masterMode) - enrageScale += 0.5f; - if (Main.getGoodWorld) - enrageScale += 2f; - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16D) - { - enrageScale *= 2f; - npc.Calamity().CurrentlyEnraged = true; - } - - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); - } - - if (npc.target >= 0 && Main.player[npc.target].dead) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Main.player[npc.target].dead) - npc.noTileCollide = true; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - bool flag = false; - bool flag2 = false; - bool flag3 = false; - npc.dontTakeDamage = false; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemHead) - flag = true; - - if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemFistLeft) - flag2 = true; - - if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemFistRight) - flag3 = true; - } - - npc.dontTakeDamage = flag; - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) - { - for (int j = (int)(npc.position.X / 16f); (float)j < (npc.position.X + (float)npc.width) / 16f; j++) - { - for (int k = (int)(npc.position.Y / 16f); (float)k < (npc.position.Y + (float)npc.width) / 16f; k++) - { - if (Main.tile[j, k].TileType == TileID.Torches) - { - Main.tile[j, k].Get().HasTile = false; - if (Main.dedServ) - NetMessage.SendTileSquare(-1, j, k); - } - } - } - } - - npc.position += npc.netOffset; - if (!Main.getGoodWorld) - { - if (!flag2) - { - int num2 = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100); - Main.dust[num2].alpha += Main.rand.Next(100); - Main.dust[num2].velocity *= 0.2f; - Main.dust[num2].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num2].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - num2 = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch); - if (!Main.rand.NextBool(20)) - { - Main.dust[num2].noGravity = true; - Main.dust[num2].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num2].velocity.Y -= 1f; - } - } - } - - if (!flag3) - { - int num3 = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100); - Main.dust[num3].alpha += Main.rand.Next(100); - Main.dust[num3].velocity *= 0.2f; - Main.dust[num3].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num3].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - num3 = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch); - if (!Main.rand.NextBool(20)) - { - Main.dust[num3].noGravity = true; - Main.dust[num3].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num3].velocity.Y -= 1f; - } - } - } - } - - npc.position -= npc.netOffset; - if (npc.noTileCollide && !Main.player[npc.target].dead) - { - if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) - npc.noTileCollide = false; - else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidTiles(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - } - - if (npc.ai[0] == 0f) - { - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.X *= 0.8f; - float num4 = 1f; - if (npc.ai[1] > 0f) - { - if (!flag2) - num4 += 2f; - - if (!flag3) - num4 += 2f; - - if (!flag) - num4 += 2f; - - if (npc.life < npc.lifeMax) - num4 += 1f; - - if (npc.life < npc.lifeMax / 2) - num4 += 4f; - - if (npc.life < npc.lifeMax / 3) - num4 += 8f; - - num4 *= enrageScale; - if (Main.getGoodWorld) - num4 += 100f; - } - - npc.ai[1] += num4; - if (npc.ai[1] >= 300f) - { - npc.ai[1] = -20f; - npc.frameCounter = 0D; - } - else if (npc.ai[1] == -1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.noTileCollide = true; - - if (!flag) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.velocity.X = 4 * npc.direction; - if (npc.life < npc.lifeMax) - { - npc.velocity.Y = -12.1f * (enrageScale + 9f) / 10f; - if ((double)npc.velocity.Y < -19.1) - npc.velocity.Y = -19.1f; - } - else - npc.velocity.Y = -12.1f; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - } - } - else if (npc.ai[0] == 1f) - { - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - SoundEngine.PlaySound(SoundID.Item14, npc.Center); - npc.ai[0] = 0f; - for (int l = (int)npc.position.X - 20; l < (int)npc.position.X + npc.width + 40; l += 20) - { - for (int m = 0; m < 4; m++) - { - int num5 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num5].velocity *= 0.2f; - } - - int num6 = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(l - 20, npc.position.Y + (float)npc.height - 8f), default(Vector2), Main.rand.Next(61, 64)); - Main.gore[num6].velocity *= 0.4f; - } - } - else - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - { - npc.velocity.X *= 0.9f; - if (npc.Bottom.Y < Main.player[npc.target].position.Y) - npc.velocity.Y += 0.2f * (enrageScale + 1f) / 2f; - } - else - { - if (npc.direction < 0) - npc.velocity.X -= 0.2f; - else if (npc.direction > 0) - npc.velocity.X += 0.2f; - - float num7 = 3f; - if (npc.life < npc.lifeMax) - num7 += 1f; - - if (npc.life < npc.lifeMax / 2) - num7 += 1f; - - if (npc.life < npc.lifeMax / 4) - num7 += 1f; - - num7 *= (enrageScale + 1f) / 2f; - if (npc.velocity.X < 0f - num7) - npc.velocity.X = 0f - num7; - - if (npc.velocity.X > num7) - npc.velocity.X = num7; - } - } - } - - if (npc.target <= 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - int num8 = 3000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num8) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num8) - npc.active = false; - } - - return false; - } - - public static bool VanillaGolemFistAI(NPC npc, Mod mod) - { - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 1f; - if (Main.masterMode) - enrageScale += 1f; - if (Main.getGoodWorld) - enrageScale += 3f; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) - enrageScale *= 2f; - - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - Player player = Main.player[npc.target]; - NPC nPC = Main.npc[NPC.golemBoss]; - Vector2 vector = nPC.Center + nPC.velocity + new Vector2(0f, -9f * npc.scale); - vector.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; - Vector2 vector2 = vector - npc.Center; - float num2 = vector2.Length(); - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.noTileCollide = true; - float num3 = 14f; - if (npc.life < npc.lifeMax / 2) - num3 += 3f; - - if (npc.life < npc.lifeMax / 4) - num3 += 3f; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) - num3 += 8f; - - num3 *= (enrageScale + 3f) / 4f; - if (num3 > 32f) - num3 = 32f; - - float x = vector2.X; - float y = vector2.Y; - float num4 = num2; - if (num4 < 12f + num3) - { - npc.rotation = 0f; - npc.velocity.X = x; - npc.velocity.Y = y; - float num5 = enrageScale; - npc.ai[1] += num5; - if (npc.life < npc.lifeMax / 2) - npc.ai[1] += num5; - - if (npc.life < npc.lifeMax / 4) - npc.ai[1] += num5; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) - npc.ai[1] += 10f * num5; - - if (npc.ai[1] >= 60f) - { - if ((npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > Main.player[npc.target].Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - } - else - npc.ai[1] = 0f; - } - } - else - { - num4 = num3 / num4; - npc.velocity.X = x * num4; - npc.velocity.Y = y * num4; - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - } - } - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[1] += 1f; - npc.Center = vector; - npc.rotation = 0f; - npc.velocity = Vector2.Zero; - if (npc.ai[1] <= 15f) - { - for (int i = 0; i < 1; i++) - { - Vector2 vector3 = Main.rand.NextVector2Circular(80f, 80f); - Vector2 vector4 = vector3 * -1f * 0.05f; - Vector2 vector5 = Main.rand.NextVector2Circular(20f, 20f); - Dust dust = Dust.NewDustPerfect(npc.Center + vector4 + vector3 + vector5, 228, vector4); - dust.fadeIn = 1.5f; - dust.scale = 0.5f; - if (Main.getGoodWorld) - dust.noLight = true; - - dust.noGravity = true; - } - } - - if (npc.ai[1] >= 30f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - float num6 = 12f; - if (npc.life < npc.lifeMax / 2) - num6 += 4f; - - if (npc.life < npc.lifeMax / 4) - num6 += 4f; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) - num6 += 10f; - - num6 *= (enrageScale + 3f) / 4f; - if (num6 > 48f) - num6 = 48f; - - Vector2 vector6 = npc.Center; - float num7 = Main.player[npc.target].Center.X - vector6.X; - float num8 = Main.player[npc.target].Center.Y - vector6.Y; - float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8); - num9 = num6 / num9; - npc.velocity.X = num7 * num9; - npc.velocity.Y = num8 * num9; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); - } - } - else if (npc.ai[0] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) - { - for (int j = (int)(npc.position.X / 16f) - 1; (float)j < (npc.position.X + (float)npc.width) / 16f + 1f; j++) - { - for (int k = (int)(npc.position.Y / 16f) - 1; (float)k < (npc.position.Y + (float)npc.width) / 16f + 1f; k++) - { - if (Main.tile[j, k].TileType == TileID.Torches) - { - Main.tile[j, k].Get().HasTile = false; - if (Main.dedServ) - NetMessage.SendTileSquare(-1, j, k); - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] == 1f) - SoundEngine.PlaySound(SoundID.Item14, npc.Center); - - if (Main.rand.NextBool()) - { - Vector2 vector7 = npc.velocity * 0.5f; - Vector2 vector8 = Main.rand.NextVector2Circular(20f, 20f); - Dust.NewDustPerfect(npc.Center + vector7 + vector8, 306, vector7, 0, Main.OurFavoriteColor).scale = 2f; - } - - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - if (npc.velocity.X > 0f && npc.Center.X > player.Center.X) - npc.noTileCollide = false; - - if (npc.velocity.X < 0f && npc.Center.X < player.Center.X) - npc.noTileCollide = false; - } - else - { - if (npc.velocity.Y > 0f && npc.Center.Y > player.Center.Y) - npc.noTileCollide = false; - - if (npc.velocity.Y < 0f && npc.Center.Y < player.Center.Y) - npc.noTileCollide = false; - } - - if (num2 > 700f || npc.collideX || npc.collideY) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else - { - if (npc.ai[0] != 3f) - return false; - - // Set damage - npc.damage = npc.defDamage; - - npc.noTileCollide = true; - float num10 = 0.4f; - Vector2 vector9 = npc.Center; - float num11 = Main.player[npc.target].Center.X - vector9.X; - float num12 = Main.player[npc.target].Center.Y - vector9.Y; - float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12); - num13 = 12f / num13; - num11 *= num13; - num12 *= num13; - if (npc.velocity.X < num11) - { - npc.velocity.X += num10; - if (npc.velocity.X < 0f && num11 > 0f) - npc.velocity.X += num10 * 2f; - } - else if (npc.velocity.X > num11) - { - npc.velocity.X -= num10; - if (npc.velocity.X > 0f && num11 < 0f) - npc.velocity.X -= num10 * 2f; - } - - if (npc.velocity.Y < num12) - { - npc.velocity.Y += num10; - if (npc.velocity.Y < 0f && num12 > 0f) - npc.velocity.Y += num10 * 2f; - } - else if (npc.velocity.Y > num12) - { - npc.velocity.Y -= num10; - if (npc.velocity.Y > 0f && num12 < 0f) - npc.velocity.Y -= num10 * 2f; - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); - } - - return false; - } - - public static bool VanillaGolemHeadAI(NPC npc, Mod mod) - { - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 1f; - if (Main.masterMode) - enrageScale += 1f; - if (Main.getGoodWorld) - enrageScale += 3f; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - } - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) - enrageScale *= 2f; - - npc.noTileCollide = true; - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - float num707 = 100f; - Vector2 vector89 = npc.Center; - float num708 = Main.npc[NPC.golemBoss].Center.X - vector89.X; - float num709 = Main.npc[NPC.golemBoss].Center.Y - vector89.Y; - num709 -= 57f * npc.scale; - num708 -= 3f * npc.scale; - float num710 = (float)Math.Sqrt(num708 * num708 + num709 * num709); - if (num710 < num707) - { - npc.rotation = 0f; - npc.velocity.X = num708; - npc.velocity.Y = num709; - } - else - { - num710 = num707 / num710; - npc.velocity.X = num708 * num710; - npc.velocity.Y = num709 * num710; - npc.rotation = npc.velocity.X * 0.1f; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 30f; - } - - if (npc.ai[0] == 0f) - { - npc.ai[1] += 1f; - int num711 = 300; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num711 - 20)) - { - npc.ai[1] += 2f * (enrageScale - 1f) / 3f; - npc.localAI[0] = 1f; - } - else - { - npc.ai[1] += 1f * (enrageScale - 1f) / 2f; - npc.localAI[0] = 0f; - } - - if (npc.ai[1] >= (float)num711) - { - npc.ai[1] = 0f; - Vector2 vector90 = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); - float num712 = 8f; - float num713 = Main.player[npc.target].Center.X - vector90.X; - float num714 = Main.player[npc.target].Center.Y - vector90.Y; - float num715 = (float)Math.Sqrt(num713 * num713 + num714 * num714); - num715 = num712 / num715; - num713 *= num715; - num714 *= num715; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector90.X, vector90.Y, num713, num714, type, damage, 0f, Main.myPlayer); - } - } - else if (npc.ai[0] == 1f) - { - Vector2 vector91 = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); - if (Main.player[npc.target].Center.X < npc.Center.X - (float)npc.width) - { - npc.localAI[1] = -1f; - vector91.X -= 40f * npc.scale; - } - else if (Main.player[npc.target].Center.X > npc.Center.X + (float)npc.width) - { - npc.localAI[1] = 1f; - vector91.X += 40f * npc.scale; - } - else - npc.localAI[1] = 0f; - - float num719 = (enrageScale + 3f) / 4f; - npc.ai[1] += num719; - if ((double)npc.life < (double)npc.lifeMax * 0.4) - npc.ai[1] += num719; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - npc.ai[1] += num719; - - int num720 = 300; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num720 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (npc.ai[1] >= (float)num720) - { - npc.ai[1] = 0f; - float num721 = 8f; - float num722 = Main.player[npc.target].Center.X - vector91.X; - float num723 = Main.player[npc.target].Center.Y - vector91.Y; - float num724 = (float)Math.Sqrt(num722 * num722 + num723 * num723); - num724 = num721 / num724; - num722 *= num724; - num723 *= num724; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector91.X, vector91.Y, num722, num723, type, damage, 0f, Main.myPlayer); - } - - npc.ai[2] += num719; - if (npc.life < npc.lifeMax / 3) - npc.ai[2] += num719; - - if (npc.life < npc.lifeMax / 4) - npc.ai[2] += num719; - - if (npc.life < npc.lifeMax / 5) - npc.ai[2] += num719; - - if (npc.ai[2] > (float)(60 + Main.rand.Next(600))) - { - npc.ai[2] = 0f; - - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - - if (npc.localAI[1] == 0f) - { - for (int num730 = 0; num730 < 2; num730++) - { - vector91 = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); - if (num730 == 0) - vector91.X -= 18f * npc.scale; - else - vector91.X += 18f * npc.scale; - - float num731 = 11f; - float num732 = Main.player[npc.target].Center.X - vector91.X; - float num733 = Main.player[npc.target].Center.Y - vector91.Y; - float num734 = (float)Math.Sqrt(num732 * num732 + num733 * num733); - num734 = num731 / num734; - num732 *= num734; - num733 *= num734; - - Vector2 laserVelocity = new Vector2(num732, num733); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num735 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[num735].timeLeft = 300; - } - } - } - else if (npc.localAI[1] != 0f) - { - vector91 = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); - if (npc.localAI[1] == -1f) - vector91.X -= 30f * npc.scale; - else if (npc.localAI[1] == 1f) - vector91.X += 30f * npc.scale; - - float num736 = 12f; - float num737 = Main.player[npc.target].Center.X - vector91.X; - float num738 = Main.player[npc.target].Center.Y - vector91.Y; - float num739 = (float)Math.Sqrt(num737 * num737 + num738 * num738); - num739 = num736 / num739; - num737 *= num739; - num738 *= num739; - - Vector2 laserVelocity = new Vector2(num737, num738); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num740 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[num740].timeLeft = 300; - } - } - } - } - - if (npc.life < npc.lifeMax / 2) - npc.ai[0] = 1f; - else - npc.ai[0] = 0f; - - return false; - } - - public static bool VanillaGolemHeadFreeAI(NPC npc, Mod mod) - { - bool flag37 = false; - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 1f; - if (Main.masterMode) - enrageScale += 1f; - if (Main.getGoodWorld) - enrageScale += 3f; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - } - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) - enrageScale *= 2f; - - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.noTileCollide = true; - flag37 = true; - } - else if (npc.noTileCollide && Collision.SolidTiles(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - float num742 = 7f; - float num743 = 0.05f; - Vector2 vector92 = npc.Center; - float num744 = Main.player[npc.target].Center.X - vector92.X; - float num745 = Main.player[npc.target].Center.Y - vector92.Y - 300f; - float num746 = (float)Math.Sqrt(num744 * num744 + num745 * num745); - num746 = num742 / num746; - num744 *= num746; - num745 *= num746; - if (npc.velocity.X < num744) - { - npc.velocity.X += num743; - if (npc.velocity.X < 0f && num744 > 0f) - npc.velocity.X += num743; - } - else if (npc.velocity.X > num744) - { - npc.velocity.X -= num743; - if (npc.velocity.X > 0f && num744 < 0f) - npc.velocity.X -= num743; - } - - if (npc.velocity.Y < num745) - { - npc.velocity.Y += num743; - if (npc.velocity.Y < 0f && num745 > 0f) - npc.velocity.Y += num743; - } - else if (npc.velocity.Y > num745) - { - npc.velocity.Y -= num743; - if (npc.velocity.Y > 0f && num745 < 0f) - npc.velocity.Y -= num743; - } - - float num747 = (enrageScale + 4f) / 5f; - npc.ai[1] += num747; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) - npc.ai[1] += num747; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) - npc.ai[1] += num747; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) - npc.ai[1] += num747; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) - npc.ai[1] += num747; - - int num748 = 300; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num748 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (flag37) - npc.ai[1] = 20f; - - if (npc.ai[1] >= (float)num748) - { - npc.ai[1] = 0f; - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); - float num749 = 8f; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - - float num752 = Main.player[npc.target].Center.X - vector93.X; - float num753 = Main.player[npc.target].Center.Y - vector93.Y; - float num754 = (float)Math.Sqrt(num752 * num752 + num753 * num753); - num754 = num749 / num754; - num752 *= num754; - num753 *= num754; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector93.X, vector93.Y, num752, num753, type, damage, 0f, Main.myPlayer); - } - - float num756 = enrageScale; - npc.ai[2] += num756; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.25) - npc.ai[2] += num756; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.5) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) - npc.ai[2] += num756; - - if (npc.ai[2] > (float)(100 + Main.rand.Next(4800))) - { - npc.ai[2] = 0f; - for (int num757 = 0; num757 < 2; num757++) - { - Vector2 vector94 = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); - switch (num757) - { - case 0: - vector94.X -= 14f * npc.scale; - break; - case 1: - vector94.X += 14f * npc.scale; - break; - } - - float num758 = 11f; - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.5) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.3) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) - num758 += 0.25f; - - float num761 = Main.player[npc.target].Center.X; - float num762 = Main.player[npc.target].Center.Y; - num761 -= vector94.X; - num762 -= vector94.Y; - float num763 = (float)Math.Sqrt(num761 * num761 + num762 * num762); - num763 = num758 / num763; - num761 *= num763; - num762 *= num763; - - Vector2 laserVelocity = new Vector2(num761, num762); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num764 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector94 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[num764].timeLeft = 300; - } - } - } - - if (!Main.getGoodWorld) - { - npc.position += npc.netOffset; - int num765 = Main.rand.Next(2) * 2 - 1; - Vector2 vector95 = npc.Bottom + new Vector2((float)(num765 * 22) * npc.scale, -22f * npc.scale); - Dust dust5 = Dust.NewDustPerfect(vector95, 228, (MathHelper.PiOver2 + -MathHelper.PiOver2 * (float)num765 + Main.rand.NextFloatDirection() * MathHelper.PiOver4).ToRotationVector2() * (2f + Main.rand.NextFloat())); - Dust dust = dust5; - dust.velocity += npc.velocity; - dust5.noGravity = true; - dust5 = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); - dust5.fadeIn = 0f; - dust5.scale = 0.7f + Main.rand.NextFloat() * 0.5f; - dust5.noGravity = true; - dust = dust5; - dust.velocity += npc.velocity; - npc.position -= npc.netOffset; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index c053243cfb..b3fa63a8d6 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -665,367 +665,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - // If you think for a fucking second that I'm going to refactor this... - public static bool VanillaKingSlimeAI(NPC npc, Mod mod) - { - float num236 = 1f; - float num237 = 1f; - bool flag6 = false; - bool flag7 = false; - bool flag8 = false; - float num238 = 2f; - if (Main.getGoodWorld) - { - num238 -= 1f - (float)npc.life / (float)npc.lifeMax; - num237 *= num238; - } - - npc.aiAction = 0; - if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = npc.lifeMax; - - if (npc.localAI[3] == 0f) - { - npc.localAI[3] = 1f; - flag6 = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -100f; - - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - } - - int num239 = 3000; - if (Main.player[npc.target].dead || Vector2.Distance(npc.Center, Main.player[npc.target].Center) > (float)num239) - { - CalamityUtils.CalamityTargeting(npc, default); - - if (Main.player[npc.target].dead || Vector2.Distance(npc.Center, Main.player[npc.target].Center) > (float)num239) - { - npc.EncourageDespawn(10); - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] != 5f) - { - npc.netUpdate = true; - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; - npc.localAI[1] = Main.maxTilesX * 16; - npc.localAI[2] = Main.maxTilesY * 16; - } - } - } - - if (!Main.player[npc.target].dead && npc.timeLeft > 10 && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityTargetingParameters options = CalamityTargetingParameters.Defaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - Point point3 = npc.Center.ToTileCoordinates(); - Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector30 = Main.player[npc.target].Center - npc.Center; - int num240 = 10; - int num241 = 0; - int num242 = 7; - int num243 = 0; - bool flag9 = false; - if (npc.localAI[0] >= 360f || vector30.Length() > 2000f) - { - if (npc.localAI[0] >= 360f) - npc.localAI[0] = 360f; - - flag9 = true; - num243 = 100; - } - - while (!flag9 && num243 < 100) - { - num243++; - int num244 = Main.rand.Next(point4.X - num240, point4.X + num240 + 1); - int num245 = Main.rand.Next(point4.Y - num240, point4.Y + 1); - if ((num245 >= point4.Y - num242 && num245 <= point4.Y + num242 && num244 >= point4.X - num242 && num244 <= point4.X + num242) || (num245 >= point3.Y - num241 && num245 <= point3.Y + num241 && num244 >= point3.X - num241 && num244 <= point3.X + num241) || Main.tile[num244, num245].HasUnactuatedTile) - continue; - - int num246 = num245; - int num247 = 0; - if (Main.tile[num244, num246].HasUnactuatedTile && Main.tileSolid[Main.tile[num244, num246].TileType] && !Main.tileSolidTop[Main.tile[num244, num246].TileType]) - { - num247 = 1; - } - else - { - for (; num247 < 150 && num246 + num247 < Main.maxTilesY; num247++) - { - int num248 = num246 + num247; - if (Main.tile[num244, num248].HasUnactuatedTile && Main.tileSolid[Main.tile[num244, num248].TileType] && !Main.tileSolidTop[Main.tile[num244, num248].TileType]) - { - num247--; - break; - } - } - } - - num245 += num247; - bool flag10 = true; - if (flag10 && Main.tile[num244, num245].LiquidType == LiquidID.Lava) - flag10 = false; - - if (flag10 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - flag10 = false; - - if (flag10) - { - npc.localAI[1] = num244 * 16 + 8; - npc.localAI[2] = num245 * 16 + 16; - flag9 = true; - break; - } - } - - if (num243 >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - } - } - } - - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 160f) - { - npc.ai[2]++; - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.localAI[0]++; - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0]--; - if (npc.localAI[0] < 0f) - npc.localAI[0] = 0f; - } - - if (npc.timeLeft < 10 && (npc.ai[0] != 0f || npc.ai[1] != 0f)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - flag7 = false; - } - - Dust dust; - if (npc.ai[1] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - flag7 = true; - npc.aiAction = 1; - npc.ai[0]++; - num236 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); - num236 = 0.5f + num236 * 0.5f; - if (npc.ai[0] >= 60f) - flag8 = true; - - if (npc.ai[0] == 60f) - Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, 734); - - if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[1] = 6f; - npc.ai[0] = 0f; - npc.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) - { - npc.ai[1] = 6f; - npc.ai[0] = 0f; - } - - if (!flag8) - { - for (int num249 = 0; num249 < 10; num249++) - { - int num250 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num250].noGravity = true; - dust = Main.dust[num250]; - dust.velocity *= 0.5f; - } - } - } - else if (npc.ai[1] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - flag7 = true; - npc.aiAction = 0; - npc.ai[0]++; - num236 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); - num236 = 0.5f + num236 * 0.5f; - if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[0] = -15f; - - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = -15f; - - CalamityUtils.CalamityTargeting(npc, default); - } - - for (int num251 = 0; num251 < 10; num251++) - { - int num252 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num252].noGravity = true; - dust = Main.dust[num252]; - dust.velocity *= 2f; - } - } - - npc.dontTakeDamage = (npc.hide = flag8); - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if (!flag7) - { - npc.ai[0] += (MathHelper.Lerp(1f, 13f, 1f - npc.life / (float)npc.lifeMax)); - if (npc.ai[0] >= 0f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - - if (npc.ai[1] == 3f) - { - npc.velocity.Y = -13f; - npc.velocity.X += (Main.masterMode ? 5.25f : 3.5f) * (float)npc.direction; - npc.ai[0] = -(Main.masterMode ? 140f : 180f); - npc.ai[1] = 0f; - } - else if (npc.ai[1] == 2f) - { - npc.velocity.Y = -6f; - npc.velocity.X += (Main.masterMode ? 6.75f : 4.5f) * (float)npc.direction; - npc.ai[0] = -(Main.masterMode ? 80f : 100f); - npc.ai[1] += 1f; - } - else - { - npc.velocity.Y = -8f; - npc.velocity.X += (Main.masterMode ? 6f : 4f) * (float)npc.direction; - npc.ai[0] = -(Main.masterMode ? 80f : 100f); - npc.ai[1] += 1f; - } - } - else if (npc.ai[0] >= -30f) - { - npc.aiAction = 1; - } - } - } - else if (npc.target < Main.maxPlayers) - { - float num253 = Main.masterMode ? 4.5f : 3f; - if (Main.getGoodWorld) - num253 = 6f; - - if ((npc.direction == 1 && npc.velocity.X < num253) || (npc.direction == -1 && npc.velocity.X > 0f - num253)) - { - if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - npc.velocity.X += (Main.masterMode ? 0.3f : 0.2f) * (float)npc.direction; - else - npc.velocity.X *= (Main.masterMode ? 0.86f : 0.93f); - } - } - - int num254 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num254].noGravity = true; - dust = Main.dust[num254]; - dust.velocity *= 0.5f; - if (npc.life <= 0) - return false; - - float num255 = (float)npc.life / (float)npc.lifeMax; - num255 = num255 * 0.5f + 0.75f; - num255 *= num236; - num255 *= num237; - if (num255 != npc.scale || flag6) - { - npc.position.X += npc.width / 2; - npc.position.Y += npc.height; - npc.scale = num255; - npc.width = (int)(98f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - int num256 = (int)((double)npc.lifeMax * 0.05); - if (!((float)(npc.life + num256) < npc.ai[3])) - return false; - - npc.ai[3] = npc.life; - int num257 = Main.rand.Next(1, 4); - for (int num258 = 0; num258 < num257; num258++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num259 = 1; - - int chanceForSpikedSlime = Main.masterMode ? 2 : 4; - if (Main.expertMode && Main.rand.NextBool(chanceForSpikedSlime)) - num259 = NPCID.SlimeSpiked; - - int num260 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num259); - Main.npc[num260].SetDefaults(num259); - Main.npc[num260].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num260].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num260].ai[0] = -1000 * Main.rand.Next(3); - Main.npc[num260].ai[1] = 0f; - if (Main.dedServ && num260 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num260); - } - - return false; - } - public static void GetPlaceToTeleportTo(NPC npc) { CalamityTargetingParameters options = CalamityTargetingParameters.Defaults; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index b228164acb..d6af968e23 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -1297,382 +1297,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaPlanteraAI(NPC npc, Mod mod) - { - bool flag39 = false; - bool flag40 = false; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Main.player[npc.target].dead) - { - flag40 = true; - flag39 = true; - } - else if (Main.netMode != NetmodeID.MultiplayerClient && npc.target >= 0 && npc.target < Main.maxPlayers) - { - int despawnDistance = 4800; - if (npc.timeLeft < NPC.activeTime && Vector2.Distance(npc.Center, Main.player[npc.target].Center) < (float)despawnDistance) - npc.timeLeft = NPC.activeTime; - } - - NPC.plantBoss = npc.whoAmI; - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - int hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); - hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); - hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); - } - - int[] array2 = new int[3]; - float num775 = 0f; - float num776 = 0f; - int num777 = 0; - for (int num778 = 0; num778 < Main.maxNPCs; num778++) - { - if (Main.npc[num778].active && Main.npc[num778].aiStyle == NPCAIStyleID.PlanteraHook) - { - num775 += Main.npc[num778].Center.X; - num776 += Main.npc[num778].Center.Y; - array2[num777] = num778; - num777++; - if (num777 > 2) - break; - } - } - - num775 /= (float)num777; - num776 /= (float)num777; - float num779 = 2.5f; - float num780 = 0.025f; - if (npc.life < npc.lifeMax / 2) - { - num779 = 5f; - num780 = 0.05f; - } - - if (npc.life < npc.lifeMax / 4) - num779 = 7f; - - if (!Main.player[npc.target].ZoneJungle || (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || Main.player[npc.target].position.Y > (float)(Main.UnderworldLayer * 16)) - { - flag39 = true; - num779 += 8f; - num780 = 0.15f; - } - - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && flag39; - - if (Main.expertMode) - { - num779 += (Main.masterMode ? 2f : 1f); - num779 *= (Main.masterMode ? 1.2f : 1.1f); - num780 += (Main.masterMode ? 0.02f : 0.01f); - num780 *= (Main.masterMode ? 1.2f : 1.1f); - } - - if (Main.getGoodWorld) - { - num779 *= 1.15f; - num780 *= 1.15f; - } - - Vector2 vector97 = new Vector2(num775, num776); - float num781 = Main.player[npc.target].Center.X - vector97.X; - float num782 = Main.player[npc.target].Center.Y - vector97.Y; - bool phase1MoveAway = npc.life > npc.lifeMax / 2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 480f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - bool adjustProjectileShootLocation = Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 80f; - if (flag40) - { - num782 *= -1f; - num781 *= -1f; - num779 += 8f; - } - else if (phase1MoveAway) - { - num782 *= -1f; - num781 *= -1f; - num779 *= 1.5f; - num780 *= 2f; - } - - float num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782); - int num784 = 500; - if (flag39) - num784 += 350; - - if (Main.expertMode) - num784 += (Main.masterMode ? 300 : 150); - - if (num783 >= (float)num784) - { - num783 = (float)num784 / num783; - num781 *= num783; - num782 *= num783; - } - - num775 += num781; - num776 += num782; - vector97 = npc.Center; - num781 = num775 - vector97.X; - num782 = num776 - vector97.Y; - num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782); - if (num783 < num779) - { - num781 = npc.velocity.X; - num782 = npc.velocity.Y; - } - else - { - num783 = num779 / num783; - num781 *= num783; - num782 *= num783; - } - - if (npc.velocity.X < num781) - { - npc.velocity.X += num780; - if (npc.velocity.X < 0f && num781 > 0f) - npc.velocity.X += num780 * 2f; - } - else if (npc.velocity.X > num781) - { - npc.velocity.X -= num780; - if (npc.velocity.X > 0f && num781 < 0f) - npc.velocity.X -= num780 * 2f; - } - - if (npc.velocity.Y < num782) - { - npc.velocity.Y += num780; - if (npc.velocity.Y < 0f && num782 > 0f) - npc.velocity.Y += num780 * 2f; - } - else if (npc.velocity.Y > num782) - { - npc.velocity.Y -= num780; - if (npc.velocity.Y > 0f && num782 < 0f) - npc.velocity.Y -= num780 * 2f; - } - - Vector2 vector98 = npc.Center; - float num785 = Main.player[npc.target].Center.X - vector98.X; - float num786 = Main.player[npc.target].Center.Y - vector98.Y; - npc.rotation = (float)Math.Atan2(num786, num785) + MathHelper.PiOver2; - if (npc.life > npc.lifeMax / 2) - { - npc.defense = 36; - if (flag39) - npc.defense *= 2; - - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - npc.localAI[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.9) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.8) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.7) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.6) - npc.localAI[1] += 1f; - - if (flag39) - npc.localAI[1] += 3f; - - if (Main.expertMode) - npc.localAI[1] += (Main.masterMode ? 2f : 1f); - - if (Main.expertMode && npc.justHit && Main.rand.NextBool()) - npc.localAI[3] = (Main.masterMode ? 2f : 1f); - - if (Main.getGoodWorld) - npc.localAI[1] += 1f; - - if (!(npc.localAI[1] > 80f)) - return false; - - npc.localAI[1] = 0f; - bool flag41 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - flag41 = true; - npc.localAI[3] = 0f; - } - - if (flag41) - { - Vector2 vector99 = npc.Center; - float num788 = 15f; - if (Main.expertMode) - num788 = Main.masterMode ? 19f : 17f; - - float num789 = Main.player[npc.target].Center.X - vector99.X; - float num790 = Main.player[npc.target].Center.Y - vector99.Y; - float num791 = (float)Math.Sqrt(num789 * num789 + num790 * num790); - num791 = num788 / num791; - num789 *= num791; - num790 *= num791; - int type = Main.masterMode ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; - int maxValue2 = 4; - int thornBallChance = 8; - if (Main.expertMode) - { - maxValue2 = 2; - thornBallChance = Main.masterMode ? 5 : 6; - } - - if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(maxValue2) && !Main.masterMode) - { - npc.localAI[1] = -30f; - type = ProjectileID.PoisonSeedPlantera; - } - else if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(thornBallChance)) - { - bool shootThornBall = true; - int numThornBalls = 0; - int thornBallLimit = 3; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) - { - numThornBalls++; - if (numThornBalls >= thornBallLimit) - { - shootThornBall = false; - break; - } - } - } - - npc.localAI[1] = shootThornBall ? -120f : -30f; - type = shootThornBall ? ProjectileID.ThornBall : ProjectileID.PoisonSeedPlantera; - } - else if (Main.masterMode) - npc.localAI[1] = -30f; - - int damage = npc.GetProjectileDamage(type); - if (flag39) - damage *= 2; - - Vector2 projectileVelocity = new Vector2(num789, num790); - int num794 = Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? vector99 : vector99 + projectileVelocity.SafeNormalize(Vector2.UnitY) * 70f, projectileVelocity, type, damage, 0f, Main.myPlayer); - if (type != ProjectileID.ThornBall) - Main.projectile[num794].timeLeft = 300; - } - - return false; - } - - npc.defense = 10; - int setDamage = (int)Math.Round(npc.defDamage * 1.4); - if (flag39) - { - npc.defense *= 4; - setDamage *= 2; - } - - npc.damage = setDamage; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 2f; - int num796 = Main.masterMode ? 12 : 8; - if (Main.getGoodWorld) - num796 += 6; - - for (int num797 = 0; num797 < num796; num797++) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - - if (Main.expertMode) - { - for (int num799 = 0; num799 < Main.maxNPCs; num799++) - { - if (Main.npc[num799].active && Main.npc[num799].aiStyle == NPCAIStyleID.PlanteraHook) - { - for (int num800 = 0; num800 < num796 / 2 - 1; num800++) - { - int num801 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - Main.npc[num801].ai[3] = num799 + 1; - } - } - } - } - } - else if (Main.expertMode && Main.rand.NextBool(Main.masterMode ? 50 : 60)) - { - int num802 = 0; - for (int num803 = 0; num803 < Main.maxNPCs; num803++) - { - if (Main.npc[num803].active && Main.npc[num803].type == NPCID.PlanterasTentacle && Main.npc[num803].ai[3] == 0f) - num802++; - } - - if (num802 < (Main.masterMode ? 12 : 8) && Main.rand.Next((num802 + 1) * 10) <= 1) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - } - } - - if (npc.localAI[2] == 0f) - { - Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); - Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); - Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 380, npc.scale); - npc.localAI[2] = 1f; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - npc.localAI[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.4) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.3) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - npc.localAI[1] += 1f; - - if (npc.localAI[1] >= (Main.masterMode ? 200f : Main.expertMode ? 275f : 350f)) - { - float num805 = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; - Vector2 vector100 = npc.Center; - float num806 = Main.player[npc.target].Center.X - vector100.X; - float num807 = Math.Abs(num806 * 0.2f); - float num808 = Main.player[npc.target].Center.Y - vector100.Y; - if (num808 > 0f) - num807 = 0f; - - num808 -= num807; - float num809 = (float)Math.Sqrt(num806 * num806 + num808 * num808); - num809 = num805 / num809; - num806 *= num809; - num808 *= num809; - int num810 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); - Main.npc[num810].velocity.X = num806; - Main.npc[num810].velocity.Y = num808; - Main.npc[num810].netUpdate = true; - npc.localAI[1] = 0f; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index eb52a49218..6815bf8ea1 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -141,7 +141,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool immuneToSlowingDebuffs = npc.ai[0] == 0f; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; @@ -252,9 +251,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; - int masterModeChargeLimit = death ? (phase5 ? 2 : 1) : (phase5 ? 3 : 2); - if (death && chargeAmt > masterModeChargeLimit) - chargeAmt = masterModeChargeLimit; + int deathChargeLimit = phase5 ? 3 : 2; + if (death && chargeAmt > deathChargeLimit) + chargeAmt = deathChargeLimit; // Switch to a random phase if chargeAmt has been exceeded if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) @@ -961,580 +960,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaQueenBeeAI(NPC npc, Mod mod) - { - if (Main.expertMode) - { - int num643 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + num643; - } - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - bool enrage = true; - int targetTileX = (int)Main.player[npc.target].Center.X / 16; - int targetTileY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); - if (tile.WallType == WallID.HiveUnsafe) - enrage = false; - - bool dead4 = Main.player[npc.target].dead; - float num644 = 0f; - if ((double)(npc.position.Y / 16f) < Main.worldSurface && enrage) - num644 += 1f; - - if (!Main.player[npc.target].ZoneJungle) - num644 += 1f; - - npc.Calamity().CurrentlyEnraged = num644 > 0f; - - if (Main.getGoodWorld) - num644 += 0.5f; - - float num645 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (npc.ai[0] != 5f) - { - if (npc.timeLeft < 60) - npc.timeLeft = 60; - - if (num645 > 3000f) - { - npc.ai[0] = 4f; - npc.netUpdate = true; - } - } - - if (dead4) - { - npc.ai[0] = 5f; - npc.netUpdate = true; - } - - if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.Y *= 0.98f; - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - if (npc.position.X < (float)(Main.maxTilesX * 8)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - else - npc.localAI[0] = 1f; - - npc.velocity.X -= 0.08f; - } - else - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - else - npc.localAI[0] = 1f; - - npc.velocity.X += 0.08f; - } - - npc.EncourageDespawn(10); - } - else if (npc.ai[0] == -1f) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - float num646 = npc.ai[1]; - int num647; - do - { - num647 = Main.rand.Next(3); - switch (num647) - { - case 1: - num647 = 2; - break; - case 2: - num647 = 3; - break; - } - } - while ((float)num647 == num646); - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.ai[0] = num647; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[0] == 0f) - { - // Charging distance from player - int chargeDistanceX = Main.masterMode ? 425 : 600; - if (Main.expertMode) - { - int chargeDistanceReduction = Main.masterMode ? 25 : 50; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - chargeDistanceX -= chargeDistanceReduction * 6; - else if ((double)npc.life < (double)npc.lifeMax * 0.25) - chargeDistanceX -= chargeDistanceReduction * 3; - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - chargeDistanceX -= chargeDistanceReduction * 2; - else if ((double)npc.life < (double)npc.lifeMax * 0.75) - chargeDistanceX -= chargeDistanceReduction; - } - chargeDistanceX -= (int)(100f * num644); - - int num648 = Main.masterMode ? 1 : 2; - if (Main.expertMode) - { - if (npc.life < npc.lifeMax / 2 && !Main.masterMode) - num648++; - - if (npc.life < npc.lifeMax / 3) - num648++; - - if (npc.life < npc.lifeMax / 5) - num648++; - } - - num648 += (int)(1f * num644); - if (npc.ai[1] > (float)(2 * num648) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - - if (npc.ai[1] % 2f == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float chargeDistanceY = 20f; - chargeDistanceY += 20f * num644; - - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); - if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) - { - // Set damage - npc.damage = npc.defDamage; - - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - npc.netUpdate = true; - float num650 = 12f; - if (Main.expertMode) - { - num650 = Main.masterMode ? 20f : 16f; - float chargeVelocityIncrease = Main.masterMode ? 1.5f : 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num650 += chargeVelocityIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num650 += chargeVelocityIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num650 += chargeVelocityIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num650 += chargeVelocityIncrease; - } - - num650 += 7f * num644; - Vector2 vector82 = npc.Center; - float num651 = Main.player[npc.target].Center.X - vector82.X; - float num652 = Main.player[npc.target].Center.Y - vector82.Y; - float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); - num653 = num650 / num653; - npc.velocity.X = num651 * num653; - npc.velocity.Y = num652 * num653; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - SoundEngine.PlaySound(SoundID.Zombie125, npc.Center); - - return false; - } - - npc.localAI[0] = 0f; - float num654 = Main.masterMode ? 16f : 12f; - float num655 = Main.masterMode ? 0.3f : 0.15f; - if (Main.expertMode) - { - float chargeLineUpVelocityIncrease = Main.masterMode ? 0.5f : 1f; - float chargeLineUpAccelerationIncrease = Main.masterMode ? 0.025f : 0.05f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num654 += chargeLineUpVelocityIncrease; - num655 += chargeLineUpAccelerationIncrease; - } - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num654 += chargeLineUpVelocityIncrease; - num655 += chargeLineUpAccelerationIncrease; - } - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num654 += chargeLineUpVelocityIncrease * 2f; - num655 += chargeLineUpAccelerationIncrease; - } - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num654 += chargeLineUpVelocityIncrease * 2f; - num655 += chargeLineUpAccelerationIncrease * 2f; - } - } - - num654 += 3f * num644; - num655 += 0.5f * num644; - - // Velocity calculations - if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY) - npc.velocity.Y += num655; - else if (npc.Center.Y > Main.player[npc.target].Center.Y + chargeDistanceY) - npc.velocity.Y -= num655; - else - npc.velocity.Y *= 0.7f; - - if (npc.velocity.Y < -num654) - npc.velocity.Y = -num654; - if (npc.velocity.Y > num654) - npc.velocity.Y = num654; - - float distanceXMax = 100f; - float distanceXMin = 20f; - if (distanceFromTargetX > chargeDistanceX + distanceXMax) - npc.velocity.X += 0.15f * npc.direction; - else if (distanceFromTargetX < chargeDistanceX + distanceXMin) - npc.velocity.X -= 0.15f * npc.direction; - else - npc.velocity.X *= 0.7f; - - if (npc.velocity.X < -16f) - npc.velocity.X = -16f; - if (npc.velocity.X > 16f) - npc.velocity.X = 16f; - - // Face the correct direction - float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation2 < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - return false; - } - - // Set damage - npc.damage = npc.defDamage; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - int num657 = 1; - if (npc.Center.X < Main.player[npc.target].Center.X) - num657 = -1; - - bool flag34 = false; - if (npc.direction == num657 && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > (float)chargeDistanceX) - { - npc.ai[2] = 1f; - flag34 = true; - } - - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)chargeDistanceX * 1.5f) - { - npc.ai[2] = 1f; - flag34 = true; - } - - if (num644 > 0f && flag34) - npc.velocity *= 0.5f; - - if (npc.ai[2] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.localAI[0] = 0f; - - npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); - float num658 = Main.masterMode ? 0.2f : 0.1f; - if (Main.expertMode) - { - float velocityMultiplier = Main.masterMode ? 0.925f : 0.9f; - float velocityGateValueIncrease = Main.masterMode ? 0.025f : 0.05f; - if (npc.life < npc.lifeMax / 2) - { - npc.velocity *= velocityMultiplier; - num658 += velocityGateValueIncrease; - } - - if (npc.life < npc.lifeMax / 3) - { - npc.velocity *= velocityMultiplier; - num658 += velocityGateValueIncrease; - } - - if (npc.life < npc.lifeMax / 5) - { - npc.velocity *= velocityMultiplier; - num658 += velocityGateValueIncrease; - } - } - - if (num644 > 0f) - npc.velocity *= 0.7f; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num658) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - npc.netUpdate = true; - } - } - else - npc.localAI[0] = 1f; - } - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float num659 = Main.masterMode ? 14f : 12f; - float num660 = 0.14f; - if (Main.expertMode) - num660 = Main.masterMode ? 0.3f : 0.2f; - - bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - float distanceAboveTarget = !canHitTarget ? 0f : 320f; - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget; - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num659; - - if (Vector2.Distance(npc.Center, hoverDestination) < 200f && canHitTarget) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return false; - } - - npc.SimpleFlyMovement(idealVelocity, num660); - } - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.localAI[0] = 0f; - - float num672 = Main.masterMode ? 16f : 14f; - float num673 = Main.masterMode ? 0.15f : 0.1f; - - Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); - bool canHitTarget = Collision.CanHit(beeSpawnCollisionLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 320f); - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num672; - - npc.ai[1] += (Main.masterMode ? 2f : 1f); - if (Main.expertMode) - { - int num667 = 0; - for (int num668 = 0; num668 < Main.maxPlayers; num668++) - { - if (Main.player[num668].active && !Main.player[num668].dead && (npc.Center - Main.player[num668].Center).Length() < 1000f) - num667++; - } - - npc.ai[1] += num667 / 2; - float beeTimerIncrease = Main.masterMode ? 0.125f : 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - npc.ai[1] += beeTimerIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - npc.ai[1] += beeTimerIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - npc.ai[1] += beeTimerIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - npc.ai[1] += beeTimerIncrease; - } - - bool flag35 = false; - int num669 = (int)(40f - 18f * num644); - if (npc.ai[1] > (float)num669) - { - npc.ai[1] = 0f; - npc.ai[2]++; - flag35 = true; - } - - if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag35) - { - SoundEngine.PlaySound(SoundID.NPCHit18, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num670 = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); - int num671 = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, num670); - Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - Main.npc[num671].velocity = beeVelocity; - Main.npc[num671].velocity *= 5f; - Main.npc[num671].CanBeReplacedByOtherNPCs = true; - Main.npc[num671].localAI[0] = 60f; - Main.npc[num671].netUpdate = true; - } - } - - // Velocity calculations if target is too far away - if (Vector2.Distance(beeSpawnLocation, hoverDestination) > 400f || !canHitTarget) - npc.SimpleFlyMovement(idealVelocity, num673); - else - npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float maxBees = Main.masterMode ? 8f : 5f; - if (npc.ai[2] > maxBees) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float num674 = 12f; - float num675 = 0.1f; - if (Main.expertMode) - { - num675 = Main.masterMode ? 0.2f : 0.15f; - num674 = Main.masterMode ? 16f : 14f; - } - num675 += 0.2f * num644; - num674 += 6f * num644; - - Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 300f); - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num674; - - npc.ai[1] += 1f; - int num679 = 40; - if (Main.masterMode) - num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 10 : ((npc.life < npc.lifeMax / 3) ? 15 : ((npc.life >= npc.lifeMax / 2) ? 25 : 20))); - else if (Main.expertMode) - num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 15 : ((npc.life < npc.lifeMax / 3) ? 25 : ((npc.life >= npc.lifeMax / 2) ? 35 : 30))); - - num679 -= (int)((Main.masterMode ? 3f : 5f) * num644); - if (npc.ai[1] % (float)num679 == (float)(num679 - 1) && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - SoundEngine.PlaySound(SoundID.Item17, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num680 = Main.masterMode ? 11f : 8f; - float stingerVelocityIncrease = Main.masterMode ? 1f : 2f; - if (Main.expertMode) - num680 += stingerVelocityIncrease; - - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * 0.1) - num680 += stingerVelocityIncrease * 1.5f; - - num680 += 7f * num644; - int num681 = (int)(12f - 5f * num644); - int num682 = (int)(6f - 2f * num644); - if (num681 < 1) - num681 = 1; - - if (num682 < 1) - num682 = 1; - - float num683 = Main.player[npc.target].Center.X - stingerSpawnLocation.X + (float)Main.rand.Next(-num681, num681 + 1); - float num684 = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y + (float)Main.rand.Next(-num682, num682 + 1); - float num685 = (float)Math.Sqrt(num683 * num683 + num684 * num684); - num685 = num680 / num685; - num683 *= num685; - num684 *= num685; - int type = ProjectileID.QueenBeeStinger; - int num688 = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation.X, stingerSpawnLocation.Y, num683, num684, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - Main.projectile[num688].timeLeft = 300; - } - } - - if (Vector2.Distance(stingerSpawnLocation, hoverDestination) > 40f || !canHitTarget) - npc.SimpleFlyMovement(idealVelocity, num675); - - float num689 = Main.masterMode ? 16f : 20f; - num689 -= 5f * num644; - if (npc.ai[1] > (float)num679 * num689) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.localAI[0] = 1f; - float num690 = 14f; - float num691 = 14f; - Vector2 vector88 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - vector88 *= num690; - npc.velocity = (npc.velocity * num691 + vector88) / (num691 + 1f); - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - if (num645 < 2000f) - { - npc.ai[0] = -1f; - npc.localAI[0] = 0f; - } - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index eff4496eba..347925e93e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -918,741 +918,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaQueenSlimeAI(NPC npc, Mod mod) - { - float num3 = 1f; - bool flag = false; - bool flag2 = npc.life <= npc.lifeMax / 2; - if (npc.localAI[0] == 0f) - { - npc.ai[1] = -100f; - npc.localAI[0] = npc.lifeMax; - - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - - Lighting.AddLight(npc.Center, 1f, 0.7f, 0.9f); - int num4 = 500; - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4) - { - CalamityUtils.CalamityTargeting(npc, default); - - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4) - { - npc.EncourageDespawn(10); - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - } - } - - if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !flag2 && npc.ai[3] >= 300f && npc.ai[0] == 0f && npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 2f; - npc.ai[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.netUpdate = true; - - CalamityTargetingParameters options = CalamityTargetingParameters.Defaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector = Main.player[npc.target].Center - npc.Center; - int num5 = 10; - int num6 = 0; - int num7 = 7; - int num8 = 0; - bool flag3 = false; - if (npc.ai[3] >= 360f || vector.Length() > 2000f) - { - if (npc.ai[3] > 360f) - npc.ai[3] = 360f; - - flag3 = true; - num8 = 100; - } - - while (!flag3 && num8 < 100) - { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y + 1); - if ((num10 >= point2.Y - num7 && num10 <= point2.Y + num7 && num9 >= point2.X - num7 && num9 <= point2.X + num7) || (num10 >= point.Y - num6 && num10 <= point.Y + num6 && num9 >= point.X - num6 && num9 <= point.X + num6) || Main.tile[num9, num10].HasUnactuatedTile) - continue; - - int num11 = num10; - int i = 0; - if (Main.tile[num9, num11].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num11].TileType] && !Main.tileSolidTop[Main.tile[num9, num11].TileType]) - { - i = 1; - } - else - { - for (; i < 150 && num11 + i < Main.maxTilesY; i++) - { - int num12 = num11 + i; - if (Main.tile[num9, num12].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num12].TileType] && !Main.tileSolidTop[Main.tile[num9, num12].TileType]) - { - i--; - break; - } - } - } - - num10 += i; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - - if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - flag4 = false; - - if (flag4) - { - npc.localAI[1] = num9 * 16 + 8; - npc.localAI[2] = num10 * 16 + 16; - flag3 = true; - break; - } - } - - if (num8 >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - npc.ai[3] = 0f; - } - } - } - - if (!flag2 && (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f)) - { - npc.ai[3] += (Main.masterMode ? 3f : Main.expertMode ? 2f : 1.5f); - } - else - { - float num13 = npc.ai[3]; - npc.ai[3] -= 1f; - if (npc.ai[3] < 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient && num13 > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - - if (npc.timeLeft <= 10 && ((flag2 && npc.ai[0] != 0f) || (!flag2 && npc.ai[0] != 3f))) - { - if (flag2) - npc.ai[0] = 0f; - else - npc.ai[0] = 3f; - - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - npc.noTileCollide = false; - npc.noGravity = false; - if (flag2) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 24f) - npc.localAI[3] = 0f; - - if (npc.ai[0] == 4f && npc.ai[2] == 1f) - npc.localAI[3] = 6f; - - if (npc.ai[0] == 5f && npc.ai[2] != 1f) - npc.localAI[3] = 7f; - } - - switch ((int)npc.ai[0]) - { - case 0: - { - // Avoid cheap bullshit - npc.damage = 0; - - if (flag2) - { - QueenSlime_FlyMovement_Vanilla(npc); - } - else - { - npc.noTileCollide = false; - npc.noGravity = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - } - - if (npc.timeLeft <= 10 || (!flag2 && npc.velocity.Y != 0f)) - break; - - npc.ai[1] += 1f; - int num18 = 60; - if (flag2) - num18 = 120; - if (Main.masterMode) - num18 /= 2; - - if (!(npc.ai[1] > (float)num18)) - break; - - npc.ai[1] = 0f; - if (flag2) - { - Player player = Main.player[npc.target]; - int num19 = Main.rand.Next(2); - if (num19 != 1) - npc.ai[0] = 4f; - else - npc.ai[0] = 5f; - - if (npc.ai[0] == 4f) - { - npc.ai[2] = 1f; - if (player != null && player.active && !player.dead && (player.Bottom.Y < npc.Bottom.Y || Math.Abs(player.Center.X - npc.Center.X) > 250f)) - { - npc.ai[0] = 5f; - npc.ai[2] = 0f; - } - } - } - else - { - switch (Main.rand.Next(3)) - { - default: - npc.ai[0] = 3f; - break; - case 1: - npc.ai[0] = 4f; - break; - case 2: - npc.ai[0] = 5f; - break; - } - } - - npc.netUpdate = true; - break; - } - - case 1: - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = 0f; - npc.ai[1] += (Main.masterMode ? 2f : 1f); - num3 = MathHelper.Clamp(npc.ai[1] / 30f, 0f, 1f); - num3 = 0.5f + num3 * 0.5f; - if (npc.ai[1] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 60f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - - CalamityUtils.CalamityTargeting(npc, default); - } - - Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); - newColor2.A = 150; - for (int num27 = 0; num27 < 10; num27++) - { - int num28 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); - Main.dust[num28].noGravity = true; - Main.dust[num28].velocity *= 2f; - } - - break; - } - - case 2: - - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = 0f; - npc.ai[1] += (Main.masterMode ? 2f : 1f); - num3 = MathHelper.Clamp((60f - npc.ai[1]) / 60f, 0f, 1f); - num3 = 0.5f + num3 * 0.5f; - - if (npc.ai[1] >= 60f) - flag = true; - - if (npc.ai[1] == 60f) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown); - - if (Main.masterMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num14 = 10; - if (Main.getGoodWorld) - num14 = 15; - - float gelVelocity = 12f; - int type = ProjectileID.QueenSlimeGelAttack; - for (int j = 0; j < num14; j++) - { - Vector2 spinningpoint = new Vector2(gelVelocity, 0f); - spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - SoundEngine.PlaySound(SoundID.Item155, npc.Center); - } - } - - if (npc.ai[1] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 120f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - - if (!flag) - { - Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); - newColor.A = 150; - for (int n = 0; n < 10; n++) - { - int num26 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); - Main.dust[num26].noGravity = true; - Main.dust[num26].velocity *= 0.5f; - } - } - break; - - case 3: - npc.rotation = 0f; - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - npc.ai[1] += 4f; - if ((double)npc.life < (double)npc.lifeMax * 0.8) - npc.ai[1] += 4f; - - if ((double)npc.life < (double)npc.lifeMax * 0.6) - npc.ai[1] += 4f; - - if (!(npc.ai[1] >= 0f)) - break; - - // Set damage - npc.damage = npc.defDamage; - - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - - if (npc.ai[2] == 3f) - { - npc.velocity.Y = -13f; - npc.velocity.X += 3.5f * (float)npc.direction; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - if (npc.timeLeft > 10) - npc.ai[0] = 0f; - else - npc.ai[1] = -60f; - } - else if (npc.ai[2] == 2f) - { - npc.velocity.Y = -6f; - npc.velocity.X += 4.5f * (float)npc.direction; - npc.ai[1] = -40f; - npc.ai[2] += 1f; - } - else - { - npc.velocity.Y = -8f; - npc.velocity.X += 4f * (float)npc.direction; - npc.ai[1] = -40f; - npc.ai[2] += 1f; - } - - if (Main.expertMode) - { - npc.velocity.X *= 1.5f; - npc.velocity.Y *= 1.25f; - } - - if (Main.masterMode) - { - npc.velocity.X *= 1.3f; - npc.velocity.Y *= 1.1f; - } - } - else - { - if (npc.target >= Main.maxPlayers) - break; - - float num20 = Main.masterMode ? 5f : 3f; - if (Main.getGoodWorld) - num20 = 7f; - - if ((npc.direction == 1 && npc.velocity.X < num20) || (npc.direction == -1 && npc.velocity.X > 0f - num20)) - { - if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - npc.velocity.X += 0.2f * (float)npc.direction; - else - npc.velocity.X *= 0.93f; - } - } - break; - - case 4: - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation *= 0.9f; - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.ai[2] == 1f) - { - npc.noTileCollide = false; - npc.noGravity = false; - int num21 = 30; - if (flag2) - num21 = 10; - - if (Main.getGoodWorld) - num21 = 0; - - Player player2 = Main.player[npc.target]; - if (npc.velocity.Y == 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - SoundEngine.PlaySound(SoundID.Item167, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.QueenSlimeSmash; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - - if (Main.masterMode) - { - float expandDelay = 0f; - int maxSmashes = 10; - float maxSmashOffset = maxSmashes * 100f; - Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * maxSmashOffset; - int maxSmashesPerSide = maxSmashes / 2; - float maxExpandDelay = 20f * maxSmashesPerSide; - float smashSpawnDistanceOffset = 200f; - for (int i = 0; i < maxSmashes + 1; i++) - { - expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); - if (i != maxSmashesPerSide) - Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -expandDelay); - - extraSmashPosition -= Vector2.UnitX * smashSpawnDistanceOffset; - } - } - } - - for (int l = 0; l < 20; l++) - { - int num22 = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); - Main.dust[num22].noGravity = true; - Main.dust[num22].velocity.Y = -5f + Main.rand.NextFloat() * -3f; - Main.dust[num22].velocity.X *= 7f; - } - } - else if (npc.ai[1] >= (float)num21) - { - for (int m = 0; m < 4; m++) - { - Vector2 vector3 = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8)); - int num23 = Dust.NewDust(vector3, 2, 2, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); - Main.dust[num23].position = vector3; - Main.dust[num23].noGravity = true; - Main.dust[num23].velocity.Y = npc.velocity.Y * 0.9f; - Main.dust[num23].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; - } - } - - npc.velocity.X *= 0.8f; - float num24 = npc.ai[1]; - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)num21) - { - if (num24 < (float)num21) - npc.netUpdate = true; - - if (flag2 && npc.ai[1] > (float)(num21 + 120)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity.Y *= 0.8f; - npc.netUpdate = true; - break; - } - - // Set damage - npc.damage = npc.defDamage; - - npc.velocity.Y += 1f; - float num25 = 14f; - if (Main.getGoodWorld) - { - npc.velocity.Y += 1f; - num25 = 15.99f; - } - - if (npc.velocity.Y == 0f) - npc.velocity.Y = 0.01f; - - if (npc.velocity.Y >= num25) - npc.velocity.Y = num25; - } - else - npc.velocity.Y *= 0.8f; - - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) - { - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 30f)) - break; - - if (npc.ai[1] >= 60f) - { - npc.ai[1] = 60f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - } - - Player player3 = Main.player[npc.target]; - Vector2 center = npc.Center; - if (!player3.dead && player3.active && Math.Abs(npc.Center.X - player3.Center.X) / 16f <= (float)num4) - center = player3.Center; - - center.Y -= 384f; - if (npc.velocity.Y == 0f) - { - npc.velocity = center - npc.Center; - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= (Main.masterMode ? 28f : Main.expertMode ? 24f : 20f); - } - else - npc.velocity.Y *= 0.95f; - - break; - } - - case 5: - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation *= 0.9f; - npc.noTileCollide = true; - npc.noGravity = true; - if (flag2) - npc.ai[3] = 0f; - - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 10f)) - break; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num14 = 10; - if (Main.getGoodWorld) - num14 = 15; - - int num15 = num14; - if (!flag2) - num15 = 6; - - int type = ProjectileID.QueenSlimeGelAttack; - for (int j = 0; j < num15; j++) - { - Vector2 spinningpoint = new Vector2(Main.masterMode ? 10.5f : 9f, 0f); - spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) - { - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 50f) - { - npc.ai[1] = 50f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.netUpdate = true; - } - } - - float num16 = 100f; - for (int k = 0; k < 4; k++) - { - Vector2 vector2 = npc.Center + Main.rand.NextVector2CircularEdge(num16, num16); - if (!flag2) - vector2 += new Vector2(0f, 20f); - - Vector2 v = vector2 - npc.Center; - v = v.SafeNormalize(Vector2.Zero) * -8f; - int num17 = Dust.NewDust(vector2, 2, 2, DustID.Smoke, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); - Main.dust[num17].position = vector2; - Main.dust[num17].noGravity = true; - Main.dust[num17].alpha = 250; - Main.dust[num17].velocity = v; - Main.dust[num17].customData = npc; - } - - if (flag2) - QueenSlime_FlyMovement_Vanilla(npc); - - break; - } - } - - npc.dontTakeDamage = (npc.hide = flag); - if (num3 != npc.scale) - { - npc.position.X += npc.width / 2; - npc.position.Y += npc.height; - npc.scale = num3; - npc.width = (int)(114f * npc.scale); - npc.height = (int)(100f * npc.scale); - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height; - } - - if (npc.life <= 0) - return false; - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - if (npc.localAI[0] >= (float)(npc.lifeMax / 2) && npc.life < npc.lifeMax / 2) - { - npc.localAI[0] = npc.life; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - int num29 = (int)((float)npc.lifeMax * 0.02f); - if (flag2) - num29 = (int)((float)npc.lifeMax * 0.015f); - - if (!((float)(npc.life + num29) < npc.localAI[0])) - return false; - - npc.localAI[0] = npc.life; - int num30 = Main.rand.Next(Main.masterMode ? 2 : 1, Main.masterMode ? 4 : 3); - for (int num31 = 0; num31 < num30; num31++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num32 = NPCID.QueenSlimeMinionBlue; - switch (Main.rand.Next(3)) - { - case 0: - num32 = NPCID.QueenSlimeMinionBlue; - break; - case 1: - num32 = NPCID.QueenSlimeMinionPink; - break; - case 2: - num32 = NPCID.QueenSlimeMinionPurple; - break; - } - - int num33 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num32); - Main.npc[num33].SetDefaults(num32); - Main.npc[num33].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num33].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num33].ai[0] = -500 * Main.rand.Next(3); - Main.npc[num33].ai[1] = 0f; - if (Main.dedServ && num33 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num33); - } - - return false; - } - public static void QueenSlime_FlyMovement(NPC npc) { // Difficulty bools @@ -1726,75 +991,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = -0.5f; } - public static void QueenSlime_FlyMovement_Vanilla(NPC npc) + public static bool BuffedQueenSlimeCrystalSlimeAI(NPC npc, Mod mod) { - npc.noTileCollide = true; - npc.noGravity = true; - float num = Main.masterMode ? 18f : Main.expertMode ? 15f : 12f; - float num2 = Main.masterMode ? 0.12f : Main.expertMode ? 0.1f : 0.085f; - float num3 = 250f; - Vector2 desiredVelocity = npc.Center; - if (npc.timeLeft > 10) - { - if (!Collision.CanHit(npc, Main.player[npc.target])) - { - bool flag = false; - Vector2 center = Main.player[npc.target].Center; - for (int i = 0; i < 16; i++) - { - float num4 = 16 * i; - Point point = (center + new Vector2(0f, 0f - num4)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) - { - desiredVelocity = center + new Vector2(0f, 0f - num4 + 16f) - npc.Center; - flag = true; - break; - } - } + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (!flag) - desiredVelocity = center - npc.Center; - } - else - desiredVelocity = Main.player[npc.target].Center + new Vector2(0f, 0f - num3) - npc.Center; - } - else - desiredVelocity = npc.Center + new Vector2(500f * (float)npc.direction, 0f - num3) - npc.Center; - - float num5 = desiredVelocity.Length(); - if (Math.Abs(desiredVelocity.X) < 40f) - desiredVelocity.X = npc.velocity.X; - - float num6 = num - 2f; - if (num5 > 100f && ((npc.velocity.X < 0f - num6 && desiredVelocity.X > 0f) || (npc.velocity.X > num6 && desiredVelocity.X < 0f))) - num2 *= 2f; - - if (num5 < 40f) - { - desiredVelocity = npc.velocity; - } - else if (num5 < 80f) - { - desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); - desiredVelocity *= num * 0.65f; - } - else - { - desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); - desiredVelocity *= num; - } - - npc.SimpleFlyMovement(desiredVelocity, num2); - npc.rotation = npc.velocity.X * 0.1f; - if (npc.rotation > 0.5f) - npc.rotation = 0.5f; - - if (npc.rotation < -0.5f) - npc.rotation = -0.5f; - } - - public static bool QueenSlimeCrystalSlimeAI(NPC npc, Mod mod) - { if (npc.localAI[0] > 0f) npc.localAI[0] -= 1f; @@ -1827,7 +1027,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses vector6 *= 1.5f; int type = ProjectileID.QueenSlimeMinionBlueSpike; - Projectile.NewProjectile(npc.GetSource_FromAI(), center, vector6 * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f), type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), center, vector6 * (death ? 0.8f : 0.5f), type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); npc.localAI[0] = 25f; if (num22 > 4) break; @@ -1856,7 +1056,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num20 *= num21; npc.localAI[0] = 50f; int type = ProjectileID.QueenSlimeMinionBlueSpike; - Vector2 spikeVelocity = new Vector2(num19, num20) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); + Vector2 spikeVelocity = new Vector2(num19, num20) * (death ? 0.8f : 0.5f); Projectile.NewProjectile(npc.GetSource_FromAI(), center, spikeVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); } } @@ -1914,7 +1114,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; - npc.ai[0] += (Main.masterMode ? 16f : Main.expertMode ? 10f : 7f); + npc.ai[0] += (death ? 16f : Main.expertMode ? 10f : 7f); float num33 = -1000f; @@ -1937,14 +1137,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (num34 == 3) { npc.velocity.Y = -8f; - npc.velocity.X += (Main.masterMode ? 9 : Main.expertMode ? 6 : 3) * npc.direction; + npc.velocity.X += (death ? 9 : Main.expertMode ? 6 : 3) * npc.direction; npc.ai[0] = -200f; npc.ai[3] = npc.position.X; } else { npc.velocity.Y = -6f; - npc.velocity.X += (Main.masterMode ? 6 : Main.expertMode ? 4 : 2) * npc.direction; + npc.velocity.X += (death ? 6 : Main.expertMode ? 4 : 2) * npc.direction; npc.ai[0] = -120f; if (num34 == 1) npc.ai[0] += num33; @@ -1972,8 +1172,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool QueenSlimeBouncySlimeAI(NPC npc, Mod mod) + public static bool BuffedQueenSlimeBouncySlimeAI(NPC npc, Mod mod) { + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + if (npc.localAI[0] > 0f) npc.localAI[0] -= 1f; @@ -2009,7 +1211,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 30f; int type = ProjectileID.QueenSlimeMinionPinkBall; - Vector2 pinkBallVelocity = new Vector2(num24, num25) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); + Vector2 pinkBallVelocity = new Vector2(num24, num25) * (death ? 0.8f : 0.5f); Projectile.NewProjectile(npc.GetSource_FromAI(), center2, pinkBallVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); } } @@ -2067,7 +1269,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; - npc.ai[0] += (Main.masterMode ? 11f : Main.expertMode ? 7f : 5f); + npc.ai[0] += (death ? 11f : Main.expertMode ? 7f : 5f); float num33 = -500f; @@ -2090,14 +1292,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (num34 == 3) { npc.velocity.Y = -8f; - npc.velocity.X += (Main.masterMode ? 9 : Main.expertMode ? 6 : 3) * npc.direction; + npc.velocity.X += (death ? 9 : Main.expertMode ? 6 : 3) * npc.direction; npc.ai[0] = -200f; npc.ai[3] = npc.position.X; } else { npc.velocity.Y = -6f; - npc.velocity.X += (Main.masterMode ? 6 : Main.expertMode ? 4 : 2) * npc.direction; + npc.velocity.X += (death ? 6 : Main.expertMode ? 4 : 2) * npc.direction; npc.ai[0] = -120f; if (num34 == 1) npc.ai[0] += num33; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 7634c94155..fb166011a6 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -1211,605 +1211,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } } - - public static bool VanillaSkeletronAI(NPC npc, Mod mod) - { - npc.reflectsProjectiles = false; - npc.defense = npc.defDefense; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 1f; - int num148 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num148].ai[0] = -1f; - Main.npc[num148].ai[1] = npc.whoAmI; - Main.npc[num148].target = npc.target; - Main.npc[num148].netUpdate = true; - num148 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num148].ai[0] = 1f; - Main.npc[num148].ai[1] = npc.whoAmI; - Main.npc[num148].ai[3] = 150f; - Main.npc[num148].target = npc.target; - Main.npc[num148].netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - npc.ai[1] = 3f; - } - - if (Main.IsItDay() && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - int numHands = 0; - int maxHands = 2; - if (Main.expertMode) - { - for (int num150 = 0; num150 < Main.maxNPCs; num150++) - { - if (Main.npc[num150].active && Main.npc[num150].type == NPCID.SkeletronHand) - numHands++; - } - - npc.defense += numHands * (Main.masterMode ? 15 : 10); - npc.Calamity().CurrentlyIncreasingDefenseOrDR = numHands > 0; - npc.chaseable = numHands == 0; - if ((numHands < maxHands || (double)npc.life < (double)npc.lifeMax * 0.75 || Main.masterMode) && npc.ai[1] == 0f) - { - float num151 = 80f; - if (numHands == 0 || Main.masterMode) - num151 /= 2f; - - if (Main.getGoodWorld) - num151 *= 0.8f; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % num151 == 0f) - { - Vector2 center3 = npc.Center; - float num152 = Main.player[npc.target].Center.X - center3.X; - float num153 = Main.player[npc.target].Center.Y - center3.Y; - float num154 = (float)Math.Sqrt(num152 * num152 + num153 * num153); - if (Collision.CanHit(center3, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num155 = 3f; - if (numHands == 0 || Main.masterMode) - num155 += 2f; - - float num156 = Main.player[npc.target].Center.X - center3.X + (float)Main.rand.Next(-5, 6); - float num157 = Main.player[npc.target].Center.Y - center3.Y + (float)Main.rand.Next(-5, 6); - float num158 = (float)Math.Sqrt(num156 * num156 + num157 * num157); - num158 = num155 / num158; - num156 *= num158; - num157 *= num158; - Vector2 vector19 = new Vector2(num156 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num157 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); - vector19 *= num155; - vector19 += npc.velocity; - num156 = vector19.X; - num157 = vector19.Y; - int type = ProjectileID.Skull; - center3 += vector19 * 5f; - int num160 = Projectile.NewProjectile(npc.GetSource_FromAI(), center3.X, center3.Y, num156, num157, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -1f); - Main.projectile[num160].timeLeft = 300; - } - } - } - } - - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - float chargeGateValue = Main.masterMode ? (600f - (maxHands - numHands) * 200f) : 800f; - if (npc.ai[2] >= chargeGateValue) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - - npc.rotation = npc.velocity.X / 15f; - float accelerationY = Main.getGoodWorld ? 0.05f : Main.masterMode ? 0.04f : Main.expertMode ? 0.03f : 0.02f; - float maxVelocityY = accelerationY * 100f; - float accelerationX = Main.getGoodWorld ? 0.093f : Main.masterMode ? 0.088f : Main.expertMode ? 0.076f : 0.064f; - float maxVelocityX = accelerationX * 100f; - float deceleration = Main.getGoodWorld ? 0.83f : Main.masterMode ? 0.86f : Main.expertMode ? 0.89f : 0.92f; - - if (npc.position.Y > Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.player[npc.target].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.player[npc.target].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < 0f - maxVelocityX) - npc.velocity.X = 0f - maxVelocityX; - } - } - else if (npc.ai[1] == 1f) - { - if (Main.getGoodWorld) - { - if (numHands > 0) - { - npc.reflectsProjectiles = true; - } - else if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 200f == 0f && NPC.CountNPCS(NPCID.DarkCaster) < 6) - { - int num165 = 1; - for (int num166 = 0; num166 < num165; num166++) - { - int num167 = 1000; - for (int num168 = 0; num168 < num167; num168++) - { - int num169 = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int num170; - for (num170 = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) - { - } - - num170--; - if (!WorldGen.SolidTile(num169, num170)) - { - int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DarkCaster); - if (Main.dedServ && num171 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); - - break; - } - } - } - } - } - - npc.defense -= 10; - npc.ai[2] += 1f; - if (npc.ai[2] == 2f) - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - - float idlePhaseGateValue = Main.masterMode ? (300f - (maxHands - numHands) * 100f) : 400f; - if (npc.ai[2] >= idlePhaseGateValue) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector20 = npc.Center; - float num172 = Main.player[npc.target].Center.X - vector20.X; - float num173 = Main.player[npc.target].Center.Y - vector20.Y; - float num174 = (float)Math.Sqrt(num172 * num172 + num173 * num173); - float num175 = 3f; - npc.damage = (int)Math.Round(npc.defDamage * 1.3); - if (Main.expertMode) - { - num175 = Main.masterMode ? (5f - numHands * 0.5f) : 3.5f; - if (num174 > 150f) - num175 *= 1.05f; - - if (num174 > 200f) - num175 *= 1.1f; - - if (num174 > 250f) - num175 *= 1.1f; - - if (num174 > 300f) - num175 *= 1.1f; - - if (num174 > 350f) - num175 *= 1.1f; - - if (num174 > 400f) - num175 *= 1.1f; - - if (num174 > 450f) - num175 *= 1.1f; - - if (num174 > 500f) - num175 *= 1.1f; - - if (num174 > 550f) - num175 *= 1.1f; - - if (num174 > 600f) - num175 *= 1.1f; - - switch (numHands) - { - case 0: - num175 *= 1.1f; - break; - case 1: - num175 *= 1.05f; - break; - } - } - - if (Main.getGoodWorld) - num175 *= 1.3f; - - num174 = num175 / num174; - npc.velocity.X = num172 * num174; - npc.velocity.Y = num173 * num174; - } - else if (npc.ai[1] == 2f) - { - npc.damage = 1000; - npc.defense = 9999; - - npc.Calamity().CurrentlyEnraged = true; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; - - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector21 = npc.Center; - float num176 = Main.player[npc.target].Center.X - vector21.X; - float num177 = Main.player[npc.target].Center.Y - vector21.Y; - float num178 = (float)Math.Sqrt(num176 * num176 + num177 * num177); - num178 = 8f / num178; - npc.velocity.X = num176 * num178; - npc.velocity.Y = num177 * num178; - } - else if (npc.ai[1] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - npc.EncourageDespawn(50); - } - - if (npc.ai[1] != 2f && npc.ai[1] != 3f && (numHands != 0 || !Main.expertMode)) - { - int num179 = Dust.NewDust(new Vector2(npc.Center.X - 15f - npc.velocity.X * 5f, npc.position.Y + (float)npc.height - 2f), 30, 10, DustID.Blood, (0f - npc.velocity.X) * 0.2f, 3f, 0, default(Color), 2f); - Main.dust[num179].noGravity = true; - Main.dust[num179].velocity.X *= 1.3f; - Main.dust[num179].velocity.X += npc.velocity.X * 0.4f; - Main.dust[num179].velocity.Y += 2f + npc.velocity.Y; - for (int num180 = 0; num180 < 2; num180++) - { - num179 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, DustID.Blood, npc.velocity.X, npc.velocity.Y, 0, default(Color), 2f); - Main.dust[num179].noGravity = true; - Dust dust = Main.dust[num179]; - dust.velocity -= npc.velocity; - Main.dust[num179].velocity.Y += 5f; - } - } - - return false; - } - - public static bool VanillaSkeletronHandAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float accelerationY = Main.getGoodWorld ? 0.1f : Main.masterMode ? 0.09f : Main.expertMode ? 0.08f : 0.07f; - float maxVelocityY = accelerationY * 100f; - float accelerationX = Main.getGoodWorld ? 0.16f : Main.masterMode ? 0.14f : Main.expertMode ? 0.12f : 0.1f; - float maxVelocityX = accelerationX * 100f; - float deceleration = Main.getGoodWorld ? 0.81f : Main.masterMode ? 0.84f : Main.expertMode ? 0.87f : 0.9f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; - } - } - else - { - npc.ai[3] += 1f; - if (Main.expertMode) - npc.ai[3] += 0.5f; - if (Main.masterMode) - npc.ai[3] += 0.5f; - - if (npc.ai[3] >= 300f) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float accelerationY = Main.getGoodWorld ? 0.07f : Main.masterMode ? 0.06f : Main.expertMode ? 0.05f : 0.04f; - float maxVelocityY = accelerationY * 100f; - float accelerationX = Main.getGoodWorld ? 0.13f : Main.masterMode ? 0.11f : Main.expertMode ? 0.09f : 0.07f; - float maxVelocityX = accelerationX * 100f; - float deceleration = Main.getGoodWorld ? 0.88f : Main.masterMode ? 0.9f : Main.expertMode ? 0.92f : 0.94f; - - if (Main.expertMode) - { - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; - } - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; - } - } - - Vector2 vector22 = npc.Center; - float num181 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector22.X; - float num182 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector22.Y; - float num183 = (float)Math.Sqrt(num181 * num181 + num182 * num182); - npc.rotation = (float)Math.Atan2(num182, num181) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - Vector2 vector23 = npc.Center; - float num184 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector23.X; - float num185 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; - float num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185); - npc.rotation = (float)Math.Atan2(num185, num184) + MathHelper.PiOver2; - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.1f; - if (Main.expertMode) - { - npc.velocity.Y -= (Main.masterMode ? 0.09f : 0.06f); - if (npc.velocity.Y < -13f) - npc.velocity.Y = -13f; - } - else if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 2f; - vector23 = npc.Center; - num184 = Main.player[npc.target].Center.X - vector23.X; - num185 = Main.player[npc.target].Center.Y - vector23.Y; - num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185); - num186 = ((!Main.expertMode) ? (18f / num186) : ((Main.masterMode ? 24f : 21f) / num186)); - npc.velocity.X = num184 * num186; - npc.velocity.Y = num185 * num186; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 3f; - } - } - else if (npc.ai[2] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - Vector2 vector24 = npc.Center; - float num187 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector24.X; - float num188 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; - float num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188); - npc.rotation = (float)Math.Atan2(num188, num187) + MathHelper.PiOver2; - npc.velocity.Y *= 0.95f; - npc.velocity.X += 0.1f * (0f - npc.ai[0]); - if (Main.expertMode) - { - npc.velocity.X += (Main.masterMode ? 0.1f : 0.07f) * (0f - npc.ai[0]); - if (npc.velocity.X < -12f) - npc.velocity.X = -12f; - else if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - } - else if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - else if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 5f; - vector24 = npc.Center; - num187 = Main.player[npc.target].Center.X - vector24.X; - num188 = Main.player[npc.target].Center.Y - vector24.Y; - num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188); - num189 = ((!Main.expertMode) ? (17f / num189) : ((Main.masterMode ? 25f : 22f) / num189)); - npc.velocity.X = num187 * num189; - npc.velocity.Y = num188 * num189; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 0f; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 8d032b1f72..83d7210b95 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -182,73 +182,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phases bool phase2 = lifeRatio < 0.66f; - bool spawnDestroyer = lifeRatio < 0.75f && death && !bossRush && npc.localAI[2] == 0f; bool phase3 = lifeRatio < 0.33f; - bool spawnRetinazer = lifeRatio < 0.5f && death && !bossRush && npc.localAI[2] == 1f; - - // Spawn The Destroyer in Master Mode (just like Oblivion from Avalon) - if (spawnDestroyer) - { - Player destroyerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; - SoundEngine.PlaySound(SoundID.Roar, destroyerSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int destroyer = NPC.NewNPC(NPC.GetBossSpawnSource(destroyerSpawnPlayer.whoAmI), (int)destroyerSpawnPlayer.Center.X, (int)destroyerSpawnPlayer.Center.Y + 810, NPCID.TheDestroyer, 1); - if (destroyer != Main.maxNPCs) - { - Main.npc[destroyer].target = destroyerSpawnPlayer.whoAmI; - Main.npc[destroyer].timeLeft *= 20; - Main.npc[destroyer].localAI[3] = 1f; - Main.npc[destroyer].SyncVanillaLocalAI(); - string typeName = Main.npc[destroyer].TypeName; - if (Main.dedServ && destroyer < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, destroyer); - - AchievementsHelper.CheckMechaMayhem(); - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[destroyer].GetTypeNetName()), new Color(175, 75, 255)); - } - } - - npc.localAI[2] = 1f; - npc.SyncVanillaLocalAI(); - } - - // Spawn Retinazer in Master Mode (just like Oblivion from Avalon) - if (spawnRetinazer) - { - Player retinazerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; - SoundEngine.PlaySound(SoundID.Roar, retinazerSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int retinazer = NPC.NewNPC(NPC.GetBossSpawnSource(retinazerSpawnPlayer.whoAmI), (int)retinazerSpawnPlayer.Center.X, (int)retinazerSpawnPlayer.Center.Y - 810, NPCID.Retinazer, 1); - if (retinazer != Main.maxNPCs) - { - Main.npc[retinazer].target = retinazerSpawnPlayer.whoAmI; - Main.npc[retinazer].timeLeft *= 20; - Main.npc[retinazer].localAI[3] = 1f; - Main.npc[retinazer].SyncVanillaLocalAI(); - string typeName = Main.npc[retinazer].TypeName; - if (Main.dedServ && retinazer < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazer); - - AchievementsHelper.CheckMechaMayhem(); - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Lang.misc[48].Value, 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, 255)); - } - } - - npc.localAI[2] = 2f; - npc.SyncVanillaLocalAI(); - } // Despawn if (npc.ai[1] != 3f) @@ -288,7 +222,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool immuneToSlowingDebuffs = npc.ai[1] == 5f; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; @@ -2084,1477 +2017,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaSkeletronPrimeAI(NPC npc, Mod mod) - { - npc.defense = npc.defDefense; - if (npc.ai[3] != 0f) - NPC.mechQueen = npc.whoAmI; - - npc.reflectsProjectiles = false; - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.ai[0] = 1f; - int num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI); - Main.npc[num495].ai[0] = -1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].netUpdate = true; - num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); - Main.npc[num495].ai[0] = 1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].netUpdate = true; - num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI); - Main.npc[num495].ai[0] = -1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].ai[3] = 150f; - Main.npc[num495].netUpdate = true; - num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); - Main.npc[num495].ai[0] = 1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].netUpdate = true; - Main.npc[num495].ai[3] = 150f; - } - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - npc.ai[1] = 3f; - } - - if (Main.IsItDay() && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - if (npc.ai[1] == 0f) - { - npc.damage = 0; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (Main.masterMode ? 300f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation = npc.velocity.X / 15f; - - float num496 = 0.1f; - float num497 = 2f; - float num498 = 0.1f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.94f : Main.expertMode ? 0.96f : 0.98f; - int num500 = 200; - int num501 = 500; - float num502 = 0f; - int num503 = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); - if (NPC.IsMechQueenUp) - { - num502 = -450f * (float)num503; - num500 = 300; - num501 = 350; - } - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.05f : 0.03f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.15f : 0.12f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.player[npc.target].position.Y - (float)num500) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - (float)num501) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.player[npc.target].Center.X + 100f + num502) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.player[npc.target].Center.X - 100f + num502) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < 0f - num499) - npc.velocity.X = 0f - num499; - } - } - else if (npc.ai[1] == 1f) - { - npc.defense *= 2; - npc.damage = npc.defDamage * 2; - - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; - - npc.ai[2] += 1f; - if (npc.ai[2] == 2f) - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - - if (npc.ai[2] >= (Main.masterMode ? 300f : 400f)) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation += (float)npc.direction * 0.3f; - - Vector2 vector54 = npc.Center; - float num504 = Main.player[npc.target].Center.X - vector54.X; - float num505 = Main.player[npc.target].Center.Y - vector54.Y; - float num506 = (float)Math.Sqrt(num504 * num504 + num505 * num505); - float num507 = 5f; - if (Main.expertMode) - { - num507 = Main.masterMode ? 7f : 6f; - if (num506 > 150f) - num507 *= (Main.masterMode ? 1.075f : 1.05f); - - float additionalMultiplier = Main.masterMode ? 1.15f : 1.1f; - if (num506 > 200f) - num507 *= additionalMultiplier; - - if (num506 > 250f) - num507 *= additionalMultiplier; - - if (num506 > 300f) - num507 *= additionalMultiplier; - - if (num506 > 350f) - num507 *= additionalMultiplier; - - if (num506 > 400f) - num507 *= additionalMultiplier; - - if (num506 > 450f) - num507 *= additionalMultiplier; - - if (num506 > 500f) - num507 *= additionalMultiplier; - - if (num506 > 550f) - num507 *= additionalMultiplier; - - if (num506 > 600f) - num507 *= additionalMultiplier; - } - - if (NPC.IsMechQueenUp) - { - float num508 = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); - num507 *= num508; - } - - num506 = num507 / num506; - npc.velocity.X = num504 * num506; - npc.velocity.Y = num505 * num506; - if (NPC.IsMechQueenUp) - { - float num509 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (num509 < 0.1f) - num509 = 0f; - - if (num509 < num507) - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * num509; - } - } - else if (npc.ai[1] == 2f) - { - npc.damage = 1000; - npc.defense = 9999; - - npc.Calamity().CurrentlyEnraged = true; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation += (float)npc.direction * 0.3f; - - Vector2 vector55 = npc.Center; - float num510 = Main.player[npc.target].Center.X - vector55.X; - float num511 = Main.player[npc.target].Center.Y - vector55.Y; - float num512 = (float)Math.Sqrt(num510 * num510 + num511 * num511); - float num513 = 10f; - num513 += num512 / 100f; - if (num513 < 8f) - num513 = 8f; - - if (num513 > 32f) - num513 = 32f; - - num512 = num513 / num512; - npc.velocity.X = num510 * num512; - npc.velocity.Y = num511 * num512; - } - else - { - if (npc.ai[1] != 3f) - return false; - - if (NPC.IsMechQueenUp) - { - int num514 = NPC.FindFirstNPC(NPCID.Retinazer); - if (num514 >= 0) - Main.npc[num514].EncourageDespawn(5); - - num514 = NPC.FindFirstNPC(NPCID.Spazmatism); - if (num514 >= 0) - Main.npc[num514].EncourageDespawn(5); - - if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) - { - num514 = NPC.FindFirstNPC(NPCID.TheDestroyer); - if (num514 >= 0) - Main.npc[num514].Transform(NPCID.TheDestroyerTail); - - npc.EncourageDespawn(5); - } - - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - if (npc.velocity.Y > 13f) - npc.velocity.Y = 13f; - } - else - { - npc.EncourageDespawn(500); - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - } - } - - return false; - } - - public static bool VanillaPrimeLaserAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.damage = 0; - - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float num496 = 0.07f; - float num497 = 6f; - float num498 = 0.1f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.11f : 0.09f; - num497 = Main.masterMode ? 8f : 7f; - num498 = Main.masterMode ? 0.15f : 0.12f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - npc.localAI[0] += 3f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 600f : 800f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.1f; - float num497 = 3f; - float num498 = 0.14f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.2f : 0.17f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector68 = npc.Center; - float num559 = Main.player[npc.target].Center.X - vector68.X; - float num560 = Main.player[npc.target].Center.Y - vector68.Y; - float num561 = (float)Math.Sqrt(num559 * num559 + num560 * num560); - npc.rotation = (float)Math.Atan2(num560, num559) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 80f : Main.expertMode ? 140f : 200f)) - { - npc.localAI[0] = 0f; - float num562 = 8f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num561 = num562 / num561; - num559 *= num561; - num560 *= num561; - Vector2 laserVelocity = new Vector2(num559, num560); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector68 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - else - { - if (npc.ai[2] != 1f) - return false; - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 150f : Main.expertMode ? 175f : 200f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector69 = npc.Center; - float num566 = Main.player[npc.target].Center.X - 350f - vector69.X; - float num567 = Main.player[npc.target].Center.Y - 20f - vector69.Y; - float num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567); - num568 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num568; - num566 *= num568; - num567 *= num568; - - float num496 = 0.1f; - float num498 = 0.03f; - float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num498 = Main.masterMode ? 0.05f : 0.04f; - } - - if (npc.velocity.X > num566) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num496; - } - - if (npc.velocity.X < num566) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num496; - } - - if (npc.velocity.Y > num567) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num498; - } - - if (npc.velocity.Y < num567) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num498; - } - - vector69 = npc.Center; - num566 = Main.player[npc.target].Center.X - vector69.X; - num567 = Main.player[npc.target].Center.Y - vector69.Y; - num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567); - npc.rotation = (float)Math.Atan2(num567, num566) - MathHelper.PiOver2; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 40f : Main.expertMode ? 60f : 80f)) - { - npc.localAI[0] = 0f; - float num569 = 10f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num568 = num569 / num568; - num566 *= num568; - num567 *= num568; - Vector2 laserVelocity = new Vector2(num566, num567); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector69 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - - return false; - } - - public static bool VanillaPrimeCannonAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.damage = 0; - - if (npc.ai[2] == 0f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float num496 = 0.07f; - float num497 = 6f; - float num498 = 0.1f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.11f : 0.09f; - num497 = Main.masterMode ? 8f : 7f; - num498 = Main.masterMode ? 0.15f : 0.12f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - npc.localAI[0] += 2f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 700f : Main.expertMode ? 900f : 1100f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.localAI[0] = 0f; - npc.ai[2] = 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.04f; - float num497 = 3f; - float num498 = 0.2f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.06f : 0.05f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.28f : 0.24f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 200f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 160f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector66 = npc.Center; - float num545 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector66.X; - float num546 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector66.Y; - float num547 = (float)Math.Sqrt(num545 * num545 + num546 * num546); - npc.rotation = (float)Math.Atan2(num546, num545) + MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 60f : Main.expertMode ? 100f : 140f)) - { - npc.localAI[0] = 0f; - float num548 = 12f; - int num549 = 0; - int num550 = ProjectileID.BombSkeletronPrime; - num547 = num548 / num547; - num545 = (0f - num545) * num547; - num546 = (0f - num546) * num547; - vector66.X += num545 * 4f; - vector66.Y += num546 * 4f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector66.X, vector66.Y, num545, num546, num550, num549, 0f, Main.myPlayer); - } - } - } - else - { - if (npc.ai[2] != 1f) - return false; - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 180f : Main.expertMode ? 240f : 300f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector67 = npc.Center; - float num552 = Main.npc[(int)npc.ai[1]].Center.X - vector67.X; - float num553 = Main.npc[(int)npc.ai[1]].position.Y - vector67.Y; - num553 = Main.player[npc.target].Center.Y - 80f - vector67.Y; - float num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553); - num554 = (Main.masterMode ? 8f : Main.expertMode ? 7f : 6f) / num554; - num552 *= num554; - num553 *= num554; - - float num496 = 0.04f; - float num498 = 0.08f; - float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.08f : 0.06f; - num498 = Main.masterMode ? 0.12f : 0.1f; - } - - if (npc.velocity.X > num552) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num496; - } - - if (npc.velocity.X < num552) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num496; - } - - if (npc.velocity.Y > num553) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num498; - } - - if (npc.velocity.Y < num553) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num498; - } - - vector67 = npc.Center; - num552 = Main.player[npc.target].Center.X - vector67.X; - num553 = Main.player[npc.target].Center.Y - vector67.Y; - num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553); - npc.rotation = (float)Math.Atan2(num553, num552) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 20f : Main.expertMode ? 30f : 40f)) - { - npc.localAI[0] = 0f; - float num555 = 10f; - int num556 = 0; - int num557 = ProjectileID.BombSkeletronPrime; - num554 = num555 / num554; - num552 *= num554; - num553 *= num554; - vector67.X += num552 * 4f; - vector67.Y += num553 * 4f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector67.X, vector67.Y, num552, num553, num557, num556, 0f, Main.myPlayer); - } - } - } - - return false; - } - - public static bool VanillaPrimeViceAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - Vector2 vector61 = npc.Center; - float num530 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector61.X; - float num531 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector61.Y; - float num532 = (float)Math.Sqrt(num530 * num530 + num531 * num531); - if (npc.ai[2] != 99f) - { - if (num532 > 800f) - npc.ai[2] = 99f; - } - else if (num532 < 400f) - npc.ai[2] = 0f; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[2] == 99f) - { - float num496 = 0.1f; - float num497 = 8f; - float num498 = 0.5f; - float num499 = 12f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 11f : 9.5f; - num498 = Main.masterMode ? 0.6f : 0.55f; - num499 = Main.masterMode ? 16f : 14f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - if (Main.player[npc.target].dead) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; - } - else - { - Vector2 vector62 = npc.Center; - float num533 = Main.player[npc.target].Center.X - vector62.X; - float num534 = Main.player[npc.target].Center.Y - vector62.Y; - float num535 = (float)Math.Sqrt(num533 * num533 + num534 * num534); - num535 = (Main.masterMode ? 16f : Main.expertMode ? 14f : 12f) / num535; - num533 *= num535; - num534 *= num535; - npc.rotation = (float)Math.Atan2(num534, num533) - MathHelper.PiOver2; - float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 2f) - { - npc.rotation = (float)Math.Atan2(num534, num533) - MathHelper.PiOver2; - npc.velocity.X = num533; - npc.velocity.Y = num534; - npc.netUpdate = true; - } - else - npc.velocity *= deceleration; - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.1f; - float num497 = 3f; - float num498 = 0.2f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.28f : 0.24f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 250f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= (deceleration - 0.02f); - - npc.velocity.X -= (num498 * 1.5f); - if (npc.velocity.X > num499 + 1f) - npc.velocity.X = num499 + 1f; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= (deceleration - 0.02f); - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector63 = npc.Center; - float num536 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector63.X; - float num537 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector63.Y; - float num538 = (float)Math.Sqrt(num536 * num536 + num537 * num537); - npc.rotation = (float)Math.Atan2(num537, num536) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - Vector2 vector64 = npc.Center; - float num539 = Main.npc[(int)npc.ai[1]].Center.X - 280f * npc.ai[0] - vector64.X; - float num540 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector64.Y; - float num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540); - npc.rotation = (float)Math.Atan2(num540, num539) + MathHelper.PiOver2; - npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; - npc.velocity.X += 0.5f; - npc.velocity.Y -= 0.5f; - if (npc.velocity.Y < -9f) - npc.velocity.Y = -9f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 2f; - vector64 = npc.Center; - num539 = Main.player[npc.target].Center.X - vector64.X; - num540 = Main.player[npc.target].Center.Y - vector64.Y; - num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540); - num541 = (Main.masterMode ? 24f : Main.expertMode ? 22f : 20f) / num541; - npc.velocity.X = num539 * num541; - npc.velocity.Y = num540 * num541; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - { - float numCharges = Main.masterMode ? 2f : Main.expertMode ? 3f : 4f; - if (npc.ai[3] >= numCharges) - { - npc.ai[2] = 3f; - npc.ai[3] = 0f; - } - else - { - npc.ai[2] = 1f; - npc.ai[3] += 1f; - } - } - } - else if (npc.ai[2] == 4f) - { - Vector2 vector65 = npc.Center; - float num542 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector65.X; - float num543 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector65.Y; - float num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543); - npc.rotation = (float)Math.Atan2(num543, num542) + MathHelper.PiOver2; - npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; - npc.velocity.X += 0.5f; - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 5f; - vector65 = npc.Center; - num542 = Main.player[npc.target].Center.X - vector65.X; - num543 = Main.player[npc.target].Center.Y - vector65.Y; - num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543); - num544 = (Main.masterMode ? 20f : Main.expertMode ? 18.5f : 17f) / num544; - npc.velocity.X = num542 * num544; - npc.velocity.Y = num543 * num544; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f && npc.Center.X < Main.player[npc.target].Center.X - 100f) - { - // Set damage - npc.damage = npc.defDamage; - - float numCharges = Main.masterMode ? 2f : Main.expertMode ? 3f : 4f; - if (npc.ai[3] >= numCharges) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[2] = 4f; - npc.ai[3] += 1f; - } - } - - return false; - } - - public static bool VanillaPrimeSawAI(NPC npc, Mod mod) - { - Vector2 vector56 = npc.Center; - float num515 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector56.X; - float num516 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector56.Y; - float num517 = (float)Math.Sqrt(num515 * num515 + num516 * num516); - if (npc.ai[2] != 99f) - { - if (num517 > 800f) - npc.ai[2] = 99f; - } - else if (num517 < 400f) - npc.ai[2] = 0f; - - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - // Min saw damage - int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); - - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - - if (npc.ai[2] == 99f) - { - float num496 = 0.1f; - float num497 = 8f; - float num498 = 0.5f; - float num499 = 12f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 11f : 9.5f; - num498 = Main.masterMode ? 0.6f : 0.55f; - num499 = Main.masterMode ? 16f : 14f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - if (Main.player[npc.target].dead) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; - } - else - { - Vector2 vector57 = npc.Center; - float num518 = Main.player[npc.target].Center.X - vector57.X; - float num519 = Main.player[npc.target].Center.Y - vector57.Y; - float num520 = (float)Math.Sqrt(num518 * num518 + num519 * num519); - num520 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num520; - num518 *= num520; - num519 *= num520; - npc.rotation = (float)Math.Atan2(num519, num518) - MathHelper.PiOver2; - - float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; - float acceleration = Main.masterMode ? 0.07f : Main.expertMode ? 0.06f : 0.05f; - if (npc.velocity.X > num518) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= acceleration; - } - - if (npc.velocity.X < num518) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += acceleration; - } - - if (npc.velocity.Y > num519) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= acceleration; - } - - if (npc.velocity.Y < num519) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += acceleration; - } - } - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 180f : Main.expertMode ? 240f : 300f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.04f; - float num497 = 3f; - float num498 = 0.3f; - float num499 = 12f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.06f : 0.05f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.4f : 0.35f; - num499 = Main.masterMode ? 16f : 14f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 250f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector58 = npc.Center; - float num521 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector58.X; - float num522 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; - float num523 = (float)Math.Sqrt(num521 * num521 + num522 * num522); - npc.rotation = (float)Math.Atan2(num522, num521) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - Vector2 vector59 = npc.Center; - float num524 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector59.X; - float num525 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; - float num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525); - npc.rotation = (float)Math.Atan2(num525, num524) + MathHelper.PiOver2; - - float deceleration = Main.masterMode ? 0.85f : Main.expertMode ? 0.9f : 0.95f; - npc.velocity.X *= deceleration; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 2f; - vector59 = npc.Center; - num524 = Main.player[npc.target].Center.X - vector59.X; - num525 = Main.player[npc.target].Center.Y - vector59.Y; - num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525); - num526 = (Main.masterMode ? 26f : Main.expertMode ? 24f : 22f) / num526; - npc.velocity.X = num524 * num526; - npc.velocity.Y = num525 * num526; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - npc.ai[2] = 3f; - } - else if (npc.ai[2] == 4f) - { - // Set damage - npc.damage = npc.defDamage; - - Vector2 vector60 = npc.Center; - float num527 = Main.player[npc.target].Center.X - vector60.X; - float num528 = Main.player[npc.target].Center.Y - vector60.Y; - float num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528); - num529 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num529; - num527 *= num529; - num528 *= num529; - - float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; - float acceleration = Main.masterMode ? 0.07f : Main.expertMode ? 0.06f : 0.05f; - - if (npc.velocity.X > num527) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= acceleration; - } - - if (npc.velocity.X < num527) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += acceleration; - } - - if (npc.velocity.Y > num528) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= acceleration; - } - - if (npc.velocity.Y < num528) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += acceleration; - } - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - vector60 = npc.Center; - num527 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector60.X; - num528 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector60.Y; - num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528); - npc.rotation = (float)Math.Atan2(num528, num527) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) - npc.ai[2] = 0f; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index e77b34c8f2..aedd0dc065 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -76,22 +76,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Check for Oblivion in Master Mode - bool oblivionAlive = false; - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - // Foveanator spawn - if (!oblivionAlive && death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) + if (death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) { NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); calamityGlobalNPC.newAI[0] = 1f; @@ -101,7 +87,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float phase2LifeRatio = death ? 0.85f : 0.7f; float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables @@ -112,16 +98,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase duration variables float phase1MaxLaserPhaseDurationDecrease = death ? 120f : 300f; - // If Oblivion is alive reduce aggression of all attacks - if (oblivionAlive) - { - phase1MaxSpeedIncrease = death ? 1f : 2f; - phase1MaxAccelerationIncrease = death ? 0.0125f : 0.025f; - phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - - phase1MaxLaserPhaseDurationDecrease = death ? 60f : 150f; - } - // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; bool finalPhase = lifeRatio < finalPhaseLifeRatio; @@ -141,8 +117,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.reflectsProjectiles = false; // Despawn - bool oblivionFightDespawn = ((oblivionAlive && lifeRatio < 0.8f) || (oblivionAlive && !spazAlive && lifeRatio < 0.95f)) && npc.localAI[3] == 1f; - if (Main.player[npc.target].dead || oblivionFightDespawn) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -199,7 +174,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); float phaseGateValue = death ? (300f - phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 450f; - float laserGateValue = oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f; + float laserGateValue = foveanatorAlive ? 45f : 30f; if (NPC.IsMechQueenUp) { phaseGateValue = 900f; @@ -300,7 +275,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - if (npc.ai[2] >= delayBeforeChargingAgain + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= delayBeforeChargingAgain) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -387,7 +362,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 6f : 7f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 7f; int numProj = shootLaser ? 6 : 2; int spread = shootLaser ? 20 : 80; float rotation = MathHelper.ToRadians(spread); @@ -474,7 +449,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 420f; + float distanceFromTarget = 420f; Vector2 destination = Main.player[npc.target].Center - Vector2.UnitY * distanceFromTarget; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -516,7 +491,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 26f)) + if (npc.localAI[1] >= (spazAlive ? (foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 26f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { @@ -562,7 +537,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 420f; + float distanceFromTarget = 420f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -573,7 +548,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 10f)) + if (npc.localAI[1] > (spazAlive ? (foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 10f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { @@ -843,24 +818,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Check for Oblivion in Master Mode - bool oblivionAlive = false; - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float phase2LifeRatio = death ? 0.85f : 0.7f; float finalPhaseLifeRatio = death ? 0.3f : 0.15f; // Movement variables @@ -872,17 +833,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phase1MaxCursedFlamePhaseDurationDecrease = death ? 80f : 200f; float phase1MaxChargesDecrease = death ? 2f : 4f; - // If Oblivion is alive reduce aggression of all attacks - if (oblivionAlive) - { - phase1MaxSpeedIncrease = death ? 1.125f : 2.25f; - phase1MaxAccelerationIncrease = death ? 0.0375f : 0.075f; - phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - - phase1MaxCursedFlamePhaseDurationDecrease = death ? 40f : 100f; - phase1MaxChargesDecrease = death ? 1f : 2f; - } - // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; bool finalPhase = lifeRatio < finalPhaseLifeRatio; @@ -902,8 +852,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.reflectsProjectiles = false; // Despawn - bool oblivionFightDespawn = ((oblivionAlive && lifeRatio < 0.8f) || (oblivionAlive && !retAlive && lifeRatio < 0.95f)) && npc.localAI[3] == 1f; - if (Main.player[npc.target].dead || oblivionFightDespawn) + if (Main.player[npc.target].dead) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -940,7 +889,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 400f; + float distanceFromTarget = 400f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -983,7 +932,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 0.4f; } - if (npc.ai[3] >= (oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f)) + if (npc.ai[3] >= (foveanatorAlive ? 45f : 30f)) { npc.ai[3] = 0f; @@ -1058,7 +1007,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge 8 times float chargeTime = death ? 45f : 25f; - if (npc.ai[2] >= chargeTime + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= chargeTime) { // Reset AI array and go to cursed fireball phase npc.ai[3] += 1f; @@ -1144,7 +1093,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses damage = (int)(damage * secondMechMultiplier); } - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 12f : 16f) + Main.rand.NextVector2CircularEdge(3f, 3f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); Main.projectile[proj].tileCollide = false; } @@ -1234,7 +1183,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Boost speed if too far from target if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); + maxVelocity += MathHelper.Lerp(0f, death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -1380,7 +1329,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charges 5 times - if (npc.ai[2] >= (chargeTime * 1.6f) + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= chargeTime * 1.6f) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -1605,1314 +1554,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaRetinazerAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - } - - float phase2LifeRatio = Main.masterMode ? 0.6f : 0.4f; - - bool dead2 = Main.player[npc.target].dead; - float num412 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num413 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num414 = (float)Math.Atan2(num413, num412) + MathHelper.PiOver2; - if (num414 < 0f) - num414 += MathHelper.TwoPi; - else if ((double)num414 > MathHelper.TwoPi) - num414 -= MathHelper.TwoPi; - - float num415 = 0.1f; - if (npc.rotation < num414) - { - if ((double)(num414 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num415; - else - npc.rotation += num415; - } - else if (npc.rotation > num414) - { - if ((double)(npc.rotation - num414) > MathHelper.Pi) - npc.rotation += num415; - else - npc.rotation -= num415; - } - - if (npc.rotation > num414 - num415 && npc.rotation < num414 + num415) - npc.rotation = num414; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if ((double)npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num414 - num415 && npc.rotation < num414 + num415) - npc.rotation = num414; - - if (Main.rand.NextBool(5)) - { - int num416 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); - Main.dust[num416].velocity.X *= 0.5f; - Main.dust[num416].velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.IsItDay() && !dead2 && npc.timeLeft < 10) - { - for (int num417 = 0; num417 < Main.maxNPCs; num417++) - { - if (num417 != npc.whoAmI && Main.npc[num417].active && (Main.npc[num417].type == NPCID.Retinazer || Main.npc[num417].type == NPCID.Spazmatism)) - npc.DiscourageDespawn(Main.npc[num417].timeLeft - 1); - } - } - - Vector2 vector41 = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 vector42 = new Vector2(-150f, -250f); - vector42 *= 0.75f; - float num418 = nPC.velocity.X * 0.025f; - vector41 = mechQueenCenter + vector42; - vector41 = vector41.RotatedBy(num418, mechQueenCenter); - } - - npc.reflectsProjectiles = false; - if (Main.IsItDay() || dead2) - { - npc.velocity.Y -= 0.04f; - npc.EncourageDespawn(10); - return false; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float num419 = 7f; - float num420 = 0.1f; - if (Main.expertMode) - { - num419 = Main.masterMode ? 9.5f : 8.25f; - num420 = Main.masterMode ? 0.13f : 0.115f; - } - - if (Main.getGoodWorld) - { - num419 *= 1.15f; - num420 *= 1.15f; - } - - int num421 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num421 = -1; - - Vector2 vector43 = npc.Center; - float num422 = Main.player[npc.target].Center.X + (float)(num421 * 300) - vector43.X; - float num423 = Main.player[npc.target].Center.Y - 300f - vector43.Y; - if (NPC.IsMechQueenUp) - { - num419 = 14f; - num422 = vector41.X; - num423 = vector41.Y; - num422 -= vector43.X; - num423 -= vector43.Y; - } - - float num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); - float num425 = num424; - if (NPC.IsMechQueenUp) - { - if (num424 > num419) - { - num424 = num419 / num424; - num422 *= num424; - num423 *= num424; - } - - float num426 = 60f; - npc.velocity.X = (npc.velocity.X * (num426 - 1f) + num422) / num426; - npc.velocity.Y = (npc.velocity.Y * (num426 - 1f) + num423) / num426; - } - else - { - num424 = num419 / num424; - num422 *= num424; - num423 *= num424; - if (npc.velocity.X < num422) - { - npc.velocity.X += num420; - if (npc.velocity.X < 0f && num422 > 0f) - npc.velocity.X += num420; - } - else if (npc.velocity.X > num422) - { - npc.velocity.X -= num420; - if (npc.velocity.X > 0f && num422 < 0f) - npc.velocity.X -= num420; - } - - if (npc.velocity.Y < num423) - { - npc.velocity.Y += num420; - if (npc.velocity.Y < 0f && num423 > 0f) - npc.velocity.Y += num420; - } - else if (npc.velocity.Y > num423) - { - npc.velocity.Y -= num420; - if (npc.velocity.Y > 0f && num423 < 0f) - npc.velocity.Y -= num420; - } - } - - int num427 = 600; - int num428 = 60; - if (NPC.IsMechQueenUp) - { - num427 = 1200; - num428 = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 90 : 120); - } - - if (Main.expertMode) - num428 = (int)(num428 * 0.8f); - - if (Main.masterMode) - num427 /= 2; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num427) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num425 < (Main.masterMode ? 720f : Main.expertMode ? 560f : 400f)) - { - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - - if (Main.expertMode) - npc.ai[3] += MathHelper.Lerp(0f, Main.masterMode ? 2.5f : 1.5f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); - - if (Main.getGoodWorld) - npc.ai[3] += 0.5f; - } - - if (npc.ai[3] >= (float)num428) - { - npc.ai[3] = 0f; - vector43 = npc.Center; - num422 = Main.player[npc.target].Center.X - vector43.X; - num423 = Main.player[npc.target].Center.Y - vector43.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num429 = Main.expertMode ? 10.5f : 9f; - int type = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); - num424 = num429 / num424; - num422 *= num424; - num423 *= num424; - int inaccuracy = Main.masterMode ? 3 : Main.expertMode ? 6 : 9; - num422 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; - num423 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; - - Vector2 laserVelocity = new Vector2(num422, num423); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.rotation = num414; - float num432 = 12f; - if (Main.expertMode) - num432 = Main.masterMode ? 18f : 15f; - - if (Main.getGoodWorld) - num432 += 2f; - - Vector2 vector44 = npc.Center; - float num433 = Main.player[npc.target].Center.X - vector44.X; - float num434 = Main.player[npc.target].Center.Y - vector44.Y; - float num435 = (float)Math.Sqrt(num433 * num433 + num434 * num434); - num435 = num432 / num435; - npc.velocity.X = num433 * num435; - npc.velocity.Y = num434 * num435; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - float decelerateGateValue = Main.masterMode ? 38f : Main.expertMode ? 32f : 25f; - if (npc.ai[2] >= decelerateGateValue) - { - // Avoid cheap bullshit - npc.damage = 0; - - float decelerationMultiplier = Main.masterMode ? 0.78f : Main.expertMode ? 0.92f : 0.96f; - npc.velocity *= decelerationMultiplier; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float delayBeforeChargingAgain = Main.masterMode ? 47f : Main.expertMode ? 56f : 70f; - if (npc.ai[2] >= delayBeforeChargingAgain) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num414; - float numCharges = Main.masterMode ? 6f : Main.expertMode ? 5f : 4f; - if (npc.ai[3] >= numCharges) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - if (npc.life < npc.lifeMax * phase2LifeRatio) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - return false; - } - - if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (NPC.IsMechQueenUp) - npc.reflectsProjectiles = true; - - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - - npc.ai[1] += 1f; - if (Main.masterMode && npc.ai[2] >= 0.2f) - { - if (npc.ai[1] % 10f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 7f; - int numProj = 3; - int spread = 10; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 90f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - } - } - } - } - - if (npc.ai[1] >= 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - for (int num436 = 0; num436 < 2; num436++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); - } - - for (int num437 = 0; num437 < 20; num437++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - - return false; - } - - // Avoid cheap bullshit - npc.damage = 0; - - npc.defense = npc.defDefense + 10; - npc.HitSound = SoundID.NPCHit4; - - if (npc.ai[1] == 0f) - { - float num438 = 8f; - float num439 = 0.15f; - if (Main.expertMode) - { - num438 = Main.masterMode ? 11f : 9.5f; - num439 = Main.masterMode ? 0.2f : 0.175f; - } - - if (Main.getGoodWorld) - { - num438 *= 1.15f; - num439 *= 1.15f; - } - - Vector2 vector45 = npc.Center; - float num440 = Main.player[npc.target].Center.X - vector45.X; - float num441 = Main.player[npc.target].Center.Y - 420f - vector45.Y; - if (NPC.IsMechQueenUp) - { - num438 = 14f; - num440 = vector41.X; - num441 = vector41.Y; - num440 -= vector45.X; - num441 -= vector45.Y; - } - - float num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); - if (NPC.IsMechQueenUp) - { - if (num442 > num438) - { - num442 = num438 / num442; - num440 *= num442; - num441 *= num442; - } - - npc.velocity.X = (npc.velocity.X * 4f + num440) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + num441) / 5f; - } - else - { - num442 = num438 / num442; - num440 *= num442; - num441 *= num442; - if (npc.velocity.X < num440) - { - npc.velocity.X += num439; - if (npc.velocity.X < 0f && num440 > 0f) - npc.velocity.X += num439; - } - else if (npc.velocity.X > num440) - { - npc.velocity.X -= num439; - if (npc.velocity.X > 0f && num440 < 0f) - npc.velocity.X -= num439; - } - - if (npc.velocity.Y < num441) - { - npc.velocity.Y += num439; - if (npc.velocity.Y < 0f && num441 > 0f) - npc.velocity.Y += num439; - } - else if (npc.velocity.Y > num441) - { - npc.velocity.Y -= num439; - if (npc.velocity.Y > 0f && num441 < 0f) - npc.velocity.Y -= num439; - } - } - - int num443 = 300; - if (NPC.IsMechQueenUp) - num443 = 1200; - - if (Main.masterMode) - num443 = (int)(num443 * 0.8f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num443) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - vector45 = npc.Center; - num440 = Main.player[npc.target].Center.X - vector45.X; - num441 = Main.player[npc.target].Center.Y - vector45.Y; - npc.rotation = (float)Math.Atan2(num441, num440) - MathHelper.PiOver2; - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - npc.localAI[1] += 1f; - - npc.localAI[1] += MathHelper.Lerp(0f, Main.masterMode ? 7f : Main.expertMode ? 6f : 5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); - - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 0f; - float num444 = Main.expertMode ? 10f : 8.5f; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); - num442 = num444 / num442; - num440 *= num442; - num441 *= num442; - - Vector2 laserVelocity = new Vector2(num440, num441); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - - return false; - } - - int num447 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num447 = -1; - - float num448 = 8f; - float num449 = 0.2f; - if (Main.expertMode) - { - num448 = Main.masterMode ? 11f : 9.5f; - num449 = Main.masterMode ? 0.3f : 0.25f; - } - - if (Main.getGoodWorld) - { - num448 *= 1.15f; - num449 *= 1.15f; - } - - Vector2 vector46 = npc.Center; - float num450 = Main.player[npc.target].Center.X + (num447 * 420f) - vector46.X; - float num451 = Main.player[npc.target].Center.Y - vector46.Y; - float num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); - num452 = num448 / num452; - num450 *= num452; - num451 *= num452; - if (npc.velocity.X < num450) - { - npc.velocity.X += num449; - if (npc.velocity.X < 0f && num450 > 0f) - npc.velocity.X += num449; - } - else if (npc.velocity.X > num450) - { - npc.velocity.X -= num449; - if (npc.velocity.X > 0f && num450 < 0f) - npc.velocity.X -= num449; - } - - if (npc.velocity.Y < num451) - { - npc.velocity.Y += num449; - if (npc.velocity.Y < 0f && num451 > 0f) - npc.velocity.Y += num449; - } - else if (npc.velocity.Y > num451) - { - npc.velocity.Y -= num449; - if (npc.velocity.Y > 0f && num451 < 0f) - npc.velocity.Y -= num449; - } - - vector46 = npc.Center; - num450 = Main.player[npc.target].Center.X - vector46.X; - num451 = Main.player[npc.target].Center.Y - vector46.Y; - npc.rotation = (float)Math.Atan2(num451, num450) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - - npc.localAI[1] += MathHelper.Lerp(0f, Main.masterMode ? 6f : Main.expertMode ? 5.25f : 3.75f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); - - if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 0f; - float num453 = 9f; - int type = ProjectileID.DeathLaser; - int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); - num452 = num453 / num452; - num450 *= num452; - num451 *= num452; - - Vector2 laserVelocity = new Vector2(num450, num451); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - - npc.ai[2] += 1f; - float rapidLaserPhaseGateValue = Main.masterMode ? 120f : Main.expertMode ? 150f : 180f; - if (npc.ai[2] >= rapidLaserPhaseGateValue) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - return false; - } - - public static bool VanillaSpazmatismAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - } - - float phase2LifeRatio = Main.masterMode ? 0.6f : 0.4f; - - bool dead3 = Main.player[npc.target].dead; - float num456 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num457 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num458 = (float)Math.Atan2(num457, num456) + MathHelper.PiOver2; - if (num458 < 0f) - num458 += MathHelper.TwoPi; - else if ((double)num458 > MathHelper.TwoPi) - num458 -= MathHelper.TwoPi; - - float num459 = 0.15f; - if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) - num459 *= 0.25f; - - if (npc.rotation < num458) - { - if ((double)(num458 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num459; - else - npc.rotation += num459; - } - else if (npc.rotation > num458) - { - if ((double)(npc.rotation - num458) > MathHelper.Pi) - npc.rotation += num459; - else - npc.rotation -= num459; - } - - if (npc.rotation > num458 - num459 && npc.rotation < num458 + num459) - npc.rotation = num458; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if ((double)npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num458 - num459 && npc.rotation < num458 + num459) - npc.rotation = num458; - - if (Main.rand.NextBool(5)) - { - int num460 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); - Main.dust[num460].velocity.X *= 0.5f; - Main.dust[num460].velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.IsItDay() && !dead3 && npc.timeLeft < 10) - { - for (int num461 = 0; num461 < Main.maxNPCs; num461++) - { - if (num461 != npc.whoAmI && Main.npc[num461].active && (Main.npc[num461].type == NPCID.Retinazer || Main.npc[num461].type == NPCID.Spazmatism)) - npc.DiscourageDespawn(Main.npc[num461].timeLeft - 1); - } - } - - Vector2 vector47 = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC nPC2 = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter(); - Vector2 vector48 = new Vector2(150f, -250f); - vector48 *= 0.75f; - float num462 = nPC2.velocity.X * 0.025f; - vector47 = mechQueenCenter2 + vector48; - vector47 = vector47.RotatedBy(num462, mechQueenCenter2); - } - - npc.reflectsProjectiles = false; - if (Main.IsItDay() || dead3) - { - npc.velocity.Y -= 0.04f; - npc.EncourageDespawn(10); - return false; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float num463 = 12f; - float num464 = 0.4f; - if (Main.expertMode) - { - num463 = Main.masterMode ? 13.2f : 12.6f; - num464 = Main.masterMode ? 0.48f : 0.44f; - } - - if (Main.getGoodWorld) - { - num463 *= 1.15f; - num464 *= 1.15f; - } - - int num465 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num465 = -1; - - Vector2 vector49 = npc.Center; - float num466 = Main.player[npc.target].Center.X + (float)(num465 * 400) - vector49.X; - float num467 = Main.player[npc.target].Center.Y - vector49.Y; - if (NPC.IsMechQueenUp) - { - num463 = 14f; - num466 = vector47.X; - num467 = vector47.Y; - num466 -= vector49.X; - num467 -= vector49.Y; - } - - float num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); - float num469 = num468; - if (NPC.IsMechQueenUp) - { - if (num468 > num463) - { - num468 = num463 / num468; - num466 *= num468; - num467 *= num468; - } - - npc.velocity.X = (npc.velocity.X * 4f + num466) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + num467) / 5f; - } - else - { - num468 = num463 / num468; - num466 *= num468; - num467 *= num468; - if (npc.velocity.X < num466) - { - npc.velocity.X += num464; - if (npc.velocity.X < 0f && num466 > 0f) - npc.velocity.X += num464; - } - else if (npc.velocity.X > num466) - { - npc.velocity.X -= num464; - if (npc.velocity.X > 0f && num466 < 0f) - npc.velocity.X -= num464; - } - - if (npc.velocity.Y < num467) - { - npc.velocity.Y += num464; - if (npc.velocity.Y < 0f && num467 > 0f) - npc.velocity.Y += num464; - } - else if (npc.velocity.Y > num467) - { - npc.velocity.Y -= num464; - if (npc.velocity.Y > 0f && num467 < 0f) - npc.velocity.Y -= num464; - } - } - - int num470 = 600; - if (NPC.IsMechQueenUp) - num470 = 1200; - - if (Main.masterMode) - num470 = (int)(num470 * 0.75f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num470) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else - { - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - - if (Main.expertMode) - npc.ai[3] += MathHelper.Lerp(0f, Main.masterMode ? 1.8f : 1.2f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); - - if (Main.getGoodWorld) - npc.ai[3] += 0.4f; - } - - if (npc.ai[3] >= 60f) - { - npc.ai[3] = 0f; - vector49 = npc.Center; - num466 = Main.player[npc.target].Center.X - vector49.X; - num467 = Main.player[npc.target].Center.Y - vector49.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num471 = Main.expertMode ? 14f : 12f; - int type = ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); - num468 = num471 / num468; - num466 *= num468; - num467 *= num468; - int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; - num466 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; - num467 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; - - Vector2 fireballVelocity = new Vector2(num466, num467); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector49 + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.rotation = num458; - float num474 = 13f; - - if (Main.expertMode) - num474 += MathHelper.Lerp(0f, Main.masterMode ? 11.2f : 5.6f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); - - if (Main.getGoodWorld) - num474 *= 1.2f; - - Vector2 vector50 = npc.Center; - float num475 = Main.player[npc.target].Center.X - vector50.X; - float num476 = Main.player[npc.target].Center.Y - vector50.Y; - float num477 = (float)Math.Sqrt(num475 * num475 + num476 * num476); - num477 = num474 / num477; - npc.velocity.X = num475 * num477; - npc.velocity.Y = num476 * num477; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - float decelerateGateValue = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; - if (npc.ai[2] >= decelerateGateValue) - { - // Avoid cheap bullshit - npc.damage = 0; - - float decelerationMultiplier = Main.masterMode ? 0.78f : Main.expertMode ? 0.85f : 0.9f; - npc.velocity *= decelerationMultiplier; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float delayBeforeChargingAgain = Main.masterMode ? 28f : Main.expertMode ? 34f : 42f; - if (npc.ai[2] >= delayBeforeChargingAgain) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num458; - float numCharges = Main.masterMode ? 6f : Main.expertMode ? 8f : 10f; - if (npc.ai[3] >= numCharges) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - if (npc.life < npc.lifeMax * phase2LifeRatio) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - return false; - } - - if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (NPC.IsMechQueenUp) - npc.reflectsProjectiles = true; - - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - - npc.ai[1] += 1f; - if (Main.masterMode && npc.ai[2] >= 0.2f) - { - if (npc.ai[1] % 10f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - } - } - } - - if (npc.ai[1] >= 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - for (int num478 = 0; num478 < 2; num478++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); - } - - for (int num479 = 0; num479 < 20; num479++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - - return false; - } - - npc.HitSound = SoundID.NPCHit4; - int setDamage = (int)Math.Round(npc.defDamage * 1.5); - int reducedSetDamage = (int)Math.Round(setDamage * 0.5); - npc.defense = npc.defDefense + 18; - - if (npc.ai[1] == 0f) - { - // Bites your fucking ass - npc.damage = reducedSetDamage; - - float num480 = 4f; - float num481 = Main.masterMode ? 0.12f : 0.1f; - int num482 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num482 = -1; - - Vector2 vector51 = npc.Center; - int flamethrowerDistance = 180; - float num483 = Main.player[npc.target].Center.X + (float)(num482 * flamethrowerDistance) - vector51.X; - float num484 = Main.player[npc.target].Center.Y - vector51.Y; - float num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); - if (!NPC.IsMechQueenUp) - { - if (num485 > flamethrowerDistance) - num480 += MathHelper.Lerp(0f, Main.masterMode ? 8f : 6f, MathHelper.Clamp((num485 - flamethrowerDistance) / 1000f, 0f, 1f)); - - if (Main.getGoodWorld) - { - num480 *= 1.15f; - num481 *= 1.15f; - } - - num485 = num480 / num485; - num483 *= num485; - num484 *= num485; - if (npc.velocity.X < num483) - { - npc.velocity.X += num481; - if (npc.velocity.X < 0f && num483 > 0f) - npc.velocity.X += num481; - } - else if (npc.velocity.X > num483) - { - npc.velocity.X -= num481; - if (npc.velocity.X > 0f && num483 < 0f) - npc.velocity.X -= num481; - } - - if (npc.velocity.Y < num484) - { - npc.velocity.Y += num481; - if (npc.velocity.Y < 0f && num484 > 0f) - npc.velocity.Y += num481; - } - else if (npc.velocity.Y > num484) - { - npc.velocity.Y -= num481; - if (npc.velocity.Y > 0f && num484 < 0f) - npc.velocity.Y -= num481; - } - } - - int num486 = 400; - if (NPC.IsMechQueenUp) - num486 = 1200; - - if (Main.masterMode) - num486 = (int)(num486 * 0.8f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num486) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = 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)) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - - npc.localAI[1] += MathHelper.Lerp(0f, 5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); - - if (npc.localAI[1] > 8f) - { - npc.localAI[1] = 0f; - float num487 = 6f + (Main.expertMode ? MathHelper.Lerp(0f, Main.masterMode ? 3f : 1.5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio) : 0f); - float timeForFlamethrowerToReachMaxVelocity = 60f; - float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); - num487 = MathHelper.Lerp(0.1f, num487, flamethrowerSpeedScalar); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - vector51 = npc.Center; - num483 = Main.player[npc.target].Center.X - vector51.X; - num484 = Main.player[npc.target].Center.Y - vector51.Y; - num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); - num485 = num487 / num485; - num483 *= num485; - num484 *= num485; - int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; - num484 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; - num483 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; - num484 += npc.velocity.Y * 0.5f; - num483 += npc.velocity.X * 0.5f; - - if (NPC.IsMechQueenUp) - { - Vector2 vector52 = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * num487 + npc.velocity * 0.5f; - num483 = vector52.X; - num484 = vector52.Y; - vector51 = npc.Center - vector52 * 3f; - } - - Vector2 flamethrowerVelocity = new Vector2(num483, num484); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector51 + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 50f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - - if (NPC.IsMechQueenUp) - { - num480 = 14f; - num483 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector51.X; - num484 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector51.Y; - num483 = vector47.X; - num484 = vector47.Y; - num483 -= vector51.X; - num484 -= vector51.Y; - num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); - if (num485 > num480) - { - num485 = num480 / num485; - num483 *= num485; - num484 *= num485; - } - - int num490 = 60; - npc.velocity.X = (npc.velocity.X * (float)(num490 - 1) + num483) / (float)num490; - npc.velocity.Y = (npc.velocity.Y * (float)(num490 - 1) + num484) / (float)num490; - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = setDamage; - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - npc.rotation = num458; - float num491 = 14f; - if (Main.expertMode) - num491 += 2.5f; - if (Main.masterMode) - num491 += 3.5f; - - Vector2 vector53 = npc.Center; - float num492 = Main.player[npc.target].Center.X - vector53.X; - float num493 = Main.player[npc.target].Center.Y - vector53.Y; - float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); - num494 = num491 / num494; - npc.velocity.X = num492 * num494; - npc.velocity.Y = num493 * num494; - npc.ai[1] = 2f; - } - else - { - if (npc.ai[1] != 2f) - return false; - - // Set damage - npc.damage = setDamage; - - npc.ai[2] += 1f; - if (Main.expertMode) - npc.ai[2] += 0.5f; - if (Main.masterMode) - npc.ai[2] += 0.5f; - - if (npc.ai[2] >= 50f) - { - // Bites your fucking ass - npc.damage = reducedSetDamage; - - npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 80f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num458; - float numCharges = Main.masterMode ? Main.rand.Next(4, 7) : 6f; - if (npc.ai[3] >= numCharges) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - - // Due to the random number of charges in Master Mode - if (Main.masterMode) - npc.netUpdate = true; - } - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 9b0df45190..38aea8f081 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -307,21 +307,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (bossRush) speedMult += 0.2f; - float masterModeVelocityBoost = 0f; + float deathModeVelocityBoost = 0f; if (death) { float velocityBoostStartDistance = distanceBeforeSlowingDown; float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); - masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); + deathModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); } // NOTE: Max velocity is 8 in Expert Mode // NOTE: Max velocity is 9 in For The Worthy float velocityBoost = 4f * (1f - lifeRatio); - float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + masterModeVelocityBoost + velocityBoost; + float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + deathModeVelocityBoost + velocityBoost; velocityX *= speedMult; if (death) @@ -730,9 +730,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity, direction, and position bool shouldFireLasers = true; float phase2LifeRatio = 0.5f; - bool masterModeDetach = lifeRatio < phase2LifeRatio && death; + bool deathModeDetach = lifeRatio < phase2LifeRatio && death; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (!masterModeDetach) + if (!deathModeDetach) { npc.position.X = Main.npc[Main.wofNPCIndex].position.X; npc.direction = Main.npc[Main.wofNPCIndex].direction; @@ -832,7 +832,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { npc.rotation = 0f; - if (!masterModeDetach) + if (!deathModeDetach) shouldFireLasers = false; } } @@ -843,7 +843,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { npc.rotation = 0f; - if (!masterModeDetach) + if (!deathModeDetach) shouldFireLasers = false; } @@ -880,7 +880,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 0f; } } - else if (npc.localAI[1] > 45f && (canHit || masterModeDetach) && !charging) + else if (npc.localAI[1] > 45f && (canHit || deathModeDetach) && !charging) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; @@ -909,626 +909,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaWallofFleshAI(NPC npc, Mod mod) - { - if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) - npc.active = false; - - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - Main.wofDrawAreaBottom = -1; - Main.wofDrawAreaTop = -1; - } - - if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180) && NPC.CountNPCS(NPCID.FireImp) < 4) - { - int num349 = 1; - for (int num350 = 0; num350 < num349; num350++) - { - int num351 = 1000; - for (int num352 = 0; num352 < num351; num352++) - { - int num353 = (int)(npc.Center.X / 16f); - int num354 = (int)(npc.Center.Y / 16f); - if (npc.target >= 0) - { - num353 = (int)(Main.player[npc.target].Center.X / 16f); - num354 = (int)(Main.player[npc.target].Center.Y / 16f); - } - - num353 += Main.rand.Next(-50, 51); - for (num354 += Main.rand.Next(-50, 51); num354 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num353, num354); num354++) - { - } - - num354--; - if (!WorldGen.SolidTile(num353, num354)) - { - int num355 = NPC.NewNPC(npc.GetSource_FromAI(), num353 * 16 + 8, num354 * 16, 24); - if (Main.dedServ && num355 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num355); - - break; - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[2] == 0f) - { - if (Main.masterMode) - npc.ai[1] += 2f; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - npc.ai[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - npc.ai[1] += 1f; - - if (npc.ai[1] > 2700f) - npc.ai[2] = 1f; - } - - int num356 = Main.masterMode ? 30 : 60; - if (npc.ai[2] > 0f && npc.ai[1] > (float)num356) - { - int num357 = 3; - if ((double)npc.life < (double)npc.lifeMax * 0.3) - num357++; - - npc.ai[2] += 1f; - npc.ai[1] = 0f; - if (npc.ai[2] > (float)num357) - npc.ai[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.LeechHead) < 10) - { - int num358 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.Center.Y + 20f), NPCID.LeechHead, 1); - int leechVelocity = Main.masterMode ? 12 : 8; - Main.npc[num358].velocity.X = npc.direction * leechVelocity; - } - } - - npc.localAI[3] += 1f; - if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000))) - { - npc.localAI[3] = -Main.rand.Next(200); - SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); - } - - int num359 = Main.UnderworldLayer + 10; - int num360 = num359 + 70; - Main.wofNPCIndex = npc.whoAmI; - int num361 = (int)(npc.position.X / 16f); - int num362 = (int)((npc.position.X + (float)npc.width) / 16f); - int num363 = (int)(npc.Center.Y / 16f); - int num364 = 0; - int num365 = num363 + 7; - while (num364 < 15 && num365 > Main.UnderworldLayer) - { - num365++; - if (num365 > Main.maxTilesY - 10) - { - num365 = Main.maxTilesY - 10; - break; - } - - if (num365 < num359) - continue; - - for (int num366 = num361; num366 <= num362; num366++) - { - try - { - if (WorldGen.InWorld(num366, num365, 2) && (WorldGen.SolidTile(num366, num365) || Main.tile[num366, num365].LiquidAmount > 0)) - num364++; - } - catch - { - num364 += 15; - } - } - } - - num365 += 4; - if (Main.wofDrawAreaBottom == -1) - { - Main.wofDrawAreaBottom = num365 * 16; - } - else if (Main.wofDrawAreaBottom > num365 * 16) - { - Main.wofDrawAreaBottom--; - if (Main.wofDrawAreaBottom < num365 * 16) - Main.wofDrawAreaBottom = num365 * 16; - } - else if (Main.wofDrawAreaBottom < num365 * 16) - { - Main.wofDrawAreaBottom++; - if (Main.wofDrawAreaBottom > num365 * 16) - Main.wofDrawAreaBottom = num365 * 16; - } - - num364 = 0; - num365 = num363 - 7; - while (num364 < 15 && num365 < Main.maxTilesY - 10) - { - num365--; - if (num365 <= 10) - { - num365 = 10; - break; - } - - if (num365 > num360) - continue; - - if (num365 < num359) - { - num365 = num359; - break; - } - - for (int num367 = num361; num367 <= num362; num367++) - { - try - { - if (WorldGen.InWorld(num367, num365, 2) && (WorldGen.SolidTile(num367, num365) || Main.tile[num367, num365].LiquidAmount > 0)) - num364++; - } - catch - { - num364 += 15; - } - } - } - - num365 -= 4; - if (Main.wofDrawAreaTop == -1) - { - Main.wofDrawAreaTop = num365 * 16; - } - else if (Main.wofDrawAreaTop > num365 * 16) - { - Main.wofDrawAreaTop--; - if (Main.wofDrawAreaTop < num365 * 16) - Main.wofDrawAreaTop = num365 * 16; - } - else if (Main.wofDrawAreaTop < num365 * 16) - { - Main.wofDrawAreaTop++; - if (Main.wofDrawAreaTop > num365 * 16) - Main.wofDrawAreaTop = num365 * 16; - } - - Main.wofDrawAreaTop = (int)MathHelper.Clamp(Main.wofDrawAreaTop, (float)num359 * 16f, (float)num360 * 16f); - Main.wofDrawAreaBottom = (int)MathHelper.Clamp(Main.wofDrawAreaBottom, (float)num359 * 16f, (float)num360 * 16f); - if (Main.wofDrawAreaTop > Main.wofDrawAreaBottom - 160) - Main.wofDrawAreaTop = Main.wofDrawAreaBottom - 160; - else if (Main.wofDrawAreaBottom < Main.wofDrawAreaTop + 160) - Main.wofDrawAreaBottom = Main.wofDrawAreaTop + 160; - - float num368 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; - if (npc.position.Y > num368 + 1f) - npc.velocity.Y = -1f; - else if (npc.position.Y < num368 - 1f) - npc.velocity.Y = 1f; - - npc.velocity.Y = 0f; - npc.position.Y = num368; - - float targetPosition = Main.player[npc.target].Center.X; - float npcPosition = npc.Center.X; - - // Slow down if close - float distanceFromTarget; - if (npc.velocity.X < 0f) - distanceFromTarget = npcPosition - targetPosition; - else - distanceFromTarget = targetPosition - npcPosition; - - float distanceBeforeSlowingDown = 640f; - float speedMult = 1f; - - if (distanceFromTarget < distanceBeforeSlowingDown) - speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; - - speedMult = MathHelper.Clamp(speedMult, 0.4f, 1f); - - float masterModeVelocityBoost = 0f; - if (Main.masterMode) - { - float velocityBoostStartDistance = distanceBeforeSlowingDown; - float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); - masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); - } - - float num369 = (Main.expertMode ? 3.5f : 2.5f) + masterModeVelocityBoost; - if (!Main.expertMode) - { - // 4.7 is the max in classic - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num369 += 0.4f; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num369 += 0.5f; - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num369 += 0.6f; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num369 += 0.7f; - } - else - { - // 6.5 is the max in expert - if ((double)npc.life < (double)npc.lifeMax * 0.8) - num369 += 0.3f; - - if ((double)npc.life < (double)npc.lifeMax * 0.6) - num369 += 0.3f; - - if ((double)npc.life < (double)npc.lifeMax * 0.4) - num369 += 0.5f; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - num369 += 0.5f; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num369 += 0.7f; - - if ((double)npc.life < (double)npc.lifeMax * 0.05) - num369 += 0.7f; - - // 8.3 is the max in master - if (Main.masterMode) - { - if ((double)npc.life < (double)npc.lifeMax * 0.025) - num369 += 0.9f; - - if ((double)npc.life < (double)npc.lifeMax * 0.01) - num369 += 0.9f; - } - } - - if (Main.getGoodWorld) - { - num369 *= 1.1f; - num369 += 0.2f; - } - - num369 *= speedMult; - - if (npc.velocity.X == 0f) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead) - { - float num370 = float.PositiveInfinity; - int num371 = 0; - for (int num372 = 0; num372 < Main.maxPlayers; num372++) - { - Player player = Main.player[npc.target]; - if (player.active) - { - float num373 = npc.Distance(player.Center); - if (num370 > num373) - { - num370 = num373; - num371 = ((npc.Center.X < player.Center.X) ? 1 : (-1)); - } - } - } - - npc.direction = num371; - } - - npc.velocity.X = npc.direction; - } - - if (npc.velocity.X < 0f) - { - npc.velocity.X = -num369; - npc.direction = -1; - } - else - { - npc.velocity.X = num369; - npc.direction = 1; - } - - if (Main.player[npc.target].dead || !Main.player[npc.target].gross) - npc.TargetClosest_WOF(); - - if (Main.player[npc.target].dead) - { - npc.localAI[1] += 1f / 180f; - if (npc.localAI[1] >= 1f) - { - SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); - npc.life = 0; - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - - return false; - } - } - else - npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f); - - npc.spriteDirection = npc.direction; - Vector2 vector38 = npc.Center; - float num374 = Main.player[npc.target].Center.X - vector38.X; - float num375 = Main.player[npc.target].Center.Y - vector38.Y; - float num376 = (float)Math.Sqrt(num374 * num374 + num375 * num375); - float num377 = num376; - num374 *= num376; - num375 *= num376; - if (npc.direction > 0) - { - if (Main.player[npc.target].Center.X > npc.Center.X) - npc.rotation = (float)Math.Atan2(0f - num375, 0f - num374) + MathHelper.Pi; - else - npc.rotation = 0f; - } - else if (Main.player[npc.target].Center.X < npc.Center.X) - npc.rotation = (float)Math.Atan2(num375, num374) + MathHelper.Pi; - else - npc.rotation = 0f; - - if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) - { - int chanceToSpawnHungry = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); - chanceToSpawnHungry *= chanceToSpawnHungry; - if (chanceToSpawnHungry < 400) - chanceToSpawnHungry = (chanceToSpawnHungry * 19 + 400) / 20; - - if (chanceToSpawnHungry < 60) - chanceToSpawnHungry = (chanceToSpawnHungry * 3 + 60) / 4; - - if (chanceToSpawnHungry < 20) - chanceToSpawnHungry = (chanceToSpawnHungry + 20) / 2; - - chanceToSpawnHungry = (int)((double)chanceToSpawnHungry * (Main.masterMode ? 0.5 : 0.7)); - if (chanceToSpawnHungry < 2) - chanceToSpawnHungry = 2; - - if (Main.rand.NextBool(chanceToSpawnHungry)) - { - int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(Main.masterMode ? 2f : 1f, Main.masterMode ? 8f : 4f, npc.life / (float)npc.lifeMax)); - if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) - { - int hungryCount = 0; - int maxHungries = 10; - float[] hungryArray = new float[maxHungries]; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (hungryCount < maxHungries && Main.npc[i].active && Main.npc[i].type == NPCID.TheHungry) - { - hungryArray[hungryCount] = Main.npc[i].ai[0]; - hungryCount++; - } - } - - int maxValue = 1 + hungryCount * 2; - if (Main.masterMode) - maxValue /= 2; - if (maxValue < 2) - maxValue = 2; - - if (hungryCount < maxHungries && Main.rand.Next(maxValue) <= 1) - { - int ai0 = -1; - for (int i = 0; i < 1000; i++) - { - int randomHungryLocation = Main.rand.Next(maxHungries); - float hungryLocation = (float)randomHungryLocation * 0.1f - 0.05f; - bool spawnHungry = true; - for (int j = 0; j < hungryCount; j++) - { - if (hungryLocation == hungryArray[j]) - { - spawnHungry = false; - break; - } - } - - if (spawnHungry) - { - ai0 = randomHungryLocation; - break; - } - } - - if (ai0 >= 0) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)ai0 * 0.1f - 0.05f); - } - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f) - { - npc.localAI[0] = 2f; - float num386 = (npc.Center.Y + (float)Main.wofDrawAreaTop) / 2f; - int num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num386, NPCID.WallofFleshEye, npc.whoAmI, 1f); - float num388 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; - num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num388, NPCID.WallofFleshEye, npc.whoAmI, -1f); - float num389 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; - int maxHungries = Main.masterMode ? 16 : 11; - float maxOffset = Main.masterMode ? (0.2f / 3f) : 0.1f; - for (int i = 0; i < maxHungries; i++) - num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num389, NPCID.TheHungry, npc.whoAmI, i * maxOffset - 0.05f); - } - - return false; - } - - public static bool VanillaWallofFleshEyeAI(NPC npc, Mod mod) - { - if (Main.wofNPCIndex < 0) - { - npc.active = false; - return false; - } - - npc.realLife = Main.wofNPCIndex; - if (Main.npc[Main.wofNPCIndex].life > 0) - npc.life = Main.npc[Main.wofNPCIndex].life; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.target = Main.npc[Main.wofNPCIndex].target; - - // Avoid cheap bullshit - npc.damage = 0; - - npc.position.X = Main.npc[Main.wofNPCIndex].position.X; - npc.direction = Main.npc[Main.wofNPCIndex].direction; - npc.spriteDirection = npc.direction; - float num391 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - num391 = ((!(npc.ai[0] > 0f)) ? ((num391 + (float)Main.wofDrawAreaBottom) / 2f) : ((num391 + (float)Main.wofDrawAreaTop) / 2f)); - num391 -= (float)(npc.height / 2); - if (npc.position.Y > num391 + 1f) - { - npc.velocity.Y = -1f; - } - else if (npc.position.Y < num391 - 1f) - { - npc.velocity.Y = 1f; - } - else - { - npc.velocity.Y = 0f; - npc.position.Y = num391; - } - - if (npc.velocity.Y > 5f) - npc.velocity.Y = 5f; - - if (npc.velocity.Y < -5f) - npc.velocity.Y = -5f; - - Vector2 vector39 = npc.Center; - float num392 = Main.player[npc.target].Center.X - vector39.X; - float num393 = Main.player[npc.target].Center.Y - vector39.Y; - float num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); - float num395 = num394; - num392 *= num394; - num393 *= num394; - bool flag27 = true; - if (npc.direction > 0) - { - if (Main.player[npc.target].Center.X > npc.Center.X) - { - npc.rotation = (float)Math.Atan2(0f - num393, 0f - num392) + MathHelper.Pi; - } - else - { - npc.rotation = 0f; - flag27 = false; - } - } - else if (Main.player[npc.target].Center.X < npc.Center.X) - { - npc.rotation = (float)Math.Atan2(num393, num392) + MathHelper.Pi; - } - else - { - npc.rotation = 0f; - flag27 = false; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - int num396 = 4; - npc.localAI[1] += 1f; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75) - { - npc.localAI[1] += 1f; - num396++; - } - - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) - { - npc.localAI[1] += 1f; - num396++; - } - - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) - { - npc.localAI[1] += 1f; - num396 += 2; - } - - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - { - npc.localAI[1] += 2f; - num396 += 3; - } - - if (Main.expertMode) - { - npc.localAI[1] += 0.5f; - num396++; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - { - npc.localAI[1] += 2f; - num396 += 3; - } - } - - if (npc.localAI[2] == 0f) - { - if (npc.localAI[1] > 600f) - { - npc.localAI[2] = 1f; - npc.localAI[1] = 0f; - } - } - else - { - if (!(npc.localAI[1] > 45f) || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - return false; - - npc.localAI[1] = 0f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (float)num396) - npc.localAI[2] = 0f; - - if (flag27) - { - float num397 = 4f; - int type = ProjectileID.EyeLaser; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) - num397 += 1f; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) - num397 += 1f; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - num397 += 1f; - - num392 = Main.player[npc.target].Center.X - npc.Center.X; - num393 = Main.player[npc.target].Center.Y - npc.Center.Y; - num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); - num394 = num397 / num394; - num392 *= num394; - num393 *= num394; - - bool targetTooClose = npc.Distance(Main.player[npc.target].Center) < 160f; - float projectileOffset = targetTooClose ? 60f : 150f; - Vector2 projectileVelocity = new Vector2(num392, num393); - Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileOffset; - Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 1f, 0f); - } - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 12cb14f419..9b9ac80d81 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -6790,8 +6790,8 @@ PrepareToShoot: int projType = ProjectileID.SandBallFalling; - // 2 to 3 in Rev, 3 to 5 in Death, if FTW is also enabled, 8 to 13 (random chance for 10x the amount) - int projAmt = CalamityWorld.revenge ? Main.rand.Next(CalamityWorld.death ? 3 : 2, CalamityWorld.death ? 6 : 4) : 1; + // If FTW is enabled, can fire 8 to 13 sand balls (random chance for 10x the amount) + int projAmt = 1; if (Main.getGoodWorld) { projAmt = Main.rand.Next(8, 14); @@ -9685,13 +9685,8 @@ PrepareToShoot: if (npc.ai[0] != -1f) { npc.TargetClosest(true); - float acceleration = Main.masterMode ? 0.25f : Main.expertMode ? 0.2f : 0.1f; - float velocity = Main.masterMode ? 6f : Main.expertMode ? 5f : 3f; - if (CalamityWorld.death) - { - acceleration *= 1.25f; - velocity *= 1.25f; - } + float acceleration = CalamityWorld.death ? 0.25f : Main.expertMode ? 0.2f : 0.1f; + float velocity = CalamityWorld.death ? 6.25f : Main.expertMode ? 5f : 3f; // Simple movement AI. You shouldn't need any help from comments to parse this. if (npc.Center.X < Main.player[npc.target].position.X) diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 93ae4067f9..12220297eb 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -203,7 +203,6 @@ namespace CalamityMod.NPCs.Yharon // Variables bool bossRush = BossRushEvent.BossRushActive; bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; bool revenge = CalamityWorld.revenge || bossRush; bool death = CalamityWorld.death || bossRush; @@ -217,7 +216,7 @@ namespace CalamityMod.NPCs.Yharon // Start phase 2 or not if (startSecondAI) { - Yharon_AI2(expertMode, masterMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC, setDamage); + Yharon_AI2(expertMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC, setDamage); return; } @@ -306,12 +305,12 @@ namespace CalamityMod.NPCs.Yharon float spinPhaseVelocity = 25f; float spinPhaseRotation = MathHelper.TwoPi * 3 / spinTime; - float increasedIdleTimeAfterBulletHell = (masterMode ? 120f : 180f) + phaseSwitchTimer; + float increasedIdleTimeAfterBulletHell = (death ? 120f : 180f) + phaseSwitchTimer; bool moveSlowerAfterBulletHell = NPC.ai[2] < 0f; bool slowChargeAfterBulletHell = NPC.ai[2] == -1f; if (moveSlowerAfterBulletHell) { - float reducedMovementMultiplier = MathHelper.Lerp(0.1f, masterMode ? 1f : 0.75f, (NPC.ai[2] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, death ? 1f : 0.75f, (NPC.ai[2] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); acceleration *= reducedMovementMultiplier; velocity *= reducedMovementMultiplier; chargeSpeed *= reducedMovementMultiplier; @@ -1620,7 +1619,7 @@ namespace CalamityMod.NPCs.Yharon } #region AI2 - public void Yharon_AI2(bool expertMode, bool masterMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC, int contactDamage) + public void Yharon_AI2(bool expertMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC, int contactDamage) { CalamityGlobalNPC.yharonP2 = NPC.whoAmI; @@ -1789,12 +1788,12 @@ namespace CalamityMod.NPCs.Yharon int flareDustSpawnDivisor = spinPhaseTimer / 10; int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); - float increasedIdleTimeAfterBulletHell = (masterMode ? 120f : 180f) + phaseSwitchTimer; + float increasedIdleTimeAfterBulletHell = (death ? 120f : 180f) + phaseSwitchTimer; bool moveSlowerAfterBulletHell = NPC.ai[1] < 0f; bool slowChargeAfterBulletHell = NPC.ai[1] == -1f; if (moveSlowerAfterBulletHell) { - float reducedMovementMultiplier = MathHelper.Lerp(0.1f, masterMode ? 1f : 0.75f, (NPC.ai[1] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, death ? 1f : 0.75f, (NPC.ai[1] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); acceleration *= reducedMovementMultiplier; velocity *= reducedMovementMultiplier; chargeSpeed *= reducedMovementMultiplier; @@ -3004,7 +3003,7 @@ namespace CalamityMod.NPCs.Yharon // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); } // Trophy (always directly from boss, never in bag) diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 5edab9f428..415b7653c4 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using CalamityMod.Graphics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -28,6 +29,27 @@ namespace CalamityMod.Particles private static List batchedNonPremultipliedParticles; private static List batchedAdditiveBlendParticles; + 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)); + public override void PostSetupContent() { Type baseParticleType = typeof(Particle); @@ -49,6 +71,8 @@ namespace CalamityMod.Particles texturePath = instance.Texture; particleTextures[ID] = ModContent.Request(texturePath, AssetRequestMode.ImmediateLoad).Value; }); + + On_Main.CheckMonoliths += DrawToTarget; } public override void Load() @@ -62,6 +86,13 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles = []; batchedNonPremultipliedParticles = []; batchedAdditiveBlendParticles = []; + + Main.QueueMainThreadAction(() => + { + PixelationTarget_AlphaBlend = new(true, CreatePixelTarget); + PixelationTarget_NonPremultiplied = new(true, CreatePixelTarget); + PixelationTarget_AdditiveBlend = new(true, CreatePixelTarget); + }); } public override void Unload() @@ -75,6 +106,8 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles = null; batchedNonPremultipliedParticles = null; batchedAdditiveBlendParticles = null; + + On_Main.CheckMonoliths -= DrawToTarget; } /// @@ -135,6 +168,90 @@ namespace CalamityMod.Particles particlesToKill.Add(particle); } + private static void DrawToTarget(On_Main.orig_CheckMonoliths orig) + { + if (Main.gameMenu) + { + 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(); + } + } + + private static void DrawPixelatedParticles() + { + 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) @@ -155,6 +272,9 @@ namespace CalamityMod.Particles if (particle == null) continue; + if (particle.Pixelate) + continue; + if (particle.UseAdditiveBlend) batchedAdditiveBlendParticles.Add(particle); else if (particle.UseHalfTransparency) @@ -233,6 +353,9 @@ namespace CalamityMod.Particles batchedNonPremultipliedParticles.Clear(); batchedAdditiveBlendParticles.Clear(); + // Draw all pixelated particles. + DrawPixelatedParticles(); + sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } diff --git a/Particles/Particle.cs b/Particles/Particle.cs index 41665cfd2d..0681436106 100644 --- a/Particles/Particle.cs +++ b/Particles/Particle.cs @@ -57,10 +57,17 @@ namespace CalamityMod.Particles 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. /// diff --git a/Particles/SquishyLightParticle.cs b/Particles/SquishyLightParticle.cs index ab80277fa6..39b1e87178 100644 --- a/Particles/SquishyLightParticle.cs +++ b/Particles/SquishyLightParticle.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public float Opacity; public float SquishStrenght; public float MaxSquish; diff --git a/Physics/Rope.cs b/Physics/Rope.cs new file mode 100644 index 0000000000..746495c53a --- /dev/null +++ b/Physics/Rope.cs @@ -0,0 +1,229 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.Physics; + +internal class Rope +{ + /// + /// A 0-1 interpolant which dictates a dampning factor for velocity integration increments. + /// + private float MovementSpeedDampingCoefficient + { + get; + set; + } + + /// + /// A timer that increments in respond to wind, assuming wind response is enabled in the . + /// + private float WindTime + { + get; + set; + } + + /// + /// The set of segments that compose this rope. + /// + public RopeSegment[] Segments + { + get; + set; + } + + /// + /// The set of positions that compose this rope. + /// + public Vector2[] SegmentPositions + { + get; + private set; + } + + /// + /// The desired distance between each segment on the rope. + /// + public float DistancePerSegment + { + get; + set; + } + + /// + /// The gravity force to exert on the rope when updating. + /// + public Vector2 Gravity + { + get; + set; + } + + /// + /// The amount of steps to perform when constraining tiles to their desired lengths. Higher values equate to greater accuracy, but reduced performance. + /// + public int ConstraintSteps + { + get; + private set; + } + + /// + /// Sets of settings that dictate how this rope should behave. + /// + public RopeSettings Settings + { + get; + set; + } + + /// + /// Whether this rope should collide with tiles or not. + /// + public bool InteractWithTiles => Settings.TileColliderArea is not null; + + public Rope(Vector2 start, Vector2 end, int segmentCount, float distancePerSegment, Vector2 gravity, RopeSettings settings, int constraintSteps = 10) + { + Segments = new RopeSegment[segmentCount]; + SegmentPositions = new Vector2[segmentCount]; + for (var i = 0; i < segmentCount; i++) + { + var segmentPos = Vector2.Lerp(start, end, i / (segmentCount - 1f)); + Segments[i] = new RopeSegment(segmentPos); + } + + Segments[0].FixedInPlace = settings.StartIsFixed; + Segments[^1].FixedInPlace = settings.EndIsFixed; + RecalculateSegmentPositions(); + + DistancePerSegment = distancePerSegment; + Gravity = gravity; + ConstraintSteps = constraintSteps; + + Settings = settings; + } + + /// + /// Recalculates the cache based on positions. + /// + private void RecalculateSegmentPositions() + { + for (var i = 0; i < Segments.Length; i++) + SegmentPositions[i] = Segments[i].Position; + } + + /// + /// Moves a given position around, obeying tile interaction rules if this rope requires them. + /// + /// The position vector to move. + /// The base velocity to consider. + private void Move(ref Vector2 position, Vector2 baseVelocity) + { + // Apply standard Eulerian integration if tile interactions are not required. + if (!InteractWithTiles || Settings.TileColliderArea is null) + { + position += baseVelocity; + return; + } + + // If tile interactions *are* required, handle them before moving forward. + var width = (int)Settings.TileColliderArea.Value.X; + var height = (int)Settings.TileColliderArea.Value.Y; + var newVelocity = Collision.noSlopeCollision(position, baseVelocity, width, height + 2, true, true); + newVelocity = Collision.noSlopeCollision(position, newVelocity, width, height, true, true); + var finalVelocity = baseVelocity; + if (Math.Abs(baseVelocity.X) > Math.Abs(newVelocity.X)) + finalVelocity.X = 0f; + if (Math.Abs(baseVelocity.Y) > Math.Abs(newVelocity.Y)) + finalVelocity.Y = 0f; + + position += finalVelocity; + } + + /// + /// Updates this rope, making it move around. + /// + public void Update() + { + for (var i = 0; i < Segments.Length; i++) + { + var movementStep = (Segments[i].Position - Segments[i].OldPosition) * (1f - MovementSpeedDampingCoefficient); + if (movementStep.Length() < 0.02f) + movementStep = Vector2.Zero; + + Segments[i].OldPosition = Segments[i].Position; + + if (!Segments[i].FixedInPlace) + Move(ref Segments[i].Position, movementStep + Gravity); + } + + for (var i = 0; i < ConstraintSteps; i++) + Constrain(); + + RecalculateSegmentPositions(); + + if (Settings.RespondToEntityMovement) + HandleEntityMovementResponse(); + if (Settings.RespondToWind) + HandleWindResponse(); + } + + /// + /// Makes this rope respond to the movement of entities. + /// + private void HandleEntityMovementResponse() + { + for (var i = 0; i < Segments.Length; i++) + { + ref RopeSegment ropeSegment = ref Segments[i]; + if (ropeSegment.FixedInPlace) + continue; + + foreach (var player in Main.ActivePlayers) + { + float playerProximityInterpolant = Utils.GetLerpValue(37f, 10f, player.Distance(ropeSegment.Position), true); + ropeSegment.Position += player.velocity * playerProximityInterpolant / Settings.Mass * 0.08f; + } + } + } + + /// + /// Makes this entity respond to wind. + /// + private void HandleWindResponse() + { + WindTime += Main.windSpeedCurrent / 60f; + if (MathF.Abs(WindTime) >= 4000f) + WindTime = 0f; + + var windSpeed = Math.Clamp(Main.WindForVisuals * 2f, -1.3f, 1.3f); + var windWave = MathF.Cos(WindTime * 3.42f + Segments[0].Position.Length() * 0.06f); + var wind = Vector2.UnitX * (windWave + Main.windSpeedCurrent) * -0.2f; + + Segments[^1].Position += wind * Utils.GetLerpValue(0.3f, 0.75f, windSpeed, true) / Settings.Mass; + } + + /// + /// Constrains segments on this rope, conserving their overall length. + /// + public void Constrain() + { + for (var i = 0; i < Segments.Length - 1; i++) + { + // Determine how much each segment has to move in order to return to its desired resting distance. + var segmentLength = Segments[i].Position.Distance(Segments[i + 1].Position); + var distanceFromIdealLength = segmentLength - DistancePerSegment; + Vector2 correctiveForce = (Segments[i].Position - Segments[i + 1].Position).SafeNormalize(Vector2.Zero) * distanceFromIdealLength; + + var pinned = Segments[i].FixedInPlace; + var nextPinned = Segments[i + 1].FixedInPlace; + correctiveForce *= pinned || nextPinned ? 1f : 0.5f; + + if (!pinned) + Move(ref Segments[i].Position, -correctiveForce); + if (!nextPinned) + Move(ref Segments[i + 1].Position, correctiveForce); + } + } +} diff --git a/Physics/RopeHandle.cs b/Physics/RopeHandle.cs new file mode 100644 index 0000000000..4b5c03570f --- /dev/null +++ b/Physics/RopeHandle.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Physics; + +// Yes, I was silently reading over the Nightshade dev channels when learning about this. +// So, thanks Tomat and 1-3 for the idea! -Lucille +/// +/// A handle that contains a reference to a given globally managed rope instance. +/// +public readonly struct RopeHandle +{ + /// + /// The value used to identify this handle's associated rope managed by the central system. + /// + private readonly int Identifier; + + /// + /// The rope associated with this handle. + /// + private readonly Rope Rope => ModContent.GetInstance().Ropes[Identifier]!; + + /// + /// The set of all positions maintained by the underlying rope. + /// + public readonly IEnumerable Positions => Rope.SegmentPositions; + + /// + /// The amount of segments this rope has. + /// + public int SegmentCount => Rope.Segments.Length; + + /// + /// The starting position of the underlying rope. + /// + public ref Vector2 Start => ref Rope.Segments[0].Position; + + /// + /// The ending position of the underlying rope. + /// + public ref Vector2 End => ref Rope.Segments[^1].Position; + + /// + /// The gravity associated with the rope. + /// + public Vector2 Gravity + { + get => Rope.Gravity; + set => Rope.Gravity = value; + } + + internal RopeHandle(int identifier) => Identifier = identifier; + + /// + /// Forces this rope to settle by performing a series of constrained updates. + /// + public void Settle() + { + for (var i = 0; i < 20; i++) + Rope.Update(); + } + + /// + /// Indicates that the rope associated with this handle should be returned back to the pool. + /// + public void Dispose() + { + var chunkIndex = Identifier / RopeManagerSystem.BitsPerChunk; + var bitIndex = Identifier % RopeManagerSystem.BitsPerChunk; + ModContent.GetInstance().ToggleActivityIndex(chunkIndex, bitIndex); + } +} diff --git a/Physics/RopeManagerSystem.cs b/Physics/RopeManagerSystem.cs new file mode 100644 index 0000000000..0192cd3c48 --- /dev/null +++ b/Physics/RopeManagerSystem.cs @@ -0,0 +1,132 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using BitOperations = System.Numerics.BitOperations; + +namespace CalamityMod.Physics; + +public sealed class RopeManagerSystem : ModSystem +{ + /// + /// The set of all maintained ropes in the world. + /// + internal readonly Rope[] Ropes = new Rope[MaxRopeCount]; + + /// + /// The internal binary mappings that determine whether ropes are active or not. + /// + internal readonly ulong[] ActivityBitChunks = new ulong[(int)Math.Ceiling((double)MaxRopeCount / BitsPerChunk)]; + + /// + /// The maximum amount of ropes to maintain across the world. + /// + public const int MaxRopeCount = 2048; + + /// + /// The amount of bits contained within each chunk in the array. + /// + public const int BitsPerChunk = sizeof(ulong) * 8; + + public override void ClearWorld() + { + for (var i = 0; i < ActivityBitChunks.Length; i++) + ActivityBitChunks[i] = 0uL; + } + + public override void PostUpdateWorld() + { + for (var i = 0; i < Ropes.Length; i++) + { + var bitIndex = i % BitsPerChunk; + var active = (ActivityBitChunks[i / BitsPerChunk] >> bitIndex & 1) == 1; + if (active) + Ropes[i].Update(); + } + } + + /// + /// Toggles a given activity index. + /// + /// The index of the to toggle. + /// The bit index in the chunk to toggle. + internal void ToggleActivityIndex(int chunkIndex, int bitIndex) => ActivityBitChunks[chunkIndex] ^= 1uL << bitIndex; + + /// + /// Attempts to find and return the first available index for a new rope. + /// + private int? SelectFirstAvailableIndex() + { + for (var i = 0; i < ActivityBitChunks.Length; i++) + { + // This comment can be deleted later if it's deemed a bit too verbose. I'm half doing it for myself to test my understanding, half doing it for any future readers who might + // not immediately understand what the bit operations do here. -Lucille + + // As a simplified example, assume the following for the activity bits, where zero means inactive and one means active: + // 0110 1111 + + // This means the first four indices are occupied, but the fifth index is free. Note that in this case bits are counted from right to left. + // In order to find the first new index, we simply need to count the amount of ones until the first zero. + // Conveniently, BitOperations.TrailingZeroCount exists for this purpose. We just need to invert the binary in order to convert the ones into zeroes. + var offset = BitOperations.TrailingZeroCount(~ActivityBitChunks[i]); + + // Check if the index offset is equal to the amount of bits in the chunk. + // If so, that means that every single bit is a one, and that there's no available index in the chunk to use. + var allBitsAreOccupied = offset == BitsPerChunk; + if (allBitsAreOccupied) + continue; + + return offset + i * BitsPerChunk; + } + + // No valid index found across the activity bit chunks. Return null. + return null; + } + + /// + /// Requests a new rope, returning a handle to it, or null if for some reason the rope couldn't be created. + /// + public RopeHandle? RequestNew(Vector2 start, Vector2 end, int segmentCount, float distancePerSegment, Vector2 gravity, RopeSettings settings, int constraintSteps = 10) + { + var index = SelectFirstAvailableIndex(); + if (index is null) + return null; + + // Mark the newly selected index as active by toggling its activity state on. + ToggleActivityIndex(index.Value / BitsPerChunk, index.Value % BitsPerChunk); + + Ropes[index.Value] = new Rope(start, end, segmentCount, distancePerSegment, gravity, settings, constraintSteps); + + return new RopeHandle(index.Value); + } + + /// + /// Calculates the overall segment length of a rope based on the horizontal span between its two end points and a desired sag distance. + /// + public static float CalculateSegmentLength(float ropeSpan, float sag, int iterations = 12) + { + // A rope at rest is defined via a catenary curve, which exists in the following mathematical form: + // y(x) = a * cosh(x / a) + + // Furthermore, the length of a rope, given the horizontal width w for a rope, is defined as follows: + // L = 2a * sinh(w / 2a) + + // In order to use the above equation, the value of a must be determined for the catenary that this rope will form. + // To do so, a numerical solution will need to be found based on the known width and sag values. + + // Suppose the two supports are at equal height at distances -w/2 and w/2. + // From this, sag (which will be denoted with h) can be defined in the following way: h = y(w/2) - y(0) + // Reducing this results in the following equation: + + // h = a(cosh(w / 2a) - 1) + // a(cosh(w / 2a) - 1) - h = 0 + // This can be used to numerically find a. + var initialGuessA = sag; + var a = (float)CalamityUtils.IterativelySearchForRoot(x => + { + return x * (Math.Cosh(ropeSpan / (x * 2D)) - 1D) - sag; + }, initialGuessA, iterations); + + // Now that a is known, it's just a matter of plugging it back into the original equation to find L. + return MathF.Sinh(ropeSpan / a * 0.5f) * a * 2f; + } +} diff --git a/Physics/RopeSegment.cs b/Physics/RopeSegment.cs new file mode 100644 index 0000000000..81cb8708de --- /dev/null +++ b/Physics/RopeSegment.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Physics; + +/// +/// A representation of a rope segment, containing physical data such as position, velocity, etc., as well as a value which determines whether the rope is fixed in place and not subject to standard physics. +/// +public struct RopeSegment +{ + /// + /// The current position of this segment. + /// + public Vector2 Position; + + /// + /// The previous position of this segment. + /// + public Vector2 OldPosition; + + /// + /// Whether this segment is fixed in place and not subject to standard physics, such as gravity. + /// + public bool FixedInPlace; + + public RopeSegment(Vector2 position) + { + Position = position; + OldPosition = position; + } +} diff --git a/Physics/RopeSettings.cs b/Physics/RopeSettings.cs new file mode 100644 index 0000000000..133e1bc4f0 --- /dev/null +++ b/Physics/RopeSettings.cs @@ -0,0 +1,11 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Physics; + +public readonly record struct RopeSettings(bool StartIsFixed, bool EndIsFixed, bool RespondToEntityMovement, bool RespondToWind, Vector2? TileColliderArea, float Mass = 1f) +{ + public RopeSettings() : this(false, false, false, false, null, 1f) + { + + } +} diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs index a47ffe9a87..4c9237af5b 100644 --- a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs @@ -13,6 +13,7 @@ using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.Audio; +using System; namespace CalamityMod.Projectiles.BaseProjectiles { @@ -269,8 +270,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.timeLeft = swingTime * 2; if (UsesBaseItem) { - Projectile.width = BaseItem.width; - Projectile.height = BaseItem.height; + Projectile.width = Projectile.height = Math.Max(BaseItem.height,BaseItem.width); } Projectile.friendly = true; Projectile.penetrate = -1; diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index b69a56ddd3..0913198f87 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -153,8 +153,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index a0abed02ee..2b2c2d18c1 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -103,8 +103,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index 81d2d736db..c734f9520a 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -84,8 +84,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index f97ab9edf4..9ae84d9397 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -284,7 +284,7 @@ namespace CalamityMod.Projectiles.Boss if (Colliding(Projectile.Hitbox, player.Hitbox) == false) return false; - // Applies Vulnerability Hex and/or the effects of Supreme Cirrus' HAGE faces. + // Applies Vulnerability Hex and/or the effects of Supreme Permafrost's HAGE faces. OnHitPlayer_Internal(player); // Check the player's speed. If they are moving fast enough, damage them more severely; this prevents trying to rush straight through the vortex. @@ -341,12 +341,12 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(ModContent.BuffType(), 360, true); - // Remove all positive buffs from the player if they're hit by HAGE while Cirrus is alive. + // Remove all positive buffs from the player if they're hit by HAGE while Permafrost is alive. if (CalamityGlobalNPC.SCal != -1) { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) { for (int l = 0; l < Player.MaxBuffs; l++) { @@ -407,8 +407,8 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - bool isCirrus = CalamityGlobalNPC.SCal != -1 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; - if (isCirrus) + bool isPermafrost = CalamityGlobalNPC.SCal != -1 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost; + if (isPermafrost) { Texture2D hageTex = ModContent.Request("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value; lightColor.B = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index a524d96893..2e5f49310d 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -87,8 +87,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/DesertScourgeSpit.cs b/Projectiles/Boss/DesertScourgeSpit.cs index a7e4915e0e..15b83a8c5d 100644 --- a/Projectiles/Boss/DesertScourgeSpit.cs +++ b/Projectiles/Boss/DesertScourgeSpit.cs @@ -65,7 +65,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha < 0) Projectile.alpha = 0; - int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); + int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.YellowTorch, 0f, 0f, 100, default, 1f); Main.dust[sandyDust].noGravity = true; Main.dust[sandyDust].velocity *= 0f; } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 3c191e8a20..2c3b539632 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - float maxVelocity = Projectile.ai[0] == 0f ? 7f : (Main.masterMode || BossRushEvent.BossRushActive) ? 13f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; + float maxVelocity = Projectile.ai[0] == 0f ? 7f : BossRushEvent.BossRushActive ? 13f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; if (Math.Abs(Projectile.velocity.X) < maxVelocity) Projectile.velocity.X *= 1.05f; diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs index 2c080802a1..8865901223 100644 --- a/Projectiles/Boss/HomingGasBulb.cs +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Projectile.localAI[0] == 0f) { @@ -49,9 +49,9 @@ namespace CalamityMod.Projectiles.Boss int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); Vector2 velocity = Main.player[closestPlayer].Center - Projectile.Center; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (masterMode ? 0f : 30f)) + if (Projectile.ai[0] >= (death ? 0f : 30f)) { - if (Projectile.ai[0] < (masterMode ? 210f : 150f)) + if (Projectile.ai[0] < (death ? 210f : 150f)) { float scaleFactor2 = Projectile.velocity.Length(); velocity.Normalize(); @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss } } - if (Projectile.ai[0] % (masterMode ? 10f : 20f) == 0f) + if (Projectile.ai[0] % (death ? 10f : 20f) == 0f) { int dustType = 73; int totalDust = 12; diff --git a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs b/Projectiles/Boss/PermafrostAbsoluteZeroProjectile.cs similarity index 78% rename from Projectiles/Boss/CirrusPhotonRipperProjectile.cs rename to Projectiles/Boss/PermafrostAbsoluteZeroProjectile.cs index c7363796be..c0994c21f9 100644 --- a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs +++ b/Projectiles/Boss/PermafrostAbsoluteZeroProjectile.cs @@ -9,13 +9,13 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusPhotonRipperProjectile : ModProjectile, ILocalizedModType + public class PermafrostAbsoluteZeroProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Melee/PhotonRipperProjectile"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/AbsoluteZero"; - public NPC Cirrus => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; + public NPC Permafrost => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; public const float ZeroChargeDamageRatio = 0.36f; public const float ToothDamageRatio = 0.1666667f; public const int ToothShootRate = 5; // One chainsaw tooth is emitted every this many frames. @@ -44,36 +44,33 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask").Value; - Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, Projectile.frame); Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); - Main.EntitySpriteDraw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.HotPink, Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } public override void AI() { - // Die if Cirrus disappears. - if (Cirrus is null || !Cirrus.active) + // Die if Permafrost disappears. + if (Permafrost is null || !Permafrost.active) { Projectile.Kill(); return; } - // Die if Cirrus shouldn't be using it. - int cirrusBulletHellCounter = Cirrus.ModNPC().bulletHellCounter2; - if (!(cirrusBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && - !(cirrusBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) + // Die if Permafrost shouldn't be using it. + int permafrostBulletHellCounter = Permafrost.ModNPC().bulletHellCounter2; + if (!(permafrostBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && + !(permafrostBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) { Projectile.Kill(); return; } - Projectile.damage = SupremeCalamitas.CirrusPhotonRipperDamage; + Projectile.damage = SupremeCalamitas.PermafrostAbsoluteZeroDamage; DetermineDamage(); PlayChainsawSounds(); @@ -81,14 +78,14 @@ namespace CalamityMod.Projectiles.Boss // Determines the owner's position whilst incorporating their fullRotation field. // It uses vector transformation on a Z rotation matrix based on said rotation under the hood. // This is essentially just the pure mathematical definition of the RotatedBy method. - Vector2 cirrusRotatedPosition = Cirrus.Center; - float rotation = Cirrus.rotation; - Vector2 vector = Cirrus.Bottom + new Vector2(0f, Cirrus.gfxOffY); + Vector2 permafrostRotatedPosition = Permafrost.Center; + float rotation = Permafrost.rotation; + Vector2 vector = Permafrost.Bottom + new Vector2(0f, Permafrost.gfxOffY); Vector2 vector2 = new Vector2(0f, -4f) + new Vector2(0f, 4f).RotatedBy(rotation); - cirrusRotatedPosition.Y += Cirrus.gfxOffY; - cirrusRotatedPosition = vector + (cirrusRotatedPosition - vector).RotatedBy(rotation) + vector2; - HandleMovement(cirrusRotatedPosition); - DetermineVisuals(cirrusRotatedPosition); + permafrostRotatedPosition.Y += Permafrost.gfxOffY; + permafrostRotatedPosition = vector + (permafrostRotatedPosition - vector).RotatedBy(rotation) + vector2; + HandleMovement(permafrostRotatedPosition); + DetermineVisuals(permafrostRotatedPosition); EmitPrettyDust(); if (Time % ToothShootRate == ToothShootRate - 1f) @@ -129,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss } } - public void DetermineVisuals(Vector2 cirrusRotatedPosition) + public void DetermineVisuals(Vector2 permafrostRotatedPosition) { float directionAngle = Projectile.velocity.ToRotation(); Projectile.rotation = directionAngle; @@ -146,8 +143,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection != oldDirection) Projectile.rotation -= MathHelper.Pi; - // Positioning close to the Cirrus' arm. - Projectile.position = cirrusRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; + // Positioning close to the Permafrost's arm. + Projectile.position = permafrostRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. // It is reset on the next frame. @@ -164,9 +161,9 @@ namespace CalamityMod.Projectiles.Boss } } - public void HandleMovement(Vector2 cirrusRotatedPosition) + public void HandleMovement(Vector2 permafrostRotatedPosition) { - Vector2 idealAimDirection = (Main.player[Cirrus.target].Center - cirrusRotatedPosition).SafeNormalize(Vector2.UnitX * Cirrus.direction); + Vector2 idealAimDirection = (Main.player[Permafrost.target].Center - permafrostRotatedPosition).SafeNormalize(Vector2.UnitX * Permafrost.direction); float angularAimVelocity = 0.03f; float directionAngularDisparity = Projectile.velocity.AngleBetween(idealAimDirection) / MathHelper.Pi; @@ -179,7 +176,7 @@ namespace CalamityMod.Projectiles.Boss else Projectile.velocity = idealAimDirection; - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Cirrus.direction); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Permafrost.direction); } public void EmitPrettyDust() @@ -213,7 +210,7 @@ namespace CalamityMod.Projectiles.Boss return; float shootReach = MathHelper.SmoothStep(Projectile.width * 1.8f, Projectile.width * 5.3f + 16f, ChargeUpPower); - float distanceFromTarget = Cirrus.Distance(Main.player[Cirrus.target].Center); + float distanceFromTarget = Permafrost.Distance(Main.player[Permafrost.target].Center); // If the distance to the mouse is less than the base reach, reach only to mouse. // This way the player can more directly control the crystals if they want. @@ -227,7 +224,7 @@ namespace CalamityMod.Projectiles.Boss shootReach = 72f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Cirrus.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Permafrost.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/CirrusBlast.cs b/Projectiles/Boss/PermafrostBlast.cs similarity index 98% rename from Projectiles/Boss/CirrusBlast.cs rename to Projectiles/Boss/PermafrostBlast.cs index 37c926aaa8..006e71ce8e 100644 --- a/Projectiles/Boss/CirrusBlast.cs +++ b/Projectiles/Boss/PermafrostBlast.cs @@ -12,7 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusBlast : BaseLaserbeamProjectile, ILocalizedModType + public class PermafrostBlast : BaseLaserbeamProjectile, ILocalizedModType { // Modified clone of Seraphim's Laser public new string LocalizationCategory => "Projectiles.Boss"; diff --git a/Projectiles/Boss/CirrusBlaster.cs b/Projectiles/Boss/PermafrostBlaster.cs similarity index 90% rename from Projectiles/Boss/CirrusBlaster.cs rename to Projectiles/Boss/PermafrostBlaster.cs index ab60a0adc6..553ba53539 100644 --- a/Projectiles/Boss/CirrusBlaster.cs +++ b/Projectiles/Boss/PermafrostBlaster.cs @@ -7,11 +7,11 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusBlaster : ModProjectile, ILocalizedModType + public class PermafrostBlaster : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Alcohol/OddMushroom"; + public override string Texture => "CalamityMod/Items/Accessories/PermafrostsConcoction"; public static readonly SoundStyle SANSCharge = new("CalamityMod/Sounds/Custom/Ravager/GasterBlasterCharge"); public static readonly SoundStyle SANSFire = new("CalamityMod/Sounds/Custom/Ravager/GasterBlasterFire"); public Vector2 storedVelocity; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.ai[0] = 90f; if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, storedVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[1], Projectile.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, storedVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[1], Projectile.whoAmI); SoundEngine.PlaySound(SANSFire, Projectile.Center); // Funny Gaster Blaster sounds #2 } diff --git a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs b/Projectiles/Boss/PermafrostColdheartIcicle.cs similarity index 81% rename from Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs rename to Projectiles/Boss/PermafrostColdheartIcicle.cs index 9a06af2a88..f58b5d3119 100644 --- a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs +++ b/Projectiles/Boss/PermafrostColdheartIcicle.cs @@ -1,5 +1,5 @@ using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; @@ -12,15 +12,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusPhotonRipperPrismTooth : ModProjectile, ILocalizedModType + public class PermafrostColdheartIcicle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Melee/PrismTooth"; + public override string Texture => "CalamityMod/Items/ColdheartIcicle"; public const int Lifetime = 80; - public NPC Cirrus => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; + public NPC Permafrost => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; public ref float ShootReach => ref Projectile.ai[0]; @@ -48,17 +48,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // Die if Cirrus disappears. - if (Cirrus is null || !Cirrus.active) + // Die if Permafrost disappears. + if (Permafrost is null || !Permafrost.active) { Projectile.Kill(); return; } - // Die if Cirrus shouldn't be using it. - int cirrusBulletHellCounter = Cirrus.ModNPC().bulletHellCounter2; - if (!(cirrusBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && - !(cirrusBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) + // Die if Permafrost shouldn't be using it. + int permafrostBulletHellCounter = Permafrost.ModNPC().bulletHellCounter2; + if (!(permafrostBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && + !(permafrostBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) { Projectile.Kill(); return; @@ -82,13 +82,13 @@ namespace CalamityMod.Projectiles.Boss // In this context, the velocity is simply the initial direction as a unit vector- it does not actually influence movement in any way. positionOffset = positionOffset.RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver2); - Vector2 cirrusRotatedPosition = Cirrus.Center; - float rotation = Cirrus.rotation; - Vector2 vector = Cirrus.Bottom + new Vector2(0f, Cirrus.gfxOffY); + Vector2 permafrostRotatedPosition = Permafrost.Center; + float rotation = Permafrost.rotation; + Vector2 vector = Permafrost.Bottom + new Vector2(0f, Permafrost.gfxOffY); Vector2 vector2 = new Vector2(0f, -4f) + new Vector2(0f, 4f).RotatedBy(rotation); - cirrusRotatedPosition.Y += Cirrus.gfxOffY; - cirrusRotatedPosition = vector + (cirrusRotatedPosition - vector).RotatedBy(rotation) + vector2; - Projectile.Center = cirrusRotatedPosition + Projectile.velocity * 42f + positionOffset; + permafrostRotatedPosition.Y += Permafrost.gfxOffY; + permafrostRotatedPosition = vector + (permafrostRotatedPosition - vector).RotatedBy(rotation) + vector2; + Projectile.Center = permafrostRotatedPosition + Projectile.velocity * 42f + positionOffset; Projectile.Opacity = Utils.GetLerpValue(0f, 12f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 12f, Lifetime - Projectile.timeLeft, true); // Destroy trees within the range of the past 20 oldPos positions. @@ -127,11 +127,11 @@ namespace CalamityMod.Projectiles.Boss AchievementsHelper.CurrentlyMining = false; } - public override Color? GetAlpha(Color lightColor) => Color.HotPink; + public override Color? GetAlpha(Color lightColor) => Color.Cyan; internal float WidthFunction(float completionRatio) => Projectile.scale * 24f * (1f - Utils.GetLerpValue(0.7f, 1f, completionRatio, true)) + 1f; - internal Color ColorFunction(float completionRatio) => Color.HotPink * Projectile.Opacity; + internal Color ColorFunction(float completionRatio) => Color.Cyan * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { @@ -163,6 +163,6 @@ namespace CalamityMod.Projectiles.Boss // Prevent the crystals from utilizing velocity. Their movement is entirely dependant on Center setting. public override bool ShouldUpdatePosition() => false; - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); } } diff --git a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs b/Projectiles/Boss/PermafrostMeat.cs similarity index 55% rename from Projectiles/Boss/CirrusVolatileVodkaBottle.cs rename to Projectiles/Boss/PermafrostMeat.cs index 753d43bf97..d234a31fab 100644 --- a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs +++ b/Projectiles/Boss/PermafrostMeat.cs @@ -12,11 +12,11 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusVolatileVodkaBottle : ModProjectile, ILocalizedModType + public class PermafrostMeat : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Alcohol/CirrusVodka"; + public override string Texture => "CalamityMod/Items/Potions/DeliciousMeat"; public override void SetDefaults() { @@ -34,9 +34,14 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.ai[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item106, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f, Pitch = 0.3f }, Projectile.position); Projectile.ai[0] = 1f; } + if (Projectile.ai[1] == 0) + { + Projectile.aiStyle = -1; + Projectile.tileCollide = false; + } } public override bool PreDraw(ref Color lightColor) @@ -48,11 +53,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Shatter, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 0, default, 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceGolem, 0f, 0f, 0, default, 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -63,32 +68,33 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.BlueCosmilite, 0f, 0f, 0, default, 1.7f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceGolem, 0f, 0f, 0, default, 1.7f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 0, default, 1f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceGolem, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 2f; } - if (Projectile.owner == Main.myPlayer) + if (Projectile.ai[2] == 0) { - int totalProjectiles = 3; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - float velocity = 8f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - for (int k = 0; k < totalProjectiles; k++) + if (Projectile.owner == Main.myPlayer) { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Vector2.Normalize(velocity2) * 10f, velocity2, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer); - if (proj.WithinBounds(Main.maxProjectiles)) + int totalProjectiles = 3; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 8f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - Main.projectile[proj].DamageType = DamageClass.Default; - Main.projectile[proj].friendly = false; - Main.projectile[proj].hostile = true; + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Vector2.Normalize(velocity2) * 10f, velocity2, Type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer, ai2: 1); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].aiStyle = -1; + } } } } @@ -97,7 +103,6 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, Player.HurtInfo info) { Projectile.Kill(); - target.AddBuff(ModContent.BuffType(), 54000); } } } diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index 17595f148b..81036fdca1 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -168,8 +168,13 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index 4ac7522311..92d27f5bc5 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -153,8 +153,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index 22850fc1e5..ba195b1b8b 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; using CalamityMod.Skies; @@ -98,12 +99,12 @@ namespace CalamityMod.Projectiles.Boss NPC scal = CalamityUtils.SpawnBossBetter(spawnPosition, ModContent.NPCType()); if (Projectile.ai[1] == 1) { - scal.ModNPC().cirrus = true; + scal.ModNPC().permafrost = true; } } // Make a laugh sound and create a burst of brimstone dust. - SoundStyle SpawnSound = Projectile.ai[1] == 1 ? SoundID.Item107 : SupremeCalamitas.SpawnSound; + SoundStyle SpawnSound = Projectile.ai[1] == 1 ? Cryogen.DeathSound : SupremeCalamitas.SpawnSound; SoundEngine.PlaySound(SpawnSound, Projectile.Center); // Make a sudden screen shake. @@ -112,19 +113,19 @@ namespace CalamityMod.Projectiles.Boss // Generate a dust explosion at the ritual's position. for (int i = 0; i < 90; i++) { - Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1 ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1 ? DustID.IceGolem : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); spawnDust.noGravity = true; spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } for (int i = 0; i < 40; i++) { Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, true, true); + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), Projectile.ai[1] == 1 ? Color.Cyan : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb); } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Cyan : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Cyan : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60); GeneralParticleHandler.SpawnParticle(pulse2); } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index a26faea61e..da046e41d1 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -486,10 +486,10 @@ namespace CalamityMod.Projectiles // Accelerate if fired in a spread from Skeletron in Rev+ if (revSkeletronAcceleratingSkull) { - float maxVelocity = (Main.masterMode || BossRushEvent.BossRushActive) ? 20f : CalamityWorld.death ? 18f : 15f; + float maxVelocity = BossRushEvent.BossRushActive ? 20f : CalamityWorld.death ? 18f : 15f; if (projectile.velocity.Length() < maxVelocity) { - float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; + float acceleration = BossRushEvent.BossRushActive ? 1.02f : 1.015f; projectile.velocity *= acceleration; if (projectile.velocity.Length() > maxVelocity) { @@ -528,7 +528,7 @@ namespace CalamityMod.Projectiles num133 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; float homingStartTime = revSkeletronPrimeHomingSkull ? 10f : 30f; - float homingEndTime = (Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f; + float homingEndTime = BossRushEvent.BossRushActive ? 120f : CalamityWorld.death ? 105f : 90f; if (revSkeletronPrimeHomingSkull) homingEndTime += 60f; @@ -549,7 +549,7 @@ namespace CalamityMod.Projectiles } float maxVelocity = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 18f : 15f; - float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; + float acceleration = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; if (projectile.velocity.Length() < maxVelocity) projectile.velocity *= acceleration; @@ -1127,11 +1127,11 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; int num606 = 16; int num607 = 16; - float segmentScale = masterMode ? 2.5f : 2f; + float segmentScale = death ? 2.5f : 2f; int segmentWidth = 150; int segmentHeight = 42; @@ -1207,12 +1207,12 @@ namespace CalamityMod.Projectiles float segmentSpawnDelay = 10f; Projectile.NewProjectile(projectile.GetSource_FromThis(), center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, segmentSpawnDelay, projectile.ai[1] - 1f); - int sharkronSpawnGateValue = masterMode ? 2 : 3; + int sharkronSpawnGateValue = death ? 2 : 3; if ((int)projectile.ai[1] % sharkronSpawnGateValue == 0 && projectile.ai[1] != 0f) { int sharkron = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); Main.npc[sharkron].velocity = projectile.velocity; - Main.npc[sharkron].scale = masterMode ? 2f : 1.5f; + Main.npc[sharkron].scale = death ? 2f : 1.5f; Main.npc[sharkron].netUpdate = true; Main.npc[sharkron].ai[2] = projectile.width; Main.npc[sharkron].ai[3] = -1.5f; @@ -1770,7 +1770,7 @@ namespace CalamityMod.Projectiles int maxHealAmount = 20; // If the target has more than 250 max life, incorporate their total life into the max amount to heal. - // This is done so that more powerful NPCs, such as Cirrus, do not take an eternity to receive meaningful healing benefits + // This is done so that more powerful NPCs do not take an eternity to receive meaningful healing benefits // from the Nurse. if (npcToHeal.lifeMax > 250) maxHealAmount = (int)Math.Max(maxHealAmount, npcToHeal.lifeMax * 0.05f); @@ -2088,7 +2088,6 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (projectile.type == ProjectileID.DeerclopsIceSpike) @@ -2098,8 +2097,8 @@ namespace CalamityMod.Projectiles int numDust = 5; int numDust2 = 5; int fadeInTime = 50; - int fadeOutGateValue = masterMode ? 120 : death ? 90 : 65; - float killGateValue = masterMode ? 130f : death ? 100f : 75f; + int fadeOutGateValue = death ? 90 : 65; + float killGateValue = death ? 100f : 75f; int maxFrames = 5; bool fadeIn = projectile.ai[0] < (float)fadeInTime; @@ -2191,7 +2190,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[0] == projectile.ai[2]) { projectile.velocity *= 100f; - projectile.velocity *= (masterMode ? 20f : death ? 16f : 12f) + Main.rand.NextFloat() * 2f; + projectile.velocity *= (death ? 16f : 12f) + Main.rand.NextFloat() * 2f; } } else @@ -2318,7 +2317,7 @@ namespace CalamityMod.Projectiles } } - else if (projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && masterMode) + else if (projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && death) { int num = (int)(projectile.Center.X / 16f); int num2 = (int)(projectile.Center.Y / 16f); @@ -2332,8 +2331,8 @@ namespace CalamityMod.Projectiles } } - bool masterModeSkeletronPrimeHomingBomb = projectile.ai[0] == -1f; - bool masterModeSkeletronPrimeFallingBomb = projectile.ai[0] == -2f; + bool deathModeSkeletronPrimeHomingBomb = projectile.ai[0] == -1f; + bool deathModeSkeletronPrimeFallingBomb = projectile.ai[0] == -2f; int target = 0; target = Player.FindClosest(projectile.Center, 1, 1); @@ -2347,7 +2346,7 @@ namespace CalamityMod.Projectiles if (projectile.timeLeft < SkeletronPrime2.BombTimeLeft / 2 && projectile.timeLeft > 3) projectile.tileCollide = true; - if (masterModeSkeletronPrimeHomingBomb) + if (deathModeSkeletronPrimeHomingBomb) { projectile.ai[1] += 1f; float homingStartTime = 20f; @@ -2415,7 +2414,7 @@ namespace CalamityMod.Projectiles dust8.position = projectile.Center + new Vector2(0f, -projectile.height / 2 - 6).RotatedBy(projectile.rotation) * 1.1f; } - if (masterModeSkeletronPrimeFallingBomb) + if (deathModeSkeletronPrimeFallingBomb) { projectile.ai[2] += 1f; if (projectile.ai[2] > 60f) @@ -2431,13 +2430,13 @@ namespace CalamityMod.Projectiles { bool primeCannonProjectile = projectile.ai[1] == 2f; bool homeIn = false; - float homingTime = masterMode ? 80f : 140f; + float homingTime = 140f; float spreadOutCutoffTime = 510f; float homeInCutoffTime = spreadOutCutoffTime - homingTime; - float minAcceleration = masterMode ? 0.072f : 0.08f; - float maxAcceleration = masterMode ? 0.108f : 0.12f; - float homingVelocity = masterMode ? 22.5f : 25f; - float maxVelocity = masterMode ? 13.5f : 15f; + float minAcceleration = 0.08f; + float maxAcceleration = 0.12f; + float homingVelocity = 25f; + float maxVelocity = 15f; if (!primeCannonProjectile) { @@ -2466,7 +2465,7 @@ namespace CalamityMod.Projectiles projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); // Stop homing when within a certain distance of the target - if (Vector2.Distance(projectile.Center, Main.player[playerIndex].Center) < (masterMode ? 192f : 96f) && projectile.timeLeft > homeInCutoffTime) + if (Vector2.Distance(projectile.Center, Main.player[playerIndex].Center) < 96f && projectile.timeLeft > homeInCutoffTime) projectile.timeLeft = (int)homeInCutoffTime; } @@ -2544,7 +2543,7 @@ namespace CalamityMod.Projectiles projectile.alpha = 0; projectile.ai[0] += 1f; - if (projectile.ai[0] >= (masterMode ? 60f : 120f)) + if (projectile.ai[0] >= 120f) { if (projectile.velocity.Length() < 18f) projectile.velocity *= 1.01f; @@ -2582,7 +2581,7 @@ namespace CalamityMod.Projectiles { if (projectile.owner == Main.myPlayer) { - int totalProjectiles = masterMode ? 12 : 8; + int totalProjectiles = death ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileType(); float velocity = 1f; @@ -2623,9 +2622,9 @@ namespace CalamityMod.Projectiles else { int closestPlayer = Player.FindClosest(projectile.Center, 1, 1); - float homingSpeed = (masterMode ? 9f : 7.5f) + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; + float homingSpeed = 7.5f + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; Vector2 homingVelocity = Vector2.Normalize(Main.player[closestPlayer].Center - projectile.Center) * homingSpeed; - int inertia = masterMode ? 150 : 200; + int inertia = 200; projectile.velocity.X = (projectile.velocity.X * (inertia - 1) + homingVelocity.X) / inertia; if (projectile.velocity.Length() > 16f) @@ -2797,7 +2796,7 @@ namespace CalamityMod.Projectiles projectile.velocity *= scaleFactor2; // Fly away from other Ice Mists in Master - if (masterMode) + if (death) { float pushForce = 0.06f; float pushDistance = 120f; @@ -2826,7 +2825,7 @@ namespace CalamityMod.Projectiles } } - if (projectile.ai[0] % (masterMode ? 30f : 60f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (projectile.ai[0] % (death ? 30f : 60f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector50 = projectile.rotation.ToRotationVector2(); Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); @@ -3481,7 +3480,7 @@ namespace CalamityMod.Projectiles { int spreadOutTime = 90; if (projectile.timeLeft > EmpressLastingRainbowTotalDuration - spreadOutTime) - projectile.velocity *= ((Main.masterMode || BossRushEvent.BossRushActive) ? 1.017078f : 1.015525f); + projectile.velocity *= BossRushEvent.BossRushActive ? 1.017078f : 1.015525f; } // Zapinator lasers cannot trigger their damage multiplier more than once @@ -4330,7 +4329,6 @@ namespace CalamityMod.Projectiles if (projectile.hostile && (projectile.damage - flatDR <= 0)) return false; - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; switch (projectile.type) @@ -4340,7 +4338,7 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { float fadeInTime = 50f; - float fadeOutGateValue = masterMode ? 120f : death ? 90f : 65f; + float fadeOutGateValue = death ? 90f : 65f; return (projectile.ai[0] >= fadeInTime && projectile.ai[0] < fadeOutGateValue); } break; @@ -4351,9 +4349,9 @@ namespace CalamityMod.Projectiles return projectile.ai[0] > projectile.ai[2]; break; - // Additional slams in the Master Mode shockwave have a delay before expanding and dealing damage + // Additional slams in the Death Mode shockwave have a delay before expanding and dealing damage case ProjectileID.QueenSlimeSmash: - if (masterMode) + if (death) return projectile.ai[0] > 0f; break; @@ -4420,7 +4418,7 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.Skull && (projectile.ai[0] == -1f || projectile.ai[0] == -3f)) { - float homingTime = ((Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f); + float homingTime = BossRushEvent.BossRushActive ? 120f : CalamityWorld.death ? 105f : 90f; if (projectile.ai[0] == -3f) homingTime += 60f; @@ -4514,7 +4512,6 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.DeerclopsIceSpike && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Texture2D texture = TextureAssets.Projectile[projectile.type].Value; @@ -4522,8 +4519,8 @@ namespace CalamityMod.Projectiles Vector2 origin12 = new Vector2(16f, value26.Height / 2); Color alpha5 = projectile.GetAlpha(lightColor); Vector2 vector39 = new Vector2(projectile.scale); - float fadeOutGateValue = masterMode ? 120f : death ? 90f : 65f; - float killGateValue = masterMode ? 130f : death ? 100f : 75f; + float fadeOutGateValue = death ? 90f : 65f; + float killGateValue = death ? 100f : 75f; float lerpValue5 = Utils.GetLerpValue(killGateValue, killGateValue - 50f, projectile.ai[0], clamped: true); vector39.Y *= lerpValue5; Vector4 vector40 = lightColor.ToVector4(); @@ -4746,7 +4743,7 @@ namespace CalamityMod.Projectiles #region Pre Kill public override bool PreKill(Projectile projectile, int timeLeft) { - bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (Main.masterMode || BossRushEvent.BossRushActive); + bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (CalamityWorld.death || BossRushEvent.BossRushActive); bool revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death); bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f; @@ -4863,7 +4860,7 @@ namespace CalamityMod.Projectiles { int beeAmt = Main.rand.Next(2, 5 + 1); int totalBeesAlive = NPC.CountNPCS(NPCID.Bee) + NPC.CountNPCS(NPCID.BeeSmall); - int finalBeeAmtToSpawn = NPC.AnyNPCs(NPCID.QueenBee) ? Math.Min(beeAmt, (Main.masterMode ? 9 : 15) - totalBeesAlive) : NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); + int finalBeeAmtToSpawn = NPC.AnyNPCs(NPCID.QueenBee) ? Math.Min(beeAmt, (CalamityWorld.death ? 9 : 15) - totalBeesAlive) : NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); for (int i = 0; i < finalBeeAmtToSpawn; i++) { int beeType = Main.rand.NextBool() ? NPCID.Bee : NPCID.BeeSmall; @@ -4871,7 +4868,7 @@ namespace CalamityMod.Projectiles { beeType = Main.rand.NextBool(3) ? NPCType() : NPCType(); } - else if (Main.masterMode || BossRushEvent.BossRushActive) + else if (CalamityWorld.death || BossRushEvent.BossRushActive) { switch (Main.rand.Next(12)) { diff --git a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs index 45174b4fd5..8dc8930a27 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 origin = frame.Size() * 0.5f; Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); return false; } diff --git a/Projectiles/Enemy/PodobooSpitUltima.cs b/Projectiles/Enemy/PodobooSpitUltima.cs index 7deb4e24c0..f955aef998 100644 --- a/Projectiles/Enemy/PodobooSpitUltima.cs +++ b/Projectiles/Enemy/PodobooSpitUltima.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Vector2 overallOffset = Projectile.Size / 2; int numPoints = 92; PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); diff --git a/Projectiles/Healing/ManaPolarizerHealOrb.cs b/Projectiles/Healing/ManaPolarizerHealOrb.cs index c2dbdacf55..3e06d805f6 100644 --- a/Projectiles/Healing/ManaPolarizerHealOrb.cs +++ b/Projectiles/Healing/ManaPolarizerHealOrb.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Healing Projectile.penetrate = 1; Projectile.tileCollide = false; Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; + Projectile.extraUpdates = 5; } public override void AI() diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index e1da468182..f9c7c7e233 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 origin = texture.Size() * 0.5f; Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), 180); diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs deleted file mode 100644 index f1b2dc7525..0000000000 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class DivineRetributionSpear : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public Player Owner => Main.player[Projectile.owner]; - public ref float VelocityScale => ref Projectile.ai[0]; - public ref float Time => ref Projectile.ai[1]; - - public static float HomingSpeed => 20f; - public static float HomingTime => 15f; - public static float ReturnTime => 75f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 15; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 30; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.timeLeft = 210; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation(); - - Time++; - Projectile.Opacity = Utils.GetLerpValue(0f, 18f, Projectile.timeLeft, true); - Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.7f * Projectile.Opacity); - - if (Time % 2f == 1f) - { - Vector2 dustOffset = (Vector2.UnitY * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.05f) * 16f).RotatedBy(Projectile.velocity.ToRotation()); - Dust dust = Dust.NewDustPerfect(Projectile.Center + dustOffset, ModContent.DustType()); - dust.noGravity = true; - dust.noLightEmittence = true; - dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; - dust.scale = Main.rand.NextFloat(0.4f, 0.6f); - } - - NPC potentialTarget = Projectile.Center.ClosestNPCAt(Time >= ReturnTime ? 480f : 320f); - if (potentialTarget != null && Time >= HomingTime) - { - Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * HomingSpeed * VelocityScale; - Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; - Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); - return; - } - else if (Owner.active && !Owner.dead && Time >= ReturnTime) - { - Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * HomingSpeed * VelocityScale * (1.2f - Utils.GetLerpValue(800f, 160f, Vector2.Distance(Projectile.Center, Owner.MountedCenter), true)); - Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; - Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); - } - if (!Owner.active || Owner.dead || (Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 240f && Time >= ReturnTime)) - { - Projectile.timeLeft--; - if (!Owner.active || Owner.dead || Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 80f) - { - if (Projectile.timeLeft > 30) - Projectile.timeLeft = 30; - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D spear = TextureAssets.Projectile[Type].Value; - Vector2 drawPos = Projectile.Center - Main.screenPosition; - - float cLerp = Utils.GetLerpValue(210, 160, Projectile.timeLeft, true); - Color baseColor = Color.Lerp(Color.Goldenrod, new Color(255, 255, 150), cLerp) * Projectile.Opacity; - Color glowColor = Color.Lerp(Color.OrangeRed, Color.Orange, cLerp) * Projectile.Opacity; - - float squish = MathHelper.Clamp(Projectile.velocity.Length() * 0.04f, 0, 0.2f); - Vector2 scale = new Vector2(1f + squish, 1f - squish); - - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float completionRatio = i / (float)Projectile.oldPos.Length; - Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; - - Color trailColor = Color.Lerp(glowColor, Color.Black, completionRatio) * 0.35f; - Vector2 trailScale = scale * MathHelper.Lerp(1f, 0.15f, completionRatio); - - Main.EntitySpriteDraw(spear, trailPos, null, trailColor, Projectile.oldRot[i], spear.Size() * 0.5f, trailScale, SpriteEffects.None); - } - } - - for (int i = 0; i < 8; i++) - { - Vector2 offset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; - Main.EntitySpriteDraw(spear, drawPos + offset, null, Color.Lerp(baseColor, glowColor, 0.8f) * 0.5f, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); - } - Main.spriteBatch.ExitShaderRegion(); - - Main.EntitySpriteDraw(spear, drawPos, null, baseColor, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(96); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int i = 0; i < 9; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(5f, 5f)); - dust.noGravity = true; - dust.noLightEmittence = true; - dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; - dust.scale = Main.rand.NextFloat(0.8f, 1.4f); - } - } - } -} diff --git a/Projectiles/Magic/DivineRetributionSpear.png b/Projectiles/Magic/DivineRetributionSpear.png deleted file mode 100644 index c8b7e089ab..0000000000 Binary files a/Projectiles/Magic/DivineRetributionSpear.png and /dev/null differ diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs deleted file mode 100644 index 75521fc686..0000000000 --- a/Projectiles/Magic/FabBolt.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class FabBolt : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public bool FadingOut - { - get => Projectile.ai[0] == 1f; - set => Projectile.ai[0] = value.ToInt(); - } - - public override void SetStaticDefaults() - { - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = 23; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 2; - Projectile.penetrate = 12; - Projectile.timeLeft = 90 * Projectile.extraUpdates; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 0; - } - - public override void AI() - { - if (FadingOut) - { - Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.27f); - if (Projectile.Opacity <= 0.05f) - Projectile.Kill(); - } - else - Projectile.velocity *= 1.004f; - Projectile.rotation = Projectile.velocity.ToRotation(); - - // Emit light. - Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.45f); - } - - internal Color ColorFunction(float completionRatio) - { - float fadeToEnd = MathHelper.Lerp(0.25f, 0.5f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f); - fadeToEnd *= 1f - Utils.GetLerpValue(0.35f, 0f, completionRatio, true); - Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, Projectile.identity % 2); - return Color.Lerp(Color.White, endColor, fadeToEnd) * Projectile.Opacity * 0.7f; - } - - internal float WidthFunction(float completionRatio) - { - float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.GetLerpValue(0f, 0.2f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 22f, expansionCompletion) * Projectile.Opacity; - } - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 80); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (!FadingOut && Projectile.penetrate < 2) - { - FadingOut = true; - Projectile.velocity *= 0.1f; - Projectile.extraUpdates = 0; - Projectile.netUpdate = true; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (!FadingOut) - { - FadingOut = true; - Projectile.velocity *= 0.1f; - Projectile.extraUpdates = 0; - Projectile.netUpdate = true; - } - return false; - } - - public override bool? CanDamage() - { - if (FadingOut) - return false; - return null; - } - } -} diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs deleted file mode 100644 index 6afbdea101..0000000000 --- a/Projectiles/Magic/FabRay.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FabRay : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 54; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - Projectile.penetrate = 70; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 60 * Projectile.extraUpdates; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.2f, 0.01f, 0.1f); - Projectile.ai[0] += 1f; - Projectile.Opacity = Utils.GetLerpValue(0f, 10f * Projectile.MaxUpdates, Projectile.timeLeft, true); - - int shootRate = Projectile.npcProj ? 40 : 12; - if (Projectile.owner == Main.myPlayer && Projectile.ai[0] % shootRate == 0f) - { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(180f, false); - if (potentialTarget != null) - { - Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 13f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (p.WithinBounds(Main.maxProjectiles)) - { - if (Projectile.hostile) - { - Main.projectile[p].hostile = true; - Main.projectile[p].friendly = false; - Main.projectile[p].DamageType = DamageClass.Default; - } - } - } - - for (int i = 0; i < Projectile.oldPos.Length / 4; i += 3) - { - potentialTarget = Projectile.oldPos[i].ClosestNPCAt(280f, false); - if (potentialTarget != null) - { - Vector2 shootVelocity = (potentialTarget.Center - Projectile.oldPos[i]).SafeNormalize(Vector2.UnitY) * 13f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPos[i] - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (p.WithinBounds(Main.maxProjectiles)) - { - if (Projectile.hostile) - { - Main.projectile[p].hostile = true; - Main.projectile[p].friendly = false; - Main.projectile[p].DamageType = DamageClass.Default; - } - } - break; - } - } - } - - // Emit light. - if (!Projectile.hostile) - Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.7f); - } - - internal Color ColorFunction(float completionRatio) - { - float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity; - Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); - return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity; - } - - internal float WidthFunction(float completionRatio) - { - float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.GetLerpValue(0f, 0.3f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 32f * Projectile.Opacity, expansionCompletion); - } - - internal Vector2 OffsetFunction(float completionRatio) => Projectile.Size * 0.5f; - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, OffsetFunction, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.hostile) - target.AddBuff(ModContent.BuffType(), 54000); - } - } -} diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index b05ce18c1f..00e47bcca7 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -378,9 +378,9 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(endColor, Color.White, deathInterpolant); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + 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 c667a63398..055311f127 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -137,10 +137,10 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(startColor, bodyColor, completion); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { // Render the main trail for the body for the laser. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(LaserWidthFunction, LaserColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); // Render a smaller, pure white trail in the same position to represent condensed energy in the core of the laser. diff --git a/Projectiles/Magic/SHPS.cs b/Projectiles/Magic/SHPS.cs index 9ce66fce0c..bd02542b8b 100644 --- a/Projectiles/Magic/SHPS.cs +++ b/Projectiles/Magic/SHPS.cs @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(Color.White, tipColor, completion); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { // Render the main trail for the body for the soul. GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); @@ -242,7 +242,7 @@ namespace CalamityMod.Projectiles.Magic // Render a smaller, pure white trail in the same position to represent the glowing white core of the soul. Vector2[] soulCoreLength = Projectile.oldPos.Take(8).ToArray(); - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(soulCoreLength, new(SoulCoreWidthFunction, SoulCoreColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), soulCoreLength.Length * 2); } } diff --git a/Projectiles/Magic/SylvBolt.cs b/Projectiles/Magic/SylvBolt.cs new file mode 100644 index 0000000000..de43d1b0f9 --- /dev/null +++ b/Projectiles/Magic/SylvBolt.cs @@ -0,0 +1,155 @@ +using System; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class SylvBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + /// + /// The color hue interpolant for this bolt. + /// + public ref float HueInterpolant => ref Projectile.ai[0]; + + /// + /// How many natural frames have elapsed so far throughout the duration of this bolt's life. Extra updates do not affect this timer. + /// + public int Time + { + get => (int)Projectile.ai[1]; + set => Projectile.ai[1] = value; + } + + /// + /// Whether this bolt is vanishing due to the a collision. + /// + public bool Vanishing + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value.ToInt(); + } + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 23; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.extraUpdates = 2; + Projectile.penetrate = 12; + Projectile.timeLeft = Projectile.extraUpdates * 90; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; + } + + public override void AI() + { + Projectile.velocity *= 1.004f; + if (Vanishing) + Vanish(); + + if (Projectile.FinalExtraUpdate()) + Time++; + + Projectile.scale = Utils.GetLerpValue(0f, 7f, Time, true); + + CreateMagicDust(); + + // Emit light. + Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.45f); + } + + /// + /// Makes this bolt vanish. + /// + private void Vanish() + { + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.24f); + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + if (Projectile.Opacity <= 0.1f) + Projectile.Kill(); + } + + /// + /// Idly emits magic dust off this bolt. + /// + private void CreateMagicDust() + { + if (Main.rand.NextBool(4)) + { + Dust magic = Dust.NewDustPerfect(Projectile.Center, 264); + magic.color = ColorFunction(0f); + magic.scale *= 0.56f; + magic.noGravity = true; + } + } + + /// + /// The function responsible for dictating the color of this bolt. + /// + internal Color ColorFunction(float completionRatio) + { + float opacity = (1f - completionRatio) * Projectile.Opacity; + return CalamityUtils.MulticolorLerp(HueInterpolant, new Color(255, 193, 255), Color.White, new Color(127, 242, 255)) * opacity; + } + + /// + /// The function responsible for dictating the width of this bolt. + /// + internal float WidthFunction(float completionRatio) + { + float tip = 1f - MathF.Pow(1f - Utils.GetLerpValue(0.05f, 0.2f, completionRatio * Projectile.Opacity, true), 2f); + return tip * Projectile.Opacity * Projectile.scale * 22f; + } + + public override bool PreDraw(ref Color lightColor) + { + MiscShaderData boltShader = GameShaders.Misc["CalamityMod:SylvestaffProjectile"]; + + boltShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: boltShader), 80); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Vanishing && Projectile.penetrate < 2) + { + Vanishing = true; + Projectile.velocity *= 0.02f; + Projectile.extraUpdates = 0; + Projectile.netUpdate = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (!Vanishing) + { + Vanishing = true; + Projectile.velocity = Vector2.Zero; + Projectile.extraUpdates = 0; + Projectile.netUpdate = true; + } + return false; + } + + public override bool? CanDamage() => !Vanishing; + } +} diff --git a/Projectiles/Magic/SylvRay.cs b/Projectiles/Magic/SylvRay.cs new file mode 100644 index 0000000000..84bcfc66b4 --- /dev/null +++ b/Projectiles/Magic/SylvRay.cs @@ -0,0 +1,217 @@ +using System; +using System.IO; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SylvRay : ModProjectile, ILocalizedModType + { + /// + /// The position from which this ray's glow effect appears. + /// + public Vector2 GlowCenter + { + get; + set; + } + + /// + /// How many natural frames have elapsed so far throughout the duration of this ray's life. Extra updates do not affect this timer. + /// + public int Time + { + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; + } + + public new string LocalizationCategory => "Projectiles.Magic"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 54; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 70; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 60 * Projectile.extraUpdates; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.WriteVector2(GlowCenter); + + public override void ReceiveExtraAI(BinaryReader reader) => GlowCenter = reader.ReadVector2(); + + public override void AI() + { + if (Projectile.FinalExtraUpdate()) + Time++; + + Projectile.Opacity = Utils.GetLerpValue(0f, Projectile.MaxUpdates * 10f, Projectile.timeLeft, true); + Projectile.scale = Utils.GetLerpValue(1f, 9.5f, Time, true) * Projectile.Opacity; + + if (GlowCenter == Vector2.Zero) + GlowCenter = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 74f; + + HandleBoltFiring(); + CreateGlowyDust(); + + Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.7f); + } + + /// + /// Handles the firing of bolts across this ray. + /// + private void HandleBoltFiring() + { + int shootRate = Sylvestaff.RayBoltShootRate; + if (Time % shootRate == 0 && Projectile.FinalExtraUpdate()) + { + int trailSearchPositions = 13; + for (int i = 0; i < trailSearchPositions; i += 3) + TryToFireBolt(Projectile.oldPos[i] + Projectile.Size * 0.5f, i / (float)trailSearchPositions); + } + } + + /// + /// Attempts to fire a given bolt projectile from a given position at the closest enemy to said position, assuming one exists. + /// + private void TryToFireBolt(Vector2 searchPosition, float hue) + { + NPC potentialTarget = searchPosition.ClosestNPCAt(Sylvestaff.RayBoltTargetingRange, false); + if (potentialTarget is null) + return; + + SoundEngine.PlaySound(Sylvestaff.BounceSound with { MaxInstances = 12, Volume = 0.4f, Pitch = 0.4f }, Projectile.Center); + + float shootSpeed = Projectile.velocity.Length(); + Vector2 shootVelocity = (potentialTarget.Center - searchPosition).SafeNormalize(Vector2.UnitY) * shootSpeed; + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), searchPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, hue); + + float burstSpeed = Main.rand.NextFloat(1f, 3f); + for (int i = 0; i < 4; i++) + { + Dust magicBurst = Dust.NewDustPerfect(searchPosition, 264); + magicBurst.velocity = Projectile.velocity.RotatedBy(MathHelper.TwoPi * i / 4f + MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * burstSpeed; + magicBurst.color = Color.White; + magicBurst.noLight = true; + magicBurst.noGravity = true; + } + } + + /// + /// Emits dust particles at the glow center of this ray, to help sell the notion that it's appearing from a concentrated ball of queer magic energy. + /// + private void CreateGlowyDust() + { + if (Time <= 9 && Main.rand.NextBool()) + { + Color colorAccent = Main.rand.NextBool() ? Color.HotPink : Color.Aqua; + + Dust transMagic = Dust.NewDustPerfect(GlowCenter, 264); + transMagic.velocity = Main.rand.NextVector2Circular(4.6f, 4.6f) + Projectile.velocity * 0.25f; + transMagic.color = Color.Lerp(Color.White, colorAccent, Main.rand.NextFloat(0.23f)); + transMagic.scale *= 1.1f; + transMagic.fadeIn = 0.75f; + transMagic.noGravity = true; + } + } + + /// + /// The function responsible for dictating the color of this ray. + /// + internal Color ColorFunction(float completionRatio) + { + float opacity = MathF.Pow(Utils.GetLerpValue(1f, 0.64f, completionRatio, true), 3f) * Projectile.Opacity; + float colorInterpolant = MathF.Cos(MathHelper.Pi * completionRatio - Main.GlobalTimeWrappedHourly * 7.2f) * 0.5f + 0.5f; + + Color pink = new Color(255, 147, 255); + Color blue = new Color(109, 224, 255); + Color baseColor = CalamityUtils.MulticolorLerp(colorInterpolant, pink, Color.White, blue, Color.White); + + return baseColor * opacity; + } + + /// + /// The function responsible for dictating the width of this ray. + /// + internal float WidthFunction(float completionRatio) + { + float expansionCompletion = 1f - MathF.Pow(1f - Utils.GetLerpValue(0f, 0.3f, completionRatio, true), 2f); + float undulation = MathF.Cos(MathHelper.Pi * completionRatio * 5f - Main.GlobalTimeWrappedHourly * 23f) * 2.4f; + float maxWidth = undulation + 32f; + + return MathHelper.Lerp(0f, Projectile.scale * maxWidth, expansionCompletion); + } + + /// + /// The function responsible for dictating the render offset of this ray. + /// + internal Vector2 OffsetFunction(float completionRatio) => Projectile.Size * 0.5f; + + /// + /// Renders the front-glow for this ray, to help make it look like it has a defined origin of concentrated magic. + /// + private void RenderFrontGlow() + { + float glowAnimationProgress = Utils.GetLerpValue(0f, 9.5f, Time, true); + float glowBump = CalamityUtils.Convert01To010(glowAnimationProgress); + float glowRotation = Projectile.velocity.ToRotation(); + Vector2 glowScale = new Vector2(1f + glowBump * 0.8f, 1f) * glowBump; + + Vector2 startingPosition = GlowCenter - Main.screenPosition; + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/BloomCirclePinpoint").Value; + Main.spriteBatch.Draw(lightTexture, startingPosition, null, ColorFunction(0f) with { A = 0 }, glowRotation, lightTexture.Size() * 0.5f, glowScale, 0, 0f); + Main.spriteBatch.Draw(lightTexture, startingPosition, null, ColorFunction(0f) with { A = 0 }, glowRotation, lightTexture.Size() * 0.5f, glowScale * 0.4f, 0, 0f); + } + + public override bool PreDraw(ref Color lightColor) + { + RenderFrontGlow(); + + MiscShaderData rayShader = GameShaders.Misc["CalamityMod:SylvestaffProjectile"]; + rayShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, OffsetFunction, pixelate: false, shader: rayShader), 32); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.penetrate--; + if (Projectile.penetrate <= 0) + { + Projectile.Kill(); + } + else + { + SoundEngine.PlaySound(Sylvestaff.BounceSound, Projectile.Center); + + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + } +} diff --git a/Projectiles/Magic/SylvestaffHoldout.cs b/Projectiles/Magic/SylvestaffHoldout.cs new file mode 100644 index 0000000000..3109ae5bff --- /dev/null +++ b/Projectiles/Magic/SylvestaffHoldout.cs @@ -0,0 +1,262 @@ +using System; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Physics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SylvestaffHoldout : ModProjectile, IPixelatedPrimitiveRenderer + { + public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles | PixelationPrimitiveLayer.AfterPlayers; + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + + /// + /// The left ribbon on this holdout. + /// + public RopeHandle? LeftRibbon; + + /// + /// The right ribbon on this holdout. + /// + public RopeHandle? RightRibbon; + + /// + /// The player owner of this holdout staff. + /// + public Player Owner => Main.player[Projectile.owner]; + + /// + /// A general purpose, ever-increment timer used by this holdout staff. + /// + public ref float Time => ref Projectile.ai[0]; + + /// + /// The point of attachment for ribbons on this staff. + /// + public Vector2 RibbonAttachPoint => Projectile.Center + Projectile.velocity * Projectile.scale * Projectile.width * 0.34f; + + /// + /// The length of ribbons attached to this staff. + /// + private static float RibbonLength => 70f; + + public override string Texture => ModContent.GetInstance().Texture; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 94; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 72000; + } + + public override void AI() + { + if (!Owner.channel) + Projectile.Kill(); + + if (LeftRibbon is null && RightRibbon is null) + InitializeRibbons(); + + AimTowardsMouse(); + HandleHoldoutLogic(); + OrientOwnerArms(); + FireAwesomeMagicRays(); + UpdateRibbon(LeftRibbon, Projectile.velocity.RotatedBy(-MathHelper.PiOver2)); + UpdateRibbon(RightRibbon, Projectile.velocity.RotatedBy(MathHelper.PiOver2)); + + Time++; + } + + /// + /// Initializes the ribbons attached to this staff. + /// + private void InitializeRibbons() + { + int ribbonSegmentCount = 12; + float distancePerSegment = RibbonLength / ribbonSegmentCount; + RopeSettings ribbonSettings = new RopeSettings() + { + StartIsFixed = true, + Mass = 0.72f, + RespondToEntityMovement = true, + RespondToWind = true + }; + LeftRibbon = ModContent.GetInstance().RequestNew(RibbonAttachPoint, Projectile.Center, ribbonSegmentCount, distancePerSegment, Vector2.Zero, ribbonSettings, 25); + RightRibbon = ModContent.GetInstance().RequestNew(RibbonAttachPoint, Projectile.Center, ribbonSegmentCount, distancePerSegment, Vector2.Zero, ribbonSettings, 25); + } + + /// + /// Handles all logic pertaining to making this staff act as a holdout projectile. + /// + private void HandleHoldoutLogic() + { + Vector2 center = Owner.MountedCenter + Vector2.UnitY * 7f + Projectile.velocity * Projectile.width * 0.31f; + + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.RotatedRelativePoint(center) - Vector2.UnitY * Owner.gfxOffY; + Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); + + // The staff is a holdout projectile; change the player's variables to reflect this. + Owner.ChangeDir(Projectile.spriteDirection); + Owner.SetDummyItemTime(2); + Owner.heldProj = Projectile.whoAmI; + + Projectile.rotation += MathHelper.PiOver4; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.PiOver2; + } + + /// + /// Orients the owner player's arm rotation to help make it look like they're actually holding the staff. + /// + private void OrientOwnerArms() + { + float baseRotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + float directionVerticality = MathF.Abs(Projectile.velocity.X); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, baseRotation + Owner.direction * directionVerticality * MathHelper.PiOver4); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, baseRotation + Owner.direction * directionVerticality * 0.33f); + } + + /// + /// Makes this staff aim towards the owner's mouse. + /// + private void AimTowardsMouse() + { + if (Main.myPlayer != Projectile.owner) + return; + + Vector2 idealDirection = Projectile.SafeDirectionTo(Main.MouseWorld); + Vector2 newDirection = Vector2.Lerp(Projectile.velocity, idealDirection, Sylvestaff.TurnSpeedInterpolant).SafeNormalize(Vector2.UnitX * Owner.direction); + if (Projectile.velocity != newDirection) + { + Projectile.velocity = newDirection; + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + } + + /// + /// Updates a given ribbon. + /// + private void UpdateRibbon(RopeHandle? ribbon, Vector2 gravityDirection) + { + // Ensure that the handle is properly initialized before proceeding any further. + if (ribbon is not RopeHandle rope) + return; + + rope.Start = RibbonAttachPoint; + rope.Gravity = gravityDirection * 0.15f - Projectile.velocity * 0.4f; + } + + /// + /// Handles the firing of magic ray projectiles for this staff. + /// + private void FireAwesomeMagicRays() + { + Item heldItem = Owner.ActiveItem(); + if (heldItem is null) + return; + + if (Time % heldItem.useAnimation == heldItem.useAnimation - 1 && Owner.CheckMana(heldItem.mana, true)) + { + SoundEngine.PlaySound(Sylvestaff.FireSound, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + int damage = Owner.GetWeaponDamage(heldItem); + Vector2 shootVelocity = Projectile.velocity * heldItem.shootSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), damage, heldItem.knockBack, Projectile.owner); + + // Apply a minor amount of recoil. + Projectile.velocity -= Projectile.velocity.RotatedBy(Projectile.spriteDirection * MathHelper.PiOver2) * Sylvestaff.StaffRecoilForce; + } + } + } + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + { + bool backLayer = layer == PixelationPrimitiveLayer.BeforeProjectiles; + RenderRibbon(LeftRibbon, -1, backLayer); + RenderRibbon(RightRibbon, 1, backLayer); + } + + /// + /// The function responsible for dictating the width of this staff's ribbons. + /// + private float RibbonWidthFunction(float completionRatio) => Projectile.scale * Utils.GetLerpValue(0f, 0.2f, completionRatio, true) * 3.6f; + + /// + /// The function responsible for dictating the color of this staff's ribbons. + /// + private Color RibbonColorFunction(float completionRatio) + { + Color light = Lighting.GetColor(RibbonAttachPoint.ToTileCoordinates()); + return Projectile.GetAlpha(light); + } + + /// + /// Renders one of this staff's ribbons. + /// + private void RenderRibbon(RopeHandle? ribbon, int direction, bool backLayer) + { + // Ensure that the handle is properly initialized before proceeding any further. + if (ribbon is not RopeHandle rope) + return; + + Vector2 forwardDirection = Projectile.velocity; + Vector2 sideDirection = forwardDirection.RotatedBy(MathHelper.PiOver2 * direction); + Vector2 attachmentPoint = RibbonAttachPoint; + Vector2[] ribbonPositions = [.. rope.Positions]; + int positionCount = ribbonPositions.Length; + for (int i = 0; i < ribbonPositions.Length; i++) + { + float completionRatio = i / (float)positionCount; + float wave = MathF.Cos(MathHelper.Pi * completionRatio * 1.5f - MathHelper.TwoPi * Time / 97f) * completionRatio; + + Vector2 backwardsOffset = forwardDirection * i * -RibbonLength / positionCount; + Vector2 sideWavyOffset = sideDirection * wave * RibbonLength * 0.5f; + Vector2 rigidPosition = attachmentPoint + backwardsOffset + sideWavyOffset; + + ribbonPositions[i] = Vector2.Lerp(ribbonPositions[i], rigidPosition, 0.76f); + } + + Vector2 intersectionPosition = Vector2.Transform((Projectile.Center - Main.screenPosition) * 0.5f, Main.GameViewMatrix.TransformationMatrix); + MiscShaderData ribbonShader = GameShaders.Misc["CalamityMod:SylvestaffRibbon"]; + ribbonShader.UseShaderSpecificData(new Vector4(intersectionPosition.X, intersectionPosition.Y, sideDirection.X, sideDirection.Y)); + ribbonShader.UseSaturation(backLayer ? -1f : 1f); + + PrimitiveSettings primitiveSettings = new PrimitiveSettings(RibbonWidthFunction, RibbonColorFunction, pixelate: true, shader: ribbonShader); + PrimitiveRenderer.RenderTrail(ribbonPositions, primitiveSettings, 33); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, direction, 0f); + return false; + } + + public override void OnKill(int timeLeft) + { + LeftRibbon?.Dispose(); + RightRibbon?.Dispose(); + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index 3dbd357902..441f6044a2 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic } if (time > 3) - Projectile.Center += offset * direction; + Projectile.Center += offset * direction * Utils.GetLerpValue(3, 10, time, true); if (time > 3 && targetDist < 1400) { diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index 435863a8cc..4d74c2f4b1 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -145,9 +145,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.ExpandHitboxBy(400); Projectile.Damage(); - for (int k = 0; k < 12; k++) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + for (int k = 0; k < 12; k++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + } } for (int k = 0; k < 40; k++) { diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index d9a8f4bb10..2f72ac129f 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -312,7 +312,6 @@ namespace CalamityMod.Projectiles.Magic { switch (name) { - case "Fabsol": case "Ziggums": return 2f; case "Poly": diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs index 5d016effdc..85cb5f4a85 100644 --- a/Projectiles/Melee/GayBeam.cs +++ b/Projectiles/Melee/GayBeam.cs @@ -325,7 +325,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), TrailLength); diff --git a/Projectiles/Melee/MirrorBladeProjectile.cs b/Projectiles/Melee/MirrorBladeProjectile.cs index 72ec5b1fb4..b2710900a3 100644 --- a/Projectiles/Melee/MirrorBladeProjectile.cs +++ b/Projectiles/Melee/MirrorBladeProjectile.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee public override int swingWidth => 200; public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; public override int AfterImageLength => 10; - public override int OffsetDistance => 80; + public override int OffsetDistance => 90; public override bool drawSwordTrail => false; public override Color[] trailColors => new Color[] { Color.Red, Color.MediumPurple, Color.Purple }; public override int StartupTime { get; set; } public override int CooldownTime { get; set; } @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee public override int swingTime { get; set; } = 8; - public override SoundStyle? UseSound => SoundID.Item1 with {Volume = 0.7f}; + public override SoundStyle? UseSound => SoundID.Item71 with {Volume = 0.9f}; public List reflectedProjectiles = new List() { }; diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index de9eff766d..f1f50f29b6 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -239,6 +239,7 @@ namespace CalamityMod.Projectiles.Melee if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordClaymoreGlow"); Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; @@ -255,6 +256,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } return false; } diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index 715ba348bc..fbe8a21069 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -220,7 +220,7 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.25f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack, Projectile.owner, 0, 0, 7); spawnBoom = false; } diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 3938a7e9cc..249d92ad9a 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Melee internal Color ColorFunction(float completionRatio) => new Color(91, 62, 153) * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); return true; } diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index db26da3a46..667cffc62e 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee } public bool JavelinPreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); // Not cloning the points causes the below operations to be applied to the original oldPos value by reference // and thus causes it to be consistently added over and over, which is not intended behavior. @@ -419,7 +419,7 @@ namespace CalamityMod.Projectiles.Melee } public bool YoyoPreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/OzzathothYoyo.cs similarity index 91% rename from Projectiles/Melee/Yoyos/AzathothYoyo.cs rename to Projectiles/Melee/Yoyos/OzzathothYoyo.cs index 029bdbc52e..690d67df7f 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/OzzathothYoyo.cs @@ -8,16 +8,16 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AzathothYoyo : ModProjectile + public class OzzathothYoyo : ModProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Type] = Azathoth.Reach; - ProjectileID.Sets.YoyosTopSpeed[Type] = Azathoth.Speed / MaxUpdates; + ProjectileID.Sets.YoyosMaximumRange[Type] = Ozzathoth.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Ozzathoth.Speed / MaxUpdates; ProjectileID.Sets.TrailCacheLength[Type] = 8; ProjectileID.Sets.TrailingMode[Type] = 1; diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.png b/Projectiles/Melee/Yoyos/OzzathothYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AzathothYoyo.png rename to Projectiles/Melee/Yoyos/OzzathothYoyo.png diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs index d6a65bac8e..cec31f3c36 100644 --- a/Projectiles/Ranged/DragonsBreathFlames.cs +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -229,7 +229,18 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 240); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (Time <= 1) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, Projectile.width, ref _); + } + else + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs index 8e9eefa522..908bf2bfd7 100644 --- a/Projectiles/Ranged/ElysianArrowRain.cs +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f; overallOffset += Projectile.velocity * 1.4f; int numPoints = 46; diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs deleted file mode 100644 index cefe2998ce..0000000000 --- a/Projectiles/Ranged/HighExplosivePeanutShell.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class HighExplosivePeanutShell : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private const int Lifetime = 180; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 9; - ProjectileID.Sets.TrailingMode[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 4; - Projectile.timeLeft = Lifetime; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation(); - Projectile.spriteDirection = 1; - - // Lighting - Lighting.AddLight(Projectile.Center, 0.75f, 0.65f, 0.08f); - - // Dirty dust, done dirt cheap - { - int dustID = 7; // wood flakes - float scale = Main.rand.NextFloat(1f, 1.4f); - Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustID); - d.noGravity = true; - d.scale = scale; - - // Dust velocity is a complicated flaking function taken from Holy Fire Bullets - d.velocity *= 0.2f; - float angleDeviation = 0.17f; - float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - Vector2 sprayVelocity = Projectile.velocity.RotatedBy(angle) * 0.6f; - d.velocity += sprayVelocity; - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void OnKill(int timeLeft) - { - // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion - SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); - SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); - - // Massively inflate the projectile's hitbox - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 140; - Projectile.position.X = Projectile.position.X - Projectile.width / 2; - Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; - - // Allow infinite piercing and ignoring iframes for this one extra hit - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - - // Rocket III type explosion is now a utility for convenience - Projectile.LargeFieryExplosion(); - - // Deal damage again. The explosion deals half the damage of the direct hit. - Projectile.damage /= 2; - Projectile.Damage(); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - return true; // the projectile does indeed die on collision - } - } -} diff --git a/Projectiles/Ranged/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs index cbf2793e2f..37091f5516 100644 --- a/Projectiles/Ranged/HiveNuke.cs +++ b/Projectiles/Ranged/HiveNuke.cs @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.zenithWorld) { - SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 12); + SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 13); SoundEngine.PlaySound(bees with { Volume = 1.5f }, Projectile.Center); SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke"); SoundEngine.PlaySound(fire with { Volume = 0.35f }, Projectile.Center); diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs index 0e6e837318..33220e38ce 100644 --- a/Projectiles/Ranged/ScorpioLargeRocket.cs +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotationPoint = frame.Size() * 0.5f; // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index 94e9965fc4..066adb7379 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time >= TimeToLaunch) { // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); } diff --git a/Projectiles/Ranged/SuperradiantBolt.cs b/Projectiles/Ranged/SuperradiantBolt.cs index 2ba1733524..e3eb6e744b 100644 --- a/Projectiles/Ranged/SuperradiantBolt.cs +++ b/Projectiles/Ranged/SuperradiantBolt.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 20); Texture2D glow = TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Ranged/SuperradiantSaw.cs b/Projectiles/Ranged/SuperradiantSaw.cs index b6e808d15f..5515cfb2db 100644 --- a/Projectiles/Ranged/SuperradiantSaw.cs +++ b/Projectiles/Ranged/SuperradiantSaw.cs @@ -243,7 +243,10 @@ namespace CalamityMod.Projectiles.Ranged PierceBeforeReturn--; Projectile.numHits++; if (PierceBeforeReturn <= 0) + { + Projectile.localNPCHitCooldown = 20; Returning = true; + } } return false; @@ -290,15 +293,18 @@ namespace CalamityMod.Projectiles.Ranged { PierceBeforeReturn--; if (PierceBeforeReturn <= 0) + { + Projectile.localNPCHitCooldown = 20; Returning = true; + } } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { // The saw deals less damage while returning, to prevent its damage being too crazy - if (PierceBeforeReturn <= 0) - modifiers.SourceDamage *= 0.33f; + // The saw also deals less damage while homing + modifiers.SourceDamage *= Returning ? 0.2f : Empowered ? 0.75f : 1f; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs index 24ba2a20b3..ae4ec09ad5 100644 --- a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs +++ b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged public override void KillHoldoutLogic() { - if (HeldItem.type != Owner.ActiveItem().type) + if (HeldItem.type != Owner.ActiveItem().type || Owner.dead || !Owner.active) { Projectile.Kill(); Projectile.netUpdate = true; @@ -74,44 +74,42 @@ namespace CalamityMod.Projectiles.Ranged if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle) && Idle.IsPlaying) Idle.Position = GunTipPosition; - // Handle the right-click dash (holds priority over left-click) + // Handle the right-click dash (only works when not used from left-click) if (Owner.Calamity().mouseRight && !Owner.HasCooldown(SuperradiantSawBoost.ID)) { - Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown); - Owner.Calamity().sBlasterDashActivated = true; - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); - - // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) - float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); - float adjustedMouseDist = clampedMouseDist / 21f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); - - // Special case: right-clicking while not holding left-click - // This is to keep it friendly to use both fires at the same time, but end the animation early if not if (Projectile.ai[1] >= 2f) { + Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); + + // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) + float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); + float adjustedMouseDist = clampedMouseDist / 21f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + + // End animation early NoSawOnHoldout = true; OffsetLengthFromArm -= 16f; Projectile.timeLeft = Owner.ActiveItem().useAnimation; KeepRefreshingLifetime = false; Idle?.Stop(); - } - // If moving, make particle effects when the dash activates - if (Owner.velocity != Vector2.Zero) - { - int particleAmt = 7; - for (int c = 0; c < particleAmt; c++) + // If moving, make particle effects when the dash activates + if (Owner.velocity != Vector2.Zero) { - Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1)); - Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f); - GeneralParticleHandler.SpawnParticle(spark); - } - for (int e = 0; e < particleAmt * 2; e++) - { - Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1)); - Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3)); - GeneralParticleHandler.SpawnParticle(spark2); + int particleAmt = 7; + for (int c = 0; c < particleAmt; c++) + { + Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1)); + Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int e = 0; e < particleAmt * 2; e++) + { + Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1)); + Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3)); + GeneralParticleHandler.SpawnParticle(spark2); + } } } } diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index 5e6bb758a4..d970edad12 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -167,7 +167,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f; overallOffset += Projectile.velocity * 1.4f; int numPoints = 92; diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs index 30c1d474cd..4d5556908d 100644 --- a/Projectiles/Ranged/VanquisherArrowProj.cs +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Ammo; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; @@ -26,6 +27,8 @@ namespace CalamityMod.Projectiles.Ranged public float HomingTime = 0; public Color MainColor; public NPC targeted; + public int rotDir = 0; + public float rotSpeed = 0; public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -64,6 +67,8 @@ namespace CalamityMod.Projectiles.Ranged if (Time == 0) { + rotDir = (Main.rand.NextBool() ? -1 : 1); + rotSpeed = Main.rand.NextFloat(0.8f, 1.1f); Projectile.scale = 0.014f; Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f; ProjectileSpeed = 30; @@ -96,34 +101,20 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.timeLeft++; CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.65f, 7, 0.98f, 0.95f, true); - //CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); } else if (Projectile.velocity.Length() < 7) Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f, 0.04f); if (HomingTime > 1) { HomingTime--; - Projectile.velocity = Projectile.velocity.RotatedByRandom(0.09f); + Projectile.velocity = Projectile.velocity.RotatedBy(0.2f * rotDir * rotSpeed * Utils.GetLerpValue(15, 5, HomingTime, true)); } Time++; } - - public override void PostDraw(Color lightColor) - { - //Color color = Color.White; - //Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height); - //Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - - public override Color? GetAlpha(Color lightColor) - { - return lightColor; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - HomingTime = Main.rand.Next(10, 20 + 1) * Projectile.extraUpdates; + HomingTime = Main.rand.Next(12, 15 + 1) * Projectile.extraUpdates; target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 5ba3bdc63f..40c9a6b8d6 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -14,7 +15,9 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/Glaive"; private static int Lifetime = 180; - private static int ReboundTime = 45; + private static int ReboundTime = 40; + private List HitNPCs = []; + public ref float AIState => ref Projectile.ai[0]; // 0 - Going out. 1 - Returning. 2 - Stealth stuck to enemy. public override void SetStaticDefaults() { @@ -29,21 +32,18 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = true; Projectile.penetrate = 3; + Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; DrawOffsetX = -10; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; } public override void AI() { - // ai[1] = 1 means that the projectile is a stealth strike, in which case it pierces infinitely. - if (Projectile.ai[1] == 1f) - Projectile.penetrate = Projectile.maxPenetrate = -1; - // Boomerang rotation - Projectile.rotation += 0.4f * (float)Projectile.direction; + Projectile.rotation += 0.175f * Projectile.direction; // Boomerang sound if (Projectile.soundDelay == 0) @@ -54,16 +54,22 @@ namespace CalamityMod.Projectiles.Rogue // Returns after some number of frames in the air if (Projectile.timeLeft < Lifetime - ReboundTime) - Projectile.ai[0] = 1f; + AIState = 1f; - if (Projectile.ai[0] != 0f) + if (AIState == 0f && Projectile.ai[1] >= 0) + { + if (Projectile.timeLeft % 10 == 0) + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[(int)Projectile.ai[1]].Center) * Projectile.velocity.Length(); + } + + if (AIState == 1f) { Projectile.tileCollide = false; float returnSpeed = Glaive.Speed * 1.6f; float acceleration = 1.4f; - if (Projectile.ai[1] == 1f) + if (Projectile.Calamity().stealthStrike) { returnSpeed *= Glaive.StealthSpeedMult; acceleration *= Glaive.StealthSpeedMult; @@ -114,6 +120,24 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Hitbox.Intersects(owner.Hitbox)) Projectile.Kill(); } + + if (AIState == 2f) + { + Projectile.tileCollide = false; + Projectile.velocity = Vector2.Zero; + if (Main.npc[(int)Projectile.ai[1]].active) + { + if (Projectile.FinalExtraUpdate()) + Projectile.Center += Main.npc[(int)Projectile.ai[1]].velocity; + } + else + AIState = 1f; + + if (Projectile.penetrate == -1) + { + AIState = 1f; + } + } } public override bool PreDraw(ref Color lightColor) @@ -124,11 +148,73 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (Projectile.Calamity().stealthStrike) + { + if (AIState != 2f) + { + HitNPCs.Add(target.whoAmI); + float maxDistance = 1000f; + float npcDistCompare = 1000f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) // Find an NPC to ricochet to + { + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, maxDistance) || HitNPCs.Contains(n.whoAmI)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if ((currentNPCDist < npcDistCompare) && (Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If you find an NPC, ricochet in their direction and reset iframes for them + if (index != -1) + { + Projectile.ai[1] = index; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * Projectile.velocity.Length(); + Projectile.perIDStaticNPCImmunity[Type][index] = Main.GameUpdateCount; // Resets the iframes + } + else // If there are no new NPCs to ricochet to, try to go back to an already hit NPC + { + maxDistance = 1000f; + npcDistCompare = 1000f; + index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, maxDistance) || n.whoAmI == target.whoAmI) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if ((currentNPCDist < npcDistCompare) && (Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If this can find an NPC, ricochet back to them + if (index != -1) + { + Projectile.ai[1] = index; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * Projectile.velocity.Length(); + Projectile.perIDStaticNPCImmunity[Type][index] = Main.GameUpdateCount; // Resets the iframes + } + else // If you still find no one new, stick to the hit NPC + { + Projectile.ai[1] = target.whoAmI; + AIState = 2f; + } + } + } + Projectile.timeLeft = Lifetime + ReboundTime * 3; + } // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. if (Projectile.penetrate == 1) { Projectile.penetrate = -1; - Projectile.ai[0] = 1f; + AIState = 1f; } } @@ -147,7 +233,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - Projectile.ai[0] = 1f; + AIState = 1f; return false; } } diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index b965693fe2..1cb53d08e3 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 28; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/LiliesOfEternityBullet.cs b/Projectiles/Summon/LiliesOfEternityBullet.cs index 5cbe15d4d7..d87e226da0 100644 --- a/Projectiles/Summon/LiliesOfEternityBullet.cs +++ b/Projectiles/Summon/LiliesOfEternityBullet.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Summon private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + 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 7dd9798613..19a527e5d2 100644 --- a/Projectiles/Summon/LiliesOfFinalityBullet.cs +++ b/Projectiles/Summon/LiliesOfFinalityBullet.cs @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Summon private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + 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/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 614db32a4d..539d17389d 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -155,7 +155,6 @@ namespace CalamityMod.Projectiles.Summon } // Turning (wtf is this) - // idk ask phup lmao if (Projectile.velocity.X < playerDestination.X) { Projectile.velocity.X += acceleration; diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 5ec0668b23..c3ebe6bf20 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Summon playerDist = returnSpeed / playerDist; playerDestination *= playerDist; - // Turning (wtf is this) (idk ask phup lmao) + // Turning (wtf is this) if (Projectile.velocity.X < playerDestination.X) { Projectile.velocity.X += acceleration; diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 92b2796588..53397e2946 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Summon playerDist = returnSpeed / playerDist; playerDestination *= playerDist; - // Turning (wtf is this) (idk ask phup lmao) + // Turning (wtf is this) if (Projectile.velocity.X < playerDestination.X) { Projectile.velocity.X += acceleration; diff --git a/Projectiles/Turret/PlagueShot.cs b/Projectiles/Turret/PlagueShot.cs index 2fbf17f8ea..88ea01207f 100644 --- a/Projectiles/Turret/PlagueShot.cs +++ b/Projectiles/Turret/PlagueShot.cs @@ -86,7 +86,8 @@ namespace CalamityMod.Projectiles.Turret public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(TeslaCannon.FireSound with { Volume = 0.18f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = -0.3f }, Projectile.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack * 0.16f, Main.myPlayer); diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 813cd82252..8b0043879c 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); diff --git a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs index d782b2b97d..c4e2de0393 100644 --- a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs +++ b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); 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/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs index 222fc845b6..191990362d 100644 --- a/Projectiles/Typeless/XykWings.cs +++ b/Projectiles/Typeless/XykWings.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless public float backWingRot = 0; public int lastDir = 0; public float spawnFade = 0; - public float spawnFadePow => (Projectile.ai[1] == 5 ? 1 - (float)Math.Pow(spawnFade, 4) : (float)Math.Pow(spawnFade, 4)); + public float spawnFadePow => (Projectile.ai[1] == 5 ? (float)Math.Pow(spawnFade, 1) : (float)Math.Pow(spawnFade, 4)); public int deathFadeTimer = 0; public bool iAmTopWing = false; @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Typeless deathFadeTimer++; int fadeTime = (BreakApart ? 90 : 20); - spawnFade = Utils.GetLerpValue(0, fadeTime, deathFadeTimer, true); + spawnFade = Utils.GetLerpValue(fadeTime, 0, deathFadeTimer, true); Projectile.scale = intendedScale * spawnFadePow; if (deathFadeTimer >= fadeTime) { @@ -166,101 +166,103 @@ namespace CalamityMod.Projectiles.Typeless } return; } - - bool isFlying = Owner.controlJump; - bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; - bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; - bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; - if (isFalling || timeFalling < 0) - timeFalling++; - else if (timeFalling > 0) - timeFalling -= 2; - float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 60, timeFalling, true), 3); - float topWingNum = (checkActiveWings() - 1); - - float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); - - if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) - { - dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); - float bonusScale = 1; - if (Owner.Calamity().rageModeActive) - bonusScale += 0.25f; - if (Owner.Calamity().adrenalineModeActive) - bonusScale += 0.5f; - if (Projectile.scale < bonusScale) - Projectile.scale = bonusScale; - } else { - dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); - if (dashfx > 0) - dashfx -= 0.01f; - else - dashfx = 0; - } + bool isFlying = Owner.controlJump; + bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; + bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; + bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; + if (isFalling || timeFalling < 0) + timeFalling++; + else if (timeFalling > 0) + timeFalling -= 3; + float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 40, timeFalling, true), 3); + float topWingNum = (checkActiveWings() - 1); - float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); - wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; - - for (int i = -1; i <= 1; i += 2) - { - float dir = i * lastDir; - Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); - float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); - Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; - - float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp)); - float spawnDistance = 150; - if (i == 1) - expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; - else - expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; - } - Projectile.Center = Owner.Center; - - Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; - backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; - - if (wingNum == 0) - Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); - - if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) - { - for (int i = -2; i <= 2; i += 1) + if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) { - if (i == 0) - i++; - - bool front = i > 0; - Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); - Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); - - if (Owner.Calamity().XykVisualsBlue) - { - bool circle = Main.rand.NextBool(3); - Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); - dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); - dust.noGravity = true; - dust.color = drawColor; - dust.noLightEmittence = true; - dust.fadeIn = 1.5f * (circle ? 0 : 1f); - } + dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); + float bonusScale = 1; + if (Owner.Calamity().rageModeActive) + bonusScale += 0.25f; + if (Owner.Calamity().adrenalineModeActive) + bonusScale += 0.5f; + if (Projectile.scale < bonusScale) + Projectile.scale = bonusScale; + } + else + { + dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); + if (dashfx > 0) + dashfx -= 0.01f; else + dashfx = 0; + } + + float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + + wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; + + for (int i = -1; i <= 1; i += 2) + { + float dir = i * lastDir; + Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); + float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); + Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; + + float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp) / (Owner.moveSpeed * 0.3f + 1)); + float spawnDistance = 150; + if (i == 1) + expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; + else + expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; + } + Projectile.Center = Owner.Center; + + Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + + if (wingNum == 0) + Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); + + if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) + { + for (int i = -2; i <= 2; i += 1) { - bool square = Main.rand.NextBool(3); - Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); - dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); - dust.noGravity = true; - dust.color = drawColor; - dust.noLightEmittence = true; - dust.fadeIn = 0.1f * (square ? 1 : 3f); + if (i == 0) + i++; + + bool front = i > 0; + Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); + Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); + + if (Owner.Calamity().XykVisualsBlue) + { + bool circle = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 1.5f * (circle ? 0 : 1f); + } + else + { + bool square = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 0.1f * (square ? 1 : 3f); + } } } - } - time++; + time++; + } } public override bool PreDraw(ref Color lightColor) { @@ -310,7 +312,6 @@ namespace CalamityMod.Projectiles.Typeless Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - return false; } public int checkActiveWings() diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs deleted file mode 100644 index 8d9ccaaf70..0000000000 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class YanmeisKnifeSlash : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 5; - } - - public override void SetDefaults() - { - Projectile.width = 180; - Projectile.height = 96; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - - // Frames and crap - Projectile.frameCounter++; - if (Projectile.frameCounter % 7 == 0) - { - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.Kill(); - } - - // Create idle light and dust. - Vector2 origin = Projectile.Center + Projectile.velocity * 3f; - Lighting.AddLight(origin, 0f, 1.5f, 0.1f); - - Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); - - // Rotation and directioning. - float velocityAngle = Projectile.velocity.ToRotation(); - Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - Projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); - - // Positioning close to the end of the player's arm. - Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * 80f; - - // Sprite and player directioning. - Projectile.spriteDirection = Projectile.direction; - player.ChangeDir(Projectile.direction); - - // Prevents the projectile from dying - Projectile.timeLeft = 2; - - // Player item-based field manipulation. - player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); - player.heldProj = Projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - } - - public void HandleAttachmentMovement(Player player, Vector2 playerRotatedPoint) - { - float speed = 1f; - if (player.ActiveItem().shoot == Projectile.type) - { - speed = player.ActiveItem().shootSpeed * Projectile.scale; - } - - // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; - - // Sync if a velocity component changes. - if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) - { - Projectile.netUpdate = true; - } - Projectile.velocity = newVelocity; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), YanmeisKnife.DebuffDuration); - if (!Main.dedServ) - { - for (int i = 0; i < 60; i++) - { - Dust dust = Dust.NewDustDirect(Main.player[Projectile.owner].position, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height, DustID.RainbowMk2); - dust.position.X += Main.rand.NextFloat(-16f, 16f); - dust.color = Main.hslToRgb(Main.rand.NextFloat(0.26f, 0.37f), 1f, 0.75f); - dust.velocity = Main.rand.NextVector2Circular(24f, 24f); - dust.scale = Main.rand.NextFloat(1.4f, 1.8f); - dust.noGravity = true; - } - } - if (Projectile.ai[0] == 0f) - { - SoundEngine.PlaySound(YanmeisKnife.HitSound, Projectile.position); - Projectile.ai[0] = 1f; - } - Main.player[Projectile.owner].AddBuff(ModContent.BuffType(), YanmeisKnife.BoostDuration); - } - public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); - } -} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.png b/Projectiles/Typeless/YanmeisKnifeSlash.png deleted file mode 100644 index e0b03d728c..0000000000 Binary files a/Projectiles/Typeless/YanmeisKnifeSlash.png and /dev/null differ diff --git a/README.md b/README.md index 9ae12d6b43..fe22891c7f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - [Steam Workshop](https://calamitymod.com/download/) - [Discord](https://discord.gg/calamity) - [Official Wiki](https://calamitymod.wiki.gg/) -- [Patreon](https://patreon.com/fabsol) +- [Patreon](https://patreon.com/CalamityMod) The Calamity Mod is a vast content mod for Terraria which adds dozens of bosses and thousands of items to create an intense and varied experience. The mod must be installed using [tModLoader](https://github.com/tModLoader/tModLoader). diff --git a/Rarities/BurnishedAuric.cs b/Rarities/BurnishedAuric.cs new file mode 100644 index 0000000000..f6f1d78c8e --- /dev/null +++ b/Rarities/BurnishedAuric.cs @@ -0,0 +1,130 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities; +using Terraria.ID; + +namespace CalamityMod.Rarities +{ + public class BurnishedAuric : ModRarity + { + // Burnished Auric is Rarity 15 (Once was known as Violet) + public override Color RarityColor => TextClr * 2f; + + public static float MaxY = 4.5f; + public static Color BloomClr = new Color(48, 33, 4, 0); + public static Color TextClr = new Color(157, 110, 11, 50); + static float lastFlashTime = 0f; + static bool isFlashing = false; + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) + { + float flashChance = 0.005f; // Low chance per frame + float flashDuration = 0.2f; // Flash lasts ~0.2 seconds + + if (Main.GameUpdateCount - lastFlashTime > flashDuration * 60) + { + if (Main.rand.NextFloat() < flashChance) + { + isFlashing = true; + lastFlashTime = Main.GameUpdateCount; + } + else + { + isFlashing = false; + } + } + var fontSize = font.MeasureString(text); + var center = fontSize / 2.0f; + + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); + textColor.A = 0; + + float pulsing = 1.5f + (float)Math.Sin(time * 5f); + for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f) + { + ChatManager.DrawColorCodedString( + spriteBatch, font, text, + new Vector2(X, Y) + new Vector2(pulsing, 0f).RotatedBy(f + time * 2f % MathHelper.TwoPi), + textColor * 0.5f, rotation, origin, baseScale); + if (isFlashing && CalamityClientConfig.Instance.TextEffects) + origin += Main.rand.NextVector2Circular(2f, 1.2f); // Small shake + } + + if (isFlashing) + { + textColor = new Color(0, 183, 241, 50); + lightColor = new Color(14, 255, 255, 50); + } + + textColor.A = 255; + + // Shadow + ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale); + + // Outline base + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), new Color(77, 0, 33), rotation, origin, baseScale); + + float shineWidth = 40f; //set to charSize + float shineSpeed = 80f; + + float shineDisp = time * shineSpeed; //predicted current location of the shine based on the time and speed + float shinePos = (shineDisp % (fontSize.X + shineWidth)); + + Vector2 basePos = new Vector2(X, Y); + if (isFlashing && CalamityClientConfig.Instance.TextEffects) + basePos += Main.rand.NextVector2Circular(3f, 10f); // Small shake + + float charOffsetX = 0f; + if (!renderTextSparkles) + return; + for (int i = 0; i < text.Length; i++) + { + string c = text[i].ToString(); + Vector2 charSize = font.MeasureString(c); + Vector2 charOrigin = charSize * 0.5f; + + Vector2 charPos = basePos + new Vector2(charOffsetX, 0f); + + float centerX = charPos.X + (charSize.X * baseScale.X) / 2f + 10.5f; + float dist = Math.Abs(centerX - (X + shinePos - shineWidth * 0.15f)); + float intensity = 1f - MathHelper.Clamp(dist / shineWidth, 0f, 1f); + + if (intensity > 0f) + { + Color shineColor = isFlashing ? new Color(90, 207, 255) * intensity * 2f : new Color(254, 231, 117) * intensity * 1f; + ChatManager.DrawColorCodedString( + spriteBatch, font, c, charPos, shineColor, rotation, origin, baseScale); + } + + charOffsetX += charSize.X - text.Length * 0.0085f; + } + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } + + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/CalamityRed.cs b/Rarities/CalamityRed.cs index 3b47a6ab63..19bb2986e1 100644 --- a/Rarities/CalamityRed.cs +++ b/Rarities/CalamityRed.cs @@ -1,5 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria; using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities; +using Terraria.ID; namespace CalamityMod.Rarities { @@ -8,12 +18,117 @@ namespace CalamityMod.Rarities // Calamity Red is Rarity 17 // This rarity should never be assigned to any items. // It is the equivalent of vanilla's Purple rarity (11): only used for positive reforges on top-rarity items. - public override Color RarityColor => new Color(163, 25, 26); // #A3191A - // (139, 0, 0) is the classic donator item color + //public override Color RarityColor => new Color(163, 25, 26); // #A3191A + // // (139, 0, 0) is the classic donator item color + + public override Color RarityColor => TextClr * 2f; + + public static float MaxY = 4.5f; + public static Color BloomClr = new Color(180, 20, 75, 0); + public static Color TextClr = new Color(242, 27, 27, 255); + + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) + { + var crystalTextGlow = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextGlow").Value; + var sparkle = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextSparkle").Value; + var fontSize = font.MeasureString(text); + var center = fontSize / 2f; + + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); + textColor.A = 0; + float pulsing = 10f + (float)Math.Sin(time * 20f); + float baseScalePulse = 1.03f; + float flameHeight = 5f; + float distortionAmount = 2f; + + if (renderTextSparkles) + + for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f) + { + float angle = f + (time * 2f % MathHelper.TwoPi); + + float distortion = (float)Math.Sin((Y + f * 100f + time * 20f) * 0.05f) * distortionAmount; + + Vector2 offset = new Vector2( + (float)Math.Cos(angle) * pulsing * 0.4f + distortion, + -(float)Math.Abs((float)Math.Sin(angle)) * flameHeight + ); + + float scaleVariation = 0.95f + 0.05f * (float)Math.Sin(time * 15f + f * 2f); + Vector2 scale = new Vector2(baseScalePulse * scaleVariation); + + Color flameLayerColor = new Color( + (int)(textColor.R * 0.5f), + (int)(textColor.G * 0.5f), + (int)(textColor.B * 0.5f), + (int)(textColor.A * 0.5f) + ); + + ChatManager.DrawColorCodedString( + spriteBatch, + font, + text, + new Vector2(X, Y) + offset, + flameLayerColor, + rotation, + origin, + scale + ); + } + + // Draw crisp center text + ChatManager.DrawColorCodedString( + spriteBatch, + font, + text, + new Vector2(X, Y), + textColor, + rotation, + origin, + new Vector2(baseScalePulse) + ); + + textColor.A = 255; + + ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale); + + var bloomColor = ColorTool.Rainbowing(time * 4 - 0.9f); + + spriteBatch.Draw(crystalTextGlow, glowPosition, null, lightColor, rotation + MathHelper.PiOver2, new Vector2(6f, 33f), + new Vector2(1.6f, fontSize.X / crystalTextGlow.Height * 1.2f), SpriteEffects.None, 0f); + + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), Color.Black, rotation, origin, baseScale); + + // Is this a scrapped visual feature of the rarity? + /*int sparkleCount = Main.rand.Next((int)fontSize.X / 7, (int)fontSize.X / 5) + 1; + var color2 = lightColor * 1.00f; + color2.A = 0; + var sparkleOrigin = new Vector2(15f, 15f); + for (int i = 0; i < sparkleCount; i++) + { + var v = new Vector2(Main.rand.NextFloat(fontSize.X), Main.rand.NextFloat(fontSize.Y * 0.6f) + 1f); + float lifeTime = Main.GlobalTimeWrappedHourly * 4f + Main.rand.NextFloat(MathHelper.TwoPi * 7f); + lifeTime %= MathHelper.TwoPi * 1f; + }*/ + + return; + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } public override int GetPrefixedRarity(int offset, float valueMult) => offset switch { - -2 => ModContent.RarityType(), + -2 => ModContent.RarityType(), -1 => ModContent.RarityType(), _ => Type, }; diff --git a/Rarities/ColorTool.cs b/Rarities/ColorTool.cs new file mode 100644 index 0000000000..f226186c9a --- /dev/null +++ b/Rarities/ColorTool.cs @@ -0,0 +1,47 @@ +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public sealed class ColorTool : GlobalItem + { + public static int RarityCosmicPurple => ModContent.GetInstance().Type; + public static int RarityBurnishedAuric => ModContent.GetInstance().Type; + public static int RarityCalamityRed => ModContent.GetInstance().Type; + + + public override bool PreDrawTooltipLine(Item Item, DrawableTooltipLine line, ref int yOffset) + { + if (line.Mod == "Terraria" && line.Name == "ItemName") + { + if (Item.rare == RarityCosmicPurple) + { + CosmicPurple.Draw(Item, line); + return false; + } + if (Item.rare == RarityBurnishedAuric) + { + BurnishedAuric.Draw(Item, line); + return false; + } + if (Item.rare == RarityCalamityRed) + { + CalamityRed.Draw(Item, line); + return false; + } + } + return true; + } + public static Color colorLerps(Color[] colors, float time) + { + int index = (int)time; + return Color.Lerp(colors[index % colors.Length], colors[(index + 1) % colors.Length], time % 1f); + } + + public static Color Rainbowing(float position) => colorLerps( + new Color[] { new Color(255, 50, 50, 255), new Color(255, 128, 50, 255), new Color(230, 255, 50, 255), new Color(80, 255, 60, 255), + new Color(50, 80, 250, 255), new Color(200, 50, 250, 255),new Color(255, 50, 230, 255), }, position); + } +} diff --git a/Rarities/CosmicPurple.cs b/Rarities/CosmicPurple.cs new file mode 100644 index 0000000000..9227f5866d --- /dev/null +++ b/Rarities/CosmicPurple.cs @@ -0,0 +1,116 @@ +using System; +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities; +using Terraria.ID; + +namespace CalamityMod.Rarities +{ + public class CosmicPurple : ModRarity + { + // Cosmic Purple is Rarity 14 (once was known as Dark Blue) + public override Color RarityColor => TextClr * 2f; + + public static float MaxY = 4.5f; + public static Color BloomClr = new Color(65, 38, 87, 0); + public static Color TextClr = new Color(103, 66, 138, 255); + + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) + { + var crystalTextGlow = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextGlow").Value; + var sparkle = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextSparkle").Value; + var fontSize = font.MeasureString(text); + var center = fontSize / 2f; + + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); + textColor.A = 0; + float pulsing = 2.5f + (float)Math.Sin(time * 5f); + for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f) + { + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y) + new Vector2(pulsing, 0f).RotatedBy(f + time * 2f % MathHelper.TwoPi), textColor * 0.5f, rotation, origin, baseScale); + } + + textColor.A = 255; + + ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale); + + var bloomColor = ColorTool.Rainbowing(time * 4 - 0.9f); + + spriteBatch.Draw(crystalTextGlow, glowPosition, null, lightColor, rotation + MathHelper.PiOver2, new Vector2(6f, 33f), + new Vector2(1.6f, fontSize.X / crystalTextGlow.Height * 1.2f), SpriteEffects.None, 0f); + + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), Color.Black, rotation, origin, baseScale); + + if (!renderTextSparkles) + return; + + // This is very expensive, however using Main.rand makes the sparkles incredibly jittery so I am just going to leave it for now + var rand = new UnifiedRandom(Main.LocalPlayer.name.GetHashCode() + (int)(center.X + center.Y)); + + int sparkleCount = rand.Next((int)fontSize.X / 7, (int)fontSize.X / 5) + 1; + var color2 = lightColor; + color2.A = 0; + var sparkleOrigin = new Vector2(15f, 15f); + for (int i = 0; i < sparkleCount; i++) + { + var v = new Vector2(rand.NextFloat(fontSize.X), rand.NextFloat(fontSize.Y * 0.6f) + 1f); + float lifeTime = Main.GlobalTimeWrappedHourly * 4f + rand.NextFloat(MathHelper.TwoPi); + lifeTime %= MathHelper.TwoPi; + + if (lifeTime > MathHelper.TwoPi) + continue; + + float sinValue = (float)Math.Sin(lifeTime); + var white = new Color(200 + lightColor.R / 20, 200 + lightColor.G / 20, 200 + lightColor.B / 20, 255) * sinValue; + + float sparkleRotationSpeed = Main.rand.NextFloat(0.8f, 1.5f); // Unique rotation rate per sparkle + float sparkleRotation = time * sparkleRotationSpeed; + + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 3f) + v, null, white, sparkleRotation, sparkleOrigin, + lifeTime / MathHelper.TwoPi * 0.3f, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, white * 0.5f, sparkleRotation, sparkleOrigin, + lifeTime / MathHelper.TwoPi, SpriteEffects.None, 0f); + + var scale2 = (float)Math.Sin(lifeTime / MathHelper.PiOver2) + 1f; + var scale3 = lifeTime / MathHelper.TwoPi; + + scale2 *= 0.2f; + scale3 *= 0.15f; + + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, color2 * sinValue, sparkleRotation, sparkleOrigin, + new Vector2(scale3, scale3) * 1.5f, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, color2 * sinValue, sparkleRotation, sparkleOrigin, + new Vector2(scale2, scale3), SpriteEffects.None, 0f); + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, color2 * sinValue, sparkleRotation, sparkleOrigin, + new Vector2(scale3, scale2), SpriteEffects.None, 0f); + } + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } + public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + }; + } +} diff --git a/Rarities/DarkBlue.cs b/Rarities/DarkBlue.cs deleted file mode 100644 index 02b431036f..0000000000 --- a/Rarities/DarkBlue.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Rarities -{ - public class DarkBlue : ModRarity - { - // Dark Blue is Rarity 14 - public override Color RarityColor => new Color(43, 96, 222); - - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } -} diff --git a/Rarities/HotPink.cs b/Rarities/HotPink.cs index 28258729a5..b3451e2f2d 100644 --- a/Rarities/HotPink.cs +++ b/Rarities/HotPink.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Rarities public override int GetPrefixedRarity(int offset, float valueMult) => offset switch { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), 1 => ModContent.RarityType(), 2 => ModContent.RarityType(), _ => Type, diff --git a/Rarities/PureGreen.cs b/Rarities/PureGreen.cs index 5b682682a2..8d859b9226 100644 --- a/Rarities/PureGreen.cs +++ b/Rarities/PureGreen.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Rarities { -2 => ItemRarityID.Purple, -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), _ => Type, }; } diff --git a/Rarities/Turquoise.cs b/Rarities/Turquoise.cs index 2117b067d9..254fa196ab 100644 --- a/Rarities/Turquoise.cs +++ b/Rarities/Turquoise.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Rarities -2 => ItemRarityID.Red, -1 => ItemRarityID.Purple, 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), + 2 => ModContent.RarityType(), _ => Type, }; } diff --git a/Rarities/Violet.cs b/Rarities/Violet.cs deleted file mode 100644 index e5b468f021..0000000000 --- a/Rarities/Violet.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Rarities -{ - public class Violet : ModRarity - { - // Violet is Rarity 15 - public override Color RarityColor => new Color(108, 45, 199); - - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } -} diff --git a/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs index 5b7ee0d578..af0ca2e3bb 100644 --- a/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs @@ -13,31 +13,9 @@ namespace CalamityMod.Systems public override bool IsSceneEffectActive(Player player) { - // Case 1: Zenith Seed Crabulon. if (Main.zenithWorld && NPC.AnyNPCs(ModContent.NPCType())) return true; - - // Case 2: Supreme Cirrus BH5. - bool cirrusSpecialAttack = false; - - // Try to find Supreme Cirrus, if she exists. She might not. - try - { - // Is there an index reference to Supreme Calamitas/Cirrus available? Is it valid? I sure hope so. Thanks TML - if (CalamityGlobalNPC.SCal >= 0 && CalamityGlobalNPC.SCal < Main.maxNPCs && Main.npc[CalamityGlobalNPC.SCal].active) - { - NPC npc = Main.npc[CalamityGlobalNPC.SCal]; - SupremeCalamitas supremeSomeone = npc.ModNPC(); - cirrusSpecialAttack = supremeSomeone is not null && supremeSomeone.cirrus && supremeSomeone.gettingTired5; - } - } - catch - { - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText("Supreme Cirrus code attempted to crash the game. Did you do something weird?"); - } - - return cirrusSpecialAttack; + return false; } public override void SpecialVisuals(Player player, bool isActive) diff --git a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs deleted file mode 100644 index e5597c0d2e..0000000000 --- a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs +++ /dev/null @@ -1,14 +0,0 @@ -using CalamityMod.World; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems -{ - public class SkeletronPrimeMasterMusicScene : ModSceneEffect - { - public override int Music => MusicID.Boss3; // I spent 20 minutes trying to get this music to play while forgetting to actually override this in the first place _ YuH - public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; - public override bool IsSceneEffectActive(Player player) => CalamityWorld.death && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; - } -} diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index f6b72244b5..0f52794ac9 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -13,6 +13,9 @@ namespace CalamityMod.Schematics { public sealed class SchematicManager : ModSystem { + internal const string ShimmerShrineKey = "Shimmer Shrine Key"; + internal const string ShimmerShrineFilename = "Schematics/Shimmer_Shrine.csch"; + internal const string BrimstoneAtriumType1Key = "Brimstone Atrium Type 1 Key"; internal const string BrimstoneAtriumType1Filename = "Schematics/Brimstone_Atrium1.csch"; @@ -166,6 +169,9 @@ namespace CalamityMod.Schematics PilePlacementMaps = new Dictionary(); TileMaps = new Dictionary { + // Shimmer Shrine + [ShimmerShrineKey] = CalamitySchematicIO.LoadSchematic(ShimmerShrineFilename), + // Underworld structures [BrimstoneAtriumType1Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType1Filename), [BrimstoneAtriumType2Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType2Filename), diff --git a/Schematics/Shimmer_Shrine.csch b/Schematics/Shimmer_Shrine.csch new file mode 100644 index 0000000000..91c2def6a4 Binary files /dev/null and b/Schematics/Shimmer_Shrine.csch differ diff --git a/Skies/DrunkCrabScreenShaderData.cs b/Skies/DrunkCrabScreenShaderData.cs index 2d67cb7706..922f635755 100644 --- a/Skies/DrunkCrabScreenShaderData.cs +++ b/Skies/DrunkCrabScreenShaderData.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Skies public class DrunkCrabScreenShaderData : ScreenShaderData { public int CrabIndex; - public int CirrusIndex; public DrunkCrabScreenShaderData(string passName) : base(passName) @@ -23,98 +22,28 @@ namespace CalamityMod.Skies public void UpdateBossIndex() { int CrabType = ModContent.NPCType(); - int CirrusType = ModContent.NPCType(); - bool shouldCheckForCirrus = false; - bool shouldForceDeactivateCirrusShader = false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - { - shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; - shouldForceDeactivateCirrusShader = Main.npc[CalamityGlobalNPC.SCal].ModNPC().giveUpCounter <= 1; - } - } - } + if (CrabIndex >= 0 && Main.npc[CrabIndex].active && Main.npc[CrabIndex].type == CrabType) + return; - if (shouldCheckForCirrus) - { - if (CirrusIndex >= 0 && Main.npc[CirrusIndex].active && Main.npc[CirrusIndex].type == CirrusType && !shouldForceDeactivateCirrusShader) - return; - - CirrusIndex = -1; - - if (!shouldForceDeactivateCirrusShader) - { - CirrusIndex = NPC.FindFirstNPC(CirrusType); - } - } - else - { - if (CrabIndex >= 0 && Main.npc[CrabIndex].active && Main.npc[CrabIndex].type == CrabType) - return; - - CrabIndex = NPC.FindFirstNPC(CrabType); - } + CrabIndex = NPC.FindFirstNPC(CrabType); } public override void Update(GameTime gameTime) { - bool shouldCheckForCirrus = false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; - } - } - - if (shouldCheckForCirrus) - { - if (CirrusIndex == -1) - { - UpdateBossIndex(); - if (CirrusIndex == -1) - Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); - } - } - else + if (CrabIndex == -1 || !Main.zenithWorld) { + UpdateBossIndex(); if (CrabIndex == -1 || !Main.zenithWorld) - { - UpdateBossIndex(); - if (CrabIndex == -1 || !Main.zenithWorld) - Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); - } - } + Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); + } } public override void Apply() { UpdateBossIndex(); - bool shouldCheckForCirrus = false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; - } - } - - if (shouldCheckForCirrus) - { - if (CirrusIndex != -1) - UseTargetPosition(Main.npc[CirrusIndex].Center); - } - else - { - if (CrabIndex != -1) - UseTargetPosition(Main.npc[CrabIndex].Center); - } + if (CrabIndex != -1) + UseTargetPosition(Main.npc[CrabIndex].Center); base.Apply(); } diff --git a/Skies/SCalScreenShaderData.cs b/Skies/SCalScreenShaderData.cs index 1e562f1683..92ca7f0082 100644 --- a/Skies/SCalScreenShaderData.cs +++ b/Skies/SCalScreenShaderData.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Skies { UseTargetPosition(Main.npc[SCalIndex].Center); - if (Main.npc[SCalIndex].ModNPC().cirrus) - Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(0.9f, 0.3f, 0.9f); + if (Main.npc[SCalIndex].ModNPC().permafrost) + Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(0.3f, 0.6f, 0.9f); } base.Apply(); } diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index 8f47be8370..d961e9a597 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Skies return Color.Transparent; NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - bool cirrus = scal.ModNPC().cirrus; + bool permafrost = scal.ModNPC().permafrost; float lifeRatio = scal.life / (float)scal.lifeMax; if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == false) @@ -151,11 +151,11 @@ namespace CalamityMod.Skies return Color.Lerp(Color.Red, Color.IndianRed, Main.rand.NextFloat(0f, 1f)); if (lifeRatio > 0.5f) - return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Crimson, Main.rand.NextFloat(0f, 1f)); + return Color.Lerp(permafrost ? Color.LightBlue : Color.Red, permafrost ? Color.DarkCyan : Color.Crimson, Main.rand.NextFloat(0f, 1f)); else if (lifeRatio > 0.3f || scal.ModNPC().postMusicHit == false) - return Color.Lerp(cirrus ? Color.Cyan : Color.Red, cirrus ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); + return Color.Lerp(permafrost ? Color.LightBlue : Color.Red, permafrost ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); else if (lifeRatio > 0.01f) - return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); + return Color.Lerp(permafrost ? Color.LightBlue : Color.Red, permafrost ? Color.MediumBlue : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); else return Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0f, 0.65f)); } @@ -253,15 +253,15 @@ namespace CalamityMod.Skies } NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - bool cirrus = scal.ModNPC().cirrus; + bool permafrost = scal.ModNPC().permafrost; float lifeRatio = scal.life / (float)scal.lifeMax; if (lifeRatio > 0.5f) - cinderColortoBe = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Crimson, Main.rand.NextFloat(0f, 1f)); + cinderColortoBe = Color.Lerp(permafrost ? Color.Cyan : Color.Red, permafrost ? Color.MediumBlue : Color.Crimson, Main.rand.NextFloat(0f, 1f)); else if (lifeRatio > 0.3f || scal.ModNPC().postMusicHit == false) - cinderColortoBe = Color.Lerp(cirrus ? Color.Cyan : Color.Red, cirrus ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); + cinderColortoBe = Color.Lerp(permafrost ? Color.Cyan : Color.Red, permafrost ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); else if (lifeRatio > 0.01f) - cinderColortoBe = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); + cinderColortoBe = Color.Lerp(permafrost ? Color.Cyan : Color.Red, permafrost ? Color.DarkTurquoise : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); else cinderColortoBe = Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0.8f)); diff --git a/Sounds/Custom/BEES/Names.txt b/Sounds/Custom/BEES/Names.txt index 25875d8fef..5645ea0a79 100644 --- a/Sounds/Custom/BEES/Names.txt +++ b/Sounds/Custom/BEES/Names.txt @@ -10,4 +10,5 @@ Names: 9 - StipulatedVenus 10 - Xyk 11 - Shade -12 - YuH \ No newline at end of file +12 - YuH +13 - ENNWAY diff --git a/Sounds/Custom/BEES/bees13.mp3 b/Sounds/Custom/BEES/bees13.mp3 new file mode 100644 index 0000000000..9b7b424035 Binary files /dev/null and b/Sounds/Custom/BEES/bees13.mp3 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/Sounds/Item/SylvestaffFire1.ogg b/Sounds/Item/SylvestaffFire1.ogg new file mode 100644 index 0000000000..8ab459ac0b Binary files /dev/null and b/Sounds/Item/SylvestaffFire1.ogg differ diff --git a/Sounds/Item/SylvestaffFire2.ogg b/Sounds/Item/SylvestaffFire2.ogg new file mode 100644 index 0000000000..4d60af5825 Binary files /dev/null and b/Sounds/Item/SylvestaffFire2.ogg differ diff --git a/Sounds/Item/SylvestaffFire3.ogg b/Sounds/Item/SylvestaffFire3.ogg new file mode 100644 index 0000000000..c8b78c318b Binary files /dev/null and b/Sounds/Item/SylvestaffFire3.ogg differ diff --git a/Sounds/Item/SylvestaffProjectileBounce1.ogg b/Sounds/Item/SylvestaffProjectileBounce1.ogg new file mode 100644 index 0000000000..dbe4a38b8e Binary files /dev/null and b/Sounds/Item/SylvestaffProjectileBounce1.ogg differ diff --git a/Sounds/Item/SylvestaffProjectileBounce2.ogg b/Sounds/Item/SylvestaffProjectileBounce2.ogg new file mode 100644 index 0000000000..81d1d354e4 Binary files /dev/null and b/Sounds/Item/SylvestaffProjectileBounce2.ogg differ diff --git a/Sounds/Item/SylvestaffProjectileBounce3.ogg b/Sounds/Item/SylvestaffProjectileBounce3.ogg new file mode 100644 index 0000000000..4cbae2723f Binary files /dev/null and b/Sounds/Item/SylvestaffProjectileBounce3.ogg differ diff --git a/Sounds/Item/ViperSpit.ogg b/Sounds/Item/ViperSpit.ogg index b7fb928fa1..2be1d386cd 100644 Binary files a/Sounds/Item/ViperSpit.ogg and b/Sounds/Item/ViperSpit.ogg differ diff --git a/Systems/Collections/AmalgamBuffLists.cs b/Systems/Collections/AmalgamBuffLists.cs index 468614edfb..8724883deb 100644 --- a/Systems/Collections/AmalgamBuffLists.cs +++ b/Systems/Collections/AmalgamBuffLists.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Systems.Collections BuffType(), BuffType(), BuffType(), - BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), diff --git a/Systems/Collections/DonatorsNameList.cs b/Systems/Collections/DonatorsNameList.cs index 579e50bb84..71971a7bf2 100644 --- a/Systems/Collections/DonatorsNameList.cs +++ b/Systems/Collections/DonatorsNameList.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ModLoader; @@ -11,658 +12,754 @@ namespace CalamityMod.Systems.Collections { public static IList List { get; private set; } - public override void OnModLoad() - { - List = - [ - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "YuH", - "Littlepiggy", - "LompL", - "Lilith", - "Ben Shapiro", - "Frederik", - "Faye", - "Gibb50", - "Braden", - "Hannes", - "profoundmango69", - "Jack", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "Tervastator", - "Luis", - "Alexander", - "BakaQing", - "Taylor", - "Xaphlactus", - "MajinBagel", - "Bendy", - "Rando Calrissian", - "Tails the Fox 92", - "Bread", - "Minty Candy", - "Preston", - "MovingTarget_086", - "Shiro", - "Chip", - "Taylor", - "ShotgunAngel", - "Sandblast", - "ThomasThePencil", - "Aero (Aero#4599)", - "Shirosity", // used to be GlitchOut - "Daawnz", - "CrabBar", - "Yatagarasu", - "Jarod", - "Zombieh", - "MingWhy", - "Random Weeb", - "Afzofa", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel", - "Christopher", - "DemoN K!ng", - "Malik", - "Ryan Baker-Ortiz", - "Aleksanders", - "TheSilverGhost", - "Lucazii", - "Shay", - "Prism", - "BobIsNotMyRealName", - "Guwahavel", - "Azura", - "Joshua", - "Doveda", - "William", - "Arche", - "DevilSunrise", - "Yanmei", - "Chaos", - "Ryan", - "Fish Repairs", - "Melvin", - "Vroomy Has -3,000 IQ", - "The Goliath", - "DaPyRo", - "Takeru", - "Circuit-Jay", - "Commmander Frostbite", - "cytokat", - "Cameron", - "Orudeon", - "BumbleDoge", - "Naglfar", - "Helixas", - "Vetus", - "High Charity", - "Devonte", - "Cerberus", - "Brendan", - "Victor", - "KAT-G307", - "Tombarry Expresserino", - "Drip Veezy", - "Glaid", - "Apotheosis", - "Bladesaber", - "Devon", - "Ruthoranium", - "cocodezi_", - "Mendzey", - "GameRDheAsianSandwich", - "Chigbungus", - "Streakist", - "Eisaya", - "Xenocrona", - "RKMoon", - "Eternal Silence", - "Jeff", - "Beta165", - "DanYami", - "Xenocrona", - "Ari", - "cosmickalamity", - "xd Ow0", - "Darren", - "Florian", - "dawn thunder", - "asdf935", - "GentSkeleton", - "Fizzlpoprock", - "Pigeon", - "Aleksh", - "Just a random guy", - "Dee", - "Æthereal", - "Broken Faucet", - "Sarcosuchus", - "Marissa443", - "Warlok", - "JackShizz", - "NebulaMagePlays", - "Primpy", - "Thys", - "Min", - "Wodernet", - "Pedro", - "Depressed Dad Gaming", - "Snowy", - "Stormone", - "Mobian", - "Rinja", - "Check pins", - "Dakota", - "Neoplasmatic", - "False", - "Whitegiraffe", - "Drakkece", - "Levi", - "Izuna", - "djsnj20", - "pyobbo", - "Alec", - "The Illustrious Sqouinchuousor", - "Moist Lad", - "TwanTheGOAT", - "3x1t_5tyl3", - "Will", - "SpookyNinja", - "Boomdiada", - "Culex", - "Rossadon", - "Ben", - "hubert thieblot", - "NepNep", - "Nanaki", - "CrimsonCrips", - "Lagohz", - "Timon", - "F00d Demon", - "Olkothan", - "Vmar98", - "Dasdruid", - "Cinder", - "Brutzli", - "Yhashtur", - "Zekai", - "Doug", - "Uberransy", - "KurlozClown", - "Nemesis 041", - "Asheel", - "Hayden", - "Lightedflare", - "Lady Shira", - "Devin", - "Qelrin", - "Thomas", - "Ne'er Dowell", - "Potion Man", - "martyrdomination", - "Destructoid", - "Coolguystorm YT", - "Wolfmaw", - "yiumik", - "Destiny Stallcup", - "GreenBerry", - "SolsticeUnlimitd", - "darkhawke", - "oracle", - "YumeiSenshi", - "Cameron", - "Aeroni", // previously "Toxin" - "Fweepachino", - "DESPACITO", - "Altzeus", - "Ryan", - "Spider region", - "WinterTire", - "Nycro", - "Vyster", // previously "Bewearium" - "William", - "HellGoat2", - "116taj", - "CaineSenpai", - "Suicide Dreams", - "Roxas", - "Obsoleek", - "Jetpat3", - "GreenTea", - "Woah", - "Ryaegos", - "Popsickle Yoshi", - "Arcadia", - "JensB__", - "Nuclei", - "Picasso's Bean", - "Corn M. Cobb", - "kgh8090", - "Luke", - "Barbara", - "Alexis", - "Soko", - "Albino gonkvader", - "Monic", - "Slim", - "ChaosChaos", - "Deallly", - "Jeff", - "vcf55", - "Kazurgundu", - "Jheybyrd", - "Kipluck", - "SCONICBOOM", - "Mr.Matter", - "Billy", - "jjth0m3", - "GTW High Cube", - "Sabrina", - "Potato - Stego", - "Perditio Astrum", - "MaxingOut", - "SharZz", - "Allegro", - "hoosfire", - "Lauren", - "Ultra Succ", - "Ethan", - "Pacnysam", - "dummyAzure", - "Jaykob", - "Goblin", - "NoOneElse", - "Nicholas", - "oli saer", - "Blobby6799", - "Domrinth", - "zombieseatflesh7", - "Shiny", - "Whale", - "The Infinity", - "MrCreamen", - "TemperedAether", - "LucasTwocas", - "JustLonelyPi", - "Brian", - "Ashton", - "Rolandark", - "Ally2Cute", - "Dionysos", - "Plant Waifu", - "fire", - "Charles", - "Kaden", - "Dr. Pawsworth", - "Jackson", - "Freakish", - "Ashamper", - "Kinzoku", - "Elementari", - "The Wolf Commando", - "Jordan", - "Jessire", - "Ashton", - "callisto", - "velneu", - "Mathuantie", - "Robert", - "Matias", - "T E R M I N A T O R", - "apotofkoolaid", - "Matthew", - "Terrarian Dragon", - "Pomelo", - "Thomas", - "Iconic Parker Gaming", - "Jaydon", - "Aidan", - "Avery", - "yayoi", - "Splotchycrib", - "GIGA MAN", - "Eric", - "Merubel", - "Smug", - "Lime-Wars l 1", - "WillyDilly", - "xAqult", - "Himakaze", - "Face", - "Carboniferous", - "James", - "Taitou1", - "Yumi", - "NEBULA", - "Blackbluue", - "Alex", - "Ruben", - "Rixu", - "Antonie", - "Zerimore", - "Oblivionisbruh", - "Loser", - "Patrick", - "Magic Love", - "gluten tag", - "RetroRed", - "Katherine", - "SoyScoutSmasher", - "Jersey", - "Reiter splash", - "Conner", - "Ekun", - "Driser", - "bikmin", - "MittoMan", - "Pyromaniac146", - "Eddie Spaghetti", - "Colin", - "ZyferDex_", - "LumiEvi", - "Anish", - "MissMudflaps", - "Valkyrie", - "anglerraptor", - "Scribbles", - "Pneuma", - "OrrangProto", - "Tomat (Stevie)", - "That Katsafaros", - "PsychoGrizzly", - "Dayne", - "Hargestar", - "The Pyro", - "Lucas", - "Superbeepig", - "Larry That Barry", - "Monti", - "StarryFox", - "Kevin", - "Poopifier Poopifly", - "Lacuna", - "Nathan", - "Handburger", - "XusTingo9", - "Underlost", - "julius", - "Mark", - "Habb", - "Reanamet", - "Empress Vega", - "Team", - "GP", - "Xsiana", - "NyanLegacy215", - "ethan", - "Trinity Series", - "M001NG", - "WrathOfOlympus", - "dennis", - "Darkweb", - "Chaozhi", - "Mars", - "Elijah", - "Tezguin", - "Shpee", - "Archie", - "Meow", - "CosmicStarIight", - "Alfragiste", - "Number1piratepan", - "Noah", - "Max Kim", - "Anton", - "edm vibes", - "Hunter", - "Doodled_lynx", - "3en", - "Kiyotu", - "Aero", - "Iguy", - "병현 송", - "Tyler", - "Leonidas", - "GregTheSpinarak", - "Cheddar", - "Alex N", - "Magicoal", - "Seanツ", - "Ariscottle", - "Kevin", - "OnTheAirPogs", - "Zerafir", - "Bill", - "Starmitzy", - "FaeLoPondering", - "Brian", - "Smart2004", - "sherk", - "Squishy", - "Ash", - "rawpie2", - "Hokojin", - "sk", - "Done", - "MeanieG", - "Sanctuary", - "Landon", - "Moonicento", - "Hayden", - "Steven", - "Hana", - "Mikabul", - "Nathaniel", - "Brutus", - "EdelVollMilch", - "garfu", - "NuT NiTe", - "adain", - "Dylan", - "Lucas", - "Arthur", - "sweatingdishes", - "pomp neigh", - "Proffesor prostate", - "Saladify", - "26-4-1", - "VeryMasterNinja", - "Vorbis", - "Nyapano", - "Shadoku", - "allosar", - "jes", - "Paltham", - "Fartein", - "Derdjin", - "A_Normal_Person", - "Duck Satan", - "Jalapeno9", - "Grylken", - "Nexus", - "KJ", - "Goober", - "ChAoS DiScOrD", - "Mayhem", - "Zombified _G", - "Madd Cat", - "Natalie", - "Solaire", - "Dakota C", - "The Davester", - "Jose", - "Him", - "Umberto", - "Lance", - "Navigator", - "Ferret4T", - "Rooki", - "LvL-94", - "Feels Fishy", - "Korb Orb", - "Calcium Comrade", - "Talmadge", - "ddoogg88 tdog", - "CasualNoLifer", - "Bossy Punch", - "Creamy", - "Tyler", - "topnormal", - "Gilded Gryphon", - "Nightskyflyer", - "Schlarfblrfsch", - "MrNobody", - "Aden C.N.", - "zombie wolf", - "n0tacat", - "Marko", - "dexxer65", - "DeLordeyeee", - "Kaledoulas", - "Mohammad", - "Skeli_G", - "Arcxus", - "Sigil", - "Dull", - "DjackV", - "Misinput", - "Gameology", - "KugelBlitz", - "TheGreatSako", - "Joep", - "Rottingwood", - "anything5000", - "Gretchen", - "Spirit Shield", - "Briny_Coffee", - "_Skeggy_", - "just akkolite", - "J.U.N.E.S", - "Bruggs", - "Vimek Xol", - "Oceanman232", - "Sadouken", - "srxe", - "ProfessorWinston", - "OctolingGrimm", - "Cole", - "Markie", - "Met Vox", - "Tweee", - "Kaimonick", - "Chow Chow", - "drenmus!", - "Nitronium Productions", - "Goomfrontlut", - "Akkolite", - "Shaun", - "Bruh.PNG", - "James", - "Lord_Lucerne", - "Ulmod", - "Adamko", - "Gamma Freya", - "Finnrua", - "Maskedmilo", - "RockRecker39", - "Konorango", - "Indeciiissive", - "Curtis", - "Ponynator", - "Crippling-Ambition", - "TitaniumLlama", - "OriginForme487", - "FishBread", - "Real mystlc", - "Levi", - "jc.", - "Medi", - "Jakob", - "Borb9834", - "Georgios", - "KeL", - "Cody", - "Cristian(Mihaii)", - "Marco", - "RuskieThe3rd", - "BreachNClear747", - "happy thoughts", - "Azure", - "theHoopty", - "porglesupreme", - "XDkilljoy65XX", - "Mr. Bones", - "dawnboi", - "Joe", - "Sailor Jolt", - "SomeRando", - "Nuclear Chaos", - "Jankle", - "The Roborex", - "everquartz", - "discokittie", - "IsaacInsomnia", - "xElectrix_", - "Forge", - "MiyoshiEira", - "thebettercat", - "Darthlego", - "Azzilan", - "Griffin", - "LucasHM", - "ChrigTopher", - "Colin V", - "Scrumlet", - "Darkus", - "Homunculus Derelictus", - "Professor Pissington", - "Buppercups - Roblox", - "Pusheen_", - "Patrera" - ]; - } - - public override void Unload() => List = null; + /// + /// This list contains all the donors of the current Patreon, which is for the entire Calamity Dev Team.

+ /// There is no overlap between OriginalPatreonList and this list.

+ /// Any user who donates to the new team-wide Patreon gets added to this new list and removed from the old one. + ///
+ internal static IList NewPatreonList { get; private set; } /// - /// Returns 25 random donator usernames. + /// This list contains all the donors of the previous Patreon, which was in Fabsol's name.

+ /// There is no overlap between NewPatreonList and this list.

+ /// Any user who donates to the new team-wide Patreon gets added to the new list and removed from this one. ///
- public static string[] GetRandomDonors() - { - List donorList = new(List); - const int maxDonorsListed = 25; - string[] donors = new string[maxDonorsListed]; - for (int i = 0; i < maxDonorsListed; i++) - { - donors[i] = donorList[Main.rand.Next(donorList.Count)]; - donorList.Remove(donors[i]); - } + internal static IList OriginalPatreonList { get; private set; } - return donors; + public override void OnModLoad() + { + // All donors at the $10 - Brimstone tier or higher are included in the shout-out. + // This is updated for each release. + NewPatreonList = + [ + "Aerosyn", + "Aidan Spears", + "Amandalias", + "Arcxus", + "Ariallis", + "Audrey Lynn Beemus", + "awesomechapro", + "Azariah", + "azazel", + "Ballin", + "Barrett Turner", + "BlueRay_256", + "Boomdiada", + "Borb9834", + "botbot94", + "Bwlstorm", + "c0d3_404", + "Carduelis", + "Careless_imp", + "Chin", + "Cinder", + "CrazyGamer69", + "Darthlego", + "Diamond Nife", + "djsnj20", + "DOGMA", + "DogVTF", + "drake093104", + "Entrian", + "Equinoxux", + "EternalGrayson", + "FishBread", + "goo", + "Grant Curtiss", + "haefer.goat.oats", + "Halleyvetica", + "Hamsting", + "help", + "Iptktp9", + "J.U.N.E.S", + "Jace Ufret", + "Jalapeno9", + "Jankle", + "JFL", + "Kiddorox", + "Liam Rafle", + "Magicoal", + "Mint_loll", + "MizzUltraViolet DamienTK", + "Nature", + "niceguysrage", + "Nick H", + "Nightinglade", + "Nothin Purrsonal", + "Nova Solarius", + "NyxxyNightstar", + "OakhamSam", + "PantySlack", + "Patch357", + "Phil Broome", + "Qwertz", + "Reece", + "roryoftheabyss", + "RuskieThe3rd", + "Sable", + "SakuraWinterz", + "Salted Warlock", + "schmoovi", + "Sharktank6", + "Shayy", // Current dev. Listed as "Shay" on Patreon. + "SirChaos189", + "SkeletonHunter96", + "Taelishe", + "Taylor Olligoci", // also an ex-dev. Listed as "Lilac Olligoci" on Patreon. There were two "Taylor"s on the old list + "Tethox", + "That Katsafaros", + "The Deer Who Sold The World", + "The Roborex", + "The Wither", + "Trinity Series", + "Tsukara", + "Vanillin", + "Vertigo", + "weisslerren", + "xAqult", + "Xtra Trinity 3678", + "Xtra", + "Xzier_Tengal", + "YashimaYamanata", + "Zachtoplasm", + "ZoeyPlague", + ]; + + // Historical donor list. Please never remove names from here unless you are also adding them to NewPatreonList. + OriginalPatreonList = + [ + "_Skeggy_", + "116taj", + "26-4-1", + "2Larry2", + "3en", + "3x1t_5tyl3", + "A_Normal_Person", + "adain", + "Adamko", + "Aden C.N.", + "Aero", + "Aero (Aero#4599)", + "Aeroni", // previously "Toxin" + "Æthereal", + "Afzofa", + "Aidan", + "Akkolite", + "Albino gonkvader", + "Alec", + "Aleksanders", + "Aleksh", + "Alex", + "Alex N", + "Alexander", + "Alexis", + "Alfragiste", + "Allegro", + "allosar", + "Ally2Cute", + "Altzeus", + "anglerraptor", + "Anish", + "Anton", + "Antonie", + "anything5000", + "Apotheosis", + "apotofkoolaid", + "Arcadia", + "Arche", + "Archie", + "Ari", + "Ariscottle", + "Arkhine", + "Arthur", + "Arti", + "asdf935", + "Ash", + "Ashamper", + "Asheel", + "Ashton", + "Ashton", + "Avery", + "Azura", + "Azure", + "Azzilan", + "BakaQing", + "Barbara", + "Ben", + // "Ben Shapiro", // 01JUN2025: Ozzatron: we already have this as a guide name. That's enough. Melting him in lava is appropriate. Crediting him for funding is not. + "Bendy", + "Beta165", + "bikmin", + "Bill", + "Billy", + "Blackbluue", + "Bladesaber", + "Blobby6799", + "BobIsNotMyRealName", + "Boomdiada", + "Borb9834", + "Bossy Punch", + "Braden", + "BreachNClear747", + "Bread", + "Brendan", + "Brian", + "Brian", + "Briny_Coffee", + "Broken Faucet", + "Bruggs", + "Bruh.PNG", + "Brutus", + "Brutzli", + "BumbleDoge", + "Buppercups - Roblox", + "CaineSenpai", + "Calcium Comrade", + "callisto", + "Cameron", + "Cameron", + "Carboniferous", + "CasualNoLifer", + "Cerberus", + "Chaos", + "ChAoS DiScOrD", + "ChaosChaos", + "Chaotic Reks", + "Chaozhi", + "Charles", + "Check pins", + "Cheddar", + "Chigbungus", + "Chip", + "Chow Chow", + "ChrigTopher", + "Christopher", + "Circuit-Jay", + "cocodezi_", + "Cody", + "Cole", + "Colin", + "Colin V", + "Commmander Frostbite", + "Conner", + "Coolguystorm YT", + "Corn M. Cobb", + "cosmickalamity", + "CosmicStarIight", + "CrabBar", // Current dev. + "Creamy", + "CrimsonCrips", + "Crippling-Ambition", + "Cristian(Mihaii)", + "Crysthamyr", + "Culex", + "Curtis", + "cytokat", + "Daawnz", + "Dakota", + "Dakota C", + "DanYami", + "DaPyRo", + "darkhawke", + "Darkus", + "Darkweb", + "Darren", // Current dev. + "Darthlego", + "Dasdruid", + "dawn thunder", + "dawnboi", + "Dayne", + "ddoogg88 tdog", + "Deallly", + "Dee", + "DeLordeyeee", + "DemoN K!ng", + "dennis", + "Depressed Dad Gaming", + "Derdjin", + "DESPACITO", + "Destiny Stallcup", + "Destructoid", + "DevAesthetic", + "DevilSunrise", + "Devin", + "Devon", + "Devonte", + "dexxer65", + "Dionysos", + "discokittie", + "DjackV", + "djsnj20", + "Domrinth", + "Done", + "Doodled_lynx", + "Doug", + "Doveda", + "Dr. Pawsworth", + "Drakkece", + "drenmus!", + "Drip Veezy", + "Driser", + "Duck Satan", + "Dull", + "dummyAzure", + "Dylan", + "Eddie Spaghetti", + "EdelVollMilch", + "edm vibes", + "Ein", + "Eisaya", + "Ekun", + "Elementari", + "Elfinlocks", + "Elijah", + "Empress Vega", + "Eragon3942", + "Eric", + "Eternal Silence", + "ethan", + "Ethan", + "everquartz", + "F00d Demon", + "Face", + "FaeLoPondering", + "False", + "Fartein", + "Faye", + "Feels Fishy", + "Ferret4T", + "Finnrua", + "fire", + "Fish Repairs", + "FishBread", + "Fizzlpoprock", + "Florian", + "Forge", + "Freakish", + "Frederik", + "Fweepachino", + "Gameology", + "GameRDheAsianSandwich", + "Gamma Freya", + "garfu", + "GentSkeleton", + "Georgios", + "Gibb50", + "GIGA MAN", + "Gilded Gryphon", + "Glaid", + "gluten tag", + "Goblin", + "Goober", + "Goomfrontlut", + "GP", + "GreenBerry", + "GreenTea", + "GregTheSpinarak", + "Gretchen", + "Griffin", + "Grylken", + "GTW High Cube", + "Guwahavel", + "Habb", + "Hana", + "Handburger", + "Hannes", + "Hans Volter", + "happy thoughts", + "Hargestar", + "Hayden", + "Hayden", + "Helixas", + "HellGoat2", + "High Charity", + "Him", + "Himakaze", + "Hokojin", + "Homunculus Derelictus", + "hoosfire", + "hubert thieblot", + "Hunter", + "Iconic Parker Gaming", + "Iguy", + "Indeciiissive", + "IsaacInsomnia", + "Izuna", + "J.U.N.E.S", + "Jack", + "JackShizz", + "Jackson", + "Jakob", + "Jalapeno9", + "James", + "James", + "Jankle", + "Jarod", + "Javyz", + "Jaydon", + "Jaykob", + "jc.", + "Jeff", + "Jeff", + "Jenonen", + "JensB__", + "Jersey", + "jes", + "Jessire", + "Jetpat3", + "Jheybyrd", + "jjth0m3", + "Joe", + "Joep", + "Jordan", + "Jose", + "Joshua", + "julius", + "Just a random guy", + "just akkolite", + "JustLonelyPi", + "Kaden", + "Kaimonick", + "Kaledoulas", + "KAT-G307", + "Katherine", + "Kazurgundu", + "KeL", + "Kevin", + "Kevin", + "kgh8090", + "Kinzoku", + "Kipluck", + "Kiyotu", + "KJ", + "Konorango", + "Korb Orb", + "Krankwagon", + "KugelBlitz", + "KurlozClown", + "Lacuna", + "Lady Shira", + "Lagohz", + "Lance", + "Landon", + "Larry That Barry", + "Lauren", + "Leonidas", + "Levi", // Ex-developer. + "Levi", + "Lightedflare", + "Lilith", + "Lime-Wars l 1", + "Littlepiggy", + "Lodude", + "LompL", + "Lord_Lucerne", + "Loser", + "Lucas", + "Lucas", + "LucasHM", + "LucasTwocas", + "Lucazii", + "Luis", + "Luke", + "LumiEvi", + "LvL-94", + "M001NG", + "Madd Cat", + "Magic Love", + "Magicoal", + "MajinBagel", + "Malik", + "Marco", + "Marissa443", + "Mark", + "Markie", + "Marko", + "Mars", + "martyrdomination", + "Maskedmilo", + "Mathuantie", + "Matias", + "Matthew", + "Max Kim", + "MaxingOut", + "Mayhem", + "MeanieG", + "Medi", + "Melvin", + "Mendzey", + "Meow", + "Merubel", + "Met Vox", + "Mikabul", + "Min", + "MingWhy", + "Minty Candy", + "MishiroUsui", + "Misinput", + "MissMudflaps", + "Mister Winchester", + "MittoMan", + "MiyoshiEira", + "Mobian", + "Mohammad", + "Moist Lad", + "Monic", + "Monti", + "Moonicento", + "MovingTarget_086", + "Mr. Bones", + "Mr.Matter", + "MrCreamen", + "MrNobody", + "n0tacat", + "Naglfar", + "Nanaki", + "Natalie", + "Nathan", + "Nathaniel", + "Navigator", + "Ne'er Dowell", + "NEBULA", + "NebulaMagePlays", + "Nemesis 041", + "Neoplasmatic", + "NepNep", + "Nexus", + "Nicholas", + "Nightskyflyer", + "Nitronium Productions", + "Noah", + "NoOneElse", + "Nuclear Chaos", + "Nuclei", + "Number1piratepan", + "NuT NiTe", + "NyanLegacy215", + "Nyapano", + "Nycro", + "Oblivionisbruh", + "Obsoleek", + "Oceanman232", + "OctolingGrimm", + "oli saer", + "Olkothan", + "OnTheAirPogs", + "oracle", + "OriginForme487", + "OrrangProto", + "Orudeon", + "Pacnysam", + "Paltham", + "Patrera", + "Patrick", + "Pedro", + "Perditio Astrum", + "Picasso's Bean", + "Pigeon", + "Plant Waifu", + "Pneuma", + "Pomelo", + "pomp neigh", + "Ponynator", + "Poopifier Poopifly", + "Popsickle Yoshi", + "porglesupreme", + "Potato - Stego", + "Potion Man", + "Preston", + "Primpy", + "Prism", + "Professor Pissington", + "ProfessorWinston", + "Proffesor prostate", + "profoundmango69", + "PsychoGrizzly", + "Pusheen_", + "pyobbo", + "Pyromaniac146", + "Qelrin", + "Rando Calrissian", + "Random Weeb", + "rawpie2", + "Real mystlc", + "Reanamet", + "Reiter splash", + "RetroRed", + "Rinja", + "Rixu", + "RKMoon", + "Robert", + "RockRecker39", + "Rolandark", + "Rooki", + "Rossadon", + "Rottingwood", + "Roxas", + "Ruben", + "RuskieThe3rd", + "Ruthoranium", + "Ryaegos", + "Ryan", + "Ryan", + "Ryan Baker-Ortiz", + "Sabrina", + "Sadouken", + "Sailor Jolt", + "Saladify", + "Samuel", + "Sanctuary", + "Sandblast", + "Sarcosuchus", + "Schlarfblrfsch", + "SCONICBOOM", + "Scribbles", + "Scrumlet", + "Seanツ", + "Shadoku", + "SharZz", + "Shaun", + "Shay", // There were two "Shay"s on the old list + "sherk", + "Shifter", + "Shiny", + "Shiro", + "Shirosity", // used to be GlitchOut + "ShotgunAngel", + "Shpee", + "Sigil", + "sk", + "Skeli_G", + "Slim", + "Smart2004", + "Smug", + "Snowy", + "Soko", + "Solaire", + "SoloMael", + "SolsticeUnlimitd", + "SomeRando", + "SoyScoutSmasher", + "Spider region", + "Spirit Shield", + "Splotchycrib", + "SpookyNinja", + "Squishy", + "srxe", + "Starmitzy", + "StarryFox", + "Steven", + "Stormone", + "Streakist", + "Suicide Dreams", + "Superbeepig", + "sweatingdishes", + "T E R M I N A T O R", + "Tails the Fox 92", + "Taitou1", + "Takeru", + "Talmadge", + "Taylor", + "Team", + "TemperedAether", + "Terrarian Dragon", + "Tervastator", + "Tezguin", + "That Katsafaros", + "The Buildmonger", + "The Davester", + "The Goliath", + "The Illustrious Sqouinchuousor", + "The Infinity", + "The Pyro", + "The Roborex", + "The Wolf Commando", + "thebettercat", + "TheBlackHand", + "TheGreatSako", + "theHoopty", + "TheSilverGhost", + "Thomas", + "Thomas", + "ThomasThePencil", + "Thys", + "Timon", + "TitaniumLlama", + "Tomat (Stevie)", + "Tombarry Expresserino", + "topnormal", + "Trinity Series", + "TwanTheGOAT", + "Tweee", + "Tyler", + "Tyler", + "Uberransy", + "Ulmod", + "Ultra Succ", + "Umberto", + "Underlost", + "Valkyrie", + "vcf55", + "Veine", + "velneu", + "VeryMasterNinja", + "Vetus", + "Victor", + "Vimek Xol", + "Vmar98", + "Vorbis", + "Vroomy Has -3,000 IQ", + "Vyster", // previously "Bewearium" + "Warlok", + "Whale", + "Whitegiraffe", + "Will", + "william", + "William", + "William", + "WillyDilly", + "WinterTire", + "Woah", + "Wodernet", + "Wolfmaw", + "WrathOfOlympus", + "Xaphlactus", + "xAqult", + "xd Ow0", + "XDkilljoy65XX", + "xElectrix_", + "Xenocrona", + "Xenocrona", + "Xsiana", + "XusTingo9", + "Yatagarasu", + "yayoi", + "Yhashtur", + "yiumik", + "YuH", // Current dev. + "YumeiSenshi", + "Yumi", + "Zacky", + "Zekai", + "Zerafir", + "Zerimore", + "zombie wolf", + "Zombieh", + "zombieseatflesh7", + "Zombified _G", + "ZyferDex_", + "병현 송", + ]; + + // Staple the two lists together. + List = [..OriginalPatreonList, ..NewPatreonList]; + } + + public override void Unload() + { + OriginalPatreonList = null; + NewPatreonList = null; + List = null; } } } diff --git a/Systems/Collections/KamiDebuffColorImmuneList.cs b/Systems/Collections/KamiDebuffColorImmuneList.cs deleted file mode 100644 index 028faa8375..0000000000 --- a/Systems/Collections/KamiDebuffColorImmuneList.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.OldDuke; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class KamiDebuffColorImmuneList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. - // This is a list so that other NPCs can be added as necessary. - // IT DOES NOT make them immune to the debuff, just stops them from being recolored. - List = - [ - NPCID.DukeFishron, - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/SummonTagBuffList.cs b/Systems/Collections/SummonTagBuffList.cs new file mode 100644 index 0000000000..c37383d0bd --- /dev/null +++ b/Systems/Collections/SummonTagBuffList.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Summon.Whips; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all summon tag buff's IDs. + /// + public sealed class SummonTagBuffList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + BuffID.CoolWhipPlayerBuff, + BuffID.ScytheWhipPlayerBuff, + BuffID.SwordWhipPlayerBuff, + BuffID.ThornWhipPlayerBuff, + BuffType() + ]; + } + + public override void Unload() => List = null; + + /// + /// A shorthand method to check whether or not a buff ID is a summon tag buff. + /// + public static bool Includes(int buffID) => List.Contains(buffID); + } +} diff --git a/Systems/Collections/SummonTagDebuffDict.cs b/Systems/Collections/SummonTagDebuffDict.cs new file mode 100644 index 0000000000..ca07c34f3f --- /dev/null +++ b/Systems/Collections/SummonTagDebuffDict.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.Summon.Whips; +using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Summon; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + /// + /// A that contains a of all summon tag debuff's IDs and their associated SummonTag. + /// + public sealed class SummonTagDebuffDict : ModSystem + { + public static IDictionary Dict { get; private set; } + + public override void OnModLoad() + { + Dict = new Dictionary + { + { BuffID.BlandWhipEnemyDebuff, SummonTag.LeatherWhip }, + { BuffID.BoneWhipNPCDebuff, SummonTag.SpinalTap }, + { BuffID.CoolWhipNPCDebuff, SummonTag.CoolWhip }, + { BuffID.FlameWhipEnemyDebuff, SummonTag.Firecracker }, + { BuffID.MaceWhipNPCDebuff, SummonTag.MorningStar }, + { BuffID.RainbowWhipNPCDebuff, SummonTag.Kaleidoscope }, + { BuffID.ScytheWhipEnemyDebuff, SummonTag.DarkHarvest }, + { BuffID.SwordWhipNPCDebuff, SummonTag.Durendal }, + { BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn }, + { BuffType(), ProfanedSoulCrystal.SummonTag }, + }; + + } + + public override void Unload() + { + Dict?.Clear(); + Dict = null; + } + + /// + /// A shorthand method to obtain a SummonTag from its debuff. + /// + public static bool TryGet(int buffType, out SummonTag tag) + { + return Dict.TryGetValue(buffType, out tag); + } + + public static bool Add(int buffType, SummonTag tag) + { + return Dict.TryAdd(buffType, tag); + } + } +} diff --git a/Systems/GlobalSaveDataSystem.cs b/Systems/GlobalSaveDataSystem.cs new file mode 100644 index 0000000000..3f4b0116f8 --- /dev/null +++ b/Systems/GlobalSaveDataSystem.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class GlobalSaveDataSystem : ModSystem + { + internal static List GlobalSaveDataKeys = []; + + /// + /// The directory in which all files related to globall saved data are stored. + /// + internal static string GlobalSaveDataDirectoryPath; + + /// + /// The path to the text file which contains all globally saved data keys. + /// + internal static string GlobalSaveDataKeysPath; + + /// + /// The path to the README file explaining the purpose of the directory. + /// + internal static string READMEPath; + + public override void OnModLoad() + { + string savePathByOS = OperatingSystem.IsLinux() ? "~/.local/share/Terraria/tModloader/" : Main.SavePath; + GlobalSaveDataDirectoryPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData"; + GlobalSaveDataKeysPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData" + Path.DirectorySeparatorChar + "GlobalSaveDataKeys.txt"; + READMEPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData" + Path.DirectorySeparatorChar + "README.txt"; + + // Ensure that the save data keys text file exists. If not, create a new one. + if (!File.Exists(GlobalSaveDataKeysPath)) + { + // Create the directory if necessary. + if (!Directory.Exists(GlobalSaveDataDirectoryPath)) + Directory.CreateDirectory(GlobalSaveDataDirectoryPath); + + // Create both the Global Save Data text file, as well as a README file explaining the directory's purpose. + if (!File.Exists(READMEPath)) + { + using StreamWriter readme = File.CreateText(READMEPath); + readme.WriteLine("Hi! You're probably wondering what this directory is and why it exists if you've found it."); + readme.WriteLine("This is how the Calamity Mod currently manages data that is saved globally across all worlds. " + + "You will find all keys managing globally saved data in the other text file within this folder. You are free to remove " + + "any of those keys if you wish to reapply the lock on whatever in-game content they unlock. If you have no interest in doing so " + + "then it is recommended you simply leave the file as is."); + } + + File.CreateText(GlobalSaveDataKeysPath); + } + // If it does exist, read all keys from the text file and save them into the list. + else + { + GlobalSaveDataKeys = File.ReadAllLines(GlobalSaveDataKeysPath).ToList(); + } + } + + /// + /// Checks whether or not a key has been saved into the GlobalSaveDataKeys text file. + /// + /// True if the key has been saved, false otherwise. + public static bool IsKeyAlreadySaved(string key) => GlobalSaveDataKeys.Contains(key); + + /// + /// Saves a specified key into the GlobalSaveDataKeys text file. + /// + public static void SaveKey(string key) + { + // If the key already exists, log it as a warning and don't run any code. + if (GlobalSaveDataKeys.Contains(key)) + { + CalamityMod.Instance.Logger.Error($"WARNING! A global save data key \"{key}\" which has already been registered is attempting to be registered again. " + + "Please report this to the Calamity Mod Team if you see this!"); + return; + } + + File.AppendAllLines(GlobalSaveDataKeysPath, [key]); + GlobalSaveDataKeys.Add(key); + } + } +} diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a44c41515f..64d9163eba 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -455,7 +455,7 @@ namespace CalamityMod.Systems ItemType(), ItemType(), ItemType(), - ItemType(), + ItemType(), ItemType(), ItemID.Jetpack }; @@ -1338,13 +1338,6 @@ namespace CalamityMod.Systems r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); @@ -1416,6 +1409,13 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Bone, 2); r.AddTile(TileID.CookingPots); r.Register(); + r.DisableDecraft(); + + r = Recipe.Create(ItemID.Milkshake); + r.AddIngredient(ItemID.IceBlock); + r.AddIngredient(ItemID.MilkCarton); + r.AddTile(TileID.IceMachine); + r.Register(); r.DisableDecraft(); r = Recipe.Create(ItemID.Nachos); diff --git a/Systems/World/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs index 2b95101060..a5bdd31e7a 100644 --- a/Systems/World/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -56,7 +56,6 @@ namespace CalamityMod //Abyss.AbleToUnlockChests = false; //Yet another fucking failsave for abyss chests spawnedBandit = false; - spawnedCirrus = false; foundHomePermafrost = false; catName = false; @@ -92,8 +91,6 @@ namespace CalamityMod downed.Add("acidRain"); if (spawnedBandit) downed.Add("bandit"); - if (spawnedCirrus) - downed.Add("drunkPrincess"); if (foundHomePermafrost) downed.Add("archmageHome"); @@ -151,7 +148,6 @@ namespace CalamityMod BossRushEvent.BossRushActive = downed.Contains("bossRushActive"); AcidRainEvent.AcidRainEventIsOngoing = downed.Contains("acidRain"); spawnedBandit = downed.Contains("bandit"); - spawnedCirrus = downed.Contains("drunkPrincess"); foundHomePermafrost = downed.Contains("archmageHome"); #region Load Pet Names @@ -237,7 +233,7 @@ namespace CalamityMod BitsByte flags5 = new BitsByte(); flags5[0] = downedAstrumDeus; flags5[1] = spawnedBandit; - flags5[2] = spawnedCirrus; + flags5[2] = false; flags5[3] = AcidRainEvent.HasStartedAcidicDownpour; flags5[4] = false; flags5[5] = downedPolterghast; @@ -391,7 +387,7 @@ namespace CalamityMod BitsByte flags5 = reader.ReadByte(); downedAstrumDeus = flags5[0]; spawnedBandit = flags5[1]; - spawnedCirrus = flags5[2]; + _ = flags5[2]; AcidRainEvent.HasStartedAcidicDownpour = flags5[3]; _ = flags5[4]; downedPolterghast = flags5[5]; diff --git a/Systems/World/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs index 411eae4315..a0340e2c6d 100644 --- a/Systems/World/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -447,7 +447,7 @@ namespace CalamityMod.Systems int tileTypeToPlaceThickness = 3; bool placeLilies = true; - // Do not change this number, ever. - Fabsol + // Apparently this is a reference! int minDistanceFromOtherLilies = 66; for (int k = x - minDistanceFromOtherLilies; k < x + minDistanceFromOtherLilies; k += 2) diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index df971eb101..be629644b2 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -37,29 +37,53 @@ namespace CalamityMod.Systems public override void ModifyWorldGenTasks(List tasks, ref double totalWeight) { // Better Underworld (similar to Don't Dig Up seed but with some adjustments) - int UnderworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); - tasks[UnderworldIndex] = new PassLegacy("Underworld", (progress, config) => + int underworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); + if (underworldIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; - CustomUnderworld.NewUnderworld(); - }); + tasks[underworldIndex] = new PassLegacy("Underworld", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; + CustomUnderworld.NewUnderworld(); + }); + } + + // Replace the shimmer gen to make it place sanely + int shimmerIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shimmer")); + if (shimmerIndex != -1) + { + tasks[shimmerIndex] = new PassLegacy("Shimmer", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterShimmer").Value; + CustomShimmer.NewShimmer(); + }); + } // Better Underworld structures after the world has been smoothed - int UnderworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); - tasks.Insert(UnderworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => + int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); + if (underworldStructuresIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; - CustomUnderworld.NewUnderworldStructures(); + tasks.Insert(underworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => + { + 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.UnderworldPillars").Value; + CustomUnderworld.NewUnderworldPillars(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; - CustomUnderworld.AshTreesAndGrass(); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; + CustomUnderworld.AshTreesAndGrass(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; - CustomUnderworld.PlaceGeyserTraps(); - })); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; + CustomUnderworld.PlaceGeyserTraps(); + })); + + // Generate the Shimmer Shrine directly above the center of the underground Shimmer lake + tasks.Insert(underworldStructuresIndex + 2, new PassLegacy("Shimmer Shrine", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.ShimmerShrine").Value; + ShimmerShrine.PlaceShimmerShrine(GenVars.structures); + })); + } // Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); @@ -73,47 +97,59 @@ namespace CalamityMod.Systems } // Generate the Astral Chest right after the dungeon has finished generating - int DungeonIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); - tasks.Insert(DungeonIndex + 1, new PassLegacy("Astral Chest", (progress, config) => + int dungeonIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); + if (dungeonIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AstralChest").Value; - AstralChestGeneration.PlaceAstralChest(); - })); + tasks.Insert(dungeonIndex + 1, new PassLegacy("Astral Chest", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AstralChest").Value; + AstralChestGeneration.PlaceAstralChest(); + })); + } // Larger Jungle Temple - int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); - tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => + int jungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); + if (jungleTempleIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; - CustomTemple.NewJungleTemple(); - }); + tasks[jungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; + CustomTemple.NewJungleTemple(); + }); - // Floral Paradise Biome - tasks.Insert(JungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) => - { - progress.Message = "Growing a floral paradise underground"; - if (FloralParadiseMinibiome.SHOULD_GENERATE) - FloralParadiseMinibiome.GenerateInstances(); - })); + // Floral Paradise Biome + tasks.Insert(jungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) => + { + progress.Message = "Growing a floral paradise underground"; + if (FloralParadiseMinibiome.SHOULD_GENERATE) + FloralParadiseMinibiome.GenerateInstances(); + })); + } // Improved Golem Arena - int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); - tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => + int jungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); + if (jungleTempleIndex2 != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; - Main.tileSolid[162] = false; - Main.tileSolid[226] = true; - CustomTemple.NewJungleTemplePart2(); - Main.tileSolid[232] = false; - }); + tasks[jungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; + Main.tileSolid[162] = false; + Main.tileSolid[226] = true; + CustomTemple.NewJungleTemplePart2(); + Main.tileSolid[232] = false; + }); + } // Better Lihzahrd Altar (consistency?) - int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); - tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => + int lihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); + if (lihzahrdAltarIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.JungleTempleAltar").Value; - CustomTemple.NewJungleTempleLihzahrdAltar(); - }); + tasks[lihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.JungleTempleAltar").Value; + CustomTemple.NewJungleTempleLihzahrdAltar(); + }); + } // Big Hive int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); @@ -180,12 +216,11 @@ namespace CalamityMod.Systems } // Sunken Sea - int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); - if (SunkenSeaIndex != -1) + int sunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); + if (sunkenSeaIndex != -1) { - tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => + tasks.Insert(sunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { - int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; int sunkenSeaY = Main.maxTilesY / 2; @@ -221,10 +256,10 @@ namespace CalamityMod.Systems } // All further tasks occur right before vanilla worldgen is completed (which includes The Dirtiest Block and final secret seed adjustments) - int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); - if (FinalIndex != -1) + int finalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); + if (finalIndex != -1) { - int currentFinalIndex = FinalIndex - 1; + int currentFinalIndex = finalIndex - 1; // Reallocate gems so rarity corresponds to depth tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => @@ -246,10 +281,10 @@ namespace CalamityMod.Systems tasks.Insert(++currentFinalIndex, new PassLegacy("Planetoids", Planetoid.GenerateAllBasePlanetoids)); // Sulphurous Sea (Step 1) - int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); - if (SulphurIndex != -1) + int sulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); + if (sulphurIndex != -1) { - tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) => + tasks.Insert(sulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) => { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SulphurSea").Value; @@ -412,9 +447,7 @@ namespace CalamityMod.Systems // Could just not add/remove gen pass, but that could lead to mod conflicts // in case whatever mod targets this specific gen pass. if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) - { hardmodeOreT1Pass.Disable(); - } tasks.Insert(announceIndex, hardmodeOreT1Pass); } diff --git a/TileEntities/TECalamityPylon.cs b/TileEntities/TECalamityPylon.cs index 4f9c4fe060..e1b64a6094 100644 --- a/TileEntities/TECalamityPylon.cs +++ b/TileEntities/TECalamityPylon.cs @@ -2,7 +2,7 @@ namespace CalamityMod.TileEntities { - /// Copied from ExampleMod for documentation if needed for later -pixl + /// Copied from ExampleMod for documentation if needed for later /// /// This is an empty child class that acts exactly like the default implementation of the abstract /// class, which itself acts nearly identical to vanilla pylon TEs. This inheritance only exists so that modded pylon entities diff --git a/Tiles/Furniture/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index ae874cba1a..9475eadbcd 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class BlueCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -36,13 +36,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/Furniture/CirrusCouch.cs b/Tiles/Furniture/CirrusCouch.cs deleted file mode 100644 index 29551f8bb3..0000000000 --- a/Tiles/Furniture/CirrusCouch.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.ObjectInteractions; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Furniture -{ - public class CirrusCouch : ModTile - { - public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), true); - - public override bool CreateDust(int i, int j, ref int type) - { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkFairy); - return false; - } - - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); - - public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); - - public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) - { - return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); - } - } -} diff --git a/Tiles/Furniture/CirrusCouch.png b/Tiles/Furniture/CirrusCouch.png deleted file mode 100644 index 1bca32a64a..0000000000 Binary files a/Tiles/Furniture/CirrusCouch.png and /dev/null differ diff --git a/Tiles/Furniture/CirrusCouch_Highlight.png b/Tiles/Furniture/CirrusCouch_Highlight.png deleted file mode 100644 index 37368baef2..0000000000 Binary files a/Tiles/Furniture/CirrusCouch_Highlight.png and /dev/null differ diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs index aa81603cc5..26c5741cca 100644 --- a/Tiles/Furniture/CraftingStations/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -1,6 +1,7 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.CraftingStations; +using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; using CalamityMod.NPCs.SupremeCalamitas; @@ -79,9 +80,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public static void HoverItemIcon(int i, int j) { - bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; + bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (vodka) - Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); else if (Main.LocalPlayer.HasItem(ModContent.ItemType())) Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); else @@ -108,12 +109,12 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public static bool AttemptToSummonSCal(int i, int j) { if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && - !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) + !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) { return true; } - bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; + bool meat = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (NPC.AnyNPCs(ModContent.NPCType()) || BossRushEvent.BossRushActive) return true; @@ -130,14 +131,14 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations ritualSpawnPosition += new Vector2(0f, -24f); SoundEngine.PlaySound(SummonSound, ritualSpawnPosition); - Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0, vodka.ToInt()); + Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0, meat.ToInt()); - if (vodka) + if (meat) { - Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); foreach (NPC n in Main.ActiveNPCs) { - if (n.type == ModContent.NPCType()) + if (n.type == ModContent.NPCType()) n.active = false; } } diff --git a/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png b/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png index 434b490237..d1706759fe 100644 Binary files a/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png and b/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png differ diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs new file mode 100644 index 0000000000..c5b88b3613 --- /dev/null +++ b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs @@ -0,0 +1,72 @@ +using CalamityMod.Buffs.Potions; +using CalamityMod.Dusts; +using CalamityMod.ForegroundDrawing.LoopingTextures; +using CalamityMod.Items.Dyes; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class OldDukeMonolithTile : BaseMonolith + { + public override int TileWidth => 4; + public override int TileHeight => 8; + public override int AnimationFrameCount => 24; + public override int AnimationDelay => 6; + public override int CursorItemType => ModContent.ItemType(); + + public static Asset Numbers; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowMask = ModContent.Request($"{Texture}_Glow"); + //Numbers = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/ExoObeliskText", AssetRequestMode.AsyncLoad); + } + + RegisterItemDrop(CursorItemType); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 8; + Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 3, 0); + + AnimationFrameHeight = 8 * 18; + TileObjectData.newTile.CoordinateHeights = [16, 16, 16, 16, 16, 16, 16, 16]; + TileObjectData.addTile(Type); + + AddMapEntry(new Color(54, 54, 54)); + + DustType = DustID.TerraBlade; + } + + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) + { + if (!monolithEnabled) + return; + + if (localPlayer is not null && localPlayer.active) + { + localPlayer.GetModPlayer().ShouldDisplayTorrentMonolith = true; + } + } + } +} diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile.png b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.png new file mode 100644 index 0000000000..83f5ef659a Binary files /dev/null and b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Glow.png b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Glow.png new file mode 100644 index 0000000000..790669b2bf Binary files /dev/null and b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Highlight.png new file mode 100644 index 0000000000..f1dd43be8f Binary files /dev/null and b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index 3ffb8dbfab..f2b8f483c8 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class PinkCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -36,13 +36,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index 31d1864cf7..dd2a5e9886 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class PurpleCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -36,13 +36,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index 177df09292..d9780550bc 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class YellowCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -35,13 +35,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/SunkenSea/Ambient/MediumCoral.cs b/Tiles/SunkenSea/Ambient/MediumCoral.cs index 17c303c016..cfbc62a123 100644 --- a/Tiles/SunkenSea/Ambient/MediumCoral.cs +++ b/Tiles/SunkenSea/Ambient/MediumCoral.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.38f; - g = 0.05f; - b = 0.28f; + g = 0.28f; + b = 0.32f; } } diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs index d5b5e0d43e..51cb82f638 100644 --- a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs +++ b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs @@ -67,7 +67,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient float brightness = 0.9f; brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.01f + i); Color lilac = new Color(126, 94, 252); - Color mint = new Color(96, 252, 236); + Color mint = new Color(96, 252, 186); Color value = Color.Lerp(lilac, mint, (MathF.Sin(j / 30f + Main.GameUpdateCount * 0.017f + -i / 40f) + 1f) / 2f); Color value1 = Color.Lerp(lilac, mint, (MathF.Sin((-j - 100) / 40f + Main.GameUpdateCount * 0.014f + i / 20f) + 1f) / 2f); r = (value.R + value1.R) / 450f; diff --git a/Tiles/SunkenSea/Ambient/WallCoral.cs b/Tiles/SunkenSea/Ambient/WallCoral.cs index 346747394c..39e2e2dd73 100644 --- a/Tiles/SunkenSea/Ambient/WallCoral.cs +++ b/Tiles/SunkenSea/Ambient/WallCoral.cs @@ -64,9 +64,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.458f; - g = 0.196f; - b = 0.387f; + r = 0.38f; + g = 0.28f; + b = 0.32f; } } } diff --git a/Tiles/Underworld/Dreadstone.cs b/Tiles/Underworld/Dreadstone.cs new file mode 100644 index 0000000000..8d8a70bc47 --- /dev/null +++ b/Tiles/Underworld/Dreadstone.cs @@ -0,0 +1,40 @@ +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 new file mode 100644 index 0000000000..47e2b916d8 Binary files /dev/null and b/Tiles/Underworld/Dreadstone.png differ diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index acc4d7cb1b..ddde388064 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -357,7 +357,6 @@ namespace CalamityMod.UI.ModeIndicator // Cannot switch to Death Mode if Master Mode isn't active. // Cannot switch to Revengeance Mode if Master Mode is active. - // I hate how this is coded, it makes me want to smash my head through a wall. - Fabsol bool cannotSwitchTo = (!Main.masterMode && mode == Difficulties[2]) || (Main.masterMode && mode == Difficulties[1]); if (ClickingMouse && !cannotSwitchTo) SwitchToDifficulty(mode); diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 6b19c38c64..57b5b078bb 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -832,25 +832,6 @@ namespace CalamityMod return p.Calamity().tarraSet; }); - internal const float TrasherEatDistance = 96f; - public static IItemDropRuleCondition AnglerFedToTrasherCondition = If((info) => - { - bool trasherNearby = false; - foreach (NPC nearby in Main.ActiveNPCs) - { - if (nearby.type != ModContent.NPCType()) - continue; - if (info.npc.Distance(nearby.Center) < TrasherEatDistance) - { - trasherNearby = true; - break; - } - } - return trasherNearby; - }); - // The text is a separate rule so it doesn't show up on the non-Trasher Fishing Rod drop which only occurs if the Angler is not fed to a Trasher - public static IItemDropRuleCondition TrasherText => CalamityConditions.TrasherTextCondition.ToDropCondition(ShowItemDropInUI.Always); - // Remix seed drop rules public static IItemDropRuleCondition Remix => Condition.RemixWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); public static IItemDropRuleCondition NotRemix => Condition.NotRemixWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 4c2a9d9c09..8108deec16 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -225,6 +225,37 @@ namespace CalamityMod /// The input value. public static int DirectionalSign(this float x) => (x > 0f).ToDirectionInt(); + + /// + /// Approximates the derivative of a function at a given point based on a central-difference formula. + /// + /// The function to take the derivative of. + /// The value to evaluate the derivative at. + public static double ApproximateDerivative(this Func fx, double x) + { + double left = fx(x + 1e-7); + double right = fx(x - 1e-7); + return (left - right) * 5e6; + } + + /// + /// Searches for an approximate for a root of a given function. + /// + /// The function to find the root for. + /// The initial guess for what the root could be. + /// The amount of iterations to perform. The higher this is, the more generally accurate the result will be. + public static double IterativelySearchForRoot(Func fx, double initialGuess, int iterations) + { + double result = initialGuess; + for (int i = 0; i < iterations; i++) + { + double derivative = (float)fx.ApproximateDerivative(result); + result -= fx(result) / derivative; + } + + return result; + } + public static List GetIntersectingPointsInLine(Point start, Point end) { List intersectingCells = []; diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index e66a64ece0..81e4aecbd5 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -462,7 +462,7 @@ namespace CalamityMod if (modPlayer.rampartOfDeities && hurtInfo.Damage > 200) extraIFrames += 30; - if (modPlayer.cirrusVodka) + if (modPlayer.purpleHaze) { if (hurtInfo.Damage == 1) extraIFrames += 5; diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 6439becdb8..0b57888e4f 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -73,8 +73,6 @@ namespace CalamityMod.World /// If true, the Bandit has lived in this world. Used to ensure their spawn condition is not required on subsequent respawns. public static bool spawnedBandit = false; - /// If true, the Drunk Princess has lived in this world. Used to ensure her spawn condition is not required on subsequent respawns. - public static bool spawnedCirrus = false; /// If true, the Archmage has lived in a house in this world. Solely used as a condition for dialogue. public static bool foundHomePermafrost = false; diff --git a/World/CustomShimmer.cs b/World/CustomShimmer.cs new file mode 100644 index 0000000000..6d399c4a5c --- /dev/null +++ b/World/CustomShimmer.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class CustomShimmer + { + public static void NewShimmer() + { + // Large = 4, Medium = 3, Small = 2 + int worldSize = (int)(Main.maxTilesX / 4200f * 2f); + int minOffsetX = 240; + int maxOffsetX; + switch (worldSize) + { + default: + case 2: + maxOffsetX = 300; + break; + + case 3: + maxOffsetX = 360; + break; + + case 4: + maxOffsetX = 420; + break; + } + + int offset = 50; + int shimmerMinDepth = (int)((Main.worldSurface + Main.rockLayer) * 0.5) + offset; + int shimmerMaxDepth = (int)(((double)((Main.maxTilesY - 250) * 2) + Main.rockLayer) * 0.33); + shimmerMaxDepth = (int)MathHelper.Clamp(shimmerMaxDepth, shimmerMinDepth + 50, Main.maxTilesY - 460); + + int shimmerPositionY = WorldGen.genRand.Next(shimmerMinDepth, shimmerMaxDepth); + int shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); + int remixSeedShimmerMinDepth = (int)Main.worldSurface + 150; + int remixSeedShimmerMaxDepth = (int)((Main.rockLayer + Main.worldSurface + 200D) * 0.5); + if (remixSeedShimmerMaxDepth <= remixSeedShimmerMinDepth) + remixSeedShimmerMaxDepth = remixSeedShimmerMinDepth + 50; + + if (WorldGen.tenthAnniversaryWorldGen) + shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth); + + int attempts = 0; + while (!WorldGen.ShimmerMakeBiome(shimmerPositionX, shimmerPositionY)) + { + attempts++; + if (WorldGen.tenthAnniversaryWorldGen && attempts < 10000) + { + shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth); + shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); + } + else if (attempts > 20000) + { + shimmerPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 120, shimmerMaxDepth); + shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX * 2, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX * 2)); + } + else + { + shimmerPositionY = WorldGen.genRand.Next((int)((Main.worldSurface + Main.rockLayer) * 0.5) + 20, shimmerMaxDepth); + shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); + } + } + + GenVars.shimmerPosition = new Vector2D(shimmerPositionX, shimmerPositionY); + int genArea = 200; + GenVars.structures.AddProtectedStructure(new Rectangle(shimmerPositionX - (int)(genArea * 0.5f), shimmerPositionY - (int)(genArea * 0.5f), genArea, genArea)); + } + } +} diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs index 23df6a3460..60b43a5528 100644 --- a/World/CustomUnderworld.cs +++ b/World/CustomUnderworld.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.Tiles.Underworld; using CalamityMod.Schematics; using Microsoft.Xna.Framework; using ReLogic.Utilities; @@ -7,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Generation; using Terraria.ID; +using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.Schematics.SchematicManager; @@ -1304,7 +1306,7 @@ namespace CalamityMod.World int pillarRightSize = 0; int topTileSectionSize = 10; int pillarTopTileSectionCutOff = pillarIndexStarY + topTileSectionSize; - ushort pillarTileID = Main.zenithWorld ? TileID.PoopBlock : TileID.StoneSlab; + 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 diff --git a/World/ShimmerShrine.cs b/World/ShimmerShrine.cs new file mode 100644 index 0000000000..6da42ae74d --- /dev/null +++ b/World/ShimmerShrine.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class ShimmerShrine + { + public static void PlaceShimmerShrine(StructureMap structures) + { + string mapKey = ShimmerShrineKey; + var schematic = TileMaps[mapKey]; + + int placementPositionX = (int)GenVars.shimmerPosition.X; + int placementPositionY = (int)Main.worldSurface - 250; + int offset = 28; + + while (!Main.tile[placementPositionX, placementPositionY].HasTile) + placementPositionY++; + + Point placementPoint = new Point(placementPositionX, placementPositionY + offset); + SchematicAnchor anchorType = SchematicAnchor.Center; + + bool place = true; + PlaceSchematic(mapKey, placementPoint, anchorType, ref place, new Action(FillShimmerShrineChest)); + + Rectangle protectionArea = CalamityUtils.GetSchematicProtectionArea(schematic, placementPoint, anchorType); + CalamityUtils.AddProtectedStructure(protectionArea, 30); + } + + public static void FillShimmerShrineChest(Chest chest, int Type, bool place) + { + List contents = new List() + { + new ChestItem(ItemID.AngelStatue, 1), + new ChestItem(WorldGen.genRand.NextBool() ? ItemID.LifeCrystal : ItemID.ManaCrystal, 1), + new ChestItem(GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(5, 16)), + new ChestItem(ItemID.CanOfWorms, WorldGen.genRand.Next(3, 5)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 11)), + new ChestItem(ItemID.LuckPotionGreater, WorldGen.genRand.Next(1, 3)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 5)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + } +} 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; } diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 03ea993426..da17625dd3 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -303,7 +303,7 @@ namespace CalamityMod.World { float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - // This lerp does absolutely nothing. - Fabsol + // This lerp does absolutely nothing. float ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 2cb56c1145..d1379f1d3c 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -752,7 +752,7 @@ namespace CalamityMod.World new ChestItem(ItemType(), 1), new ChestItem(ItemID.PinkGel, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(50, 60 + 1)), - new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 4 + 1)), new ChestItem(Main.zenithWorld ? ItemID.RestorationPotion : ItemID.LesserHealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(Main.zenithWorld ? ItemID.GasTrap : ItemID.Mushroom, Main.zenithWorld ? 1 : WorldGen.genRand.Next(5,9+1)), diff --git a/build.txt b/build.txt index b2de9aca5b..23f413337a 100644 --- a/build.txt +++ b/build.txt @@ -1,4 +1,4 @@ -author = Fabsol and the Dev Team +author = The Calamity Dev Team version = 2.0.4.006 displayName = Calamity Mod modReferences = CalamityModMusic diff --git a/description.txt b/description.txt index 2d245627a8..cc8249777f 100644 --- a/description.txt +++ b/description.txt @@ -5,9 +5,9 @@ The mod also makes hundreds of adjustments to vanilla items, features and mechan Calamity adds significant progression to the game after defeating the Moon Lord, including many new tiers of equipment. A more detailed breakdown of the content available in Calamity: -- 27 bosses and 12 minibosses +- 27 bosses and 5 minibosses - 200+ enemies -- 5 town NPCs +- 4 town NPCs - 5 biomes and many new structures - 1 event - 1 new playable class (based on Throwing from Terraria 1.3) diff --git a/description_workshop.txt b/description_workshop.txt index 3cdb56ca5b..097c434b08 100644 --- a/description_workshop.txt +++ b/description_workshop.txt @@ -25,9 +25,9 @@ https://steamcommunity.com/sharedfiles/filedetails/?id=2816188633 A more detailed breakdown of the content available in Calamity: [olist] -[*] 27 bosses and 12 minibosses +[*] 27 bosses and 5 minibosses [*] 200+ enemies -[*] 5 town NPCs +[*] 4 town NPCs [*] 5 biomes and many new structures [*] 1 event [*] 1 new playable class (based on Throwing from Terraria 1.3) diff --git a/icon.png b/icon.png index 80069a3be1..8451ec4099 100644 Binary files a/icon.png and b/icon.png differ diff --git a/icon_workshop.png b/icon_workshop.png index 1edebb0978..677e0c27a3 100644 Binary files a/icon_workshop.png and b/icon_workshop.png differ