diff --git a/Buffs/Pets/SirenLightPetBuff.png b/Buffs/Pets/SirenLightPetBuff.png index d3f7aa5885..e2ff5c8780 100644 Binary files a/Buffs/Pets/SirenLightPetBuff.png and b/Buffs/Pets/SirenLightPetBuff.png differ diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs new file mode 100644 index 0000000000..0e89d7656b --- /dev/null +++ b/Buffs/StatBuffs/KamiBuff.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class KamiBuff : ModBuff + { + public const float RunSpeedBoost = 0.2f; + public const float RunAccelerationBoost = 0.4f; + public override void SetDefaults() + { + DisplayName.SetDefault("Kami Injection"); + Description.SetDefault("Increased defense, movement speed, and damage"); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().kamiBoost = true; + } + } +} diff --git a/Buffs/StatBuffs/KamiBuff.png b/Buffs/StatBuffs/KamiBuff.png new file mode 100644 index 0000000000..4fdc0fff94 Binary files /dev/null and b/Buffs/StatBuffs/KamiBuff.png differ diff --git a/Buffs/StatBuffs/XerocRage.png b/Buffs/StatBuffs/XerocRage.png index b4dc31565c..5db048a016 100644 Binary files a/Buffs/StatBuffs/XerocRage.png and b/Buffs/StatBuffs/XerocRage.png differ diff --git a/Buffs/StatBuffs/XerocWrath.png b/Buffs/StatBuffs/XerocWrath.png index e8f6d0c6c1..60b04f7a73 100644 Binary files a/Buffs/StatBuffs/XerocWrath.png and b/Buffs/StatBuffs/XerocWrath.png differ diff --git a/Buffs/StatDebuffs/KamiDebuff.cs b/Buffs/StatDebuffs/KamiDebuff.cs new file mode 100644 index 0000000000..d554fa2441 --- /dev/null +++ b/Buffs/StatDebuffs/KamiDebuff.cs @@ -0,0 +1,33 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class KamiDebuff : ModBuff + { + public const float MultiplicativeDamageReduction = 0.8f; + public const float MaxNPCSpeed = 16f; // Hard-cap for npc speed when afflicted with this debuff. Does not affect certain NPCs and does not affect any bosses (Basically only works on boss minions). + public override void SetDefaults() + { + DisplayName.SetDefault("Kami Flu"); + Description.SetDefault("Defenseless and dying"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(NPC npc, ref int buffIndex) + { + if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) + npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().teslaFreeze = true; + } + } +} diff --git a/Buffs/StatDebuffs/KamiDebuff.png b/Buffs/StatDebuffs/KamiDebuff.png new file mode 100644 index 0000000000..df7af84f98 Binary files /dev/null and b/Buffs/StatDebuffs/KamiDebuff.png differ diff --git a/Buffs/Summon/Herring.png b/Buffs/Summon/Herring.png index aed61a6102..cd535e3c29 100644 Binary files a/Buffs/Summon/Herring.png and b/Buffs/Summon/Herring.png differ diff --git a/Buffs/Summon/SandyWaifu.png b/Buffs/Summon/SandyWaifu.png index fa0be1df22..a8e19f8ceb 100644 Binary files a/Buffs/Summon/SandyWaifu.png and b/Buffs/Summon/SandyWaifu.png differ diff --git a/Buffs/Summon/WaterWaifu.png b/Buffs/Summon/WaterWaifu.png index b9e9cafb73..090fe9a059 100644 Binary files a/Buffs/Summon/WaterWaifu.png and b/Buffs/Summon/WaterWaifu.png differ diff --git a/Buffs/Summon/WulfrumDroidBuff.png b/Buffs/Summon/WulfrumDroidBuff.png index 34b1c798e4..bec3e3f78c 100644 Binary files a/Buffs/Summon/WulfrumDroidBuff.png and b/Buffs/Summon/WulfrumDroidBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 17f79cf4ef..746b51c4de 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -111,6 +111,13 @@ namespace CalamityMod.CalPlayer public Projectile lastProjectileHit; public double acidRoundMultiplier = 1D; public int waterLeechTarget = -1; + public float KameiTrailXScale = 0.1f; + public int KameiBladeUseDelay = 0; + public Vector2[] KameiOldPositions = new Vector2[4]; + public double trueMeleeDamage = 0D; + public double contactDamageReduction = 0D; + public double projectileDamageReduction = 0D; + #endregion public double trueMeleeDamage = 0D; public double contactDamageReduction = 0D; @@ -268,6 +275,7 @@ namespace CalamityMod.CalPlayer public int throwingCrit = 0; public bool throwingAmmoCost75 = false; public bool throwingAmmoCost66 = false; + public bool throwingAmmoCost55 = false; public bool throwingAmmoCost50 = false; #endregion @@ -492,6 +500,7 @@ namespace CalamityMod.CalPlayer public bool depthCharm = false; public bool anechoicPlating = false; public bool jellyfishNecklace = false; + public bool abyssDivingGear = false; public bool abyssalAmulet = false; public bool lumenousAmulet = false; public bool reaperToothNecklace = false; @@ -641,6 +650,11 @@ namespace CalamityMod.CalPlayer public bool auricBoost = false; public bool daedalusReflect = false; public bool daedalusSplit = false; + public bool titanHeartSet = false; + public bool titanHeartMask = false; + public bool titanHeartMantle = false; + public bool titanHeartBoots = false; + public int titanCooldown = 0; public bool umbraphileSet = false; public bool reaverBlast = false; public bool reaverBurst = false; @@ -826,6 +840,7 @@ namespace CalamityMod.CalPlayer public bool hallowedDefense = false; public bool hallowedPower = false; public bool hallowedRegen = false; + public bool kamiBoost = false; #endregion #region Minion @@ -961,6 +976,10 @@ namespace CalamityMod.CalPlayer public bool snowmanForce; public bool snowmanNoseless; public bool snowmanPower; + public bool meldTransformationPrevious; + public bool meldTransformation; + public bool meldTransformationForce; + public bool meldTransformationPower; #endregion #endregion @@ -1325,6 +1344,7 @@ namespace CalamityMod.CalPlayer throwingCrit = 0; throwingAmmoCost75 = false; throwingAmmoCost66 = false; + throwingAmmoCost55 = false; throwingAmmoCost50 = false; accStealthGenBoost = 0f; @@ -1559,6 +1579,7 @@ namespace CalamityMod.CalPlayer hallowedDefense = false; hallowedRegen = false; hallowedPower = false; + kamiBoost = false; IBoots = false; elysianFire = false; sTracers = false; @@ -1601,6 +1622,7 @@ namespace CalamityMod.CalPlayer depthCharm = false; anechoicPlating = false; jellyfishNecklace = false; + abyssDivingGear = false; abyssalAmulet = false; lumenousAmulet = false; reaperToothNecklace = false; @@ -1625,6 +1647,10 @@ namespace CalamityMod.CalPlayer statigelSet = false; + titanHeartSet = false; + titanHeartMask = false; + titanHeartMantle = false; + titanHeartBoots = false; umbraphileSet = false; plagueReaper = false; plaguebringerPatronSet = false; @@ -1929,6 +1955,9 @@ namespace CalamityMod.CalPlayer snowmanPrevious = snowman; snowman = snowmanHide = snowmanForce = snowmanPower = false; + meldTransformationPrevious = meldTransformation; + meldTransformation = meldTransformationForce = meldTransformationPower = false; + rageModeActive = false; adrenalineModeActive = false; @@ -1985,8 +2014,6 @@ namespace CalamityMod.CalPlayer hallowedRuneCooldown = 0; doubledHorror = false; sulphurBubbleCooldown = 0; - forbiddenCooldown = 0; - tornadoCooldown = 0; ladHearts = 0; prismaticLasers = 0; @@ -2050,6 +2077,7 @@ namespace CalamityMod.CalPlayer throwingCrit = 0; throwingAmmoCost75 = false; throwingAmmoCost66 = false; + throwingAmmoCost55 = false; throwingAmmoCost50 = false; #endregion @@ -2082,6 +2110,7 @@ namespace CalamityMod.CalPlayer rRage = false; xRage = false; xWrath = false; + kamiBoost = false; graxDefense = false; encased = false; sMeleeBoost = false; @@ -2205,6 +2234,11 @@ namespace CalamityMod.CalPlayer reaverDoubleTap = false; shadeRegen = false; dsSetBonus = false; + titanHeartSet = false; + titanHeartMask = false; + titanHeartMantle = false; + titanHeartBoots = false; + titanCooldown = 0; umbraphileSet = false; reaverBlast = false; reaverBurst = false; @@ -2233,6 +2267,8 @@ namespace CalamityMod.CalPlayer desertProwler = false; snowRuffianSet = false; forbiddenCirclet = false; + forbiddenCooldown = 0; + tornadoCooldown = 0; eskimoSet = false; //vanilla armor meteorSet = false; //vanilla armor, for Space Gun nerf victideSet = false; @@ -2279,6 +2315,7 @@ namespace CalamityMod.CalPlayer CurrentlyViewedHologramX = CurrentlyViewedHologramY = -1; CurrentlyViewedHologramText = string.Empty; + KameiBladeUseDelay = 0; lastProjectileHit = null; if (CalamityWorld.bossRushActive) @@ -3306,6 +3343,10 @@ namespace CalamityMod.CalPlayer profanedCrystalHide = false; profanedCrystalForce = true; } + else if (item.type == ModContent.ItemType()) + { + abyssDivingGear = true; + } } } @@ -3652,6 +3693,7 @@ namespace CalamityMod.CalPlayer ((frostFlare && player.statLife < (int)(player.statLifeMax2 * 0.25)) ? 0.15f : 0f) + (auricSet ? 0.1f : 0f) + (dragonScales ? 0.1f : 0f) + + (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + @@ -3671,6 +3713,7 @@ namespace CalamityMod.CalPlayer (cTracers ? 0.1f : 0f) + (silvaSet ? 0.05f : 0f) + (eTracers ? 0.05f : 0f) + + (kamiBoost ? KamiBuff.RunSpeedBoost : 0f) + (etherealExtorter && player.ZoneBeach ? 0.05f : 0f) + (stressPills ? 0.05f : 0f) + (laudanum && horror ? 0.1f : 0f) + @@ -3752,7 +3795,6 @@ namespace CalamityMod.CalPlayer } #endregion } - #endregion #region Rogue Mirrors @@ -3779,6 +3821,11 @@ namespace CalamityMod.CalPlayer Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); } + + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } } } @@ -3799,6 +3846,11 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.Item68, Main.player[Main.myPlayer].position); int eclipseBurst = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(7000 * player.RogueDamage()), 0, player.whoAmI); + + if (player.whoAmI == Main.myPlayer) + { + NetMessage.SendData(MessageID.Dodge, -1, -1, null, player.whoAmI, 1f, 0f, 0f, 0, 0, 0); + } } } #endregion @@ -4077,16 +4129,19 @@ namespace CalamityMod.CalPlayer sCalDeathCount++; } } - deathCount++; + + if (CalamityWorld.ironHeart) + { + KillPlayer(); + return false; + } + + deathCount++; if (player.whoAmI == Main.myPlayer && Main.netMode == NetmodeID.MultiplayerClient) { DeathPacket(false); } - if (CalamityWorld.ironHeart && areThereAnyDamnBosses) - { - KillPlayer(); - return false; - } + return true; } #endregion @@ -4121,6 +4176,14 @@ namespace CalamityMod.CalPlayer } #endregion + #region Get Heal Life + public override void GetHealLife(Item item, bool quickHeal, ref int healValue) + { + if (CalamityWorld.ironHeart) + healValue = 0; + } + #endregion + #region Get Weapon Damage And KB public override void ModifyWeaponDamage(Item item, ref float add, ref float mult, ref float flat) { @@ -4190,6 +4253,26 @@ namespace CalamityMod.CalPlayer { knockback *= 1.09f; } + if (titanHeartMask && item.Calamity().rogue) + { + knockback *= 1.05f; + } + if (titanHeartMantle && item.Calamity().rogue) + { + knockback *= 1.05f; + } + if (titanHeartBoots && item.Calamity().rogue) + { + knockback *= 1.05f; + } + if (titanHeartSet && item.Calamity().rogue) + { + knockback *= 1.2f; + } + if (titanHeartSet && StealthStrikeAvailable() && item.Calamity().rogue) + { + knockback *= 2f; + } bool ZoneForest = !ZoneAbyss && !ZoneSulphur && !ZoneAstral && !ZoneCalamity && !ZoneSunkenSea && !player.ZoneSnow && !player.ZoneCorrupt && !player.ZoneCrimson && !player.ZoneHoly && !player.ZoneDesert && !player.ZoneUndergroundDesert && !player.ZoneGlowshroom && !player.ZoneDungeon && !player.ZoneBeach && !player.ZoneMeteor; if (etherealExtorter) { @@ -5878,7 +5961,7 @@ namespace CalamityMod.CalPlayer } else { - float amount = npc.velocity.Length() / npc.Calamity().maxVelocity; + float amount = npc.velocity.Length() / (npc.Calamity().maxVelocity * 0.5f); if (amount > 1f) amount = 1f; @@ -5971,7 +6054,7 @@ namespace CalamityMod.CalPlayer if (DRStat > 0) contactDamageReduction *= 1f - (DRStat * 0.01f); - contactDamageReduction = 1D - (1D / (1D + contactDamageReduction)); + contactDamageReduction = 1D / (1D + contactDamageReduction); damage = (int)(damage * contactDamageReduction); } @@ -6200,7 +6283,7 @@ namespace CalamityMod.CalPlayer if (DRStat > 0) projectileDamageReduction *= 1f - (DRStat * 0.01f); - projectileDamageReduction = 1D - (1D / (1D + projectileDamageReduction)); + projectileDamageReduction = 1D / (1D + projectileDamageReduction); damage = (int)(damage * projectileDamageReduction); } @@ -7013,93 +7096,108 @@ namespace CalamityMod.CalPlayer } #endregion - #region Frame Effects + #region Frame Effects + public override void FrameEffects() + { + if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || + player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + { + player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + } + else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) + { + player.legs = mod.GetEquipSlot("ProviLegs", EquipType.Legs); + player.body = mod.GetEquipSlot("ProviBody", EquipType.Body); + player.head = mod.GetEquipSlot("ProviHead", EquipType.Head); + player.wings = mod.GetEquipSlot("ProviWings", EquipType.Wings); + player.face = -1; - public override void FrameEffects() - { - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || - player.Calamity().andromedaState == AndromedaPlayerState.SpecialAttack) + bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(player.statLifeMax2 * 0.5); + + if (profanedCrystalWingCounter.Value == 0) + { + int key = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); + } + + player.wingFrame = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); + player.armorEffectDrawOutlines = true; + if (profanedCrystalBuffs) + { + player.armorEffectDrawShadow = true; + if (enrage) + { + player.armorEffectDrawOutlinesForbidden = true; + } + } + } + else if ((snowmanPower || snowmanForce) && !snowmanHide) + { + player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); + player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); + player.face = -1; + } + else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) + { + player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); + player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); + player.face = -1; + } + else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) + { + player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); + player.face = -1; + } + else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) + { + player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); + player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); + player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); + player.face = -1; + } + else if (meldTransformationPower || meldTransformationForce) { - player.head = mod.GetEquipSlot("NoHead", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. + player.legs = mod.GetEquipSlot("MeldTransformationLegs", EquipType.Legs); + player.body = mod.GetEquipSlot("MeldTransformationBody", EquipType.Body); + player.head = mod.GetEquipSlot("MeldTransformationHead", EquipType.Head); } - else if (snowRuffianSet) - { - player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); - bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; - if (player.controlJump && falling) - { - player.velocity.Y *= 0.9f; - player.wingFrame = 3; + else + { + if (profanedCrystalWingCounter.Key != 1) + profanedCrystalWingCounter = new KeyValuePair(1, 7); + if (profanedCrystalAnimCounter.Key != 0) + profanedCrystalAnimCounter = new KeyValuePair(0, 10); + } + if (snowRuffianSet) + { + player.wings = mod.GetEquipSlot("SnowRuffWings", EquipType.Wings); + bool falling = player.gravDir == -1 ? player.velocity.Y < 0.05f : player.velocity.Y > 0.05f; + if (player.controlJump && falling) + { + player.velocity.Y *= 0.9f; + player.wingFrame = 3; player.noFallDmg = true; player.fallStart = (int)(player.position.Y / 16f); - } - } - else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) - { - player.legs = mod.GetEquipSlot("ProviLegs", EquipType.Legs); - player.body = mod.GetEquipSlot("ProviBody", EquipType.Body); - player.head = mod.GetEquipSlot("ProviHead", EquipType.Head); - player.wings = mod.GetEquipSlot("ProviWings", EquipType.Wings); + } + } + if (abyssDivingGear && (player.head == -1 || player.head == ArmorIDs.Head.FamiliarWig)) + { + player.head = mod.GetEquipSlot("AbyssDivingGearHead", EquipType.Head); + player.face = -1; + } - bool enrage = !profanedCrystalForce && profanedCrystalBuffs && player.statLife <= (int)(player.statLifeMax2 * 0.5); + if (CalamityWorld.defiled) + Defiled(); - if (profanedCrystalWingCounter.Value == 0) - { - int key = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 7); - } - - player.wingFrame = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); - player.armorEffectDrawOutlines = true; - if (profanedCrystalBuffs) - { - player.armorEffectDrawShadow = true; - if (enrage) - { - player.armorEffectDrawOutlinesForbidden = true; - } - } - } - else if ((snowmanPower || snowmanForce) && !snowmanHide) - { - player.legs = mod.GetEquipSlot("PopoLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("PopoBody", EquipType.Body); - player.head = snowmanNoseless ? mod.GetEquipSlot("PopoNoselessHead", EquipType.Head) : mod.GetEquipSlot("PopoHead", EquipType.Head); - } - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - player.legs = mod.GetEquipSlot("AbyssalDivingSuitLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("AbyssalDivingSuitBody", EquipType.Body); - player.head = mod.GetEquipSlot("AbyssalDivingSuitHead", EquipType.Head); - } - else if ((sirenBoobsPower || sirenBoobsForce) && !sirenBoobsHide) - { - player.legs = mod.GetEquipSlot("SirenLeg", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBody", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHead", EquipType.Head); - } - else if ((sirenBoobsAltPower || sirenBoobsAltForce) && !sirenBoobsAltHide) - { - player.legs = mod.GetEquipSlot("SirenLegAlt", EquipType.Legs); - player.body = mod.GetEquipSlot("SirenBodyAlt", EquipType.Body); - player.head = mod.GetEquipSlot("SirenHeadAlt", EquipType.Head); - } - else - { - if (profanedCrystalWingCounter.Key != 1) - profanedCrystalWingCounter = new KeyValuePair(1, 7); - if (profanedCrystalAnimCounter.Key != 0) - profanedCrystalAnimCounter = new KeyValuePair(0, 10); - } - - if (CalamityWorld.defiled) - Defiled(); - - if (weakPetrification) - WeakPetrification(); - } - #endregion + if (weakPetrification) + WeakPetrification(); + } + #endregion #region Limitations private void WeakPetrification() @@ -7187,6 +7285,18 @@ namespace CalamityMod.CalPlayer Main.PlaySound(SoundID.FemaleHit, (int)player.position.X, (int)player.position.Y, 1, 1f, 0f); //female hit noise hurtSoundTimer = 10; } + else if (titanHeartSet) + { + playSound = false; + Terraria.Audio.LegacySoundStyle atlasHurt = Utils.SelectRandom(Main.rand, new Terraria.Audio.LegacySoundStyle[] + { + mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt0"), + mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt1"), + mod.GetLegacySoundSlot(SoundType.NPCHit, "Sounds/NPCHit/AtlasHurt2") + }); + Main.PlaySound(atlasHurt, (int)player.position.X, (int)player.position.Y); + hurtSoundTimer = 10; + } } @@ -7228,6 +7338,20 @@ namespace CalamityMod.CalPlayer damage = (int)newDamage; } + if (CalamityWorld.ironHeart) + { + int damageMin = player.statLifeMax2 / 4; + playSound = false; + hurtSoundTimer = 20; + if (damage < damageMin) + { + damage = damageMin; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartHurt"), (int)player.position.X, (int)player.position.Y); + } + else + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/IronHeartBigHurt"), (int)player.position.X, (int)player.position.Y); + } + #region MultiplicativeReductions if (trinketOfChiBuff) { @@ -7944,7 +8068,7 @@ namespace CalamityMod.CalPlayer player.lastDeathPostion = player.Center; player.lastDeathTime = DateTime.Now; player.showLastDeath = true; - bool specialDeath = CalamityWorld.ironHeart && areThereAnyDamnBosses; + bool specialDeath = CalamityWorld.ironHeart; int coinsOwned = (int)Utils.CoinsCount(out bool flag, player.inventory, new int[0]); if (Main.myPlayer == player.whoAmI) { @@ -7958,13 +8082,7 @@ namespace CalamityMod.CalPlayer if (Main.myPlayer == player.whoAmI) { player.trashItem.SetDefaults(0, false); - if (specialDeath) - { - player.difficulty = 2; - player.DropItems(); - player.KillMeForGood(); - } - else if (player.difficulty == 0) + if (player.difficulty == 0) { for (int i = 0; i < 59; i++) { @@ -8367,11 +8485,11 @@ namespace CalamityMod.CalPlayer Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0) + NPC npc = Main.npc[i]; + if (npc.active && !npc.dontTakeDamage && !npc.friendly && !npc.townNPC && npc.immune[player.whoAmI] <= 0 && npc.damage > 0) { - NPC nPC = Main.npc[i]; Rectangle rect = nPC.getRect(); - if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + if (rectangle.Intersects(rect) && (npc.noTileCollide || player.CanHit(npc))) { OnDodge(); break; @@ -8380,9 +8498,9 @@ namespace CalamityMod.CalPlayer } for (int i = 0; i < Main.maxProjectiles; i++) { - if (Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0) + Projectile proj = Main.projectile[i]; + if (proj.active && !proj.friendly && proj.hostile && proj.damage > 0) { - Projectile proj = Main.projectile[i]; Rectangle rect = proj.getRect(); if (rectangle.Intersects(rect)) { @@ -9345,7 +9463,6 @@ namespace CalamityMod.CalPlayer #endregion #region Drawing - public static readonly PlayerLayer MiscEffectsBack = new PlayerLayer("CalamityMod", "MiscEffectsBack", PlayerLayer.MiscEffectsBack, delegate (PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -9376,10 +9493,40 @@ namespace CalamityMod.CalPlayer { if (drawInfo.shadow != 0f) return; - Player drawPlayer = drawInfo.drawPlayer; Item item = drawPlayer.ActiveItem(); + // Kamei trail/afterimage effect. + if (drawPlayer.Calamity().kamiBoost) + { + for (int i = drawPlayer.Calamity().KameiOldPositions.Length - 1; i > 0; i--) + { + if (drawPlayer.Calamity().KameiOldPositions[i - 1] == Vector2.Zero) + drawPlayer.Calamity().KameiOldPositions[i - 1] = drawPlayer.position; + drawPlayer.Calamity().KameiOldPositions[i] = drawPlayer.Calamity().KameiOldPositions[i - 1]; + } + drawPlayer.Calamity().KameiOldPositions[0] = drawPlayer.position; + + List existingDrawData = Main.playerDrawData; + for (int i = 0; i < drawPlayer.Calamity().KameiOldPositions.Length; i++) + { + float scale = MathHelper.Lerp(1f, 0.5f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); + float opacity = MathHelper.Lerp(0.25f, 0.08f, i / (float)drawPlayer.Calamity().KameiOldPositions.Length); + List afterimage = new List(); + for (int j = 0; j < existingDrawData.Count; j++) + { + var drawData = existingDrawData[j]; + drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition; + drawData.color = Color.Cyan * opacity; + drawData.color.G = (byte)(drawData.color.G * 1.6); + drawData.color.B = (byte)(drawData.color.B * 1.2); + drawData.scale = new Vector2(scale); + afterimage.Add(drawData); + } + Main.playerDrawData.InsertRange(0, afterimage); + } + } + if (!drawPlayer.frozen && item.type > ItemID.None && !drawPlayer.dead && @@ -9539,6 +9686,7 @@ namespace CalamityMod.CalPlayer } } }); + public override void ModifyDrawInfo(ref PlayerDrawInfo drawInfo) { if (drawInfo.shadow != 0f) @@ -10456,6 +10604,7 @@ namespace CalamityMod.CalPlayer chatText = "Now is not the time!"; return false; } + return true; } diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index ad9956bef2..5899716584 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -461,7 +461,7 @@ namespace CalamityMod.CalPlayer player.lifeRegen /= 2; } - if (modPlayer.omegaBlueChestplate || modPlayer.godSlayerCooldown || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (CalamityWorld.ironHeart || modPlayer.omegaBlueChestplate || modPlayer.godSlayerCooldown || player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) { if (player.lifeRegen > 0) player.lifeRegen = 0; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3803891113..1b4d16c477 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -339,8 +339,8 @@ namespace CalamityMod.CalPlayer { player.Calamity().andromedaState = AndromedaPlayerState.Inactive; } - - if (player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) + + if(player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot) { player.width = 152; player.height = 212; @@ -905,6 +905,8 @@ namespace CalamityMod.CalPlayer // Cooldowns and timers if (modPlayer.gainRageCooldown > 0) modPlayer.gainRageCooldown--; + if (modPlayer.KameiBladeUseDelay > 0) + modPlayer.KameiBladeUseDelay--; if (modPlayer.galileoCooldown > 0) modPlayer.galileoCooldown--; if (modPlayer.soundCooldown > 0) @@ -981,6 +983,8 @@ namespace CalamityMod.CalPlayer modPlayer.titanBoost--; if (modPlayer.prismaticLasers > 0) modPlayer.prismaticLasers--; + if (modPlayer.titanCooldown > 0) + modPlayer.titanCooldown--; // Silva invincibility effects if (modPlayer.silvaCountdown > 0 && modPlayer.hasSilvaEffect && modPlayer.silvaSet) @@ -1139,8 +1143,14 @@ namespace CalamityMod.CalPlayer player.endurance += 0.07f; } - // Absorber bonus - if (modPlayer.absorber) + if (modPlayer.kamiBoost) + { + player.allDamage += 0.3f; + player.statDefense += 20; + } + + // Absorber bonus + if (modPlayer.absorber) { player.moveSpeed += 0.12f; player.jumpSpeedBoost += 1.2f; @@ -3305,7 +3315,7 @@ namespace CalamityMod.CalPlayer } // Brimstone Elemental lore inferno potion boost - if (modPlayer.brimstoneElementalLore && player.inferno) + if ((modPlayer.brimstoneElementalLore || modPlayer.ataxiaBlaze) && player.inferno) { const int FramesPerHit = 30; @@ -3799,7 +3809,7 @@ namespace CalamityMod.CalPlayer modPlayer.critStats[0] = player.meleeCrit; modPlayer.critStats[1] = player.rangedCrit; modPlayer.critStats[2] = player.magicCrit; - modPlayer.critStats[3] = modPlayer.throwingCrit; + modPlayer.critStats[3] = player.thrownCrit + modPlayer.throwingCrit; modPlayer.ammoReductionRanged = (int)(100f * (player.ammoBox ? 0.8f : 1f) * (player.ammoPotion ? 0.8f : 1f) * @@ -3844,7 +3854,7 @@ namespace CalamityMod.CalPlayer #region Rogue Mirrors private static void RogueMirrors(Player player, CalamityPlayer modPlayer) { - Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + Rectangle rectangle = new Rectangle((int)(player.position.X + player.velocity.X * 0.5f - 4f), (int)(player.position.Y + player.velocity.Y * 0.5f - 4f), player.width + 8, player.height + 8); for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; diff --git a/CalamityMod.cs b/CalamityMod.cs index 07ddddce6a..c4d6206efc 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -135,8 +135,8 @@ namespace CalamityMod // Boss velocity scaling data structure public static SortedDictionary bossVelocityDamageScaleValues; - public const float velocityScaleMin = 0.66f; - public const float bitingEnemeyVelocityScale = 0.9f; + public const float velocityScaleMin = 0.5f; + public const float bitingEnemeyVelocityScale = 0.8f; // Lists public static IList donatorList; @@ -209,6 +209,7 @@ namespace CalamityMod public static List angryBonesList; public static List hornetList; public static List mossHornetList; + public static List bossMinionList; public static List legOverrideList; @@ -287,6 +288,12 @@ namespace CalamityMod AddEquipTexture(new SnowRuffianWings(), null, EquipType.Wings, "SnowRuffWings", "CalamityMod/Items/Armor/SnowRuffianWings"); + AddEquipTexture(new MeldTransformationHead(), null, EquipType.Head, "MeldTransformationHead", "CalamityMod/Items/Armor/MeldTransformation_Head"); + AddEquipTexture(new MeldTransformationBody(), null, EquipType.Body, "MeldTransformationBody", "CalamityMod/Items/Armor/MeldTransformation_Body", "CalamityMod/Items/Armor/MeldTransformation_Arms"); + AddEquipTexture(new MeldTransformationLegs(), null, EquipType.Legs, "MeldTransformationLegs", "CalamityMod/Items/Armor/MeldTransformation_Legs"); + + AddEquipTexture(new AbyssDivingGearHair(), null, EquipType.Head, "AbyssDivingGearHead", "CalamityMod/Items/Accessories/AbyssalDivingGear_Face"); + AstralCactusTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactus"); AstralCactusGlowTexture = ModContent.GetTexture("CalamityMod/ExtraTextures/Tiles/AstralCactusGlow"); AstralSky = ModContent.GetTexture("CalamityMod/ExtraTextures/AstralSky"); @@ -438,6 +445,7 @@ namespace CalamityMod angryBonesList = null; hornetList = null; mossHornetList = null; + bossMinionList = null; legOverrideList = null; @@ -737,7 +745,10 @@ namespace CalamityMod ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), - ModContent.ProjectileType() + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ModContent.ProjectileType(), // Because of potential dust lag. + ModContent.ProjectileType() }; projectileDestroyExceptionList = new List() @@ -2595,6 +2606,107 @@ namespace CalamityMod NPCID.GiantMossHornet }; + bossMinionList = new List() + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.SlimeSpiked, + NPCID.ServantofCthulhu, + ModContent.NPCType(), + NPCID.EaterofWorldsHead, + NPCID.EaterofWorldsBody, + NPCID.EaterofWorldsTail, + NPCID.Creeper, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.SkeletronHand, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.LeechHead, + NPCID.LeechBody, + NPCID.LeechTail, + NPCID.WallofFleshEye, + NPCID.TheHungry, + NPCID.TheHungryII, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.PrimeCannon, + NPCID.PrimeLaser, + NPCID.PrimeSaw, + NPCID.PrimeVice, + ModContent.NPCType(), + NPCID.TheDestroyer, + NPCID.TheDestroyerBody, + NPCID.TheDestroyerTail, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.PlanterasTentacle, + ModContent.NPCType(), + NPCID.Spore, + NPCID.GolemHead, + NPCID.GolemHeadFree, + NPCID.GolemFistLeft, + NPCID.GolemFistRight, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + NPCID.CultistDragonHead, + NPCID.CultistDragonBody1, + NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, + NPCID.CultistDragonBody4, + NPCID.CultistDragonTail, + NPCID.AncientCultistSquidhead, + NPCID.MoonLordFreeEye, + NPCID.MoonLordHand, + NPCID.MoonLordHead, + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() + }; + Mod thorium = ModLoader.GetMod("ThoriumMod"); if (CalamityConfig.Instance.BuffThoriumBosses && thorium != null) { diff --git a/ExtraTextures/Chains/BallOFuguChain.png b/ExtraTextures/Chains/BallOFuguChain.png index 0a507b3c27..72c9a548c3 100644 Binary files a/ExtraTextures/Chains/BallOFuguChain.png and b/ExtraTextures/Chains/BallOFuguChain.png differ diff --git a/ExtraTextures/Lasers/UltimaRayEnd.png b/ExtraTextures/Lasers/UltimaRayEnd.png new file mode 100644 index 0000000000..26fefb2eb4 Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayEnd.png differ diff --git a/ExtraTextures/Lasers/UltimaRayMid.png b/ExtraTextures/Lasers/UltimaRayMid.png new file mode 100644 index 0000000000..9a13aa9d6b Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayMid.png differ diff --git a/ExtraTextures/Lasers/UltimaRayStart.png b/ExtraTextures/Lasers/UltimaRayStart.png new file mode 100644 index 0000000000..6ebfb4d0e7 Binary files /dev/null and b/ExtraTextures/Lasers/UltimaRayStart.png differ diff --git a/ExtraTextures/Tanks/Backpack_TheEmpyrean.png b/ExtraTextures/Tanks/Backpack_TheEmpyrean.png index 585763a882..9a350cbd98 100644 Binary files a/ExtraTextures/Tanks/Backpack_TheEmpyrean.png and b/ExtraTextures/Tanks/Backpack_TheEmpyrean.png differ diff --git a/Gores/LeviathanGores/LeviGore.png b/Gores/LeviathanGores/LeviGore.png new file mode 100644 index 0000000000..2fa7b63295 Binary files /dev/null and b/Gores/LeviathanGores/LeviGore.png differ diff --git a/Gores/LeviathanGores/LeviGore2.png b/Gores/LeviathanGores/LeviGore2.png new file mode 100644 index 0000000000..dd6f7cab00 Binary files /dev/null and b/Gores/LeviathanGores/LeviGore2.png differ diff --git a/Gores/LeviathanGores/LeviGore3.png b/Gores/LeviathanGores/LeviGore3.png new file mode 100644 index 0000000000..3021ab4ddc Binary files /dev/null and b/Gores/LeviathanGores/LeviGore3.png differ diff --git a/Gores/LeviathanGores/LeviGore4.png b/Gores/LeviathanGores/LeviGore4.png new file mode 100644 index 0000000000..be05c90eaa Binary files /dev/null and b/Gores/LeviathanGores/LeviGore4.png differ diff --git a/Gores/Leviathangib1.png b/Gores/Leviathangib1.png deleted file mode 100644 index 0ecb8917b0..0000000000 Binary files a/Gores/Leviathangib1.png and /dev/null differ diff --git a/Gores/Leviathangib2.png b/Gores/Leviathangib2.png deleted file mode 100644 index 439118a08d..0000000000 Binary files a/Gores/Leviathangib2.png and /dev/null differ diff --git a/Gores/Leviathangib3.png b/Gores/Leviathangib3.png deleted file mode 100644 index e574799f70..0000000000 Binary files a/Gores/Leviathangib3.png and /dev/null differ diff --git a/Gores/SirenGores/Siren.png b/Gores/SirenGores/Siren.png deleted file mode 100644 index 5fd3fd11c7..0000000000 Binary files a/Gores/SirenGores/Siren.png and /dev/null differ diff --git a/Gores/SirenGores/Siren2.png b/Gores/SirenGores/Siren2.png deleted file mode 100644 index 773164636b..0000000000 Binary files a/Gores/SirenGores/Siren2.png and /dev/null differ diff --git a/Gores/SirenGores/Siren3.png b/Gores/SirenGores/Siren3.png deleted file mode 100644 index 5fc6575960..0000000000 Binary files a/Gores/SirenGores/Siren3.png and /dev/null differ diff --git a/Gores/SirenGores/Siren4.png b/Gores/SirenGores/Siren4.png deleted file mode 100644 index d819fb0058..0000000000 Binary files a/Gores/SirenGores/Siren4.png and /dev/null differ diff --git a/Gores/SirenGores/Siren5.png b/Gores/SirenGores/Siren5.png deleted file mode 100644 index 21f1e550d5..0000000000 Binary files a/Gores/SirenGores/Siren5.png and /dev/null differ diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index a5ca41427f..202b02f1b9 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -6,54 +6,70 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - [AutoloadEquip(EquipType.Face)] - public class AbyssalDivingGear : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Abyssal Diving Gear"); - Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + - "Removes the bleed effect caused by the abyss\n" + - "Grants the ability to swim and greatly extends underwater breathing\n" + - "Provides light underwater and extra mobility on ice\n" + - "Provides a moderate amount of light in the abyss\n" + - "Greatly reduces breath loss in the abyss"); - } + //[AutoloadEquip(EquipType.Face)] + public class AbyssalDivingGear : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Diving Gear"); + Tooltip.SetDefault("Reduces the damage caused by the pressure of the abyss while out of breath\n" + + "Removes the bleed effect caused by the abyss\n" + + "Grants the ability to swim and greatly extends underwater breathing\n" + + "Provides light underwater and extra mobility on ice\n" + + "Provides a moderate amount of light in the abyss\n" + + "Greatly reduces breath loss in the abyss"); + } - public override void SetDefaults() - { - item.width = 26; - item.height = 26; - item.value = CalamityGlobalItem.Rarity7BuyPrice; - item.rare = 7; - item.accessory = true; - } + public override void SetDefaults() + { + item.width = 26; + item.height = 26; + item.value = CalamityGlobalItem.Rarity7BuyPrice; + item.rare = 7; + item.accessory = true; + } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.depthCharm = true; - modPlayer.jellyfishNecklace = true; - player.arcticDivingGear = true; - player.accFlipper = true; - player.accDivingHelm = true; - player.iceSkate = true; - if (player.wet) - { - Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); - } - } + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.depthCharm = true; + modPlayer.jellyfishNecklace = true; + if (!hideVisual) + modPlayer.abyssDivingGear = true; //this bool is just used for drawing + player.arcticDivingGear = true; + player.accFlipper = true; + player.accDivingHelm = true; + player.iceSkate = true; + if (player.wet) + { + Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.2f, 0.8f, 0.9f); + } + } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.ArcticDivingGear); - recipe.AddIngredient(ModContent.ItemType()); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override void UpdateVanity(Player player, EquipType type) + { + player.Calamity().abyssDivingGear = true; //this bool is just used for drawing + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.ArcticDivingGear); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } + + public class AbyssDivingGearHair : EquipTexture + { + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = false; + drawAltHair = false; + } + } } diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs index 6726b95ace..4b81fed3d4 100644 --- a/Items/Accessories/DarkGodsSheath.cs +++ b/Items/Accessories/DarkGodsSheath.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Accessories recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType(), 5); - recipe.AddIngredient(ModContent.ItemType(), 25); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Accessories/DarkGodsSheath.png b/Items/Accessories/DarkGodsSheath.png index f2bd3b2b32..0a71033b81 100644 Binary files a/Items/Accessories/DarkGodsSheath.png and b/Items/Accessories/DarkGodsSheath.png differ diff --git a/Items/Accessories/EnchantedPearl.png b/Items/Accessories/EnchantedPearl.png index a036b0d126..db3018d0fe 100644 Binary files a/Items/Accessories/EnchantedPearl.png and b/Items/Accessories/EnchantedPearl.png differ diff --git a/Items/Accessories/LeviathanAmbergris.png b/Items/Accessories/LeviathanAmbergris.png index 88034a76f7..35d439497c 100644 Binary files a/Items/Accessories/LeviathanAmbergris.png and b/Items/Accessories/LeviathanAmbergris.png differ diff --git a/Items/Accessories/LureofEnthrallment.png b/Items/Accessories/LureofEnthrallment.png index 91eb37c1de..d89b82671e 100644 Binary files a/Items/Accessories/LureofEnthrallment.png and b/Items/Accessories/LureofEnthrallment.png differ diff --git a/Items/Accessories/WifeinaBottle.png b/Items/Accessories/WifeinaBottle.png index bc29babf45..79320b4e72 100644 Binary files a/Items/Accessories/WifeinaBottle.png and b/Items/Accessories/WifeinaBottle.png differ diff --git a/Items/Accessories/Wings/MOAB.png b/Items/Accessories/Wings/MOAB.png index e67e251f22..ecafba2594 100644 Binary files a/Items/Accessories/Wings/MOAB.png and b/Items/Accessories/Wings/MOAB.png differ diff --git a/Items/Accessories/Wings/MOAB_Wings.png b/Items/Accessories/Wings/MOAB_Wings.png index b7e594948f..c02706a974 100644 Binary files a/Items/Accessories/Wings/MOAB_Wings.png and b/Items/Accessories/Wings/MOAB_Wings.png differ diff --git a/Items/Accessories/Wings/XerocWings.png b/Items/Accessories/Wings/XerocWings.png index 7e14b06cf9..5044f88358 100644 Binary files a/Items/Accessories/Wings/XerocWings.png and b/Items/Accessories/Wings/XerocWings.png differ diff --git a/Items/Accessories/Wings/XerocWings_Wings.png b/Items/Accessories/Wings/XerocWings_Wings.png index 62064efbca..22d8a51361 100644 Binary files a/Items/Accessories/Wings/XerocWings_Wings.png and b/Items/Accessories/Wings/XerocWings_Wings.png differ diff --git a/Items/Accessories/WulfrumBattery.png b/Items/Accessories/WulfrumBattery.png index 3bc19a4875..ada5ddef24 100644 Binary files a/Items/Accessories/WulfrumBattery.png and b/Items/Accessories/WulfrumBattery.png differ diff --git a/Items/Ammo/ArcticArrow.png b/Items/Ammo/ArcticArrow.png index d667dfa5b6..5fcacaa5de 100644 Binary files a/Items/Ammo/ArcticArrow.png and b/Items/Ammo/ArcticArrow.png differ diff --git a/Items/Ammo/ElysianArrow.png b/Items/Ammo/ElysianArrow.png index ed813a16ae..e0936c2556 100644 Binary files a/Items/Ammo/ElysianArrow.png and b/Items/Ammo/ElysianArrow.png differ diff --git a/Items/Ammo/IcicleArrow.png b/Items/Ammo/IcicleArrow.png index 6812f4d459..6be666a75d 100644 Binary files a/Items/Ammo/IcicleArrow.png and b/Items/Ammo/IcicleArrow.png differ diff --git a/Items/Ammo/NapalmArrow.png b/Items/Ammo/NapalmArrow.png index 254f05c605..48ef48d4c4 100644 Binary files a/Items/Ammo/NapalmArrow.png and b/Items/Ammo/NapalmArrow.png differ diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 1fee11c457..a61a43b5b4 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -47,8 +47,8 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.Calamity(); modPlayer.daedalusSplit = true; modPlayer.rogueStealthMax += 1.05f; - player.Calamity().throwingDamage += 0.05f; - player.Calamity().wearingRogueArmor = true; + modPlayer.throwingDamage += 0.05f; + modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/MeldTransformation_Arms.png b/Items/Armor/MeldTransformation_Arms.png new file mode 100644 index 0000000000..d8caa7f60a Binary files /dev/null and b/Items/Armor/MeldTransformation_Arms.png differ diff --git a/Items/Armor/MeldTransformation_Body.png b/Items/Armor/MeldTransformation_Body.png new file mode 100644 index 0000000000..c35fedf436 Binary files /dev/null and b/Items/Armor/MeldTransformation_Body.png differ diff --git a/Items/Armor/MeldTransformation_Head.png b/Items/Armor/MeldTransformation_Head.png new file mode 100644 index 0000000000..6045927bc4 Binary files /dev/null and b/Items/Armor/MeldTransformation_Head.png differ diff --git a/Items/Armor/MeldTransformation_Legs.png b/Items/Armor/MeldTransformation_Legs.png new file mode 100644 index 0000000000..fbf2427684 Binary files /dev/null and b/Items/Armor/MeldTransformation_Legs.png differ diff --git a/Items/Armor/StatigelArmor.cs b/Items/Armor/StatigelArmor.cs index 86fe23c7e0..42fbd4e999 100644 --- a/Items/Armor/StatigelArmor.cs +++ b/Items/Armor/StatigelArmor.cs @@ -26,10 +26,7 @@ namespace CalamityMod.Items.Armor public override void UpdateEquip(Player player) { - player.meleeCrit += 5; - player.magicCrit += 5; - player.rangedCrit += 5; - player.Calamity().throwingCrit += 5; + player.Calamity().AllCritBoost(5); } public override void AddRecipes() diff --git a/Items/Armor/TitanHeartBoots.cs b/Items/Armor/TitanHeartBoots.cs new file mode 100644 index 0000000000..68ced6a884 --- /dev/null +++ b/Items/Armor/TitanHeartBoots.cs @@ -0,0 +1,42 @@ +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Legs)] + public class TitanHeartBoots : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart Boots"); + Tooltip.SetDefault("10% increased rogue velocity and 5% boosted rogue knockback"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 14; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().titanHeartBoots = true; + player.Calamity().throwingVelocity += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 14); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TitanHeartBoots.png b/Items/Armor/TitanHeartBoots.png new file mode 100644 index 0000000000..97012de069 Binary files /dev/null and b/Items/Armor/TitanHeartBoots.png differ diff --git a/Items/Armor/TitanHeartBoots_Legs.png b/Items/Armor/TitanHeartBoots_Legs.png new file mode 100644 index 0000000000..dbd89ea24a Binary files /dev/null and b/Items/Armor/TitanHeartBoots_Legs.png differ diff --git a/Items/Armor/TitanHeartMantle.cs b/Items/Armor/TitanHeartMantle.cs new file mode 100644 index 0000000000..5ddc500f41 --- /dev/null +++ b/Items/Armor/TitanHeartMantle.cs @@ -0,0 +1,43 @@ +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Body)] + public class TitanHeartMantle : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart Mantle"); + Tooltip.SetDefault("45% chance to not consume rogue items\n" + + "5% boosted rogue knockback but 20% lowered rogue shoot speed"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 17; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().titanHeartMantle = true; + player.Calamity().throwingAmmoCost55 = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 20); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TitanHeartMantle.png b/Items/Armor/TitanHeartMantle.png new file mode 100644 index 0000000000..fa0b8a8c39 Binary files /dev/null and b/Items/Armor/TitanHeartMantle.png differ diff --git a/Items/Armor/TitanHeartMantle_Arms.png b/Items/Armor/TitanHeartMantle_Arms.png new file mode 100644 index 0000000000..871f504511 Binary files /dev/null and b/Items/Armor/TitanHeartMantle_Arms.png differ diff --git a/Items/Armor/TitanHeartMantle_Body.png b/Items/Armor/TitanHeartMantle_Body.png new file mode 100644 index 0000000000..2aeac92624 Binary files /dev/null and b/Items/Armor/TitanHeartMantle_Body.png differ diff --git a/Items/Armor/TitanHeartMask.cs b/Items/Armor/TitanHeartMask.cs new file mode 100644 index 0000000000..db9b696842 --- /dev/null +++ b/Items/Armor/TitanHeartMask.cs @@ -0,0 +1,64 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor +{ + [AutoloadEquip(EquipType.Head)] + public class TitanHeartMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart Mask"); + Tooltip.SetDefault("5% increased rogue damage and knockback"); + } + + public override void SetDefaults() + { + item.width = 18; + item.height = 18; + item.value = Item.buyPrice(0, 12, 0, 0); + item.rare = 5; + item.defense = 12; //43 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) + { + return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + } + + public override void UpdateArmorSet(Player player) + { + player.setBonus = "20% increased rogue damage and knockback\n" + + "Stealth strikes deal double knockback and cause an astral explosion\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 100\n" + + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.titanHeartSet = true; + modPlayer.throwingDamage += 0.2f; + modPlayer.rogueStealthMax += 1f; + modPlayer.wearingRogueArmor = true; + } + + public override void UpdateEquip(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.titanHeartMask = true; + modPlayer.throwingDamage += 0.05f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Armor/TitanHeartMask.png b/Items/Armor/TitanHeartMask.png new file mode 100644 index 0000000000..2d29c5f4a3 Binary files /dev/null and b/Items/Armor/TitanHeartMask.png differ diff --git a/Items/Armor/TitanHeartMask_Head.png b/Items/Armor/TitanHeartMask_Head.png new file mode 100644 index 0000000000..0da57b829a Binary files /dev/null and b/Items/Armor/TitanHeartMask_Head.png differ diff --git a/Items/Armor/Vanity/AnahitaMask.cs b/Items/Armor/Vanity/AnahitaMask.cs new file mode 100644 index 0000000000..dbb1c899ec --- /dev/null +++ b/Items/Armor/Vanity/AnahitaMask.cs @@ -0,0 +1,22 @@ +using Terraria.ModLoader; +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class AnahitaMask : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anahita Mask"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = 1; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/AnahitaMask.png b/Items/Armor/Vanity/AnahitaMask.png new file mode 100644 index 0000000000..ad122a30d9 Binary files /dev/null and b/Items/Armor/Vanity/AnahitaMask.png differ diff --git a/Items/Armor/Vanity/AnahitaMask_Head.png b/Items/Armor/Vanity/AnahitaMask_Head.png new file mode 100644 index 0000000000..9e9469605b Binary files /dev/null and b/Items/Armor/Vanity/AnahitaMask_Head.png differ diff --git a/Items/Armor/Vanity/LeviathanMask.png b/Items/Armor/Vanity/LeviathanMask.png index cc7e565bfc..8f9f7e506e 100644 Binary files a/Items/Armor/Vanity/LeviathanMask.png and b/Items/Armor/Vanity/LeviathanMask.png differ diff --git a/Items/Armor/Vanity/LeviathanMask_Head.png b/Items/Armor/Vanity/LeviathanMask_Head.png index 28b1546778..ce1b8bbeee 100644 Binary files a/Items/Armor/Vanity/LeviathanMask_Head.png and b/Items/Armor/Vanity/LeviathanMask_Head.png differ diff --git a/Items/Armor/WulfrumArmor.png b/Items/Armor/WulfrumArmor.png index 6b588b347a..f99eacd3b0 100644 Binary files a/Items/Armor/WulfrumArmor.png and b/Items/Armor/WulfrumArmor.png differ diff --git a/Items/Armor/WulfrumArmor_Arms.png b/Items/Armor/WulfrumArmor_Arms.png index f4658bd88d..d746fc89f8 100644 Binary files a/Items/Armor/WulfrumArmor_Arms.png and b/Items/Armor/WulfrumArmor_Arms.png differ diff --git a/Items/Armor/WulfrumArmor_Body.png b/Items/Armor/WulfrumArmor_Body.png index 44e60bb227..0122566d95 100644 Binary files a/Items/Armor/WulfrumArmor_Body.png and b/Items/Armor/WulfrumArmor_Body.png differ diff --git a/Items/Armor/WulfrumArmor_FemaleBody.png b/Items/Armor/WulfrumArmor_FemaleBody.png index 44e60bb227..0122566d95 100644 Binary files a/Items/Armor/WulfrumArmor_FemaleBody.png and b/Items/Armor/WulfrumArmor_FemaleBody.png differ diff --git a/Items/Armor/WulfrumHeadgear.png b/Items/Armor/WulfrumHeadgear.png index 671c39b7f4..e6d08596e8 100644 Binary files a/Items/Armor/WulfrumHeadgear.png and b/Items/Armor/WulfrumHeadgear.png differ diff --git a/Items/Armor/WulfrumHeadgear_Head.png b/Items/Armor/WulfrumHeadgear_Head.png index 4ea3156130..cf9ef4f3ac 100644 Binary files a/Items/Armor/WulfrumHeadgear_Head.png and b/Items/Armor/WulfrumHeadgear_Head.png differ diff --git a/Items/Armor/WulfrumHelm.png b/Items/Armor/WulfrumHelm.png index 500b44d32a..b2611d63d1 100644 Binary files a/Items/Armor/WulfrumHelm.png and b/Items/Armor/WulfrumHelm.png differ diff --git a/Items/Armor/WulfrumHelm_Head.png b/Items/Armor/WulfrumHelm_Head.png index 1498d2b0be..9c56efc53a 100644 Binary files a/Items/Armor/WulfrumHelm_Head.png and b/Items/Armor/WulfrumHelm_Head.png differ diff --git a/Items/Armor/WulfrumHelmet.png b/Items/Armor/WulfrumHelmet.png index a531fdf4a6..e549a7c76e 100644 Binary files a/Items/Armor/WulfrumHelmet.png and b/Items/Armor/WulfrumHelmet.png differ diff --git a/Items/Armor/WulfrumHelmet_Head.png b/Items/Armor/WulfrumHelmet_Head.png index a62f01cf1d..50ce885f3f 100644 Binary files a/Items/Armor/WulfrumHelmet_Head.png and b/Items/Armor/WulfrumHelmet_Head.png differ diff --git a/Items/Armor/WulfrumHood.png b/Items/Armor/WulfrumHood.png index 73ea374b5a..82655fd91e 100644 Binary files a/Items/Armor/WulfrumHood.png and b/Items/Armor/WulfrumHood.png differ diff --git a/Items/Armor/WulfrumHood_Head.png b/Items/Armor/WulfrumHood_Head.png index dc5bcd550e..6b273ef5e1 100644 Binary files a/Items/Armor/WulfrumHood_Head.png and b/Items/Armor/WulfrumHood_Head.png differ diff --git a/Items/Armor/WulfrumLeggings.png b/Items/Armor/WulfrumLeggings.png index 6ed06d8882..ba9f776ea1 100644 Binary files a/Items/Armor/WulfrumLeggings.png and b/Items/Armor/WulfrumLeggings.png differ diff --git a/Items/Armor/WulfrumLeggings_Legs.png b/Items/Armor/WulfrumLeggings_Legs.png index 56268cf5de..9b96d20767 100644 Binary files a/Items/Armor/WulfrumLeggings_Legs.png and b/Items/Armor/WulfrumLeggings_Legs.png differ diff --git a/Items/Armor/WulfrumMask.png b/Items/Armor/WulfrumMask.png index 81852ac847..07edc75dce 100644 Binary files a/Items/Armor/WulfrumMask.png and b/Items/Armor/WulfrumMask.png differ diff --git a/Items/Armor/WulfrumMask_Head.png b/Items/Armor/WulfrumMask_Head.png index 77d7eabf9f..56756bdf03 100644 Binary files a/Items/Armor/WulfrumMask_Head.png and b/Items/Armor/WulfrumMask_Head.png differ diff --git a/Items/Armor/XerocCuisses.cs b/Items/Armor/XerocCuisses.cs index 7d20d317bd..c0ab2a23e2 100644 --- a/Items/Armor/XerocCuisses.cs +++ b/Items/Armor/XerocCuisses.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Cuisses"); + DisplayName.SetDefault("Empyrean Cuisses"); Tooltip.SetDefault("5% increased rogue damage and critical strike chance\n" + "20% increased movement speed\n" + "Speed of the cosmos"); diff --git a/Items/Armor/XerocCuisses.png b/Items/Armor/XerocCuisses.png index b2a9795649..86af5c1d75 100644 Binary files a/Items/Armor/XerocCuisses.png and b/Items/Armor/XerocCuisses.png differ diff --git a/Items/Armor/XerocCuisses_Legs.png b/Items/Armor/XerocCuisses_Legs.png index 38062343b0..9128b5898c 100644 Binary files a/Items/Armor/XerocCuisses_Legs.png and b/Items/Armor/XerocCuisses_Legs.png differ diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 36ffe653b9..c1e064b27c 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Mask"); + DisplayName.SetDefault("Empyrean Mask"); Tooltip.SetDefault("11% increased rogue damage and critical strike chance, 22% increased movement speed\n" + "Temporary immunity to lava\n" + "Provides heat protection in Death Mode\n" + @@ -36,6 +36,8 @@ namespace CalamityMod.Items.Armor { player.armorEffectDrawShadow = true; player.armorEffectDrawOutlines = true; + player.Calamity().meldTransformation = true; + player.Calamity().meldTransformationForce = true; } public override void UpdateArmorSet(Player player) @@ -50,7 +52,7 @@ namespace CalamityMod.Items.Armor "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) { player.AddBuff(BuffID.Wrath, 2); player.AddBuff(BuffID.Rage, 2); @@ -78,4 +80,28 @@ namespace CalamityMod.Items.Armor recipe.AddRecipe(); } } + + public class MeldTransformationHead : EquipTexture + { + public override bool DrawHead() + { + return false; + } + } + + public class MeldTransformationBody : EquipTexture + { + public override bool DrawBody() + { + return false; + } + } + + public class MeldTransformationLegs : EquipTexture + { + public override bool DrawLegs() + { + return false; + } + } } diff --git a/Items/Armor/XerocMask.png b/Items/Armor/XerocMask.png index 7fc3160e93..47578c6049 100644 Binary files a/Items/Armor/XerocMask.png and b/Items/Armor/XerocMask.png differ diff --git a/Items/Armor/XerocMask_Head.png b/Items/Armor/XerocMask_Head.png index b7555ffc81..04e8bb52e5 100644 Binary files a/Items/Armor/XerocMask_Head.png and b/Items/Armor/XerocMask_Head.png differ diff --git a/Items/Armor/XerocPlateMail.cs b/Items/Armor/XerocPlateMail.cs index 3d439a6533..3d5091ce9d 100644 --- a/Items/Armor/XerocPlateMail.cs +++ b/Items/Armor/XerocPlateMail.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Armor { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Plate Mail"); + DisplayName.SetDefault("Empyrean Cloak"); Tooltip.SetDefault("+20 max life\n" + "6% increased movement speed\n" + "7% increased rogue damage and critical strike chance\n" + diff --git a/Items/Armor/XerocPlateMail.png b/Items/Armor/XerocPlateMail.png index df27234edb..6fecf62e4a 100644 Binary files a/Items/Armor/XerocPlateMail.png and b/Items/Armor/XerocPlateMail.png differ diff --git a/Items/Armor/XerocPlateMail_Arms.png b/Items/Armor/XerocPlateMail_Arms.png index bba2164400..dc99ae730b 100644 Binary files a/Items/Armor/XerocPlateMail_Arms.png and b/Items/Armor/XerocPlateMail_Arms.png differ diff --git a/Items/Armor/XerocPlateMail_Body.png b/Items/Armor/XerocPlateMail_Body.png index 6fe45adf32..4b6581a9cb 100644 Binary files a/Items/Armor/XerocPlateMail_Body.png and b/Items/Armor/XerocPlateMail_Body.png differ diff --git a/Items/Armor/XerocPlateMail_FemaleBody.png b/Items/Armor/XerocPlateMail_FemaleBody.png deleted file mode 100644 index 6fe45adf32..0000000000 Binary files a/Items/Armor/XerocPlateMail_FemaleBody.png and /dev/null differ diff --git a/Items/DifficultyItems/IronHeart.cs b/Items/DifficultyItems/IronHeart.cs index eb3d38a3c2..10704165c4 100644 --- a/Items/DifficultyItems/IronHeart.cs +++ b/Items/DifficultyItems/IronHeart.cs @@ -2,6 +2,7 @@ using CalamityMod.NPCs.SlimeGod; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -13,10 +14,10 @@ namespace CalamityMod.Items.DifficultyItems public override void SetStaticDefaults() { DisplayName.SetDefault("Iron Heart"); - Tooltip.SetDefault("Makes dying while a boss is alive permanently kill you.\n" + + Tooltip.SetDefault("Healing with potions and all positive life regen is disabled.\n" + + "Enemy damage scales with your max health.\n" + "Can be toggled on and off.\n" + - "Using this while a boss is alive will permanently kill you.\n" + - "Cannot be activated if any boss has been killed."); + "Using this while a boss is alive will instantly kill you and despawn the boss."); } public override void SetDefaults() @@ -32,24 +33,19 @@ namespace CalamityMod.Items.DifficultyItems item.consumable = false; } - public override bool CanUseItem(Player player) - { - return !CalamityWorld.downedBossAny; - } - public override bool UseItem(Player player) { - for (int doom = 0; doom < 200; doom++) - { - if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || - Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) - { - player.KillMeForGood(); - Main.npc[doom].active = Main.npc[doom].friendly; - Main.npc[doom].netUpdate = true; - } - } - if (!CalamityWorld.ironHeart) + for (int doom = 0; doom < Main.npc.Length; doom++) + { + if ((Main.npc[doom].active && (Main.npc[doom].boss || Main.npc[doom].type == NPCID.EaterofWorldsHead || Main.npc[doom].type == NPCID.EaterofWorldsTail || Main.npc[doom].type == ModContent.NPCType() || + Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType() || Main.npc[doom].type == ModContent.NPCType())) || CalamityWorld.DoGSecondStageCountdown > 0) + { + player.KillMe(PlayerDeathReason.ByCustomReason(player.name + " tried to change the rules."), 1000.0, 0, false); + Main.npc[doom].active = Main.npc[doom].friendly; + Main.npc[doom].netUpdate = true; + } + } + if (!CalamityWorld.ironHeart) { CalamityWorld.ironHeart = true; string key = "Mods.CalamityMod.IronHeartText"; diff --git a/Items/Fishing/FishingRods/WulfrumRod.png b/Items/Fishing/FishingRods/WulfrumRod.png index 3371287464..593ae2bc0c 100644 Binary files a/Items/Fishing/FishingRods/WulfrumRod.png and b/Items/Fishing/FishingRods/WulfrumRod.png differ diff --git a/Items/LoreItems/KnowledgeAquaticScourge.cs b/Items/LoreItems/KnowledgeAquaticScourge.cs index 725d3ce13d..c00a8083ea 100644 --- a/Items/LoreItems/KnowledgeAquaticScourge.cs +++ b/Items/LoreItems/KnowledgeAquaticScourge.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A horror born of pollution and insatiable hunger; based on size alone this was merely a juvenile.\n" + "These scourge creatures are the largest aquatic predators and very rarely do they frequent such shallow waters.\n" + "Place in your inventory to gain immunity to the sulphurous waters and increase the stat gains from the Well Fed buff.\n" + - "However, without the Well Fed buff your stats will decrease due to your insatiable hunger."); + "However, without the Well Fed buff your stats will decrease due to your insatiable hunger.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -31,11 +32,12 @@ namespace CalamityMod.Items.LoreItems return false; } - public override void UpdateInventory(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aquaticScourgeLore = true; - } + public override void UpdateInventory(Player player) + { + CalamityPlayer modPlayer = player.Calamity(); + if (item.favorited) + modPlayer.aquaticScourgeLore = true; + } public override void AddRecipes() { diff --git a/Items/LoreItems/KnowledgeAstrumAureus.cs b/Items/LoreItems/KnowledgeAstrumAureus.cs index 7b1d99ae7d..afff87fd71 100644 --- a/Items/LoreItems/KnowledgeAstrumAureus.cs +++ b/Items/LoreItems/KnowledgeAstrumAureus.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Aureus"); Tooltip.SetDefault("A titanic cyborg infected by a star-borne disease expelled from the belly of an ancient god.\n" + "The destruction of this creature will not prevent the spread of the disease.\n" + - "Place in your inventory to gain increased jump speed in space."); + "Place in your inventory to gain increased jump speed in space.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumAureusLore = true; + if (item.favorited) + modPlayer.astrumAureusLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeAstrumDeus.cs b/Items/LoreItems/KnowledgeAstrumDeus.cs index e892c5c7e8..a8b5376105 100644 --- a/Items/LoreItems/KnowledgeAstrumDeus.cs +++ b/Items/LoreItems/KnowledgeAstrumDeus.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Astrum Deus"); Tooltip.SetDefault("God of the stars and largest vessel for the Astral Infection.\n" + "Though struck down from its place among the stars its remnants have gathered strength, aiming to take its rightful place in the cosmos once more.\n" + - "Place in your inventory to gain increased movement speed in space."); + "Place in your inventory to gain increased movement speed in space.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.astrumDeusLore = true; + if (item.favorited) + modPlayer.astrumDeusLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeBrainofCthulhu.cs b/Items/LoreItems/KnowledgeBrainofCthulhu.cs index 4e6a899dbb..e5f11cc641 100644 --- a/Items/LoreItems/KnowledgeBrainofCthulhu.cs +++ b/Items/LoreItems/KnowledgeBrainofCthulhu.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Most likely another abomination spawned from this inchoate mass of flesh.\n" + "Allows you to teleport similar to the Rod of Discord while in the crimson. Place in your hotbar to use it.\n" + "Teleportation is disabled while Chaos State is active.\n" + - "However, you become confused for a few seconds after you use it due to your overwhelming brain power."); + "However, you become confused for a few seconds after you use it due to your overwhelming brain power.\n" + + "Teleportation only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override bool CanUseItem(Player player) { - return player.ZoneCrimson; + return player.ZoneCrimson && item.favorited; } public override bool UseItem(Player player) diff --git a/Items/LoreItems/KnowledgeBrimstoneElemental.cs b/Items/LoreItems/KnowledgeBrimstoneElemental.cs index 336c1e75a2..d9a666e5d1 100644 --- a/Items/LoreItems/KnowledgeBrimstoneElemental.cs +++ b/Items/LoreItems/KnowledgeBrimstoneElemental.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Brimstone Elemental"); Tooltip.SetDefault("The most powerful of the elementals, bent on exacting revenge upon the bloody inferno that demolished her home.\n" + "Finally put to rest, she will suffer no longer from the grief caused by the deaths of her people.\n" + - "Place in your inventory to improve the inferno potion effect."); + "Place in your inventory to improve the inferno potion effect.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneElementalLore = true; + if (item.favorited) + modPlayer.brimstoneElementalLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCalamitas.cs b/Items/LoreItems/KnowledgeCalamitas.cs index a4f20b294d..d2cddd9d9c 100644 --- a/Items/LoreItems/KnowledgeCalamitas.cs +++ b/Items/LoreItems/KnowledgeCalamitas.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The witch unrivaled. Perhaps the only one amongst my cohorts to have ever given me cause for doubt.\n" + "Now that you have defeated her your destiny is clear.\n" + "Come now, face me.\n" + - "Place in your inventory to die instantly from every hit."); + "Place in your inventory to die instantly from every hit.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.SCalLore = true; + if (item.favorited) + modPlayer.SCalLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCrabulon.cs b/Items/LoreItems/KnowledgeCrabulon.cs index 57bf38da6e..1b2116ca4e 100644 --- a/Items/LoreItems/KnowledgeCrabulon.cs +++ b/Items/LoreItems/KnowledgeCrabulon.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A crab and its mushrooms, a love story.\n" + "It's interesting how creatures can adapt given certain circumstances.\n" + "Place in your inventory to gain the Mushy buff while underground or in the mushroom biome.\n" + - "However, your movement speed will be decreased while in these areas due to you being covered in fungi."); + "However, your movement speed will be decreased while in these areas due to you being covered in fungi.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.crabulonLore = true; + if (item.favorited) + modPlayer.crabulonLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeCryogen.cs b/Items/LoreItems/KnowledgeCryogen.cs index 184c4b9776..16b985b6f8 100644 --- a/Items/LoreItems/KnowledgeCryogen.cs +++ b/Items/LoreItems/KnowledgeCryogen.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Cryogen"); Tooltip.SetDefault("The archmage's prison.\n" + "I am unsure if it has grown weaker over the decades of imprisonment.\n" + - "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body."); + "Place in your inventory to gain a frost dash that freezes enemies, at the cost of slightly reduced defense due to your brittle body.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dashMod = 6; + if (item.favorited) + modPlayer.dashMod = 6; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDesertScourge.cs b/Items/LoreItems/KnowledgeDesertScourge.cs index 082f206049..a631c734fa 100644 --- a/Items/LoreItems/KnowledgeDesertScourge.cs +++ b/Items/LoreItems/KnowledgeDesertScourge.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "What used to be a majestic beast swimming through the water has now become a dried-up and\n" + "gluttonous husk, constantly on a voracious search for its next meal.\n" + "Place in your inventory for an increase to defense while in the desert or sunken sea.\n" + - "However, you will deal decreased damage while in these areas due to being a husk of your former self."); + "However, you will deal decreased damage while in these areas due to being a husk of your former self.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - player.Calamity().desertScourgeLore = true; + if (item.favorited) + player.Calamity().desertScourgeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDestroyer.cs b/Items/LoreItems/KnowledgeDestroyer.cs index 55303b8bff..5c3141b702 100644 --- a/Items/LoreItems/KnowledgeDestroyer.cs +++ b/Items/LoreItems/KnowledgeDestroyer.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A machine brought to life by the mighty souls of warriors, and built to excavate massive tunnels in planets to gather resources.\n" + "Could have proven useful if Draedon didn't have an obsession with turning everything into a tool of destruction.\n" + "Place in your inventory to gain a boost to your pick speed.\n" + - "However, your max acceleration is decreased slightly due to you feeling heavier."); + "However, your max acceleration is decreased slightly due to you feeling heavier.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.destroyerLore = true; + if (item.favorited) + modPlayer.destroyerLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDevourerofGods.cs b/Items/LoreItems/KnowledgeDevourerofGods.cs index c7b2f2d492..3cf2fa69fd 100644 --- a/Items/LoreItems/KnowledgeDevourerofGods.cs +++ b/Items/LoreItems/KnowledgeDevourerofGods.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("This serpent’s power to assimilate the abilities and energy of those it consumed is unique in almost all the known cosmos, save for its lesser brethren.\n" + "I would have soon had to eliminate it as a threat had it been given more time and creatures to feast upon.\n" + "Place in your inventory to boost the power of your true melee strikes by 25%.\n" + - "However, due to your reckless nature you will take increased damage."); + "However, due to your reckless nature you will take increased damage.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.DoGLore = true; + if (item.favorited) + modPlayer.DoGLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeDukeFishron.cs b/Items/LoreItems/KnowledgeDukeFishron.cs index 516bd28ad7..fdc59c60bd 100644 --- a/Items/LoreItems/KnowledgeDukeFishron.cs +++ b/Items/LoreItems/KnowledgeDukeFishron.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The mutant terror of the sea was once the trusted companion of an old king; he tamed it using its favorite treat.\n" + "Long ago, the creature flew in desperation from the raging bloody inferno consuming its home, ultimately finding its way to the ocean.\n" + "Place in your inventory for an increase to all damage, crit and movement speed while submerged in liquid.\n" + - "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out."); + "However, while not submerged in liquid you will have slightly decreased damage, crit and movement speed due to feeling dried out.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.dukeFishronLore = true; + if (item.favorited) + modPlayer.dukeFishronLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeEaterofWorlds.cs b/Items/LoreItems/KnowledgeEaterofWorlds.cs index 40a7adf76f..83269fc9a3 100644 --- a/Items/LoreItems/KnowledgeEaterofWorlds.cs +++ b/Items/LoreItems/KnowledgeEaterofWorlds.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Perhaps it was just a giant worm infected by the microbe, given centuries to feed and grow its festering body.\n" + "Seems likely, given the origins of this place.\n" + "Deadly microbes spawn around you while this is placed in your inventory.\n" + - "However, you will have decreased life regen due to your skin rotting off."); + "However, you will have decreased life regen due to your skin rotting off.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.eaterOfWorldsLore = true; + if (item.favorited) + modPlayer.eaterOfWorldsLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeEyeofCthulhu.cs b/Items/LoreItems/KnowledgeEyeofCthulhu.cs index 61a1a60a44..086355307c 100644 --- a/Items/LoreItems/KnowledgeEyeofCthulhu.cs +++ b/Items/LoreItems/KnowledgeEyeofCthulhu.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("That eye...how peculiar.\n" + "I sensed it watching you more intensely as you grew stronger.\n" + "Place in your inventory for night vision at night.\n" + - "However, your vision is reduced during the day."); + "However, your vision is reduced during the day.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -31,10 +32,13 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (!Main.dayTime) - player.nightVision = true; - else - player.blind = true; + if (item.favorited) + { + if (!Main.dayTime) + player.nightVision = true; + else + player.blind = true; + } } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeGolem.cs b/Items/LoreItems/KnowledgeGolem.cs index 4fc871658b..d661b84483 100644 --- a/Items/LoreItems/KnowledgeGolem.cs +++ b/Items/LoreItems/KnowledgeGolem.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Golem"); Tooltip.SetDefault("A primitive construct.\n" + "I admire the lihzahrd race for their ingenuity, though finding faith in such a flawed idol would invariably lead to their downfall.\n" + - "Place in your inventory to gain increased defense while standing still."); + "Place in your inventory to gain increased defense while standing still.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.golemLore = true; + if (item.favorited) + modPlayer.golemLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeHiveMind.cs b/Items/LoreItems/KnowledgeHiveMind.cs index 2d7b59c989..9ad9b6dbd9 100644 --- a/Items/LoreItems/KnowledgeHiveMind.cs +++ b/Items/LoreItems/KnowledgeHiveMind.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A hive of clustered microbial-infected flesh.\n" + "I do not believe killing it will lessen the corruption here.\n" + "Place in your inventory for all of your projectiles to inflict cursed flames when in the corruption.\n" + - "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor."); + "However, enemy spawn rates will be greatly reduced while in the corruption due to your overwhelmingly-putrid odor.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneCorrupt) + if (player.ZoneCorrupt && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.hiveMindLore = true; diff --git a/Items/LoreItems/KnowledgeKingSlime.cs b/Items/LoreItems/KnowledgeKingSlime.cs index 9b7704180f..1af39c4988 100644 --- a/Items/LoreItems/KnowledgeKingSlime.cs +++ b/Items/LoreItems/KnowledgeKingSlime.cs @@ -13,7 +13,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Only a fool could be caught by this pitiful excuse for a hunter.\n" + "Unfortunately, our world has no shortage of those.\n" + "Place in your inventory to gain a slight movement speed and jump boost.\n" + - "However, your defense is slightly reduced due to your gelatinous body."); + "However, your defense is slightly reduced due to your gelatinous body.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -31,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - player.Calamity().kingSlimeLore = true; + if (item.favorited) + player.Calamity().kingSlimeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.cs b/Items/LoreItems/KnowledgeLeviathanandSiren.cs index b0207cd611..e95bef421f 100644 --- a/Items/LoreItems/KnowledgeLeviathanandSiren.cs +++ b/Items/LoreItems/KnowledgeLeviathanandSiren.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Items.LoreItems "Perhaps two genetic misfits outcast from their homes that found comfort in assisting one another.\n" + "Place in your inventory to gain increased max health while wearing the siren heart and treasure detect while wearing the strange orb.\n" + "Allows the young siren pet to move normally while outside of liquids.\n" + - "However, if you're not submerged in liquid you will have decreased defense and damage reduction."); + "However, if you're not submerged in liquid you will have decreased defense and damage reduction.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.leviathanAndSirenLore = true; + if (item.favorited) + modPlayer.leviathanAndSirenLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeLeviathanandSiren.png b/Items/LoreItems/KnowledgeLeviathanandSiren.png index 155928f2bf..b1e8746bb8 100644 Binary files a/Items/LoreItems/KnowledgeLeviathanandSiren.png and b/Items/LoreItems/KnowledgeLeviathanandSiren.png differ diff --git a/Items/LoreItems/KnowledgeLunaticCultist.cs b/Items/LoreItems/KnowledgeLunaticCultist.cs index 85eefb0946..4ddea4544f 100644 --- a/Items/LoreItems/KnowledgeLunaticCultist.cs +++ b/Items/LoreItems/KnowledgeLunaticCultist.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Someone I once held in such contempt for his actions is now...deceased, his sealing ritual undone...prepare for the end.\n" + "Your impending doom approaches...\n" + "Place in your inventory for an increase to all stats during the lunar event.\n" + - "However, your vision is decreased due to eldritch knowledge damaging your mind."); + "However, your vision is decreased due to eldritch knowledge damaging your mind.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (NPC.LunarApocalypseIsUp) + if (NPC.LunarApocalypseIsUp && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.lunaticCultistLore = true; diff --git a/Items/LoreItems/KnowledgeMoonLord.cs b/Items/LoreItems/KnowledgeMoonLord.cs index de993228b6..6d023e3fcb 100644 --- a/Items/LoreItems/KnowledgeMoonLord.cs +++ b/Items/LoreItems/KnowledgeMoonLord.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "Had it been fully restored it would have been a force to behold, but what you fought was an empty shell.\n" + "However, that doesn't diminish the immense potential locked within it, released upon its death.\n" + "Place in your inventory to gain an improved Gravity Globe that gives you an increase to all stats while upside down.\n" + - "However, while not upside down you have permanent featherfall."); + "However, while not upside down you have permanent featherfall.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.moonLordLore = true; + if (item.favorited) + modPlayer.moonLordLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeOldDuke.cs b/Items/LoreItems/KnowledgeOldDuke.cs index 78a1498a80..6df689a8c1 100644 --- a/Items/LoreItems/KnowledgeOldDuke.cs +++ b/Items/LoreItems/KnowledgeOldDuke.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Old Duke"); Tooltip.SetDefault("Strange, to find out that the mutant terror of the seas was not alone in its unique biology.\n" + "Perhaps I was mistaken to classify the creature from its relation to pigrons alone.\n" + - "Place in your inventory to convert negative effects from the Acid Rain debuff to positive effects."); + "Place in your inventory to convert negative effects from the Acid Rain debuff to positive effects.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.boomerDukeLore = true; + if (item.favorited) + modPlayer.boomerDukeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePerforators.cs b/Items/LoreItems/KnowledgePerforators.cs index aed58f7645..53dbe77a77 100644 --- a/Items/LoreItems/KnowledgePerforators.cs +++ b/Items/LoreItems/KnowledgePerforators.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Perforators and their Hive"); Tooltip.SetDefault("An abomination of comingled flesh, bone, and organ, infested primarily by blood-slurping worms.\n" + "Place in your inventory for all of your projectiles to inflict ichor when in the crimson.\n" + - "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus."); + "However, enemy spawn rates will be greatly increased while in the crimson due to your body excreting a sweet-smelling pus.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneCrimson) + if (player.ZoneCrimson && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.perforatorLore = true; diff --git a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs index 54bc9ee369..4f88bf176c 100644 --- a/Items/LoreItems/KnowledgePlaguebringerGoliath.cs +++ b/Items/LoreItems/KnowledgePlaguebringerGoliath.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("The Plaguebringer Goliath"); Tooltip.SetDefault("A horrific amalgam of steel, flesh, and infection, capable of destroying an entire civilization in just one onslaught.\n" + "Its plague nuke barrage can leave an entire area uninhabitable for months. A shame that it came to this but the plague must be contained.\n" + - "Place in your inventory to gain increased wing flight time, but at the cost of reduced life regen."); + "Place in your inventory to gain increased wing flight time, but at the cost of reduced life regen.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.plaguebringerGoliathLore = true; + if (item.favorited) + modPlayer.plaguebringerGoliathLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePlantera.cs b/Items/LoreItems/KnowledgePlantera.cs index b5a07a9743..7c71900847 100644 --- a/Items/LoreItems/KnowledgePlantera.cs +++ b/Items/LoreItems/KnowledgePlantera.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("Well done, you killed a plant.\n" + "It was used as a vessel to house the spirits of those unfortunate enough to find their way down here.\n" + "I wish you luck in dealing with the fallout.\n" + - "Place in your inventory to gain increased item grab range."); + "Place in your inventory to gain increased item grab range.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.planteraLore = true; + if (item.favorited) + modPlayer.planteraLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgePolterghast.cs b/Items/LoreItems/KnowledgePolterghast.cs index 80488cdddb..acce6e2081 100644 --- a/Items/LoreItems/KnowledgePolterghast.cs +++ b/Items/LoreItems/KnowledgePolterghast.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Polterghast"); Tooltip.SetDefault("A creature born of hatred and anger, formed by countless human souls with all of their energy entirely devoted to consuming others.\n" + "It seems a waste to have had such a potent source of power ravage mindlessly through these empty halls.\n" + - "Place in your inventory to gain increased item grab range."); + "Place in your inventory to gain increased item grab range.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.polterghastLore = true; + if (item.favorited) + modPlayer.polterghastLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeProvidence.cs b/Items/LoreItems/KnowledgeProvidence.cs index 4c6d5cb9e0..16183e5179 100644 --- a/Items/LoreItems/KnowledgeProvidence.cs +++ b/Items/LoreItems/KnowledgeProvidence.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("A core surrounded by stone and flame, a simple origin and a simple goal.\n" + "What would have become of us had she not been defeated is a frightening concept to consider.\n" + "Place in your inventory to imbue all projectiles with profaned flames, causing them to inflict extra damage.\n" + - "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames."); + "However, your max life is decreased due to a part of your soul being required to fuel the profaned flames.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -35,7 +36,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.providenceLore = true; + if (item.favorited) + modPlayer.providenceLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeQueenBee.cs b/Items/LoreItems/KnowledgeQueenBee.cs index f4ed7c5ed5..b91706e5ae 100644 --- a/Items/LoreItems/KnowledgeQueenBee.cs +++ b/Items/LoreItems/KnowledgeQueenBee.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.LoreItems { DisplayName.SetDefault("Queen Bee"); Tooltip.SetDefault("As crude as the giant insects are they can prove useful in certain situations...given the ability to control them.\n" + - "Place in your inventory to make small bees and weak hornets friendly."); + "Place in your inventory to make small bees and weak hornets friendly.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -31,7 +32,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.queenBeeLore = true; + if (item.favorited) + modPlayer.queenBeeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeRavager.cs b/Items/LoreItems/KnowledgeRavager.cs index 8a2b2fc156..461310f14d 100644 --- a/Items/LoreItems/KnowledgeRavager.cs +++ b/Items/LoreItems/KnowledgeRavager.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Ravager"); Tooltip.SetDefault("The flesh golem constructed using twisted necromancy during the time of my conquest to counter my unstoppable forces.\n" + "Its creators were slaughtered by it moments after its conception. It is for the best that it has been destroyed.\n" + - "Place in your inventory to gain an increase to all damage, but at the cost of reduced wing flight time."); + "Place in your inventory to gain an increase to all damage, but at the cost of reduced wing flight time.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.ravagerLore = true; + if (item.favorited) + modPlayer.ravagerLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeSkeletron.cs b/Items/LoreItems/KnowledgeSkeletron.cs index 81a3cf3fdc..8f54da002b 100644 --- a/Items/LoreItems/KnowledgeSkeletron.cs +++ b/Items/LoreItems/KnowledgeSkeletron.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("The curse is said to only affect the elderly.\n" + "After they are afflicted they become an immortal vessel for an ancient demon of the underworld.\n" + "Place in your inventory to gain increased damage while in the dungeon.\n" + - "However, your max health is decreased due to Skeletron's curse."); + "However, your max health is decreased due to Skeletron's curse.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.ZoneDungeon) + if (player.ZoneDungeon && item.favorited) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.skeletronLore = true; diff --git a/Items/LoreItems/KnowledgeSkeletronPrime.cs b/Items/LoreItems/KnowledgeSkeletronPrime.cs index bbb95cff60..22239ad9f4 100644 --- a/Items/LoreItems/KnowledgeSkeletronPrime.cs +++ b/Items/LoreItems/KnowledgeSkeletronPrime.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("What a silly and pointless contraption for something created with the essence of pure terror.\n" + "Draedon obviously took several liberties with its design...I am not impressed.\n" + "Place in your inventory to gain a boost to your armor penetration.\n" + - "However, your max acceleration is decreased due to you feeling heavier."); + "However, your max acceleration is decreased due to you feeling heavier.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.skeletronPrimeLore = true; + if (item.favorited) + modPlayer.skeletronPrimeLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeSlimeGod.cs b/Items/LoreItems/KnowledgeSlimeGod.cs index e980523588..c194ec932f 100644 --- a/Items/LoreItems/KnowledgeSlimeGod.cs +++ b/Items/LoreItems/KnowledgeSlimeGod.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("It is a travesty, one of the most threatening biological terrors ever created.\n" + "If this creature were allowed to combine every slime on the planet it would become nearly unstoppable.\n" + "Place in your inventory to become slimed and able to slide around on tiles quickly, at the cost of reduced defense.\n" + - "This effect makes dashing more difficult and does not work with mounts."); + "This effect makes dashing more difficult and does not work with mounts.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -32,7 +33,7 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { - if (player.mount.Active) + if (player.mount.Active || !item.favorited) return; if (player.dashDelay < 0) diff --git a/Items/LoreItems/KnowledgeTwins.cs b/Items/LoreItems/KnowledgeTwins.cs index 7314c7f2ba..1514675839 100644 --- a/Items/LoreItems/KnowledgeTwins.cs +++ b/Items/LoreItems/KnowledgeTwins.cs @@ -15,7 +15,8 @@ namespace CalamityMod.Items.LoreItems "These creatures did not belong in this world, it's best to be rid of them.\n" + "Place in your inventory to gain invisibility and rogue bonuses at night.\n" + "However, your defense is reduced while above 50% life due to you feeling softer.\n" + - "Your max acceleration is reduced while below 50% life due to you feeling heavier."); + "Your max acceleration is reduced while below 50% life due to you feeling heavier.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.twinsLore = true; + if (item.favorited) + modPlayer.twinsLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeWallofFlesh.cs b/Items/LoreItems/KnowledgeWallofFlesh.cs index 7f485be3dc..6c4b7a7015 100644 --- a/Items/LoreItems/KnowledgeWallofFlesh.cs +++ b/Items/LoreItems/KnowledgeWallofFlesh.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems Tooltip.SetDefault("I see the deed is done.\n" + "The unholy amalgamation of flesh and hatred has been defeated.\n" + "Prepare to face the terrors that lurk in the light and dark parts of this world.\n" + - "Place in your inventory to gain increased item grab range."); + "Place in your inventory to gain increased item grab range.\n" + + "This effect only occurs if the item is favorited."); } public override void SetDefaults() @@ -33,7 +34,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.wallOfFleshLore = true; + if (item.favorited) + modPlayer.wallOfFleshLore = true; } public override void AddRecipes() diff --git a/Items/LoreItems/KnowledgeYharon.cs b/Items/LoreItems/KnowledgeYharon.cs index 535ff8a48d..bbf5a90a42 100644 --- a/Items/LoreItems/KnowledgeYharon.cs +++ b/Items/LoreItems/KnowledgeYharon.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.LoreItems DisplayName.SetDefault("Jungle Dragon, Yharon"); Tooltip.SetDefault("I would not be able to bear a world without my faithful companion by my side.\n" + "Fortunately, fate will have it so that it is a world I shall never have to see, for better or for worse.\n" + - "Place in your inventory to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage."); + "Place in your inventory to gain nearly-infinite wing flight time, but at the cost of a 25% decrease to all damage.\n" + + "These effects only occur if the item is favorited."); } public override void SetDefaults() @@ -34,7 +35,8 @@ namespace CalamityMod.Items.LoreItems public override void UpdateInventory(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.yharonLore = true; + if (item.favorited) + modPlayer.yharonLore = true; } public override void AddRecipes() diff --git a/Items/Materials/MeldBlob.png b/Items/Materials/MeldBlob.png index 48341ed30c..a24387680f 100644 Binary files a/Items/Materials/MeldBlob.png and b/Items/Materials/MeldBlob.png differ diff --git a/Items/Materials/MeldiateBar.cs b/Items/Materials/MeldiateBar.cs index 570ff475ff..e9d66056da 100644 --- a/Items/Materials/MeldiateBar.cs +++ b/Items/Materials/MeldiateBar.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - DisplayName.SetDefault("Meld Bar"); + DisplayName.SetDefault("Meld Construct"); } public override void SetDefaults() @@ -23,9 +23,8 @@ namespace CalamityMod.Items.Materials public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ItemID.Ectoplasm); - recipe.AddIngredient(ItemID.HallowedBar); recipe.AddIngredient(ModContent.ItemType(), 6); + recipe.AddIngredient(ModContent.ItemType(), 3); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this, 3); recipe.AddRecipe(); diff --git a/Items/Materials/MeldiateBar.png b/Items/Materials/MeldiateBar.png index d2067434db..1150c8db8f 100644 Binary files a/Items/Materials/MeldiateBar.png and b/Items/Materials/MeldiateBar.png differ diff --git a/Items/Materials/TitanHeart.cs b/Items/Materials/TitanHeart.cs new file mode 100644 index 0000000000..3f74cd0867 --- /dev/null +++ b/Items/Materials/TitanHeart.cs @@ -0,0 +1,19 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Materials +{ + public class TitanHeart : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Titan Heart"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.AncientBattleArmorMaterial); + } + } +} diff --git a/Items/Materials/TitanHeart.png b/Items/Materials/TitanHeart.png new file mode 100644 index 0000000000..834d516b56 Binary files /dev/null and b/Items/Materials/TitanHeart.png differ diff --git a/Items/Materials/UnholyCore.png b/Items/Materials/UnholyCore.png index 480bddf481..d13404b0e2 100644 Binary files a/Items/Materials/UnholyCore.png and b/Items/Materials/UnholyCore.png differ diff --git a/Items/Materials/WulfrumShard.cs b/Items/Materials/WulfrumShard.cs index e7975c53b3..bcdec89051 100644 --- a/Items/Materials/WulfrumShard.cs +++ b/Items/Materials/WulfrumShard.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Items.Materials { public override void SetStaticDefaults() { - DisplayName.SetDefault("Wulfrum Shard"); + DisplayName.SetDefault("Wulfrum Metal Scrap"); } public override void SetDefaults() diff --git a/Items/Materials/WulfrumShard.png b/Items/Materials/WulfrumShard.png index ffe827c29e..384f3c9372 100644 Binary files a/Items/Materials/WulfrumShard.png and b/Items/Materials/WulfrumShard.png differ diff --git a/Items/Pets/StrangeOrb.png b/Items/Pets/StrangeOrb.png index 2debd5f599..c7ab860ffb 100644 Binary files a/Items/Pets/StrangeOrb.png and b/Items/Pets/StrangeOrb.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png index 8735c3d983..fc114a1b5d 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png and b/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png index 84a2da8dfd..fe06bed067 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png and b/Items/Placeables/Furniture/CraftingStations/SilvaBasin.png differ diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png index d4a0bad1c4..4d7e82cc00 100644 Binary files a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png and b/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png differ diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs new file mode 100644 index 0000000000..c2c772e9fc --- /dev/null +++ b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.cs @@ -0,0 +1,30 @@ +using CalamityMod.Tiles.Furniture; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Trophies +{ + public class AnahitaTrophy : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Anahita Trophy"); + } + + public override void SetDefaults() + { + item.width = 30; + item.height = 30; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = ItemUseStyleID.SwingThrow; + item.consumable = true; + item.value = 50000; + item.rare = 1; + item.createTile = ModContent.TileType(); + item.placeStyle = 27; + } + } +} diff --git a/Items/Placeables/Furniture/Trophies/AnahitaTrophy.png b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.png new file mode 100644 index 0000000000..4edfaecab6 Binary files /dev/null and b/Items/Placeables/Furniture/Trophies/AnahitaTrophy.png differ diff --git a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png index e9c5717b85..54e4ff532a 100644 Binary files a/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png and b/Items/Placeables/Furniture/Trophies/LeviathanTrophy.png differ diff --git a/Items/Tools/ClimateChange/BloodIdol.png b/Items/Tools/ClimateChange/BloodIdol.png index 6fea635e5d..cdd73b1f65 100644 Binary files a/Items/Tools/ClimateChange/BloodIdol.png and b/Items/Tools/ClimateChange/BloodIdol.png differ diff --git a/Items/Tools/GallantPickaxe.cs b/Items/Tools/GallantPickaxe.cs index b9d891f4f5..06659b65f8 100644 --- a/Items/Tools/GallantPickaxe.cs +++ b/Items/Tools/GallantPickaxe.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.Tools { public override void SetStaticDefaults() { - DisplayName.SetDefault("Gallant Pickaxe"); + DisplayName.SetDefault("Genesis Pickaxe"); Tooltip.SetDefault("Can mine Uelibloom Ore"); } @@ -18,20 +18,19 @@ namespace CalamityMod.Items.Tools { item.damage = 80; item.melee = true; - item.width = 54; - item.height = 54; - item.useTime = 6; - item.useAnimation = 12; + item.width = 84; + item.height = 80; + item.useTime = 7; + item.useAnimation = 14; item.useTurn = true; item.pick = 225; item.useStyle = ItemUseStyleID.SwingThrow; item.knockBack = 5.5f; - item.value = Item.buyPrice(1, 20, 0, 0); + item.value = Item.buyPrice(1, 0, 0, 0); item.rare = 10; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.tileBoost += 4; - item.Calamity().customRarity = CalamityRarity.Turquoise; + item.tileBoost += 6; item.useTurn = true; } @@ -50,7 +49,7 @@ namespace CalamityMod.Items.Tools { if (Main.rand.NextBool(5)) { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 58); + int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 62); } } } diff --git a/Items/Tools/GallantPickaxe.png b/Items/Tools/GallantPickaxe.png index c61cc5f0ab..9937b7fc19 100644 Binary files a/Items/Tools/GallantPickaxe.png and b/Items/Tools/GallantPickaxe.png differ diff --git a/Items/Tools/WulfrumAxe.cs b/Items/Tools/WulfrumAxe.cs index 457e96fb4f..0e2b0fa44c 100644 --- a/Items/Tools/WulfrumAxe.cs +++ b/Items/Tools/WulfrumAxe.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Tools { item.damage = 5; item.melee = true; - item.width = 62; - item.height = 58; + item.width = 30; + item.height = 38; item.useTime = 26; item.useAnimation = 26; item.useTurn = true; diff --git a/Items/Tools/WulfrumAxe.png b/Items/Tools/WulfrumAxe.png index edac3515c0..7bd72fbc30 100644 Binary files a/Items/Tools/WulfrumAxe.png and b/Items/Tools/WulfrumAxe.png differ diff --git a/Items/Tools/WulfrumHammer.cs b/Items/Tools/WulfrumHammer.cs index c4643b22ca..57a0d6a014 100644 --- a/Items/Tools/WulfrumHammer.cs +++ b/Items/Tools/WulfrumHammer.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Tools { item.damage = 7; item.melee = true; - item.width = 56; - item.height = 56; + item.width = 28; + item.height = 38; item.useTime = 29; item.useAnimation = 29; item.useTurn = true; diff --git a/Items/Tools/WulfrumHammer.png b/Items/Tools/WulfrumHammer.png index 030ee2396b..05741786eb 100644 Binary files a/Items/Tools/WulfrumHammer.png and b/Items/Tools/WulfrumHammer.png differ diff --git a/Items/Tools/WulfrumPickaxe.cs b/Items/Tools/WulfrumPickaxe.cs index 7c5faf290a..0d8c6a3592 100644 --- a/Items/Tools/WulfrumPickaxe.cs +++ b/Items/Tools/WulfrumPickaxe.cs @@ -16,8 +16,8 @@ namespace CalamityMod.Items.Tools { item.damage = 5; item.melee = true; - item.width = 48; - item.height = 48; + item.width = 46; + item.height = 38; item.useTime = 16; item.useAnimation = 16; item.useTurn = true; diff --git a/Items/Tools/WulfrumPickaxe.png b/Items/Tools/WulfrumPickaxe.png index dcb359dd90..2dc3379335 100644 Binary files a/Items/Tools/WulfrumPickaxe.png and b/Items/Tools/WulfrumPickaxe.png differ diff --git a/Items/TreasureBags/LeviathanBag.cs b/Items/TreasureBags/LeviathanBag.cs index 1dc1bf6a76..72b97af33f 100644 --- a/Items/TreasureBags/LeviathanBag.cs +++ b/Items/TreasureBags/LeviathanBag.cs @@ -33,10 +33,7 @@ namespace CalamityMod.Items.TreasureBags item.expert = true; } - public override bool CanRightClick() - { - return true; - } + public override bool CanRightClick() => true; public override void PostUpdate() => CalamityUtils.ForceItemIntoWorld(item); @@ -63,6 +60,7 @@ namespace CalamityMod.Items.TreasureBags // Vanity DropHelper.DropItemChance(player, ModContent.ItemType(), 7); + DropHelper.DropItemChance(player, ModContent.ItemType(), 7); // Fishing DropHelper.DropItemChance(player, ItemID.HotlineFishingHook, 10); diff --git a/Items/TreasureBags/LeviathanBag.png b/Items/TreasureBags/LeviathanBag.png index 2928778427..23539eab22 100644 Binary files a/Items/TreasureBags/LeviathanBag.png and b/Items/TreasureBags/LeviathanBag.png differ diff --git a/Items/Weapons/Magic/Atlantis.png b/Items/Weapons/Magic/Atlantis.png index bb16c85109..327b9e0d5c 100644 Binary files a/Items/Weapons/Magic/Atlantis.png and b/Items/Weapons/Magic/Atlantis.png differ diff --git a/Items/Weapons/Magic/BrimroseStaff.png b/Items/Weapons/Magic/BrimroseStaff.png index e6c093ff69..7436cd0e66 100644 Binary files a/Items/Weapons/Magic/BrimroseStaff.png and b/Items/Weapons/Magic/BrimroseStaff.png differ diff --git a/Items/Weapons/Magic/BurningSea.png b/Items/Weapons/Magic/BurningSea.png index 0107454fa0..da9ceb00f5 100644 Binary files a/Items/Weapons/Magic/BurningSea.png and b/Items/Weapons/Magic/BurningSea.png differ diff --git a/Items/Weapons/Magic/SirensSong.png b/Items/Weapons/Magic/SirensSong.png index 5c53c88263..566bc3ee4c 100644 Binary files a/Items/Weapons/Magic/SirensSong.png and b/Items/Weapons/Magic/SirensSong.png differ diff --git a/Items/Weapons/Magic/TomeofFates.png b/Items/Weapons/Magic/TomeofFates.png index d33492dbf1..9ca9f148d3 100644 Binary files a/Items/Weapons/Magic/TomeofFates.png and b/Items/Weapons/Magic/TomeofFates.png differ diff --git a/Items/Weapons/Magic/WulfrumStaff.cs b/Items/Weapons/Magic/WulfrumStaff.cs index 9341c3853b..8f9810e226 100644 --- a/Items/Weapons/Magic/WulfrumStaff.cs +++ b/Items/Weapons/Magic/WulfrumStaff.cs @@ -7,47 +7,46 @@ using Microsoft.Xna.Framework; namespace CalamityMod.Items.Weapons.Magic { - public class WulfrumStaff : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Wulfrum Staff"); - Tooltip.SetDefault("Casts a wulfrum bolt"); - Item.staff[item.type] = true; - } + public class WulfrumStaff : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Wulfrum Staff"); + Tooltip.SetDefault("Casts a wulfrum bolt"); + //Item.staff[item.type] = true; + } - public override void SetDefaults() - { - item.damage = 12; - item.magic = true; - item.mana = 4; - item.width = 44; - item.height = 46; - item.useTime = 20; - item.useAnimation = 20; - item.useStyle = ItemUseStyleID.HoldingOut; - item.noMelee = true; - item.knockBack = 3; - item.value = Item.buyPrice(0, 1, 0, 0); - item.rare = 1; - item.UseSound = SoundID.Item43; - item.autoReuse = true; - item.shoot = ModContent.ProjectileType(); - item.shootSpeed = 9f; - } + public override void SetDefaults() + { + item.damage = 12; + item.magic = true; + item.mana = 4; + item.width = 44; + item.height = 46; + item.useTime = 20; + item.useAnimation = 20; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 3; + item.value = Item.buyPrice(0, 1, 0, 0); + item.rare = 1; + item.UseSound = SoundID.Item43; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 9f; + } - public override Vector2? HoldoutOrigin() - { - return new Vector2(10, 25); - } + //public override Vector2? HoldoutOrigin() => new Vector2(8, 15); - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType(), 12); - recipe.AddTile(TileID.Anvils); - recipe.SetResult(this); - recipe.AddRecipe(); - } - } + public override Vector2? HoldoutOffset() => new Vector2(-3, 0); + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 12); + recipe.AddTile(TileID.Anvils); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } } diff --git a/Items/Weapons/Magic/WulfrumStaff.png b/Items/Weapons/Magic/WulfrumStaff.png index 6c20e25a5c..bd38ecf2cd 100644 Binary files a/Items/Weapons/Magic/WulfrumStaff.png and b/Items/Weapons/Magic/WulfrumStaff.png differ diff --git a/Items/Weapons/Melee/BallOFugu.png b/Items/Weapons/Melee/BallOFugu.png index 8325b126c6..b3a2e690c6 100644 Binary files a/Items/Weapons/Melee/BallOFugu.png and b/Items/Weapons/Melee/BallOFugu.png differ diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 161eb295ad..7f1a6bcc4b 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 50; + item.width = item.height = 54; item.damage = 64; item.melee = true; item.useAnimation = 25; @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 6f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 50; item.value = Item.buyPrice(0, 60, 0, 0); item.rare = 7; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Brimlash.png b/Items/Weapons/Melee/Brimlash.png index f3544237e5..d05b7ca683 100644 Binary files a/Items/Weapons/Melee/Brimlash.png and b/Items/Weapons/Melee/Brimlash.png differ diff --git a/Items/Weapons/Melee/BrimlashBuster.cs b/Items/Weapons/Melee/BrimlashBuster.cs index f576976d36..9f9b0afda6 100644 --- a/Items/Weapons/Melee/BrimlashBuster.cs +++ b/Items/Weapons/Melee/BrimlashBuster.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 68; + item.width = item.height = 72; item.damage = 100; item.melee = true; item.useAnimation = 25; @@ -30,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 8; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 68; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/BrimlashBuster.png b/Items/Weapons/Melee/BrimlashBuster.png index 946e98b5da..c2440eeb9f 100644 Binary files a/Items/Weapons/Melee/BrimlashBuster.png and b/Items/Weapons/Melee/BrimlashBuster.png differ diff --git a/Items/Weapons/Melee/CrimsonCrusherBlade.cs b/Items/Weapons/Melee/CrimsonCrusherBlade.cs index 1363d4647c..ac8381d7db 100644 --- a/Items/Weapons/Melee/CrimsonCrusherBlade.cs +++ b/Items/Weapons/Melee/CrimsonCrusherBlade.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Melee target.AddBuff(BuffID.Ichor, 120); if (target.damage > 0 && crit && !CalamityPlayer.areThereAnyDamnBosses) { - target.damage = target.defDamage - 10; + target.damage = target.defDamage - 5; if (target.damage < 1) target.damage = 1; } diff --git a/Items/Weapons/Melee/EmpyreanKnives.cs b/Items/Weapons/Melee/EmpyreanKnives.cs index d2b4690363..5e65ceb85b 100644 --- a/Items/Weapons/Melee/EmpyreanKnives.cs +++ b/Items/Weapons/Melee/EmpyreanKnives.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -105,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Melee recipe.AddIngredient(ItemID.VampireKnives); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 999); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index d2b8c3c049..05d1284942 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 95; item.melee = true; - item.width = 60; - item.height = 60; + item.width = 62; + item.height = 62; item.useTime = 24; item.useAnimation = 24; item.useTurn = true; diff --git a/Items/Weapons/Melee/Greentide.png b/Items/Weapons/Melee/Greentide.png index a3af9daf60..9ec5b48535 100644 Binary files a/Items/Weapons/Melee/Greentide.png and b/Items/Weapons/Melee/Greentide.png differ diff --git a/Items/Weapons/Melee/KelvinCatalystMelee.png b/Items/Weapons/Melee/KelvinCatalystMelee.png index 1d6c440160..86a074d801 100644 Binary files a/Items/Weapons/Melee/KelvinCatalystMelee.png and b/Items/Weapons/Melee/KelvinCatalystMelee.png differ diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index a999aa626d..a2bd797c9e 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 26; item.damage = 120; item.melee = true; - item.useAnimation = 6; + item.useAnimation = 8; item.useStyle = ItemUseStyleID.SwingThrow; - item.useTime = 6; + item.useTime = 8; item.useTurn = true; item.knockBack = 7f; item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/ProfanedSword.cs b/Items/Weapons/Melee/ProfanedSword.cs index 6ed2429af9..aceefd4f42 100644 --- a/Items/Weapons/Melee/ProfanedSword.cs +++ b/Items/Weapons/Melee/ProfanedSword.cs @@ -22,8 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee { item.damage = 75; item.melee = true; - item.width = 42; - item.height = 50; + item.width = item.height = 52; item.useTime = 23; item.useAnimation = 23; item.useTurn = true; diff --git a/Items/Weapons/Melee/ProfanedSword.png b/Items/Weapons/Melee/ProfanedSword.png index 41758d95bf..36dfb30fbe 100644 Binary files a/Items/Weapons/Melee/ProfanedSword.png and b/Items/Weapons/Melee/ProfanedSword.png differ diff --git a/Items/Weapons/Melee/Terratomere.cs b/Items/Weapons/Melee/Terratomere.cs index 8f60a38641..78b2011564 100644 --- a/Items/Weapons/Melee/Terratomere.cs +++ b/Items/Weapons/Melee/Terratomere.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = speedX + (float)Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.5), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * 0.5), knockBack, player.whoAmI, 0f, 0f); } return false; } @@ -52,7 +52,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); @@ -62,7 +61,6 @@ namespace CalamityMod.Items.Weapons.Melee recipe.SetResult(this); recipe.AddRecipe(); recipe = new ModRecipe(mod); - recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); recipe.AddIngredient(ModContent.ItemType()); diff --git a/Items/Weapons/Melee/WulfrumBlade.cs b/Items/Weapons/Melee/WulfrumBlade.cs index 7dbf7198ae..34b3bbbbb0 100644 --- a/Items/Weapons/Melee/WulfrumBlade.cs +++ b/Items/Weapons/Melee/WulfrumBlade.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,7 +15,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - item.width = 46; + item.width = 32; + item.height = 46; item.damage = 12; item.melee = true; item.useAnimation = 20; @@ -24,11 +26,15 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 3.75f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 54; item.value = Item.buyPrice(0, 1, 0, 0); item.rare = 1; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + hitbox = CalamityUtils.FixSwingHitbox(39, 39); + } + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/Weapons/Melee/WulfrumBlade.png b/Items/Weapons/Melee/WulfrumBlade.png index d607dcf424..121c4cfe6e 100644 Binary files a/Items/Weapons/Melee/WulfrumBlade.png and b/Items/Weapons/Melee/WulfrumBlade.png differ diff --git a/Items/Weapons/Melee/XerocsGreatsword.cs b/Items/Weapons/Melee/XerocsGreatsword.cs index 07a2e2b818..364fa0609a 100644 --- a/Items/Weapons/Melee/XerocsGreatsword.cs +++ b/Items/Weapons/Melee/XerocsGreatsword.cs @@ -11,13 +11,14 @@ namespace CalamityMod.Items.Weapons.Melee { public override void SetStaticDefaults() { - DisplayName.SetDefault("Xeroc Greatsword"); + DisplayName.SetDefault("Entropic Claymore"); Tooltip.SetDefault("Fires a spread of homing plasma balls"); } public override void SetDefaults() { - item.width = 66; + item.width = 130; + item.height = 106; item.damage = 90; item.melee = true; item.useAnimation = 26; @@ -27,13 +28,17 @@ namespace CalamityMod.Items.Weapons.Melee item.knockBack = 5.25f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 66; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; - item.shoot = ModContent.ProjectileType(); + item.shoot = ModContent.ProjectileType(); item.shootSpeed = 12f; } + public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) + { + hitbox = CalamityUtils.FixSwingHitbox(118, 118); + } + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int num6 = Main.rand.Next(4, 6); @@ -41,7 +46,24 @@ namespace CalamityMod.Items.Weapons.Melee { float SpeedX = speedX + (float)Main.rand.Next(-20, 21) * 0.05f; float SpeedY = speedY + (float)Main.rand.Next(-20, 21) * 0.05f; - Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); + float damageMult = 0.5f; + switch (index) + { + case 0: + type = ModContent.ProjectileType(); + break; + case 1: + type = ModContent.ProjectileType(); + damageMult = 0.65f; + break; + case 2: + type = ModContent.ProjectileType(); + damageMult = 0.8f; + break; + default: + break; + } + Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)(damage * damageMult), knockBack, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Melee/XerocsGreatsword.png b/Items/Weapons/Melee/XerocsGreatsword.png index 48fe75ebe6..ce89466c6c 100644 Binary files a/Items/Weapons/Melee/XerocsGreatsword.png and b/Items/Weapons/Melee/XerocsGreatsword.png differ diff --git a/Items/Weapons/Ranged/Archerfish.png b/Items/Weapons/Ranged/Archerfish.png index ad368e2088..55448257d1 100644 Binary files a/Items/Weapons/Ranged/Archerfish.png and b/Items/Weapons/Ranged/Archerfish.png differ diff --git a/Items/Weapons/Ranged/BrimstoneFury.png b/Items/Weapons/Ranged/BrimstoneFury.png index 058b9539c3..fff257b092 100644 Binary files a/Items/Weapons/Ranged/BrimstoneFury.png and b/Items/Weapons/Ranged/BrimstoneFury.png differ diff --git a/Items/Weapons/Ranged/Leviatitan.png b/Items/Weapons/Ranged/Leviatitan.png index 89fe64b156..4b56fc017d 100644 Binary files a/Items/Weapons/Ranged/Leviatitan.png and b/Items/Weapons/Ranged/Leviatitan.png differ diff --git a/Items/Weapons/Ranged/TheEmpyrean.cs b/Items/Weapons/Ranged/TheEmpyrean.cs index 0df599984b..e0221afb11 100644 --- a/Items/Weapons/Ranged/TheEmpyrean.cs +++ b/Items/Weapons/Ranged/TheEmpyrean.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public override void SetStaticDefaults() { - DisplayName.SetDefault("The Empyrean"); + DisplayName.SetDefault("God's Bellows"); Tooltip.SetDefault("70% chance to not consume gel"); } diff --git a/Items/Weapons/Ranged/TheEmpyrean.png b/Items/Weapons/Ranged/TheEmpyrean.png index 78910571a1..87df93208a 100644 Binary files a/Items/Weapons/Ranged/TheEmpyrean.png and b/Items/Weapons/Ranged/TheEmpyrean.png differ diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs new file mode 100644 index 0000000000..f51f49efef --- /dev/null +++ b/Items/Weapons/Ranged/Ultima.cs @@ -0,0 +1,70 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class Ultima : ModItem + { + public const float FullChargeTime = 420f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima"); + Tooltip.SetDefault("Casts a continuous stream of plasma bolts\n" + + "Over time the bolts are replaced with powerful lasers\n" + + "Bolts power up into solid beams as you continue shooting\n" + + "90% chance to not consume ammo"); + } + + public override void SetDefaults() + { + item.damage = 210; + item.ranged = true; + item.width = 44; + item.height = 58; + item.useTime = item.useAnimation = 3; + item.useStyle = ItemUseStyleID.HoldingOut; + item.noMelee = true; + item.knockBack = 2f; + item.value = CalamityGlobalItem.RarityVioletBuyPrice; + item.rare = 10; + item.UseSound = SoundID.Item33; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 18f; + item.useAmmo = AmmoID.Arrow; + item.channel = true; + item.useTurn = false; + item.autoReuse = true; + item.noUseGraphic = true; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position, new Vector2(speedX, speedY).SafeNormalize(Vector2.UnitX * player.direction), ModContent.ProjectileType(), 0, 0f, player.whoAmI); + return false; + } + + public override bool ConsumeAmmo(Player player) => Main.rand.Next(0, 100) >= 90; + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PulseBow); + recipe.AddIngredient(ItemID.LaserRifle); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddIngredient(ModContent.ItemType(), 15); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Ranged/Ultima.png b/Items/Weapons/Ranged/Ultima.png new file mode 100644 index 0000000000..bf77665303 Binary files /dev/null and b/Items/Weapons/Ranged/Ultima.png differ diff --git a/Items/Weapons/Ranged/WulfrumBow.cs b/Items/Weapons/Ranged/WulfrumBow.cs index 6462f3e949..0e94240971 100644 --- a/Items/Weapons/Ranged/WulfrumBow.cs +++ b/Items/Weapons/Ranged/WulfrumBow.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Weapons.Ranged { item.damage = 10; item.ranged = true; - item.width = 34; - item.height = 56; + item.width = 27; + item.height = 38; item.useTime = 25; item.useAnimation = 25; item.useStyle = ItemUseStyleID.HoldingOut; diff --git a/Items/Weapons/Ranged/WulfrumBow.png b/Items/Weapons/Ranged/WulfrumBow.png index 3cf54d70b3..ad309cc5e0 100644 Binary files a/Items/Weapons/Ranged/WulfrumBow.png and b/Items/Weapons/Ranged/WulfrumBow.png differ diff --git a/Items/Weapons/Rogue/BrackishFlask.png b/Items/Weapons/Rogue/BrackishFlask.png index c0101e465c..0e5ad78a57 100644 Binary files a/Items/Weapons/Rogue/BrackishFlask.png and b/Items/Weapons/Rogue/BrackishFlask.png differ diff --git a/Items/Weapons/Rogue/Brimblade.png b/Items/Weapons/Rogue/Brimblade.png index d7de00d24b..0d93160ef8 100644 Binary files a/Items/Weapons/Rogue/Brimblade.png and b/Items/Weapons/Rogue/Brimblade.png differ diff --git a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs index 9a3ad6e804..518361349f 100644 --- a/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs +++ b/Items/Weapons/Rogue/EmpyreanKnivesThrown.cs @@ -1,5 +1,4 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Hybrid; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -106,7 +105,7 @@ namespace CalamityMod.Items.Weapons.Rogue recipe.AddIngredient(ItemID.VampireKnives); recipe.AddIngredient(ModContent.ItemType(), 10); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 999); recipe.AddTile(ModContent.TileType()); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/KelvinCatalyst.png b/Items/Weapons/Rogue/KelvinCatalyst.png index 1d6c440160..86a074d801 100644 Binary files a/Items/Weapons/Rogue/KelvinCatalyst.png and b/Items/Weapons/Rogue/KelvinCatalyst.png differ diff --git a/Items/Weapons/Rogue/Lionfish.png b/Items/Weapons/Rogue/Lionfish.png index 56025eca70..e97c12862e 100644 Binary files a/Items/Weapons/Rogue/Lionfish.png and b/Items/Weapons/Rogue/Lionfish.png differ diff --git a/Items/Weapons/Rogue/RogueWeapon.cs b/Items/Weapons/Rogue/RogueWeapon.cs index 13f3d07d1d..2b3318cd0d 100644 --- a/Items/Weapons/Rogue/RogueWeapon.cs +++ b/Items/Weapons/Rogue/RogueWeapon.cs @@ -92,6 +92,8 @@ namespace CalamityMod.Items.Weapons.Rogue rogueAS -= 0.2f; if (player.Calamity().gloveOfRecklessness) rogueAS += 0.2f; + if (player.Calamity().titanHeartMantle) + rogueAS -= 0.2f; return rogueAS; } @@ -135,6 +137,11 @@ namespace CalamityMod.Items.Weapons.Rogue if (Main.rand.Next(1, 101) > 50) return false; } + if (player.Calamity().throwingAmmoCost55) + { + if (Main.rand.Next(1, 101) > 55) + return false; + } if (player.Calamity().throwingAmmoCost66) { if (Main.rand.Next(1, 101) > 66) diff --git a/Items/Weapons/Rogue/StarofDestruction.cs b/Items/Weapons/Rogue/StarofDestruction.cs index 98ac50f628..7187589b87 100644 --- a/Items/Weapons/Rogue/StarofDestruction.cs +++ b/Items/Weapons/Rogue/StarofDestruction.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SafeSetDefaults() { - item.width = 86; + item.width = item.height = 94; item.damage = 175; item.noMelee = true; item.noUseGraphic = true; @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Rogue item.knockBack = 10f; item.UseSound = SoundID.Item1; item.autoReuse = true; - item.height = 86; item.value = Item.buyPrice(0, 95, 0, 0); item.rare = 9; item.shoot = ModContent.ProjectileType(); @@ -52,7 +51,6 @@ namespace CalamityMod.Items.Weapons.Rogue { ModRecipe recipe = new ModRecipe(mod); recipe.AddIngredient(ModContent.ItemType(), 10); - recipe.AddIngredient(ModContent.ItemType(), 30); recipe.AddTile(TileID.LunarCraftingStation); recipe.SetResult(this); recipe.AddRecipe(); diff --git a/Items/Weapons/Rogue/StarofDestruction.png b/Items/Weapons/Rogue/StarofDestruction.png index 732056dac4..46c3428789 100644 Binary files a/Items/Weapons/Rogue/StarofDestruction.png and b/Items/Weapons/Rogue/StarofDestruction.png differ diff --git a/Items/Weapons/Rogue/WulfrumKnife.png b/Items/Weapons/Rogue/WulfrumKnife.png index aab1bf448c..94ca6dcea6 100644 Binary files a/Items/Weapons/Rogue/WulfrumKnife.png and b/Items/Weapons/Rogue/WulfrumKnife.png differ diff --git a/Items/Weapons/Rogue/XerocPitchfork.png b/Items/Weapons/Rogue/XerocPitchfork.png index 6b1f401a25..37d3d40f62 100644 Binary files a/Items/Weapons/Rogue/XerocPitchfork.png and b/Items/Weapons/Rogue/XerocPitchfork.png differ diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 82985b8340..70bc426e7c 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -19,8 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon { item.damage = 20; item.mana = 10; - item.width = 46; - item.height = 46; + item.width = item.height = 48; item.useTime = item.useAnimation = 30; item.useStyle = ItemUseStyleID.SwingThrow; item.noMelee = true; diff --git a/Items/Weapons/Summon/HerringStaff.png b/Items/Weapons/Summon/HerringStaff.png index 00bcdf2e28..4668f74cf8 100644 Binary files a/Items/Weapons/Summon/HerringStaff.png and b/Items/Weapons/Summon/HerringStaff.png differ diff --git a/Items/Weapons/Summon/WulfrumController.png b/Items/Weapons/Summon/WulfrumController.png index c419f9b6ac..7222b843e5 100644 Binary files a/Items/Weapons/Summon/WulfrumController.png and b/Items/Weapons/Summon/WulfrumController.png differ diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs new file mode 100644 index 0000000000..fabdacfe67 --- /dev/null +++ b/Items/Weapons/Typeless/YanmeisKnife.cs @@ -0,0 +1,67 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Typeless +{ + public class YanmeisKnife : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yanmei's Knife"); + Tooltip.SetDefault("When hitting a boss or its minions, you gain various boosts and cripple the enemy hit\n" + + "A knife from an unknown world\n" + + "An owner who's heart is pure and free of taint\n" + + "A heart of iron and valor"); + } + + public override void SetDefaults() + { + item.height = 44; + item.width = 48; + item.damage = 8; + item.crit += 6; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = item.useTime = 32; + item.useStyle = ItemUseStyleID.HoldingOut; + item.knockBack = 4.5f; + item.autoReuse = false; + item.value = CalamityGlobalItem.Rarity8BuyPrice; + item.UseSound = SoundID.Item71; + item.rare = 8; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 24f; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override bool CanUseItem(Player player) + { + if (player.Calamity().KameiBladeUseDelay > 0) + return false; + return base.CanUseItem(player); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + player.Calamity().KameiBladeUseDelay = 180; + Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PsychoKnife); + recipe.AddIngredient(ItemID.Obsidian, 10); + recipe.AddIngredient(ItemID.IronBar, 20); + recipe.AddIngredient(ModContent.ItemType(), 50); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Weapons/Typeless/YanmeisKnife.png b/Items/Weapons/Typeless/YanmeisKnife.png new file mode 100644 index 0000000000..36c6bc6c06 Binary files /dev/null and b/Items/Weapons/Typeless/YanmeisKnife.png differ diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 82b3dddb13..57478d54b2 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -39,11 +40,14 @@ namespace CalamityMod.NPCs.AquaticScourge npc.dontCountMe = true; npc.chaseable = false; npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 36599322df..7c757d090d 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -39,11 +40,14 @@ namespace CalamityMod.NPCs.AquaticScourge npc.dontCountMe = true; npc.chaseable = false; npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index e50a123e29..61f704b9e1 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.AquaticScourge { npc.npcSlots = 16f; npc.damage = 80; - npc.width = 100; + npc.width = 90; npc.height = 90; npc.defense = 10; npc.DR_NERD(0.1f); @@ -57,10 +57,13 @@ namespace CalamityMod.NPCs.AquaticScourge npc.DeathSound = SoundID.NPCDeath1; npc.netAlways = true; bossBag = ModContent.ItemType(); - if (Main.expertMode) - { - npc.scale = 1.15f; - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; } public override void SendExtraAI(BinaryWriter writer) diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 05b29875a0..e7e675c560 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,3 +1,4 @@ +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -15,8 +16,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { npc.damage = 45; - npc.width = 30; - npc.height = 50; + npc.width = 32; + npc.height = 32; npc.defense = 25; npc.DR_NERD(0.15f); npc.aiStyle = -1; @@ -39,11 +40,14 @@ namespace CalamityMod.NPCs.AquaticScourge npc.dontCountMe = true; npc.chaseable = false; npc.canGhostHeal = false; - if (Main.expertMode) - { - npc.scale = 1.15f; - } - } + + if (CalamityWorld.death || CalamityWorld.bossRushActive) + npc.scale = 1.2f; + else if (CalamityWorld.revenge) + npc.scale = 1.15f; + else if (Main.expertMode) + npc.scale = 1.1f; + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.png b/NPCs/AquaticScourge/AquaticScourgeTail.png index 93fe7cd462..c6f723a2a0 100644 Binary files a/NPCs/AquaticScourge/AquaticScourgeTail.png and b/NPCs/AquaticScourge/AquaticScourgeTail.png differ diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index e27be4a2be..7411eedc31 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index a2abc3311a..f3e28b000e 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -293,7 +293,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 1dd8067b76..823eeb5d01 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 81fa114674..caf087f35e 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -148,7 +148,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 3ce951f053..67f601ec44 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -610,7 +610,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } @@ -635,8 +635,10 @@ namespace CalamityMod.NPCs.Astral int minStardust = Main.expertMode ? 7 : 6; int maxStardust = Main.expertMode ? 9 : 8; DropHelper.DropItem(npc, ModContent.ItemType(), minStardust, maxStardust); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); + DropHelper.DropItem(npc, ModContent.ItemType()); + //not guarantee to prevent inventory spam + DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedAstrageldon, 7, 1, 1); } } } diff --git a/NPCs/Astral/BigSightseer.cs b/NPCs/Astral/BigSightseer.cs index 5c6552fa6c..918c76f0b6 100644 --- a/NPCs/Astral/BigSightseer.cs +++ b/NPCs/Astral/BigSightseer.cs @@ -147,8 +147,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/EnchantedNightcrawler.cs b/NPCs/Astral/EnchantedNightcrawler.cs index 944a68c4a8..99cb60152e 100644 --- a/NPCs/Astral/EnchantedNightcrawler.cs +++ b/NPCs/Astral/EnchantedNightcrawler.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index 1e7216d85b..0e724cb04e 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -109,7 +109,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 2cc7eb6e38..7e5b6ccbb6 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Hive.cs b/NPCs/Astral/Hive.cs index c5566554ff..23fe7877e6 100644 --- a/NPCs/Astral/Hive.cs +++ b/NPCs/Astral/Hive.cs @@ -121,13 +121,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - //only 1 hive possible. - bool anyHives = NPC.CountNPCS(npc.type) > 0; - if (anyHives) - return 0f; - - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player) || NPC.AnyNPCs(npc.type)) { return 0f; } diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 6a54edbd3c..8f9f7da46d 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -64,39 +64,31 @@ namespace CalamityMod.NPCs.Astral { npc.velocity.X -= acceleration; if (npc.velocity.X > 0) - { npc.velocity.X -= acceleration; - } if (npc.velocity.X < -maxSpeed) - { npc.velocity.X = -maxSpeed; - } } else { npc.velocity.X += acceleration; if (npc.velocity.X < 0) - { npc.velocity.X += acceleration; - } if (npc.velocity.X > maxSpeed) - { npc.velocity.X = maxSpeed; - } } //if need to jump if (npc.velocity.Y == 0f && (HoleBelow() || (npc.collideX && npc.position.X == npc.oldPosition.X))) { - npc.velocity.Y = (CalamityWorld.death ? -7f : -5f); + npc.velocity.Y = CalamityWorld.death ? -7f : -5f; } //check if we can shoot at target. Vector2 vector = npc.Center - target.Center; - if (Math.Abs(vector.Y) < 64f && Math.Abs(vector.X) < 540f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) + if (vector.Length() < 480f && Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - npc.ai[1]++; - if (npc.ai[1] > (CalamityWorld.death ? 60f : 120f)) + npc.ai[1] += 1f; + if (npc.ai[1] >= (CalamityWorld.death ? 60f : 120f)) { //fire projectile npc.ai[0] = 1f; @@ -106,24 +98,19 @@ namespace CalamityMod.NPCs.Astral } } else - { npc.ai[1] -= 0.5f; - } if (npc.justHit) - { npc.ai[1] -= 60f; - } - if (npc.ai[1] < 0f) npc.ai[1] = 0f; } else { - npc.ai[2]++; + npc.ai[2] += 1f; npc.velocity.X *= 0.95f; - if (npc.ai[2] == 25f) + if (npc.ai[2] >= 20f) { Main.PlaySound(SoundID.Item71, npc.position); Vector2 vector = Main.player[npc.target].Center - npc.Center; @@ -230,7 +217,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 2cd1f5bd17..04ab9247a6 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -262,7 +262,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/SmallSightseer.cs b/NPCs/Astral/SmallSightseer.cs index b16d5068ce..e8f6cfc624 100644 --- a/NPCs/Astral/SmallSightseer.cs +++ b/NPCs/Astral/SmallSightseer.cs @@ -114,8 +114,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Main.tile[spawnInfo.spawnTileX, spawnInfo.spawnTileY]; - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index f0ec674ee5..69e8bc6c7a 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -102,7 +102,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Astral/Twinkler.cs b/NPCs/Astral/Twinkler.cs index 5ab6f2a60c..1cc77dad77 100644 --- a/NPCs/Astral/Twinkler.cs +++ b/NPCs/Astral/Twinkler.cs @@ -56,7 +56,7 @@ namespace CalamityMod.NPCs.Astral public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.player.PillarZone()) + if (CalamityGlobalNPC.AnyEvents(spawnInfo.player)) { return 0f; } diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index d12cc4334e..bcdc08d81c 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -13,7 +13,7 @@ namespace CalamityMod.NPCs.Calamitas public override void SetStaticDefaults() { DisplayName.SetDefault("Life Seeker"); - Main.npcFrameCount[npc.type] = 2; + Main.npcFrameCount[npc.type] = 6; NPCID.Sets.TrailingMode[npc.type] = 1; } @@ -31,7 +31,6 @@ namespace CalamityMod.NPCs.Calamitas npc.aiStyle = 5; aiType = NPCID.Probe; npc.knockBackResist = CalamityWorld.bossRushActive ? 0f : 0.25f; - animationType = NPCID.DemonEye; npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; @@ -40,14 +39,22 @@ namespace CalamityMod.NPCs.Calamitas npc.buffImmune[BuffID.OnFire] = true; } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { SpriteEffects spriteEffects = SpriteEffects.None; if (npc.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); + Texture2D texture = Main.npcTexture[npc.type]; + Vector2 vector11 = new Vector2((float)(texture.Width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -61,18 +68,18 @@ namespace CalamityMod.NPCs.Calamitas color38 = npc.GetAlpha(color38); color38 *= (float)(num153 - num155) / 15f; Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector41 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector43 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); - texture2D15 = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/LifeSeekerGlow"); + texture = ModContent.GetTexture("CalamityMod/NPCs/Calamitas/LifeSeekerGlow"); Color color37 = Color.Lerp(Color.White, Color.Red, 0.5f); if (CalamityConfig.Instance.Afterimages) @@ -83,13 +90,13 @@ namespace CalamityMod.NPCs.Calamitas color41 = Color.Lerp(color41, color36, amount9); color41 *= (float)(num153 - num163) / 15f; Vector2 vector44 = npc.oldPos[num163] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector44 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; + vector44 -= new Vector2((float)texture.Width, (float)(texture.Height / Main.npcFrameCount[npc.type])) * npc.scale / 2f; vector44 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); - spriteBatch.Draw(texture2D15, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector44, npc.frame, color41, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D15, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); + spriteBatch.Draw(texture, vector43, npc.frame, color37, npc.rotation, vector11, npc.scale, spriteEffects, 0f); return false; } diff --git a/NPCs/Calamitas/LifeSeeker.png b/NPCs/Calamitas/LifeSeeker.png index ced67f60ae..5dea135f9f 100644 Binary files a/NPCs/Calamitas/LifeSeeker.png and b/NPCs/Calamitas/LifeSeeker.png differ diff --git a/NPCs/Calamitas/LifeSeekerGlow.png b/NPCs/Calamitas/LifeSeekerGlow.png index 36dee76491..d15b05bd68 100644 Binary files a/NPCs/Calamitas/LifeSeekerGlow.png and b/NPCs/Calamitas/LifeSeekerGlow.png differ diff --git a/NPCs/CalamityAI.cs b/NPCs/CalamityAI.cs index e231efd7a1..aad823eb9e 100644 --- a/NPCs/CalamityAI.cs +++ b/NPCs/CalamityAI.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Dusts; using CalamityMod.Events; @@ -125,7 +126,7 @@ namespace CalamityMod.NPCs } } else - npc.localAI[1] = (npc.Center.X - player.Center.X < 0 ? 1f : -1f); + npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; } if (Main.netMode != NetmodeID.MultiplayerClient) @@ -135,7 +136,7 @@ namespace CalamityMod.NPCs // Spawn segments if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) { - int maxLength = death ? 41 : 31; + int maxLength = death ? 50 : revenge ? 40 : expertMode ? 35 : 30; int Previous = npc.whoAmI; for (int num36 = 0; num36 < maxLength; num36++) { @@ -143,9 +144,9 @@ namespace CalamityMod.NPCs if (num36 >= 0 && num36 < maxLength - 1) { if (num36 % 2 == 0) - lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); - else lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); + else + lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); } else lol = NPC.NewNPC((int)npc.position.X + (npc.width / 2), (int)npc.position.Y + (npc.height / 2), ModContent.NPCType(), npc.whoAmI); @@ -211,13 +212,13 @@ namespace CalamityMod.NPCs { Vector2 vector15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); vector15.Normalize(); - vector15 *= Main.rand.Next(50, 401); + vector15 *= Main.rand.Next(50, 401) * 0.01f; if (expertMode) - vector15 *= death ? 0.05f : 0.05f * (1f - lifeRatio); + vector15 *= 1f + (death ? 0.25f : 0.25f * (1f - lifeRatio)); if (CalamityWorld.bossRushActive) - vector15 *= 1.1f; + vector15 *= 1.25f; Projectile.NewProjectile(npc.Center, vector15, ModContent.ProjectileType(), damageBoom, 0f, Main.myPlayer, 0f, Main.rand.Next(-45, 1)); } @@ -2806,6 +2807,16 @@ namespace CalamityMod.NPCs Player player = Main.player[npc.target]; + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (Main.netMode != NetmodeID.Server) + { + if (!Main.player[Main.myPlayer].dead && Main.player[Main.myPlayer].active && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < 5600f) + Main.player[Main.myPlayer].AddBuff(ModContent.BuffType(), 2); + } + } + // Life float lifeRatio = npc.life / (float)npc.lifeMax; @@ -2872,7 +2883,11 @@ namespace CalamityMod.NPCs { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)npc2); netMessage.Write(Main.npc[npc2].Calamity().newAI[0]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[1]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[2]); + netMessage.Write(Main.npc[npc2].Calamity().newAI[3]); netMessage.Send(); } @@ -2886,7 +2901,10 @@ namespace CalamityMod.NPCs { var netMessage = mod.GetPacket(); netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)npc3); netMessage.Write(Main.npc[npc3].Calamity().newAI[0]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[1]); + netMessage.Write(Main.npc[npc3].Calamity().newAI[2]); netMessage.Write(Main.npc[npc3].Calamity().newAI[3]); netMessage.Send(); } @@ -2993,6 +3011,17 @@ namespace CalamityMod.NPCs Main.npc[lol].realLife = npc.whoAmI; Main.npc[lol].Calamity().newAI[0] = calamityGlobalNPC.newAI[0]; Main.npc[lol].Calamity().newAI[3] = calamityGlobalNPC.newAI[3]; + if (Main.netMode == NetmodeID.Server) + { + var netMessage = mod.GetPacket(); + netMessage.Write((byte)CalamityModMessageType.SyncCalamityNPCAIArray); + netMessage.Write((byte)lol); + netMessage.Write(Main.npc[lol].Calamity().newAI[0]); + netMessage.Write(Main.npc[lol].Calamity().newAI[1]); + netMessage.Write(Main.npc[lol].Calamity().newAI[2]); + netMessage.Write(Main.npc[lol].Calamity().newAI[3]); + netMessage.Send(); + } Main.npc[lol].ai[2] = npc.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; @@ -3498,7 +3527,7 @@ namespace CalamityMod.NPCs tileEnrageMult += (800 - nearbyActiveTiles) * 0.001f; // Ranges from 1f to 1.8f // Increase projectile fire rate based on number of nearby active tiles - float projectileFireRateMultiplier = MathHelper.Lerp(1f, 2f, 1f - ((tileEnrageMult - 1f) / 0.8f)); + float projectileFireRateMultiplier = MathHelper.Lerp(1f, 4f, 1f - ((tileEnrageMult - 1f) / 0.8f)); // Increase damage of projectiles and contact damage based on number of nearby active tiles int damageIncrease = 0; @@ -3516,7 +3545,7 @@ namespace CalamityMod.NPCs num474 *= 1.25f; npc.ai[0] += 1f; - if (npc.ai[0] >= 60f * projectileFireRateMultiplier) + if (npc.ai[0] >= 45f * projectileFireRateMultiplier) { npc.ai[0] = 0f; @@ -3568,7 +3597,7 @@ namespace CalamityMod.NPCs if (calamityGlobalNPC.enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) calamityGlobalNPC.newAI[1] += 2f; - if (calamityGlobalNPC.newAI[1] >= 900f * projectileFireRateMultiplier) + if (calamityGlobalNPC.newAI[1] >= 600f * projectileFireRateMultiplier) { calamityGlobalNPC.newAI[1] = 0f; int damage = (expertMode ? CalamityUtils.GetMasterModeProjectileDamage(50, 1.5) : 60) + damageIncrease; @@ -3585,7 +3614,7 @@ namespace CalamityMod.NPCs int num946 = ModContent.ProjectileType(); vector104.X += num942 * 5f; vector104.Y += num943 * 5f; - int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, damage, 0f, Main.myPlayer, 0f, 0f); + int num947 = Projectile.NewProjectile(vector104.X, vector104.Y, num942, num943, num946, damage, 0f, Main.myPlayer, tileEnrageMult, 0f); Main.projectile[num947].timeLeft = 300; npc.netUpdate = true; } diff --git a/NPCs/CalamityGlobalAI.cs b/NPCs/CalamityGlobalAI.cs index 84e597c10b..c06a10bbd7 100644 --- a/NPCs/CalamityGlobalAI.cs +++ b/NPCs/CalamityGlobalAI.cs @@ -1389,13 +1389,17 @@ namespace CalamityMod.NPCs float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); // Count segments remaining - float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); // 2f to 65f + float segmentCount = NPC.CountNPCS(NPCID.EaterofWorldsHead) + NPC.CountNPCS(NPCID.EaterofWorldsBody) + NPC.CountNPCS(NPCID.EaterofWorldsTail); // Percent segments remaining, add two to total for head and tail float lifeRatio = segmentCount / (totalSegments + 2); - // Phases - bool phase2 = lifeRatio < 0.9f || death; + // 8 seconds of reistance to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < 480f && CalamityWorld.bossRushActive) + calamityGlobalNPC.newAI[1] += 1f; + + // Phases + bool phase2 = lifeRatio < 0.9f || death; bool phase3 = lifeRatio < 0.75f || death; bool phase4 = lifeRatio < 0.4f || death; bool phase5 = lifeRatio < 0.1f || (death && lifeRatio < 0.33f); @@ -1460,8 +1464,14 @@ namespace CalamityMod.NPCs } } - // Worm variable - npc.realLife = -1; + // Set worm variable for worms + if (CalamityWorld.bossRushActive) + { + if (npc.ai[3] > 0f) + npc.realLife = (int)npc.ai[3]; + } + else + npc.realLife = -1; // Target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead) @@ -1474,94 +1484,150 @@ namespace CalamityMod.NPCs npc.timeLeft = 300; } + if (CalamityWorld.bossRushActive) + { + // Check if other segments are still alive, if not, die + if (npc.type > NPCID.EaterofWorldsHead) + { + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == NPCID.EaterofWorldsHead) + shouldDespawn = false; + } + if (!shouldDespawn) + { + if (npc.ai[1] > 0f) + shouldDespawn = false; + else if (Main.npc[(int)npc.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + } + } + } + // Spawn segments if (Main.netMode != NetmodeID.MultiplayerClient) { - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - // Spawn entire worm - if (npc.type == NPCID.EaterofWorldsHead) - { - // Length - npc.ai[2] = totalSegments; + if (CalamityWorld.bossRushActive) + { + // Spawn segments from head + if (npc.ai[0] == 0f && npc.type == NPCID.EaterofWorldsHead) + { + npc.ai[3] = npc.whoAmI; + npc.realLife = npc.whoAmI; + int index = npc.whoAmI; - // Body spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - { - // Body spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } - else - { - // Tail spawn - npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); - } + for (int j = 0; j <= totalSegments; j++) + { + int type = NPCID.EaterofWorldsBody; + if (j == totalSegments) + type = NPCID.EaterofWorldsTail; - // Worm shit - 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; - } - - // Splitting effect - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); - } - 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 whoAmI = npc.whoAmI; - float num25 = npc.life / (float)npc.lifeMax; - float num26 = npc.ai[0]; - int aiTimer = calamityGlobalNPC.AITimer; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num25); - npc.ai[0] = num26; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI; - calamityGlobalNPC.AITimer = aiTimer; - } - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - int whoAmI2 = npc.whoAmI; - float num27 = npc.life / (float)npc.lifeMax; - float num28 = npc.ai[1]; - int aiTimer = calamityGlobalNPC.AITimer; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)(npc.lifeMax * num27); - npc.ai[1] = num28; - npc.TargetClosest(true); - npc.netUpdate = true; - npc.whoAmI = whoAmI2; - calamityGlobalNPC.AITimer = aiTimer; + int segment = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + Main.npc[segment].ai[3] = npc.whoAmI; + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[1] = index; + Main.npc[index].ai[0] = segment; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment, 0f, 0f, 0f, 0, 0, 0); + index = segment; + } + } } + else + { + if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) + { + // Spawn entire worm + if (npc.type == NPCID.EaterofWorldsHead) + { + // Length + npc.ai[2] = totalSegments; - if (!npc.active && Main.netMode == NetmodeID.Server) - NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + // Body spawn + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) + { + // Body spawn + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + else + { + // Tail spawn + npc.ai[0] = NPC.NewNPC((int)(npc.position.X + (npc.width / 2)), (int)(npc.position.Y + npc.height), npc.type + 1, npc.whoAmI, 0f, 0f, 0f, 0f, 255); + } + + // Worm shit + 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; + } + + // Splitting effect + if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) + { + npc.life = 0; + npc.HitEffect(0, 10.0); + npc.checkDead(); + npc.active = false; + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } + 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 whoAmI = npc.whoAmI; + float num25 = npc.life / (float)npc.lifeMax; + float num26 = npc.ai[0]; + int aiTimer = calamityGlobalNPC.AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * num25); + npc.ai[0] = num26; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI; + calamityGlobalNPC.AITimer = aiTimer; + } + if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) + { + int whoAmI2 = npc.whoAmI; + float num27 = npc.life / (float)npc.lifeMax; + float num28 = npc.ai[1]; + int aiTimer = calamityGlobalNPC.AITimer; + npc.SetDefaultsKeepPlayerInteraction(npc.type); + npc.life = (int)(npc.lifeMax * num27); + npc.ai[1] = num28; + npc.TargetClosest(true); + npc.netUpdate = true; + npc.whoAmI = whoAmI2; + calamityGlobalNPC.AITimer = aiTimer; + } + + if (!npc.active && Main.netMode == NetmodeID.Server) + NetMessage.SendData(MessageID.StrikeNPC, -1, -1, null, npc.whoAmI, -1f, 0f, 0f, 0, 0, 0); + } } // Movement @@ -1748,7 +1814,7 @@ namespace CalamityMod.NPCs bool flag5 = true; for (int num58 = 0; num58 < Main.maxPlayers; num58++) { - if (Main.player[num58].active && !Main.player[num58].dead && Main.player[num58].ZoneCorrupt) + if (Main.player[num58].active && !Main.player[num58].dead && (Main.player[num58].ZoneCorrupt || Main.player[num58].ZoneCrimson)) flag5 = false; } @@ -1866,7 +1932,7 @@ namespace CalamityMod.NPCs public static int GetEaterOfWorldsSegmentsCountRevDeath() { - return CalamityWorld.death ? 80 : 75; + return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 80 : 75; } #endregion @@ -2522,7 +2588,7 @@ namespace CalamityMod.NPCs public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.death ? 30 : 25; + return (CalamityWorld.death || CalamityWorld.bossRushActive) ? 30 : 25; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) @@ -4490,11 +4556,13 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.TheDestroyerBody && Vector2.Distance(player.Center, npc.Center) > 80f && !flyAtTarget) { // Laser rate of fire - int shootTime = 2 + (int)Math.Ceiling(((enraged || configBossRushBoost) ? 5D : 2D) * (1f - lifeRatio)); + int shootTime = 4 + (death ? 2 : (int)Math.Ceiling(2f * (1f - lifeRatio))); if (CalamityWorld.bossRushActive) shootTime += 1; + if (enraged || configBossRushBoost) + shootTime += 2; - calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); + calamityGlobalNPC.newAI[0] += Main.rand.Next(shootTime); int randomCount = death ? Main.rand.Next(1470, 27300) : Main.rand.Next(1330, 24700); if (calamityGlobalNPC.newAI[0] >= randomCount) @@ -4696,7 +4764,7 @@ namespace CalamityMod.NPCs if (flyAtTarget) { - float speedMultiplier = phase5 ? 1.5f : phase4 ? 1.3f : 1.2f; + float speedMultiplier = phase5 ? 2f : phase4 ? 1.7f : 1.5f; speed *= speedMultiplier; } @@ -7146,37 +7214,32 @@ namespace CalamityMod.NPCs if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 64f) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (NPC.CountNPCS(NPCID.Probe) < 3) - NPC.NewNPC((int)npc.Center.X, (int)(npc.Center.Y + 4f), NPCID.Probe); - else - { - Vector2 vector16 = npc.Center; - float num159 = CalamityWorld.bossRushActive ? 6f : 4f; - float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); - float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); - float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); - num162 = num159 / num162; - num160 *= num162; - num161 *= num162; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 vector16 = npc.Center; + float num159 = CalamityWorld.bossRushActive ? 6f : 4f; + float num160 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector16.X + Main.rand.Next(-20, 21); + float num161 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector16.Y + Main.rand.Next(-20, 21); + float num162 = (float)Math.Sqrt(num160 * num160 + num161 * num161); + num162 = num159 / num162; + num160 *= num162; + num161 *= num162; - Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); - value.Normalize(); - value *= num159; - num160 = value.X; - num161 = value.Y; + Vector2 value = new Vector2(num160 * 1f + Main.rand.Next(-50, 51) * 0.01f, num161 * 1f + Main.rand.Next(-50, 51) * 0.01f); + value.Normalize(); + value *= num159; + num160 = value.X; + num161 = value.Y; - int num163 = 28; - if (death) - num163 += 3; - int num164 = ProjectileID.Skull; - vector16 += value * 5f; - int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[num165].timeLeft = 180; - Main.projectile[num165].tileCollide = false; - } - } + int num163 = 28; + if (death) + num163 += 3; + int num164 = ProjectileID.Skull; + vector16 += value * 5f; + int num165 = Projectile.NewProjectile(vector16.X, vector16.Y, num160, num161, num164, num163, 0f, Main.myPlayer, -1f, 0f); + Main.projectile[num165].timeLeft = 180; + Main.projectile[num165].tileCollide = false; + } } // Go to floating phase, or spinning phase if in phase 2 @@ -8783,36 +8846,39 @@ namespace CalamityMod.NPCs npc.localAI[2] = 1f; } - // Spawn spores - float spawnBoost = death ? 4f : 8f * (0.5f - lifeRatio); - npc.localAI[1] += 1f + spawnBoost; - - if (npc.localAI[1] >= 360f) - { - float num757 = CalamityWorld.bossRushActive ? 12f : 8f; - Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); - float num759 = Math.Abs(num758 * 0.2f); - - float num760 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector94.Y + Main.rand.Next(-10, 11); - if (num760 > 0f) - num759 = 0f; - - num760 -= num759; - float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); - num761 = num757 / num761; - num758 *= num761; - num760 *= num761; - - int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); - Main.npc[num762].velocity.X = num758; - Main.npc[num762].velocity.Y = num760; - Main.npc[num762].netUpdate = true; - npc.localAI[1] = 0f; - } - if (Main.netMode != NetmodeID.MultiplayerClient) { + // Spawn spores + if (!phase4) + { + float spawnBoost = death ? 4f : 8f * (0.5f - lifeRatio); + npc.localAI[1] += 1f + spawnBoost; + + if (npc.localAI[1] >= 360f) + { + float num757 = CalamityWorld.bossRushActive ? 12f : 8f; + Vector2 vector94 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); + float num758 = Main.player[npc.target].position.X + Main.player[npc.target].width * 0.5f - vector94.X + Main.rand.Next(-10, 11); + float num759 = Math.Abs(num758 * 0.2f); + + float num760 = Main.player[npc.target].position.Y + Main.player[npc.target].height * 0.5f - vector94.Y + Main.rand.Next(-10, 11); + if (num760 > 0f) + num759 = 0f; + + num760 -= num759; + float num761 = (float)Math.Sqrt(num758 * num758 + num760 * num760); + num761 = num757 / num761; + num758 *= num761; + num760 *= num761; + + int num762 = NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore, 0, 0f, 0f, 0f, 0f, 255); + Main.npc[num762].velocity.X = num758; + Main.npc[num762].velocity.Y = num760; + Main.npc[num762].netUpdate = true; + npc.localAI[1] = 0f; + } + } + // Fire spread of poison seeds if (tentacleCount < 8) { @@ -9113,6 +9179,8 @@ namespace CalamityMod.NPCs public static bool BuffedPlanterasTentacleAI(NPC npc, Mod mod, bool chaos) { + CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); + bool death = CalamityWorld.death || CalamityWorld.bossRushActive; // Despawn if Plantera is gone @@ -9123,8 +9191,21 @@ namespace CalamityMod.NPCs return false; } - // Set Plantera to a variable - int num778 = NPC.plantBoss; + // 3 seconds of resistance and no damage to prevent spawn killing and unfair hits + if (calamityGlobalNPC.newAI[1] < 180f) + { + npc.damage = 0; + npc.defense = npc.defDefense + 999; + calamityGlobalNPC.newAI[1] += 1f; + } + else + { + npc.damage = npc.defDamage; + npc.defense = npc.defDefense; + } + + // Set Plantera to a variable + int num778 = NPC.plantBoss; if (npc.ai[3] > 0f) num778 = (int)npc.ai[3] - 1; @@ -12714,7 +12795,7 @@ namespace CalamityMod.NPCs if (flag86 && WorldGen.SolidTile(point5.X, point5.Y)) flag86 = false; - float num1163 = (float)Main.rand.Next(6, 19); + float num1163 = Main.rand.Next(6, 19); float num1164 = MathHelper.TwoPi / num1163; float num1165 = MathHelper.TwoPi * Main.rand.NextFloat(); float scaleFactor8 = 1f + Main.rand.NextFloat() * 2f; diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 1f812460ae..1bbe449db9 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -90,9 +90,6 @@ namespace CalamityMod.NPCs public Dictionary flatDRReductions = new Dictionary(); public Dictionary multDRReductions = new Dictionary(); - // Iron Heart (currently unimplemented) - // private int ironHeartDamage = 0; - // Max velocity used in contact damage scaling public float maxVelocity = 0f; @@ -146,6 +143,7 @@ namespace CalamityMod.NPCs public int clamDebuff = 0; public int sulphurPoison = 0; public int ladHearts = 0; + public int kamiFlu = 0; public int relicOfResilienceCooldown = 0; public int relicOfResilienceWeakness = 0; @@ -221,9 +219,9 @@ namespace CalamityMod.NPCs { NPCID.GolemFistLeft, 250000 }, { NPCID.GolemFistRight, 250000 }, - { NPCID.EaterofWorldsHead, 2500000 }, // 30 seconds - { NPCID.EaterofWorldsBody, 2500000 }, - { NPCID.EaterofWorldsTail, 2500000 }, + { NPCID.EaterofWorldsHead, 15000000 }, // 30 seconds + { NPCID.EaterofWorldsBody, 15000000 }, + { NPCID.EaterofWorldsTail, 15000000 }, // Tier 2 { NPCID.TheDestroyer, 2500000 }, // 30 seconds + immunity timer at start @@ -688,6 +686,7 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); + ApplyDPSDebuff(kamiFlu, 250, 25, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(sulphurPoison, 180, 36, ref npc.lifeRegen, ref damage); if (npc.velocity.X == 0) ApplyDPSDebuff(electrified, 10, 2, ref npc.lifeRegen, ref damage); @@ -778,11 +777,6 @@ namespace CalamityMod.NPCs } OtherStatChanges(npc); - - if (CalamityWorld.ironHeart) - { - IronHeartChanges(npc); - } } #endregion @@ -801,7 +795,7 @@ namespace CalamityMod.NPCs npc.buffImmune[BuffID.Slow] = true; } - if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) + if (DestroyerIDs.Contains(npc.type) || (EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) { for (int k = 0; k < npc.buffImmune.Length; k++) { @@ -1075,6 +1069,12 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)(npc.lifeMax * 0.6); } + if (npc.type == NPCID.GreenJellyfish && !Main.hardMode) + { + npc.defense = 4; + npc.defDefense = npc.defense; + } + if (Main.bloodMoon && NPC.downedMoonlord && !npc.boss && !npc.friendly && !npc.dontTakeDamage && npc.lifeMax <= 2000 && npc.damage > 0) { npc.lifeMax = (int)(npc.lifeMax * 3.5); @@ -1225,15 +1225,6 @@ namespace CalamityMod.NPCs } #endregion - // TODO -- Change Iron Heart damage in here for Iron Heart mode - #region Iron Heart Changes - private void IronHeartChanges(NPC npc) - { - // Iron Heart damage variable will scale with npc.damage - // ironHeartDamage = 0; - } - #endregion - #region Scale Expert Multiplayer Stats public override void ScaleExpertStats(NPC npc, int numPlayers, float bossLifeScale) { @@ -1417,14 +1408,13 @@ namespace CalamityMod.NPCs public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { // Damage reduction on spawn - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) + bool destroyerResist = DestroyerIDs.Contains(npc.type) && (CalamityWorld.revenge || CalamityWorld.bossRushActive); + bool eaterofWorldsResist = EaterofWorldsIDs.Contains(npc.type) && CalamityWorld.bossRushActive; + if (destroyerResist || eaterofWorldsResist || AstrumDeusIDs.Contains(npc.type)) { - if (DestroyerIDs.Contains(npc.type) || AstrumDeusIDs.Contains(npc.type)) + if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) { - if (newAI[1] < 480f || (newAI[2] > 0f && DestroyerIDs.Contains(npc.type))) - { - damage *= 0.01; - } + damage *= 0.01; } } @@ -1549,6 +1539,8 @@ namespace CalamityMod.NPCs calcDR *= 0.66f; if (wCleave > 0) calcDR *= 0.75f; + if (npc.Calamity().kamiFlu > 0) + calcDR *= KamiDebuff.MultiplicativeDamageReduction; if (npc.onFire2) calcDR *= 0.8f; @@ -3140,6 +3132,8 @@ namespace CalamityMod.NPCs clamDebuff--; if (sulphurPoison > 0) sulphurPoison--; + if (kamiFlu > 0) + kamiFlu--; if (relicOfResilienceCooldown > 0) relicOfResilienceCooldown--; if (relicOfResilienceWeakness > 0) @@ -3151,6 +3145,11 @@ namespace CalamityMod.NPCs if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) return; + if (kamiFlu > 0) + { + npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-KamiDebuff.MaxNPCSpeed), new Vector2(KamiDebuff.MaxNPCSpeed)); + } + if (!CalamityPlayer.areThereAnyDamnBosses) { if (pearlAura > 0) @@ -3521,7 +3520,7 @@ namespace CalamityMod.NPCs if (modPlayer.nucleogenesis) { - if ((projectile.minion || projectile.sentry || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type] || CalamityMod.projectileMinionList.Contains(projectile.type)) && ShouldAffectNPC(npc) && Main.rand.NextBool(15)) + if (projectile.minion || projectile.sentry || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type] || CalamityMod.projectileMinionList.Contains(projectile.type)) { damage = npc.lifeMax * 3; } @@ -4102,10 +4101,19 @@ namespace CalamityMod.NPCs { pool[0] = 0f; } - if (spawnInfo.player.Calamity().underworldLore) + + // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode + if (spawnInfo.player.ZoneRockLayerHeight && spawnInfo.water) { - pool[NPCID.VoodooDemon] = 0f; + if (!Main.hardMode) + pool[NPCID.GreenJellyfish] = SpawnCondition.CaveJellyfish.Chance * 0.5f; + else + pool[NPCID.BlueJellyfish] = SpawnCondition.CaveJellyfish.Chance; } + + if (spawnInfo.player.Calamity().underworldLore) + pool[NPCID.VoodooDemon] = 0f; + if (spawnInfo.player.Calamity().ZoneSulphur && !spawnInfo.player.Calamity().ZoneAbyss && CalamityWorld.rainingAcid) { pool.Clear(); @@ -4521,6 +4529,11 @@ namespace CalamityMod.NPCs return new Color(200, 50, 50, npc.alpha); } + if (npc.Calamity().kamiFlu > 0) + { + return new Color(51, 197, 108, npc.alpha); + } + return null; } @@ -6082,8 +6095,10 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { + if (EaterofWorldsIDs.Contains(target.type) || DestroyerIDs.Contains(target.type)) + return false; + if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && - target.type != NPCID.TheDestroyerBody && target.type != NPCID.TheDestroyerTail && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityMod.enemyImmunityList.Contains(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 741b64d5c7..debfe75091 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -393,24 +393,6 @@ namespace CalamityMod.NPCs CalamityWorld.bossRushStage = 7; CalamityUtils.KillAllHostileProjectiles(); } - else if (npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody || npc.type == NPCID.EaterofWorldsTail) - { - int count = 0; - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && (Main.npc[j].type == NPCID.EaterofWorldsHead || Main.npc[j].type == NPCID.EaterofWorldsBody || Main.npc[j].type == NPCID.EaterofWorldsTail)) - { - count++; - break; - } - } - - if (count < 4) - { - CalamityWorld.bossRushStage = 8; - CalamityUtils.KillAllHostileProjectiles(); - } - } else if (npc.type == ModContent.NPCType()) { CalamityWorld.bossRushStage = 9; @@ -614,7 +596,14 @@ namespace CalamityMod.NPCs CalamityUtils.KillAllHostileProjectiles(); break; - case NPCID.TheDestroyer: + case NPCID.EaterofWorldsHead: + case NPCID.EaterofWorldsBody: + case NPCID.EaterofWorldsTail: + CalamityWorld.bossRushStage = 8; + CalamityUtils.KillAllHostileProjectiles(); + break; + + case NPCID.TheDestroyer: CalamityWorld.bossRushStage = 10; CalamityUtils.KillAllHostileProjectiles(); @@ -802,7 +791,7 @@ namespace CalamityMod.NPCs RareVariants(npc); CommonLoot(npc); TownNPCLoot(npc); - BossLoot(npc); + EventEnemyLoot(npc, Main.pumpkinMoon, Main.snowMoon, Main.eclipse); } #endregion @@ -1694,6 +1683,7 @@ namespace CalamityMod.NPCs case NPCID.SolarDrakomireRider: case NPCID.SolarDrakomire: case NPCID.SolarCrawltipedeHead: + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentSolar, Main.expertMode ? 4 : 5); break; @@ -1702,6 +1692,7 @@ namespace CalamityMod.NPCs case NPCID.VortexHornet: //Alien Hornet case NPCID.VortexHornetQueen: //Alien Queen case NPCID.VortexRifleman: //Storm Diver + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentVortex, Main.expertMode ? 4 : 5); break; @@ -1709,7 +1700,7 @@ namespace CalamityMod.NPCs case NPCID.NebulaSoldier: //Predictor case NPCID.NebulaHeadcrab: //Brain Suckler case NPCID.NebulaBeast: //Evolution Beast - DropHelper.DropItemChance(npc, ModContent.ItemType(), 4, Main.expertMode ? 2 : 1, Main.expertMode ? 3 : 2); + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentNebula, Main.expertMode ? 4 : 5); break; @@ -1718,6 +1709,7 @@ namespace CalamityMod.NPCs case NPCID.StardustJellyfishBig: //Flow Invader case NPCID.StardustCellBig: //Star Cell case NPCID.StardustWormHead: //Milkyway Weaver + DropHelper.DropItemChance(npc, ModContent.ItemType(), Main.expertMode ? 4 : 5); DropHelper.DropItemChance(npc, ItemID.FragmentStardust, Main.expertMode ? 4 : 5); break; @@ -1861,36 +1853,87 @@ namespace CalamityMod.NPCs DropHelper.DropItemCondition(npc, ItemID.GoldenFishingRod, Main.hardMode, 12, 1, 1); } } - #endregion + #endregion - #region Boss Loot - private void BossLoot(NPC npc) - { - // Not really loot code, but NPCLoot is the only death hook - if (npc.boss && !CalamityWorld.downedBossAny) - { - CalamityWorld.downedBossAny = true; - CalamityMod.UpdateServerBoolean(); - } + #region Boss Loot + private void EventEnemyLoot(NPC npc, bool pumpkin, bool frost, bool eclipse) + { + // Not really loot code, but NPCLoot is the only death hook + if (npc.boss && !CalamityWorld.downedBossAny) + { + CalamityWorld.downedBossAny = true; + CalamityMod.UpdateServerBoolean(); + } - // Nightmare Fuel, Endothermic Energy and Darksun Fragments - if (npc.type == NPCID.Pumpking) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDoG, 10, 20); - } - else if (npc.type == NPCID.IceQueen) - { - DropHelper.DropItemCondition(npc, ModContent.ItemType(), CalamityWorld.downedDoG, 20, 40); - } - else if (npc.type == NPCID.Mothron && CalamityWorld.buffedEclipse) - { - DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + // Nightmare Fuel, Endothermic Energy and Darksun Fragments + if (!CalamityWorld.downedDoG) + { + return; + } - // Mark a buffed Mothron as killed (allowing access to Yharon P2) - CalamityWorld.downedBuffedMothron = true; - CalamityMod.UpdateServerBoolean(); - } - } + if (frost) + { + switch (npc.type) + { + case NPCID.Nutcracker: + case NPCID.NutcrackerSpinning: + case NPCID.ElfCopter: + case NPCID.Flocko: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Krampus: + case NPCID.Yeti: + case NPCID.PresentMimic: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); + break; + case NPCID.Everscream: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.SantaNK1: + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); + break; + case NPCID.IceQueen: + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + break; + } + } + else if (pumpkin) + { + switch (npc.type) + { + case NPCID.Splinterling: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2); + break; + case NPCID.Hellhound: + case NPCID.Poltergeist: + DropHelper.DropItemChance(npc, ModContent.ItemType(), 2, 1, 2); + break; + case NPCID.HeadlessHorseman: + DropHelper.DropItem(npc, ModContent.ItemType(), 3, 5); + break; + case NPCID.MourningWood: + DropHelper.DropItem(npc, ModContent.ItemType(), 5, 10); + break; + case NPCID.Pumpking: + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + break; + } + } + + if (!CalamityWorld.buffedEclipse) + { + return; + } + + if (npc.type == NPCID.Mothron) + { + DropHelper.DropItem(npc, ModContent.ItemType(), 10, 20); + + // Mark a buffed Mothron as killed (allowing access to Yharon P2) + CalamityWorld.downedBuffedMothron = true; + CalamityMod.UpdateServerBoolean(); + } + } #endregion } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 831c712dcc..12dd1004d6 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -133,7 +133,7 @@ namespace CalamityMod.NPCs.DevourerofGods spawnDoGCountdown--; if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); for (int i = 0; i < 2; i++) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); @@ -153,7 +153,7 @@ namespace CalamityMod.NPCs.DevourerofGods { spawnDoGCountdown--; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); if (spawnDoGCountdown == 0 && Main.netMode != NetmodeID.MultiplayerClient) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); @@ -751,7 +751,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void NPCLoot() { // Skip the sentinel phase entirely if DoG has already been killed - CalamityWorld.DoGSecondStageCountdown = CalamityWorld.downedDoG ? 600 : 21600; + CalamityWorld.DoGSecondStageCountdown = (CalamityWorld.downedDoG || CalamityWorld.downedSecondSentinels) ? 600 : 21600; if (Main.netMode == NetmodeID.Server) { diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index 5692d8a2c4..441976927f 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -135,10 +135,10 @@ namespace CalamityMod.NPCs.DevourerofGods if (player.dead || CalamityGlobalNPC.DoGHead < 0 || !Main.npc[CalamityGlobalNPC.DoGHead].active) { npc.TargetClosest(false); - npc.velocity.Y = npc.velocity.Y - 3f; + npc.velocity.Y -= 3f; if ((double)npc.position.Y < Main.topWorld + 16f) { - npc.velocity.Y = npc.velocity.Y - 3f; + npc.velocity.Y -= 3f; } if ((double)npc.position.Y < Main.topWorld + 16f) { diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index ca2510c68a..8a07055c26 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -129,9 +129,9 @@ namespace CalamityMod.NPCs.DevourerofGods bool expertMode = Main.expertMode || CalamityWorld.bossRushActive; bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; bool death = CalamityWorld.death || CalamityWorld.bossRushActive; - bool speedBoost = lifeRatio < 0.6 || (death && lifeRatio < 0.9); - bool speedBoost2 = lifeRatio < 0.2; - bool breathFireMore = lifeRatio < 0.15 || death; + bool speedBoost = lifeRatio < 0.75f || (death && lifeRatio < 0.9f); + bool speedBoost2 = lifeRatio < 0.3f; + bool breathFireMore = lifeRatio < 0.15f || death; // Light Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.2f, 0.05f, 0.2f); @@ -234,7 +234,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) { - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerSpawn"), (int)player.position.X, (int)player.position.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); for (int i = 0; i < 3; i++) NPC.SpawnOnPlayer(npc.FindClosestPlayer(), ModContent.NPCType()); @@ -306,9 +306,8 @@ namespace CalamityMod.NPCs.DevourerofGods { calamityGlobalNPC.newAI[1] += 1f; - float speed = 10.5f; - float spawnOffsetX = 1900f; - float spawnOffsetY = 1000f; + float speed = 12f; + float spawnOffset = 1500f; float divisor = 120f; if (calamityGlobalNPC.newAI[1] % divisor == 0f) @@ -320,8 +319,8 @@ namespace CalamityMod.NPCs.DevourerofGods // Side walls for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + spawnOffsetX, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffsetX, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[0], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[0], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[0] -= spacingVar; } @@ -329,8 +328,8 @@ namespace CalamityMod.NPCs.DevourerofGods { for (int x = 0; x < 10; x++) { - Projectile.NewProjectile(player.position.X + spawnOffsetX, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(player.position.X - spawnOffsetX, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + spawnOffset, targetPosY + shotSpacing[3], -speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X - spawnOffset, targetPosY + shotSpacing[3], speed, 0f, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[3] -= Main.rand.NextBool(2) ? 180 : 200; } shotSpacing[3] = 1050; @@ -340,7 +339,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Lower wall for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffsetY, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + shotSpacing[1], player.position.Y + spawnOffset, 0f, -speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[1] -= spacingVar; } shotSpacing[1] = 1050; @@ -348,7 +347,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Upper wall for (int x = 0; x < totalShots; x++) { - Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffsetY, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(player.position.X + shotSpacing[2], player.position.Y - spawnOffset, 0f, speed, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 0f, 0f); shotSpacing[2] -= spacingVar; } shotSpacing[2] = 1050; @@ -886,7 +885,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeMechGaussRifle"), (int)npc.Center.X, (int)npc.Center.Y); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/DevourerAttack"), (int)player.position.X, (int)player.position.Y); int dustAmt = 50; int random = 5; diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 3cd80f7221..50ba7c0d68 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -23,20 +23,21 @@ namespace CalamityMod.NPCs.Leviathan [AutoloadBossHead] public class Leviathan : ModNPC { - private bool altTextureSwap = false; + int counter = 0; + bool initialised = false; public override void SetStaticDefaults() { DisplayName.SetDefault("The Leviathan"); - Main.npcFrameCount[npc.type] = 3; + Main.npcFrameCount[npc.type] = 6; } public override void SetDefaults() { npc.npcSlots = 20f; npc.damage = 90; - npc.width = 850; - npc.height = 450; + npc.width = 650; + npc.height = 300; npc.defense = 40; npc.DR_NERD(0.35f); npc.LifeMaxNERB(69000, 90700, 7000000); @@ -87,14 +88,16 @@ namespace CalamityMod.NPCs.Leviathan public override void SendExtraAI(BinaryWriter writer) { - writer.Write(altTextureSwap); writer.Write(npc.dontTakeDamage); + writer.Write(counter); + writer.Write(initialised); } public override void ReceiveExtraAI(BinaryReader reader) { - altTextureSwap = reader.ReadBoolean(); npc.dontTakeDamage = reader.ReadBoolean(); + counter = reader.ReadInt32(); + initialised = reader.ReadBoolean(); } public override void AI() @@ -120,23 +123,16 @@ namespace CalamityMod.NPCs.Leviathan sirenAlive = Main.npc[CalamityGlobalNPC.siren].active; } - int soundChoice = Main.rand.Next(3); int soundChoiceRage = 92; - if (soundChoice == 0) - { - soundChoice = 38; - } - else if (soundChoice == 1) - { - soundChoice = 39; - } - else - { - soundChoice = 40; - } + int soundChoice = Utils.SelectRandom(Main.rand, new int[] + { + 38, + 39, + 40 + }); if (Main.rand.NextBool(600)) { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, (sirenAlive && !death) ? soundChoice : soundChoiceRage); } if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -334,7 +330,7 @@ namespace CalamityMod.NPCs.Leviathan if (flag103 && (spawnParasea || spawnAberration)) { - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoice); + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, soundChoice); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = spawnAberration ? ModContent.NPCType() : ModContent.NPCType(); @@ -466,7 +462,7 @@ namespace CalamityMod.NPCs.Leviathan npc.velocity.X = num1045 * num1047; npc.velocity.Y = num1046 * num1047; npc.spriteDirection = npc.direction; - Main.PlaySound(29, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); + Main.PlaySound(SoundID.Zombie, (int)npc.position.X, (int)npc.position.Y, soundChoiceRage); return; } @@ -567,7 +563,7 @@ namespace CalamityMod.NPCs.Leviathan npc.position.Y = npc.position.Y - (float)(npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { - int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { @@ -577,16 +573,17 @@ namespace CalamityMod.NPCs.Leviathan } for (int num623 = 0; num623 < 70; num623++) { - int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 3f); + int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; Main.dust[num624].velocity *= 5f; - num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 5, 0f, 0f, 100, default, 2f); + num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[num624].velocity *= 2f; } float randomSpread = (float)(Main.rand.Next(-200, 200) / 100); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib1"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib2"), 1f); - Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/Leviathangib3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore2"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore3"), 1f); + Gore.NewGore(npc.position, npc.velocity * randomSpread, mod.GetGoreSlot("Gores/LeviathanGores/LeviGore4"), 1f); } } @@ -598,6 +595,9 @@ namespace CalamityMod.NPCs.Leviathan // The Leviathan runs the same loot code as Anahita, but only if she dies last. public override void NPCLoot() { + //Trophy dropped regardless of Anahita, precedent of Twins + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + if (!NPC.AnyNPCs(ModContent.NPCType())) DropSirenLeviLoot(npc); } @@ -607,7 +607,6 @@ namespace CalamityMod.NPCs.Leviathan { DropHelper.DropBags(npc); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); DropHelper.DropItemCondition(npc, ModContent.ItemType(), true, !CalamityWorld.downedLeviathan); DropHelper.DropResidentEvilAmmo(npc, CalamityWorld.downedLeviathan, 4, 2, 1); @@ -628,6 +627,7 @@ namespace CalamityMod.NPCs.Leviathan // Vanity DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 7); // Fishing DropHelper.DropItemChance(npc, ItemID.HotlineFishingHook, 10); @@ -656,46 +656,60 @@ namespace CalamityMod.NPCs.Leviathan public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D texture = Main.npcTexture[npc.type]; - Texture2D texture2 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanTexTwo"); - Texture2D texture3 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAltTexOne"); - Texture2D texture4 = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAltTexTwo"); if (npc.ai[0] == 1f) { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture2, 0, npc, drawColor, true); - } + texture = Main.npcTexture[npc.type]; } else { - if (!altTextureSwap) - { - CalamityMod.DrawTexture(spriteBatch, texture3, 0, npc, drawColor, true); - } - else - { - CalamityMod.DrawTexture(spriteBatch, texture4, 0, npc, drawColor, true); - } + texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/LeviathanAttack"); } + int verticalFrameCount = 3; + int horizontalFrameCount = 2; + int height = texture.Height / verticalFrameCount; + int width = texture.Width / horizontalFrameCount; + SpriteEffects spriteEffects = SpriteEffects.FlipHorizontally; + if (npc.spriteDirection == -1) + spriteEffects = SpriteEffects.None; + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f); return false; } public override void FindFrame(int frameHeight) { - npc.frameCounter += 1.0; - if (npc.frameCounter > 6.0) + Texture2D texture = Main.npcTexture[npc.type]; + int verticalFrameCount = 3; + int horizontalFrameCount = 2; + int height = texture.Height / verticalFrameCount; + int width = texture.Width / horizontalFrameCount; + int timeBetweenFrames = 8; + + if (!initialised) { - npc.frame.Y = npc.frame.Y + frameHeight; - npc.frameCounter = 0.0; + counter = verticalFrameCount; + npc.frameCounter = timeBetweenFrames; + initialised = true; } - if (npc.frame.Y >= frameHeight * 3) + + //ensure width and height are set. + npc.frame.Width = width; + npc.frame.Height = height; + npc.frameCounter++; + if (npc.frameCounter >= timeBetweenFrames) { + npc.frame.X = counter >= verticalFrameCount ? width + 3 : 0; + if (counter == verticalFrameCount) + npc.frame.Y = 0; + else + npc.frame.Y += height; + npc.frameCounter = 0; + counter++; + } + if (counter == Main.npcFrameCount[npc.type]) + { + counter = 1; npc.frame.Y = 0; - altTextureSwap = !altTextureSwap; + npc.frame.X = 0; } } diff --git a/NPCs/Leviathan/Leviathan.png b/NPCs/Leviathan/Leviathan.png index 5bd4cf58e8..6bd923b971 100644 Binary files a/NPCs/Leviathan/Leviathan.png and b/NPCs/Leviathan/Leviathan.png differ diff --git a/NPCs/Leviathan/LeviathanAltTexOne.png b/NPCs/Leviathan/LeviathanAltTexOne.png deleted file mode 100644 index 9f98f74ae9..0000000000 Binary files a/NPCs/Leviathan/LeviathanAltTexOne.png and /dev/null differ diff --git a/NPCs/Leviathan/LeviathanAltTexTwo.png b/NPCs/Leviathan/LeviathanAltTexTwo.png deleted file mode 100644 index 1c8019853c..0000000000 Binary files a/NPCs/Leviathan/LeviathanAltTexTwo.png and /dev/null differ diff --git a/NPCs/Leviathan/LeviathanAttack.png b/NPCs/Leviathan/LeviathanAttack.png new file mode 100644 index 0000000000..650e015b7a Binary files /dev/null and b/NPCs/Leviathan/LeviathanAttack.png differ diff --git a/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png b/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png new file mode 100644 index 0000000000..34c3c55b6a Binary files /dev/null and b/NPCs/Leviathan/LeviathanOpenMouth_UNUSED.png differ diff --git a/NPCs/Leviathan/LeviathanTexTwo.png b/NPCs/Leviathan/LeviathanTexTwo.png deleted file mode 100644 index 23779c9d83..0000000000 Binary files a/NPCs/Leviathan/LeviathanTexTwo.png and /dev/null differ diff --git a/NPCs/Leviathan/Leviathan_Head_Boss.png b/NPCs/Leviathan/Leviathan_Head_Boss.png index f8b1338143..640bfa01d0 100644 Binary files a/NPCs/Leviathan/Leviathan_Head_Boss.png and b/NPCs/Leviathan/Leviathan_Head_Boss.png differ diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index a2ef7193da..c6253fab8e 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.TreasureBags; using CalamityMod.Projectiles.Boss; using CalamityMod.World; @@ -19,6 +20,9 @@ namespace CalamityMod.NPCs.Leviathan private bool secondClone = false; private bool forceChargeFrames = false; private int frameUsed = 0; + private static Texture2D sirenStabTexture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenStabbing"); + + //IMPORTANT: Do NOT remove the empty space on the sprites. This is intentional for framing. The sprite is centered and hitbox is fine already. public override void SetStaticDefaults() { @@ -106,7 +110,7 @@ namespace CalamityMod.NPCs.Leviathan CalamityGlobalNPC.siren = npc.whoAmI; // Light - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0f, 0.5f, 0.3f); + Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0f, 0.5f, 0.3f); // Target if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -703,12 +707,12 @@ namespace CalamityMod.NPCs.Leviathan if (num22 != 0) { if (npc.ai[1] == 0f && num22 != npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.direction = num22; if (npc.spriteDirection != -npc.direction) - npc.rotation += 3.14159274f; + npc.rotation += MathHelper.Pi; npc.spriteDirection = -npc.direction; } @@ -717,123 +721,62 @@ namespace CalamityMod.NPCs.Leviathan public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 187, hitDirection, -1f, 0, default, 1f); if (npc.life <= 0) { - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren2"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren3"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren4"), 1f); - Gore.NewGore(npc.position, npc.velocity, mod.GetGoreSlot("Gores/SirenGores/Siren5"), 1f); - for (int k = 0; k < 50; k++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, hitDirection, -1f, 0, default, 1f); + Dust.NewDust(npc.position, npc.width, npc.height, 187, hitDirection, -1f, 0, default, 1f); } } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) // 2 total states (ice shield or no ice shield) + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D texture = Main.npcTexture[npc.type]; - if (npc.dontTakeDamage) - { - switch (frameUsed) - { - case 0: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenAlt"); - break; - case 1: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenAltSinging"); - break; - case 2: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenAltStabbing"); - break; - } - } - else - { - switch (frameUsed) - { - case 0: - texture = Main.npcTexture[npc.type]; - break; - case 1: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenSinging"); - break; - case 2: - texture = ModContent.GetTexture("CalamityMod/NPCs/Leviathan/SirenStabbing"); - break; - } - } + switch (frameUsed) + { + case 0: + texture = Main.npcTexture[npc.type]; + break; + case 1: + texture = sirenStabTexture; + break; + } - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - if (npc.ai[0] > 2f || forceChargeFrames) - { - int width = 106; - Vector2 vector = new Vector2((float)(width / 2), (float)(texture.Height / Main.npcFrameCount[npc.type] / 2)); - Rectangle frame = new Rectangle(0, 0, width, texture.Height / Main.npcFrameCount[npc.type]); - frame.Y = 146 * (int)(npc.frameCounter / 12.0); // 1 to 6 - if (frame.Y >= 146 * 6 || npc.ai[0] == 4f) - frame.Y = 0; - - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + vector.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)texture.Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame), - npc.GetAlpha(drawColor), - npc.rotation, - vector, - npc.scale, - spriteEffects, - 0f); - return false; - } - - Rectangle frame2 = npc.frame; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / Main.npcFrameCount[npc.type] / 2)); - Main.spriteBatch.Draw(texture, - new Vector2(npc.position.X - Main.screenPosition.X + (float)(npc.width / 2) - (float)Main.npcTexture[npc.type].Width * npc.scale / 2f + vector11.X * npc.scale, - npc.position.Y - Main.screenPosition.Y + (float)npc.height - (float)Main.npcTexture[npc.type].Height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + vector11.Y * npc.scale + 0f + npc.gfxOffY), - new Microsoft.Xna.Framework.Rectangle?(frame2), - npc.GetAlpha(drawColor), - npc.rotation, - vector11, - npc.scale, - spriteEffects, - 0f); + bool charging = npc.ai[0] > 2f || forceChargeFrames; + int height = texture.Height / Main.npcFrameCount[npc.type]; + int width = texture.Width; + SpriteEffects spriteEffects = charging ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + if (npc.spriteDirection == -1) + spriteEffects = charging ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.spriteBatch.Draw(texture, npc.Center - Main.screenPosition + new Vector2(0f, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, new Vector2((float)width / 2f, (float)height / 2f), npc.scale, spriteEffects, 0f); return false; } - public override void FindFrame(int frameHeight) // 6 total frames, 3 total texture types + public override void FindFrame(int frameHeight) { - if (forceChargeFrames) - frameUsed = 2; - else if (npc.ai[0] == 2f) - frameUsed = 0; - else if (npc.ai[0] <= 1f) + Texture2D texture = Main.npcTexture[npc.type]; + if (npc.ai[0] > 2f || forceChargeFrames) + { frameUsed = 1; + } else - frameUsed = 2; + { + frameUsed = 0; + } + int frameY = texture.Height / Main.npcFrameCount[npc.type]; + int timeBetweenFrames = 8; - npc.frameCounter += 1.0; - if (npc.ai[0] == 3f || forceChargeFrames) - { - if (npc.frameCounter > 72.0) - npc.frameCounter = 0.0; - } - else if (npc.ai[0] != 4f) - { - int frameY = 146; - if (npc.frameCounter > 72.0) - npc.frameCounter = 0.0; + npc.frameCounter++; + if (npc.frameCounter > timeBetweenFrames * Main.npcFrameCount[npc.type]) + npc.frameCounter = 0; - npc.frame.Y = frameY * (int)(npc.frameCounter / 12.0); - if (npc.frame.Y >= frameHeight * 6) - npc.frame.Y = 0; - } + npc.frame.Y = frameY * (int)(npc.frameCounter / timeBetweenFrames); + if (npc.frame.Y >= frameHeight * Main.npcFrameCount[npc.type]) + npc.frame.Y = 0; + + //100x1140 + //200x636 } public override void BossLoot(ref string name, ref int potionType) @@ -844,6 +787,9 @@ namespace CalamityMod.NPCs.Leviathan // Anahita runs the same loot code as the Leviathan, but only if she dies last. public override void NPCLoot() { + //Trophy dropped regardless of Levi, precedent of Twins + DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); + if (!NPC.AnyNPCs(ModContent.NPCType())) Leviathan.DropSirenLeviLoot(npc); } diff --git a/NPCs/Leviathan/Siren.png b/NPCs/Leviathan/Siren.png index 56d3a69d45..4be01908da 100644 Binary files a/NPCs/Leviathan/Siren.png and b/NPCs/Leviathan/Siren.png differ diff --git a/NPCs/Leviathan/SirenAlt.png b/NPCs/Leviathan/SirenAlt.png deleted file mode 100644 index 793607a326..0000000000 Binary files a/NPCs/Leviathan/SirenAlt.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenAltSinging.png b/NPCs/Leviathan/SirenAltSinging.png deleted file mode 100644 index 365c439126..0000000000 Binary files a/NPCs/Leviathan/SirenAltSinging.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenAltStabbing.png b/NPCs/Leviathan/SirenAltStabbing.png deleted file mode 100644 index cf57a094f5..0000000000 Binary files a/NPCs/Leviathan/SirenAltStabbing.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenSinging.png b/NPCs/Leviathan/SirenSinging.png deleted file mode 100644 index 064adc1694..0000000000 Binary files a/NPCs/Leviathan/SirenSinging.png and /dev/null differ diff --git a/NPCs/Leviathan/SirenStabbing.png b/NPCs/Leviathan/SirenStabbing.png index 8d69d7de7b..36d13de7dc 100644 Binary files a/NPCs/Leviathan/SirenStabbing.png and b/NPCs/Leviathan/SirenStabbing.png differ diff --git a/NPCs/Leviathan/Siren_Head_Boss.png b/NPCs/Leviathan/Siren_Head_Boss.png index 6c4a70aad2..20f6e2deaf 100644 Binary files a/NPCs/Leviathan/Siren_Head_Boss.png and b/NPCs/Leviathan/Siren_Head_Boss.png differ diff --git a/NPCs/Leviathan/SirenandLevi_BossChecklist.png b/NPCs/Leviathan/SirenandLevi_BossChecklist.png index 047c54cff8..c59d4c2139 100644 Binary files a/NPCs/Leviathan/SirenandLevi_BossChecklist.png and b/NPCs/Leviathan/SirenandLevi_BossChecklist.png differ diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 48df531d90..3fa97855bb 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -7,570 +7,568 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.NPCs.NormalNPCs { - public class ShockstormShuttle : ModNPC - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Shockstorm Shuttle"); - } + public class ShockstormShuttle : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shockstorm Shuttle"); + Main.npcFrameCount[npc.type] = 4; + } - public override void SetDefaults() - { - npc.npcSlots = 3f; - npc.damage = 30; - npc.width = 64; - npc.height = 38; - npc.defense = 15; + public override void SetDefaults() + { + npc.npcSlots = 3f; + npc.damage = 30; + npc.width = 64; + npc.height = 38; + npc.defense = 15; npc.DR_NERD(0.15f); - npc.lifeMax = 150; - npc.aiStyle = -1; - aiType = -1; - npc.knockBackResist = 0f; - npc.value = Item.buyPrice(0, 0, 5, 0); - npc.HitSound = SoundID.NPCHit4; - npc.DeathSound = SoundID.NPCDeath14; - npc.noGravity = true; - npc.noTileCollide = true; - banner = npc.type; - bannerItem = ModContent.ItemType(); - } + npc.lifeMax = 150; + npc.aiStyle = -1; + aiType = -1; + npc.knockBackResist = 0f; + npc.value = Item.buyPrice(0, 0, 5, 0); + npc.HitSound = SoundID.NPCHit4; + npc.DeathSound = SoundID.NPCDeath14; + npc.noGravity = true; + npc.noTileCollide = true; + banner = npc.type; + bannerItem = ModContent.ItemType(); + } - public override void AI() - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times - if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 12f; //speed of projectile - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 30; //projectile damage - if (Main.expertMode) - { - num184 = 22; - } - int num185 = ProjectileID.MartianTurretBolt; //projectile ID - if (Main.rand.NextBool(8)) - { - num185 = ProjectileID.SaucerLaser; //more powerful projectile ID - } - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); //projectile spreadX - num182 += (float)Main.rand.Next(-20, 21); //projectile spreadY - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[3] = 1f; - } - Vector2 center16 = npc.Center; - Player player8 = Main.player[npc.target]; - if (npc.target < 0 || npc.target == 255 || player8.dead || !player8.active) - { - npc.TargetClosest(true); - player8 = Main.player[npc.target]; - npc.netUpdate = true; - } - if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) - { - if (npc.ai[0] == 0f) - { - npc.ai[0] = -1f; - } - if (npc.ai[0] == 2f) - { - npc.ai[0] = -2f; - } - npc.netUpdate = true; - } - if (npc.ai[0] == -1f || npc.ai[0] == -2f) - { - npc.velocity.Y = npc.velocity.Y - 0.4f; - if (npc.timeLeft > 10) - { - npc.timeLeft = 10; - } - if (!player8.dead) - { - npc.timeLeft = 300; - if (npc.ai[0] == -2f) - { - npc.ai[0] = 2f; - } - if (npc.ai[0] == 0f) - { - npc.ai[0] = 0f; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - return; - } - } - else if (npc.ai[0] == 0f) - { - int num1580 = 0; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - npc.ai[3] += 1f; - if (npc.ai[3] >= 600f) - { - npc.ai[3] = 0f; - } - int num1581 = num1580; - if (npc.ai[3] >= 580f) - { - num1580 = 0; - } - else if (npc.ai[3] >= 440f) - { - num1580 = 5; - } - else if (npc.ai[3] >= 420f) - { - num1580 = 4; - } - else if (npc.ai[3] >= 280f) - { - num1580 = 3; - } - else if (npc.ai[3] >= 260f) - { - num1580 = 2; - } - else if (npc.ai[3] >= 20f) - { - num1580 = 1; - } - if (num1580 != num1581) - { - if (num1580 == 0) - { - npc.ai[2] = 0f; - } - if (num1580 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - } - if (num1580 == 2) - { - npc.ai[2] = 0f; - } - npc.netUpdate = true; - } - if (num1580 == 0) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; - if (vector196.Length() < 50f) - { - npc.ai[3] = 19f; - } - else - { - vector196.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); - } - } - if (num1580 == 1) - { - int num1582 = (int)npc.Center.X / 16; - int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1584 = 0; - bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; - if (flag149) - { - num1584 = 1; - } - else - { - while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) - { - int num1585 = num1583 + num1584; - bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; - if (flag150) - { - num1584--; - break; - } - num1584++; - } - } - float num1586 = (float)(num1584 * 16); - float num1587 = 250f; - if (num1586 < num1587) - { - float num1588 = -4f; - if (-num1588 > num1586) - { - num1588 = -num1586; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 3.5f * npc.ai[2]; - } - if (num1580 == 2) - { - if (npc.ai[2] == 0f) - { - npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); - } - Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; - int num1589 = (int)npc.Center.X / 16; - int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1591 = 0; - bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; - if (flag151) - { - num1591 = 1; - } - else - { - while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) - { - int num1592 = num1590 + num1591; - bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; - if (flag152) - { - num1591--; - break; - } - num1591++; - } - } - float num1593 = (float)(num1591 * 16); - float num1594 = 170f; - if (num1593 < num1594) - { - vector197.Y -= num1594 - num1593; - } - if (vector197.Length() < 70f) - { - npc.ai[3] = 279f; - } - else - { - vector197.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); - } - } - else if (num1580 == 3) - { - float num1595 = 0.85f; - int num1596 = (int)npc.Center.X / 16; - int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1598 = 0; - bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; - if (flag153) - { - num1598 = 1; - } - else - { - while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) - { - int num1599 = num1597 + num1598; - bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; - if (flag154) - { - num1598--; - break; - } - num1598++; - } - } - float num1600 = (float)(num1598 * 16); - float num1601 = 170f; - if (num1600 < num1601) - { - float num1602 = -4f; - if (-num1602 > num1600) - { - num1602 = -num1600; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * num1595; - } - npc.velocity.X = npc.velocity.X * num1595; - } - if (num1580 == 4) - { - Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; - if (vector198.Length() < 50f) - { - npc.ai[3] = 439f; - return; - } - vector198.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); - return; - } - else if (num1580 == 5) - { - npc.velocity *= 0.85f; - return; - } - } - else if (npc.ai[0] == 1f) - { - npc.velocity *= 0.96f; - float num1603 = 150f; - npc.ai[1] += 1f; - if (npc.ai[1] >= num1603) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.rotation = 0f; - npc.netUpdate = true; - return; - } - if (npc.ai[1] < 40f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * 6.28318548f), default).Y * 0.2f; - return; - } - if (npc.ai[1] < 80f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * 6.28318548f), default).Y * 0.3f; - return; - } - if (npc.ai[1] < 120f) - { - npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * 6.28318548f), default).Y * 0.4f; - return; - } - npc.rotation = (npc.ai[1] - 120f) / 30f * 6.28318548f; - return; - } - else if (npc.ai[0] == 2f) - { - float num1605 = 3600f; - float num1606 = 120f; - float num1607 = 60f; - int num1608 = 0; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - int num1609 = num1608; - num1608 = 0; - npc.ai[3] += 1f; - if (npc.ai[3] % num1606 >= num1607) - { - num1608 = 1; - } - if (num1608 != num1609) - { - if (num1608 == 1) - { - npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); - if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this - { - npc.localAI[0] += (float)Main.rand.Next(4); - if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) - { - npc.localAI[0] = 0f; - npc.TargetClosest(true); - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num179 = 11f; - Vector2 value9 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - float num181 = Math.Abs(num180) * 0.1f; - float num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y - num181; - float num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - npc.netUpdate = true; - num183 = num179 / num183; - num180 *= num183; - num182 *= num183; - int num184 = 50; - if (Main.expertMode) - { - num184 = 28; - } - if (Main.hardMode) - { - num184 = 40; - if (NPC.downedMoonlord) - { - num184 = 80; - if (Main.expertMode) - { - num184 = 45; - } - } - } - int num185 = ProjectileID.SaucerLaser; - value9.X += num180; - value9.Y += num182; - for (int num186 = 0; num186 < 2; num186++) - { - num180 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - value9.X; - num182 = Main.player[npc.target].position.Y + (float)Main.player[npc.target].height * 0.5f - value9.Y; - num183 = (float)Math.Sqrt((double)(num180 * num180 + num182 * num182)); - num183 = 12f / num183; - num180 += (float)Main.rand.Next(-20, 21); - num182 += (float)Main.rand.Next(-20, 21); - num180 *= num183; - num182 *= num183; - Projectile.NewProjectile(value9.X, value9.Y, num180, num182, num185, num184, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - Main.PlaySound(SoundID.Item12, npc.position); - } - npc.netUpdate = true; - } - if (npc.ai[3] >= num1605) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else if (num1608 == 0) - { - Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; - vector199.Normalize(); - npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); - } - else - { - int num1610 = (int)npc.Center.X / 16; - int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; - int num1612 = 0; - bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; - if (flag155) - { - num1612 = 1; - } - else - { - while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) - { - int num1613 = num1611 + num1612; - bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; - if (flag156) - { - num1612--; - break; - } - num1612++; - } - } - float num1614 = (float)(num1612 * 16); - float num1615 = 250f; - if (num1614 < num1615) - { - float num1616 = -4f; - if (-num1616 > num1614) - { - num1616 = -num1614; - } - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); - } - else - { - npc.velocity.Y = npc.velocity.Y * 0.95f; - } - npc.velocity.X = 8f * npc.ai[2]; - } - npc.rotation = 0f; - } - } + public override void AI() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[0] += (float)Main.rand.Next(4); //adds to localAI to fire projectiles at random times + if (npc.localAI[0] >= (float)Main.rand.Next(100, 120)) //rate at which projectiles are shot + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float projSpeed = 12f; //speed of projectile + Vector2 npcPos = npc.Center; + float targetX = Main.player[npc.target].Center.X - npcPos.X; + float YAdjust = Math.Abs(targetX) * 0.1f; + float targetY = Main.player[npc.target].Center.Y - npcPos.Y - YAdjust; + Vector2 velocity = new Vector2(targetX, targetY); + float targetDist = velocity.Length(); + npc.netUpdate = true; + targetDist = projSpeed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + int projDmg = 30; //projectile damage + if (Main.expertMode) + { + projDmg = 22; + } + int projType = ProjectileID.MartianTurretBolt; //projectile ID + if (Main.rand.NextBool(8)) + { + projType = ProjectileID.SaucerLaser; //more powerful projectile ID + } + npcPos.X += velocity.X; + npcPos.Y += velocity.Y; + for (int num186 = 0; num186 < 2; num186++) //shoots two projectiles by looping twice + { + velocity = Main.player[npc.target].Center - npcPos; + targetDist = velocity.Length(); + targetDist = projSpeed / targetDist; + velocity.X += (float)Main.rand.Next(-20, 21); //projectile spreadX + velocity.Y += (float)Main.rand.Next(-20, 21); //projectile spreadY + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile.NewProjectile(npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + if (npc.localAI[3] == 0f && Main.netMode != NetmodeID.MultiplayerClient) + { + npc.localAI[3] = 1f; + } + Vector2 center16 = npc.Center; + Player player8 = Main.player[npc.target]; + if (npc.target < 0 || npc.target == Main.maxPlayers || player8.dead || !player8.active) + { + npc.TargetClosest(true); + player8 = Main.player[npc.target]; + npc.netUpdate = true; + } + if ((player8.dead || Vector2.Distance(player8.Center, center16) > 3200f) && npc.ai[0] != 1f) + { + if (npc.ai[0] == 0f) + { + npc.ai[0] = -1f; + } + if (npc.ai[0] == 2f) + { + npc.ai[0] = -2f; + } + npc.netUpdate = true; + } + if (npc.ai[0] == -1f || npc.ai[0] == -2f) + { + npc.velocity.Y = npc.velocity.Y - 0.4f; + if (npc.timeLeft > 10) + { + npc.timeLeft = 10; + } + if (!player8.dead) + { + npc.timeLeft = 300; + if (npc.ai[0] == -2f) + { + npc.ai[0] = 2f; + } + if (npc.ai[0] == 0f) + { + npc.ai[0] = 0f; + } + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + return; + } + } + else if (npc.ai[0] == 0f) + { + int num1580 = 0; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + npc.ai[3] += 1f; + if (npc.ai[3] >= 600f) + { + npc.ai[3] = 0f; + } + int num1581 = num1580; + if (npc.ai[3] >= 580f) + { + num1580 = 0; + } + else if (npc.ai[3] >= 440f) + { + num1580 = 5; + } + else if (npc.ai[3] >= 420f) + { + num1580 = 4; + } + else if (npc.ai[3] >= 280f) + { + num1580 = 3; + } + else if (npc.ai[3] >= 260f) + { + num1580 = 2; + } + else if (npc.ai[3] >= 20f) + { + num1580 = 1; + } + if (num1580 != num1581) + { + if (num1580 == 0) + { + npc.ai[2] = 0f; + } + if (num1580 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + } + if (num1580 == 2) + { + npc.ai[2] = 0f; + } + npc.netUpdate = true; + } + if (num1580 == 0) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(-600 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector196 = player8.Center + new Vector2(npc.ai[2], -250f) - center16; + if (vector196.Length() < 50f) + { + npc.ai[3] = 19f; + } + else + { + vector196.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector196 * 16f, 0.1f); + } + } + if (num1580 == 1) + { + int num1582 = (int)npc.Center.X / 16; + int num1583 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1584 = 0; + bool flag149 = Main.tile[num1582, num1583].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1583].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1583].type]; + if (flag149) + { + num1584 = 1; + } + else + { + while (num1584 < 150 && num1583 + num1584 < Main.maxTilesY) + { + int num1585 = num1583 + num1584; + bool flag150 = Main.tile[num1582, num1585].nactive() && Main.tileSolid[(int)Main.tile[num1582, num1585].type] && !Main.tileSolidTop[(int)Main.tile[num1582, num1585].type]; + if (flag150) + { + num1584--; + break; + } + num1584++; + } + } + float num1586 = (float)(num1584 * 16); + float num1587 = 250f; + if (num1586 < num1587) + { + float num1588 = -4f; + if (-num1588 > num1586) + { + num1588 = -num1586; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1588, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 3.5f * npc.ai[2]; + } + if (num1580 == 2) + { + if (npc.ai[2] == 0f) + { + npc.ai[2] = (float)(300 * Math.Sign((center16 - player8.Center).X)); + } + Vector2 vector197 = player8.Center + new Vector2(npc.ai[2], -170f) - center16; + int num1589 = (int)npc.Center.X / 16; + int num1590 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1591 = 0; + bool flag151 = Main.tile[num1589, num1590].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1590].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1590].type]; + if (flag151) + { + num1591 = 1; + } + else + { + while (num1591 < 150 && num1590 + num1591 < Main.maxTilesY) + { + int num1592 = num1590 + num1591; + bool flag152 = Main.tile[num1589, num1592].nactive() && Main.tileSolid[(int)Main.tile[num1589, num1592].type] && !Main.tileSolidTop[(int)Main.tile[num1589, num1592].type]; + if (flag152) + { + num1591--; + break; + } + num1591++; + } + } + float num1593 = (float)(num1591 * 16); + float num1594 = 170f; + if (num1593 < num1594) + { + vector197.Y -= num1594 - num1593; + } + if (vector197.Length() < 70f) + { + npc.ai[3] = 279f; + } + else + { + vector197.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector197 * 20f, 0.1f); + } + } + else if (num1580 == 3) + { + float num1595 = 0.85f; + int num1596 = (int)npc.Center.X / 16; + int num1597 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1598 = 0; + bool flag153 = Main.tile[num1596, num1597].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1597].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1597].type]; + if (flag153) + { + num1598 = 1; + } + else + { + while (num1598 < 150 && num1597 + num1598 < Main.maxTilesY) + { + int num1599 = num1597 + num1598; + bool flag154 = Main.tile[num1596, num1599].nactive() && Main.tileSolid[(int)Main.tile[num1596, num1599].type] && !Main.tileSolidTop[(int)Main.tile[num1596, num1599].type]; + if (flag154) + { + num1598--; + break; + } + num1598++; + } + } + float num1600 = (float)(num1598 * 16); + float num1601 = 170f; + if (num1600 < num1601) + { + float num1602 = -4f; + if (-num1602 > num1600) + { + num1602 = -num1600; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1602, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * num1595; + } + npc.velocity.X = npc.velocity.X * num1595; + } + if (num1580 == 4) + { + Vector2 vector198 = player8.Center + new Vector2(0f, -250f) - center16; + if (vector198.Length() < 50f) + { + npc.ai[3] = 439f; + return; + } + vector198.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector198 * 16f, 0.1f); + return; + } + else if (num1580 == 5) + { + npc.velocity *= 0.85f; + return; + } + } + else if (npc.ai[0] == 1f) + { + npc.velocity *= 0.96f; + float num1603 = 150f; + npc.ai[1] += 1f; + if (npc.ai[1] >= num1603) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.rotation = 0f; + npc.netUpdate = true; + return; + } + if (npc.ai[1] < 40f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 40f * MathHelper.TwoPi), default).Y * 0.2f; + return; + } + if (npc.ai[1] < 80f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 20f * MathHelper.TwoPi), default).Y * 0.3f; + return; + } + if (npc.ai[1] < 120f) + { + npc.rotation = Vector2.UnitY.RotatedBy((double)(npc.ai[1] / 10f * MathHelper.TwoPi), default).Y * 0.4f; + return; + } + npc.rotation = (npc.ai[1] - 120f) / 30f * MathHelper.TwoPi; + return; + } + else if (npc.ai[0] == 2f) + { + float num1605 = 3600f; + float num1606 = 120f; + float num1607 = 60f; + int num1608 = 0; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + int num1609 = num1608; + num1608 = 0; + npc.ai[3] += 1f; + if (npc.ai[3] % num1606 >= num1607) + { + num1608 = 1; + } + if (num1608 != num1609) + { + if (num1608 == 1) + { + npc.ai[2] = (float)((Math.Sign((player8.Center - center16).X) == 1) ? 1 : -1); + if (Main.netMode != NetmodeID.MultiplayerClient) //second projectile being shot. Didn't use this + { + npc.localAI[0] += (float)Main.rand.Next(4); + if (npc.localAI[0] >= (float)Main.rand.Next(50, 100)) + { + npc.localAI[0] = 0f; + npc.TargetClosest(true); + if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { + float projSpeed = 11f; + Vector2 npcPos = npc.Center; + float targetX = Main.player[npc.target].Center.X - npcPos.X; + float YAdjust = Math.Abs(targetX) * 0.1f; + float targetY = Main.player[npc.target].Center.Y - npcPos.Y - YAdjust; + Vector2 velocity = new Vector2(targetX, targetY); + float targetDist = velocity.Length(); + npc.netUpdate = true; + targetDist = projSpeed / targetDist; + velocity.X *= targetDist; + velocity.Y *= targetDist; + int projDmg = 50; + if (Main.expertMode) + { + projDmg = 28; + } + int projType = ProjectileID.SaucerLaser; + npcPos.X += velocity.X; + npcPos.Y += velocity.Y; + for (int num186 = 0; num186 < 2; num186++) + { + velocity.X = Main.player[npc.target].Center.X - npcPos.X; + velocity.Y = Main.player[npc.target].Center.Y - npcPos.Y; + targetDist = velocity.Length(); + targetDist = projSpeed / targetDist; + velocity.X += (float)Main.rand.Next(-20, 21); + velocity.Y += (float)Main.rand.Next(-20, 21); + velocity.X *= targetDist; + velocity.Y *= targetDist; + Projectile.NewProjectile(npcPos, velocity, projType, projDmg, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + Main.PlaySound(SoundID.Item12, npc.position); + } + npc.netUpdate = true; + } + if (npc.ai[3] >= num1605) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.netUpdate = true; + } + else if (num1608 == 0) + { + Vector2 vector199 = player8.Center + new Vector2(npc.ai[2] * 350f, -250f) - center16; + vector199.Normalize(); + npc.velocity = Vector2.Lerp(npc.velocity, vector199 * 16f, 0.1f); + } + else + { + int num1610 = (int)npc.Center.X / 16; + int num1611 = (int)(npc.position.Y + (float)npc.height) / 16; + int num1612 = 0; + bool flag155 = Main.tile[num1610, num1611].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1611].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1611].type]; + if (flag155) + { + num1612 = 1; + } + else + { + while (num1612 < 150 && num1611 + num1612 < Main.maxTilesY) + { + int num1613 = num1611 + num1612; + bool flag156 = Main.tile[num1610, num1613].nactive() && Main.tileSolid[(int)Main.tile[num1610, num1613].type] && !Main.tileSolidTop[(int)Main.tile[num1610, num1613].type]; + if (flag156) + { + num1612--; + break; + } + num1612++; + } + } + float num1614 = (float)(num1612 * 16); + float num1615 = 250f; + if (num1614 < num1615) + { + float num1616 = -4f; + if (-num1616 > num1614) + { + num1616 = -num1614; + } + npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, num1616, 0.05f); + } + else + { + npc.velocity.Y = npc.velocity.Y * 0.95f; + } + npc.velocity.X = 8f * npc.ai[2]; + } + npc.rotation = 0f; + } + } - public override void HitEffect(int hitDirection, double damage) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); - } - if (npc.life <= 0) - { - for (int k = 0; k < 20; k++) - { - Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); - } - } - } + public override void FindFrame(int frameHeight) + { + npc.frameCounter += 0.15f; + npc.frameCounter %= Main.npcFrameCount[npc.type]; + int frame = (int)npc.frameCounter; + npc.frame.Y = frame * frameHeight; + } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Sky.Chance * 0.1f; - } + public override void HitEffect(int hitDirection, double damage) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + } + if (npc.life <= 0) + { + for (int k = 0; k < 20; k++) + { + Dust.NewDust(npc.position, npc.width, npc.height, 234, hitDirection, -1f, 0, default, 1f); + } + } + } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Electrified, 120, true); - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.playerSafe || !Main.hardMode) + { + return 0f; + } + return SpawnCondition.Sky.Chance * 0.1f; + } - public override void NPCLoot() - { - DropHelper.DropItemCondition(npc, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); - DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); - } - } + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 120, true); + } + + public override void NPCLoot() + { + DropHelper.DropItemCondition(npc, ItemID.MartianConduitPlating, NPC.downedGolemBoss, 1, 10, 30); + DropHelper.DropItemChance(npc, ModContent.ItemType(), 3); + } + } } diff --git a/NPCs/NormalNPCs/ShockstormShuttle.png b/NPCs/NormalNPCs/ShockstormShuttle.png index 6f56a972bf..ef2147cbc0 100644 Binary files a/NPCs/NormalNPCs/ShockstormShuttle.png and b/NPCs/NormalNPCs/ShockstormShuttle.png differ diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 5cf9df800d..1c0a4df67d 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -60,18 +60,18 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(5500, 20000)) + npc.localAI[0] += Main.rand.Next(shoot); + if (npc.localAI[0] >= Main.rand.Next(1800, 20000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 9b90748b30..210658a80d 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -60,18 +60,18 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(4000, 12000)) + npc.localAI[0] += Main.rand.Next(shoot); + if (npc.localAI[0] >= Main.rand.Next(1500, 12000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index b62936683f..51c0a46ae3 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -60,18 +60,18 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient) { int shoot = revenge ? 5 : 4; - npc.localAI[0] += (float)Main.rand.Next(shoot); - if (npc.localAI[0] >= (float)Main.rand.Next(1500, 6000)) + npc.localAI[0] += Main.rand.Next(shoot); + if (npc.localAI[0] >= Main.rand.Next(1200, 6000)) { npc.localAI[0] = 0f; npc.TargetClosest(true); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { float num941 = revenge ? 9f : 8f; - Vector2 vector104 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float num942 = player.position.X + (float)player.width * 0.5f - vector104.X; - float num943 = player.position.Y + (float)player.height * 0.5f - vector104.Y; - float num944 = (float)Math.Sqrt((double)(num942 * num942 + num943 * num943)); + Vector2 vector104 = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + (npc.height / 2)); + float num942 = player.position.X + player.width * 0.5f - vector104.X; + float num943 = player.position.Y + player.height * 0.5f - vector104.Y; + float num944 = (float)Math.Sqrt(num942 * num942 + num943 * num943); num944 = num941 / num944; num942 *= num944; num943 *= num944; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 6106fba79d..1a55d6dbd7 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -214,6 +214,7 @@ namespace CalamityMod.NPCs.Providence // Phase times float phaseTime = nightTime ? 240f : 300f; float crystalPhaseTime = nightTime ? 60f : 120f; + int nightCrystalTime = 210; float attackDelayAfterCocoon = 90f; // Phases @@ -1186,17 +1187,19 @@ namespace CalamityMod.NPCs.Providence if (!targetDead) npc.velocity *= 0.9f; - if (Main.netMode != NetmodeID.MultiplayerClient) + npc.ai[1] += 1f; + if (npc.ai[1] >= crystalPhaseTime) { - npc.ai[1] += 1f; - if (npc.ai[1] >= crystalPhaseTime) + if (npc.ai[1] == crystalPhaseTime && Main.netMode != NetmodeID.MultiplayerClient) { - if (npc.ai[1] == crystalPhaseTime) - Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, 0f, 0f); + int proj = Projectile.NewProjectile(player.Center.X, player.Center.Y - 360f, 0f, 0f, ModContent.ProjectileType(), crystalDamage, 0f, player.whoAmI, 0f, 0f); - if (npc.ai[1] >= crystalPhaseTime + 210f || !nightTime) - npc.ai[0] = -1f; + if (nightTime) + Main.projectile[proj].timeLeft = nightCrystalTime; } + + if (npc.ai[1] >= crystalPhaseTime + nightCrystalTime || !nightTime) + npc.ai[0] = -1f; } } diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 9cfdc7105a..a03b512b93 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -561,10 +561,10 @@ namespace CalamityMod.NPCs.Ravager float amount = death ? 1f : 1f - lifeRatio; Vector2 targetVector = player.position; + float aimY = targetVector.Y - 320f; if (npc.ai[0] == 2f && npc.ai[1] == 0f) { - float aimY = targetVector.Y - 320f; if (npc.Top.Y > aimY) { if (npc.velocity.Y > 0f) @@ -577,14 +577,14 @@ namespace CalamityMod.NPCs.Ravager } } - float maxOffset = death ? 160f : 160f * (1f - lifeRatio); + float maxOffset = 160f + (death ? 160f : 160f * (1f - lifeRatio)); float offset = npc.ai[0] == 2f ? maxOffset * npc.Calamity().newAI[2] : 0f; // Set offset to 0 if the target stops moving if (Math.Abs(player.velocity.X) < 0.5f) npc.Calamity().newAI[2] = 0f; - if ((npc.position.X < targetVector.X + offset && npc.position.X + npc.width > targetVector.X + player.width + offset) || npc.ai[1] > 0f) + if ((npc.position.X < targetVector.X + offset && npc.position.X + npc.width > targetVector.X + player.width + offset && (npc.Top.Y <= aimY || npc.ai[0] != 2f)) || npc.ai[1] > 0f) { if (npc.ai[0] == 2f) { diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index afad42a2a8..e276f62f9f 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -782,7 +782,11 @@ namespace CalamityMod.NPCs.Signus netMessage.Write(CalamityWorld.DoGSecondStageCountdown); netMessage.Send(); } - } + + // Mark DoG fight sentinels as dead + CalamityWorld.downedSecondSentinels = true; + CalamityMod.UpdateServerBoolean(); + } // Mark Signus as dead CalamityWorld.downedSentinel3 = true; diff --git a/NPCs/Signus/SignusBomb.cs b/NPCs/Signus/SignusBomb.cs index 7218ff3784..f05fa9d320 100644 --- a/NPCs/Signus/SignusBomb.cs +++ b/NPCs/Signus/SignusBomb.cs @@ -28,6 +28,7 @@ namespace CalamityMod.NPCs.Signus npc.knockBackResist = 0f; npc.noGravity = true; npc.noTileCollide = true; + npc.dontTakeDamage = true; npc.HitSound = SoundID.NPCHit53; npc.DeathSound = SoundID.NPCDeath44; } @@ -51,50 +52,58 @@ namespace CalamityMod.NPCs.Signus return; } - Lighting.AddLight((int)((npc.position.X + (float)(npc.width / 2)) / 16f), (int)((npc.position.Y + (float)(npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 0.7f, 0.2f, 1.1f); + npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[1] == 0f) - { - npc.scale -= 0.02f; - npc.alpha += 30; - if (npc.alpha >= 250) - { - npc.alpha = 255; - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 1f) - { - npc.scale += 0.02f; - npc.alpha -= 30; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[1] = 0f; - } - } + npc.TargetClosest(true); Player player = Main.player[npc.target]; - Vector2 vector = player.Center - npc.Center; - if (vector.Length() < 90f || npc.ai[3] >= 300f) + Vector2 vector = player.Center - npc.Center; + npc.ai[2] = vector.Length(); + + npc.ai[3] += 1f; + if (npc.ai[2] < 90f || npc.ai[3] >= 300f || npc.Calamity().newAI[0] > 0f) { - npc.dontTakeDamage = false; - CheckDead(); - npc.life = 0; - return; + npc.Calamity().newAI[0] += 1f; + npc.velocity *= 0.98f; + npc.dontTakeDamage = false; + npc.scale = MathHelper.Lerp(1f, 3f, npc.Calamity().newAI[0] / 85f); + + if (npc.Calamity().newAI[0] >= 85f) + { + CheckDead(); + npc.life = 0; + } + + return; } - npc.ai[3] += 1f; - npc.dontTakeDamage = npc.ai[3] >= 240f ? false : true; - if (npc.ai[3] >= 180f) - { - npc.velocity *= 0.985f; - return; - } - float num1372 = 14f; - Vector2 vector167 = new Vector2(npc.Center.X + (float)(npc.direction * 20), npc.Center.Y + 6f); - float num1373 = player.position.X + (float)player.width * 0.5f - vector167.X; + + if (npc.ai[1] == 0f) + { + npc.scale -= 0.02f; + npc.alpha += 30; + if (npc.alpha >= 250) + { + npc.alpha = 255; + npc.ai[1] = 1f; + } + } + else if (npc.ai[1] == 1f) + { + npc.scale += 0.02f; + npc.alpha -= 30; + if (npc.alpha <= 0) + { + npc.alpha = 0; + npc.ai[1] = 0f; + } + } + + float num1372 = 14f; + Vector2 vector167 = new Vector2(npc.Center.X + (npc.direction * 20), npc.Center.Y + 6f); + float num1373 = player.position.X + player.width * 0.5f - vector167.X; float num1374 = player.Center.Y - vector167.Y; - float num1375 = (float)Math.Sqrt((double)(num1373 * num1373 + num1374 * num1374)); + float num1375 = (float)Math.Sqrt(num1373 * num1373 + num1374 * num1374); float num1376 = num1372 / num1375; num1373 *= num1376; num1374 *= num1376; @@ -115,6 +124,7 @@ namespace CalamityMod.NPCs.Signus } return; } + npc.velocity.X = (npc.velocity.X * 50f + num1373) / 51f; npc.velocity.Y = (npc.velocity.Y * 50f + num1374) / 51f; if (num1375 < 350f) @@ -141,7 +151,7 @@ namespace CalamityMod.NPCs.Signus spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = Main.npcTexture[npc.type]; - Vector2 vector11 = new Vector2((float)(Main.npcTexture[npc.type].Width / 2), (float)(Main.npcTexture[npc.type].Height / 2)); + Vector2 vector11 = new Vector2(Main.npcTexture[npc.type].Width / 2, Main.npcTexture[npc.type].Height / 2); Color color36 = Color.White; float amount9 = 0.5f; int num153 = 5; @@ -153,16 +163,16 @@ namespace CalamityMod.NPCs.Signus Color color38 = lightColor; color38 = Color.Lerp(color38, color36, amount9); color38 = npc.GetAlpha(color38); - color38 *= (float)(num153 - num155) / 15f; - Vector2 vector41 = npc.oldPos[num155] + new Vector2((float)npc.width, (float)npc.height) / 2f - Main.screenPosition; - vector41 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + color38 *= (num153 - num155) / 15f; + Vector2 vector41 = npc.oldPos[num155] + new Vector2(npc.width, npc.height) / 2f - Main.screenPosition; + vector41 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector41 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector41, npc.frame, color38, npc.rotation, vector11, npc.scale, spriteEffects, 0f); } } Vector2 vector43 = npc.Center - Main.screenPosition; - vector43 -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height)) * npc.scale / 2f; + vector43 -= new Vector2(texture2D15.Width, texture2D15.Height) * npc.scale / 2f; vector43 += vector11 * npc.scale + new Vector2(0f, 4f + npc.gfxOffY); spriteBatch.Draw(texture2D15, vector43, npc.frame, npc.GetAlpha(lightColor), npc.rotation, vector11, npc.scale, spriteEffects, 0f); @@ -172,24 +182,24 @@ namespace CalamityMod.NPCs.Signus public override bool CheckDead() { Main.PlaySound(2, (int)npc.position.X, (int)npc.position.Y, 14); - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.damage = 300; npc.width = npc.height = 256; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); - for (int num621 = 0; num621 < 15; num621++) + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); + for (int num621 = 0; num621 < 10; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 2f); Main.dust[num622].velocity *= 3f; if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } Main.dust[num622].noGravity = true; } - for (int num623 = 0; num623 < 30; num623++) + for (int num623 = 0; num623 < 20; num623++) { int num624 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, (int)CalamityDusts.PurpleCosmolite, 0f, 0f, 100, default, 3f); Main.dust[num624].noGravity = true; diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 8310cfc78f..172fd6c68f 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -212,6 +212,7 @@ namespace CalamityMod.NPCs.SlimeGod { npc.Calamity().newAI[2] = npc.life; npc.Calamity().newAI[3] = 1f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodPossession"), (int)npc.position.X, (int)npc.position.Y); } } @@ -249,6 +250,25 @@ namespace CalamityMod.NPCs.SlimeGod { npc.ai[2] = 0f; npc.Calamity().newAI[3] = 0f; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SlimeGodExit"), (int)npc.position.X, (int)npc.position.Y); + for (int i = 0; i < 20; i++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 3f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].scale = 0.5f; + Main.dust[dust].fadeIn = 1f + Main.rand.Next(10) * 0.1f; + } + } + for (int j = 0; j < 30; j++) + { + int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 3f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 5f; + dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); + Main.dust[dust].velocity *= 2f; + } } return; @@ -687,12 +707,12 @@ namespace CalamityMod.NPCs.SlimeGod } if (npc.life <= 0) { - npc.position.X = npc.position.X + (float)(npc.width / 2); - npc.position.Y = npc.position.Y + (float)(npc.height / 2); + npc.position.X = npc.position.X + (npc.width / 2); + npc.position.Y = npc.position.Y + (npc.height / 2); npc.width = 40; npc.height = 40; - npc.position.X = npc.position.X - (float)(npc.width / 2); - npc.position.Y = npc.position.Y - (float)(npc.height / 2); + npc.position.X = npc.position.X - (npc.width / 2); + npc.position.Y = npc.position.Y - (npc.height / 2); for (int num621 = 0; num621 < 40; num621++) { int num622 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y), npc.width, npc.height, 4, 0f, 0f, 100, default, 2f); @@ -700,7 +720,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 70; num623++) diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index 07ff19638f..1c570f4c68 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -63,12 +63,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SendExtraAI(BinaryWriter writer) { writer.Write(npc.localAI[0]); - } + writer.Write(npc.alpha); + } public override void ReceiveExtraAI(BinaryReader reader) { npc.localAI[0] = reader.ReadSingle(); - } + npc.alpha = reader.ReadInt32(); + } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { diff --git a/NPCs/Yharon/DetonatingFlare2.cs b/NPCs/Yharon/DetonatingFlare2.cs index 4c7178c56b..a64bd8c3b0 100644 --- a/NPCs/Yharon/DetonatingFlare2.cs +++ b/NPCs/Yharon/DetonatingFlare2.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.Yharon npc.noGravity = true; npc.noTileCollide = true; npc.canGhostHeal = false; - npc.HitSound = SoundID.NPCHit52; + npc.HitSound = SoundID.NPCHit52; npc.DeathSound = SoundID.NPCDeath55; npc.alpha = 255; } diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 4e6d9f69af..cc5c553066 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -243,6 +243,7 @@ namespace CalamityMod.NPCs.Yharon bool phase2Check = npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); bool phase3Check = npc.life <= npc.lifeMax * (revenge ? 0.5 : (expertMode ? 0.4 : 0.25)); bool phase4Check = npc.life <= npc.lifeMax * 0.1; + bool phase1Change = npc.ai[0] > -1f; bool phase2Change = npc.ai[0] > 5f; bool phase3Change = npc.ai[0] > 12f; bool isCharging = npc.ai[3] < 20f; @@ -255,6 +256,14 @@ namespace CalamityMod.NPCs.Yharon float acceleration = expertMode ? 0.7f : 0.69f; float velocity = expertMode ? 11f : 10.8f; + // Damage immunity + if (phase3Change) + npc.dontTakeDamage = phase4Check; + else if (phase2Change) + npc.dontTakeDamage = phase3Check; + else if (phase1Change) + npc.dontTakeDamage = phase2Check; + if (npc.Calamity().enraged > 0 || (CalamityConfig.Instance.BossRushXerocCurse && CalamityWorld.bossRushActive)) { acceleration = 0.95f; @@ -413,7 +422,8 @@ namespace CalamityMod.NPCs.Yharon // Set DR based on protection boost (aka enrage) bool chargeTelegraph = (npc.ai[0] == 0f || npc.ai[0] == 6f || npc.ai[0] == 13f) && npc.localAI[1] > 0f; - npc.Calamity().DR = protectionBoost ? EnragedDR : (chargeTelegraph ? ChargeTelegraph_DR : Phase1_DR); + bool bulletHell = npc.ai[0] == 8f || npc.ai[0] == 15f; + npc.Calamity().DR = protectionBoost ? EnragedDR : ((chargeTelegraph || bulletHell) ? ChargeTelegraph_DR : Phase1_DR); // Trigger spawn effects if (npc.localAI[0] == 0f) @@ -469,8 +479,6 @@ namespace CalamityMod.NPCs.Yharon // Spawn effects if (npc.ai[0] == -1f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; int num1467 = Math.Sign(player.Center.X - vectorCenter.X); @@ -528,8 +536,6 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 0f && !player.dead) { - npc.dontTakeDamage = false; - if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); @@ -734,8 +740,6 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 4f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -774,8 +778,6 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 6f && !player.dead) { - npc.dontTakeDamage = false; - if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); @@ -1025,8 +1027,6 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 10f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -1063,7 +1063,7 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust that speeds up and whips around in a wave else if (npc.ai[0] == 12f) { - if (npc.ai[2] == 0f) + if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); npc.ai[2] += 1f; @@ -1097,8 +1097,6 @@ namespace CalamityMod.NPCs.Yharon // Phase switch else if (npc.ai[0] == 13f && !player.dead) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[1] == 0f) npc.ai[1] = 500 * Math.Sign((vectorCenter - player.Center).X); @@ -1286,8 +1284,6 @@ namespace CalamityMod.NPCs.Yharon // Charge else if (npc.ai[0] == 14f) { - npc.dontTakeDamage = phase4Check; - ChargeDust(7, pie); npc.ai[2] += 1f; @@ -1304,8 +1300,6 @@ namespace CalamityMod.NPCs.Yharon // Flare Dust bullet hell else if (npc.ai[0] == 15f) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[2] == 0f) { Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); @@ -1325,7 +1319,7 @@ namespace CalamityMod.NPCs.Yharon // Rotate spiral by 7.2 * (300 / 12) = +90 degrees and then back -90 degrees if (Main.netMode != NetmodeID.MultiplayerClient) - DoFlareDustBulletHell(1, flareDustPhaseTimer, projectileDamage, 8, 12f, 7.2f, false); + DoFlareDustBulletHell(1, flareDustPhaseTimer, projectileDamage, 8, 12f, 3.6f, false); } npc.velocity = npc.velocity.RotatedBy(-(double)spinPhaseRotation * (float)npc.direction); @@ -1344,8 +1338,6 @@ namespace CalamityMod.NPCs.Yharon // Infernado else if (npc.ai[0] == 16f) { - npc.dontTakeDamage = phase4Check; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -1369,8 +1361,6 @@ namespace CalamityMod.NPCs.Yharon // Enter new phase else if (npc.ai[0] == 17f) { - npc.dontTakeDamage = true; - npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -1392,8 +1382,6 @@ namespace CalamityMod.NPCs.Yharon // Fast charge else if (npc.ai[0] == 18f) { - npc.dontTakeDamage = phase4Check; - ChargeDust(14, pie); npc.ai[2] += 1f; @@ -1410,8 +1398,6 @@ namespace CalamityMod.NPCs.Yharon // Fireball ring else if (npc.ai[0] == 19f) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[2] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/YharonRoar"), (int)npc.position.X, (int)npc.position.Y); @@ -1444,8 +1430,6 @@ namespace CalamityMod.NPCs.Yharon // Fireball breath else if (npc.ai[0] == 20f) { - npc.dontTakeDamage = phase4Check; - if (npc.ai[1] == 0f) npc.ai[1] = 400 * Math.Sign((vectorCenter - player.Center).X); @@ -1493,7 +1477,7 @@ namespace CalamityMod.NPCs.Yharon { bool phase2 = npc.life <= npc.lifeMax * (revenge ? 0.8 : (expertMode ? 0.7 : 0.5)); bool phase3 = npc.life <= npc.lifeMax * (revenge ? 0.5 : (expertMode ? 0.4 : 0.25)); - bool phase4 = npc.life <= npc.lifeMax * 0.15 && revenge; + bool phase4 = npc.life <= npc.lifeMax * 0.2 && revenge; if (npc.ai[0] != 8f) { @@ -1520,35 +1504,56 @@ namespace CalamityMod.NPCs.Yharon else if (Main.netMode == NetmodeID.Server) NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); } - if (invincibilityCounter < 900) - { - phase2 = phase3 = phase4 = false; - invincibilityCounter += 1; + if (invincibilityCounter < 900) + { + phase2 = phase3 = phase4 = false; - int heal = 5; //900 / 5 = 180 - healCounter += 1; - if (healCounter >= heal) - { - healCounter = 0; + invincibilityCounter += 1; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = npc.lifeMax / 200; - if (healAmt > npc.lifeMax - npc.life) - healAmt = npc.lifeMax - npc.life; + int heal = 5; //900 / 5 = 180 + healCounter += 1; + if (healCounter >= heal) + { + healCounter = 0; - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - else - npc.dontTakeDamage = npc.ai[0] == 9f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int healAmt = npc.lifeMax / 200; + if (healAmt > npc.lifeMax - npc.life) + healAmt = npc.lifeMax - npc.life; + + if (healAmt > 0) + { + npc.life += healAmt; + npc.HealEffect(healAmt, true); + npc.netUpdate = true; + } + } + } + } + else + { + // Damage immunity + switch (secondPhasePhase) + { + case 1: + npc.dontTakeDamage = phase2; + break; + case 2: + npc.dontTakeDamage = phase3; + break; + case 3: + npc.dontTakeDamage = phase4; + break; + case 4: + npc.dontTakeDamage = false; + break; + } + + if (!npc.dontTakeDamage) + npc.dontTakeDamage = npc.ai[0] == 9f; + } // Acquire target and determine enrage state if (npc.target < 0 || npc.target == 255 || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1598,7 +1603,8 @@ namespace CalamityMod.NPCs.Yharon // Set DR based on protection boost (aka enrage) bool chargeTelegraph = npc.ai[0] < 2f && npc.localAI[1] > 0f; - npc.Calamity().DR = protectionBoost ? EnragedDR : (chargeTelegraph ? ChargeTelegraph_DR : Phase2_DR); + bool bulletHell = npc.ai[0] == 5f; + npc.Calamity().DR = protectionBoost ? EnragedDR : ((chargeTelegraph || bulletHell) ? ChargeTelegraph_DR : Phase2_DR); int projectileDamage = expertMode ? 110 : 125; if (phase4) @@ -2131,7 +2137,7 @@ namespace CalamityMod.NPCs.Yharon // For phase 4: Rotate spiral by 18 * (240 / 16) = +135 degrees and then back -135 degrees if (npc.ai[1] % flareDustSpawnDivisor3 == 0f) - DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, phase4 ? 12 : 10, phase4 ? 16f : 12f, phase4 ? 18f : 9f, true); + DoFlareDustBulletHell(1, (int)spinPhaseTimer, projectileDamage, phase4 ? 12 : 10, phase4 ? 16f : 12f, phase4 ? 2.8f : 3.2f, true); } else if (phase2) { @@ -2472,7 +2478,8 @@ namespace CalamityMod.NPCs.Yharon Projectile.NewProjectile(flareDustBulletHellSpawn, vector2, ModContent.ProjectileType(), projectileDamage, 0f, Main.myPlayer, 2f, 0f); } - npc.localAI[2] += (aiVariableUsed < (timer / 2)) ? radialOffset : -radialOffset; + float newRadialOffset = (int)aiVariableUsed / (timer / 4) % 2f == 0f ? radialOffset : -radialOffset; + npc.localAI[2] += newRadialOffset; break; default: diff --git a/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs new file mode 100644 index 0000000000..2bdecf4355 --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseLaserbeamProjectile.cs @@ -0,0 +1,169 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Enums; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + public abstract class BaseLaserbeamProjectile : ModProjectile + { + public float RotationalSpeed + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float Time + { + get => projectile.localAI[0]; + set => projectile.localAI[0] = value; + } + public float LaserLength + { + get => projectile.localAI[1]; + set => projectile.localAI[1] = value; + } + public virtual void Behavior() + { + // Attach to some arbitrary thing/position optionally. (The ai[1] value is a reserved for this in vanilla's Phantasmal Deathray) + AttachToSomething(); + + // Ensure the the velocity is a unit vector and is not a <0,0> vector. + projectile.velocity = projectile.velocity.SafeNormalize(-Vector2.UnitY); + + Time++; + if (Time >= Lifetime) + { + projectile.Kill(); + return; + } + + DetermineScale(); + + UpdateLaserMotion(); + + float idealLaserLength = DetermineLaserLength(); + LaserLength = MathHelper.Lerp(LaserLength, idealLaserLength, 0.9f); // Very quickly approach the ideal laser length. + + DelegateMethods.v3_1 = LightCastColor.ToVector3(); + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.width * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CastLight)); + } + public virtual void UpdateLaserMotion() + { + // This part is rather complicated at a glance. + // What it's doing is converting the velocity to an angle, doing something with that angle, and changing it back into the velocity. + // In this case, "doing something with that angle" means incrementing it by a constant. + // You could attempt to make it intelligent by having it move towards the target like the Last Prism, but that's not done here. + // This allows one to cause an arcing motion. + + float updatedVelocityDirection = projectile.velocity.ToRotation() + RotationalSpeed; + projectile.rotation = updatedVelocityDirection - MathHelper.PiOver2; // Pretty much all lasers have a vertical sheet. + projectile.velocity = updatedVelocityDirection.ToRotationVector2(); + } + public virtual void DetermineScale() + { + projectile.scale = (float)Math.Sin(Time / Lifetime * MathHelper.Pi) * 6f * MaxScale; + if (projectile.scale > MaxScale) + { + projectile.scale = MaxScale; + } + } + public virtual void AttachToSomething() { } // Does nothing by default. + public virtual float DetermineLaserLength() => MaxLaserLength; // Go with the default length and ignore any obstacles by default. + public virtual void ExtraBehavior() { } + public override void AI() + { + Behavior(); + ExtraBehavior(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + // This should never happen, but just in case- + if (projectile.velocity == Vector2.Zero) + return false; + + // Start texture drawing. + spriteBatch.Draw(LaserBeginTexture, + projectile.Center - Main.screenPosition, + null, + LaserOverlayColor, + projectile.rotation, + LaserBeginTexture.Size() / 2f, + projectile.scale, + SpriteEffects.None, + 0f); + + // Prepare things for body drawing. + float laserBodyLength = LaserLength; + laserBodyLength -= (LaserBeginTexture.Height / 2 + LaserEndTexture.Height) * projectile.scale; + Vector2 centerOnLaser = projectile.Center; + centerOnLaser += projectile.velocity * projectile.scale * LaserBeginTexture.Height / 2f; + + // Body drawing. + if (laserBodyLength > 0f) + { + float laserOffset = LaserMiddleTexture.Height * projectile.scale; + float incrementalBodyLength = 0f; + while (incrementalBodyLength + 1f < laserBodyLength) + { + spriteBatch.Draw(LaserMiddleTexture, + centerOnLaser - Main.screenPosition, + null, + LaserOverlayColor, + projectile.rotation, + LaserMiddleTexture.Width * 0.5f * Vector2.UnitX, + projectile.scale, + SpriteEffects.None, + 0f); + incrementalBodyLength += laserOffset; + centerOnLaser += projectile.velocity * laserOffset; + } + } + + // End texture drawing. + if (Math.Abs(LaserLength - DetermineLaserLength()) < 30f) + { + Vector2 laserEndCenter = centerOnLaser - Main.screenPosition; + spriteBatch.Draw(LaserEndTexture, + laserEndCenter, + null, + LaserOverlayColor, + projectile.rotation, + LaserEndTexture.Frame(1, 1, 0, 0).Top(), + projectile.scale, + SpriteEffects.None, + 0f); + } + return false; + } + public override void CutTiles() + { + DelegateMethods.tilecut_0 = TileCuttingContext.AttackMelee; + Utils.PlotTileLine(projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, new Utils.PerLinePoint(DelegateMethods.CutTiles)); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (projHitbox.Intersects(targetHitbox)) + return true; + float unused = 69420f; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LaserLength, projectile.Size.Length() * projectile.scale, ref unused)) + { + return true; + } + return false; + } + + #region Virtual Values + public virtual float Lifetime => 120f; + public virtual float MaxScale => 1f; + public virtual float MaxLaserLength => 2400f; // Be careful with this. Going too high will cause lag. + public virtual Color LightCastColor => Color.White; + public virtual Color LaserOverlayColor => Color.White * 0.9f; + public virtual Texture2D LaserBeginTexture { get; } + public virtual Texture2D LaserMiddleTexture { get; } + public virtual Texture2D LaserEndTexture { get; } + #endregion + } +} diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index 696bf4ff99..0bd500e3be 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -56,15 +56,11 @@ namespace CalamityMod.Projectiles.Boss } int choice = (int)projectile.ai[1]; - if (projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) + if (projectile.localAI[0] == 0f) { - projectile.soundDelay = 420; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), (int)projectile.Center.X, (int)projectile.Center.Y); - } - - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] += 1f; + projectile.soundDelay = 1125 - (choice * 225); + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterSpawn"), (int)projectile.Center.X, (int)projectile.Center.Y); + projectile.localAI[0] += 1f; switch (choice) { case 0: @@ -82,10 +78,16 @@ namespace CalamityMod.Projectiles.Boss default: break; } - } + } - if (speedAdd < speedLimit) - speedAdd += 0.04f; + if (speedAdd < speedLimit) + speedAdd += 0.04f; + + if (projectile.soundDelay <= 0 && (choice == 0 || choice == 2)) + { + projectile.soundDelay = 420; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/BrimstoneMonsterDrone"), (int)projectile.Center.X, (int)projectile.Center.Y); + } bool revenge = CalamityWorld.revenge || CalamityWorld.bossRushActive; diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index 844466f5c0..89e6fa7364 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -56,43 +56,40 @@ namespace CalamityMod.Projectiles.Boss if (beamTimer <= 0) { Main.PlaySound(SoundID.Item33, (int)projectile.position.X, (int)projectile.position.Y); - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; - if (projectile.owner == Main.myPlayer) - { - for (i = 0; i < 4; i++) - { - float speed = 4f; - int seeProjFileforDmg = 0; - if (CalamityWorld.death) - { - speed = 7f; - } - else if (CalamityWorld.revenge) - { - speed = 6f; - } - else if (Main.expertMode) - { - speed = 5f; - } - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * speed), (float)(Math.Cos(offsetAngle) * speed), ModContent.ProjectileType(), seeProjFileforDmg, projectile.knockBack, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * speed), (float)(-Math.Cos(offsetAngle) * speed), ModContent.ProjectileType(), seeProjFileforDmg, projectile.knockBack, projectile.owner, 0f, 0f); - } - } + if (projectile.owner == Main.myPlayer) + { + float speed = 3f; + int seeProjFileforDmg = 0; + if (CalamityWorld.death) + { + speed = 5f; + } + else if (CalamityWorld.revenge) + { + speed = 4.5f; + } + else if (Main.expertMode) + { + speed = 4f; + } + speed *= projectile.ai[0]; + int totalProjectiles = 8; + float radians = MathHelper.TwoPi / totalProjectiles; + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 vector255 = new Vector2(0f, -speed).RotatedBy(radians * i); + Projectile.NewProjectile(projectile.Center, vector255, ModContent.ProjectileType(), seeProjFileforDmg, 0f, projectile.owner, 0f, 0f); + } + } beamTimer = 180; } - int num103 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num103 = Player.FindClosest(projectile.Center, 1, 1); float scaleFactor2 = projectile.velocity.Length(); Vector2 vector11 = Main.player[num103].Center - projectile.Center; if (Vector2.Distance(Main.player[num103].Center, projectile.Center) > 2000f) { - projectile.position.X = (float)(Main.player[num103].Center.X / 16) * 16f - (float)(projectile.width / 2); - projectile.position.Y = (float)(Main.player[num103].Center.Y / 16) * 16f - (float)(projectile.height / 2) - 250f; + projectile.position.X = Main.player[num103].Center.X / 16 * 16f - (projectile.width / 2); + projectile.position.Y = Main.player[num103].Center.Y / 16 * 16f - (projectile.height / 2) - 250f; projectile.ai[1] = 0f; beamTimer = 90; } @@ -112,7 +109,7 @@ namespace CalamityMod.Projectiles.Boss if (Main.rand.NextBool(2)) { Main.dust[num622].scale = 0.5f; - Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; + Main.dust[num622].fadeIn = 1f + Main.rand.Next(10) * 0.1f; } } for (int num623 = 0; num623 < 60; num623++) @@ -142,8 +139,8 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 85) { byte b2 = (byte)(projectile.timeLeft * 3); - byte a2 = (byte)(100f * ((float)b2 / 255f)); - return new Color((int)b2, (int)b2, (int)b2, (int)a2); + byte a2 = (byte)(100f * (b2 / 255f)); + return new Color(b2, b2, b2, a2); } return new Color(255, 255, 255, 100); } diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index 2d2e932d33..23dbe65792 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -1,7 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using System.IO; using Terraria; using Terraria.ModLoader; @@ -73,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss OldVelocity = Vector2.Zero; projectile.netUpdate = true; } - projectile.rotation = projectile.velocity.ToRotation() + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; } // Otherwise, be sure to save the velocity the projectile started with. It will be set again when the telegraph is over. else if (OldVelocity == Vector2.Zero) @@ -81,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss OldVelocity = projectile.velocity; projectile.velocity = Vector2.Zero; projectile.netUpdate = true; - projectile.rotation = OldVelocity.ToRotation() + 1.57f; + projectile.rotation = OldVelocity.ToRotation() + MathHelper.PiOver2; } TelegraphDelay++; } diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 3829d127fe..678ce0689a 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -45,16 +45,6 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(projectile.Center, 0.5f, 0.25f, 0f); - float num953 = revenge ? 110f : 100f; - float scaleFactor12 = revenge ? 50f : 40f; - - if (projectile.ai[1] == 1f) - { - num953 *= 0.7f; - scaleFactor12 *= 0.7f; - } - - float num954 = 40f; if (projectile.timeLeft > 30 && projectile.alpha > 0) { projectile.alpha -= 25; @@ -68,9 +58,19 @@ namespace CalamityMod.Projectiles.Boss projectile.alpha = 0; } - if (projectile.timeLeft > 120 && projectile.ai[1] == 1f) + if (projectile.timeLeft > 135 && projectile.ai[1] == 1f) return; + float num953 = revenge ? 110f : 100f; + float num954 = 40f; + float scaleFactor12 = revenge ? 50f : 40f; + + if (projectile.ai[1] == 1f) + { + num953 *= 0.7f; + scaleFactor12 *= 0.7f; + } + int num959 = (int)projectile.ai[0]; if (num959 >= 0 && Main.player[num959].active && !Main.player[num959].dead) { diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 74a0e0b614..6df3f39e6f 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { DisplayName.SetDefault("Frost Mist"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.TrailCacheLength[projectile.type] = 4; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } diff --git a/Projectiles/Boss/FrostMist.png b/Projectiles/Boss/FrostMist.png index 8349afb42d..ef17040dd0 100644 Binary files a/Projectiles/Boss/FrostMist.png and b/Projectiles/Boss/FrostMist.png differ diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 920c6f23d6..eb6db64052 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 30; projectile.height = 30; - projectile.friendly = true; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.alpha = 255; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] < 80f) + if (projectile.ai[0] < 240f) { projectile.ai[0] += 1f; @@ -41,14 +41,15 @@ namespace CalamityMod.Projectiles.Boss } bool expertMode = Main.expertMode; - projectile.velocity *= 1.01f; - int num487 = Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) + if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.01f; + + projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); + int num487 = (int)projectile.ai[1]; + float num491 = Vector2.Distance(Main.player[num487].Center, projectile.Center); + + if (num491 < 50f && !Main.player[num487].dead && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) { int num492 = expertMode ? -150 : -100; if (CalamityWorld.death || CalamityWorld.bossRushActive) @@ -66,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss { Main.player[num487].KillMe(PlayerDeathReason.ByCustomReason(Main.player[Main.myPlayer].name + " burst into sinless ash."), 1000.0, 0, false); } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492); projectile.Kill(); } } diff --git a/Projectiles/Boss/HolyLight.cs b/Projectiles/Boss/HolyLight.cs index a43f292c80..a90f4bd63f 100644 --- a/Projectiles/Boss/HolyLight.cs +++ b/Projectiles/Boss/HolyLight.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 20; projectile.height = 20; - projectile.friendly = true; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.alpha = 255; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - if (projectile.ai[0] < 80f) + if (projectile.ai[0] < 240f) { projectile.ai[0] += 1f; @@ -37,13 +37,15 @@ namespace CalamityMod.Projectiles.Boss } bool expertMode = Main.expertMode; - projectile.velocity *= 1.01f; - int num487 = Player.FindClosest(projectile.position, projectile.width, projectile.height); - Vector2 vector36 = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f); - float num489 = Main.player[num487].Center.X - vector36.X; - float num490 = Main.player[num487].Center.Y - vector36.Y; - float num491 = (float)Math.Sqrt(num489 * num489 + num490 * num490); - if (num491 < 50f && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) + + if (projectile.velocity.Length() < 16f) + projectile.velocity *= 1.01f; + + projectile.ai[1] = Player.FindClosest(projectile.position, projectile.width, projectile.height); + int num487 = (int)projectile.ai[1]; + float num491 = Vector2.Distance(Main.player[num487].Center, projectile.Center); + + if (num491 < 50f && !Main.player[num487].dead && projectile.position.X < Main.player[num487].position.X + Main.player[num487].width && projectile.position.X + projectile.width > Main.player[num487].position.X && projectile.position.Y < Main.player[num487].position.Y + Main.player[num487].height && projectile.position.Y + projectile.height > Main.player[num487].position.Y) { int num492 = expertMode ? 50 : 35; Main.player[num487].HealEffect(num492, false); @@ -52,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss { Main.player[num487].statLife = Main.player[num487].statLifeMax2; } - NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SpiritHeal, -1, -1, null, num487, num492); projectile.Kill(); } } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index d96878a30d..96a616128f 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -16,7 +16,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 20; projectile.height = 20; - projectile.hostile = true; + projectile.scale = 1.5f; + projectile.hostile = true; projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; @@ -25,7 +26,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.01f / 255f, (255 - projectile.alpha) * 0.15f / 255f, (255 - projectile.alpha) * 0.05f / 255f); + Lighting.AddLight(projectile.Center, 0f, 0.15f, 0f); bool flag15 = false; bool flag16 = false; if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) @@ -61,12 +62,12 @@ namespace CalamityMod.Projectiles.Boss num461 *= 0.7f; projectile.ai[0] += 4f; int num462 = 0; - while ((float)num462 < num461) + while (num462 < num461) { - float num463 = (float)Main.rand.Next(-10, 11); - float num464 = (float)Main.rand.Next(-10, 11); - float num465 = (float)Main.rand.Next(3, 9); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); + float num463 = Main.rand.Next(-10, 11); + float num464 = Main.rand.Next(-10, 11); + float num465 = Main.rand.Next(3, 9); + float num466 = (float)Math.Sqrt(num463 * num463 + num464 * num464); num466 = num465 / num466; num463 *= num466; num464 *= num466; @@ -75,9 +76,9 @@ namespace CalamityMod.Projectiles.Boss Main.dust[num467].position.X = projectile.Center.X; Main.dust[num467].position.Y = projectile.Center.Y; Dust expr_149DF_cp_0 = Main.dust[num467]; - expr_149DF_cp_0.position.X += (float)Main.rand.Next(-10, 11); + expr_149DF_cp_0.position.X += Main.rand.Next(-10, 11); Dust expr_14A09_cp_0 = Main.dust[num467]; - expr_14A09_cp_0.position.Y += (float)Main.rand.Next(-10, 11); + expr_14A09_cp_0.position.Y += Main.rand.Next(-10, 11); Main.dust[num467].velocity.X = num463; Main.dust[num467].velocity.Y = num464; num462++; diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index b7a4a8a5d7..9355b50714 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -17,7 +17,8 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 10; projectile.height = 10; - projectile.hostile = true; + projectile.scale = 1.5f; + projectile.hostile = true; projectile.penetrate = -1; projectile.tileCollide = false; projectile.timeLeft = 300; @@ -28,9 +29,9 @@ namespace CalamityMod.Projectiles.Boss if (projectile.position.Y > projectile.ai[1]) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; - int num123 = (int)Player.FindClosest(projectile.Center, 1, 1); + int num123 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[0] += 1f; if (projectile.ai[0] < 110f && projectile.ai[0] > 30f) { @@ -61,13 +62,13 @@ namespace CalamityMod.Projectiles.Boss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, (float)(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow").Height / Main.projFrames[projectile.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathGlow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.png b/Projectiles/Boss/PlagueStingerGoliath.png index 1d5914c74b..0c8fd55607 100644 Binary files a/Projectiles/Boss/PlagueStingerGoliath.png and b/Projectiles/Boss/PlagueStingerGoliath.png differ diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index 46be68fdc6..dd2f44e3bc 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Boss { projectile.width = 10; projectile.height = 10; + projectile.scale = 1.5f; projectile.hostile = true; projectile.penetrate = -1; projectile.extraUpdates = 2; @@ -30,7 +31,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.position.Y > projectile.ai[1]) projectile.tileCollide = true; - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) @@ -46,13 +47,13 @@ namespace CalamityMod.Projectiles.Boss spriteEffects = SpriteEffects.FlipHorizontally; } Vector2 center = new Vector2(projectile.Center.X, projectile.Center.Y); - Vector2 vector11 = new Vector2((float)(Main.projectileTexture[projectile.type].Width / 2), (float)(Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2)); + Vector2 vector11 = new Vector2(Main.projectileTexture[projectile.type].Width / 2, Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type] / 2); Vector2 vector = center - Main.screenPosition; - vector -= new Vector2((float)ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, (float)(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type])) * 1f / 2f; + vector -= new Vector2(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Width, ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow").Height / Main.projFrames[projectile.type]) * 1f / 2f; vector += vector11 * 1f + new Vector2(0f, 0f + 4f + projectile.gfxOffY); - Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Red); + Color color = new Color(127 - projectile.alpha, 127 - projectile.alpha, 127 - projectile.alpha, 0).MultiplyRGBA(Color.Red); Main.spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Boss/PlagueStingerGoliathV2Glow"), vector, - null, color, projectile.rotation, vector11, 1f, spriteEffects, 0f); + null, color, projectile.rotation, vector11, projectile.scale, spriteEffects, 0f); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index a1751ddb0b..5680c48c3d 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -48,9 +48,6 @@ namespace CalamityMod.Projectiles.Boss return; } - if (!Main.dayTime) - projectile.timeLeft -= CalamityWorld.death ? 9 : 16; - projectile.position.X = Main.player[projectile.owner].Center.X - (projectile.width / 2); projectile.position.Y = Main.player[projectile.owner].Center.Y - (projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 360f; if (Main.player[projectile.owner].gravDir == -1f) diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 1c4e00283e..c9894eee49 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss projectile.frame = 0; } - projectile.velocity *= 0.99f; + projectile.velocity *= 0.995f; if (projectile.timeLeft < 180) { diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 8aa5ed76aa..6858829227 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - projectile.width = 26; + projectile.width = 24; projectile.height = 58; projectile.hostile = true; projectile.penetrate = -1; diff --git a/Projectiles/Boss/SirenSong.png b/Projectiles/Boss/SirenSong.png index 418fb2622c..af5f7c5eb7 100644 Binary files a/Projectiles/Boss/SirenSong.png and b/Projectiles/Boss/SirenSong.png differ diff --git a/Projectiles/Boss/WaterSpear.png b/Projectiles/Boss/WaterSpear.png index b923a9ea8b..a50659774e 100644 Binary files a/Projectiles/Boss/WaterSpear.png and b/Projectiles/Boss/WaterSpear.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 322ec663d5..0c81e3402a 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -52,9 +52,10 @@ namespace CalamityMod.Projectiles public float spawnedPlayerMinionDamageValue = 1f; public int spawnedPlayerMinionProjectileDamageValue = 0; public int defDamage = 0; + public int defCrit = 0; - // Rogue Stuff - public bool stealthStrike = false; //Update all existing rogue weapons with this + // Rogue Stuff + public bool stealthStrike = false; //Update all existing rogue weapons with this public bool momentumCapacitatorBoost = false; //Constant acceleration // Iron Heart @@ -84,6 +85,18 @@ namespace CalamityMod.Projectiles switch (projectile.type) { + case ProjectileID.ShadowBeamHostile: + projectile.timeLeft = 60; + break; + + case ProjectileID.LostSoulHostile: + projectile.tileCollide = true; + break; + + case ProjectileID.NebulaLaser: + projectile.extraUpdates = 1; + break; + case ProjectileID.StarWrath: projectile.penetrate = projectile.maxPenetrate = 1; break; @@ -996,7 +1009,25 @@ namespace CalamityMod.Projectiles #region PostAI public override void PostAI(Projectile projectile) { - int x = (int)(projectile.Center.X / 16f); + Player player = Main.player[projectile.owner]; + CalamityPlayer modPlayer = player.Calamity(); + + // Set crit here to avoid issues with projectiles that change class types in PreAI and AI + if (defCrit == 0 && !projectile.npcProj && !projectile.trap) + { + if (projectile.melee) + defCrit = modPlayer.critStats[0]; + else if (projectile.ranged) + defCrit = modPlayer.critStats[1]; + else if (projectile.magic) + defCrit = modPlayer.critStats[2]; + else if (rogue) + defCrit = modPlayer.critStats[3]; + else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) + defCrit = 4; + } + + int x = (int)(projectile.Center.X / 16f); int y = (int)(projectile.Center.Y / 16f); for (int i = x - 1; i <= x + 1; i++) { @@ -1030,41 +1061,40 @@ namespace CalamityMod.Projectiles Player player = Main.player[projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap && rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) - crit = true; - // Super dummies have nearly 10 million max HP (which is used in damage calculations). // This can very easily cause damage numbers that are unrealistic for the weapon. // As a result, they are omitted in this code. if (!target.boss && target.type != NPCType()) { - if (target.HitSound != SoundID.NPCHit1 && target.HitSound != SoundID.NPCHit6 && target.HitSound != SoundID.NPCHit7 && - target.HitSound != SoundID.NPCHit8 && target.HitSound != SoundID.NPCHit9 && target.HitSound != SoundID.NPCHit12 && - target.HitSound != SoundID.NPCHit13 && target.HitSound != SoundID.NPCHit14 && target.HitSound != SoundID.NPCHit18 && - target.HitSound != SoundID.NPCHit19 && target.HitSound != SoundID.NPCHit20 && target.HitSound != SoundID.NPCHit21 && - target.HitSound != SoundID.NPCHit22 && target.HitSound != SoundID.NPCHit23 && target.HitSound != SoundID.NPCHit24 && - target.HitSound != SoundID.NPCHit25 && target.HitSound != SoundID.NPCHit26 && target.HitSound != SoundID.NPCHit27 && - target.HitSound != SoundID.NPCHit28 && target.HitSound != SoundID.NPCHit29 && target.HitSound != SoundID.NPCHit31 && - target.HitSound != SoundID.NPCHit32 && target.HitSound != SoundID.NPCHit33 && target.HitSound != SoundID.NPCHit35 && - target.HitSound != SoundID.NPCHit37 && target.HitSound != SoundID.NPCHit38 && target.HitSound != SoundID.NPCHit40 && - target.HitSound != SoundID.NPCHit43 && target.HitSound != SoundID.NPCHit44 && target.HitSound != SoundID.NPCHit45 && - target.HitSound != SoundID.NPCHit46 && target.HitSound != SoundID.NPCHit47 && target.HitSound != SoundID.NPCHit48 && - target.HitSound != SoundID.NPCHit50 && target.HitSound != SoundID.NPCHit51 && target.HitSound != SoundID.NPCHit55 && - target.HitSound != SoundID.NPCHit56 && target.HitSound != SoundID.NPCHit57 && hasInorganicEnemyHitBoost) + if (target.Inorganic() && hasInorganicEnemyHitBoost) { damage += (int)(target.lifeMax * inorganicEnemyHitBoost); inorganicEnemyHitEffect?.Invoke(target); } - if (target.HitSound != SoundID.NPCHit4 && target.HitSound != SoundID.NPCHit41 && target.HitSound != SoundID.NPCHit2 && - target.HitSound != SoundID.NPCHit5 && target.HitSound != SoundID.NPCHit11 && target.HitSound != SoundID.NPCHit30 && - target.HitSound != SoundID.NPCHit34 && target.HitSound != SoundID.NPCHit36 && target.HitSound != SoundID.NPCHit42 && - target.HitSound != SoundID.NPCHit49 && target.HitSound != SoundID.NPCHit52 && target.HitSound != SoundID.NPCHit53 && - target.HitSound != SoundID.NPCHit54 && target.HitSound != null && hasOrganicEnemyHitBoost) + if (target.Organic() && hasOrganicEnemyHitBoost) { damage += (int)(target.lifeMax * organicEnemyHitBoost); organicEnemyHitEffect?.Invoke(target); } } + + if (projectile.owner == Main.myPlayer && !projectile.npcProj && !projectile.trap) + { + int critMax = 100; + int critChance = (int)MathHelper.Clamp(defCrit, 1, critMax); + crit = Main.rand.Next(1, critMax + 1) <= critChance; + + if ((uint)(projectile.type - ProjectileID.DD2LightningAuraT1) <= 2u) + { + if (player.setMonkT3) + crit = Main.rand.NextBool(4); + else if (player.setMonkT2) + crit = Main.rand.NextBool(6); + } + + if (rogue && stealthStrike && modPlayer.stealthStrikeAlwaysCrits) + crit = true; + } } #endregion @@ -1150,8 +1180,6 @@ namespace CalamityMod.Projectiles if (Main.player[Main.myPlayer].lifeSteal > 0f && target.canGhostHeal && target.type != NPCID.TargetDummy && target.type != NPCType() && !player.moonLeech) { - // Commented out for now to test the global life steal nerf - /* // Increases the degree to which Spectre Healing set contributes to the lifesteal cap if (player.ghostHeal) { @@ -1167,13 +1195,12 @@ namespace CalamityMod.Projectiles // Increases the degree to which Vampire Knives contribute to the lifesteal cap if (projectile.type == ProjectileID.VampireKnife) { - float num = damage * 0.0375f; + float num = damage * 0.075f; if (num < 0f) num = 0f; Main.player[Main.myPlayer].lifeSteal -= num; } - */ if (modPlayer.vampiricTalisman && rogue && crit) { @@ -1194,10 +1221,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.025f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 3f); } else if (modPlayer.silvaSet) { @@ -1205,10 +1235,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.015f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 3f); } else if (projectile.magic) { @@ -1218,10 +1251,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.015f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); } else if (modPlayer.tarraMage) { @@ -1233,6 +1269,9 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; @@ -1251,10 +1290,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult; + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); } else if (modPlayer.manaOverloader) { @@ -1262,10 +1304,13 @@ namespace CalamityMod.Projectiles healMult -= projectile.numHits * 0.05f; float heal = projectile.damage * healMult * (player.statMana / (float)player.statManaMax2); + if (heal > 50) + heal = 50; + if (!CanSpawnLifeStealProjectile(projectile, healMult, heal)) goto OTHEREFFECTS; - SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 1.5f); + SpawnLifeStealProjectile(projectile, player, heal, ProjectileType(), 1200f, 2f); } } } @@ -1466,6 +1511,22 @@ namespace CalamityMod.Projectiles } } + if (modPlayer.titanHeartSet && stealthStrike && modPlayer.titanCooldown <= 0) + { + int dmg = (int)(85 + (projectile.damage * 0.05f)); + int boom = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ProjectileType(), dmg, projectile.knockBack, projectile.owner, 0f, 0f); + Main.projectile[boom].Calamity().forceRogue = true; + Main.PlaySound(SoundID.Item14, projectile.position); + for (int dustexplode = 0; dustexplode < 360; dustexplode++) + { + Vector2 dustd = new Vector2(17f, 17f).RotatedBy(MathHelper.ToRadians(dustexplode)); + int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(), dustd.X, dustd.Y, 100, default, 3f); + Main.dust[d].noGravity = true; + Main.dust[d].position = projectile.Center; + } + modPlayer.titanCooldown = 15; + } + if (modPlayer.corrosiveSpine && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType()) { for (int i = 0; i < 3; i++) diff --git a/Projectiles/Healing/XerocHealOrb.cs b/Projectiles/Healing/XerocHealOrb.cs index c5d09d22e5..4c9f4ecb0a 100644 --- a/Projectiles/Healing/XerocHealOrb.cs +++ b/Projectiles/Healing/XerocHealOrb.cs @@ -26,11 +26,14 @@ namespace CalamityMod.Projectiles.Healing projectile.HealingProjectile((int)projectile.ai[1], (int)projectile.ai[0], 5.5f, 15f); float num498 = projectile.velocity.X * 0.2f; float num499 = -(projectile.velocity.Y * 0.2f); - int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num500]; - dust.noGravity = true; - dust.position.X -= num498; - dust.position.Y -= num499; + if (projectile.timeLeft % 2 == 0) + { + int num500 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[num500]; + dust.noGravity = true; + dust.position.X -= num498; + dust.position.Y -= num499; + } } } } diff --git a/Projectiles/Healing/XerocHealOrb.png b/Projectiles/Healing/XerocHealOrb.png index 15e8775737..c1fdbf1381 100644 Binary files a/Projectiles/Healing/XerocHealOrb.png and b/Projectiles/Healing/XerocHealOrb.png differ diff --git a/Projectiles/Hybrid/KelvinCatalystBoomerang.png b/Projectiles/Hybrid/KelvinCatalystBoomerang.png index 1d6c440160..86a074d801 100644 Binary files a/Projectiles/Hybrid/KelvinCatalystBoomerang.png and b/Projectiles/Hybrid/KelvinCatalystBoomerang.png differ diff --git a/Projectiles/Magic/AtlantisSpear.png b/Projectiles/Magic/AtlantisSpear.png index 122a12fd18..626938fb51 100644 Binary files a/Projectiles/Magic/AtlantisSpear.png and b/Projectiles/Magic/AtlantisSpear.png differ diff --git a/Projectiles/Magic/BrimstoneTentacle.cs b/Projectiles/Magic/BrimstoneTentacle.cs index 80915bf57b..02c463fd8f 100644 --- a/Projectiles/Magic/BrimstoneTentacle.cs +++ b/Projectiles/Magic/BrimstoneTentacle.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.localAI[1]++; if (projectile.velocity.X != projectile.velocity.X) { if (Math.Abs(projectile.velocity.X) < 1f) @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = projectile.width; projectile.position.X = center10.X - (float)(projectile.width / 2); projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + if (projectile.localAI[0] < 0.1f) { projectile.localAI[0] += 0.01f; } @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic } projectile.ai[0] *= 1.05f; projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + if (projectile.scale < 1f && projectile.localAI[1] > 5f) { int num897 = 0; while ((float)num897 < projectile.scale * 10f) diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 450e3a9de4..3cd1698c27 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { + projectile.localAI[1]++; if (projectile.velocity.X != projectile.velocity.X) { if (Math.Abs(projectile.velocity.X) < 1f) @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = projectile.width; projectile.position.X = center10.X - (float)(projectile.width / 2); projectile.position.Y = center10.Y - (float)(projectile.height / 2); - if ((double)projectile.localAI[0] < 0.1) + if (projectile.localAI[0] < 0.1f) { projectile.localAI[0] += 0.01f; } @@ -74,12 +75,12 @@ namespace CalamityMod.Projectiles.Magic } projectile.ai[0] *= 1.05f; projectile.ai[1] *= 1.05f; - if (projectile.scale < 1f) + if (projectile.scale < 1f && projectile.localAI[1] > 5f) { int num897 = 0; while ((float)num897 < projectile.scale * 10f) { - int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); + int num898 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, projectile.velocity.X, projectile.velocity.Y, 100, default, 1.1f); Main.dust[num898].position = (Main.dust[num898].position + projectile.Center) / 2f; Main.dust[num898].noGravity = true; Main.dust[num898].velocity *= 0.1f; diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs index cfbd639b34..8139dc9f72 100644 --- a/Projectiles/Magic/FabBolt.cs +++ b/Projectiles/Magic/FabBolt.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Magic projectile.height = 4; projectile.extraUpdates = 100; projectile.friendly = true; - projectile.timeLeft = 90; + projectile.timeLeft = 45; projectile.magic = true; } @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Magic Main.dust[num448].position = vector33; Main.dust[num448].noGravity = true; Main.dust[num448].noLight = true; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.1f; } } diff --git a/Projectiles/Magic/FabOrb.cs b/Projectiles/Magic/FabOrb.cs index 7ffb1f294b..4d13216330 100644 --- a/Projectiles/Magic/FabOrb.cs +++ b/Projectiles/Magic/FabOrb.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Magic projectile.friendly = true; projectile.alpha = 255; projectile.penetrate = -1; - projectile.timeLeft = 300; + projectile.timeLeft = 30; projectile.magic = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 300f, 6f, 24f, 5, ModContent.ProjectileType()); + CalamityGlobalProjectile.MagnetSphereHitscan(projectile, 150f, 6f, 6f, 2, ModContent.ProjectileType()); } } } diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs index 55c9ed27ad..0e52433323 100644 --- a/Projectiles/Magic/FabRay.cs +++ b/Projectiles/Magic/FabRay.cs @@ -25,9 +25,8 @@ namespace CalamityMod.Projectiles.Magic public override void AI() { - Lighting.AddLight(projectile.Center, 0.2f, 0.01f, 0.1f); projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 9f && projectile.owner == Main.myPlayer) + if (projectile.localAI[1] >= 6f && projectile.owner == Main.myPlayer) { projectile.localAI[1] = 0f; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); @@ -39,12 +38,12 @@ namespace CalamityMod.Projectiles.Magic for (int num447 = 0; num447 < 2; num447++) { Vector2 vector33 = projectile.position; - vector33 -= projectile.velocity * ((float)num447 * 0.25f); - int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1.25f); + vector33 -= projectile.velocity * (num447 * 0.25f); + int num448 = Dust.NewDust(vector33, 1, 1, 234, 0f, 0f, 0, default, 1f); Main.dust[num448].noGravity = true; Main.dust[num448].noLight = true; Main.dust[num448].position = vector33; - Main.dust[num448].scale = (float)Main.rand.Next(70, 110) * 0.013f; + Main.dust[num448].scale = Main.rand.Next(70, 110) * 0.013f; Main.dust[num448].velocity *= 0.1f; } } diff --git a/Projectiles/Magic/SirensSongNote.png b/Projectiles/Magic/SirensSongNote.png index 2ec8ea38c0..e323ebc6e3 100644 Binary files a/Projectiles/Magic/SirensSongNote.png and b/Projectiles/Magic/SirensSongNote.png differ diff --git a/Projectiles/Melee/BallOFuguProj.png b/Projectiles/Melee/BallOFuguProj.png index f4673a0825..ca90c057a0 100644 Binary files a/Projectiles/Melee/BallOFuguProj.png and b/Projectiles/Melee/BallOFuguProj.png differ diff --git a/Projectiles/Melee/ChaosFlameSmall.cs b/Projectiles/Melee/ChaosFlameSmall.cs index 2c334e743c..4cba2dbd61 100644 --- a/Projectiles/Melee/ChaosFlameSmall.cs +++ b/Projectiles/Melee/ChaosFlameSmall.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Melee { projectile.frame = 0; } - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X); + projectile.rotation = projectile.velocity.ToRotation(); Lighting.AddLight(projectile.Center, 0.4f, 0f, 0f); if (Main.rand.NextBool(4)) { diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.cs b/Projectiles/Melee/MeldGreatswordBigProjectile.cs new file mode 100644 index 0000000000..ebbeb8d830 --- /dev/null +++ b/Projectiles/Melee/MeldGreatswordBigProjectile.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MeldGreatswordBigProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.melee = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = 1f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Melee/MeldGreatswordBigProjectile.png b/Projectiles/Melee/MeldGreatswordBigProjectile.png new file mode 100644 index 0000000000..d2e1ad5ddb Binary files /dev/null and b/Projectiles/Melee/MeldGreatswordBigProjectile.png differ diff --git a/Projectiles/Melee/PlasmaBall.cs b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs similarity index 74% rename from Projectiles/Melee/PlasmaBall.cs rename to Projectiles/Melee/MeldGreatswordMediumProjectile.cs index fd5f2a8405..0c511c7c71 100644 --- a/Projectiles/Melee/PlasmaBall.cs +++ b/Projectiles/Melee/MeldGreatswordMediumProjectile.cs @@ -1,15 +1,18 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class PlasmaBall : ModProjectile + public class MeldGreatswordMediumProjectile : ModProjectile { public override void SetStaticDefaults() { - DisplayName.SetDefault("Ball"); + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; } public override void SetDefaults() @@ -24,6 +27,7 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { + projectile.rotation = projectile.velocity.ToRotation(); Vector2 value7 = new Vector2(6f, 12f); projectile.localAI[0] += 1f; if (projectile.localAI[0] == 48f) @@ -50,5 +54,11 @@ namespace CalamityMod.Projectiles.Melee CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } } } diff --git a/Projectiles/Melee/MeldGreatswordMediumProjectile.png b/Projectiles/Melee/MeldGreatswordMediumProjectile.png new file mode 100644 index 0000000000..90aede20e7 Binary files /dev/null and b/Projectiles/Melee/MeldGreatswordMediumProjectile.png differ diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.cs b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs new file mode 100644 index 0000000000..c472068f63 --- /dev/null +++ b/Projectiles/Melee/MeldGreatswordSmallProjectile.cs @@ -0,0 +1,64 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MeldGreatswordSmallProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bolt"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 10; + ProjectileID.Sets.TrailingMode[projectile.type] = 1; + } + + public override void SetDefaults() + { + projectile.width = 8; + projectile.height = 8; + projectile.friendly = true; + projectile.penetrate = 1; + projectile.melee = true; + projectile.timeLeft = 600; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation(); + Vector2 value7 = new Vector2(6f, 12f); + projectile.localAI[0] += 1f; + if (projectile.localAI[0] == 48f) + { + projectile.localAI[0] = 0f; + } + else + { + for (int num41 = 0; num41 < 2; num41++) + { + Vector2 value8 = Vector2.UnitX * -15f; + value8 = -Vector2.UnitY.RotatedBy((double)(projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7; + int num42 = Dust.NewDust(projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f); + Main.dust[num42].scale = 1f; + Main.dust[num42].noGravity = true; + Main.dust[num42].position = projectile.Center + value8; + Main.dust[num42].velocity = projectile.velocity; + } + } + + int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 27, 0f, 0f, 100, default, 0.8f); + Main.dust[num458].noGravity = true; + Main.dust[num458].velocity *= 0f; + + CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 12f, 20f); + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2); + return false; + } + } +} diff --git a/Projectiles/Melee/MeldGreatswordSmallProjectile.png b/Projectiles/Melee/MeldGreatswordSmallProjectile.png new file mode 100644 index 0000000000..7930994094 Binary files /dev/null and b/Projectiles/Melee/MeldGreatswordSmallProjectile.png differ diff --git a/Projectiles/Melee/PlasmaBall.png b/Projectiles/Melee/PlasmaBall.png deleted file mode 100644 index 139ef2e822..0000000000 Binary files a/Projectiles/Melee/PlasmaBall.png and /dev/null differ diff --git a/Projectiles/Melee/ProfanedSwordProj.cs b/Projectiles/Melee/ProfanedSwordProj.cs index dbaef5da37..3e8e17d725 100644 --- a/Projectiles/Melee/ProfanedSwordProj.cs +++ b/Projectiles/Melee/ProfanedSwordProj.cs @@ -30,14 +30,14 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + MathHelper.ToRadians(45f); if (Main.rand.NextBool(4)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, (int)CalamityDusts.Brimstone, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.spriteDirection == -1) { - projectile.rotation -= 1.57f; + projectile.rotation -= MathHelper.ToRadians(90f); } } diff --git a/Projectiles/Melee/ProfanedSwordProj.png b/Projectiles/Melee/ProfanedSwordProj.png index 0967c869b9..36dfb30fbe 100644 Binary files a/Projectiles/Melee/ProfanedSwordProj.png and b/Projectiles/Melee/ProfanedSwordProj.png differ diff --git a/Projectiles/Pets/SirenFlopping.png b/Projectiles/Pets/SirenFlopping.png deleted file mode 100644 index 62bcb652ae..0000000000 Binary files a/Projectiles/Pets/SirenFlopping.png and /dev/null differ diff --git a/Projectiles/Pets/SirenYoung.cs b/Projectiles/Pets/SirenYoung.cs index 0e59557428..ea4a75c9bf 100644 --- a/Projectiles/Pets/SirenYoung.cs +++ b/Projectiles/Pets/SirenYoung.cs @@ -11,11 +11,13 @@ namespace CalamityMod.Projectiles.Pets public class SirenYoung : ModProjectile { private bool underwater = false; + private int sleepyTimer = 0; + private int lightLevel = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Siren"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 17; Main.projPet[projectile.type] = true; ProjectileID.Sets.LightPet[projectile.type] = true; } @@ -23,12 +25,13 @@ namespace CalamityMod.Projectiles.Pets public override void SetDefaults() { projectile.netImportant = true; - projectile.width = 30; - projectile.height = 30; + projectile.width = 38; + projectile.height = 58; projectile.friendly = true; projectile.penetrate = -1; projectile.timeLeft *= 5; projectile.ignoreWater = true; + projectile.tileCollide = false; } public override void AI() @@ -48,325 +51,91 @@ namespace CalamityMod.Projectiles.Pets { projectile.timeLeft = 2; } - projectile.frameCounter++; - if (projectile.frameCounter > 6) - { - projectile.frame++; - projectile.frameCounter = 0; - } - if (projectile.frame > 3) - { - projectile.frame = 0; - } - underwater = Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) || modPlayer.leviathanAndSirenLore; + if (sleepyTimer < 180) + { + projectile.frameCounter++; + if (projectile.frameCounter > 6) + { + projectile.frame++; + projectile.frameCounter = 0; + } + } + if (underwater) + { + if (projectile.frame >= 8) + { + projectile.frame = 0; + } + } + else + { + if (projectile.frame >= 16) + { + projectile.frame = sleepyTimer >= 180 ? 16 : 8; + } + } + underwater = player.IsUnderwater() || modPlayer.leviathanAndSirenLore; if (underwater) { - projectile.width = 30; - projectile.height = 30; + if (projectile.frame == 16) + projectile.frame = 0; + if (sleepyTimer > 0) + sleepyTimer--; if (projectile.localAI[0] == 0f) { - Lighting.AddLight(projectile.Center, 2.5f, 2f, 0f); //4.5 + lightLevel = 0; } else { - Lighting.AddLight(projectile.Center, 1.65f, 1.32f, 0f); //3 + lightLevel = 1; } } - else - { - projectile.width = 54; - projectile.height = 54; - Lighting.AddLight(projectile.Center, 0.825f, 0.66f, 0f); //1.5 - Vector2 vector54 = player.Center; - vector54.X -= (float)((15 + player.width / 2) * player.direction); - vector54.X -= (float)(40 * player.direction); - if (projectile.ai[0] == 1f) - { - projectile.tileCollide = false; - float num663 = 0.2f; - float num664 = 10f; - int num665 = 200; - if (num664 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num664 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - } - Vector2 vector58 = vector54 - projectile.Center; - float num666 = vector58.Length(); - if (num666 > 2000f) - { - projectile.position = player.Center - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - if (num666 < (float)num665 && player.velocity.Y == 0f && projectile.position.Y + (float)projectile.height <= player.position.Y + (float)player.height && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.ai[0] = 0f; - projectile.netUpdate = true; - if (projectile.velocity.Y < -6f) - { - projectile.velocity.Y = -6f; - } - } - if (num666 >= 60f) - { - vector58.Normalize(); - vector58 *= num664; - if (projectile.velocity.X < vector58.X) - { - projectile.velocity.X = projectile.velocity.X + num663; - if (projectile.velocity.X < 0f) - { - projectile.velocity.X = projectile.velocity.X + num663 * 1.5f; - } - } - if (projectile.velocity.X > vector58.X) - { - projectile.velocity.X = projectile.velocity.X - num663; - if (projectile.velocity.X > 0f) - { - projectile.velocity.X = projectile.velocity.X - num663 * 1.5f; - } - } - if (projectile.velocity.Y < vector58.Y) - { - projectile.velocity.Y = projectile.velocity.Y + num663; - if (projectile.velocity.Y < 0f) - { - projectile.velocity.Y = projectile.velocity.Y + num663 * 1.5f; - } - } - if (projectile.velocity.Y > vector58.Y) - { - projectile.velocity.Y = projectile.velocity.Y - num663; - if (projectile.velocity.Y > 0f) - { - projectile.velocity.Y = projectile.velocity.Y - num663 * 1.5f; - } - } - } - if (projectile.velocity.X != 0f) - { - projectile.spriteDirection = Math.Sign(projectile.velocity.X); - } - } - if (projectile.ai[0] == 2f) - { - projectile.friendly = true; - projectile.spriteDirection = projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } - projectile.ai[1] -= 1f; - if (projectile.ai[1] <= 0f) - { - projectile.ai[1] = 0f; - projectile.ai[0] = 0f; - projectile.friendly = false; - projectile.netUpdate = true; - return; - } - } - if (projectile.ai[0] == 0f) - { - float num671 = 200f; - if (player.rocketDelay2 > 0) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - } - Vector2 vector59 = vector54 - projectile.Center; - if (vector59.Length() > 2000f) - { - projectile.position = vector54 - new Vector2((float)projectile.width, (float)projectile.height) / 2f; - } - else if (vector59.Length() > num671 || Math.Abs(vector59.Y) > 300f) - { - projectile.ai[0] = 1f; - projectile.netUpdate = true; - if (projectile.velocity.Y > 0f && vector59.Y < 0f) - { - projectile.velocity.Y = 0f; - } - if (projectile.velocity.Y < 0f && vector59.Y > 0f) - { - projectile.velocity.Y = 0f; - } - } - projectile.tileCollide = true; - float num672 = 0.5f; - float num673 = 4f; - float num674 = 4f; - float num675 = 0.1f; - if (num674 < Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y)) - { - num674 = Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y); - num672 = 0.7f; - } - int num676 = 0; - bool flag29 = false; - float num677 = vector54.X - projectile.Center.X; - if (Math.Abs(num677) > 5f) - { - if (num677 < 0f) - { - num676 = -1; - if (projectile.velocity.X > -num673) - { - projectile.velocity.X = projectile.velocity.X - num672; - } - else - { - projectile.velocity.X = projectile.velocity.X - num675; - } - } - else - { - num676 = 1; - if (projectile.velocity.X < num673) - { - projectile.velocity.X = projectile.velocity.X + num672; - } - else - { - projectile.velocity.X = projectile.velocity.X + num675; - } - } - flag29 = true; - } - else - { - projectile.velocity.X = projectile.velocity.X * 0.9f; - if (Math.Abs(projectile.velocity.X) < num672 * 2f) - { - projectile.velocity.X = 0f; - } - } - if (num676 != 0) - { - int num678 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - int num679 = (int)projectile.position.Y / 16; - num678 += num676; - num678 += (int)projectile.velocity.X; - int num3; - for (int num680 = num679; num680 < num679 + projectile.height / 16 + 1; num680 = num3 + 1) - { - if (WorldGen.SolidTile(num678, num680)) - { - flag29 = true; - } - num3 = num680; - } - } - if (projectile.velocity.X != 0f) - { - flag29 = true; - } - Collision.StepUp(ref projectile.position, ref projectile.velocity, projectile.width, projectile.height, ref projectile.stepSpeed, ref projectile.gfxOffY, 1, false, 0); - if (projectile.velocity.Y == 0f && flag29) - { - int num3; - for (int num681 = 0; num681 < 3; num681 = num3 + 1) - { - int num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - if (num681 == 0) - { - num682 = (int)projectile.position.X / 16; - } - if (num681 == 2) - { - num682 = (int)(projectile.position.X + (float)projectile.width) / 16; - } - int num683 = (int)(projectile.position.Y + (float)projectile.height) / 16; - if (WorldGen.SolidTile(num682, num683) || Main.tile[num682, num683].halfBrick() || Main.tile[num682, num683].slope() > 0 || (TileID.Sets.Platforms[(int)Main.tile[num682, num683].type] && Main.tile[num682, num683].active() && !Main.tile[num682, num683].inActive())) - { - try - { - num682 = (int)(projectile.position.X + (float)(projectile.width / 2)) / 16; - num683 = (int)(projectile.position.Y + (float)(projectile.height / 2)) / 16; - num682 += num676; - num682 += (int)projectile.velocity.X; - if (!WorldGen.SolidTile(num682, num683 - 1) && !WorldGen.SolidTile(num682, num683 - 2)) - { - projectile.velocity.Y = -5.1f; - } - else if (!WorldGen.SolidTile(num682, num683 - 2)) - { - projectile.velocity.Y = -7.1f; - } - else if (WorldGen.SolidTile(num682, num683 - 5)) - { - projectile.velocity.Y = -11.1f; - } - else if (WorldGen.SolidTile(num682, num683 - 4)) - { - projectile.velocity.Y = -10.1f; - } - else - { - projectile.velocity.Y = -9.1f; - } - } catch - { - projectile.velocity.Y = -9.1f; - } - } - num3 = num681; - } - } - if (projectile.velocity.X > num674) - { - projectile.velocity.X = num674; - } - if (projectile.velocity.X < -num674) - { - projectile.velocity.X = -num674; - } - if (projectile.velocity.X < 0f) - { - projectile.direction = -1; - } - if (projectile.velocity.X > 0f) - { - projectile.direction = 1; - } - if (projectile.velocity.X > num672 && num676 == 1) - { - projectile.direction = 1; - } - if (projectile.velocity.X < -num672 && num676 == -1) - { - projectile.direction = -1; - } - projectile.spriteDirection = projectile.direction; - projectile.velocity.Y = projectile.velocity.Y + 0.4f; - if (projectile.velocity.Y > 10f) - { - projectile.velocity.Y = 10f; - } - } - return; - } + else + { + if (sleepyTimer < 180) + { + sleepyTimer++; + lightLevel = 1; + } + else + { + lightLevel = 2; + projectile.frame = 16; + } + } + switch (lightLevel) + { + case 0: + Lighting.AddLight(projectile.Center, 0f, 2f, 2.5f); //4.5 + break; + case 1: + Lighting.AddLight(projectile.Center, 0f, 1.32f, 1.65f); //3 + break; + case 2: + Lighting.AddLight(projectile.Center, 0f, 0.5f, 0.7f); + break; + } + float num23 = 0.2f; float num24 = 5f; - projectile.tileCollide = false; Vector2 vector4 = new Vector2(projectile.position.X + (float)projectile.width * 0.5f, projectile.position.Y + (float)projectile.height * 0.5f); - float num25 = Main.player[projectile.owner].position.X + (float)(Main.player[projectile.owner].width / 2) - vector4.X; - float num26 = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].gfxOffY + (float)(Main.player[projectile.owner].height / 2) - vector4.Y; - if (Main.player[projectile.owner].controlLeft) + float num25 = player.position.X + (float)(player.width / 2) - vector4.X; + float num26 = player.position.Y + player.gfxOffY + (float)(player.height / 2) - vector4.Y; + if (player.controlLeft && sleepyTimer < 180) { num25 -= 120f; } - else if (Main.player[projectile.owner].controlRight) + else if (player.controlRight && sleepyTimer < 180) { num25 += 120f; } - if (Main.player[projectile.owner].controlDown) + if (player.controlDown && sleepyTimer < 180) { num26 += 120f; } else { - if (Main.player[projectile.owner].controlUp) + if (player.controlUp && sleepyTimer < 180) { num26 -= 120f; } @@ -375,12 +144,12 @@ namespace CalamityMod.Projectiles.Pets float num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); if (num27 > 1000f) { - projectile.position.X = projectile.position.X + num25; - projectile.position.Y = projectile.position.Y + num26; + projectile.position.X += num25; + projectile.position.Y += num26; } if (projectile.localAI[0] == 1f) { - if (num27 < 10f && Math.Abs(Main.player[projectile.owner].velocity.X) + Math.Abs(Main.player[projectile.owner].velocity.Y) < num24 && Main.player[projectile.owner].velocity.Y == 0f) + if (num27 < 10f && Math.Abs(player.velocity.X) + Math.Abs(player.velocity.Y) < num24 && player.velocity.Y == 0f) { projectile.localAI[0] = 0f; } @@ -396,11 +165,11 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity.X = num25 * num27; projectile.velocity.Y = num26 * num27; } - if ((double)projectile.velocity.X > 0.5) + if (projectile.velocity.X > 0.5f) { projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.5) + else if (projectile.velocity.X < -0.5f) { projectile.direction = 1; } @@ -412,11 +181,11 @@ namespace CalamityMod.Projectiles.Pets { projectile.localAI[0] = 1f; } - if ((double)projectile.velocity.X > 0.5) + if (projectile.velocity.X > 0.5f) { projectile.direction = -1; } - else if ((double)projectile.velocity.X < -0.5) + else if (projectile.velocity.X < -0.5f) { projectile.direction = 1; } @@ -432,14 +201,14 @@ namespace CalamityMod.Projectiles.Pets projectile.velocity *= 0f; num23 = 0f; } - projectile.direction = -Main.player[projectile.owner].direction; + projectile.direction = -player.direction; } num27 = num24 / num27; num25 *= num27; num26 *= num27; if (projectile.velocity.X < num25) { - projectile.velocity.X = projectile.velocity.X + num23; + projectile.velocity.X += num23; if (projectile.velocity.X < 0f) { projectile.velocity.X = projectile.velocity.X * 0.99f; @@ -447,7 +216,7 @@ namespace CalamityMod.Projectiles.Pets } if (projectile.velocity.X > num25) { - projectile.velocity.X = projectile.velocity.X - num23; + projectile.velocity.X -= num23; if (projectile.velocity.X > 0f) { projectile.velocity.X = projectile.velocity.X * 0.99f; @@ -455,7 +224,7 @@ namespace CalamityMod.Projectiles.Pets } if (projectile.velocity.Y < num26) { - projectile.velocity.Y = projectile.velocity.Y + num23; + projectile.velocity.Y += num23; if (projectile.velocity.Y < 0f) { projectile.velocity.Y = projectile.velocity.Y * 0.99f; @@ -463,7 +232,7 @@ namespace CalamityMod.Projectiles.Pets } if (projectile.velocity.Y > num26) { - projectile.velocity.Y = projectile.velocity.Y - num23; + projectile.velocity.Y -= num23; if (projectile.velocity.Y > 0f) { projectile.velocity.Y = projectile.velocity.Y * 0.99f; @@ -473,15 +242,6 @@ namespace CalamityMod.Projectiles.Pets { projectile.rotation = projectile.velocity.X * 0.05f; } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) - { - Texture2D texture = underwater ? Main.projectileTexture[projectile.type] : ModContent.GetTexture("CalamityMod/Projectiles/Pets/SirenFlopping"); - int height = (underwater ? Main.projectileTexture[projectile.type].Height : 256) / Main.projFrames[projectile.type]; - int frameHeight = height * projectile.frame; - Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameHeight, texture.Width, height)), projectile.GetAlpha(lightColor), projectile.rotation, new Vector2((float)texture.Width / 2f, (float)height / 2f), projectile.scale, SpriteEffects.None, 0f); - return false; - } + } } } diff --git a/Projectiles/Pets/SirenYoung.png b/Projectiles/Pets/SirenYoung.png index 41481d1dba..70e101e4e1 100644 Binary files a/Projectiles/Pets/SirenYoung.png and b/Projectiles/Pets/SirenYoung.png differ diff --git a/Projectiles/Ranged/ArcticArrowProj.cs b/Projectiles/Ranged/ArcticArrowProj.cs index 04652dbf92..ff3cf364b6 100644 --- a/Projectiles/Ranged/ArcticArrowProj.cs +++ b/Projectiles/Ranged/ArcticArrowProj.cs @@ -2,8 +2,8 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged { @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 67, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Ranged/ArcticArrowProj.png b/Projectiles/Ranged/ArcticArrowProj.png index e4023c5037..5fcacaa5de 100644 Binary files a/Projectiles/Ranged/ArcticArrowProj.png and b/Projectiles/Ranged/ArcticArrowProj.png differ diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 08fd53fe89..fc45b2f130 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -51,12 +51,12 @@ namespace CalamityMod.Projectiles.Ranged num296 = 0.75f; } projectile.ai[0] += 1f; - int num297 = 58; + int dustType = 62; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 77878e655d..c1549dff6d 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/ElysianArrowProj.png b/Projectiles/Ranged/ElysianArrowProj.png index bf8d18b65e..e0936c2556 100644 Binary files a/Projectiles/Ranged/ElysianArrowProj.png and b/Projectiles/Ranged/ElysianArrowProj.png differ diff --git a/Projectiles/Ranged/EssenceFire.cs b/Projectiles/Ranged/EssenceFire.cs index 0ef5baaf68..ff134707ac 100644 --- a/Projectiles/Ranged/EssenceFire.cs +++ b/Projectiles/Ranged/EssenceFire.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -50,12 +51,12 @@ namespace CalamityMod.Projectiles.Ranged num296 = 0.75f; } projectile.ai[0] += 1f; - int num297 = 173; + int dustType = (int)CalamityDusts.PurpleCosmolite; if (Main.rand.NextBool(2)) { for (int num298 = 0; num298 < 1; num298++) { - int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, num297, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); + int num299 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, dustType, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1f); Dust dust = Main.dust[num299]; if (Main.rand.NextBool(3)) { diff --git a/Projectiles/Ranged/NapalmArrowProj.cs b/Projectiles/Ranged/NapalmArrowProj.cs index dedd67315a..ff82a970b4 100644 --- a/Projectiles/Ranged/NapalmArrowProj.cs +++ b/Projectiles/Ranged/NapalmArrowProj.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(5)) { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 6, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); diff --git a/Projectiles/Ranged/NapalmArrowProj.png b/Projectiles/Ranged/NapalmArrowProj.png index 53fb0e274a..48ef48d4c4 100644 Binary files a/Projectiles/Ranged/NapalmArrowProj.png and b/Projectiles/Ranged/NapalmArrowProj.png differ diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs new file mode 100644 index 0000000000..1201e4a9ae --- /dev/null +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -0,0 +1,112 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaBolt : ModProjectile + { + public float Bounces + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public float DefaultHue => ((float)Math.Sin(Main.GlobalTime * 2.5f) + 1) * 0.5f; + public const int MaxBounces = 1; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[projectile.type] = 0; + ProjectileID.Sets.TrailCacheLength[projectile.type] = 3; + DisplayName.SetDefault("Ultima Bolt"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 42; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 300; + } + + public override void AI() + { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + + public Color GetColorFromHue(float hue) => Main.hslToRgb(hue, 1f, 0.725f) * projectile.Opacity; + public override Color? GetAlpha(Color lightColor) => GetColorFromHue(DefaultHue); + + public void ProduceExplosionDust(int dustCount) + { + if (!Main.dedServ) + { + for (int i = 0; i < dustCount; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, 267); + dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.8f); + dust.scale = Main.rand.NextFloat(1f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(7f, 7f); + dust.noGravity = true; + } + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (Bounces >= MaxBounces) + { + projectile.Kill(); + return false; + } + + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y; + } + Bounces++; + ProduceExplosionDust(24); + + return false; + } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = ModContent.GetTexture(Texture); + for (int i = 0; i < projectile.oldPos.Length; i++) + { + if (i > 0) + { + CalamityUtils.DistanceClamp(ref projectile.oldPos[i], ref projectile.oldPos[i - 1], 8f); // Ensure the max distance between the old positions isn't too great. It looks weird if it is. + } + float completionRatio = i / (float)projectile.oldPos.Length; + Color color = GetColorFromHue((DefaultHue + completionRatio * 0.5f) % 1f) * (float)Math.Pow(1f - completionRatio, 2); + spriteBatch.Draw(texture, + projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition, + null, + color, + projectile.rotation, + texture.Size() * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f); + } + return false; + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 90, 90); + projectile.Damage(); + ProduceExplosionDust(32); + } + } +} diff --git a/Projectiles/Ranged/UltimaBolt.png b/Projectiles/Ranged/UltimaBolt.png new file mode 100644 index 0000000000..4e0b7c7f9b Binary files /dev/null and b/Projectiles/Ranged/UltimaBolt.png differ diff --git a/Projectiles/Ranged/UltimaBowProjectile.cs b/Projectiles/Ranged/UltimaBowProjectile.cs new file mode 100644 index 0000000000..c5f44980fe --- /dev/null +++ b/Projectiles/Ranged/UltimaBowProjectile.cs @@ -0,0 +1,108 @@ +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaBowProjectile : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const float PositioningOffset = 35f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima"); + } + + public override void SetDefaults() + { + projectile.width = 82; + projectile.height = 144; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ranged = true; + projectile.ignoreWater = true; + } + + public override void AI() + { + Player player = Main.player[projectile.owner]; + projectile.direction = (Math.Cos(projectile.velocity.ToRotation()) > 0).ToDirectionInt(); + AttemptToFireProjectiles(player); + AttachToPlayer(player); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; + Time++; + } + + public void AttemptToFireProjectiles(Player player) + { + bool canFire = player.channel && player.HasAmmo(player.ActiveItem(), true) && !player.noItems && !player.CCed; + if (!canFire) + { + projectile.Kill(); + return; + } + if (Main.netMode != NetmodeID.MultiplayerClient && Time % player.ActiveItem().useTime == 0) + { + int type = ProjectileID.WoodenArrowFriendly; // This doesn't really matter. It's overwritten anyway. But it is passed into the PickAmmo method. + float shotSpeed = player.ActiveItem().shootSpeed; + int damage = player.GetWeaponDamage(player.ActiveItem()); + float knockBack = player.ActiveItem().knockBack; + + player.PickAmmo(player.ActiveItem(), ref type, ref shotSpeed, ref canFire, ref damage, ref knockBack); // Pick ammo and consume it (this incorporates the bow's chance to not consume ammo). + + Main.PlaySound(player.ActiveItem().UseSound, projectile.Center); + + type = ModContent.ProjectileType(); + float shootLaserChance = Utils.InverseLerp(Ultima.FullChargeTime * 0.35f, Ultima.FullChargeTime, Time, true); + Vector2 shotPosition = player.RotatedRelativePoint(player.MountedCenter, true); + shotPosition += projectile.velocity.ToRotation().ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(40f)).RotatedBy(-0.25f * projectile.spriteDirection) * 42f; + + projectile.velocity = projectile.DirectionTo(Main.MouseWorld); + + Vector2 shotVelocity = projectile.velocity * shotSpeed; // The velocity should always be a unit vector. + + // Fire a laser. + if (Main.rand.NextFloat() <= shootLaserChance) + { + type = ModContent.ProjectileType(); + shotVelocity = shotVelocity.RotatedByRandom(0.03f); + damage *= 2; + } + // Sometimes fire little sparks if the bow is fully charged. + if (Time >= Ultima.FullChargeTime * 0.7f && Main.rand.NextBool(6)) + { + // To ensure that the sparks don't spawn on top of the laser itself. + float offsetAngle = Main.rand.NextFloat(0.2f, 0.5f) * Main.rand.NextBool(2).ToDirectionInt(); + Vector2 sparkVelocity = projectile.DirectionTo(Main.MouseWorld).RotatedByRandom(0.5f) * 13f; + sparkVelocity = sparkVelocity.RotatedBy(offsetAngle); + Projectile.NewProjectile(shotPosition, sparkVelocity, ModContent.ProjectileType(), damage / 3, knockBack, projectile.owner); + } + knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); + + Projectile.NewProjectile(shotPosition, shotVelocity, type, damage, knockBack, projectile.owner); + projectile.netUpdate = true; + } + } + + public void AttachToPlayer(Player player) + { + projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + projectile.velocity.ToRotation().ToRotationVector2() * PositioningOffset; + projectile.spriteDirection = projectile.direction; + projectile.timeLeft = 2; + player.ChangeDir(projectile.direction); + player.heldProj = projectile.whoAmI; + player.itemTime = player.itemAnimation = 2; + player.itemRotation = (projectile.velocity * projectile.direction).ToRotation(); + } + + public override bool CanDamage() => false; + } +} diff --git a/Projectiles/Ranged/UltimaBowProjectile.png b/Projectiles/Ranged/UltimaBowProjectile.png new file mode 100644 index 0000000000..a5e99993fd Binary files /dev/null and b/Projectiles/Ranged/UltimaBowProjectile.png differ diff --git a/Projectiles/Ranged/UltimaRay.cs b/Projectiles/Ranged/UltimaRay.cs new file mode 100644 index 0000000000..43742db73f --- /dev/null +++ b/Projectiles/Ranged/UltimaRay.cs @@ -0,0 +1,51 @@ +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaRay : BaseLaserbeamProjectile + { + public float HueOffset + { + get => projectile.ai[1]; + set => projectile.ai[1] = value; + } + public override float MaxScale => 0.7f; + public override float MaxLaserLength => 1599.999999f; + public override float Lifetime => 50f; + public override Color LaserOverlayColor => Main.hslToRgb((float)Math.Sin(Main.GlobalTime * 2.3f + HueOffset) * 0.5f + 0.5f, 1f, 0.775f) * Utils.InverseLerp(Lifetime, 0f, Time, true); + public override Color LightCastColor => LaserOverlayColor; + public override Texture2D LaserBeginTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayStart"); + public override Texture2D LaserMiddleTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayMid"); + public override Texture2D LaserEndTexture => ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd"); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima Ray"); + } + public override void SetDefaults() + { + projectile.width = projectile.height = 22; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = -1; + projectile.alpha = 255; + projectile.localNPCHitCooldown = 8; + projectile.usesLocalNPCImmunity = true; + } + public override bool PreAI() + { + // Initialization. Using the AI hook would override the base laser's code, and we don't want that. + if (projectile.localAI[0] == 0f) + { + HueOffset = Main.rand.NextFloat(MathHelper.Pi / 5f); + projectile.localAI[0] = 1f; + } + return true; + } + public override bool ShouldUpdatePosition() => false; + } +} diff --git a/Projectiles/Ranged/UltimaRay.png b/Projectiles/Ranged/UltimaRay.png new file mode 100644 index 0000000000..15e8775737 Binary files /dev/null and b/Projectiles/Ranged/UltimaRay.png differ diff --git a/Projectiles/Ranged/UltimaSpark.cs b/Projectiles/Ranged/UltimaSpark.cs new file mode 100644 index 0000000000..277bb81070 --- /dev/null +++ b/Projectiles/Ranged/UltimaSpark.cs @@ -0,0 +1,91 @@ +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class UltimaSpark : ModProjectile + { + public float Time + { + get => projectile.ai[0]; + set => projectile.ai[0] = value; + } + public const int DustType = 261; + public const float MaxHomingDistance = 1200f; + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ultima Spark"); + } + + public override void SetDefaults() + { + projectile.width = projectile.height = 8; + projectile.friendly = true; + projectile.ranged = true; + projectile.arrow = true; + projectile.penetrate = 1; + projectile.timeLeft = 240; + projectile.extraUpdates = 1; + } + + public override void AI() + { + if (!Main.dedServ && Time > 5f) + { + for (int i = 0; i < 3; i++) + { + Vector2 spawnPosition = Vector2.Lerp(projectile.oldPosition, projectile.position, i / 3f); + Dust dust = Dust.NewDustPerfect(spawnPosition, DustType); + dust.color = Main.hslToRgb((Main.rand.NextFloat(-0.04f, 0.04f) + Time / 80f) % 1f, 0.8f, 0.6f); + dust.scale = 2.3f; + dust.fadeIn = 1f; + dust.rotation = Main.rand.NextFloat(MathHelper.TwoPi); + dust.velocity = Vector2.Zero; + dust.noGravity = true; + } + } + + NPC potentialTarget = projectile.Center.ClosestNPCAt(MaxHomingDistance); + if (potentialTarget != null) + { + projectile.velocity = (projectile.velocity * 8f + projectile.DirectionTo(potentialTarget.Center) * 18f) / 9f; + return; + } + + if (Time > 30f) + { + float updatedTime = Time - 30f; + // Make a complete 90 degree turn in 30 frames. + if (updatedTime % 120f > 90f) + { + projectile.velocity = projectile.velocity.RotatedBy(MathHelper.PiOver2 / 20f); + } + // Arc around quickly for 60 frames. + else if (updatedTime % 120f > 30f) + { + projectile.velocity = projectile.velocity.RotatedBy((float)Math.Sin((updatedTime - 30f) % 60f / 60f * MathHelper.TwoPi) * MathHelper.ToRadians(15f)); + } + } + + Time++; + } + + public override void Kill(int timeLeft) + { + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 60, 60); + projectile.Damage(); + if (!Main.dedServ) + { + for (int i = 0; i < 20; i++) + { + Dust dust = Dust.NewDustPerfect(projectile.Center, DustType); + dust.color = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.7f); + dust.scale = Main.rand.NextFloat(0.9f, 1.25f); + dust.velocity = Main.rand.NextVector2Circular(6f, 6f); + dust.noGravity = true; + } + } + } + } +} diff --git a/Projectiles/Ranged/UltimaSpark.png b/Projectiles/Ranged/UltimaSpark.png new file mode 100644 index 0000000000..a799dbbc35 Binary files /dev/null and b/Projectiles/Ranged/UltimaSpark.png differ diff --git a/Projectiles/Rogue/BrackishFlaskProj.cs b/Projectiles/Rogue/BrackishFlaskProj.cs index fe00874d77..e5683ce1d5 100644 --- a/Projectiles/Rogue/BrackishFlaskProj.cs +++ b/Projectiles/Rogue/BrackishFlaskProj.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Projectiles.Rogue double startAngle = Math.Atan2(projectile.velocity.X, projectile.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int i; if (projectile.owner == Main.myPlayer) { if (projectile.Calamity().stealthStrike) @@ -51,11 +50,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f); - for (i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), projectile.damage / 2, projectile.knockBack * 0.5f, projectile.owner, 1f, 0f); } } } diff --git a/Projectiles/Rogue/BrackishFlaskProj.png b/Projectiles/Rogue/BrackishFlaskProj.png index c0101e465c..0e5ad78a57 100644 Binary files a/Projectiles/Rogue/BrackishFlaskProj.png and b/Projectiles/Rogue/BrackishFlaskProj.png differ diff --git a/Projectiles/Rogue/BrackishWater.cs b/Projectiles/Rogue/BrackishWater.cs index 78719abe3c..77bfdf8c6e 100644 --- a/Projectiles/Rogue/BrackishWater.cs +++ b/Projectiles/Rogue/BrackishWater.cs @@ -26,23 +26,23 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 0.25f / 255f, (255 - projectile.alpha) * 0.5f / 255f); - if (projectile.localAI[0] == 0f) + if (projectile.localAI[0] == 0f && projectile.ai[0] == 1f) { Main.PlaySound(SoundID.Item, (int)projectile.position.X, (int)projectile.position.Y, 21); projectile.localAI[0] += 1f; } - int randomDust = Utils.SelectRandom(Main.rand, new int[] + if (projectile.timeLeft % 2 == 0) { - 33, - 89 - }); - for (int num457 = 0; num457 < 3; num457++) - { - int num458 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); - Main.dust[num458].noGravity = true; - Main.dust[num458].velocity *= 0.5f; - Main.dust[num458].velocity += projectile.velocity * 0.1f; - } + int randomDust = Utils.SelectRandom(Main.rand, new int[] + { + 33, + 89 + }); + int water = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, randomDust, 0f, 0f, 100, default, 1.2f); + Main.dust[water].noGravity = true; + Main.dust[water].velocity *= 0.5f; + Main.dust[water].velocity += projectile.velocity * 0.1f; + } } public override void Kill(int timeLeft) diff --git a/Projectiles/Rogue/BrackishWater.png b/Projectiles/Rogue/BrackishWater.png index 831f72cfc8..29d231bf6d 100644 Binary files a/Projectiles/Rogue/BrackishWater.png and b/Projectiles/Rogue/BrackishWater.png differ diff --git a/Projectiles/Rogue/Brimblade2.png b/Projectiles/Rogue/Brimblade2.png index d7de00d24b..0d93160ef8 100644 Binary files a/Projectiles/Rogue/Brimblade2.png and b/Projectiles/Rogue/Brimblade2.png differ diff --git a/Projectiles/Rogue/BrimbladeProj.png b/Projectiles/Rogue/BrimbladeProj.png index d7de00d24b..0d93160ef8 100644 Binary files a/Projectiles/Rogue/BrimbladeProj.png and b/Projectiles/Rogue/BrimbladeProj.png differ diff --git a/Projectiles/Rogue/DestructionBolt.png b/Projectiles/Rogue/DestructionBolt.png index bb6630a736..66a812cf0b 100644 Binary files a/Projectiles/Rogue/DestructionBolt.png and b/Projectiles/Rogue/DestructionBolt.png differ diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index 3e4ba4e834..8faa224bca 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public class DestructionStar : ModProjectile { public int hitCount = 0; - private static float Radius = 43f; + private static float Radius = 47f; public override void SetStaticDefaults() { @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 86; - projectile.height = 86; + projectile.width = 94; + projectile.height = 94; projectile.friendly = true; projectile.penetrate = 16; projectile.usesLocalNPCImmunity = true; @@ -89,8 +89,7 @@ namespace CalamityMod.Projectiles.Rogue } if (projectile.owner == Main.myPlayer) { - int i; - for (i = 0; i < hitCount; i++) + for (int i = 0; i < hitCount; i++) { Vector2 value15 = new Vector2((float)Main.rand.Next(-100, 101), (float)Main.rand.Next(-100, 101)); while (value15.X == 0f && value15.Y == 0f) @@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue } value15.Normalize(); value15 *= (float)Main.rand.Next(70, 101) * 0.1f; - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, value15.X, value15.Y, ModContent.ProjectileType(), (int)(projectile.damage * 0.5), 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/Projectiles/Rogue/DestructionStar.png b/Projectiles/Rogue/DestructionStar.png index 732056dac4..46c3428789 100644 Binary files a/Projectiles/Rogue/DestructionStar.png and b/Projectiles/Rogue/DestructionStar.png differ diff --git a/Projectiles/Rogue/LionfishProj.png b/Projectiles/Rogue/LionfishProj.png index 56025eca70..e97c12862e 100644 Binary files a/Projectiles/Rogue/LionfishProj.png and b/Projectiles/Rogue/LionfishProj.png differ diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index c874e06e43..81c622266b 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -1,7 +1,8 @@ +using CalamityMod.Buffs.DamageOverTime; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Rogue { @@ -10,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Venom Cloud"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 10; } public override void SetDefaults() @@ -30,41 +31,37 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { + projectile.ai[0] += 1f; projectile.frameCounter++; - if (projectile.frameCounter > 9) + if (projectile.frameCounter > 6) { projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) - { - projectile.frame = 0; - } + if (projectile.ai[0] < 219f) //255 - frameCounter tick * number of disippation frames + { + if (projectile.frame >= 4) + { + projectile.frame = 0; + } + } + else if (projectile.owner == Main.myPlayer && projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.Kill(); + } projectile.velocity *= 0.98f; - projectile.ai[0] += 1f; - if (projectile.ai[0] >= 120f) - { - if (projectile.alpha < 255) - { - projectile.alpha += 5; - if (projectile.alpha > 255) - { - projectile.alpha = 255; - } - } - else if (projectile.owner == Main.myPlayer) - { - projectile.Kill(); - } - } - else if (projectile.alpha > 80) + if (projectile.alpha > 110) { projectile.alpha -= 30; - if (projectile.alpha < 80) + if (projectile.alpha < 110) { - projectile.alpha = 80; + projectile.alpha = 110; } } + if (Math.Abs(projectile.velocity.X) > 0.1f) + { + projectile.spriteDirection = -projectile.direction; + } } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/ScourgeVenomCloud.png b/Projectiles/Rogue/ScourgeVenomCloud.png index 412c5607a5..2a1c0b9502 100644 Binary files a/Projectiles/Rogue/ScourgeVenomCloud.png and b/Projectiles/Rogue/ScourgeVenomCloud.png differ diff --git a/Projectiles/Rogue/WulfrumKnifeProj.png b/Projectiles/Rogue/WulfrumKnifeProj.png index aab1bf448c..94ca6dcea6 100644 Binary files a/Projectiles/Rogue/WulfrumKnifeProj.png and b/Projectiles/Rogue/WulfrumKnifeProj.png differ diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.cs b/Projectiles/Rogue/XerocPitchforkProjectile.cs index 710588bed7..38d1edc8b2 100644 --- a/Projectiles/Rogue/XerocPitchforkProjectile.cs +++ b/Projectiles/Rogue/XerocPitchforkProjectile.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - projectile.width = 12; - projectile.height = 12; + projectile.width = 20; + projectile.height = 20; projectile.friendly = true; projectile.penetrate = -1; projectile.extraUpdates = 1; @@ -32,10 +32,10 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(135f); if (Main.rand.NextBool(3)) { - Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 58, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 62, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } if (projectile.spriteDirection == -1) { diff --git a/Projectiles/Rogue/XerocPitchforkProjectile.png b/Projectiles/Rogue/XerocPitchforkProjectile.png index 5ff0fa6cf6..ca5e3d8840 100644 Binary files a/Projectiles/Rogue/XerocPitchforkProjectile.png and b/Projectiles/Rogue/XerocPitchforkProjectile.png differ diff --git a/Projectiles/Summon/FrostMistFriendly.cs b/Projectiles/Summon/FrostMistFriendly.cs index b80a01a5a3..2742d3a92d 100644 --- a/Projectiles/Summon/FrostMistFriendly.cs +++ b/Projectiles/Summon/FrostMistFriendly.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Mist"); - Main.projFrames[projectile.type] = 6; + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.MinionShot[projectile.type] = true; } @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } diff --git a/Projectiles/Summon/FrostMistFriendly.png b/Projectiles/Summon/FrostMistFriendly.png index 8349afb42d..ef17040dd0 100644 Binary files a/Projectiles/Summon/FrostMistFriendly.png and b/Projectiles/Summon/FrostMistFriendly.png differ diff --git a/Projectiles/Summon/HerringMinion.cs b/Projectiles/Summon/HerringMinion.cs index 36d87f9dba..ea46870676 100644 --- a/Projectiles/Summon/HerringMinion.cs +++ b/Projectiles/Summon/HerringMinion.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Herring"); - Main.projFrames[projectile.type] = 4; + Main.projFrames[projectile.type] = 8; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } @@ -74,7 +74,7 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame > 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } diff --git a/Projectiles/Summon/HerringMinion.png b/Projectiles/Summon/HerringMinion.png index 9d384c9345..5e8bef7fba 100644 Binary files a/Projectiles/Summon/HerringMinion.png and b/Projectiles/Summon/HerringMinion.png differ diff --git a/Projectiles/Summon/MagicBullet.cs b/Projectiles/Summon/MagicBullet.cs index 5e92de59ea..f87517bbc9 100644 --- a/Projectiles/Summon/MagicBullet.cs +++ b/Projectiles/Summon/MagicBullet.cs @@ -1,5 +1,6 @@ using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -60,5 +61,7 @@ namespace CalamityMod.Projectiles.Summon { return new Color(189, 51, 164, projectile.alpha); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) => projectile.timeLeft < 600; } } diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 0927822a9d..69aacc2f67 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.immune[projectile.owner] = 6; + target.immune[projectile.owner] = 8; } } } diff --git a/Projectiles/Summon/ReaverOrb.cs b/Projectiles/Summon/ReaverOrb.cs index 4ccf243923..d803995de9 100644 --- a/Projectiles/Summon/ReaverOrb.cs +++ b/Projectiles/Summon/ReaverOrb.cs @@ -75,12 +75,12 @@ namespace CalamityMod.Projectiles.Summon projectile.damage = damage2; } Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0f / 255f, (255 - projectile.alpha) * 1f / 255f, (255 - projectile.alpha) * 0f / 255f); - projectile.position.X = Main.player[projectile.owner].Center.X - (float)(projectile.width / 2); - projectile.position.Y = Main.player[projectile.owner].Center.Y - (float)(projectile.height / 2) + Main.player[projectile.owner].gfxOffY - 60f; - if (Main.player[projectile.owner].gravDir == -1f) + projectile.position.X = player.Center.X - (float)(projectile.width / 2); + projectile.position.Y = player.Center.Y - (float)(projectile.height / 2) + player.gfxOffY - 60f; + if (player.gravDir == -1f) { projectile.position.Y = projectile.position.Y + 120f; - projectile.rotation = 3.14f; + projectile.rotation = MathHelper.Pi; } else { diff --git a/Projectiles/Summon/SakuraBullet.cs b/Projectiles/Summon/SakuraBullet.cs index d742786f82..13a6f07c97 100644 --- a/Projectiles/Summon/SakuraBullet.cs +++ b/Projectiles/Summon/SakuraBullet.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; - if ((npc.CanBeChasedBy(projectile, false) || npc.type == NPCID.DukeFishron) && npc.active) + if ((npc.CanBeChasedBy(projectile, false) || (npc.type == NPCID.DukeFishron && (!npc.dontTakeDamage || npc.ai[0] > 9f))) && npc.active) { float extraDistance = (npc.width / 2) + (npc.height / 2); diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index ffa5c68efd..f7361227a3 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -93,7 +93,7 @@ namespace CalamityMod.Projectiles.Summon { projectile.frame = 0; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 2f60590d2d..803cb848d5 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Projectiles.Summon player.MinionDamage()); projectile.damage = damage2; } - if ((double)Math.Abs(projectile.velocity.X) > 0.2) + if (Math.Abs(projectile.velocity.X) > 0.2f) { projectile.spriteDirection = -projectile.direction; } diff --git a/Projectiles/Summon/SandElementalMinion.png b/Projectiles/Summon/SandElementalMinion.png index 22e16e792d..a0b71ad531 100644 Binary files a/Projectiles/Summon/SandElementalMinion.png and b/Projectiles/Summon/SandElementalMinion.png differ diff --git a/Projectiles/Summon/SirenSongFriendly.png b/Projectiles/Summon/SirenSongFriendly.png index c2832ae6e8..1738907123 100644 Binary files a/Projectiles/Summon/SirenSongFriendly.png and b/Projectiles/Summon/SirenSongFriendly.png differ diff --git a/Projectiles/Summon/WaterSpearFriendly.png b/Projectiles/Summon/WaterSpearFriendly.png index b923a9ea8b..a50659774e 100644 Binary files a/Projectiles/Summon/WaterSpearFriendly.png and b/Projectiles/Summon/WaterSpearFriendly.png differ diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index cbc19cb5d6..1f0624e0fa 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -15,19 +15,18 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { DisplayName.SetDefault("Wulfrum Droid"); - Main.projFrames[projectile.type] = 3; + Main.projFrames[projectile.type] = 12; ProjectileID.Sets.MinionSacrificable[projectile.type] = true; ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; } public override void SetDefaults() { - projectile.width = 30; - projectile.height = 30; + projectile.width = 26; + projectile.height = 32; projectile.netImportant = true; projectile.friendly = true; projectile.ignoreWater = true; - //projectile.aiStyle = 62; projectile.minionSlots = 1f; projectile.timeLeft = 18000; projectile.penetrate = -1; @@ -44,24 +43,23 @@ namespace CalamityMod.Projectiles.Summon { projectile.Calamity().spawnedPlayerMinionDamageValue = player.MinionDamage(); projectile.Calamity().spawnedPlayerMinionProjectileDamageValue = projectile.damage; - int num226 = 36; - for (int num227 = 0; num227 < num226; num227++) + int dustAmt = 36; + for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { - Vector2 vector6 = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; - vector6 = vector6.RotatedBy((double)((float)(num227 - (num226 / 2 - 1)) * 6.28318548f / (float)num226), default) + projectile.Center; - Vector2 vector7 = vector6 - projectile.Center; - int num228 = Dust.NewDust(vector6 + vector7, 0, 0, 61, vector7.X * 1.1f, vector7.Y * 1.1f, 100, default, 1.4f); - Main.dust[num228].noGravity = true; - Main.dust[num228].noLight = true; - Main.dust[num228].velocity = vector7; + Vector2 source = Vector2.Normalize(projectile.velocity) * new Vector2((float)projectile.width / 2f, (float)projectile.height) * 0.75f; + source = source.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + projectile.Center; + Vector2 dustVel = source - projectile.Center; + int green = Dust.NewDust(source + dustVel, 0, 0, 61, dustVel.X * 1.1f, dustVel.Y * 1.1f, 100, default, 1.4f); + Main.dust[green].noGravity = true; + Main.dust[green].noLight = true; + Main.dust[green].velocity = dustVel; } dust += 1f; } if (player.MinionDamage() != projectile.Calamity().spawnedPlayerMinionDamageValue) { int damage2 = (int)((float)projectile.Calamity().spawnedPlayerMinionProjectileDamageValue / - projectile.Calamity().spawnedPlayerMinionDamageValue * - player.MinionDamage()); + projectile.Calamity().spawnedPlayerMinionDamageValue * player.MinionDamage()); projectile.damage = damage2; } projectile.frameCounter++; @@ -70,13 +68,13 @@ namespace CalamityMod.Projectiles.Summon projectile.frame++; projectile.frameCounter = 0; } - if (projectile.frame >= 3) + if (projectile.frame >= Main.projFrames[projectile.type]) { projectile.frame = 0; } - bool flag64 = projectile.type == ModContent.ProjectileType(); + bool correctMinion = projectile.type == ModContent.ProjectileType(); player.AddBuff(ModContent.BuffType(), 3600); - if (flag64) + if (correctMinion) { if (player.dead) { @@ -88,135 +86,132 @@ namespace CalamityMod.Projectiles.Summon } } projectile.MinionAntiClump(); - Vector2 vector2_3 = projectile.position; - float num7 = 450f; - bool flag = false; - int num8 = -1; + Vector2 targetVector = projectile.position; + float range = 450f; + bool foundTarget = false; + int targetIndex = -1; if (player.HasMinionAttackTargetNPC) { NPC npc = Main.npc[player.MinionAttackTargetNPC]; if (npc.CanBeChasedBy((object) this, false)) { - float num1 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag && num1 < num7) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if ((!foundTarget && targetDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num7 = num1; - vector2_3 = npc.Center; - flag = true; - num8 = npc.whoAmI; + range = targetDist; + targetVector = npc.Center; + foundTarget = true; + targetIndex = npc.whoAmI; } } } - if (!flag) + if (!foundTarget) { - for (int index2 = 0; index2 < Main.npc.Length; ++index2) + for (int npcIndex = 0; npcIndex < Main.npc.Length; ++npcIndex) { - NPC npc = Main.npc[index2]; + NPC npc = Main.npc[npcIndex]; if (npc.CanBeChasedBy((object) this, false)) { - float num1 = Vector2.Distance(npc.Center, projectile.Center); - if ((!flag && num1 < num7) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) + float targetDist = Vector2.Distance(npc.Center, projectile.Center); + if ((!foundTarget && targetDist < range) && Collision.CanHitLine(projectile.position, projectile.width, projectile.height, npc.position, npc.width, npc.height)) { - num7 = num1; - vector2_3 = npc.Center; - flag = true; - num8 = index2; + range = targetDist; + targetVector = npc.Center; + foundTarget = true; + targetIndex = npcIndex; } } } } - int num9 = 500; - if (flag) - num9 = 1000; - if ((double) Vector2.Distance(player.Center, projectile.Center) > (double) num9) + float separationAnxietyDist = 500f; + if (foundTarget) + separationAnxietyDist = 1000f; + if (Vector2.Distance(player.Center, projectile.Center) > separationAnxietyDist) { projectile.ai[0] = 1f; projectile.netUpdate = true; } - if ((double) projectile.ai[0] == 1.0) + if (projectile.ai[0] == 1f) projectile.tileCollide = false; - if (flag && (double) projectile.ai[0] == 0.0) + if (foundTarget && projectile.ai[0] == 0f) { - Vector2 vector2_1 = vector2_3 - projectile.Center; - float num1 = vector2_1.Length(); - vector2_1.Normalize(); - if ((double) num1 > 200.0) + Vector2 targetPos = targetVector - projectile.Center; + float targetDist = targetPos.Length(); + targetPos.Normalize(); + if (targetDist > 200f) { - float num2 = 6f; - Vector2 vector2_2 = vector2_1 * num2; - projectile.velocity.X = (float) (((double) projectile.velocity.X * 40.0 + (double) vector2_2.X) / 41.0); - projectile.velocity.Y = (float) (((double) projectile.velocity.Y * 40.0 + (double) vector2_2.Y) / 41.0); + float speed = 6f; + Vector2 goToTarget = targetPos * speed; + projectile.velocity.X = (projectile.velocity.X * 40f + goToTarget.X) / 41f; + projectile.velocity.Y = (projectile.velocity.Y * 40f + goToTarget.Y) / 41f; } - else if ((double) projectile.velocity.Y > -1.0) + else if (projectile.velocity.Y > -1f) projectile.velocity.Y -= 0.1f; } else { if (!Collision.CanHitLine(projectile.Center, 1, 1, player.Center, 1, 1)) projectile.ai[0] = 1f; - float num1 = 6f; - if ((double) projectile.ai[0] == 1.0) - num1 = 15f; - Vector2 center = projectile.Center; - Vector2 vector2_1 = player.Center - center + new Vector2(0.0f, -60f); - float num3 = vector2_1.Length(); - if ((double) num3 > 200.0 && (double) num1 < 9.0) - num1 = 9f; - if ((double) num3 < 100.0 && (double) projectile.ai[0] == 1.0 && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) + float returnSpeed = 6f; + if (projectile.ai[0] == 1f) + returnSpeed = 15f; + Vector2 playerVec = player.Center - projectile.Center + new Vector2(0f, -60f); + float playerDist = playerVec.Length(); + if (playerDist > 200f && returnSpeed < 9f) + returnSpeed = 9f; + if (playerDist < 100f && projectile.ai[0] == 1f && !Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) { - projectile.ai[0] = 0.0f; + projectile.ai[0] = 0f; projectile.netUpdate = true; } - if ((double) num3 > 2000.0) + if (playerDist > 2000f) { projectile.position.X = player.Center.X - (float) (projectile.width / 2); projectile.position.Y = player.Center.Y - (float) (projectile.width / 2); + projectile.netUpdate = true; } - else if ((double) num3 > 70.0) + else if (playerDist > 70f) { - vector2_1.Normalize(); - projectile.velocity = (projectile.velocity * 20f + vector2_1 * num1) / 21f; + playerVec.Normalize(); + projectile.velocity = (projectile.velocity * 20f + playerVec * returnSpeed) / 21f; } else { - if ((double) projectile.velocity.X == 0.0 && (double) projectile.velocity.Y == 0.0) + if (projectile.velocity.X == 0f && projectile.velocity.Y == 0f) { projectile.velocity.X = -0.15f; projectile.velocity.Y = -0.05f; } - projectile.velocity = projectile.velocity * 1.01f; + projectile.velocity *= 1.01f; } } projectile.rotation = projectile.velocity.X * 0.05f; - if ((double) projectile.velocity.X > 0.0) + if (projectile.velocity.X > 0f) projectile.spriteDirection = projectile.direction = 1; - else if ((double) projectile.velocity.X < 0.0) + else if (projectile.velocity.X < 0f) projectile.spriteDirection = projectile.direction = -1; - if ((double) projectile.ai[1] > 0.0) + if (projectile.ai[1] > 0f) projectile.ai[1] += (float) Main.rand.Next(1, 4); - if ((double) projectile.ai[1] > 90.0) + if (projectile.ai[1] > 90f) { projectile.ai[1] = 0.0f; projectile.netUpdate = true; } - if ((double) projectile.ai[1] != 0.0) + if (projectile.ai[1] != 0f) return; ++projectile.ai[1]; if (Main.myPlayer != projectile.owner) return; - if (!flag) + if (!foundTarget) return; - Vector2 vec = vector2_3 - projectile.Center; - vec.Normalize(); - Vector2 vec2 = vec * 10f; - int bolt = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, vec2.X, vec2.Y, ModContent.ProjectileType(), projectile.damage, 0.0f, Main.myPlayer, 0.0f, 0.0f); + Vector2 velocity = targetVector - projectile.Center; + velocity.Normalize(); + velocity *= 10f; + int bolt = Projectile.NewProjectile(projectile.Center, velocity, ModContent.ProjectileType(), projectile.damage, projectile.knockBack, projectile.owner); Main.projectile[bolt].netUpdate = true; projectile.netUpdate = true; } - public override bool CanDamage() - { - return false; - } + public override bool CanDamage() => false; } } diff --git a/Projectiles/Summon/WulfrumDroid.png b/Projectiles/Summon/WulfrumDroid.png index c227fdff07..fec767973b 100644 Binary files a/Projectiles/Summon/WulfrumDroid.png and b/Projectiles/Summon/WulfrumDroid.png differ diff --git a/Projectiles/Typeless/KelvinCatalystStar.png b/Projectiles/Typeless/KelvinCatalystStar.png index 63cf056df5..4c9d479f3b 100644 Binary files a/Projectiles/Typeless/KelvinCatalystStar.png and b/Projectiles/Typeless/KelvinCatalystStar.png differ diff --git a/Projectiles/Typeless/WulfrumBobber.cs b/Projectiles/Typeless/WulfrumBobber.cs index 2668a7b540..f178c2fbf2 100644 --- a/Projectiles/Typeless/WulfrumBobber.cs +++ b/Projectiles/Typeless/WulfrumBobber.cs @@ -24,8 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDrawExtras(SpriteBatch spriteBatch) { - Player player = Main.player[projectile.owner]; - CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(200, 200, 200, 100)); + CalamityUtils.DrawFishingLine(projectile, ModContent.ItemType(), new Color(200, 200, 200, 100), 38, 28f); return false; } } diff --git a/Projectiles/Typeless/WulfrumBobber.png b/Projectiles/Typeless/WulfrumBobber.png index 7d03394d6f..19d0f06aea 100644 Binary files a/Projectiles/Typeless/WulfrumBobber.png and b/Projectiles/Typeless/WulfrumBobber.png differ diff --git a/Projectiles/Typeless/XerocBlast.cs b/Projectiles/Typeless/XerocBlast.cs index 498481348e..3a1db33347 100644 --- a/Projectiles/Typeless/XerocBlast.cs +++ b/Projectiles/Typeless/XerocBlast.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Typeless num466 = num465 / num466; num463 *= num466; num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); + int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[num467]; dust.noGravity = true; dust.position.X = projectile.Center.X; diff --git a/Projectiles/Typeless/XerocBubble.cs b/Projectiles/Typeless/XerocBubble.cs index 4503b2e48d..986923299c 100644 --- a/Projectiles/Typeless/XerocBubble.cs +++ b/Projectiles/Typeless/XerocBubble.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int num468 = 0; num468 < 1; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 1f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 1f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Typeless/XerocBubble.png b/Projectiles/Typeless/XerocBubble.png index 637b8391b1..1c0aafc145 100644 Binary files a/Projectiles/Typeless/XerocBubble.png and b/Projectiles/Typeless/XerocBubble.png differ diff --git a/Projectiles/Typeless/XerocFire.cs b/Projectiles/Typeless/XerocFire.cs index 1cb3dbfa08..f3d8d7e5f1 100644 --- a/Projectiles/Typeless/XerocFire.cs +++ b/Projectiles/Typeless/XerocFire.cs @@ -41,8 +41,8 @@ namespace CalamityMod.Projectiles.Typeless projectile.ai[0] = 5f; if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f) { - projectile.velocity.X = projectile.velocity.X * 0.97f; - if ((double)projectile.velocity.X > -0.01 && (double)projectile.velocity.X < 0.01) + projectile.velocity.X *= 0.97f; + if (projectile.velocity.X > -0.01f && projectile.velocity.X < 0.01f) { projectile.velocity.X = 0f; projectile.netUpdate = true; @@ -51,16 +51,9 @@ namespace CalamityMod.Projectiles.Typeless projectile.velocity.Y = projectile.velocity.Y + 0.2f; } projectile.rotation += projectile.velocity.X * 0.1f; - int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); - Dust dust = Main.dust[num199]; - dust.position.X -= 2f; - dust.position.Y += 2f; - dust.scale += (float)Main.rand.Next(50) * 0.01f; - dust.noGravity = true; - dust.velocity.Y -= 2f; - if (Main.rand.NextBool(2)) + if (Main.rand.NextBool(3)) { - int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 58, 0f, 0f, 100, default, 0.75f); + int num200 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 62, 0f, 0f, 100, default, 0.75f); Dust dust2 = Main.dust[num200]; dust2.position.X -= 2f; dust2.position.Y += 2f; @@ -68,9 +61,19 @@ namespace CalamityMod.Projectiles.Typeless dust2.noGravity = true; dust2.velocity *= 0.1f; } - if ((double)projectile.velocity.Y < 0.25 && (double)projectile.velocity.Y > 0.15) + else + { + int num199 = Dust.NewDust(projectile.position, projectile.width, projectile.height, 62, 0f, 0f, 100, default, 0.75f); + Dust dust = Main.dust[num199]; + dust.position.X -= 2f; + dust.position.Y += 2f; + dust.scale += (float)Main.rand.Next(50) * 0.01f; + dust.noGravity = true; + dust.velocity.Y -= 2f; + } + if (projectile.velocity.Y < 0.25f && projectile.velocity.Y > 0.15f) { - projectile.velocity.X = projectile.velocity.X * 0.8f; + projectile.velocity.X *= 0.8f; } projectile.rotation = -projectile.velocity.X * 0.05f; if (projectile.velocity.Y > 16f) diff --git a/Projectiles/Typeless/XerocFire.png b/Projectiles/Typeless/XerocFire.png index 28f94674d6..297ed01ef2 100644 Binary files a/Projectiles/Typeless/XerocFire.png and b/Projectiles/Typeless/XerocFire.png differ diff --git a/Projectiles/Typeless/XerocOrb.cs b/Projectiles/Typeless/XerocOrb.cs index 5a7607f9da..00a76b1ba2 100644 --- a/Projectiles/Typeless/XerocOrb.cs +++ b/Projectiles/Typeless/XerocOrb.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; CalamityGlobalProjectile.HomeInOnNPC(projectile, false, 400f, 7f, 20f); diff --git a/Projectiles/Typeless/XerocOrb.png b/Projectiles/Typeless/XerocOrb.png index 15e8775737..c1fdbf1381 100644 Binary files a/Projectiles/Typeless/XerocOrb.png and b/Projectiles/Typeless/XerocOrb.png differ diff --git a/Projectiles/Typeless/XerocStar.cs b/Projectiles/Typeless/XerocStar.cs index 285ed3a9b2..511f7f198e 100644 --- a/Projectiles/Typeless/XerocStar.cs +++ b/Projectiles/Typeless/XerocStar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Typeless { for (int num468 = 0; num468 < 1; num468++) { - int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 58, 0f, 0f, 100, default, 2f); + int num469 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 62, 0f, 0f, 100, default, 2f); Main.dust[num469].noGravity = true; Main.dust[num469].velocity *= 0f; } diff --git a/Projectiles/Typeless/XerocStar.png b/Projectiles/Typeless/XerocStar.png index 454174ef8a..3ccaa4660b 100644 Binary files a/Projectiles/Typeless/XerocStar.png and b/Projectiles/Typeless/XerocStar.png differ diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs new file mode 100644 index 0000000000..599ff27179 --- /dev/null +++ b/Projectiles/Typeless/YanmeisKnifeSlash.cs @@ -0,0 +1,113 @@ +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class YanmeisKnifeSlash : ModProjectile + { + // This is a rather weird thing, but it's what the patron asked for. + public static readonly Func CanRecieveCoolEffectsFrom = (npc) => npc.boss || CalamityMod.bossMinionList.Contains(npc.type); + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Yanmei's Knife"); + Main.projFrames[projectile.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; + projectile.Calamity().trueMelee = true; + } + + 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[projectile.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; + } + 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, int damage, float knockback, bool crit) + { + if (!CanRecieveCoolEffectsFrom(target)) + return; + target.AddBuff(ModContent.BuffType(), 600); + 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, 267); + 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; + } + } + Main.PlaySound(SoundID.Zombie, Main.player[projectile.owner].Center, 104); + Main.player[projectile.owner].AddBuff(ModContent.BuffType(), 600); + } + public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); + } +} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.png b/Projectiles/Typeless/YanmeisKnifeSlash.png new file mode 100644 index 0000000000..e0b03d728c Binary files /dev/null and b/Projectiles/Typeless/YanmeisKnifeSlash.png differ diff --git a/Sounds/Custom/BrimstoneMonsterSpawn.cs b/Sounds/Custom/BrimstoneMonsterSpawn.cs new file mode 100644 index 0000000000..a36de799cf --- /dev/null +++ b/Sounds/Custom/BrimstoneMonsterSpawn.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class BrimstoneMonsterSpawn : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/BrimstoneMonsterSpawn.ogg b/Sounds/Custom/BrimstoneMonsterSpawn.ogg new file mode 100644 index 0000000000..820dfa8180 Binary files /dev/null and b/Sounds/Custom/BrimstoneMonsterSpawn.ogg differ diff --git a/Sounds/Custom/DevourerAttack.cs b/Sounds/Custom/DevourerAttack.cs new file mode 100644 index 0000000000..07ce5c166f --- /dev/null +++ b/Sounds/Custom/DevourerAttack.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class DevourerAttack : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/DevourerAttack.ogg b/Sounds/Custom/DevourerAttack.ogg new file mode 100644 index 0000000000..d680f9a984 Binary files /dev/null and b/Sounds/Custom/DevourerAttack.ogg differ diff --git a/Sounds/Custom/SlimeGodExit.cs b/Sounds/Custom/SlimeGodExit.cs new file mode 100644 index 0000000000..5aca87dbd2 --- /dev/null +++ b/Sounds/Custom/SlimeGodExit.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SlimeGodExit : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SlimeGodExit.ogg b/Sounds/Custom/SlimeGodExit.ogg new file mode 100644 index 0000000000..2762c5ceac Binary files /dev/null and b/Sounds/Custom/SlimeGodExit.ogg differ diff --git a/Sounds/Custom/SlimeGodPossession.cs b/Sounds/Custom/SlimeGodPossession.cs new file mode 100644 index 0000000000..fc846aaeb3 --- /dev/null +++ b/Sounds/Custom/SlimeGodPossession.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework.Audio; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Sounds.Custom +{ + public class SlimeGodPossession : ModSound + { + public override SoundEffectInstance PlaySound(ref SoundEffectInstance soundInstance, float volume, float pan, SoundType type) + { + soundInstance = sound.CreateInstance(); + soundInstance.Volume = volume * 1f; + soundInstance.Pan = pan; + Main.PlaySoundInstance(soundInstance); + return soundInstance; + } + } +} diff --git a/Sounds/Custom/SlimeGodPossession.ogg b/Sounds/Custom/SlimeGodPossession.ogg new file mode 100644 index 0000000000..858780ffbb Binary files /dev/null and b/Sounds/Custom/SlimeGodPossession.ogg differ diff --git a/Tiles/Furniture/BossTrophy.cs b/Tiles/Furniture/BossTrophy.cs index 752e6ce492..e6731142a8 100644 --- a/Tiles/Furniture/BossTrophy.cs +++ b/Tiles/Furniture/BossTrophy.cs @@ -110,6 +110,9 @@ namespace CalamityMod.Tiles.Furniture break; case 26: item = ModContent.ItemType(); + break; + case 27: + item = ModContent.ItemType(); break; } if (item > 0) diff --git a/Tiles/Furniture/BossTrophy.png b/Tiles/Furniture/BossTrophy.png index b521b489bd..3970e3d5cb 100644 Binary files a/Tiles/Furniture/BossTrophy.png and b/Tiles/Furniture/BossTrophy.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinFlame.png b/Tiles/FurnitureCosmilite/CosmiliteBasinFlame.png new file mode 100644 index 0000000000..4bda7186c9 Binary files /dev/null and b/Tiles/FurnitureCosmilite/CosmiliteBasinFlame.png differ diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs index a76b519ecc..78d10a7148 100644 --- a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs +++ b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.cs @@ -1,14 +1,18 @@ +using CalamityMod.Dusts; +using CalamityMod.Items.Placeables.FurnitureCosmilite; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -using CalamityMod.Items.Placeables.FurnitureCosmilite; namespace CalamityMod.Tiles.FurnitureCosmilite { public class CosmiliteBasinTile : ModTile { + int animationFrame = 0; + public override void SetDefaults() { Main.tileLighted[Type] = true; @@ -42,6 +46,7 @@ namespace CalamityMod.Tiles.FurnitureCosmilite if (frameCounter >= 6) { frame = (frame + 1) % 6; + animationFrame = frame; frameCounter = 0; } } @@ -67,5 +72,19 @@ namespace CalamityMod.Tiles.FurnitureCosmilite { CalamityUtils.LightHitWire(Type, i, j, 3, 3); } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + CalamityUtils.DrawStaticFlameEffect(ModContent.GetTexture("CalamityMod/Tiles/FurnitureCosmilite/CosmiliteBasinFlame"), i, j, offsetY: animationFrame * animationFrameHeight); + } + + public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex) + { + Tile tile = Main.tile[i, j]; + if (tile.frameY == 18) + { + CalamityUtils.DrawFlameSparks((int)CalamityDusts.PurpleCosmolite, 5, i, j); + } + } } } \ No newline at end of file diff --git a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png index 4abbed3430..cee44a5c37 100644 Binary files a/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png and b/Tiles/FurnitureCosmilite/CosmiliteBasinTile.png differ diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index ca8c0ebecb..89a2e24768 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -1032,8 +1032,7 @@ namespace CalamityMod ItemID.SolarFlarePickaxe, ItemID.VortexPickaxe, ItemID.NebulaPickaxe, - ItemID.StardustPickaxe, - ModContent.ItemType() + ItemID.StardustPickaxe }); RecipeGroup.RegisterGroup("LunarPickaxe", group); diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 168234a4d4..10875c407a 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -958,6 +958,8 @@ namespace CalamityMod { newDamage = (int)((dmgInput - cap) * 0.1) + cap; } + if (newDamage < 1) + newDamage = 1; return newDamage; } @@ -2909,12 +2911,13 @@ namespace CalamityMod public static void DrawFishingLine(this Projectile projectile, int fishingRodType, Color poleColor, int xPositionAdditive = 45, float yPositionAdditive = 35f) { Player player = Main.player[projectile.owner]; - if (projectile.bobber && player.ActiveItem().holdStyle > 0) + Item item = Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; + if (projectile.bobber && item.holdStyle > 0) { float pPosX = player.MountedCenter.X; float pPosY = player.MountedCenter.Y; pPosY += player.gfxOffY; - int type = player.ActiveItem().type; + int type = item.type; float gravDir = player.gravDir; if (type == fishingRodType) @@ -3392,6 +3395,20 @@ namespace CalamityMod return (t - from) / (to - from); } + /// + /// Clamps the distance between vectors via normalization. + /// + /// The starting point. + /// The ending point. + /// The maximum possible distance between the two vectors before they get clamped. + public static void DistanceClamp(ref Vector2 start, ref Vector2 end, float maxDistance) + { + if (Vector2.Distance(end, start) > maxDistance) + { + end = start + Vector2.Normalize(end - start) * maxDistance; + } + } + // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function public static Rectangle ClampToWorld(Rectangle tileRectangle) { diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index eda7ca3327..673d5408d1 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -161,7 +161,8 @@ namespace CalamityMod.World public static bool downedSentinel1 = false; // Ceaseless Void public static bool downedSentinel2 = false; // Storm Weaver public static bool downedSentinel3 = false; // Signus, Envoy of the Devourer - public static bool downedPolterghast = false; + public static bool downedSecondSentinels = false; + public static bool downedPolterghast = false; public static bool downedDoG = false; public static bool downedBumble = false; public static bool buffedEclipse = false; @@ -251,6 +252,7 @@ namespace CalamityMod.World downedGSS = false; downedBuffedMothron = false; downedBoomerDuke = false; + downedSecondSentinels = false; death = false; defiled = false; armageddon = false; @@ -299,6 +301,8 @@ namespace CalamityMod.World downed.Add("stormWeaver"); if (downedSentinel3) downed.Add("signus"); + if (downedSecondSentinels) + downed.Add("secondSentinels"); if (downedYharon) downed.Add("yharon"); if (buffedEclipse) @@ -405,6 +409,7 @@ namespace CalamityMod.World downedSentinel1 = downed.Contains("ceaselessVoid"); downedSentinel2 = downed.Contains("stormWeaver"); downedSentinel3 = downed.Contains("signus"); + downedSecondSentinels = downed.Contains("secondSentinels"); downedYharon = downed.Contains("yharon"); buffedEclipse = downed.Contains("eclipse"); downedSCal = downed.Contains("supremeCalamitas"); @@ -529,7 +534,7 @@ namespace CalamityMod.World BitsByte flags8 = reader.ReadByte(); forcedRainAlready = flags8[0]; forcedDownpourWithTear = flags8[1]; - _ = flags8[2]; + downedSecondSentinels = flags8[2]; _ = flags8[3]; _ = flags8[4]; _ = flags8[5]; @@ -620,7 +625,7 @@ namespace CalamityMod.World BitsByte flags8 = new BitsByte(); flags8[0] = forcedRainAlready; flags8[1] = forcedDownpourWithTear; - flags8[2] = false; + flags8[2] = downedSecondSentinels; flags8[3] = false; flags8[4] = false; flags8[5] = false; @@ -717,7 +722,7 @@ namespace CalamityMod.World BitsByte flags8 = reader.ReadByte(); forcedRainAlready = flags8[0]; forcedDownpourWithTear = flags8[1]; - _ = flags8[2]; + downedSecondSentinels = flags8[2]; _ = flags8[3]; _ = flags8[4]; _ = flags8[5];