diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index d675ac0b01..0fae2bfeae 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -113,7 +113,19 @@ namespace CalamityMod.Buffs tip = "22.5% increased damage"; break; - case BuffID.BeetleEndurance1: + case BuffID.BeetleMight1: + tip = "Melee damage and speed increase by 5%"; + break; + + case BuffID.BeetleMight2: + tip = "Melee damage and speed increase by 10%"; + break; + + case BuffID.BeetleMight3: + tip = "Melee damage and speed increase by 15%"; + break; + + case BuffID.BeetleEndurance1: tip = "Damage taken reduced by 10%"; break; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 280eac5611..b52d46cbbf 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -345,8 +345,8 @@ namespace CalamityMod.CalPlayer public bool rageModeActive = false; public float rage = 0f; public float rageMax = 100f; // 0 to 100% by default - public static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(10); - public static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(2); + public static readonly int DefaultRageDuration = CalamityUtils.SecondsToFrames(9); // Rage lasts 9 seconds by default. + public static readonly int RageDurationPerBooster = CalamityUtils.SecondsToFrames(1); // Each booster is +1 second: 10, 11, 12. public int RageDuration = DefaultRageDuration; public int rageGainCooldown = 0; public static readonly int DefaultRageGainCooldown = 10; // It is pretty hard to have less than 10 iframes for any reason @@ -419,7 +419,10 @@ namespace CalamityMod.CalPlayer public bool evasionScarf = false; public bool badgeOfBravery = false; public bool badgeOfBraveryRare = false; - public bool scarfCooldown = false; + public float warBannerBonus = 0f; + private const float maxWarBannerBonus = 0.2f; + private const float maxWarBannerDistance = 480f; + public bool scarfCooldown = false; public bool eScarfCooldown = false; public bool cryogenSoul = false; public bool yInsignia = false; @@ -1440,6 +1443,7 @@ namespace CalamityMod.CalPlayer accStealthGenBoost = 0f; trueMeleeDamage = 0D; + warBannerBonus = 0f; dashMod = 0; externalAbyssLight = 0; @@ -3675,31 +3679,51 @@ namespace CalamityMod.CalPlayer } if (badgeOfBraveryRare) { - float maxDistance = 480f; // 30 tile distance - float meleeSpeedBoost = 0f; - for (int l = 0; l < Main.maxNPCs; l++) - { - NPC nPC = Main.npc[l]; + int closestNPC = -1; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC nPC = Main.npc[i]; + if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage) + { + closestNPC = i; + break; + } + } + float distance = -1f; + for (int j = 0; j < Main.maxNPCs; j++) + { + NPC nPC = Main.npc[j]; + if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage) + { + float distance2 = Math.Abs(nPC.position.X + (float)(nPC.width / 2) - (player.position.X + (float)(player.width / 2))) + Math.Abs(nPC.position.Y + (float)(nPC.height / 2) - (player.position.Y + (float)(player.height / 2))); + if (distance == -1f || distance2 < distance) + { + distance = distance2; + closestNPC = j; + } + } + } - // Take the longer of the two directions for the NPC's hitbox to be generous. - float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f); - float hitboxEdgeDist = nPC.Distance(player.Center) - generousHitboxWidth; + if (closestNPC != -1) + { + NPC actualClosestNPC = Main.npc[closestNPC]; + + float generousHitboxWidth = Math.Max(actualClosestNPC.Hitbox.Width / 2f, actualClosestNPC.Hitbox.Height / 2f); + float hitboxEdgeDist = actualClosestNPC.Distance(player.Center) - generousHitboxWidth; if (hitboxEdgeDist < 0) hitboxEdgeDist = 0; - if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage && hitboxEdgeDist < maxDistance) - { - meleeSpeedBoost += MathHelper.Lerp(0f, 0.3f, 1f - (hitboxEdgeDist / maxDistance)); + if (hitboxEdgeDist < maxWarBannerDistance) + { + warBannerBonus = MathHelper.Lerp(0f, maxWarBannerBonus, 1f - (hitboxEdgeDist / maxWarBannerDistance)); - if (meleeSpeedBoost >= 0.3f) - { - meleeSpeedBoost = 0.3f; - break; - } - } - } - meleeSpeedMult += meleeSpeedBoost; + if (warBannerBonus > maxWarBannerBonus) + warBannerBonus = maxWarBannerBonus; + } + + meleeSpeedMult += warBannerBonus; + } } if (eGauntlet) { @@ -3712,9 +3736,7 @@ namespace CalamityMod.CalPlayer if (bloodyMary) { if (Main.bloodMoon) - { meleeSpeedMult += 0.15f; - } } if (community) { @@ -3747,6 +3769,11 @@ namespace CalamityMod.CalPlayer else meleeSpeedMult += 0.05f; } + if (player.beetleOffense && player.beetleOrbs > 0) + { + player.meleeDamage -= 0.05f * player.beetleOrbs; + meleeSpeedMult -= 0.05f * player.beetleOrbs; + } if (CalamityConfig.Instance.Proficiency) { meleeSpeedMult += GetMeleeSpeedBonus(); @@ -5345,7 +5372,7 @@ namespace CalamityMod.CalPlayer { // Add more true melee damage to the true melee projectile that scales with melee speed // This is done because melee speed does nothing to melee weapons that are purely projectiles - damageMult += trueMeleeDamage + ((1f - player.meleeSpeed) * (100f / player.meleeSpeed) / 100f); + damageMult += trueMeleeDamage + ((1f - player.meleeSpeed) * (100f / player.meleeSpeed) / 100f * 0.25f); } if (screwdriver) @@ -6798,15 +6825,11 @@ namespace CalamityMod.CalPlayer } else if (npc.type == NPCID.Plantera && npc.life < npc.lifeMax / 2) { - player.AddBuff(BuffID.Poisoned, 180); - player.AddBuff(BuffID.Venom, 180); - player.AddBuff(BuffID.Bleeding, 300); + player.AddBuff(BuffID.Poisoned, 300); } else if (npc.type == NPCID.PlanterasTentacle) { - player.AddBuff(BuffID.Poisoned, 120); - player.AddBuff(BuffID.Venom, 120); - player.AddBuff(BuffID.Bleeding, 180); + player.AddBuff(BuffID.Poisoned, 180); } else if (npc.type == NPCID.AncientDoom) { @@ -6860,7 +6883,6 @@ namespace CalamityMod.CalPlayer else if (proj.type == ProjectileID.ThornBall) { player.AddBuff(BuffID.Poisoned, 240); - player.AddBuff(BuffID.Venom, 120); } else if (proj.type == ProjectileID.CultistBossIceMist) { @@ -7390,7 +7412,9 @@ namespace CalamityMod.CalPlayer } } - evilSmasherBoost = 0; + if (evilSmasherBoost > 0) + evilSmasherBoost -= 1; + hellbornBoost = 0; if (amidiasBlessing) diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f7e789e900..b83e14bd8c 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -297,8 +297,8 @@ namespace CalamityMod.CalPlayer if (modPlayer.rageGainCooldown > 0) --modPlayer.rageGainCooldown; - // This is how much Rage will be changed by this frame. - float rageDiff = 0; + // This is how much Rage will be changed by this frame. + float rageDiff = 0; // If the player equips multiple rage generation accessories they get the max possible effect without stacking any of them. { @@ -407,42 +407,47 @@ namespace CalamityMod.CalPlayer bool rageFading = modPlayer.rageCombatFrames <= 0 && !modPlayer.heartOfDarkness && !modPlayer.shatteredCommunity; - // If Rage Mode is currently active, you smoothly lose all rage over the duration. - if (modPlayer.rageModeActive) + // If Rage Mode is currently active, you smoothly lose all rage over the duration. + if (modPlayer.rageModeActive) rageDiff -= modPlayer.rageMax / modPlayer.RageDuration; // If out of combat and NOT using Heart of Darkness or Shattered Community, Rage fades away. else if (!modPlayer.rageModeActive && rageFading) rageDiff -= modPlayer.rageMax / CalamityPlayer.RageFadeTime; - // Apply the rage change and cap rage in both directions. - modPlayer.rage += rageDiff; - if (modPlayer.rage < 0) - modPlayer.rage = 0; + // Apply the rage change and cap rage in both directions. + modPlayer.rage += rageDiff; + if (modPlayer.rage < 0) + modPlayer.rage = 0; - if (modPlayer.rage >= modPlayer.rageMax) - { - // Rage IS NOT capped while active. It can go above 100%. + if (modPlayer.rage >= modPlayer.rageMax) + { + // If Rage is not active, it is capped at 100%. if (!modPlayer.rageModeActive) - modPlayer.rage = modPlayer.rageMax; + modPlayer.rage = modPlayer.rageMax; - // Play a sound when the Rage Meter is full - if (modPlayer.playFullRageSound) - { - modPlayer.playFullRageSound = false; - Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); - } - } - else - modPlayer.playFullRageSound = true; + // If using the Shattered Community, Rage is capped at 200% while it's active. + // This prevents infinitely stacking rage before a fight by standing on spikes/lava with a regen build or the Nurse handy. + else if (modPlayer.shatteredCommunity && modPlayer.rage >= 2f * modPlayer.rageMax) + modPlayer.rage = 2f * modPlayer.rageMax; - // This is how much Adrenaline will be changed by this frame. - float adrenalineDiff = 0; - bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); - bool wofAndNotHell = Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16); + // Play a sound when the Rage Meter is full + if (modPlayer.playFullRageSound) + { + modPlayer.playFullRageSound = false; + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/FullRage"), (int)player.position.X, (int)player.position.Y); + } + } + else + modPlayer.playFullRageSound = true; - // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. - if (modPlayer.adrenalineModeActive) + // This is how much Adrenaline will be changed by this frame. + float adrenalineDiff = 0; + bool SCalAlive = NPC.AnyNPCs(ModContent.NPCType()); + bool wofAndNotHell = Main.wof >= 0 && player.position.Y < (float)((Main.maxTilesY - 200) * 16); + + // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. + if (modPlayer.adrenalineModeActive) adrenalineDiff = -modPlayer.adrenalineMax / modPlayer.AdrenalineDuration; else @@ -3049,33 +3054,7 @@ namespace CalamityMod.CalPlayer } if (modPlayer.badgeOfBraveryRare) - { - float maxDistance = 480f; // 30 tile distance - float damageBoost = 0f; - for (int l = 0; l < Main.maxNPCs; l++) - { - NPC nPC = Main.npc[l]; - - // Take the longer of the two directions for the NPC's hitbox to be generous. - float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f); - float hitboxEdgeDist = nPC.Distance(player.Center) - generousHitboxWidth; - - if (hitboxEdgeDist < 0) - hitboxEdgeDist = 0; - - if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage && hitboxEdgeDist < maxDistance) - { - damageBoost += MathHelper.Lerp(0f, 0.3f, 1f - (hitboxEdgeDist / maxDistance)); - - if (damageBoost >= 0.3f) - { - damageBoost = 0.3f; - break; - } - } - } - player.meleeDamage += damageBoost; - } + player.meleeDamage += modPlayer.warBannerBonus; // The player's true max life value with Calamity adjustments modPlayer.actualMaxLife = player.statLifeMax2; @@ -3751,35 +3730,8 @@ namespace CalamityMod.CalPlayer ((player.head == ArmorIDs.Head.MoltenHelmet && player.body == ArmorIDs.Body.MoltenBreastplate && player.legs == ArmorIDs.Legs.MoltenGreaves) ? 0.2 : 0) + (player.kbGlove ? 0.1 : 0) + (modPlayer.eGauntlet ? 0.1 : 0) + - (modPlayer.yInsignia ? 0.1 : 0); - if (modPlayer.badgeOfBraveryRare) - { - float maxDistance = 480f; // 30 tile distance - float damageBoost = 0f; - for (int l = 0; l < Main.maxNPCs; l++) - { - NPC nPC = Main.npc[l]; - - // Take the longer of the two directions for the NPC's hitbox to be generous. - float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f); - float hitboxEdgeDist = nPC.Distance(player.Center) - generousHitboxWidth; - - if (hitboxEdgeDist < 0) - hitboxEdgeDist = 0; - - if (nPC.active && !nPC.friendly && (nPC.damage > 0 || nPC.boss) && !nPC.dontTakeDamage && hitboxEdgeDist < maxDistance) - { - damageBoost += MathHelper.Lerp(0f, 0.3f, 1f - (hitboxEdgeDist / maxDistance)); - - if (damageBoost >= 0.3f) - { - damageBoost = 0.3f; - break; - } - } - } - damageAdd += damageBoost; - } + (modPlayer.yInsignia ? 0.1 : 0) + + (modPlayer.badgeOfBraveryRare ? modPlayer.warBannerBonus : 0); modPlayer.trueMeleeDamage += damageAdd; // Amalgam boosts diff --git a/CalamityMod.cs b/CalamityMod.cs index 68f5bea4fb..ffefc5e402 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -410,14 +410,14 @@ namespace CalamityMod { NPCID.Crab, 0.05f }, { NPCID.Crawdad, 0.2f }, { NPCID.Crawdad2, 0.2f }, - { NPCID.CultistBoss, 0.1f }, + { NPCID.CultistBoss, 0.15f }, { NPCID.DD2Betsy, 0.1f }, { NPCID.DD2OgreT2, 0.1f }, { NPCID.DD2OgreT3, 0.15f }, { NPCID.DeadlySphere, 0.4f }, { NPCID.DiabolistRed, 0.2f }, { NPCID.DiabolistWhite, 0.2f }, - { NPCID.DukeFishron, 0.1f }, + { NPCID.DukeFishron, 0.15f }, { NPCID.DungeonGuardian, 0.999999f }, { NPCID.DungeonSpirit, 0.2f }, { NPCID.ElfCopter, 0.15f }, @@ -451,9 +451,9 @@ namespace CalamityMod { NPCID.MartianTurret, 0.2f }, { NPCID.MartianWalker, 0.35f }, { NPCID.Mimic, 0.3f }, - { NPCID.MoonLordCore, 0.05f }, - { NPCID.MoonLordHand, 0.05f }, - { NPCID.MoonLordHead, 0.05f }, + { NPCID.MoonLordCore, 0.15f }, + { NPCID.MoonLordHand, 0.15f }, + { NPCID.MoonLordHead, 0.15f }, { NPCID.Mothron, 0.2f }, { NPCID.MothronEgg, 0.5f }, { NPCID.MourningWood, 0.1f }, diff --git a/Items/Accessories/SamuraiBadge.cs b/Items/Accessories/SamuraiBadge.cs index 56798d087e..2fa867eade 100644 --- a/Items/Accessories/SamuraiBadge.cs +++ b/Items/Accessories/SamuraiBadge.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { DisplayName.SetDefault("Warbanner of the Sun"); Tooltip.SetDefault("Increases melee damage, true melee damage and melee speed the closer you are to enemies\n" + - "Max boost is 30% increased melee damage, true melee damage and melee speed"); + "Max boost is 20% increased melee damage, true melee damage and melee speed"); Main.RegisterItemAnimation(item.type, new DrawAnimationVertical(6, 5)); } diff --git a/Items/Accessories/ShatteredCommunity.cs b/Items/Accessories/ShatteredCommunity.cs index 731ab8fe33..9276cd363e 100644 --- a/Items/Accessories/ShatteredCommunity.cs +++ b/Items/Accessories/ShatteredCommunity.cs @@ -20,8 +20,6 @@ namespace CalamityMod.Items.Accessories private static readonly Color rarityColorOne = new Color(128, 62, 128); private static readonly Color rarityColorTwo = new Color(245, 105, 245); - private bool everInInventory = false; - // Base level cost is 400,000 damage dealt while Rage is active. // Each successive level costs (400,000 * level) MORE damage, so the total required goes up quadratically. // Total required to reach level 60 is 732,000,000 damage dealt. @@ -61,7 +59,6 @@ namespace CalamityMod.Items.Accessories public override ModItem Clone() { var clone = (ShatteredCommunity)base.Clone(); - clone.everInInventory = everInInventory; clone.level = level; clone.totalRageDamage = totalRageDamage; return clone; @@ -69,7 +66,6 @@ namespace CalamityMod.Items.Accessories public override ModItem Clone(Item item) { var clone = (ShatteredCommunity)base.Clone(); - clone.everInInventory = everInInventory; clone.level = level; clone.totalRageDamage = totalRageDamage; return clone; @@ -99,8 +95,6 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot) => !player.Calamity().community; public override bool CanUseItem(Player player) => false; - public override void UpdateInventory(Player player) => everInInventory = true; - // Produces purple light while in the world. public override void PostUpdate() { @@ -164,16 +158,6 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List tooltips) { - // Shattered Community hides its full tooltip when viewed via Recipe Browser or similar. - // Instead, it notifies the player that it must be crafted with a full-power Community. - // Once it has entered a player's inventory, it permanently behaves normally. - if (!everInInventory) - { - tooltips.RemoveAll(line => line.Name != "Tooltip0" && line.Name != "Tooltip1" && line.Name != "Tooltip2" && line.Name.StartsWith("Tooltip")); - tooltips.Find(line => line.Name == "Tooltip2").text = "Must be crafted with a fully powered Community"; - return; - } - // Stat tooltips are added dynamically. StringBuilder sb = new StringBuilder(256); @@ -211,7 +195,6 @@ namespace CalamityMod.Items.Accessories { TagCompound tag = new TagCompound { - { "real", everInInventory }, { "level", level }, { "totalDamage", totalRageDamage } }; @@ -220,21 +203,18 @@ namespace CalamityMod.Items.Accessories public override void Load(TagCompound tag) { - everInInventory = tag.GetBool("real"); level = tag.GetInt("level"); totalRageDamage = tag.GetLong("totalDamage"); } public override void NetSend(BinaryWriter writer) { - writer.Write(everInInventory); writer.Write(level); writer.Write(totalRageDamage); } public override void NetRecieve(BinaryReader reader) { - everInInventory = reader.ReadBoolean(); level = reader.ReadInt32(); totalRageDamage = reader.ReadInt64(); } diff --git a/Items/Armor/Vanity/AshenHorns.cs b/Items/Armor/Vanity/AshenHorns.cs new file mode 100644 index 0000000000..ef4b0359fe --- /dev/null +++ b/Items/Armor/Vanity/AshenHorns.cs @@ -0,0 +1,24 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class AshenHorns : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Ashen Horns"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override void DrawHair(ref bool drawHair, ref bool drawAltHair) + { + drawHair = true; + } + } +} diff --git a/Items/Armor/Vanity/AshenHorns.png b/Items/Armor/Vanity/AshenHorns.png new file mode 100644 index 0000000000..0085c11cf3 Binary files /dev/null and b/Items/Armor/Vanity/AshenHorns.png differ diff --git a/Items/Armor/Vanity/AshenHorns_Head.png b/Items/Armor/Vanity/AshenHorns_Head.png new file mode 100644 index 0000000000..12cc0083ee Binary files /dev/null and b/Items/Armor/Vanity/AshenHorns_Head.png differ diff --git a/Items/Armor/Vanity/SCalBoots.cs b/Items/Armor/Vanity/SCalBoots.cs new file mode 100644 index 0000000000..5557bb0bdc --- /dev/null +++ b/Items/Armor/Vanity/SCalBoots.cs @@ -0,0 +1,19 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class SCalBoots : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Boots"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + } +} diff --git a/Items/Armor/Vanity/SCalBoots.png b/Items/Armor/Vanity/SCalBoots.png new file mode 100644 index 0000000000..2c4283bcd3 Binary files /dev/null and b/Items/Armor/Vanity/SCalBoots.png differ diff --git a/Items/Armor/Vanity/SCalBoots_Legs.png b/Items/Armor/Vanity/SCalBoots_Legs.png new file mode 100644 index 0000000000..867d3c73ea Binary files /dev/null and b/Items/Armor/Vanity/SCalBoots_Legs.png differ diff --git a/Items/Armor/Vanity/SCalMask.cs b/Items/Armor/Vanity/SCalMask.cs new file mode 100644 index 0000000000..b5776465da --- /dev/null +++ b/Items/Armor/Vanity/SCalMask.cs @@ -0,0 +1,21 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class SCalMask : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Hood"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + + public override bool DrawHead() => false; + } +} diff --git a/Items/Armor/Vanity/SCalMask.png b/Items/Armor/Vanity/SCalMask.png new file mode 100644 index 0000000000..bdb80ee25a Binary files /dev/null and b/Items/Armor/Vanity/SCalMask.png differ diff --git a/Items/Armor/Vanity/SCalMask_Head.png b/Items/Armor/Vanity/SCalMask_Head.png new file mode 100644 index 0000000000..818608cb43 Binary files /dev/null and b/Items/Armor/Vanity/SCalMask_Head.png differ diff --git a/Items/Armor/Vanity/SCalRobes.cs b/Items/Armor/Vanity/SCalRobes.cs new file mode 100644 index 0000000000..912ca647e9 --- /dev/null +++ b/Items/Armor/Vanity/SCalRobes.cs @@ -0,0 +1,19 @@ +using Terraria.ModLoader; +using Terraria.ID; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class SCalRobes : ModItem + { + public override void SetStaticDefaults() => DisplayName.SetDefault("Calamitous Robes"); + + public override void SetDefaults() + { + item.width = 28; + item.height = 20; + item.rare = ItemRarityID.Blue; + item.vanity = true; + } + } +} diff --git a/Items/Armor/Vanity/SCalRobes.png b/Items/Armor/Vanity/SCalRobes.png new file mode 100644 index 0000000000..3ddf36518f Binary files /dev/null and b/Items/Armor/Vanity/SCalRobes.png differ diff --git a/Items/Armor/Vanity/SCalRobes_Arms.png b/Items/Armor/Vanity/SCalRobes_Arms.png new file mode 100644 index 0000000000..9e678c9974 Binary files /dev/null and b/Items/Armor/Vanity/SCalRobes_Arms.png differ diff --git a/Items/Armor/Vanity/SCalRobes_Body.png b/Items/Armor/Vanity/SCalRobes_Body.png new file mode 100644 index 0000000000..facccaeb4b Binary files /dev/null and b/Items/Armor/Vanity/SCalRobes_Body.png differ diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index babd4bca52..fedf738286 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -506,7 +506,7 @@ namespace CalamityMod.Items #region SavingAndLoading public override bool NeedsSaving(Item item) { - return true; + return rogue || timesUsed != 0 || customRarity != 0 || Charge != 0 || reforgeTier != 0 || AppliedEnchantment.HasValue || DischargeEnchantExhaustion != 0; } public override TagCompound Save(Item item) diff --git a/Items/Materials/EnchantedMetal.cs b/Items/Materials/EnchantedMetal.cs deleted file mode 100644 index d5bfd938e7..0000000000 --- a/Items/Materials/EnchantedMetal.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class EnchantedMetal : ModItem - { - public override void SetStaticDefaults() - { - DisplayName.SetDefault("Enchanted Metal"); - } - public override void SetDefaults() - { - item.width = 26; - item.height = 20; - item.value = Item.buyPrice(0, 15, 0, 0); - item.rare = ItemRarityID.Pink; - item.maxStack = 99; - } - public override void AddRecipes() - { - ModRecipe recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalEye); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalSkull); - recipe.AddRecipe(); - - recipe = new ModRecipe(mod); - recipe.AddIngredient(item.type, 3); - recipe.AddTile(TileID.MythrilAnvil); - recipe.SetResult(ItemID.MechanicalWorm); - recipe.AddRecipe(); - } - } -} diff --git a/Items/Materials/EnchantedMetal.png b/Items/Materials/EnchantedMetal.png deleted file mode 100644 index bd175ca8e9..0000000000 Binary files a/Items/Materials/EnchantedMetal.png and /dev/null differ diff --git a/Items/PermanentBoosters/InfernalBlood.cs b/Items/PermanentBoosters/InfernalBlood.cs index 8a6ea3caff..9a47a6ab2f 100644 --- a/Items/PermanentBoosters/InfernalBlood.cs +++ b/Items/PermanentBoosters/InfernalBlood.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Infernal Blood"); - Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 2 seconds\n" + + Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 1 second\n" + "Revengeance drop"); } diff --git a/Items/PermanentBoosters/MushroomPlasmaRoot.cs b/Items/PermanentBoosters/MushroomPlasmaRoot.cs index 15498ba769..4dd9b8c833 100644 --- a/Items/PermanentBoosters/MushroomPlasmaRoot.cs +++ b/Items/PermanentBoosters/MushroomPlasmaRoot.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Mushroom Plasma Root"); - Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 2 seconds\n" + + Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 1 second\n" + "Revengeance drop"); } diff --git a/Items/PermanentBoosters/RedLightningContainer.cs b/Items/PermanentBoosters/RedLightningContainer.cs index c22629e1eb..51fedc6db7 100644 --- a/Items/PermanentBoosters/RedLightningContainer.cs +++ b/Items/PermanentBoosters/RedLightningContainer.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void SetStaticDefaults() { DisplayName.SetDefault("Red Lightning Container"); - Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 2 seconds\n" + + Tooltip.SetDefault("Permanently increases the duration of Rage Mode by 1 second\n" + "Revengeance drop"); } diff --git a/Items/TreasureBags/SCalBag.cs b/Items/TreasureBags/SCalBag.cs new file mode 100644 index 0000000000..0478b55c4a --- /dev/null +++ b/Items/TreasureBags/SCalBag.cs @@ -0,0 +1,66 @@ +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Pets; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; + +using SCalBoss = CalamityMod.NPCs.SupremeCalamitas.SupremeCalamitas; + +namespace CalamityMod.Items.TreasureBags +{ + public class SCalBag : ModItem + { + public override int BossBagNPC => ModContent.NPCType(); + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Treasure Coffer"); + Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); + } + + public override void SetDefaults() + { + item.maxStack = 999; + item.consumable = true; + item.width = 24; + item.height = 24; + item.rare = ItemRarityID.Purple; + item.expert = true; + } + + public override bool CanRightClick() => true; + + public override void OpenBossBag(Player player) + { + player.TryGettingDevArmor(); + + // Weapons + float w = DropHelper.BagWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(player, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + + // Equipment + DropHelper.DropItem(player, ModContent.ItemType()); + + // Vanity + if (Main.rand.NextBool(7)) + { + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + DropHelper.DropItem(player, ModContent.ItemType()); + } + } + } +} diff --git a/Items/TreasureBags/SCalBag.png b/Items/TreasureBags/SCalBag.png new file mode 100644 index 0000000000..2fc6a926b0 Binary files /dev/null and b/Items/TreasureBags/SCalBag.png differ diff --git a/Items/Weapons/Melee/AegisBlade.cs b/Items/Weapons/Melee/AegisBlade.cs index da53e41c6b..a6de95ecd1 100644 --- a/Items/Weapons/Melee/AegisBlade.cs +++ b/Items/Weapons/Melee/AegisBlade.cs @@ -66,26 +66,24 @@ namespace CalamityMod.Items.Weapons.Melee 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.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.6), knockBack, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), (int)(damage * 0.6), knockBack, player.whoAmI); return false; } public override void MeleeEffects(Player player, Rectangle hitbox) { if (Main.rand.NextBool(3)) - { - int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); - } + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 246, 0f, 0f, 0, new Color(255, Main.DiscoG, 53)); } public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/BrinyBaron.cs b/Items/Weapons/Melee/BrinyBaron.cs index 0af9ef496d..d7851ac814 100644 --- a/Items/Weapons/Melee/BrinyBaron.cs +++ b/Items/Weapons/Melee/BrinyBaron.cs @@ -78,12 +78,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), knockback, player.whoAmI); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, player.whoAmI); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { - Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.5f), item.knockBack, player.whoAmI); + Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), item.knockBack, player.whoAmI); } } } diff --git a/Items/Weapons/Melee/CometQuasher.cs b/Items/Weapons/Melee/CometQuasher.cs index 0c68934528..dd5aa04bda 100644 --- a/Items/Weapons/Melee/CometQuasher.cs +++ b/Items/Weapons/Melee/CometQuasher.cs @@ -56,8 +56,7 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num112 = 3; - for (int num113 = 0; num113 < num112; num113++) + for (int num113 = 0; num113 < 2; num113++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); diff --git a/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index f8d13e7b1e..1f1d31d5d1 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Items.Weapons.Melee Tooltip.SetDefault("EViL! sMaSH eVIl! SmAsh...ER!\n" + "For every enemy you kill this hammer gains stat bonuses\n" + "These bonuses stack until a cap is reached\n" + - "The bonuses will reset if you get hit or select a different item\n" + + "The bonus stacks will reset if you select a different item\n" + + "The bonus stacks will be reduced by 1 every time you get hit\n" + "Summons fossil spikes on enemy hits"); } @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee item.width = 64; item.height = 66; item.scale = 2f; - item.damage = 50; + item.damage = 80; item.melee = true; item.useAnimation = item.useTime = 38; item.useStyle = ItemUseStyleID.SwingThrow; @@ -44,20 +45,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - OnHitEffect(target.Center, player, knockback); - if (target.life <= 0 && player.Calamity().evilSmasherBoost < 10) player.Calamity().evilSmasherBoost += 1; } - - public override void OnHitPvp(Player player, Player target, int damage, bool crit) - { - OnHitEffect(target.Center, player, item.knockBack); - } - - private void OnHitEffect(Vector2 targetPos, Player player, float knockback) - { - Projectile.NewProjectile(targetPos, Vector2.Zero, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage()), knockback, Main.myPlayer); - } } } diff --git a/Items/Weapons/Melee/FeralthornClaymore.cs b/Items/Weapons/Melee/FeralthornClaymore.cs index c118675f4c..039b478069 100644 --- a/Items/Weapons/Melee/FeralthornClaymore.cs +++ b/Items/Weapons/Melee/FeralthornClaymore.cs @@ -51,20 +51,16 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(BuffID.Venom, 300); - for (int x = 0; x < 2; x++) - Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); - for (int x = 0; x < 2; x++) - Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); } public override void OnHitPvp(Player player, Player target, int damage, bool crit) { target.AddBuff(BuffID.Venom, 300); - for (int x = 0; x < 2; x++) - Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); - for (int x = 0; x < 2; x++) - Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X + 40f + Main.rand.Next(0, 151), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); + Projectile.NewProjectile(player.position.X - 40f + Main.rand.Next(-150, 1), player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), (int)(item.damage * player.MeleeDamage() * 0.4), 0f, Main.myPlayer); } } } diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index f14af05113..90963a5a7d 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -60,8 +60,7 @@ namespace CalamityMod.Items.Weapons.Melee num80 = num72 / num80; } - int num107 = 4; - for (int num108 = 0; num108 < num107; num108++) + for (int num108 = 0; num108 < 3; num108++) { vector2 = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); vector2.X = (vector2.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index ed08789e23..7bc6ada075 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Perdition"); Tooltip.SetDefault("Summons a beacon at the position of the mouse\n" + - "When a target is manually selected via right click it releases torrents of souls from below onto the target\n" + - "The beacon does not move"); + "When a target is manually selected via right click it releases torrents of souls from below onto the target"); } public override void SetDefaults() diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 2a0af9787e..d7798bcc38 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -577,7 +577,7 @@ namespace CalamityMod BossDifficulty.TryGetValue("SupremeCalamitas", out float order); int type = NPCType(); int summon = ItemType(); - List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + List loot = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType() }; string instructions = $"Use an [i:{summon}]"; string despawn = CalamityUtils.ColorMessage("Please don't waste my time.", new Color(0xFF, 0xA5, 0x00)); diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index ae9c089056..da2b8cac3b 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -161,7 +161,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 900, true); + player.AddBuff(ModContent.BuffType(), 300, true); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index 672541c0f1..eaefbf7dcc 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -232,7 +232,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 300, true); player.AddBuff(ModContent.BuffType(), 300, true); } diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index 444abd85a8..c560f7e961 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 180); if (puffedUp) { diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 18d1160721..6b35083632 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -544,8 +544,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 600, true); - player.AddBuff(BuffID.Darkness, 600, true); + player.AddBuff(ModContent.BuffType(), 300, true); } public override void NPCLoot() diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 7515be8701..ad12776944 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -509,7 +509,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 1200, true); + player.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Abyss/EidolonWyrmHeadHuge.cs b/NPCs/Abyss/EidolonWyrmHeadHuge.cs index 4ecf4c442c..c55de5c02b 100644 --- a/NPCs/Abyss/EidolonWyrmHeadHuge.cs +++ b/NPCs/Abyss/EidolonWyrmHeadHuge.cs @@ -214,12 +214,14 @@ namespace CalamityMod.NPCs.Abyss } // Despawn if target is dead + bool targetDead = false; if (player.dead) { npc.TargetClosest(false); player = Main.player[npc.target]; if (player.dead) { + targetDead = true; npc.ai[3] = 0f; npc.localAI[0] = 0f; npc.localAI[1] = 0f; @@ -397,7 +399,7 @@ namespace CalamityMod.NPCs.Abyss Vector2 lightningChargeVectorFlipped = lightningChargeVector * -1f; float lightningSpawnY = 540f; Vector2 lightningSpawnLocation = new Vector2(lightningChargeVector.X, -lightningSpawnY); - int numLightningBolts = 10; + int numLightningBolts = 8; float distanceBetweenBolts = lightningSpawnY * 2f / numLightningBolts; // Velocity and turn speed values @@ -1087,16 +1089,21 @@ namespace CalamityMod.NPCs.Abyss // Lightning barrage if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[3] == 0f) { + if (Main.player[Main.myPlayer].active && !Main.player[Main.myPlayer].dead && Vector2.Distance(Main.player[Main.myPlayer].Center, npc.Center) < soundDistance) + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/LightningStrike"), Main.player[Main.myPlayer].Center); + npc.localAI[3] = 1f; int type = ProjectileID.CultistBossLightningOrbArc; int damage = npc.GetProjectileDamage(type); for (int i = 0; i < numLightningBolts; i++) { - lightningSpawnLocation.Y += distanceBetweenBolts * i; Vector2 projectileDestination = player.Center - lightningSpawnLocation; float ai = Main.rand.Next(100); int proj = Projectile.NewProjectile(lightningSpawnLocation, npc.velocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; + lightningSpawnLocation.Y += distanceBetweenBolts; + if (i == numLightningBolts / 2) + lightningSpawnLocation.Y += distanceBetweenBolts; } } @@ -1303,16 +1310,19 @@ namespace CalamityMod.NPCs.Abyss } } - // Increase velocity if velocity is ever zero - if (npc.velocity == Vector2.Zero) - npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; - - // Acceleration - if (!((destination - npc.Center).Length() < turnDistance)) + if (!targetDead) { - float targetAngle = npc.AngleTo(destination); - float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); - npc.velocity = f.ToRotationVector2() * baseVelocity; + // Increase velocity if velocity is ever zero + if (npc.velocity == Vector2.Zero) + npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + + // Acceleration + if (!((destination - npc.Center).Length() < turnDistance)) + { + float targetAngle = npc.AngleTo(destination); + float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + npc.velocity = f.ToRotationVector2() * baseVelocity; + } } // Velocity upper limit diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index a8a8cf7e47..aafb72f870 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -162,7 +162,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } } diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index e5a02e6d21..cc7938f5b2 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -162,7 +162,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } } diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index d022691127..2149a4dcfe 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -380,7 +380,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 300, true); player.AddBuff(ModContent.BuffType(), 300, true); } } diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index 9ffad34b42..6062317091 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -161,7 +161,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 60, true); player.AddBuff(ModContent.BuffType(), 60, true); } } diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 0af989517b..7bef66a3c8 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -69,7 +69,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); player.AddBuff(BuffID.Venom, 90, true); } diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 6d439fa7b1..d920ff7068 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -1,7 +1,6 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.World; using Microsoft.Xna.Framework; using System; @@ -348,7 +347,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(ModContent.BuffType(), 90); } } } diff --git a/NPCs/Abyss/Reaper.cs b/NPCs/Abyss/Reaper.cs index 7e679ff5b5..7c447ec42e 100644 --- a/NPCs/Abyss/Reaper.cs +++ b/NPCs/Abyss/Reaper.cs @@ -627,9 +627,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Darkness, 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); player.AddBuff(ModContent.BuffType(), 300, true); } diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 519f43f74c..bde527ebfc 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -113,7 +113,7 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + player.AddBuff(BuffID.Poisoned, 120, true); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index bd3f24e2a3..fd343b31b2 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -96,7 +96,6 @@ namespace CalamityMod.NPCs.Abyss public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index 1f25d972ac..513b166b73 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -154,6 +154,6 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index 817b571180..01d52e8b43 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -189,6 +189,6 @@ namespace CalamityMod.NPCs.AcidRain public override void NPCLoot() => DropHelper.DropItemChance(npc, ModContent.ItemType(), 30); - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 22c2f99d1a..2f74df3527 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -111,7 +111,7 @@ namespace CalamityMod.NPCs.AcidRain public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index d31261d687..fee70fb9dd 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -141,7 +141,7 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); public override void PostDraw(SpriteBatch spriteBatch, Color drawColor) => CalamityGlobalNPC.DrawGlowmask(npc, spriteBatch, ModContent.GetTexture(Texture + "Glow"), true); } diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index e7754f40b8..8a775663ad 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -244,6 +244,6 @@ namespace CalamityMod.NPCs.AcidRain } } - public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, int damage, bool crit) => target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/NPCs/AquaticScourge/AquaticParasite.cs b/NPCs/AquaticScourge/AquaticParasite.cs index 720f0b824a..d83d57199d 100644 --- a/NPCs/AquaticScourge/AquaticParasite.cs +++ b/NPCs/AquaticScourge/AquaticParasite.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using Microsoft.Xna.Framework; using System; @@ -193,7 +194,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index 0e341dc802..3d1f279382 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -139,8 +140,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index 59f2339a34..a8ed986573 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -137,8 +138,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index e7bb9fe125..4f024cb160 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.LoreItems; @@ -260,8 +261,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 360, true); - player.AddBuff(BuffID.Venom, 360, true); + player.AddBuff(ModContent.BuffType(), 360, true); } } } diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 147fd4bd66..7cb06929d0 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -136,8 +137,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/AquaticScourge/AquaticSeekerHead.cs b/NPCs/AquaticScourge/AquaticSeekerHead.cs index 49f2ccd77d..43de2652ed 100644 --- a/NPCs/AquaticScourge/AquaticSeekerHead.cs +++ b/NPCs/AquaticScourge/AquaticSeekerHead.cs @@ -300,8 +300,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/AquaticScourge/AquaticUrchin.cs b/NPCs/AquaticScourge/AquaticUrchin.cs index 18727ea594..b8e1710feb 100644 --- a/NPCs/AquaticScourge/AquaticUrchin.cs +++ b/NPCs/AquaticScourge/AquaticUrchin.cs @@ -1,7 +1,6 @@ -using CalamityMod.Events; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -40,7 +39,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); + player.AddBuff(ModContent.BuffType(), 120, true); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 2cb13bbad4..5d0dd8115c 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -627,7 +627,7 @@ namespace CalamityMod.NPCs.Astral public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(ModContent.BuffType(), 300, true); } public override void NPCLoot() diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 8f17bfe511..cfdf6e8a5d 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Calamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index bcbe90e9e1..0129bfff98 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -184,7 +184,7 @@ namespace CalamityMod.NPCs.Calamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 4f297c5c02..e08fe2fdad 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -183,7 +183,7 @@ namespace CalamityMod.NPCs.Calamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 47d4ebff58..ca2069c807 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -258,7 +258,7 @@ namespace CalamityMod.NPCs.Calamitas public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Calamitas/LifeSeeker.cs b/NPCs/Calamitas/LifeSeeker.cs index ecae78c18f..d676ab6f0a 100644 --- a/NPCs/Calamitas/LifeSeeker.cs +++ b/NPCs/Calamitas/LifeSeeker.cs @@ -108,11 +108,6 @@ namespace CalamityMod.NPCs.Calamitas return false; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(ModContent.BuffType(), 120, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 093719ee1f..a5b03df850 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1218,7 +1218,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.Golem) { - npc.lifeMax = (int)(npc.lifeMax * 3.5); + npc.lifeMax = (int)(npc.lifeMax * 4.0); npc.npcSlots = 64f; } else if (npc.type == NPCID.GolemHead) @@ -1232,7 +1232,7 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.Plantera) { - npc.lifeMax = (int)(npc.lifeMax * 2.35); + npc.lifeMax = (int)(npc.lifeMax * 2.6); npc.npcSlots = 32f; } else if (npc.type == NPCID.WallofFlesh || npc.type == NPCID.WallofFleshEye) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index f012c62c28..2e4c4648f3 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -116,7 +116,6 @@ namespace CalamityMod.NPCs.Crags public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/NPCs/Crags/CharredSlime.cs b/NPCs/Crags/CharredSlime.cs index cebba881d9..ab5b668108 100644 --- a/NPCs/Crags/CharredSlime.cs +++ b/NPCs/Crags/CharredSlime.cs @@ -1,5 +1,5 @@ using CalamityMod.World; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; @@ -54,7 +54,12 @@ namespace CalamityMod.NPCs.Crags return spawnInfo.player.Calamity().ZoneCalamity ? 0.08f : 0f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/Crags/CultistAssassin.cs b/NPCs/Crags/CultistAssassin.cs index 517778560e..7b03fe74f4 100644 --- a/NPCs/Crags/CultistAssassin.cs +++ b/NPCs/Crags/CultistAssassin.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -45,7 +45,12 @@ namespace CalamityMod.NPCs.Crags return (spawnInfo.player.Calamity().ZoneCalamity || spawnInfo.player.ZoneDungeon) && Main.hardMode ? 0.04f : 0f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index aa43a3ece5..ab1a5ec815 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; @@ -57,7 +57,12 @@ namespace CalamityMod.NPCs.Crags DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/NormalNPCs/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs similarity index 84% rename from NPCs/NormalNPCs/HeatSpirit.cs rename to NPCs/Crags/HeatSpirit.cs index 3467711ba5..4d066baeb4 100644 --- a/NPCs/NormalNPCs/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -6,7 +6,7 @@ using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.NormalNPCs +namespace CalamityMod.NPCs.Crags { public class HeatSpirit : ModNPC { @@ -32,16 +32,12 @@ namespace CalamityMod.NPCs.NormalNPCs bannerItem = ModContent.ItemType(); } - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.playerSafe || !Main.hardMode) - { - return 0f; - } - return SpawnCondition.Underworld.Chance * 0.065f; - } + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + return spawnInfo.player.Calamity().ZoneCalamity ? 0.125f : 0f; + } - public override void FindFrame(int frameHeight) + public override void FindFrame(int frameHeight) { if (npc.velocity.X < 0f) { @@ -73,7 +69,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } @@ -94,7 +89,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void NPCLoot() { - DropHelper.DropItemChance(npc, ModContent.ItemType(), 0.25f); - } + DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 4, 1, 1); + } } } diff --git a/NPCs/NormalNPCs/HeatSpirit.png b/NPCs/Crags/HeatSpirit.png similarity index 100% rename from NPCs/NormalNPCs/HeatSpirit.png rename to NPCs/Crags/HeatSpirit.png diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 88c833e11a..9376752557 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -1,8 +1,7 @@ using CalamityMod.Dusts; -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -257,7 +256,12 @@ namespace CalamityMod.NPCs.Crags DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 688a356851..2742b488c7 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -1,8 +1,7 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; using Terraria; using Terraria.ID; @@ -257,7 +256,12 @@ namespace CalamityMod.NPCs.Crags DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.hardMode, 3, 1, 1); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index b6dffd4fc4..2f880ba559 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -1,4 +1,4 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; @@ -280,7 +280,12 @@ namespace CalamityMod.NPCs.Crags DropHelper.DropItemChance(npc, ModContent.ItemType(), (Main.hardMode ? 30 : 10)); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 120, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) { diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index f40071661d..3acb7e383c 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -257,7 +257,6 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBody2.cs b/NPCs/DevourerofGods/DevourerofGodsBody2.cs index 2a8e7670cc..cceaf8c976 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody2.cs @@ -220,7 +220,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 120, true); - player.AddBuff(BuffID.Frostburn, 120, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs index 8e95007eec..62a457b27d 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBodyS.cs @@ -283,7 +283,6 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 240, true); player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.Frostburn, 240, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 70d762a4dc..e8f5e17eef 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -988,7 +988,6 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 300, true); player.AddBuff(ModContent.BuffType(), 420, true); - player.AddBuff(BuffID.Frostburn, 300, true); /*if (CalamityWorld.death && !player.Calamity().lol) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); diff --git a/NPCs/DevourerofGods/DevourerofGodsHead2.cs b/NPCs/DevourerofGods/DevourerofGodsHead2.cs index 345e53a3f7..d254c887a4 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead2.cs @@ -393,7 +393,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Frostburn, 180, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs index 627b9464c0..91e34ed629 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHeadS.cs @@ -1366,7 +1366,6 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 300, true); player.AddBuff(ModContent.BuffType(), 420, true); - player.AddBuff(BuffID.Frostburn, 300, true); /*if ((CalamityWorld.death || BossRushEvent.BossRushActive) && (npc.alpha <= 0 || postTeleportTimer > 0) && !player.Calamity().lol && preventBullshitHitsAtStartofFinalPhaseTimer <= 0) { player.KillMe(PlayerDeathReason.ByCustomReason(player.name + "'s essence was consumed by the devourer."), 1000.0, 0, false); diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index 09348e7048..e7375417c3 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -247,7 +247,6 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 180, true); player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(BuffID.Frostburn, 180, true); if (player.Calamity().dogTextCooldown <= 0) { diff --git a/NPCs/DevourerofGods/DevourerofGodsTail2.cs b/NPCs/DevourerofGods/DevourerofGodsTail2.cs index 56d963d099..935e392980 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail2.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail2.cs @@ -217,7 +217,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 90, true); - player.AddBuff(BuffID.Frostburn, 90, true); } } } diff --git a/NPCs/DevourerofGods/DevourerofGodsTailS.cs b/NPCs/DevourerofGods/DevourerofGodsTailS.cs index 2bc0b738b9..7d1e991d65 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTailS.cs @@ -319,7 +319,6 @@ namespace CalamityMod.NPCs.DevourerofGods { player.AddBuff(ModContent.BuffType(), 180, true); player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(BuffID.Frostburn, 180, true); if (player.Calamity().dogTextCooldown <= 0) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index f4777b1b0f..d362e877f6 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -139,8 +139,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.localAI[2] == 0f) npc.localAI[2] = npc.ai[0]; - bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; - if (shootTrackingLasers) + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootLasers && !invisiblePhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -191,6 +191,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); for (int i = 0; i < numProjectiles; i++) { // Normal laser @@ -332,17 +333,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (vulnerable) { // Noise - float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.25f : 1f; + float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; if (npc.localAI[0] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); // Steam - float maxSteamTime = 180f; npc.localAI[0] += 1f; - if (npc.localAI[0] < maxSteamTime) + if (npc.localAI[0] < ThanatosHead.ventDuration) { SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; - SmokeDrawer.ParticleSpawnRate = 3; + SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; } } else @@ -423,9 +423,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Swap between venting and non-venting frames CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; npc.frameCounter += 1D; - if (shootTrackingLasers) + if (shootLasers && !invisiblePhase) { if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 33d377f148..83fb0b7418 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -139,8 +139,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.localAI[2] == 0f) npc.localAI[2] = npc.ai[0]; - bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; - if (shootTrackingLasers) + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootLasers && !invisiblePhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -191,6 +191,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); for (int i = 0; i < numProjectiles; i++) { // Normal laser @@ -332,17 +333,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (vulnerable) { // Noise - float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.25f : 1f; + float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; if (npc.localAI[0] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); // Steam - float maxSteamTime = 180f; npc.localAI[0] += 1f; - if (npc.localAI[0] < maxSteamTime) + if (npc.localAI[0] < ThanatosHead.ventDuration) { SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; - SmokeDrawer.ParticleSpawnRate = 3; + SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; } } else @@ -423,9 +423,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Swap between venting and non-venting frames CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; npc.frameCounter += 1D; - if (shootTrackingLasers) + if (shootLasers && !invisiblePhase) { if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) { diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index 933b025751..1c77ac9bb2 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -52,6 +52,12 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Whether the head is venting heat or not, it is vulnerable to damage during venting private bool vulnerable = false; + // Max time in vent phase + public const float ventDuration = 180f; + + // Spawn rate for vent clouds + public const int ventCloudSpawnRate = 5; + // Default life ratio for the other mechs private const float defaultLifeRatio = 5f; @@ -268,20 +274,31 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Despawn if target is dead - if (player.dead) - { - npc.TargetClosest(false); - - npc.velocity.Y += 2f; - if (npc.position.Y > Main.worldSurface * 16.0) - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.rockLayer * 16.0) + bool targetDead = false; + if (player.dead) + { + npc.TargetClosest(false); + player = Main.player[npc.target]; + if (player.dead) { - for (int a = 0; a < Main.maxNPCs; a++) + targetDead = true; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + + npc.velocity.Y += 2f; + if (npc.position.Y > Main.worldSurface * 16.0) + npc.velocity.Y += 2f; + + if (npc.position.Y > Main.rockLayer * 16.0) { - if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; + for (int a = 0; a < Main.maxNPCs; a++) + { + if (Main.npc[a].type == npc.type || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) + Main.npc[a].active = false; + } } } } @@ -315,11 +332,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Phase gate values float velocityAdjustTime = 20f; - float speedUpTime = 480f; - float slowDownTime = 120f; + float speedUpTime = berserk ? 360f : 480f; + float slowDownTime = berserk ? 90f : 120f; float chargePhaseGateValue = speedUpTime + slowDownTime; - float laserBarrageDuration = 420f; + float laserBarrageDuration = berserk ? 330f : 420f; // Adjust opacity bool invisiblePhase = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune; @@ -361,8 +378,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float turnDegrees = baseVelocity * 0.11f; if (berserk) { - baseVelocity *= 1.2f; - turnDegrees *= 1.2f; + baseVelocity *= 1.25f; + turnDegrees *= 1.25f; } float turnSpeed = MathHelper.ToRadians(turnDegrees); float chargeVelocityMult = MathHelper.Lerp(1f, 1.5f, chargeVelocityScalar); @@ -380,7 +397,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float deathrayVelocityScalarIncrement = 1f / deathrayDuration; // Scalar to use during laser barrage, passive and immune phases - float laserBarrageVelocityScalarIncrement = 0.01f; + float laserBarrageVelocityScalarIncrement = berserk ? 0.02f : 0.01f; float laserBarrageVelocityScalarDecrement = 1f / velocityAdjustTime; // Distance from target @@ -396,7 +413,15 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { if (phase2 && !berserk) { + // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + if (Main.netMode != NetmodeID.MultiplayerClient) { // Spawn code here @@ -410,14 +435,29 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Do not run this if any exo mech is dead if ((anyOtherExoMechPassive || lessThan70PercentLife) && !berserk && totalOtherExoMechLifeRatio < 5f) { - // Tells Thanatos to return to the battle in passive state + // Tells Thanatos to return to the battle in passive state and reset everything SecondaryAIState = (float)SecondaryPhase.Passive; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); } // Go passive and immune if one of the other mechs is berserk // This is only called if two exo mechs are alive if (otherMechIsBerserk) + { + // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } } break; @@ -430,13 +470,28 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Enter passive and invincible phase if one of the other exo mechs is berserk if (otherMechIsBerserk) + { + // Reset everything SecondaryAIState = (float)SecondaryPhase.PassiveAndImmune; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); + } // If Thanatos is the first mech to go berserk if (berserk) { - // Reset + // Reset everything AIState = (float)Phase.Charge; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -453,15 +508,27 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Enter the fight again if any of the other exo mechs is below 70% and the other mechs aren't berserk if ((exoPrimeLifeRatio < 0.7f || exoSpazLifeRatio < 0.7f || exoRetLifeRatio < 0.7f) && !otherMechIsBerserk) { - // Tells Thanatos to return to the battle in passive state + // Tells Thanatos to return to the battle in passive state and reset everything // Return to normal phases if one or more mechs have been downed SecondaryAIState = totalOtherExoMechLifeRatio > 5f ? (float)SecondaryPhase.Nothing : (float)SecondaryPhase.Passive; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); } if (berserk) { - // Reset + // Reset everything AIState = (float)Phase.Charge; + npc.localAI[0] = 0f; + npc.localAI[2] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + chargeVelocityScalar = 0f; + npc.TargetClosest(); // Never be passive if berserk SecondaryAIState = (float)SecondaryPhase.Nothing; @@ -547,7 +614,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] >= velocityAdjustTime) { - npc.localAI[0] = /*berserk ? 1f : 0f*/ 1f; + npc.localAI[0] = (berserk || otherExoMechsAlive == 0) ? 1f : 0f; AIState = (float)Phase.Charge; calamityGlobalNPC.newAI[2] = 0f; calamityGlobalNPC.newAI[3] = 0f; @@ -567,7 +634,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos vulnerable = true; // If close enough to the target, prepare to fire deathray - bool readyToFireDeathray = distanceFromTarget < 800f; + float slowDownDistance = 800f; + bool readyToFireDeathray = distanceFromTarget < slowDownDistance; if (readyToFireDeathray) npc.localAI[2] = 1f; @@ -599,8 +667,13 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos // Gradually turn and move slower if within 50 tiles of the target if (npc.localAI[2] == 1f) { - baseVelocity *= distanceFromTarget / 800f; - turnSpeed *= distanceFromTarget / 800f; + // Exponentially scale down velocity if close to the target + float velocityScale = distanceFromTarget / slowDownDistance; + if (velocityScale < 1f) + velocityScale *= velocityScale; + + baseVelocity *= velocityScale; + turnSpeed *= velocityScale; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) { @@ -638,7 +711,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { int type = ModContent.ProjectileType(); int damage = npc.GetProjectileDamage(type); - int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, 255, npc.whoAmI); + int laser = Projectile.NewProjectile(npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, npc.whoAmI); if (Main.projectile.IndexInRange(laser)) Main.projectile[laser].ai[0] = npc.whoAmI; } @@ -680,12 +753,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent"), npc.Center); // Steam - float maxSteamTime = 180f; npc.localAI[1] += 1f; - if (npc.localAI[1] < maxSteamTime) + if (npc.localAI[1] < ventDuration) { SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; - SmokeDrawer.ParticleSpawnRate = 3; + SmokeDrawer.ParticleSpawnRate = ventCloudSpawnRate; } } else @@ -693,16 +765,19 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos SmokeDrawer.Update(); - // Increase velocity if velocity is ever zero - if (npc.velocity == Vector2.Zero) - npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; - - // Acceleration - if (!((destination - npc.Center).Length() < turnDistance)) + if (!targetDead) { - float targetAngle = npc.AngleTo(destination); - float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); - npc.velocity = f.ToRotationVector2() * baseVelocity; + // Increase velocity if velocity is ever zero + if (npc.velocity == Vector2.Zero) + npc.velocity = Vector2.Normalize(player.Center - npc.Center).SafeNormalize(Vector2.Zero) * baseVelocity; + + // Acceleration + if (!((destination - npc.Center).Length() < turnDistance)) + { + float targetAngle = npc.AngleTo(destination); + float f = npc.velocity.ToRotation().AngleTowards(targetAngle, turnSpeed); + npc.velocity = f.ToRotationVector2() * baseVelocity; + } } // Velocity upper limit diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 2f718d7be1..1d3724bd5b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -138,8 +138,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (npc.localAI[2] == 0f) npc.localAI[2] = npc.ai[0]; - bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; - if (shootTrackingLasers) + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + if (shootLasers && !invisiblePhase) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -190,6 +190,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon").WithVolume(0.1f), npc.Center); for (int i = 0; i < numProjectiles; i++) { // Normal laser @@ -331,17 +332,16 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (vulnerable) { // Noise - float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.25f : 1f; + float volume = calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge ? 0.1f : 1f; if (npc.localAI[0] == 0f) Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/ThanatosVent").WithVolume(volume), npc.Center); // Steam - float maxSteamTime = 180f; npc.localAI[0] += 1f; - if (npc.localAI[0] < maxSteamTime) + if (npc.localAI[0] < ThanatosHead.ventDuration) { SmokeDrawer.BaseMoveRotation = npc.rotation - MathHelper.PiOver2; - SmokeDrawer.ParticleSpawnRate = 3; + SmokeDrawer.ParticleSpawnRate = ThanatosHead.ventCloudSpawnRate; } } else @@ -422,9 +422,10 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Swap between venting and non-venting frames CalamityGlobalNPC calamityGlobalNPC_Head = Main.npc[(int)npc.ai[2]].Calamity(); - bool shootTrackingLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; + bool invisiblePhase = calamityGlobalNPC_Head.newAI[1] == (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; + bool shootLasers = (calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.Charge || calamityGlobalNPC_Head.newAI[0] == (float)ThanatosHead.Phase.UndergroundLaserBarrage) && calamityGlobalNPC_Head.newAI[2] > 0f; npc.frameCounter += 1D; - if (shootTrackingLasers) + if (shootLasers && !invisiblePhase) { if (npc.Calamity().newAI[1] == 0f && npc.Calamity().newAI[0] > 0f) { diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 128392b785..3ed9eed015 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -613,8 +613,7 @@ namespace CalamityMod.NPCs.GreatSandShark public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Rabies, 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); + player.AddBuff(BuffID.Bleeding, 300, true); } } } diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index b706b04af9..661ff91b49 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -175,7 +175,7 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Wet, 120, true); + player.AddBuff(BuffID.Bleeding, 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 19ffe9175f..e7a7dae482 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -769,7 +769,7 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Wet, 240, true); + target.AddBuff(BuffID.Bleeding, 240, true); } public override bool CheckActive() diff --git a/NPCs/Leviathan/Parasea.cs b/NPCs/Leviathan/Parasea.cs index ed5662c6a6..8f882d9ddc 100644 --- a/NPCs/Leviathan/Parasea.cs +++ b/NPCs/Leviathan/Parasea.cs @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.Leviathan public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Wet, 60, true); + player.AddBuff(BuffID.Bleeding, 60, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 2b69aa12f4..59e5c088a1 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -781,11 +781,6 @@ namespace CalamityMod.NPCs.Leviathan Leviathan.DropSirenLeviLoot(npc); } - public override void OnHitPlayer(Player target, int damage, bool crit) - { - target.AddBuff(BuffID.Wet, 120, true); - } - public override bool CheckActive() { return false; diff --git a/NPCs/NormalNPCs/AngryDog.cs b/NPCs/NormalNPCs/AngryDog.cs index 13b0d03839..39bc9c7303 100644 --- a/NPCs/NormalNPCs/AngryDog.cs +++ b/NPCs/NormalNPCs/AngryDog.cs @@ -125,7 +125,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); + player.AddBuff(BuffID.Frostburn, 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index f05c040215..7fade23b01 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -141,12 +141,6 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 180, true); - player.AddBuff(BuffID.Electrified, 120, true); - } - public override bool CheckActive() { return false; diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 8f38f46cd6..e4e919b725 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -386,12 +386,6 @@ namespace CalamityMod.NPCs.NormalNPCs return false; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 240, true); - player.AddBuff(BuffID.Electrified, 180, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 44ce657a2e..c42785cc4e 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -99,12 +99,6 @@ namespace CalamityMod.NPCs.NormalNPCs } } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.Chilled, 120, true); - player.AddBuff(BuffID.Electrified, 90, true); - } - public override bool CheckActive() { return false; diff --git a/NPCs/NormalNPCs/BlightedEye.cs b/NPCs/NormalNPCs/BlightedEye.cs index b44f7eddd0..72a085368e 100644 --- a/NPCs/NormalNPCs/BlightedEye.cs +++ b/NPCs/NormalNPCs/BlightedEye.cs @@ -57,7 +57,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 120, true); + player.AddBuff(BuffID.Weak, 180, true); } public override void NPCLoot() diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 18f5ccedc2..577d48c3b2 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -64,8 +64,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.ManaSickness, 120, true); - player.AddBuff(BuffID.Confused, 120, true); + player.AddBuff(BuffID.Cursed, 60, true); } public override void NPCLoot() diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index 521cef9d8f..e623d647c6 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -46,7 +46,13 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.Cavern.Chance * 0.08f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } + + public override void HitEffect(int hitDirection, double damage) { // TODO -- This dust was an invalid dust. Replaced with a random dust. int dustType = 91; diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 355d71b86c..67a6bedab7 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -74,12 +74,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.NextBool(3)) - { - player.AddBuff(ModContent.BuffType(), 30, true); - } - } + player.AddBuff(BuffID.Frostburn, 120, true); + player.AddBuff(BuffID.Chilled, 90, true); + } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index e2c6130047..308a6c6d61 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -61,7 +61,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.ManaSickness, 120, true); player.AddBuff(BuffID.Weak, 120, true); } diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index eed82d34ff..eae55024b2 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -246,11 +246,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Frostburn, 300, true); - if (Main.rand.NextBool(3)) - { - player.AddBuff(ModContent.BuffType(), 30, true); - } + player.AddBuff(BuffID.Frostburn, 180, true); + player.AddBuff(BuffID.Chilled, 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index f6c13c649d..d90e8276de 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using CalamityMod.World; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -79,9 +80,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, ProjectileID.SolarWhipSwordExplosion, 0, 0f, Main.myPlayer); - } + Projectile.NewProjectile(player.Center, Vector2.Zero, ProjectileID.SolarWhipSwordExplosion, 0, 0f, Main.myPlayer); } public override void FindFrame(int frameHeight) diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 4f8350d4a1..f2712b0592 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -410,7 +410,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60); + player.AddBuff(ModContent.BuffType(), 120); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index 9a9aab2596..7bba946c20 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -404,7 +404,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 60); + player.AddBuff(ModContent.BuffType(), 120); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs index ed4f99cf74..7304c27f16 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyLantern.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyLantern.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; @@ -222,7 +223,12 @@ namespace CalamityMod.NPCs.NormalNPCs return true; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index f87c92d4b2..4d454791a3 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -159,7 +159,12 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.OverworldHallow.Chance / 4f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.soundDelay == 0) { diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 02603db49e..b6cca2936c 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -386,11 +386,6 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.Sky.Chance * 0.1f; } - 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); diff --git a/NPCs/NormalNPCs/SunBat.cs b/NPCs/NormalNPCs/SunBat.cs index ff1056a975..b99d1cc2a2 100644 --- a/NPCs/NormalNPCs/SunBat.cs +++ b/NPCs/NormalNPCs/SunBat.cs @@ -64,7 +64,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index cfb9ab90f9..a07e784564 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -215,7 +215,6 @@ namespace CalamityMod.NPCs.NormalNPCs public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.OnFire, 120, true); player.AddBuff(ModContent.BuffType(), 120, true); } diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 7b3083e45e..ebf827fcd5 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -280,7 +280,12 @@ namespace CalamityMod.NPCs.NormalNPCs return SpawnCondition.Sky.Chance * 0.1f; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 18fc5484d2..9459854e2b 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -417,10 +417,7 @@ namespace CalamityMod.NPCs.OldDuke public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - player.AddBuff(BuffID.Poisoned, 300, true); - player.AddBuff(ModContent.BuffType(), 300); + player.AddBuff(ModContent.BuffType(), 480); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/OldDuke/OldDukeSharkron.cs b/NPCs/OldDuke/OldDukeSharkron.cs index 12988856b5..2e009de779 100644 --- a/NPCs/OldDuke/OldDukeSharkron.cs +++ b/NPCs/OldDuke/OldDukeSharkron.cs @@ -204,10 +204,7 @@ namespace CalamityMod.NPCs.OldDuke public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 180, true); - player.AddBuff(BuffID.Rabies, 180, true); - player.AddBuff(BuffID.Poisoned, 180, true); - player.AddBuff(ModContent.BuffType(), 180); + player.AddBuff(ModContent.BuffType(), 240); } public override bool CheckDead() diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 82f0f46799..ea7aece799 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -178,9 +178,7 @@ namespace CalamityMod.NPCs.OldDuke public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 180, true); - player.AddBuff(BuffID.Poisoned, 180, true); - player.AddBuff(ModContent.BuffType(), 180); + player.AddBuff(ModContent.BuffType(), 240); } public override bool CheckDead() diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index 4d31e22e11..453aab72e3 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -134,7 +134,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); } } } diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index d581177a2d..7d42766093 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -217,7 +217,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 120, true); - player.AddBuff(BuffID.Bleeding, 120, true); } } } diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 6bb0b5b173..6d10b3d5b3 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -137,7 +137,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 90, true); - player.AddBuff(BuffID.Bleeding, 90, true); } } } diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index f99789bd6f..41f1d79ba1 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -561,7 +561,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 300, true); - player.AddBuff(BuffID.Bleeding, 300, true); } } } diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 74a3e72e3a..9a425cdc1d 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -457,7 +457,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 240, true); - player.AddBuff(BuffID.Bleeding, 240, true); } } } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index 9b8705e5c8..86ef2253d7 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -500,7 +500,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 180, true); - player.AddBuff(BuffID.Bleeding, 180, true); } } } diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index ba94da2886..52221159cb 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; @@ -502,7 +503,12 @@ namespace CalamityMod.NPCs.Perforator CalamityNetcode.SyncWorld(); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < damage / npc.lifeMax * 100.0; k++) { diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 6b15f31b17..7b44de8380 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -122,7 +122,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 90, true); - player.AddBuff(BuffID.Bleeding, 90, true); } } } diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 28b35c0ac9..eb3985e6cb 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -184,7 +184,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 60, true); - player.AddBuff(BuffID.Bleeding, 60, true); } } } diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 354aa2f694..c1880d42a1 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -127,7 +127,6 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player player, int damage, bool crit) { player.AddBuff(ModContent.BuffType(), 60, true); - player.AddBuff(BuffID.Bleeding, 60, true); } } } diff --git a/NPCs/PlagueEnemies/PlagueBee.cs b/NPCs/PlagueEnemies/PlagueBee.cs index 337d08d151..1771277b48 100644 --- a/NPCs/PlagueEnemies/PlagueBee.cs +++ b/NPCs/PlagueEnemies/PlagueBee.cs @@ -110,7 +110,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 180, true); + player.AddBuff(ModContent.BuffType(), 120, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlagueEnemies/PlaguedDerpling.cs b/NPCs/PlagueEnemies/PlaguedDerpling.cs index 9ac9335c55..1bbcb275e6 100644 --- a/NPCs/PlagueEnemies/PlaguedDerpling.cs +++ b/NPCs/PlagueEnemies/PlaguedDerpling.cs @@ -158,7 +158,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlagueEnemies/PlaguedFlyingFox.cs b/NPCs/PlagueEnemies/PlaguedFlyingFox.cs index dc0f7e1d3f..10d5c7aa54 100644 --- a/NPCs/PlagueEnemies/PlaguedFlyingFox.cs +++ b/NPCs/PlagueEnemies/PlaguedFlyingFox.cs @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/PlagueEnemies/PlaguedJungleSlime.cs b/NPCs/PlagueEnemies/PlaguedJungleSlime.cs index a8ca82cdbd..e1d1facfc2 100644 --- a/NPCs/PlagueEnemies/PlaguedJungleSlime.cs +++ b/NPCs/PlagueEnemies/PlaguedJungleSlime.cs @@ -130,7 +130,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/PlagueEnemies/PlaguedTortoise.cs b/NPCs/PlagueEnemies/PlaguedTortoise.cs index 7feecda54e..6fb5c503cb 100644 --- a/NPCs/PlagueEnemies/PlaguedTortoise.cs +++ b/NPCs/PlagueEnemies/PlaguedTortoise.cs @@ -61,7 +61,7 @@ namespace CalamityMod.NPCs.PlagueEnemies public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void NPCLoot() diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 12ce326a39..5e18cbe21d 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -1,5 +1,5 @@ +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; @@ -157,6 +157,11 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override bool PreNPCLoot() => false; + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 240, true); + } + public override bool CheckDead() { Main.PlaySound(SoundID.Item14, npc.position); diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs index 2ada7a26c3..3677e079a6 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerShade.cs @@ -640,7 +640,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 120, true); + player.AddBuff(ModContent.BuffType(), 240, true); } } } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index c4f8ab0315..2e03fb5649 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -148,9 +148,14 @@ namespace CalamityMod.NPCs.Polterghast Vector2 rotationVector = lookAt - vector; // Rotation - float num740 = player.Center.X + predictionVector.X - vector.X; - float num741 = player.Center.Y + predictionVector.Y - vector.Y; - npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + if (npc.Calamity().newAI[3] == 0f) + { + float num740 = player.Center.X + predictionVector.X - vector.X; + float num741 = player.Center.Y + predictionVector.Y - vector.Y; + npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + } + else + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; npc.damage = npc.defDamage; diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 07781cbfa9..e1f13ad9d5 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -340,9 +340,14 @@ namespace CalamityMod.NPCs.Polterghast Vector2 rotationVector = lookAt - vector; // Rotation - float num740 = player.Center.X + predictionVector.X - vector.X; - float num741 = player.Center.Y + predictionVector.Y - vector.Y; - npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + if (calamityGlobalNPC.newAI[3] == 0f) + { + float num740 = player.Center.X + predictionVector.X - vector.X; + float num741 = player.Center.Y + predictionVector.Y - vector.Y; + npc.rotation = (float)Math.Atan2(num741, num740) + MathHelper.PiOver2; + } + else + npc.rotation = npc.velocity.ToRotation() + MathHelper.PiOver2; if (!chargePhase) { diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs index 5beea4876f..d9d07d853a 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss2.cs @@ -284,7 +284,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 240, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs index 8f0f4d1d9b..d43081d6b8 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianBoss3.cs @@ -292,7 +292,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 180, true); } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index 2e44c17f11..31fa7133e5 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -193,7 +193,7 @@ namespace CalamityMod.NPCs.Providence public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(ModContent.BuffType(), 300, true); + player.AddBuff(ModContent.BuffType(), 240, true); } public override void HitEffect(int hitDirection, double damage) diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index 059aa6a8af..828be9aa02 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -187,11 +187,6 @@ namespace CalamityMod.NPCs.Providence return true; } - public override void OnHitPlayer(Player player, int damage, bool crit) - { - player.AddBuff(BuffID.OnFire, 600, true); - } - public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 3; k++) diff --git a/NPCs/SlimeGod/SlimeGod.cs b/NPCs/SlimeGod/SlimeGod.cs index c934236acc..d191adca3f 100644 --- a/NPCs/SlimeGod/SlimeGod.cs +++ b/NPCs/SlimeGod/SlimeGod.cs @@ -621,7 +621,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 180, true); + player.AddBuff(BuffID.Weak, 300, true); } } } diff --git a/NPCs/SlimeGod/SlimeGodRun.cs b/NPCs/SlimeGod/SlimeGodRun.cs index 45a09f2b30..83216147d2 100644 --- a/NPCs/SlimeGod/SlimeGodRun.cs +++ b/NPCs/SlimeGod/SlimeGodRun.cs @@ -631,7 +631,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 90, true); + player.AddBuff(BuffID.Cursed, 120, true); } } } diff --git a/NPCs/SlimeGod/SlimeGodRunSplit.cs b/NPCs/SlimeGod/SlimeGodRunSplit.cs index e549251fd3..e696bad571 100644 --- a/NPCs/SlimeGod/SlimeGodRunSplit.cs +++ b/NPCs/SlimeGod/SlimeGodRunSplit.cs @@ -627,7 +627,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 90, true); + player.AddBuff(BuffID.Cursed, 45, true); } } } diff --git a/NPCs/SlimeGod/SlimeGodSplit.cs b/NPCs/SlimeGod/SlimeGodSplit.cs index 190827cb5c..655062459a 100644 --- a/NPCs/SlimeGod/SlimeGodSplit.cs +++ b/NPCs/SlimeGod/SlimeGodSplit.cs @@ -620,7 +620,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Weak, 180, true); + player.AddBuff(BuffID.Weak, 120, true); } } } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson.cs b/NPCs/SlimeGod/SlimeSpawnCrimson.cs index b65ef0b378..e279b841b3 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 60, true); + player.AddBuff(BuffID.Cursed, 30, true); } } } diff --git a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs index e872db3e4e..6396750e57 100644 --- a/NPCs/SlimeGod/SlimeSpawnCrimson2.cs +++ b/NPCs/SlimeGod/SlimeSpawnCrimson2.cs @@ -118,7 +118,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Cursed, 60, true); + player.AddBuff(BuffID.Cursed, 30, true); } } } diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0e1b456c93..5ab2867cfe 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -191,7 +191,12 @@ namespace CalamityMod.NPCs.StormWeaver } } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 90, true); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/StormWeaver/StormWeaverBodyNaked.cs b/NPCs/StormWeaver/StormWeaverBodyNaked.cs index 61728c5214..8d0e61ccc6 100644 --- a/NPCs/StormWeaver/StormWeaverBodyNaked.cs +++ b/NPCs/StormWeaver/StormWeaverBodyNaked.cs @@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 200 : 60; + int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 180 : 90; player.AddBuff(BuffID.Electrified, buffDuration, true); } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index 7b7a42732c..4f3eb1bc61 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -470,7 +470,12 @@ namespace CalamityMod.NPCs.StormWeaver return false; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 180, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/StormWeaver/StormWeaverHeadNaked.cs b/NPCs/StormWeaver/StormWeaverHeadNaked.cs index de834511bd..ea90959448 100644 --- a/NPCs/StormWeaver/StormWeaverHeadNaked.cs +++ b/NPCs/StormWeaver/StormWeaverHeadNaked.cs @@ -606,7 +606,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = npc.Calamity().newAI[0] >= 400f ? 300 : 90; + int buffDuration = npc.Calamity().newAI[0] >= 400f ? 360 : 180; player.AddBuff(BuffID.Electrified, buffDuration, true); } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 467d5c8dfe..654d78c3db 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -165,7 +165,12 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(BuffID.Electrified, 60, true); + } + + public override void HitEffect(int hitDirection, double damage) { for (int k = 0; k < 5; k++) { diff --git a/NPCs/StormWeaver/StormWeaverTailNaked.cs b/NPCs/StormWeaver/StormWeaverTailNaked.cs index cb35add269..fbb13857cc 100644 --- a/NPCs/StormWeaver/StormWeaverTailNaked.cs +++ b/NPCs/StormWeaver/StormWeaverTailNaked.cs @@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player player, int damage, bool crit) { - int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 100 : 30; + int buffDuration = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] >= 400f ? 120 : 60; player.AddBuff(BuffID.Electrified, buffDuration, true); } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 841ac5bf93..fe6fe9394b 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; @@ -191,7 +192,12 @@ namespace CalamityMod.NPCs.SulphurousSea DropHelper.DropItemChance(npc, ModContent.ItemType(), 15); // Rarer to encourage fighting Acid Rain } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 7da6e84a8c..35ba753fd7 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Projectiles.Enemy; using CalamityMod.Items.Materials; @@ -66,7 +67,12 @@ namespace CalamityMod.NPCs.SulphurousSea DropHelper.DropItemChance(npc, ModContent.ItemType(), 10); } - public override void HitEffect(int hitDirection, double damage) + public override void OnHitPlayer(Player player, int damage, bool crit) + { + player.AddBuff(ModContent.BuffType(), 180); + } + + public override void HitEffect(int hitDirection, double damage) { if (npc.life <= 0) { diff --git a/NPCs/SulphurousSea/Catfish.cs b/NPCs/SulphurousSea/Catfish.cs index 48bd63fd84..100534b6c9 100644 --- a/NPCs/SulphurousSea/Catfish.cs +++ b/NPCs/SulphurousSea/Catfish.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using System.IO; using Terraria; @@ -72,9 +73,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } + player.AddBuff(ModContent.BuffType(), 180); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { diff --git a/NPCs/SulphurousSea/Flounder.cs b/NPCs/SulphurousSea/Flounder.cs index 4661cc92d8..529296adaa 100644 --- a/NPCs/SulphurousSea/Flounder.cs +++ b/NPCs/SulphurousSea/Flounder.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; using Terraria; @@ -80,8 +81,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Venom, 120, true); - } + player.AddBuff(ModContent.BuffType(), 120); + } public override void FindFrame(int frameHeight) { diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 0346d252de..5fa4d702ab 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; using Terraria; @@ -87,9 +88,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 120, true); - player.AddBuff(BuffID.Venom, 120, true); - } + player.AddBuff(ModContent.BuffType(), 120); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { diff --git a/NPCs/SulphurousSea/Mauler.cs b/NPCs/SulphurousSea/Mauler.cs index feea79b679..858b238003 100644 --- a/NPCs/SulphurousSea/Mauler.cs +++ b/NPCs/SulphurousSea/Mauler.cs @@ -335,10 +335,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 300, true); - player.AddBuff(BuffID.Venom, 300, true); - player.AddBuff(BuffID.Rabies, 300, true); - } + player.AddBuff(ModContent.BuffType(), 420); + } public override void NPCLoot() { diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index f08dc8781f..089b5b9941 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -311,9 +312,8 @@ namespace CalamityMod.NPCs.SulphurousSea public override void OnHitPlayer(Player player, int damage, bool crit) { - player.AddBuff(BuffID.Bleeding, 180, true); - player.AddBuff(BuffID.Venom, 180, true); - } + player.AddBuff(ModContent.BuffType(), 180); + } public override float SpawnChance(NPCSpawnInfo spawnInfo) { diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 8669ddac3f..d438591214 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -2,12 +2,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Potions; using CalamityMod.Items.Tools; +using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -200,6 +202,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.noTileCollide = true; npc.HitSound = SoundID.NPCHit1; music = CalamityMod.Instance.GetMusicFromMusicMod("SCG") ?? MusicID.Boss2; + bossBag = ModContent.ItemType(); } public override void BossHeadSlot(ref int index) @@ -2736,6 +2739,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Make the town NPC spawn. NPC.NewNPC((int)npc.Center.X, (int)npc.Center.Y + 12, ModContent.NPCType()); + DropHelper.DropBags(npc); + // Increase the player's SCal kill count if (Main.player[npc.target].Calamity().sCalKillCount < 5) Main.player[npc.target].Calamity().sCalKillCount++; @@ -2748,32 +2753,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas int essenceMax = Main.expertMode ? 40 : 30; DropHelper.DropItem(npc, ModContent.ItemType(), true, essenceMin, essenceMax); - // Weapons - // Rejoice! Hybrid weapons are no more, so this list is no longer cluttered. - DropHelper.DropItemFromSetCondition(npc, true, Main.expertMode, - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), // Flamsteed Ring - ModContent.ItemType(), // Illustrious Knives - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType(), // Staff of Blushie - ModContent.ItemType(), - ModContent.ItemType(), // Temporal Umbrella - ModContent.ItemType(), // The Dance of Light - ModContent.ItemType(), - ModContent.ItemType() // Voidragon - ); - DropHelper.DropItemCondition(npc, ModContent.ItemType(), Main.expertMode, CalamityWorld.revenge); + if (!Main.expertMode) + { + // Weapons. + float w = DropHelper.NormalWeaponDropRateFloat; + DropHelper.DropEntireWeightedSet(npc, + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w), + DropHelper.WeightStack(w) + ); + + // Vanity. + if (Main.rand.NextBool(7)) + { + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + DropHelper.DropItem(npc, ModContent.ItemType()); + } + } // Vanity DropHelper.DropItem(npc, ModContent.ItemType(), Main.expertMode); diff --git a/NPCs/TownNPCs/DILF.cs b/NPCs/TownNPCs/DILF.cs index a6c895266a..9f787d9d47 100644 --- a/NPCs/TownNPCs/DILF.cs +++ b/NPCs/TownNPCs/DILF.cs @@ -183,8 +183,6 @@ namespace CalamityMod.NPCs.TownNPCs nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); nextSlot++; - shop.item[nextSlot].SetDefaults(ModContent.ItemType()); - nextSlot++; shop.item[nextSlot].SetDefaults(ModContent.ItemType()); shop.item[nextSlot].shopCustomPrice = Item.buyPrice(5, 0, 0, 0); nextSlot++; diff --git a/Projectiles/Boss/AbyssBallVolley2.cs b/Projectiles/Boss/AbyssBallVolley2.cs index 4ed1a4f3ec..eda2d5205d 100644 --- a/Projectiles/Boss/AbyssBallVolley2.cs +++ b/Projectiles/Boss/AbyssBallVolley2.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft < 60) return; - target.AddBuff(BuffID.Cursed, 90); + target.AddBuff(BuffID.Cursed, 45); } } } diff --git a/Projectiles/Boss/AbyssMine.cs b/Projectiles/Boss/AbyssMine.cs index 7519b4d99b..e84b0b6669 100644 --- a/Projectiles/Boss/AbyssMine.cs +++ b/Projectiles/Boss/AbyssMine.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Weak, 120); + target.AddBuff(BuffID.Weak, 240); } } } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 782ccaa384..a495cc4825 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index a57b17780b..908b1c6c34 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -142,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 0, texture.Width, texture.Height); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Boss spriteBatch.Draw(texture, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); num224 += rectangle7.Height * projectile.scale; value20 += projectile.velocity * rectangle7.Height * projectile.scale; - rectangle7.Y += 16; + rectangle7.Y += texture.Height; if (rectangle7.Y + rectangle7.Height > texture.Height) { rectangle7.Y = 0; diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index 853e2cbe38..1bded359eb 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index fe9e600933..cfa0eeaa1a 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -97,7 +97,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 20fca4c374..642067453c 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -173,7 +173,7 @@ namespace CalamityMod.Projectiles.Boss if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 0, texture2D20.Width, texture2D20.Height); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) @@ -183,7 +183,7 @@ namespace CalamityMod.Projectiles.Boss spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); num224 += rectangle7.Height * projectile.scale; value20 += projectile.velocity * rectangle7.Height * projectile.scale; - rectangle7.Y += 16; + rectangle7.Y += texture2D20.Height; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { rectangle7.Y = 0; diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 8cff3cf48d..13c18ddd2a 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Boss if (projectile.timeLeft > 815 || projectile.timeLeft < 85) return; - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/DoGFire.cs b/Projectiles/Boss/DoGFire.cs index 5a4b4d38f6..62abfb3a55 100644 --- a/Projectiles/Boss/DoGFire.cs +++ b/Projectiles/Boss/DoGFire.cs @@ -75,9 +75,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Frostburn, 300, true); - target.AddBuff(BuffID.Darkness, 300, true); + target.AddBuff(ModContent.BuffType(), 240); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/EssenceDust.cs b/Projectiles/Boss/EssenceDust.cs index 14558e7405..31db43e494 100644 --- a/Projectiles/Boss/EssenceDust.cs +++ b/Projectiles/Boss/EssenceDust.cs @@ -28,8 +28,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - projectile.velocity.X *= 0.985f; - projectile.velocity.Y *= 0.975f; + projectile.velocity *= 0.985f; Lighting.AddLight(projectile.Center, 0.45f, 0f, 0.55f); for (int num468 = 0; num468 < 5; num468++) { diff --git a/Projectiles/Boss/ExoDestroyerBeamStart.cs b/Projectiles/Boss/ExoDestroyerBeamStart.cs index 1c88e0cb97..5a90c4d052 100644 --- a/Projectiles/Boss/ExoDestroyerBeamStart.cs +++ b/Projectiles/Boss/ExoDestroyerBeamStart.cs @@ -23,15 +23,14 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Thanatos Deathray"); - Main.projFrames[projectile.type] = 4; + DisplayName.SetDefault("T Hanos Deathray"); } public override void SetDefaults() { projectile.Calamity().canBreakPlayerDefense = true; - projectile.width = 32; - projectile.height = 32; + projectile.width = 30; + projectile.height = 30; projectile.hostile = true; projectile.alpha = 255; projectile.penetrate = -1; @@ -61,7 +60,7 @@ namespace CalamityMod.Projectiles.Boss bool expertMode = Main.expertMode || malice; // Die if the thing to attach to disappears. - if (ThingToAttachTo is null || !ThingToAttachTo.active) + if (ThingToAttachTo is null || !ThingToAttachTo.active || ThingToAttachTo.Calamity().newAI[0] != 2f) { projectile.Kill(); return; @@ -71,7 +70,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); // Offset to move the beam forward so that it starts inside the NPC's mouth. - float beamStartForwardsOffset = -18f; + float beamStartForwardsOffset = -8f; // Set the starting location of the beam to the center of the NPC. projectile.Center = ThingToAttachTo.Center; @@ -80,11 +79,6 @@ namespace CalamityMod.Projectiles.Boss // Add the forwards offset, measured in pixels. projectile.position += hostNPCDirection * beamStartForwardsOffset; - projectile.rotation = ThingToAttachTo.velocity.ToRotation(); - - Time++; - - float scale = 1f; Time++; if (Time >= Lifetime) { @@ -92,13 +86,16 @@ namespace CalamityMod.Projectiles.Boss return; } - projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; + float scale = 1f; + projectile.scale = (float)Math.Sin(Time * MathHelper.Pi / Lifetime) * 10f * scale; if (projectile.scale > scale) projectile.scale = scale; projectile.rotation = ThingToAttachTo.velocity.ToRotation(); projectile.velocity = projectile.rotation.ToRotationVector2(); + projectile.rotation = ThingToAttachTo.velocity.ToRotation() - MathHelper.PiOver2; + float arraySize = 3f; Vector2 samplingPoint = projectile.Center; float[] samples = new float[(int)arraySize]; @@ -121,6 +118,7 @@ namespace CalamityMod.Projectiles.Boss float divisor = expertMode ? 80f : 160f; if (ThingToAttachTo.Calamity().newAI[2] % divisor == 0f && projectile.owner == Main.myPlayer) { + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LaserCannon"), ThingToAttachTo.Center); Vector2 velocity = projectile.velocity; velocity.Normalize(); float distanceBetweenProjectiles = malice ? 160f : death ? 256f : revenge ? 288f : 320f; @@ -134,7 +132,7 @@ namespace CalamityMod.Projectiles.Boss float radians = MathHelper.TwoPi / totalProjectiles; for (int j = 0; j < totalProjectiles; j++) { - Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); + Vector2 projVelocity = projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; Projectile.NewProjectile(fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); } fireFrom += velocity * distanceBetweenProjectiles; @@ -196,42 +194,42 @@ namespace CalamityMod.Projectiles.Boss Texture2D beamMiddle = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamMiddle"); Texture2D beamEnd = ModContent.GetTexture("CalamityMod/ExtraTextures/Lasers/ExoDestroyerBeamEnd"); - float drawLength = LengthOfLaser; - Color color = new Color(250, 0, 0, 0); + float drawLength = LengthOfLaser; + Color color = new Color(250, 100, 100, 0); // Draw start of beam Vector2 vector = projectile.Center - Main.screenPosition; - Rectangle? sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamStart.Width, 16); - spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, beamStart.Size() / 2f, projectile.scale, SpriteEffects.None, 0f); + Rectangle? sourceRectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamStart.Width, 30); + spriteBatch.Draw(beamStart, vector, sourceRectangle, color, projectile.rotation, new Vector2(32f, 30f) / 2f, projectile.scale, SpriteEffects.None, 0f); // Draw middle of beam - drawLength -= (beamStart.Height / 2 + beamEnd.Height) * projectile.scale; + drawLength -= (beamStart.Height / 4 / 2 + beamEnd.Height / 4) * projectile.scale; Vector2 center = projectile.Center; - center += projectile.velocity * projectile.scale * beamStart.Height / 2f; + center += projectile.velocity * projectile.scale * beamStart.Height / 4f / 2f; if (drawLength > 0f) { float i = 0f; - Rectangle rectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamMiddle.Width, 16); + Rectangle rectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamMiddle.Width, 30); while (i + 1f < drawLength) { if (drawLength - i < rectangle.Height) rectangle.Height = (int)(drawLength - i); - spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); + spriteBatch.Draw(beamMiddle, center - Main.screenPosition, rectangle, color, projectile.rotation, new Vector2(rectangle.Width / 2f, 0f), projectile.scale, SpriteEffects.None, 0f); i += rectangle.Height * projectile.scale; center += projectile.velocity * rectangle.Height * projectile.scale; - rectangle.Y += 16; - if (rectangle.Y + rectangle.Height > beamMiddle.Height) + rectangle.Y += 30; + if (rectangle.Y + rectangle.Height > beamMiddle.Height / 4) rectangle.Y = 0; } } // Draw end of beam Vector2 vector2 = center - Main.screenPosition; - sourceRectangle = new Rectangle(0, 16 * (projectile.timeLeft / Main.projFrames[projectile.type] % 5), beamEnd.Width, 16); - spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, beamEnd.Frame(1, 1, 0, 0).Top(), projectile.scale, SpriteEffects.None, 0f); + sourceRectangle = new Rectangle(0, 30 * (projectile.timeLeft / 3 % 4), beamEnd.Width, 30); + spriteBatch.Draw(beamEnd, vector2, sourceRectangle, color, projectile.rotation, new Vector2(28f, 30f) / 2f, projectile.scale, SpriteEffects.None, 0f); return false; } @@ -249,7 +247,7 @@ namespace CalamityMod.Projectiles.Boss return true; float collisionPoint = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 22f * projectile.scale, ref collisionPoint)) + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + projectile.velocity * LengthOfLaser, 30f * projectile.scale, ref collisionPoint)) return true; return false; @@ -258,7 +256,6 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { target.AddBuff(ModContent.BuffType(), 360); - target.AddBuff(BuffID.OnFire, 360); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs b/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs index cd9d0560cf..0bc632e560 100644 --- a/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs +++ b/Projectiles/Boss/ExoDestroyerBeamTelegraph.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Die if the thing to attach to disappears. - if (ThingToAttachTo is null || !ThingToAttachTo.active) + if (ThingToAttachTo is null || !ThingToAttachTo.active || ThingToAttachTo.Calamity().newAI[0] != 2f) { projectile.Kill(); return; @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 hostNPCDirection = Vector2.Normalize(ThingToAttachTo.velocity); // Offset to move the beam forward so that it starts inside the NPC's mouth. - float beamStartForwardsOffset = -18f; + float beamStartForwardsOffset = -8f; // Set the starting location of the beam to the center of the NPC. projectile.Center = ThingToAttachTo.Center; diff --git a/Projectiles/Boss/ExoDestroyerLaser.cs b/Projectiles/Boss/ExoDestroyerLaser.cs index f3456966c7..c24cd45435 100644 --- a/Projectiles/Boss/ExoDestroyerLaser.cs +++ b/Projectiles/Boss/ExoDestroyerLaser.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Projectiles.Boss public override void SetStaticDefaults() { - DisplayName.SetDefault("Thanatos Beam"); + DisplayName.SetDefault("T Hanos Beam"); Main.projFrames[projectile.type] = 4; } @@ -231,13 +231,12 @@ namespace CalamityMod.Projectiles.Boss if (TelegraphDelay > TelegraphTotalTime) { target.AddBuff(ModContent.BuffType(), 180); - target.AddBuff(BuffID.OnFire, 180); } } public override Color? GetAlpha(Color lightColor) { - return new Color(255, 255, 255, projectile.alpha); + return new Color(255, 100, 100, projectile.alpha); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index 5daa2dcf3c..7736aa2a9d 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -128,9 +128,8 @@ namespace CalamityMod.Projectiles.Boss if (projectile.Opacity != 1f) return; - target.AddBuff(BuffID.Frostburn, 240, true); - target.AddBuff(BuffID.Chilled, 120, true); - target.AddBuff(BuffID.Frozen, 30, true); + target.AddBuff(BuffID.Frostburn, 120, true); + target.AddBuff(BuffID.Chilled, 90, true); } } } diff --git a/Projectiles/Boss/HellfireExplosion.cs b/Projectiles/Boss/HellfireExplosion.cs index 24f72c7dd7..db3c29b3be 100644 --- a/Projectiles/Boss/HellfireExplosion.cs +++ b/Projectiles/Boss/HellfireExplosion.cs @@ -106,7 +106,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/HiveBombGoliath.cs b/Projectiles/Boss/HiveBombGoliath.cs index 0cbc03c00d..fc4c722210 100644 --- a/Projectiles/Boss/HiveBombGoliath.cs +++ b/Projectiles/Boss/HiveBombGoliath.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 92108c0a14..f9641760f0 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -174,7 +174,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 120); + target.AddBuff(buffType, 180); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index e1d7ebcd08..a7d08fc10b 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -94,7 +94,6 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(BuffID.Frostburn, 90, true); target.AddBuff(BuffID.Chilled, 60, true); - target.AddBuff(BuffID.Frozen, 30, true); } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 3ac4dda5a5..244187f9e9 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -139,7 +139,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 180); + target.AddBuff(buffType, 240); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index 87ff7367a9..d898d09bd5 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -89,7 +89,6 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Poisoned, 180, true); target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index d6f8c332ce..4eab148cd1 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using System; using System.IO; @@ -69,7 +70,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, projectile.alpha); } diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index a13b28c632..34f9397844 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using System; using System.IO; @@ -69,7 +70,12 @@ namespace CalamityMod.Projectiles.Boss } } - public override Color? GetAlpha(Color lightColor) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, projectile.alpha); } diff --git a/Projectiles/Boss/PlagueExplosion.cs b/Projectiles/Boss/PlagueExplosion.cs index 4d7bcfa5ef..9ed2a0abd3 100644 --- a/Projectiles/Boss/PlagueExplosion.cs +++ b/Projectiles/Boss/PlagueExplosion.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/ProfanedSpear.cs b/Projectiles/Boss/ProfanedSpear.cs index 357df6ea35..2bb342cb8b 100644 --- a/Projectiles/Boss/ProfanedSpear.cs +++ b/Projectiles/Boss/ProfanedSpear.cs @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index bd24c91aed..6cd9c2ba04 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -158,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss if (num223 > 0f) { float num224 = 0f; - Rectangle rectangle7 = new Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture2D20.Width, 16); + Rectangle rectangle7 = new Rectangle(0, 36 * (projectile.timeLeft / 3 % 4), texture2D20.Width, 36); while (num224 + 1f < num223) { if (num223 - num224 < rectangle7.Height) @@ -168,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.Draw(texture2D20, value20 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color44, projectile.rotation, new Vector2(rectangle7.Width / 2, 0f), projectile.scale, SpriteEffects.None, 0f); num224 += rectangle7.Height * projectile.scale; value20 += projectile.velocity * rectangle7.Height * projectile.scale; - rectangle7.Y += 16; + rectangle7.Y += 36; if (rectangle7.Y + rectangle7.Height > texture2D20.Height) { rectangle7.Y = 0; @@ -205,7 +205,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { int buffType = (Main.dayTime && !CalamityWorld.malice) ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 300); + target.AddBuff(buffType, 420); } public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit) diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 9b04d5e972..38e835c8eb 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -1,5 +1,5 @@ +using CalamityMod.Buffs.StatDebuffs; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -67,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { if (projectile.timeLeft >= 180) - target.AddBuff(BuffID.Venom, 300); - } + target.AddBuff(ModContent.BuffType(), 240, true); + } } } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index 81d18da39e..753fce4136 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -1,5 +1,5 @@ +using CalamityMod.Buffs.StatDebuffs; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { if (projectile.timeLeft >= 180) - target.AddBuff(BuffID.Venom, 300); - } + target.AddBuff(ModContent.BuffType(), 240, true); + } } } diff --git a/Projectiles/Boss/ShadeNimbusHostile.cs b/Projectiles/Boss/ShadeNimbusHostile.cs index a060978836..e4979333ed 100644 --- a/Projectiles/Boss/ShadeNimbusHostile.cs +++ b/Projectiles/Boss/ShadeNimbusHostile.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { @@ -55,5 +56,10 @@ namespace CalamityMod.Projectiles.Boss } } } - } + + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.CursedInferno, 90); + } + } } diff --git a/Projectiles/Boss/SignusScythe.cs b/Projectiles/Boss/SignusScythe.cs index 857e4854e0..9391090f77 100644 --- a/Projectiles/Boss/SignusScythe.cs +++ b/Projectiles/Boss/SignusScythe.cs @@ -89,7 +89,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index 5dadbdb9cc..0b7b154d92 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -100,10 +100,7 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, int damage, bool crit) { if (projectile.ai[1] <= 1800f && projectile.ai[1] > 120f) - { target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 120); - } } } } diff --git a/Projectiles/Boss/WaterSpear.cs b/Projectiles/Boss/WaterSpear.cs index 68d25bc384..7215b9f2b7 100644 --- a/Projectiles/Boss/WaterSpear.cs +++ b/Projectiles/Boss/WaterSpear.cs @@ -87,13 +87,5 @@ namespace CalamityMod.Projectiles.Boss Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 33, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f); } } - - public override void OnHitPlayer(Player target, int damage, bool crit) - { - if (projectile.Opacity != 1f) - return; - - target.AddBuff(BuffID.Wet, 240); - } } } diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index e5b2eb1430..92dbedfac3 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -416,7 +416,7 @@ namespace CalamityMod.Projectiles adultWyrmAlive = true; } - if (adultWyrmAlive) + if (adultWyrmAlive || (CalamityWorld.death && !CalamityPlayer.areThereAnyDamnBosses)) { if (projectile.type == ProjectileID.CultistBossFireBallClone) { diff --git a/Projectiles/DraedonsArsenal/GaussFlux.cs b/Projectiles/DraedonsArsenal/GaussFlux.cs index f89011b425..2fce06a109 100644 --- a/Projectiles/DraedonsArsenal/GaussFlux.cs +++ b/Projectiles/DraedonsArsenal/GaussFlux.cs @@ -32,8 +32,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal projectile.melee = true; projectile.penetrate = -1; projectile.timeLeft = 180; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 14; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Enemy/CragmawBeam.cs b/Projectiles/Enemy/CragmawBeam.cs index a61e2a6847..6be4f2ca40 100644 --- a/Projectiles/Enemy/CragmawBeam.cs +++ b/Projectiles/Enemy/CragmawBeam.cs @@ -1,10 +1,10 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.ID; using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -203,9 +203,9 @@ namespace CalamityMod.Projectiles.Enemy } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Electrified, 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } } diff --git a/Projectiles/Enemy/FlameBurstHostile.cs b/Projectiles/Enemy/FlameBurstHostile.cs index b479571d64..9378955fb3 100644 --- a/Projectiles/Enemy/FlameBurstHostile.cs +++ b/Projectiles/Enemy/FlameBurstHostile.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -86,7 +87,12 @@ namespace CalamityMod.Projectiles.Enemy } } - public override void Kill(int timeLeft) + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override void Kill(int timeLeft) { for (int k = 0; k < 5; k++) { diff --git a/Projectiles/Enemy/GammaBeam.cs b/Projectiles/Enemy/GammaBeam.cs index a26cbce6ad..b42f69b30a 100644 --- a/Projectiles/Enemy/GammaBeam.cs +++ b/Projectiles/Enemy/GammaBeam.cs @@ -1,10 +1,10 @@ +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.IO; using Terraria; -using Terraria.ID; using Terraria.Enums; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Enemy @@ -208,9 +208,9 @@ namespace CalamityMod.Projectiles.Enemy } return false; } - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.Electrified, 300); - } - } + public override void OnHitPlayer(Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 600); + } + } } diff --git a/Projectiles/Enemy/InkBombHostile.cs b/Projectiles/Enemy/InkBombHostile.cs index 404587d035..b244786920 100644 --- a/Projectiles/Enemy/InkBombHostile.cs +++ b/Projectiles/Enemy/InkBombHostile.cs @@ -84,8 +84,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); projectile.Kill(); } } diff --git a/Projectiles/Enemy/InkPoisonCloud.cs b/Projectiles/Enemy/InkPoisonCloud.cs index b959629ee3..37cc8d4d20 100644 --- a/Projectiles/Enemy/InkPoisonCloud.cs +++ b/Projectiles/Enemy/InkPoisonCloud.cs @@ -65,8 +65,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/InkPoisonCloud2.cs b/Projectiles/Enemy/InkPoisonCloud2.cs index 8bf7f57d92..cde0aa66e1 100644 --- a/Projectiles/Enemy/InkPoisonCloud2.cs +++ b/Projectiles/Enemy/InkPoisonCloud2.cs @@ -65,8 +65,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/InkPoisonCloud3.cs b/Projectiles/Enemy/InkPoisonCloud3.cs index 2950babbc5..5456625367 100644 --- a/Projectiles/Enemy/InkPoisonCloud3.cs +++ b/Projectiles/Enemy/InkPoisonCloud3.cs @@ -65,8 +65,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 300); - target.AddBuff(BuffID.Darkness, 600, true); + target.AddBuff(BuffID.Darkness, 300, true); } } } diff --git a/Projectiles/Enemy/NuclearBulletLarge.cs b/Projectiles/Enemy/NuclearBulletLarge.cs index fdf3d549d9..341228dfc2 100644 --- a/Projectiles/Enemy/NuclearBulletLarge.cs +++ b/Projectiles/Enemy/NuclearBulletLarge.cs @@ -1,5 +1,5 @@ using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using Terraria; using Terraria.ModLoader; @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 300); } public override void Kill(int timeLeft) { diff --git a/Projectiles/Enemy/NuclearBulletMedium.cs b/Projectiles/Enemy/NuclearBulletMedium.cs index b3c5df79b6..3a2d7b8606 100644 --- a/Projectiles/Enemy/NuclearBulletMedium.cs +++ b/Projectiles/Enemy/NuclearBulletMedium.cs @@ -1,5 +1,5 @@ using Microsoft.Xna.Framework; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using System; using Terraria; @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } public override void Kill(int timeLeft) { diff --git a/Projectiles/Enemy/NuclearToadGoo.cs b/Projectiles/Enemy/NuclearToadGoo.cs index aab0150aad..f2d030ddec 100644 --- a/Projectiles/Enemy/NuclearToadGoo.cs +++ b/Projectiles/Enemy/NuclearToadGoo.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Enemy } public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } public override void Kill(int timeLeft) { diff --git a/Projectiles/Enemy/SulphuricAcidBubble.cs b/Projectiles/Enemy/SulphuricAcidBubble.cs index b1790cb1b5..c886df086b 100644 --- a/Projectiles/Enemy/SulphuricAcidBubble.cs +++ b/Projectiles/Enemy/SulphuricAcidBubble.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -103,8 +104,8 @@ namespace CalamityMod.Projectiles.Enemy { return; } - target.AddBuff(BuffID.Venom, 120); - projectile.Kill(); + target.AddBuff(ModContent.BuffType(), 120); + projectile.Kill(); } public override void Kill(int timeLeft) diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index 62fd008508..ed4519027d 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -1,3 +1,4 @@ +using CalamityMod.Buffs.StatDebuffs; using System; using Terraria; using Terraria.ID; @@ -76,7 +77,7 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Venom, 120); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Enemy/ToxicMinnowCloud.cs b/Projectiles/Enemy/ToxicMinnowCloud.cs index 82efe42b9e..6449e63664 100644 --- a/Projectiles/Enemy/ToxicMinnowCloud.cs +++ b/Projectiles/Enemy/ToxicMinnowCloud.cs @@ -83,14 +83,14 @@ namespace CalamityMod.Projectiles.Enemy public override void OnHitPlayer(Player target, int damage, bool crit) { - target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.Poisoned, 120); } public override bool? CanHitNPC(NPC target) => projectile.timeLeft > 40; public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.Poisoned, 600); + target.AddBuff(BuffID.Poisoned, 120); } } } diff --git a/Projectiles/Melee/AegisBlast.cs b/Projectiles/Melee/AegisBlast.cs index 49dc6b08a8..92d09a151d 100644 --- a/Projectiles/Melee/AegisBlast.cs +++ b/Projectiles/Melee/AegisBlast.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = false; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.timeLeft = 90; + projectile.timeLeft = 60; projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 15; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BansheeHookBoom.cs b/Projectiles/Melee/BansheeHookBoom.cs index fa73f834cd..7cdd4761db 100644 --- a/Projectiles/Melee/BansheeHookBoom.cs +++ b/Projectiles/Melee/BansheeHookBoom.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee projectile.timeLeft = 6; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 16; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Melee/BrimlanceHellfireExplosion.cs b/Projectiles/Melee/BrimlanceHellfireExplosion.cs index d66774aac3..2df66b4e13 100644 --- a/Projectiles/Melee/BrimlanceHellfireExplosion.cs +++ b/Projectiles/Melee/BrimlanceHellfireExplosion.cs @@ -27,9 +27,9 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 60; projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 20; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Melee/BrimstoneBoom.cs b/Projectiles/Melee/BrimstoneBoom.cs index 456aafe56b..b599a16e14 100644 --- a/Projectiles/Melee/BrimstoneBoom.cs +++ b/Projectiles/Melee/BrimstoneBoom.cs @@ -24,7 +24,9 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = -1; projectile.timeLeft = 5; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Melee/FossilSpike.cs b/Projectiles/Melee/FossilSpike.cs index 79a514c741..1281e38dee 100644 --- a/Projectiles/Melee/FossilSpike.cs +++ b/Projectiles/Melee/FossilSpike.cs @@ -19,14 +19,15 @@ namespace CalamityMod.Projectiles.Melee projectile.tileCollide = false; projectile.timeLeft = 300; projectile.melee = true; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { if (Main.rand.NextBool(5)) - { Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); - } + projectile.frameCounter++; if (projectile.frameCounter > 4) { @@ -34,9 +35,7 @@ namespace CalamityMod.Projectiles.Melee projectile.frameCounter = 0; } if (projectile.frame > 3) - { projectile.frame = 0; - } } } } diff --git a/Projectiles/Melee/Nebudust.cs b/Projectiles/Melee/Nebudust.cs index c64faaa877..83edf2475c 100644 --- a/Projectiles/Melee/Nebudust.cs +++ b/Projectiles/Melee/Nebudust.cs @@ -24,35 +24,13 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.tileCollide = false; projectile.penetrate = -1; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 8; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 6; + } public override void AI() { - Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } + Lighting.AddLight(projectile.Center, 0.5f, 0.5f, 0f); float num461 = 25f; if (projectile.ai[0] > 60f) { diff --git a/Projectiles/Melee/RainbowBoom.cs b/Projectiles/Melee/RainbowBoom.cs index c32d92735a..32bf60c5d0 100644 --- a/Projectiles/Melee/RainbowBoom.cs +++ b/Projectiles/Melee/RainbowBoom.cs @@ -23,8 +23,8 @@ namespace CalamityMod.Projectiles.Melee projectile.penetrate = -1; projectile.timeLeft = 20; projectile.melee = true; - projectile.usesLocalNPCImmunity = true; - projectile.localNPCHitCooldown = 5; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 5; } public override void AI() diff --git a/Projectiles/Melee/Spears/BansheeHookProj.cs b/Projectiles/Melee/Spears/BansheeHookProj.cs index 40853f457b..90d4974778 100644 --- a/Projectiles/Melee/Spears/BansheeHookProj.cs +++ b/Projectiles/Melee/Spears/BansheeHookProj.cs @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Melee.Spears public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - float angle = projectile.rotation - MathHelper.PiOver4 * Math.Sign(projectile.velocity.X) + + float angle = projectile.rotation - MathHelper.PiOver4 * Math.Sign(projectile.velocity.X) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; float areaCheck = -95f; float reduntantVariable = 0f; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + angle.ToRotationVector2() * areaCheck, (TravelSpeed + 1f) * projectile.scale, ref reduntantVariable)) diff --git a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs index de846691bf..c320e0737f 100644 --- a/Projectiles/Melee/Spears/DiseasedPikeSpear.cs +++ b/Projectiles/Melee/Spears/DiseasedPikeSpear.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee.Spears { for (int i = 0; i < 4; i++) { - int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); + int proj = Projectile.NewProjectile(projectile.Center, projectile.velocity * 0.5f, ModContent.ProjectileType(), (int)(projectile.damage * 0.75), projectile.knockBack, projectile.owner); Main.projectile[proj].extraUpdates += i; } } diff --git a/Projectiles/Melee/TaintedBladeSlasher.cs b/Projectiles/Melee/TaintedBladeSlasher.cs index 7d493cda46..30b8eace4f 100644 --- a/Projectiles/Melee/TaintedBladeSlasher.cs +++ b/Projectiles/Melee/TaintedBladeSlasher.cs @@ -16,7 +16,16 @@ namespace CalamityMod.Projectiles.Melee public ref float SwordItemID => ref projectile.ai[1]; public ref float VerticalOffset => ref projectile.localAI[0]; public ref float Time => ref projectile.localAI[1]; - public float AttackCompletionRatio => 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; + public float AttackCompletionRatio + { + get + { + float completionRatio = 1f - Owner.itemAnimation / (float)Owner.itemAnimationMax; + if (float.IsNaN(completionRatio) || float.IsInfinity(completionRatio)) + completionRatio = 0f; + return completionRatio; + } + } public Player Owner => Main.player[projectile.owner]; public int Variant => (int)projectile.ai[0] % 2; @@ -124,6 +133,9 @@ namespace CalamityMod.Projectiles.Melee return; } + if (Owner.itemAnimationMax == 0) + Owner.itemAnimationMax = (int)(Owner.ActiveItem().useAnimation * Owner.meleeSpeed); + float swingOffsetAngle = MathHelper.SmoothStep(-1.87f, 3.79f, AttackCompletionRatio); // Offset a little bit angularly if the secondary variant to prevent complete overlap. diff --git a/Projectiles/Melee/TerracottaExplosion.cs b/Projectiles/Melee/TerracottaExplosion.cs index db7dc1e6e4..9a82fbc045 100644 --- a/Projectiles/Melee/TerracottaExplosion.cs +++ b/Projectiles/Melee/TerracottaExplosion.cs @@ -23,7 +23,9 @@ namespace CalamityMod.Projectiles.Melee projectile.melee = true; projectile.penetrate = -1; projectile.timeLeft = 5; - } + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } public override void AI() { diff --git a/Projectiles/Rogue/TheAtomSplitterProjectile.cs b/Projectiles/Rogue/TheAtomSplitterProjectile.cs index abc384ed25..cb23b8ba13 100644 --- a/Projectiles/Rogue/TheAtomSplitterProjectile.cs +++ b/Projectiles/Rogue/TheAtomSplitterProjectile.cs @@ -158,9 +158,12 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { ReleaseHitDust(target.Center - projectile.velocity * 3f); - HitTargetIndex = target.whoAmI; - projectile.timeLeft = projectile.Calamity().stealthStrike ? 100 : 60; - projectile.netUpdate = true; + if (!Main.npc.IndexInRange((int)HitTargetIndex)) + { + HitTargetIndex = target.whoAmI; + projectile.timeLeft = projectile.Calamity().stealthStrike ? 100 : 60; + projectile.netUpdate = true; + } } } } diff --git a/Projectiles/Summon/UniverseSplitterHugeBeam.cs b/Projectiles/Summon/UniverseSplitterHugeBeam.cs index 5a211b41f3..fa8adf72e8 100644 --- a/Projectiles/Summon/UniverseSplitterHugeBeam.cs +++ b/Projectiles/Summon/UniverseSplitterHugeBeam.cs @@ -70,12 +70,12 @@ namespace CalamityMod.Projectiles.Summon projectile.scale = MathHelper.Lerp(LaserSize, 0f, 1f - (projectile.timeLeft / (float)TotalFadeoutTime)); } - Vector2 samplingPoint = projectile.Center; + Vector2 samplingPoint = projectile.Top; - float[] samples = new float[3]; + float[] samples = new float[12]; float determinedLength = 0f; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, MaximumLength + 72f, samples); + Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, MaximumLength, samples); for (int i = 0; i < samples.Length; i++) { determinedLength += samples[i]; @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon determinedLength = MathHelper.Clamp(determinedLength, MaximumLength * 0.3f, MaximumLength); float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength - 20f, lerpDelta); if (projectile.localAI[0] < 30f) { projectile.localAI[1] = MathHelper.Lerp(72f, projectile.localAI[1], projectile.localAI[0] / 30f); diff --git a/Projectiles/Summon/UniverseSplitterSmallBeam.cs b/Projectiles/Summon/UniverseSplitterSmallBeam.cs index 02d9aad775..8a177e8a5a 100644 --- a/Projectiles/Summon/UniverseSplitterSmallBeam.cs +++ b/Projectiles/Summon/UniverseSplitterSmallBeam.cs @@ -87,22 +87,7 @@ namespace CalamityMod.Projectiles.Summon projectile.scale = MathHelper.Lerp(3.25f, 0.01f, (projectile.localAI[0] - (TimeLeft - 15f)) / 15f); } - Vector2 samplingPoint = projectile.Center; - - float[] samples = new float[3]; - - float determinedLength = 0f; - Collision.LaserScan(samplingPoint, projectile.velocity, projectile.width * projectile.scale, MaximumLength, samples); - for (int i = 0; i < samples.Length; i++) - { - determinedLength += samples[i]; - } - determinedLength /= samples.Length; - - determinedLength = MathHelper.Clamp(determinedLength, MaximumLength * 0.5f, MaximumLength); - - float lerpDelta = 0.5f; - projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], determinedLength, lerpDelta); + projectile.localAI[1] = MathHelper.Lerp(projectile.localAI[1], MaximumLength, 0.5f); Vector2 beamEndPosiiton = projectile.Center + projectile.velocity * (projectile.localAI[1] - 6f); // Draw white light across the laser