diff --git a/Buffs/DoTDebuffs/AbyssalFlames.cs b/Buffs/DoTDebuffs/AbyssalFlames.cs index ab5be6fca2..894a08bca7 100644 --- a/Buffs/DoTDebuffs/AbyssalFlames.cs +++ b/Buffs/DoTDebuffs/AbyssalFlames.cs @@ -1,13 +1,14 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class AbyssalFlames : ModBuff { - public override void SetDefaults() + public static int DefenseReduction = 10; + + public override void SetDefaults() { DisplayName.SetDefault("Abyssal Flames"); Description.SetDefault("Your soul is being consumed"); diff --git a/Buffs/DoTDebuffs/AstralInfectionDebuff.cs b/Buffs/DoTDebuffs/AstralInfectionDebuff.cs index b503e59e7a..4c373e65bb 100644 --- a/Buffs/DoTDebuffs/AstralInfectionDebuff.cs +++ b/Buffs/DoTDebuffs/AstralInfectionDebuff.cs @@ -1,13 +1,14 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class AstralInfectionDebuff : ModBuff { - public override void SetDefaults() + public static int DefenseReduction = 8; + + public override void SetDefaults() { DisplayName.SetDefault("Astral Infection"); Description.SetDefault("Your flesh is melting off"); diff --git a/Buffs/DoTDebuffs/GodSlayerInferno.cs b/Buffs/DoTDebuffs/GodSlayerInferno.cs index 73705be872..3d7e001811 100644 --- a/Buffs/DoTDebuffs/GodSlayerInferno.cs +++ b/Buffs/DoTDebuffs/GodSlayerInferno.cs @@ -1,13 +1,14 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class GodSlayerInferno : ModBuff { - public override void SetDefaults() + public static int DefenseReduction = 20; + + public override void SetDefaults() { DisplayName.SetDefault("God Slayer Inferno"); Description.SetDefault("Your flesh is burning off"); diff --git a/Buffs/DoTDebuffs/Plague.cs b/Buffs/DoTDebuffs/Plague.cs index bed5e900fa..6b442c4b5f 100644 --- a/Buffs/DoTDebuffs/Plague.cs +++ b/Buffs/DoTDebuffs/Plague.cs @@ -1,13 +1,14 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.DoTDebuffs { public class Plague : ModBuff { - public override void SetDefaults() + public static int DefenseReduction = 4; + + public override void SetDefaults() { DisplayName.SetDefault("Plague"); Description.SetDefault("Rotting from the inside"); diff --git a/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs b/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs new file mode 100644 index 0000000000..21e0147c3c --- /dev/null +++ b/Buffs/StatDebuffs/AbyssalMirrorCooldown.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class AbyssalMirrorCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Abyssal Evade Cooldown"); + Description.SetDefault("Your Abyssal Mirror's dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).abyssalMirrorCooldown = true; + } + } +} diff --git a/Buffs/StatDebuffs/AbyssalMirrorCooldown.png b/Buffs/StatDebuffs/AbyssalMirrorCooldown.png new file mode 100644 index 0000000000..b3f98fa867 Binary files /dev/null and b/Buffs/StatDebuffs/AbyssalMirrorCooldown.png differ diff --git a/Buffs/StatDebuffs/EclipseMirrorCooldown.cs b/Buffs/StatDebuffs/EclipseMirrorCooldown.cs new file mode 100644 index 0000000000..1a77ae9f8f --- /dev/null +++ b/Buffs/StatDebuffs/EclipseMirrorCooldown.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class EclipseMirrorCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Eclipse Evade Cooldown"); + Description.SetDefault("Your Eclipse Mirror's dodge is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).eclipseMirrorCooldown = true; + } + } +} diff --git a/Buffs/StatDebuffs/EclipseMirrorCooldown.png b/Buffs/StatDebuffs/EclipseMirrorCooldown.png new file mode 100644 index 0000000000..cfeebdb1bc Binary files /dev/null and b/Buffs/StatDebuffs/EclipseMirrorCooldown.png differ diff --git a/Buffs/StatDebuffs/InkBombCooldown.cs b/Buffs/StatDebuffs/InkBombCooldown.cs new file mode 100644 index 0000000000..ad4f09d956 --- /dev/null +++ b/Buffs/StatDebuffs/InkBombCooldown.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Buffs.StatDebuffs +{ + public class InkBombCooldown : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Ink Bomb Cooldown"); + Description.SetDefault("Your Ink Bomb is recharging"); + Main.debuff[Type] = true; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + longerExpertDebuff = false; + canBeCleared = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.GetModPlayer(mod).inkBombCooldown = true; + } + } +} diff --git a/Buffs/StatDebuffs/InkBombCooldown.png b/Buffs/StatDebuffs/InkBombCooldown.png new file mode 100644 index 0000000000..8565069431 Binary files /dev/null and b/Buffs/StatDebuffs/InkBombCooldown.png differ diff --git a/Buffs/StatDebuffs/WarCleave.cs b/Buffs/StatDebuffs/WarCleave.cs index 2ee824ef3d..366bee9b82 100644 --- a/Buffs/StatDebuffs/WarCleave.cs +++ b/Buffs/StatDebuffs/WarCleave.cs @@ -6,7 +6,9 @@ namespace CalamityMod.Buffs.StatDebuffs { public class WarCleave : ModBuff { - public override void SetDefaults() + public static int DefenseReduction = 15; + + public override void SetDefaults() { DisplayName.SetDefault("War Cleave"); Description.SetDefault("Defense and protection reduced"); diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index e0651255cf..14c71f5c52 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -1,13 +1,14 @@ using Terraria; using Terraria.ModLoader; using CalamityMod.NPCs; -using CalamityMod.CalPlayer; namespace CalamityMod.Buffs.StatDebuffs { public class WhisperingDeath : ModBuff { - public override void SetDefaults() + public static int DefenseReduction = 50; + + public override void SetDefaults() { DisplayName.SetDefault("Whispering Death"); Description.SetDefault("Death approaches; defense, attack power, and life regen reduced"); diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 7d935b7e04..ab3b75c2f7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -85,9 +85,11 @@ namespace CalamityMod.CalPlayer public float stealthGenStandstill = 1f; public float stealthGenMoving = 0f; public float stealthGenMultiplier = 1f; - private bool stealthStrikeThisFrame = false; + private float stealthGenAcceleration = 1f; + private bool stealthStrikeThisFrame = false; public bool stealthStrikeHalfCost = false; public bool stealthStrikeAlwaysCrits = false; + public bool wearingRogueArmor = false; public float throwingDamage = 1f; public float throwingVelocity = 1f; @@ -288,16 +290,28 @@ namespace CalamityMod.CalPlayer public bool normalityRelocator = false; public bool fabledTortoise = false; public bool manaOverloader = false; + public bool royalGel = false; + public bool oldDie = false; + public bool ursaSergeant = false; public bool sandWaifu = false; public bool sandBoobWaifu = false; public bool cloudWaifu = false; public bool brimstoneWaifu = false; public bool sirenWaifu = false; public bool fungalClump = false; + public bool darkGodSheath = false; + public bool inkBomb = false; + public bool inkBombCooldown = false; + public bool abyssalMirror = false; + public bool abyssalMirrorCooldown = false; + public bool eclipseMirror = false; + public bool eclipseMirrorCooldown = false; + public bool featherCrown = false; + public bool moonCrown = false; - // Armor Set - public bool victideSet = false; - public bool aeroSet = false; + // Armor Set + public bool victideSet = false; + public bool aeroSet = false; public bool statigelSet = false; public bool tarraSet = false; public bool tarraMelee = false; @@ -840,6 +854,7 @@ namespace CalamityMod.CalPlayer shadowSpeed = false; dsSetBonus = false; + wearingRogueArmor = false; desertScourgeLore = false; eaterOfWorldsLore = false; @@ -934,6 +949,7 @@ namespace CalamityMod.CalPlayer normalityRelocator = false; fabledTortoise = false; manaOverloader = false; + royalGel = false; lol = false; raiderTalisman = false; sGenerator = false; @@ -945,6 +961,8 @@ namespace CalamityMod.CalPlayer sTracers = false; eTracers = false; cTracers = false; + oldDie = false; + ursaSergeant = false; daedalusReflect = false; daedalusSplit = false; @@ -991,7 +1009,17 @@ namespace CalamityMod.CalPlayer weakPetrification = false; - shadowflame = false; + inkBomb = false; + inkBombCooldown = false; + darkGodSheath = false; + abyssalMirror = false; + abyssalMirrorCooldown = false; + eclipseMirror = false; + eclipseMirrorCooldown = false; + featherCrown = false; + moonCrown = false; + + shadowflame = false; wDeath = false; lethalLavaBurn = false; aCrunch = false; @@ -1211,11 +1239,14 @@ namespace CalamityMod.CalPlayer abyssalDivingSuitCooldown = false; abyssalDivingSuitPlateHits = 0; sirenIceCooldown = false; - #endregion + inkBombCooldown = false; + abyssalMirrorCooldown = false; + eclipseMirrorCooldown = false; + #endregion - #region Rogue + #region Rogue // Stealth - rogueStealth = 0f; + rogueStealth = 0f; rogueStealthMax = 0f; throwingDamage = 1f; @@ -3256,6 +3287,24 @@ namespace CalamityMod.CalPlayer } } } + if (ursaSergeant) + { + if (player.statLife <= (int)((double)player.statLifeMax2 * 0.15)) + { + player.lifeRegen += 3; + player.lifeRegenTime += 3; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.25)) + { + player.lifeRegen += 2; + player.lifeRegenTime += 2; + } + else if (player.statLife <= (int)((double)player.statLifeMax2 * 0.5)) + { + player.lifeRegen += 1; + player.lifeRegenTime += 1; + } + } if (invincible || lol) { player.thorns = 0f; @@ -4442,6 +4491,20 @@ namespace CalamityMod.CalPlayer { player.lifeRegen /= 2; } + if (royalGel) + { + player.npcTypeNoAggro[mod.NPCType("AeroSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("BloomSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("CharredSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("CrimulanBlightSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("CryoSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("EbonianBlightSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("IrradiatedSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("PerennialSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("PlaguedJungleSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("AstralSlime")] = true; + player.npcTypeNoAggro[mod.NPCType("WulfrumSlime")] = true; //remove when wulfrum slime redesigned + } #endregion #region LimitsAndOtherShit @@ -4602,10 +4665,48 @@ namespace CalamityMod.CalPlayer if (player.wingTimeMax < 50000) player.wingTimeMax = 50000; } - #endregion - } + #endregion - public override void PostUpdateRunSpeeds() + #region Rogue Mirrors + Rectangle rectangle = new Rectangle((int)((double)player.position.X + (double)player.velocity.X * 0.5 - 4.0), (int)((double)player.position.Y + (double)player.velocity.Y * 0.5 - 4.0), player.width + 8, player.height + 8); + for (int i = 0; i < 200; i++) + { + if ((Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && !Main.npc[i].townNPC && Main.npc[i].immune[player.whoAmI] <= 0 && Main.npc[i].damage > 0)) + { + NPC nPC = Main.npc[i]; + Rectangle rect = nPC.getRect(); + if (rectangle.Intersects(rect) && (nPC.noTileCollide || player.CanHit(nPC))) + { + if (Main.rand.Next(0, 10) == 0) + { + AbyssMirrorEvade(); + EclipseMirrorEvade(); + } + break; + } + } + } + for (int i = 0; i < 1000; i++) + { + if ((Main.projectile[i].active && !Main.projectile[i].friendly && Main.projectile[i].hostile && Main.projectile[i].damage > 0)) + { + Projectile proj = Main.projectile[i]; + Rectangle rect = proj.getRect(); + if (rectangle.Intersects(rect)) + { + if (Main.rand.Next(0, 10) == 0) + { + AbyssMirrorEvade(); + EclipseMirrorEvade(); + } + break; + } + } + } + #endregion + } + + public override void PostUpdateRunSpeeds() { #region SpeedBoosts float runAccMult = 1f + @@ -4650,6 +4751,11 @@ namespace CalamityMod.CalPlayer runAccMult *= 0.5f; runSpeedMult *= 0.5f; } + if (ursaSergeant) + { + runAccMult *= 0.8f; + runSpeedMult *= 0.8f; + } if (elysianGuard) { runAccMult *= 0.5f; @@ -4683,12 +4789,61 @@ namespace CalamityMod.CalPlayer player.accRunSpeed = player.maxRunSpeed; } } - #endregion - } - #endregion + #endregion + } - #region Pre Kill - public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) + #region Rogue Mirrors + private void AbyssMirrorEvade() + { + if (player.whoAmI == Main.myPlayer && abyssalMirror && !abyssalMirrorCooldown) + { + player.AddBuff(mod.BuffType("AbyssalMirrorCooldown"), 1200); + player.immune = true; + player.immuneTime = player.longInvince ? 100 : 60; + player.noKnockback = true; + rogueStealth += 0.5f; + + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + + Main.PlaySound(mod.GetLegacySoundSlot(SoundType.Custom, "Sounds/Custom/SilvaActivation"), (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y); + + for (int i = 0; i < 50; i++) + { + int lumenyl = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), mod.ProjectileType("AbyssalMirrorProjectile"), 55, 0, player.whoAmI); + Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); + Main.projectile[lumenyl].frame = Main.rand.Next(0, 4); + } + } + } + + private void EclipseMirrorEvade() + { + if (player.whoAmI == Main.myPlayer && eclipseMirror && !eclipseMirrorCooldown) + { + player.AddBuff(mod.BuffType("EclipseMirrorCooldown"), 1200); + player.immune = true; + player.immuneTime = player.longInvince ? 100 : 60; + player.noKnockback = true; + rogueStealth = rogueStealthMax; + + for (int k = 0; k < player.hurtCooldowns.Length; k++) + { + player.hurtCooldowns[k] = player.immuneTime; + } + + Main.PlaySound(2, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 68); + int eclipseBurst = Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, 0f, mod.ProjectileType("EclipseMirrorBurst"), 8000, 0, player.whoAmI); + } + } + #endregion + + #endregion + + #region Pre Kill + public override bool PreKill(double damage, int hitDirection, bool pvp, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { if (invincible && player.inventory[player.selectedItem].type != mod.ItemType("ColdheartIcicle")) { @@ -5803,9 +5958,20 @@ namespace CalamityMod.CalPlayer } } damage = (int)((double)damage * damageMult); - #endregion - if (yharonLore) + if (oldDie) + { + float diceMult = Main.rand.NextFloat(0.8824f, 1.1565f); + if (item.GetGlobalItem(mod).rogue || wearingRogueArmor) + { + float roll2 = Main.rand.NextFloat(0.8824f, 1.1565f); + diceMult = roll2 > diceMult ? roll2 : diceMult; + } + damage = (int)(damage * diceMult); + } + #endregion + + if (yharonLore) damage = (int)((double)damage * 0.75); if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue) @@ -6061,10 +6227,21 @@ namespace CalamityMod.CalPlayer } } damage = (int)((double)damage * damageMult); - #endregion - #region AdditiveBoosts - if (theBee && !isSummon) + if (oldDie) + { + float diceMult = Main.rand.NextFloat(0.8824f, 1.1565f); + if (proj.GetGlobalProjectile(mod).rogue || wearingRogueArmor) + { + float roll2 = Main.rand.NextFloat(0.8824f, 1.1565f); + diceMult = roll2 > diceMult ? roll2 : diceMult; + } + damage = (int)(damage * diceMult); + } + #endregion + + #region AdditiveBoosts + if (theBee && !isSummon) { if (hasClassType) damage += theBeeDamage; @@ -6633,6 +6810,10 @@ namespace CalamityMod.CalPlayer #region Fishing public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk) { + if (ZoneAstral && Main.rand.NextBool(25)) + { + caughtType = mod.ItemType("UrsaSergeant"); + } Point point = player.Center.ToTileCoordinates(); bool abyssPosX = false; if (CalamityWorld.abyssSide) @@ -7284,8 +7465,21 @@ namespace CalamityMod.CalPlayer } } } - } - if (ataxiaBlaze && Main.rand.NextBool(5)) + } + if (inkBomb) + { + if (player.whoAmI == Main.myPlayer && !inkBombCooldown) + { + player.AddBuff(mod.BuffType("InkBombCooldown"), 1200); + rogueStealth += 0.5f; + for (int i = 0; i < 5; i++) + { + Main.PlaySound(2, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 61); + int inkBomb = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), mod.ProjectileType("InkBombProjectile"), 0, 0, player.whoAmI); + } + } + } + if (ataxiaBlaze && Main.rand.NextBool(5)) { if (damage > 0) { @@ -9252,22 +9446,45 @@ namespace CalamityMod.CalPlayer stealthGenMoving += 0.2f; else stealthGenMoving += 0.1f; - } + } - // - // Other code which affects stealth generation goes here. - // Increase stealthGenStandstill (default 1.0) to increase basic "stand still" stealth generation. - // Incrase stealthGenMoving (default 0.0) to increase stealth generation while moving. - // Increase stealthGenMultiplier (default 1.0) to provide a global % boost to all stealth generation. - // + bool standstill = Math.Abs(player.velocity.X) < 0.1f && Math.Abs(player.velocity.Y) < 0.1f && !player.mount.Active; - // You get 100% stealth regen while standing still and not on a mount. Otherwise, you get your stealth regeneration while moving. - bool standstill = Math.Abs(player.velocity.X) < 0.1f && Math.Abs(player.velocity.Y) < 0.1f && !player.mount.Active; - if (standstill) - return stealthGenStandstill * stealthGenMultiplier; - else - return stealthGenMoving * stealthGenMultiplier; - } + // Stealth gen acceleration + float stealthScaleCap = eclipseMirror ? 40f : 25f; + + if (standstill && (eclipseMirror || darkGodSheath)) + { + if (eclipseMirror) + stealthGenAcceleration = stealthGenAcceleration < stealthScaleCap ? stealthGenAcceleration * 1.2f : stealthScaleCap; + if (darkGodSheath) + stealthGenAcceleration = stealthGenAcceleration < stealthScaleCap ? stealthGenAcceleration + 0.15f : stealthScaleCap; + } + else + { + stealthGenAcceleration = 1f; + } + + // + // Other code which affects stealth generation goes here. + // Increase stealthGenStandstill (default 1.0) to increase basic "stand still" stealth generation. + // Incrase stealthGenMoving (default 0.0) to increase stealth generation while moving. + // Increase stealthGenMultiplier (default 1.0) to provide a global % boost to all stealth generation. + // + + // You get 100% stealth regen while standing still and not on a mount. Otherwise, you get your stealth regeneration while moving. + if (standstill) + { + if (eclipseMirror || darkGodSheath) + return stealthGenStandstill * stealthGenMultiplier * stealthGenAcceleration; + else + return stealthGenStandstill * stealthGenMultiplier; + } + else + { + return stealthGenMoving * stealthGenMultiplier; + } + } public bool StealthStrikeAvailable() { @@ -10418,6 +10635,30 @@ namespace CalamityMod.CalPlayer } return meleeSpeedBonus; } - #endregion - } + #endregion + + #region Misc Stuff + + /// + /// Returns the range at which an abyss enemy can detect the player + /// + /// The default detection range + /// The detection range set by the player having anechoic plating/coating + /// + public float GetAbyssAggro(float defaultRange, float anechoicRange) + { + /* ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 600f) * + (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) * + (Main.player[npc.target].GetCalamityPlayer().abyssalMirror ? 0.7f : 1f) * + (Main.player[npc.target].GetCalamityPlayer().eclipseMirror ? 0.3f : 1f) */ + float range = anechoicPlating || anechoicCoating ? anechoicRange : defaultRange; + range *= fishAlert ? 3f : 1f; + range *= abyssalMirror ? 0.65f : 1f; + range *= eclipseMirror ? 0.3f : 1f; + return range; + } + + #endregion + } } diff --git a/CalamityMod.cs b/CalamityMod.cs index 221c974b64..e444b2b22f 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -56,8 +56,11 @@ namespace CalamityMod public static Texture2D AstralSky; public static Effect CustomShader; - // Lists - public static IList donatorList; + // DR data structure + public static SortedDictionary DRValues; + + // Lists + public static IList donatorList; public static List rangedProjectileExceptionList; public static List projectileMinionList; public static List enemyImmunityList; @@ -87,6 +90,7 @@ namespace CalamityMod public static List revengeanceEnemyBuffList; public static List revengeanceProjectileBuffList; public static List revengeanceLifeStealExceptionList; + public static List movementImpairImmuneList; public static List trapProjectileList; public static List scopedWeaponList; public static List trueMeleeBoostExceptionList; @@ -138,6 +142,8 @@ namespace CalamityMod Config.Load(); SetupLists(); + SetupVanillaDR(); + SetupThoriumBossDR(ModLoader.GetMod("ThoriumMod")); CalamityLocalization.AddLocalizations(); } @@ -217,8 +223,10 @@ namespace CalamityMod AstralCactusGlowTexture = null; AstralSky = null; - donatorList = null; + DRValues?.Clear(); + DRValues = null; + donatorList = null; rangedProjectileExceptionList = null; projectileMinionList = null; enemyImmunityList = null; @@ -247,6 +255,7 @@ namespace CalamityMod revengeanceEnemyBuffList = null; revengeanceProjectileBuffList = null; revengeanceLifeStealExceptionList = null; + movementImpairImmuneList = null; trapProjectileList = null; scopedWeaponList = null; trueMeleeBoostExceptionList = null; @@ -1469,6 +1478,10 @@ namespace CalamityMod NPCID.MoonLordCore }; + movementImpairImmuneList = new List() + { + NPCID.QueenBee, + }; trapProjectileList = new List() { @@ -2041,17 +2054,163 @@ namespace CalamityMod } } } - #endregion + #endregion - #region Music - public override void UpdateMusic(ref int music, ref MusicPriority priority) + #region Vanilla Enemy DR + private void SetupVanillaDR() + { + DRValues = new SortedDictionary { + { NPCID.AngryBonesBig, 0.2f }, + { NPCID.AngryBonesBigHelmet, 0.2f }, + { NPCID.AngryBonesBigMuscle, 0.2f }, + { NPCID.AnomuraFungus, 0.1f }, + { NPCID.Antlion, 0.1f }, + { NPCID.Arapaima, 0.1f }, + { NPCID.ArmoredSkeleton, 0.15f }, + { NPCID.ArmoredViking, 0.1f }, + { NPCID.BigMimicCorruption, 0.3f }, + { NPCID.BigMimicCrimson, 0.3f }, + { NPCID.BigMimicHallow, 0.3f }, + { NPCID.BigMimicJungle, 0.3f }, // unused vanilla enemy + { NPCID.BlueArmoredBones, 0.2f }, + { NPCID.BlueArmoredBonesMace, 0.2f }, + { NPCID.BlueArmoredBonesNoPants, 0.2f }, + { NPCID.BlueArmoredBonesSword, 0.2f }, + { NPCID.BoneLee, 0.2f }, + { NPCID.Crab, 0.05f }, + { NPCID.Crawdad, 0.2f }, + { NPCID.Crawdad2, 0.2f }, + { NPCID.CultistBoss, 0.05f }, + { 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.DungeonGuardian, 0.999999f }, + { NPCID.DungeonSpirit, 0.2f }, + { NPCID.ElfCopter, 0.15f }, + { NPCID.Everscream, 0.1f }, + { NPCID.FlyingAntlion, 0.05f }, + { NPCID.GiantCursedSkull, 0.2f }, + { NPCID.GiantShelly, 0.2f }, + { NPCID.GiantShelly2, 0.2f }, + { NPCID.GiantTortoise, 0.35f }, + { NPCID.Golem, 0.25f }, + { NPCID.GolemFistLeft, 0.25f }, + { NPCID.GolemFistRight, 0.25f }, + { NPCID.GolemHead, 0.25f }, + { NPCID.GolemHeadFree, 0.25f }, + { NPCID.GraniteFlyer, 0.1f }, + { NPCID.GraniteGolem, 0.15f }, + { NPCID.GreekSkeleton, 0.1f }, + { NPCID.HellArmoredBones, 0.2f }, + { NPCID.HellArmoredBonesMace, 0.2f }, + { NPCID.HellArmoredBonesSpikeShield, 0.2f }, + { NPCID.HellArmoredBonesSword, 0.2f }, + { NPCID.IceGolem, 0.1f }, + { NPCID.IceQueen, 0.1f }, + { NPCID.IceTortoise, 0.35f }, + { NPCID.HeadlessHorseman, 0.05f }, + { NPCID.MartianDrone, 0.2f }, + { NPCID.MartianSaucer, 0.2f }, + { NPCID.MartianSaucerCannon, 0.2f }, + { NPCID.MartianSaucerCore, 0.2f }, + { NPCID.MartianSaucerTurret, 0.2f }, + { NPCID.MartianTurret, 0.2f }, + { NPCID.MartianWalker, 0.35f }, + { NPCID.Mimic, 0.3f }, + { NPCID.MoonLordCore, 0.05f }, + { NPCID.MoonLordFreeEye, 0.05f }, + { NPCID.MoonLordHand, 0.05f }, + { NPCID.MoonLordHead, 0.05f }, + { NPCID.Mothron, 0.2f }, + { NPCID.MothronEgg, 0.5f }, + { NPCID.MourningWood, 0.1f }, + { NPCID.Necromancer, 0.2f }, + { NPCID.NecromancerArmored, 0.2f }, + { NPCID.Paladin, 0.45f }, + { NPCID.PirateCaptain, 0.05f }, + { NPCID.PirateShipCannon, 0.15f }, + { NPCID.PossessedArmor, 0.25f }, + { NPCID.PresentMimic, 0.3f }, + { NPCID.PrimeCannon, 0.2f }, + { NPCID.PrimeLaser, 0.2f }, + { NPCID.PrimeSaw, 0.25f }, + { NPCID.PrimeVice, 0.25f }, + { NPCID.Probe, 0.25f }, + { NPCID.Pumpking, 0.1f }, + { NPCID.QueenBee, 0.05f }, + { NPCID.RaggedCaster, 0.2f }, + { NPCID.RaggedCasterOpenCoat, 0.2f }, + { NPCID.Retinazer, 0.2f }, + { NPCID.RustyArmoredBonesAxe, 0.2f }, + { NPCID.RustyArmoredBonesFlail, 0.2f }, + { NPCID.RustyArmoredBonesSword, 0.2f }, + { NPCID.RustyArmoredBonesSwordNoArmor, 0.2f }, + { NPCID.SandElemental, 0.1f }, + { NPCID.SantaNK1, 0.35f }, + { NPCID.SeaSnail, 0.05f }, + { NPCID.SkeletonArcher, 0.1f }, + { NPCID.SkeletonCommando, 0.2f }, + { NPCID.SkeletonSniper, 0.2f }, + { NPCID.SkeletronHand, 0.05f }, + { NPCID.SkeletronHead, 0.05f }, + { NPCID.SkeletronPrime, 0.25f }, + { NPCID.Spazmatism, 0.2f }, + { NPCID.TacticalSkeleton, 0.2f }, + { NPCID.TheDestroyer, 0.1f }, + { NPCID.TheDestroyerBody, 0.2f }, + { NPCID.TheDestroyerTail, 0.35f }, + { NPCID.TheHungry, 0.1f }, + { NPCID.UndeadViking, 0.1f }, + { NPCID.WalkingAntlion, 0.1f }, + { NPCID.WallofFlesh, 0.5f }, + }; + } + #endregion + + #region Thorium Boss DR + private void SetupThoriumBossDR(Mod thorium) + { + if (thorium is null || !Config.RevengeanceAndDeathThoriumBossBuff) + return; + + void ThoriumDR(string npcName, float dr) { DRValues.Add(thorium.NPCType(npcName), dr); } + ThoriumDR("Viscount", 0.05f); + ThoriumDR("BoreanStrider", 0.05f); + ThoriumDR("FallenDeathBeholder", 0.05f); + ThoriumDR("Lich", 0.05f); + ThoriumDR("AbyssionReleased", 0.05f); + ThoriumDR("CryoCore", 0.1f); + ThoriumDR("BioCore", 0.1f); + ThoriumDR("PyroCore", 0.1f); + ThoriumDR("Aquaius", 0.1f); + ThoriumDR("ThePrimeScouter", 0.2f); + ThoriumDR("FallenDeathBeholder2", 0.2f); + ThoriumDR("SlagFury", 0.2f); + ThoriumDR("Aquaius2", 0.2f); + ThoriumDR("GraniteEnergyStorm", 0.2f); + ThoriumDR("TheBuriedWarrior", 0.25f); + ThoriumDR("TheBuriedWarrior1", 0.25f); + ThoriumDR("TheBuriedWarrior2", 0.25f); + ThoriumDR("LichHeadless", 0.25f); + ThoriumDR("AbyssionCracked", 0.25f); + ThoriumDR("Omnicide", 0.3f); + ThoriumDR("Abyssion", 0.35f); + } + #endregion + + #region Music + public override void UpdateMusic(ref int music, ref MusicPriority priority) { Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (Main.musicVolume != 0) { if (Main.myPlayer != -1 && !Main.gameMenu && Main.LocalPlayer.active) { - if (Main.LocalPlayer.GetModPlayer(this).ZoneCalamity) + Player p = Main.LocalPlayer; + if (p.InCalamity()) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2062,7 +2221,7 @@ namespace CalamityMod priority = MusicPriority.Environment; } } - if (Main.LocalPlayer.GetModPlayer(this).ZoneSunkenSea) + if (p.InSunkenSea()) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2073,7 +2232,7 @@ namespace CalamityMod priority = MusicPriority.Environment; } } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAstral) + if (p.InAstral()) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2084,7 +2243,7 @@ namespace CalamityMod priority = MusicPriority.Environment; } } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer1 || Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer2) + if (p.InAbyss(1) || p.InAbyss(2)) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2095,7 +2254,7 @@ namespace CalamityMod priority = MusicPriority.BiomeHigh; } } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer3) + if (p.InAbyss(3)) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2106,7 +2265,7 @@ namespace CalamityMod priority = MusicPriority.BiomeHigh; } } - if (Main.LocalPlayer.GetModPlayer(this).ZoneAbyssLayer4) + if (p.InAbyss(4)) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2117,7 +2276,7 @@ namespace CalamityMod priority = MusicPriority.BiomeHigh; } } - if (Main.LocalPlayer.GetModPlayer(this).ZoneSulphur) + if (p.InSulphur()) { if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -2152,7 +2311,7 @@ namespace CalamityMod public override object Call(params object[] args) { - return ModSupport.Call(args); + return ModCalls.Call(args); } #endregion diff --git a/Items/Accessories/AbyssalMirror.cs b/Items/Accessories/AbyssalMirror.cs new file mode 100644 index 0000000000..dab49f627f --- /dev/null +++ b/Items/Accessories/AbyssalMirror.cs @@ -0,0 +1,52 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class AbyssalMirror : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Abyssal Mirror"); + Tooltip.SetDefault("Light does not reach the depths of the ocean\n" + + "Significantly reduces enemy aggression, even in the abyss\n" + + "15% increased stealth regeneration while moving\n" + + "Grants a slight chance to evade attacks, releasing a cloud of lumenyl fluid which damages and stuns nearby enemies\n" + + "Evading an attack grants a lot of stealth\n" + + "This evade has a 20s cooldown before it can occur again"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 6, 0, 0); + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.stealthGenMoving += 0.15f; + modPlayer.abyssalMirror = true; + player.aggro -= 450; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("MirageMirror")); + recipe.AddIngredient(mod.GetItem("InkBomb")); + recipe.AddIngredient(ItemID.SpectreBar, 8); + recipe.AddIngredient(ItemID.BlackBelt); + recipe.AddIngredient(mod.GetItem("DepthCells"), 5); + recipe.AddIngredient(mod.GetItem("Lumenite"), 5); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/AbyssalMirror.png b/Items/Accessories/AbyssalMirror.png new file mode 100644 index 0000000000..e0dc36f515 Binary files /dev/null and b/Items/Accessories/AbyssalMirror.png differ diff --git a/Items/Accessories/DarkGodsSheath.cs b/Items/Accessories/DarkGodsSheath.cs new file mode 100644 index 0000000000..148398317d --- /dev/null +++ b/Items/Accessories/DarkGodsSheath.cs @@ -0,0 +1,52 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class DarkGodsSheath : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Dark God's Sheath"); + Tooltip.SetDefault("+100 maximum stealth\n" + + "Stealth regeneration rate increases while standing still\n" + + "Stealth strikes have a 100% critical hit chance\n" + + "Stealth strikes only expend 50% of your max stealth\n" + + "6% increased rogue damage, and 6% increased rogue crit chance"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 26, 0, 0); + item.rare = 9; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.stealthStrikeAlwaysCrits = true; + modPlayer.stealthStrikeHalfCost = true; + modPlayer.rogueStealthMax += 1; + modPlayer.darkGodSheath = true; + modPlayer.throwingCrit += 6; + modPlayer.throwingDamage += 0.06f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("SilencingSheath")); + recipe.AddIngredient(mod.ItemType("RuinMedallion")); + recipe.AddIngredient(mod.ItemType("MeldiateBar"), 5); + recipe.AddIngredient(mod.ItemType("Stardust"), 25); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/DarkGodsSheath.png b/Items/Accessories/DarkGodsSheath.png new file mode 100644 index 0000000000..f2bd3b2b32 Binary files /dev/null and b/Items/Accessories/DarkGodsSheath.png differ diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index a7a1756702..02fe367f2b 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Deific Amulet"); Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + "Increases armor penetration by 10 and immune time after being struck\n" + - "Provides light underwater and causes stars to fall when damaged\n" + + "Provides light underwater and provides a small amount of light in the abyss\n" + + "Causes stars to fall when damaged\n" + "Reduces the cooldown of healing potions"); } @@ -29,6 +30,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.dAmulet = true; + modPlayer.jellyfishNecklace = true; } public override void AddRecipes() diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs new file mode 100644 index 0000000000..207c7a6f6c --- /dev/null +++ b/Items/Accessories/EclipseMirror.cs @@ -0,0 +1,60 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class EclipseMirror : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse Mirror"); + Tooltip.SetDefault("Its reflection shows naught but darkness\n" + + "+100 maximum stealth\n" + + "8% increased rogue damage, and 8% increased rogue crit chance\n" + + "Vastly reduces enemy aggression, even in the abyss\n" + + "20% increased stealth regeneration while moving\n" + + "Stealth regeneration rate exponentially increases while standing still\n" + + "Stealth strikes have a 100% critical hit chance\n" + + "Stealth strikes only expend 50% of your max stealth\n" + + "Grants a small chance to evade attacks in a blast of darksun light, which inflicts extreme damage in a wide area\n" + + "Evading an attack grants full stealth\n" + + "This evade has a 20s cooldown before it can occur again"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 22, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 15; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.stealthGenMoving += 0.2f; + modPlayer.rogueStealthMax += 1; + modPlayer.eclipseMirror = true; + modPlayer.stealthStrikeAlwaysCrits = true; + modPlayer.stealthStrikeHalfCost = true; + modPlayer.throwingCrit += 8; + modPlayer.throwingDamage += 0.08f; + player.aggro -= 700; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.GetItem("AbyssalMirror")); + recipe.AddIngredient(mod.GetItem("DarkGodsSheath")); + recipe.AddIngredient(mod.GetItem("DarksunFragment"), 10); + recipe.AddIngredient(mod.GetItem("NightmareFuel"), 5); + recipe.AddIngredient(mod.GetItem("EndothermicEnergy"), 5); + recipe.AddTile(mod.GetTile("DraedonsForge")); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/EclipseMirror.png b/Items/Accessories/EclipseMirror.png new file mode 100644 index 0000000000..fcfde3314c Binary files /dev/null and b/Items/Accessories/EclipseMirror.png differ diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs new file mode 100644 index 0000000000..5de38271e6 --- /dev/null +++ b/Items/Accessories/FeatherCrown.cs @@ -0,0 +1,51 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class FeatherCrown : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Feather Crown"); + Tooltip.SetDefault("15% increased rogue projectile velocity\n" + + "Stealth strikes cause feathers to fall from the sky on enemy hits"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 0, 80, 0); + item.rare = 4; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.throwingVelocity += 0.15f; + modPlayer.featherCrown = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.GoldCrown); + recipe.AddIngredient(mod.ItemType("AerialiteBar"), 6); + recipe.AddIngredient(ItemID.Feather, 8); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.PlatinumCrown); + recipe.AddIngredient(mod.ItemType("AerialiteBar"), 6); + recipe.AddIngredient(ItemID.Feather, 8); + recipe.AddTile(TileID.SkyMill); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/FeatherCrown.png b/Items/Accessories/FeatherCrown.png new file mode 100644 index 0000000000..00716d0487 Binary files /dev/null and b/Items/Accessories/FeatherCrown.png differ diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs new file mode 100644 index 0000000000..6689c18557 --- /dev/null +++ b/Items/Accessories/InkBomb.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class InkBomb : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Bomb"); + Tooltip.SetDefault("Throws several ink bombs when hit that explode in a confusing cloud of ink\n" + + "Gain a lot of stealth when struck\n" + + "This effect has a 20s cooldown before it can occur again"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 3, 0, 0); + item.rare = 3; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.inkBomb = true; + } + + public override void AddRecipes() + { + } + } +} diff --git a/Items/Accessories/InkBomb.png b/Items/Accessories/InkBomb.png new file mode 100644 index 0000000000..6576bb5b6a Binary files /dev/null and b/Items/Accessories/InkBomb.png differ diff --git a/Items/Accessories/MirageMirror.cs b/Items/Accessories/MirageMirror.cs new file mode 100644 index 0000000000..3839a333aa --- /dev/null +++ b/Items/Accessories/MirageMirror.cs @@ -0,0 +1,53 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class MirageMirror : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Mirage Mirror"); + Tooltip.SetDefault("Bend light around you\n" + + "Reduces enemy aggression outside of the abyss\n" + + "10% increased stealth regeneration while moving"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.stealthGenMoving += 0.1f; + player.aggro -= 200; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.MagicMirror); + recipe.AddIngredient(ItemID.BlackLens); + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.IceMirror); + recipe.AddIngredient(ItemID.BlackLens); + recipe.AddIngredient(ItemID.Bone, 50); + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/MirageMirror.png b/Items/Accessories/MirageMirror.png new file mode 100644 index 0000000000..d6040ee4ae Binary files /dev/null and b/Items/Accessories/MirageMirror.png differ diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs new file mode 100644 index 0000000000..225f6fa7f6 --- /dev/null +++ b/Items/Accessories/MoonstoneCrown.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class MoonstoneCrown : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moonstone Crown"); + Tooltip.SetDefault("15% increased rogue projectile velocity\n" + + "Stealth strikes summon lunar flares on enemy hits\n" + + "Rogue projectiles very occasionally summon moon sigils behind them"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 18, 0, 0); + item.GetGlobalItem(mod).postMoonLordRarity = 12; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.throwingVelocity += 0.15f; + modPlayer.moonCrown = true; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("FeatherCrown")); + recipe.AddIngredient(ItemID.LunarBar, 5); + recipe.AddIngredient(mod.ItemType("GalacticaSingularity"), 5); + recipe.AddTile(TileID.LunarCraftingStation); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/MoonstoneCrown.png b/Items/Accessories/MoonstoneCrown.png new file mode 100644 index 0000000000..e889e88ce5 Binary files /dev/null and b/Items/Accessories/MoonstoneCrown.png differ diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs new file mode 100644 index 0000000000..4305c1df0b --- /dev/null +++ b/Items/Accessories/OldDie.cs @@ -0,0 +1,33 @@ +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class OldDie : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Old Die"); + Tooltip.SetDefault("Increases randomness of attack damage \n" + + "'Lucky for you, the curse doesn't affect you.Mostly.'"); + } + + public override void SetDefaults() + { + item.width = 24; + item.height = 26; + item.rare = 3; + item.value = Item.buyPrice(0, 40, 0, 0); + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetCalamityPlayer(); + modPlayer.oldDie = true; + } + } +} diff --git a/Items/Accessories/OldDie.png b/Items/Accessories/OldDie.png new file mode 100644 index 0000000000..924aef845b Binary files /dev/null and b/Items/Accessories/OldDie.png differ diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index b81ce1710a..803a56216e 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -11,7 +11,8 @@ namespace CalamityMod.Items.Accessories DisplayName.SetDefault("Rampart of Deities"); Tooltip.SetDefault("Taking damage makes you move very fast for a short time\n" + "Increases armor penetration by 20 and immune time after being struck\n" + - "Provides light underwater and causes stars to fall when damaged\n" + + "Provides light underwater and provides a small amount of light in the abyss\n" + + "Causes stars to fall when damaged\n" + "Absorbs 25% of damage done to players on your team\n" + "Only active above 25% life\n" + "Grants immunity to knockback and reduces the cooldown of healing potions\n" + @@ -34,6 +35,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.dAmulet = true; modPlayer.rampartOfDeities = true; + modPlayer.jellyfishNecklace = true; } public override void AddRecipes() diff --git a/Items/Accessories/RuinMedallion.cs b/Items/Accessories/RuinMedallion.cs new file mode 100644 index 0000000000..27e7e203c3 --- /dev/null +++ b/Items/Accessories/RuinMedallion.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class RuinMedallion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ruin Medallion"); + Tooltip.SetDefault("Stealth strikes only expend 50% of your max stealth\n" + + "6% increased rogue damage, and 6% increased rogue crit chance"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 13, 0, 0); + item.rare = 6; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.stealthStrikeHalfCost = true; + modPlayer.throwingCrit += 6; + modPlayer.throwingDamage += 0.06f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(mod.ItemType("CoinofDeceit")); + recipe.AddIngredient(mod.ItemType("UnholyCore"), 4); + recipe.AddIngredient(mod.ItemType("EssenceofChaos"), 2); + recipe.AddTile(TileID.MythrilAnvil); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/RuinMedallion.png b/Items/Accessories/RuinMedallion.png new file mode 100644 index 0000000000..108f963231 Binary files /dev/null and b/Items/Accessories/RuinMedallion.png differ diff --git a/Items/Accessories/SilencingSheath.cs b/Items/Accessories/SilencingSheath.cs new file mode 100644 index 0000000000..36f837060d --- /dev/null +++ b/Items/Accessories/SilencingSheath.cs @@ -0,0 +1,52 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class SilencingSheath : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Silencing Sheath"); + Tooltip.SetDefault("+50 maximum stealth\n" + + "10% increased stealth regeneration while standing still"); + } + + public override void SetDefaults() + { + item.width = 20; + item.height = 20; + item.value = Item.buyPrice(0, 2, 0, 0); + item.rare = 2; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetModPlayer(mod); + modPlayer.rogueStealthMax += 0.5f; + modPlayer.stealthGenStandstill += 0.1f; + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.DemoniteBar, 8); + recipe.AddIngredient(ItemID.Silk, 10); + recipe.AddIngredient(ItemID.ShadowScale, 3); + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + + recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.CrimtaneBar, 8); + recipe.AddIngredient(ItemID.Silk, 10); + recipe.AddIngredient(ItemID.TissueSample, 3); + recipe.AddTile(TileID.TinkerersWorkbench); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Accessories/SilencingSheath.png b/Items/Accessories/SilencingSheath.png new file mode 100644 index 0000000000..b9876f8585 Binary files /dev/null and b/Items/Accessories/SilencingSheath.png differ diff --git a/Items/Accessories/UrsaSergeant.cs b/Items/Accessories/UrsaSergeant.cs new file mode 100644 index 0000000000..43658c96ae --- /dev/null +++ b/Items/Accessories/UrsaSergeant.cs @@ -0,0 +1,36 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Items.Accessories +{ + public class UrsaSergeant : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ursa Sergeant"); + Tooltip.SetDefault("+20 defense but 20% reduced movement speed\n" + + "Immune to Astral Infection and Feral Bite\n" + + "Increased regeneration at lower health"); + } + + public override void SetDefaults() + { + item.width = 36; + item.height = 26; + item.value = Item.buyPrice(0, 24, 0, 0); + item.rare = 8; + item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.GetCalamityPlayer(); + modPlayer.ursaSergeant = true; + player.statDefense += 20; + player.buffImmune[mod.BuffType("AstralInfectionDebuff")] = true; + player.buffImmune[148] = true; //Feral Bite + } + } +} diff --git a/Items/Accessories/UrsaSergeant.png b/Items/Accessories/UrsaSergeant.png new file mode 100644 index 0000000000..88265b671b Binary files /dev/null and b/Items/Accessories/UrsaSergeant.png differ diff --git a/Items/Accessories/Wings/AureateWings.cs b/Items/Accessories/Wings/AureateWings.cs index 0b80910239..de90dcdd77 100644 --- a/Items/Accessories/Wings/AureateWings.cs +++ b/Items/Accessories/Wings/AureateWings.cs @@ -87,6 +87,7 @@ namespace CalamityMod.Items.Accessories.Wings } } player.wingTimeMax = 80; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/CelestialTracers.cs b/Items/Accessories/Wings/CelestialTracers.cs index d29fee2b37..2b3298cd95 100644 --- a/Items/Accessories/Wings/CelestialTracers.cs +++ b/Items/Accessories/Wings/CelestialTracers.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaMax += 240; player.wingTimeMax = 280; + player.noFallDmg = true; modPlayer.IBoots = !hideVisual; modPlayer.elysianFire = !hideVisual; modPlayer.cTracers = true; diff --git a/Items/Accessories/Wings/DiscordianWings.cs b/Items/Accessories/Wings/DiscordianWings.cs index 39884b72b1..a158290da6 100644 --- a/Items/Accessories/Wings/DiscordianWings.cs +++ b/Items/Accessories/Wings/DiscordianWings.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 180; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs index e089746bb0..be952ecc4e 100644 --- a/Items/Accessories/Wings/DrewsWings.cs +++ b/Items/Accessories/Wings/DrewsWings.cs @@ -46,6 +46,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 361; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/ElysianTracers.cs b/Items/Accessories/Wings/ElysianTracers.cs index 805c76ae18..a95ff90a2e 100644 --- a/Items/Accessories/Wings/ElysianTracers.cs +++ b/Items/Accessories/Wings/ElysianTracers.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaMax += 240; player.wingTimeMax = 160; + player.noFallDmg = true; modPlayer.IBoots = !hideVisual; modPlayer.elysianFire = !hideVisual; modPlayer.eTracers = true; diff --git a/Items/Accessories/Wings/HadarianWings.cs b/Items/Accessories/Wings/HadarianWings.cs index 051a43a673..2eefc9829c 100644 --- a/Items/Accessories/Wings/HadarianWings.cs +++ b/Items/Accessories/Wings/HadarianWings.cs @@ -62,6 +62,7 @@ namespace CalamityMod.Items.Accessories.Wings } } player.wingTimeMax = 120; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/InfinityBoots.cs b/Items/Accessories/Wings/InfinityBoots.cs index 4cf4d4b6b7..032bfa5088 100644 --- a/Items/Accessories/Wings/InfinityBoots.cs +++ b/Items/Accessories/Wings/InfinityBoots.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaMax += 240; player.wingTimeMax = 120; + player.noFallDmg = true; modPlayer.IBoots = !hideVisual; modPlayer.sTracers = true; } diff --git a/Items/Accessories/Wings/SkylineWings.cs b/Items/Accessories/Wings/SkylineWings.cs index 6fcd18cc27..90f84c0094 100644 --- a/Items/Accessories/Wings/SkylineWings.cs +++ b/Items/Accessories/Wings/SkylineWings.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void UpdateAccessory(Player player, bool hideVisual) { player.wingTimeMax = 60; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/StarlightWings.cs b/Items/Accessories/Wings/StarlightWings.cs index 90559cbef0..a3b7372ad0 100644 --- a/Items/Accessories/Wings/StarlightWings.cs +++ b/Items/Accessories/Wings/StarlightWings.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 150; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/TarragonWings.cs b/Items/Accessories/Wings/TarragonWings.cs index 29b9a05b22..cb0ed6fa19 100644 --- a/Items/Accessories/Wings/TarragonWings.cs +++ b/Items/Accessories/Wings/TarragonWings.cs @@ -60,6 +60,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 210; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Accessories/Wings/XerocWings.cs b/Items/Accessories/Wings/XerocWings.cs index e24ab089a5..6fab33895c 100644 --- a/Items/Accessories/Wings/XerocWings.cs +++ b/Items/Accessories/Wings/XerocWings.cs @@ -49,6 +49,7 @@ namespace CalamityMod.Items.Accessories.Wings Main.dust[num60].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); } player.wingTimeMax = 180; + player.noFallDmg = true; } public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) diff --git a/Items/Armor/AerospecHeadgear.cs b/Items/Armor/AerospecHeadgear.cs index 51dae14db8..6fae64a91e 100644 --- a/Items/Armor/AerospecHeadgear.cs +++ b/Items/Armor/AerospecHeadgear.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Items.Armor player.noFallDmg = true; player.moveSpeed += 0.05f; player.GetCalamityPlayer().throwingCrit += 5; + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/AstralHelm.cs b/Items/Armor/AstralHelm.cs index 625ce758dd..e483578d91 100644 --- a/Items/Armor/AstralHelm.cs +++ b/Items/Armor/AstralHelm.cs @@ -44,7 +44,8 @@ namespace CalamityMod.Items.Armor player.moveSpeed += 0.25f; player.allDamage += 0.28f; modPlayer.AllCritBoost(21); - } + player.GetCalamityPlayer().wearingRogueArmor = true; + } public override void UpdateEquip(Player player) { diff --git a/Items/Armor/AtaxiaHood.cs b/Items/Armor/AtaxiaHood.cs index e8c4b9febe..f1b983fc25 100644 --- a/Items/Armor/AtaxiaHood.cs +++ b/Items/Armor/AtaxiaHood.cs @@ -50,6 +50,7 @@ namespace CalamityMod.Items.Armor modPlayer.ataxiaVolley = true; modPlayer.rogueStealthMax = 1.2f; player.GetCalamityPlayer().throwingDamage += 0.05f; + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/AuricTeslaPlumedHelm.cs b/Items/Armor/AuricTeslaPlumedHelm.cs index 0761c2b293..8d1e8f56e5 100644 --- a/Items/Armor/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/AuricTeslaPlumedHelm.cs @@ -54,6 +54,7 @@ namespace CalamityMod.Items.Armor modPlayer.silvaThrowing = true; modPlayer.auricSet = true; modPlayer.rogueStealthMax = 1.6f; + modPlayer.wearingRogueArmor = true; player.thorns += 3f; player.lavaMax += 240; player.ignoreWater = true; diff --git a/Items/Armor/AuricTeslaSpaceHelmet.cs b/Items/Armor/AuricTeslaSpaceHelmet.cs index 2e28e6775e..9a8201e2b7 100644 --- a/Items/Armor/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/AuricTeslaSpaceHelmet.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Armor player.setBonus = "Summoner Tarragon, Bloodflare, God Slayer, and Silva armor effects\n" + "All projectiles spawn healing auric orbs on enemy hits\n" + "Max run speed and acceleration boosted by 10%\n" + - "120% increased minion damage"; + "+1 max minion and 120% increased minion damage"; CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.tarraSet = true; modPlayer.tarraSummon = true; @@ -56,6 +56,7 @@ namespace CalamityMod.Items.Armor player.ignoreWater = true; player.crimsonRegen = true; player.minionDamage += 1.2f; + player.maxMinions++; if (player.lavaWet) { player.statDefense += 30; diff --git a/Items/Armor/BloodflareHelm.cs b/Items/Armor/BloodflareHelm.cs index a1f9c9c340..bc5c364835 100644 --- a/Items/Armor/BloodflareHelm.cs +++ b/Items/Armor/BloodflareHelm.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Armor modPlayer.bloodflareSet = true; modPlayer.bloodflareThrowing = true; modPlayer.rogueStealthMax = 1.35f; + modPlayer.wearingRogueArmor = true; player.setBonus = "Greatly increases life regen\n" + "Enemies below 50% life have a chance to drop hearts when struck\n" + "Enemies above 50% life have a chance to drop mana stars when struck\n" + diff --git a/Items/Armor/DaedalusVisor.cs b/Items/Armor/DaedalusVisor.cs index 2cd97823bd..b03f70efec 100644 --- a/Items/Armor/DaedalusVisor.cs +++ b/Items/Armor/DaedalusVisor.cs @@ -53,6 +53,7 @@ namespace CalamityMod.Items.Armor modPlayer.daedalusSplit = true; modPlayer.rogueStealthMax = 1.1f; player.GetCalamityPlayer().throwingDamage += 0.05f; + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/DemonshadeHelm.cs b/Items/Armor/DemonshadeHelm.cs index b5920e292b..02ca3048c9 100644 --- a/Items/Armor/DemonshadeHelm.cs +++ b/Items/Armor/DemonshadeHelm.cs @@ -43,6 +43,7 @@ namespace CalamityMod.Items.Armor "This makes them do 25% more damage but they also take 125% more damage"; CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.dsSetBonus = true; + modPlayer.wearingRogueArmor = true; if (player.whoAmI == Main.myPlayer && !modPlayer.chibii) { modPlayer.redDevil = true; diff --git a/Items/Armor/GodSlayerMask.cs b/Items/Armor/GodSlayerMask.cs index f13355d99e..25abc597c1 100644 --- a/Items/Armor/GodSlayerMask.cs +++ b/Items/Armor/GodSlayerMask.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Armor modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; modPlayer.rogueStealthMax = 1.4f; + modPlayer.wearingRogueArmor = true; player.setBonus = "You will survive fatal damage and will be healed 150 HP if an attack would have killed you\n" + "This effect can only occur once every 45 seconds\n" + "While the cooldown for this effect is active you gain a 10% increase to all damage\n" + diff --git a/Items/Armor/MolluskShellmet.cs b/Items/Armor/MolluskShellmet.cs index 04be0b63d1..998a6f243e 100644 --- a/Items/Armor/MolluskShellmet.cs +++ b/Items/Armor/MolluskShellmet.cs @@ -56,7 +56,8 @@ namespace CalamityMod.Items.Armor Projectile.NewProjectile(player.Center.X, player.Center.Y, 0f, -1f, mod.ProjectileType("Shellfish"), (int)((double)1500 * player.minionDamage), 0f, Main.myPlayer, 0f, 0f); } } - } + player.GetCalamityPlayer().wearingRogueArmor = true; + } public override void AddRecipes() { diff --git a/Items/Armor/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlueHelmet.cs index f10fd8d2c7..b77bc1fae3 100644 --- a/Items/Armor/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlueHelmet.cs @@ -57,6 +57,7 @@ Abyssal madness increases damage, critical strike chance, and tentacle aggressio This effect has a 30 second cooldown"; player.armorPenetration += 50; + player.GetCalamityPlayer().wearingRogueArmor = true; //raise rev caps player.GetModPlayer().omegaBlueSet = true; diff --git a/Items/Armor/ReaverCap.cs b/Items/Armor/ReaverCap.cs index 531d59291f..a124da966c 100644 --- a/Items/Armor/ReaverCap.cs +++ b/Items/Armor/ReaverCap.cs @@ -47,6 +47,7 @@ namespace CalamityMod.Items.Armor "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; player.GetCalamityPlayer().throwingDamage += 0.05f; + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/SilvaMask.cs b/Items/Armor/SilvaMask.cs index a7870b06cf..667df5caae 100644 --- a/Items/Armor/SilvaMask.cs +++ b/Items/Armor/SilvaMask.cs @@ -39,6 +39,7 @@ namespace CalamityMod.Items.Armor modPlayer.silvaSet = true; modPlayer.silvaThrowing = true; modPlayer.rogueStealthMax = 1.5f; + modPlayer.wearingRogueArmor = true; player.setBonus = "You are immune to almost all debuffs\n" + "All projectiles spawn healing leaf orbs on enemy hits\n" + "Max run speed and acceleration boosted by 5%\n" + diff --git a/Items/Armor/StatigelMask.cs b/Items/Armor/StatigelMask.cs index 7e08d3c31b..fd61ef926c 100644 --- a/Items/Armor/StatigelMask.cs +++ b/Items/Armor/StatigelMask.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Items.Armor modPlayer.rogueStealthMax = 1.05f; player.doubleJumpSail = true; player.jumpBoost = true; + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/TarragonHelmet.cs b/Items/Armor/TarragonHelmet.cs index 3560eb06c0..4a1250d5a6 100644 --- a/Items/Armor/TarragonHelmet.cs +++ b/Items/Armor/TarragonHelmet.cs @@ -44,7 +44,8 @@ namespace CalamityMod.Items.Armor modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; modPlayer.rogueStealthMax = 1.3f; - player.setBonus = "Reduces enemy spawn rates\n" + + modPlayer.wearingRogueArmor = true; + player.setBonus = "Reduces enemy spawn rates\n" + "Increased heart pickup range\n" + "Enemies have a chance to drop extra hearts on death\n" + "After every 25 rogue critical hits you will gain 5 seconds of damage immunity\n" + diff --git a/Items/Armor/VictideHeadgear.cs b/Items/Armor/VictideHeadgear.cs index fad42bfdb2..3b4bdaba19 100644 --- a/Items/Armor/VictideHeadgear.cs +++ b/Items/Armor/VictideHeadgear.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Items.Armor CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.victideSet = true; modPlayer.rogueStealthMax = 1f; + modPlayer.wearingRogueArmor = true; player.ignoreWater = true; if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) { diff --git a/Items/Armor/WulfrumMask.cs b/Items/Armor/WulfrumMask.cs index f3754f3247..21a4d8d249 100644 --- a/Items/Armor/WulfrumMask.cs +++ b/Items/Armor/WulfrumMask.cs @@ -37,6 +37,7 @@ namespace CalamityMod.Items.Armor { player.statDefense += 5; //14 } + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/Armor/XerocMask.cs b/Items/Armor/XerocMask.cs index 60e59f1273..02e924b01d 100644 --- a/Items/Armor/XerocMask.cs +++ b/Items/Armor/XerocMask.cs @@ -55,6 +55,7 @@ namespace CalamityMod.Items.Armor } player.GetCalamityPlayer().throwingDamage += 0.09f; player.GetCalamityPlayer().throwingVelocity += 0.09f; + player.GetCalamityPlayer().wearingRogueArmor = true; } public override void UpdateEquip(Player player) diff --git a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs index 428885f2c0..d3323b3745 100644 --- a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs +++ b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs @@ -2,6 +2,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles.Rogue; namespace CalamityMod.Items.CalamityCustomThrowingDamage { @@ -38,10 +39,12 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { speedY *= 0.7f; //since the barrel is heavy Vector2 initialVelocity = new Vector2(speedX, speedY); - bool canUseStealthStrike = player.GetCalamityPlayer().StealthStrikeAvailable(); + //unitY additive is do it doesn't exploe initially - Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type,damage,knockBack,player.whoAmI, canUseStealthStrike.ToInt()); + int p = Projectile.NewProjectile(position - Vector2.UnitY * 12f, initialVelocity, type,damage,knockBack,player.whoAmI); + if (player.GetCalamityPlayer().StealthStrikeAvailable()) + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } } -} \ No newline at end of file +} diff --git a/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs b/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs index 5477a63ea7..7dc164d93a 100644 --- a/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs +++ b/Items/CalamityCustomThrowingDamage/BloodsoakedCrasher.cs @@ -40,7 +40,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) //setting the stealth strike { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("BloodsoakedCrashax"), damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("BloodsoakedCrashax"), damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs index dfad01af54..d606ebd2b1 100644 --- a/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs +++ b/Items/CalamityCustomThrowingDamage/BouncingEyeball.cs @@ -45,7 +45,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage if (player.GetCalamityPlayer().StealthStrikeAvailable()) { initialVelocity *= 2f; - Projectile.NewProjectile(position, initialVelocity, mod.ProjectileType("BouncingEyeballProjectileStealthStrike"),damage,knockBack,player.whoAmI); + int p = Projectile.NewProjectile(position, initialVelocity, mod.ProjectileType("BouncingEyeballProjectileStealthStrike"),damage,knockBack,player.whoAmI); + Main.projectile[p].GetCalamityProj().stealthStrike = true; } else { diff --git a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs index 3d959eb43e..36f9cfe918 100644 --- a/Items/CalamityCustomThrowingDamage/CelestialReaper.cs +++ b/Items/CalamityCustomThrowingDamage/CelestialReaper.cs @@ -40,7 +40,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { Vector2 velocity = new Vector2(speedX, speedY); float strikeValue = player.GetCalamityPlayer().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true - Projectile.NewProjectile(position, velocity, mod.ProjectileType("CelestialReaperProjectile"), damage, knockBack, player.whoAmI, strikeValue); + int p = Projectile.NewProjectile(position, velocity, mod.ProjectileType("CelestialReaperProjectile"), damage, knockBack, player.whoAmI, strikeValue); + if (player.GetCalamityPlayer().StealthStrikeAvailable()) + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } } diff --git a/Items/CalamityCustomThrowingDamage/Cinquedea.cs b/Items/CalamityCustomThrowingDamage/Cinquedea.cs index 3ea9585135..21bef889e2 100644 --- a/Items/CalamityCustomThrowingDamage/Cinquedea.cs +++ b/Items/CalamityCustomThrowingDamage/Cinquedea.cs @@ -41,7 +41,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("CinquedeaProj"), damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), mod.ProjectileType("CinquedeaProj"), damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs index 1377b307e2..217ebd3dca 100644 --- a/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs +++ b/Items/CalamityCustomThrowingDamage/ConsecratedWater.cs @@ -39,7 +39,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { Vector2 velocity = new Vector2(speedX, speedY); float strikeValue = player.GetCalamityPlayer().StealthStrikeAvailable().ToInt(); //0 if false, 1 if true - Projectile.NewProjectile(position, velocity, mod.ProjectileType("ConsecratedWaterProjectile"), damage, knockBack, player.whoAmI, ai1:strikeValue); + int p = Projectile.NewProjectile(position, velocity, mod.ProjectileType("ConsecratedWaterProjectile"), damage, knockBack, player.whoAmI, ai1:strikeValue); + if (player.GetCalamityPlayer().StealthStrikeAvailable()) + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } public override void AddRecipes() diff --git a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs index e85a711d5d..b9f7e111a6 100644 --- a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs +++ b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs @@ -45,15 +45,16 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EclipsesStealth"), damage, knockBack, player.whoAmI, 0f, 0f); - } + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("EclipsesStealth"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; + } else { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); } return false; } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/CalamityCustomThrowingDamage/Glaive.cs b/Items/CalamityCustomThrowingDamage/Glaive.cs index 6854359321..4194f87b34 100644 --- a/Items/CalamityCustomThrowingDamage/Glaive.cs +++ b/Items/CalamityCustomThrowingDamage/Glaive.cs @@ -50,7 +50,9 @@ Stealth strikes are super fast and pierce infinitely"); ai1 = 1f; } - Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, ai1); + int p = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, ai1); + if (player.GetCalamityPlayer().StealthStrikeAvailable()) + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } diff --git a/Items/CalamityCustomThrowingDamage/IronFrancisca.cs b/Items/CalamityCustomThrowingDamage/IronFrancisca.cs index 3127d62a00..4dba7088e7 100644 --- a/Items/CalamityCustomThrowingDamage/IronFrancisca.cs +++ b/Items/CalamityCustomThrowingDamage/IronFrancisca.cs @@ -39,7 +39,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/Kylie.cs b/Items/CalamityCustomThrowingDamage/Kylie.cs index 15833b6388..de41639f7b 100644 --- a/Items/CalamityCustomThrowingDamage/Kylie.cs +++ b/Items/CalamityCustomThrowingDamage/Kylie.cs @@ -44,7 +44,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage for (int i = 0; i <3; i++) { Vector2 perturbedspeed = new Vector2(speedX, speedY).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType("Kylieproj"), item.damage, item.knockBack, player.whoAmI,0f,1f); + int proj = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType("Kylieproj"), item.damage, item.knockBack, player.whoAmI,0f,1f); + Main.projectile[proj].GetCalamityProj().stealthStrike = true; spread -= 10; } return false; diff --git a/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs b/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs index a43665d387..89b96a0d92 100644 --- a/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs +++ b/Items/CalamityCustomThrowingDamage/LeadTomahawk.cs @@ -39,7 +39,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 1f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs index c2a9bc7f69..97bf32eda2 100644 --- a/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs +++ b/Items/CalamityCustomThrowingDamage/MonkeyDarts.cs @@ -44,7 +44,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage for (int i = 0; i < 3; i++) { Vector2 perturbedspeed = new Vector2(speedX * 1.4f, speedY * 1.4f).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType(), item.damage, item.knockBack, player.whoAmI,1); + int p = Projectile.NewProjectile(position.X, position.Y, perturbedspeed.X, perturbedspeed.Y, mod.ProjectileType(), item.damage, item.knockBack, player.whoAmI,1); + Main.projectile[p].GetCalamityProj().stealthStrike = true; spread -= 7; } return false; diff --git a/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs b/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs index 7fa113f498..cd4e448294 100644 --- a/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs +++ b/Items/CalamityCustomThrowingDamage/ScourgeoftheSeas.cs @@ -44,8 +44,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ScourgeoftheSeasStealth"), damage, knockBack, player.whoAmI, 0f, 0f); - } + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("ScourgeoftheSeasStealth"), damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; + } else { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs b/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs index 3e12a04d22..ad414c9556 100644 --- a/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs +++ b/Items/CalamityCustomThrowingDamage/StormfrontRazor.cs @@ -57,7 +57,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position, new Vector2(speedX * 1.6f, speedY * 1.6f), mod.ProjectileType("Stormfrontproj"), damage, knockBack, player.whoAmI, 0, 40f); + int p = Projectile.NewProjectile(position, new Vector2(speedX * 1.6f, speedY * 1.6f), mod.ProjectileType("Stormfrontproj"), damage, knockBack, player.whoAmI, 0, 40f); + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } else diff --git a/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs b/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs index f4696226c6..581c28c5ad 100644 --- a/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs +++ b/Items/CalamityCustomThrowingDamage/ThrowingBrick.cs @@ -39,7 +39,8 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage //Check if stealth is full if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Brick"), item.damage, item.knockBack, player.whoAmI, 1); + int p = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Brick"), item.damage, item.knockBack, player.whoAmI, 1); + Main.projectile[p].GetCalamityProj().stealthStrike = true; return false; } return true; diff --git a/Items/CalamityCustomThrowingDamage/UtensilPoker.cs b/Items/CalamityCustomThrowingDamage/UtensilPoker.cs index 6816dffafe..9d9c5b0ea5 100644 --- a/Items/CalamityCustomThrowingDamage/UtensilPoker.cs +++ b/Items/CalamityCustomThrowingDamage/UtensilPoker.cs @@ -41,8 +41,9 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage { if (player.GetCalamityPlayer().StealthStrikeAvailable()) { - Projectile.NewProjectile(position.X, position.Y, (int) ((double)speedX * 1.2), (int) ((double)speedY * 1.2), mod.ProjectileType("ButcherKnife"), (int) ((double)damage * 3), knockBack, Main.myPlayer); - if (Main.rand.NextBool(3)) + int p = Projectile.NewProjectile(position.X, position.Y, (int) ((double)speedX * 1.2), (int) ((double)speedY * 1.2), mod.ProjectileType("ButcherKnife"), (int) ((double)damage * 3), knockBack, Main.myPlayer); + Main.projectile[p].GetCalamityProj().stealthStrike = true; + if (Main.rand.NextBool(3)) { Projectile.NewProjectile(position.X, position.Y, speedX, speedY, mod.ProjectileType("Fork"), (int) ((double)damage * 1.1), knockBack * 2f, Main.myPlayer); } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 3f68e66d4c..844b90fab5 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1814,6 +1814,7 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.rogueStealthMax = 1f; + modPlayer.wearingRogueArmor = true; player.GetCalamityPlayer().throwingDamage += 0.1f; player.GetCalamityPlayer().throwingVelocity += 0.1f; player.statDefense += 5; @@ -1827,6 +1828,7 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.GetCalamityPlayer(); modPlayer.rogueStealthMax = 1f; + modPlayer.wearingRogueArmor = true; player.GetCalamityPlayer().throwingDamage += 0.05f; player.GetCalamityPlayer().throwingCrit += 5; player.statDefense += 2; @@ -2181,6 +2183,9 @@ namespace CalamityMod.Items if (item.type == ItemID.WormScarf) player.endurance -= 0.07f; + if (item.type == ItemID.RoyalGel) + modPlayer.royalGel = true; + if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell || (item.type == ItemID.MoonStone && !Main.dayTime) || (item.type == ItemID.SunStone && Main.dayTime)) { diff --git a/Items/Patreon/DodusHandcannon.cs b/Items/Patreon/DodusHandcannon.cs index aa44699512..9704e0a57a 100644 --- a/Items/Patreon/DodusHandcannon.cs +++ b/Items/Patreon/DodusHandcannon.cs @@ -1,7 +1,11 @@ +using System; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Patreon { @@ -39,7 +43,7 @@ namespace CalamityMod.Items.Patreon public override Vector2? HoldoutOffset() { - return new Vector2(-15, 10); + return new Vector2(-15, 5); } public override bool CanUseItem(Player player) diff --git a/Items/Placeables/Banners/IrradiatedSlimeBanner.png b/Items/Placeables/Banners/IrradiatedSlimeBanner.png index a7176895d4..8a88b06c39 100644 Binary files a/Items/Placeables/Banners/IrradiatedSlimeBanner.png and b/Items/Placeables/Banners/IrradiatedSlimeBanner.png differ diff --git a/Items/Placeables/Banners/PiggyBanner.cs b/Items/Placeables/Banners/PiggyBanner.cs new file mode 100644 index 0000000000..fc2f90a0e0 --- /dev/null +++ b/Items/Placeables/Banners/PiggyBanner.cs @@ -0,0 +1,25 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Banners +{ + public class PiggyBanner : ModItem + { + public override void SetDefaults() + { + item.width = 10; + item.height = 24; + item.maxStack = 99; + item.useTurn = true; + item.autoReuse = true; + item.useAnimation = 15; + item.useTime = 10; + item.useStyle = 1; + item.consumable = true; + item.rare = 1; + item.value = Item.buyPrice(0, 0, 10, 0); + item.createTile = mod.TileType("MonsterBanner"); + item.placeStyle = 108; + } + } +} diff --git a/Items/Placeables/Banners/PiggyBanner.png b/Items/Placeables/Banners/PiggyBanner.png new file mode 100644 index 0000000000..e6cd993b29 Binary files /dev/null and b/Items/Placeables/Banners/PiggyBanner.png differ diff --git a/Items/Weapons/AbyssWeapons/Archerfish.cs b/Items/Weapons/AbyssWeapons/Archerfish.cs index 3e619b6d42..a965a8119c 100644 --- a/Items/Weapons/AbyssWeapons/Archerfish.cs +++ b/Items/Weapons/AbyssWeapons/Archerfish.cs @@ -1,7 +1,11 @@ +using System; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.AbyssWeapons { @@ -35,7 +39,7 @@ namespace CalamityMod.Items.Weapons.AbyssWeapons public override Vector2? HoldoutOffset() { - return new Vector2(-5, 0); + return new Vector2(-10, -5); } public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) diff --git a/Items/Weapons/Astral/AstralBlaster.cs b/Items/Weapons/Astral/AstralBlaster.cs index 12d05a7efc..9ec2d6e27c 100644 --- a/Items/Weapons/Astral/AstralBlaster.cs +++ b/Items/Weapons/Astral/AstralBlaster.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Astral { @@ -33,6 +38,11 @@ namespace CalamityMod.Items.Weapons.Astral item.useAmmo = 97; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.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, mod.ProjectileType("AstralRound"), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.cs b/Items/Weapons/Bumblebirb/GoldenEagle.cs index 980b1ab9c9..35395959b8 100644 --- a/Items/Weapons/Bumblebirb/GoldenEagle.cs +++ b/Items/Weapons/Bumblebirb/GoldenEagle.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Bumblebirb { @@ -33,6 +38,11 @@ namespace CalamityMod.Items.Weapons.Bumblebirb item.GetGlobalItem(mod).postMoonLordRarity = 12; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float SpeedX = speedX + 5f * 0.05f; diff --git a/Items/Weapons/Crabulon/Fungicide.cs b/Items/Weapons/Crabulon/Fungicide.cs index 15b50571c6..331f5660e7 100644 --- a/Items/Weapons/Crabulon/Fungicide.cs +++ b/Items/Weapons/Crabulon/Fungicide.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Crabulon { @@ -32,6 +37,11 @@ namespace CalamityMod.Items.Weapons.Crabulon item.useAmmo = 97; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.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, mod.ProjectileType("FungiOrb"), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/FirestormCannon.cs b/Items/Weapons/FirestormCannon.cs index 9315a72495..34aceee5dd 100644 --- a/Items/Weapons/FirestormCannon.cs +++ b/Items/Weapons/FirestormCannon.cs @@ -1,6 +1,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Projectiles; namespace CalamityMod.Items.Weapons { @@ -72,6 +73,7 @@ namespace CalamityMod.Items.Weapons int flare = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, (int)((double)damage * 0.75), knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[flare].penetrate = 1; Main.projectile[flare].timeLeft = 600; + Main.projectile[flare].GetGlobalProjectile(mod).forceRanged = true; } return false; } @@ -85,6 +87,7 @@ namespace CalamityMod.Items.Weapons float SpeedX = speedX + (float) Main.rand.Next(-40, 41) * 0.05f; float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); + Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; Main.projectile[projectile].timeLeft = 200; } return false; diff --git a/Items/Weapons/HalleysInferno.cs b/Items/Weapons/HalleysInferno.cs index b5e8272a90..5348a74fc6 100644 --- a/Items/Weapons/HalleysInferno.cs +++ b/Items/Weapons/HalleysInferno.cs @@ -40,19 +40,19 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 14.6f; item.useAmmo = 23; } - + public override Vector2? HoldoutOffset() { return new Vector2(-15, 0); } - + public override bool ConsumeAmmo(Player player) { if (Main.rand.Next(0, 100) < 50) return false; return true; } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -63,4 +63,4 @@ namespace CalamityMod.Items.Weapons recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Helstorm.cs b/Items/Weapons/Helstorm.cs index 4f9ed958db..ed53dc9134 100644 --- a/Items/Weapons/Helstorm.cs +++ b/Items/Weapons/Helstorm.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Items.Weapons public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) { - target.AddBuff(BuffID.OnFire, 400); + target.AddBuff(BuffID.OnFire, 360); } } } diff --git a/Items/Weapons/Megafleet.cs b/Items/Weapons/Megafleet.cs index b44bd26e68..05ab9e4600 100644 --- a/Items/Weapons/Megafleet.cs +++ b/Items/Weapons/Megafleet.cs @@ -1,7 +1,11 @@ +using System; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons { @@ -36,7 +40,7 @@ namespace CalamityMod.Items.Weapons public override Vector2? HoldoutOffset() { - return new Vector2(-5, 0); + return new Vector2(-10, 0); } public override bool ConsumeAmmo(Player player) diff --git a/Items/Weapons/Perforators/Eviscerator.cs b/Items/Weapons/Perforators/Eviscerator.cs index b164aec035..3b13d7d8df 100644 --- a/Items/Weapons/Perforators/Eviscerator.cs +++ b/Items/Weapons/Perforators/Eviscerator.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.Perforators { @@ -33,6 +38,11 @@ namespace CalamityMod.Items.Weapons.Perforators item.useAmmo = 97; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-7, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.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, mod.ProjectileType("BloodClotFriendly"), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/RareVariants/Infinity.cs b/Items/Weapons/RareVariants/Infinity.cs index 59b9095ae6..d6b47715c5 100644 --- a/Items/Weapons/RareVariants/Infinity.cs +++ b/Items/Weapons/RareVariants/Infinity.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Items.Weapons.RareVariants public class Infinity : ModItem { internal int rotation = 0; - internal int limit = 1; + internal bool limit = true; public override void SetStaticDefaults() { DisplayName.SetDefault("Infinity"); @@ -63,7 +63,7 @@ namespace CalamityMod.Items.Weapons.RareVariants int shot2 = Projectile.NewProjectile(position.X, position.Y, num8.X, num8.Y, type, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot2].timeLeft = 180; //Code to constantly make the shooting go side to side to make the helix - if (limit == 1) + if (limit) { rotation += 2; } @@ -73,11 +73,11 @@ namespace CalamityMod.Items.Weapons.RareVariants } if (rotation >= 15) { - limit = 0; + limit = false; } else if (rotation <= -15) { - limit = 1; + limit = true; } return false; } @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.RareVariants Main.projectile[shot1].timeLeft = 180; int shot2 = Projectile.NewProjectile(position.X, position.Y, num8.X, num8.Y, mod.ProjectileType("ChargedBlast"), damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[shot2].timeLeft = 180; - if (limit == 1) + if (limit) { rotation += 2; } @@ -100,11 +100,11 @@ namespace CalamityMod.Items.Weapons.RareVariants } if (rotation >= 15) { - limit = 0; + limit = false; } else if (rotation <= -15) { - limit = 1; + limit = true; } return false; } diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs index e6c56dafe9..f163496208 100644 --- a/Items/Weapons/SDFMG.cs +++ b/Items/Weapons/SDFMG.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons { @@ -35,6 +40,11 @@ namespace CalamityMod.Items.Weapons item.GetGlobalItem(mod).postMoonLordRarity = 14; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { float SpeedX = speedX + (float)Main.rand.Next(-5, 6) * 0.05f; diff --git a/Items/Weapons/SlagMagnum.cs b/Items/Weapons/SlagMagnum.cs index 06cc3186d2..158c55d8d9 100644 --- a/Items/Weapons/SlagMagnum.cs +++ b/Items/Weapons/SlagMagnum.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons { @@ -32,6 +37,11 @@ namespace CalamityMod.Items.Weapons item.useAmmo = 97; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-10, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.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, mod.ProjectileType("SlagRound"), damage, knockBack, player.whoAmI, 0f, 0f); diff --git a/Items/Weapons/SlimeGod/GunkShot.cs b/Items/Weapons/SlimeGod/GunkShot.cs index 313f9c2e2f..3035334cef 100644 --- a/Items/Weapons/SlimeGod/GunkShot.cs +++ b/Items/Weapons/SlimeGod/GunkShot.cs @@ -1,6 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.SlimeGod { @@ -32,6 +37,11 @@ namespace CalamityMod.Items.Weapons.SlimeGod item.useAmmo = 97; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-5, 0); + } + public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) { int num6 = Main.rand.Next(3, 5); diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs index 8506215eed..23bab11b5f 100644 --- a/Items/Weapons/SlimeGod/OverloadedBlaster.cs +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.cs @@ -1,7 +1,11 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; - +using CalamityMod.Items; namespace CalamityMod.Items.Weapons.SlimeGod { public class OverloadedBlaster : ModItem @@ -33,6 +37,11 @@ namespace CalamityMod.Items.Weapons.SlimeGod item.useAmmo = 23; } + public override Vector2? HoldoutOffset() + { + return new Vector2(-4, 0); + } + public override bool ConsumeAmmo(Player player) { if (Main.rand.Next(0, 100) < 33) diff --git a/Items/Weapons/SparkSpreader.cs b/Items/Weapons/SparkSpreader.cs index 5a4fd54ac2..2bb371a910 100644 --- a/Items/Weapons/SparkSpreader.cs +++ b/Items/Weapons/SparkSpreader.cs @@ -36,19 +36,19 @@ namespace CalamityMod.Items.Weapons item.shootSpeed = 5f; item.useAmmo = 23; } - + public override Vector2? HoldoutOffset() { return new Vector2(-4, 0); } - + public override bool ConsumeAmmo(Player player) { if (Main.rand.Next(0, 100) < 20) return false; return true; } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); @@ -60,4 +60,4 @@ namespace CalamityMod.Items.Weapons recipe.AddRecipe(); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/SpectralstormCannon.cs b/Items/Weapons/SpectralstormCannon.cs index c4a18c0bfc..b3bd203eb8 100644 --- a/Items/Weapons/SpectralstormCannon.cs +++ b/Items/Weapons/SpectralstormCannon.cs @@ -52,6 +52,7 @@ namespace CalamityMod.Items.Weapons float SpeedY = speedY + (float) Main.rand.Next(-40, 41) * 0.05f; int projectile = Projectile.NewProjectile(position.X, position.Y, SpeedX, SpeedY, type, damage, knockBack, player.whoAmI, 0.0f, 0.0f); Main.projectile[projectile].timeLeft = 200; + Main.projectile[projectile].GetGlobalProjectile(mod).forceRanged = true; } int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, 297, damage, knockBack, player.whoAmI, 0f, 0f); Main.projectile[proj].GetGlobalProjectile(mod).forceRanged = true; diff --git a/MiscModSupport/ModSupport.cs b/MiscModSupport/ModCalls.cs similarity index 92% rename from MiscModSupport/ModSupport.cs rename to MiscModSupport/ModCalls.cs index 585b99a659..80d6f2ddfe 100644 --- a/MiscModSupport/ModSupport.cs +++ b/MiscModSupport/ModCalls.cs @@ -8,7 +8,7 @@ using CalamityMod.CalPlayer; namespace CalamityMod.MiscModSupport { - public class ModSupport + public class ModCalls { #region Boss / Event Downed /// @@ -475,10 +475,21 @@ namespace CalamityMod.MiscModSupport return false; } - #endregion + #endregion - #region Call - public static object Call(params object[] args) + #region Set Damage Reduction + + public static float SetDamageReduction(int npcID, float dr) + { + CalamityMod.DRValues.TryGetValue(npcID, out float oldDR); + CalamityMod.DRValues.Remove(npcID); + CalamityMod.DRValues.Add(npcID, dr); + return oldDR; + } + #endregion + + #region Call + public static object Call(params object[] args) { if (args is null || args.Length <= 0) return new ArgumentNullException("ERROR: No function name specified. First argument must be a function name."); if (!(args[0] is string)) return new ArgumentException("ERROR: First argument must be a string function name."); @@ -536,7 +547,20 @@ namespace CalamityMod.MiscModSupport p = (Player)args[1]; return GetSetBonus(p, args[2].ToString()); - default: + case "DR": + case "DamageReduction": + case "SetDR": + case "SetDamageReduction": + if (args.Length < 2) return new ArgumentNullException("ERROR: Must specify both NPC ID as an int and damage reduction as a float or double."); + if (args.Length < 3) return new ArgumentNullException("ERROR: Must specify damage reduction as a float or double."); + if (!(args[2] is float) && !(args[2] is double)) return new ArgumentException("ERROR: The second argument to \"SetDamageReduction\" must be a float or a double."); + if (!(args[1] is string)) return new ArgumentException("ERROR: The first argument to \"SetDamageReduction\" must be an int."); + + int npcID = (int)args[1]; + float DR = (float)args[2]; + return SetDamageReduction(npcID, DR); + + default: return new ArgumentException("ERROR: Invalid method name."); } } diff --git a/NPCs/AbyssNPCs/AquaticScourgeBody.cs b/NPCs/AbyssNPCs/AquaticScourgeBody.cs index 95ca397b17..c5f8053c61 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBody.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBody.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 32; npc.height = 32; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs index eae8954669..413a92daab 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeBodyAlt.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 32; npc.height = 32; npc.defense = 15; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AbyssNPCs/AquaticScourgeHead.cs b/NPCs/AbyssNPCs/AquaticScourgeHead.cs index db81aceacb..4757a7e29a 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeHead.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeHead.cs @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 100; npc.height = 90; npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.aiStyle = -1; aiType = -1; npc.lifeMax = CalamityWorld.revenge ? 85000 : 73000; diff --git a/NPCs/AbyssNPCs/AquaticScourgeTail.cs b/NPCs/AbyssNPCs/AquaticScourgeTail.cs index a031c3d663..e2524da01a 100644 --- a/NPCs/AbyssNPCs/AquaticScourgeTail.cs +++ b/NPCs/AbyssNPCs/AquaticScourgeTail.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 30; npc.height = 50; npc.defense = 25; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs index 1a674081b3..66d291053a 100644 --- a/NPCs/AbyssNPCs/BobbitWormHead.cs +++ b/NPCs/AbyssNPCs/BobbitWormHead.cs @@ -25,7 +25,8 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 80; //324 npc.height = 40; //216 npc.defense = 50; - npc.lifeMax = 10000; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = 10000; npc.knockBackResist = 0f; aiType = -1; npc.noGravity = true; @@ -62,10 +63,11 @@ namespace CalamityMod.NPCs.AbyssNPCs if (npc.ai[1] >= 60f) { npc.TargetClosest(true); - if (npc.Center.Y + ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && - Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { + //if (npc.Center.Y + ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 50f : 100f) > Main.player[npc.target].Center.Y && + if (npc.Center.Y + Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(100f, 50f) > Main.player[npc.target].Center.Y && + Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) + { npc.ai[1] = 0f; npc.ai[0] = 1f; return; diff --git a/NPCs/AbyssNPCs/ColossalSquid.cs b/NPCs/AbyssNPCs/ColossalSquid.cs index 33fc6f64e5..4a9dc6dd4d 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -28,6 +28,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 180; npc.height = 180; npc.defense = 50; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = 220000; npc.aiStyle = -1; aiType = -1; @@ -321,10 +322,11 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(false); if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 300f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - npc.justHit) + //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 300f) * + //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(300f, 150f)) || + npc.justHit) { hasBeenHit = true; } diff --git a/NPCs/AbyssNPCs/Cuttlefish.cs b/NPCs/AbyssNPCs/Cuttlefish.cs index cfd843c593..10fe14910f 100644 --- a/NPCs/AbyssNPCs/Cuttlefish.cs +++ b/NPCs/AbyssNPCs/Cuttlefish.cs @@ -6,6 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using CalamityMod.World; using CalamityMod.CalPlayer; +using CalamityMod.Utilities; namespace CalamityMod.NPCs.AbyssNPCs { @@ -319,8 +320,10 @@ namespace CalamityMod.NPCs.AbyssNPCs if (Main.rand.NextBool(2)) { Item.NewItem((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height, mod.ItemType("CloakingGland")); - } - } + } + int inkBombDropRate = CalamityWorld.defiled ? DropHelper.DefiledDropRateInt : Main.expertMode ? 50 : 100; + DropHelper.DropItemChance(npc, mod.ItemType("InkBomb"), inkBombDropRate, 1, 1); + } public override void HitEffect(int hitDirection, double damage) { diff --git a/NPCs/AbyssNPCs/EidolonWyrmHead.cs b/NPCs/AbyssNPCs/EidolonWyrmHead.cs index 2e67f9747e..7f4e770d80 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHead.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHead.cs @@ -31,7 +31,8 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 126; //36 npc.height = 76; //20 npc.defense = 300; - npc.lifeMax = 160000; + npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.lifeMax = 160000; npc.aiStyle = -1; aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) diff --git a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs index deec893330..e515dc39de 100644 --- a/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs +++ b/NPCs/AbyssNPCs/EidolonWyrmHeadHuge.cs @@ -31,7 +31,8 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 254; //36 npc.height = 138; //20 npc.defense = 3000; - npc.lifeMax = 1000000; + npc.takenDamageMultiplier = 1E-6f; + npc.lifeMax = 1000000; npc.aiStyle = -1; aiType = -1; for (int k = 0; k < npc.buffImmune.Length; k++) diff --git a/NPCs/AbyssNPCs/GiantSquid.cs b/NPCs/AbyssNPCs/GiantSquid.cs index 04725e3fa2..23a7350900 100644 --- a/NPCs/AbyssNPCs/GiantSquid.cs +++ b/NPCs/AbyssNPCs/GiantSquid.cs @@ -97,10 +97,11 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(false); if ((Main.player[npc.target].wet && !Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - npc.justHit) + //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * + //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(500f, 300f)) || + npc.justHit) { hasBeenHit = true; } diff --git a/NPCs/AbyssNPCs/Gnasher.cs b/NPCs/AbyssNPCs/Gnasher.cs index 560b288b6a..222468333c 100644 --- a/NPCs/AbyssNPCs/Gnasher.cs +++ b/NPCs/AbyssNPCs/Gnasher.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 50; npc.height = 36; npc.defense = 30; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 35; npc.knockBackResist = 0.25f; npc.aiStyle = 3; diff --git a/NPCs/AbyssNPCs/GulperEelHead.cs b/NPCs/AbyssNPCs/GulperEelHead.cs index e44445ced3..4bc9234f25 100644 --- a/NPCs/AbyssNPCs/GulperEelHead.cs +++ b/NPCs/AbyssNPCs/GulperEelHead.cs @@ -63,9 +63,10 @@ namespace CalamityMod.NPCs.AbyssNPCs public override void AI() { - if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 100f : 600f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) || + //if ((Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 100f : 600f) * + // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) || + if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(600f, 100f) || npc.justHit) { detectsPlayer = true; diff --git a/NPCs/AbyssNPCs/Laserfish.cs b/NPCs/AbyssNPCs/Laserfish.cs index 972e7e0de5..e4434ba93f 100644 --- a/NPCs/AbyssNPCs/Laserfish.cs +++ b/NPCs/AbyssNPCs/Laserfish.cs @@ -70,10 +70,11 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(false); if (Main.player[npc.target].wet && !Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 400f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - { + //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 400f) * + //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(400f, 200f)) + { flag14 = true; } if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) diff --git a/NPCs/AbyssNPCs/MantisShrimp.cs b/NPCs/AbyssNPCs/MantisShrimp.cs index c95941c7aa..41d226d03e 100644 --- a/NPCs/AbyssNPCs/MantisShrimp.cs +++ b/NPCs/AbyssNPCs/MantisShrimp.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 40; npc.height = 24; npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 30; npc.aiStyle = 3; aiType = 67; diff --git a/NPCs/AbyssNPCs/Mauler.cs b/NPCs/AbyssNPCs/Mauler.cs index 8c5681a490..dc4452910a 100644 --- a/NPCs/AbyssNPCs/Mauler.cs +++ b/NPCs/AbyssNPCs/Mauler.cs @@ -26,6 +26,7 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.width = 180; npc.height = 90; npc.defense = 50; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = 165000; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/AbyssNPCs/MorayEel.cs b/NPCs/AbyssNPCs/MorayEel.cs index 3dd11644b2..33e6c9911e 100644 --- a/NPCs/AbyssNPCs/MorayEel.cs +++ b/NPCs/AbyssNPCs/MorayEel.cs @@ -69,10 +69,11 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(false); if (Main.player[npc.target].wet && !Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 250f : 300f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - { + //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 250f : 300f) * + //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(300f, 250f)) + { flag14 = true; } if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) diff --git a/NPCs/AbyssNPCs/OarfishHead.cs b/NPCs/AbyssNPCs/OarfishHead.cs index 9e2c3a6fa0..1391e85e63 100644 --- a/NPCs/AbyssNPCs/OarfishHead.cs +++ b/NPCs/AbyssNPCs/OarfishHead.cs @@ -131,9 +131,10 @@ namespace CalamityMod.NPCs.AbyssNPCs { num42 *= 16; float num47 = (float)(num42 - 200); //800 - if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * + // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(250f, 150f)) { num192 = num47; if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) < 250f) @@ -165,10 +166,11 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.velocity *= num49; } } - if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - { + //if ((Main.player[npc.target].Center - npc.Center).Length() > ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + // Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 150f : 250f) * + // (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + if ((Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(250f, 150f)) + { for (int num51 = 0; num51 < 200; num51++) { if (Main.npc[num51].active && Main.npc[num51].type == npc.type && num51 != npc.whoAmI) diff --git a/NPCs/AbyssNPCs/Reaper.cs b/NPCs/AbyssNPCs/Reaper.cs index 82b3192e3c..cf4f43f921 100644 --- a/NPCs/AbyssNPCs/Reaper.cs +++ b/NPCs/AbyssNPCs/Reaper.cs @@ -149,12 +149,14 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(false); if ((!Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) || - npc.justHit) - { - hasBeenHit = true; + //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 300f : 500f) * + //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(500f, 300f)) || + npc.justHit) + + { + hasBeenHit = true; } if (!flag14) { diff --git a/NPCs/AbyssNPCs/Viperfish.cs b/NPCs/AbyssNPCs/Viperfish.cs index 3c27b95f07..7e8371e78c 100644 --- a/NPCs/AbyssNPCs/Viperfish.cs +++ b/NPCs/AbyssNPCs/Viperfish.cs @@ -70,10 +70,13 @@ namespace CalamityMod.NPCs.AbyssNPCs npc.TargetClosest(false); if (Main.player[npc.target].wet && !Main.player[npc.target].dead && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && - (Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || - Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 600f) * - (Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f)) - { + //(Main.player[npc.target].Center - npc.Center).Length() < ((Main.player[npc.target].GetCalamityPlayer().anechoicPlating || + //Main.player[npc.target].GetCalamityPlayer().anechoicCoating) ? 200f : 600f) * + //(Main.player[npc.target].GetCalamityPlayer().fishAlert ? 3f : 1f) * + // (Main.player[npc.target].GetCalamityPlayer().abyssalMirror ? 0.7f : 1f) * + // (Main.player[npc.target].GetCalamityPlayer().eclipseMirror ? 0.3f : 1f)) + (Main.player[npc.target].Center - npc.Center).Length() < Main.player[npc.target].GetCalamityPlayer().GetAbyssAggro(600f, 200f)) + { flag14 = true; } if ((!Main.player[npc.target].wet || Main.player[npc.target].dead) && flag14) diff --git a/NPCs/Astrageldon/Astrageldon.cs b/NPCs/Astrageldon/Astrageldon.cs index 6e3df437ba..0683a2365c 100644 --- a/NPCs/Astrageldon/Astrageldon.cs +++ b/NPCs/Astrageldon/Astrageldon.cs @@ -30,7 +30,8 @@ namespace CalamityMod.NPCs.Astrageldon npc.width = 400; npc.height = 280; npc.defense = 50; - npc.LifeMaxNERD(96000, NPC.downedMoonlord ? 440000 : 122000, 187000, 1400000, 1600000); + npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.LifeMaxNERD(96000, NPC.downedMoonlord ? 440000 : 122000, 187000, 1400000, 1600000); npc.aiStyle = -1; aiType = -1; npc.knockBackResist = 0f; diff --git a/NPCs/Astrageldon/AstrageldonSlime.cs b/NPCs/Astrageldon/AstrageldonSlime.cs index 75b550dd46..70ccf5066d 100644 --- a/NPCs/Astrageldon/AstrageldonSlime.cs +++ b/NPCs/Astrageldon/AstrageldonSlime.cs @@ -10,7 +10,8 @@ namespace CalamityMod.NPCs.Astrageldon { public class AstrageldonSlime : ModNPC { - private bool boostDR = false; + // TODO -- This value is never set, but is read and written by the network. Remove it? + private bool boostDR = false; public override void SetStaticDefaults() { @@ -26,6 +27,8 @@ namespace CalamityMod.NPCs.Astrageldon npc.width = 90; npc.height = 60; npc.alpha = 255; + npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = Main.expertMode ? 1007 : 1012; if (CalamityWorld.death || CalamityWorld.bossRushActive) { @@ -203,12 +206,6 @@ namespace CalamityMod.NPCs.Astrageldon } } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = (crit ? 2 : 1); - return false; - } - public override Color? GetAlpha(Color drawColor) { return new Color(200, 200, 200, npc.alpha); diff --git a/NPCs/AstralBiomeNPCs/Aries.cs b/NPCs/AstralBiomeNPCs/Aries.cs index 7ea17ccc36..640edf9b18 100644 --- a/NPCs/AstralBiomeNPCs/Aries.cs +++ b/NPCs/AstralBiomeNPCs/Aries.cs @@ -28,6 +28,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 54; npc.aiStyle = 41; npc.defense = 14; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 300; npc.knockBackResist = 0.6f; npc.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/AstralBiomeNPCs/AstralProbe.cs b/NPCs/AstralBiomeNPCs/AstralProbe.cs index b0d04d08ea..d7a9186b62 100644 --- a/NPCs/AstralBiomeNPCs/AstralProbe.cs +++ b/NPCs/AstralBiomeNPCs/AstralProbe.cs @@ -21,6 +21,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.width = 30; //324 npc.height = 30; //216 npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 50; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs index 5388ed493f..22f97f8a21 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaGround.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaGround.cs @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = 3; npc.damage = 55; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 500; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.38f; diff --git a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs index 477d26ae07..4a94b77840 100644 --- a/NPCs/AstralBiomeNPCs/AstralachneaWall.cs +++ b/NPCs/AstralBiomeNPCs/AstralachneaWall.cs @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = -1; npc.damage = 55; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 500; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0f; diff --git a/NPCs/AstralBiomeNPCs/Atlas.cs b/NPCs/AstralBiomeNPCs/Atlas.cs index b7b7a22897..e968ddd212 100644 --- a/NPCs/AstralBiomeNPCs/Atlas.cs +++ b/NPCs/AstralBiomeNPCs/Atlas.cs @@ -103,6 +103,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 88; npc.damage = 70; npc.defense = 40; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 1200; npc.knockBackResist = 0.08f; npc.value = Item.buyPrice(0, 1, 0, 0); diff --git a/NPCs/AstralBiomeNPCs/BigSightseer.cs b/NPCs/AstralBiomeNPCs/BigSightseer.cs index 4df8877244..46efa64d4c 100644 --- a/NPCs/AstralBiomeNPCs/BigSightseer.cs +++ b/NPCs/AstralBiomeNPCs/BigSightseer.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 56; npc.damage = 50; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 430; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/AstralBiomeNPCs/FusionFeeder.cs b/NPCs/AstralBiomeNPCs/FusionFeeder.cs index c53d496ab0..11ae6021e9 100644 --- a/NPCs/AstralBiomeNPCs/FusionFeeder.cs +++ b/NPCs/AstralBiomeNPCs/FusionFeeder.cs @@ -33,6 +33,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = 103; npc.lifeMax = 400; npc.defense = 12; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.value = Item.buyPrice(0, 0, 20, 0); npc.knockBackResist = 0.8f; npc.behindTiles = true; diff --git a/NPCs/AstralBiomeNPCs/Hadarian.cs b/NPCs/AstralBiomeNPCs/Hadarian.cs index 9038a2b654..1ef1836288 100644 --- a/NPCs/AstralBiomeNPCs/Hadarian.cs +++ b/NPCs/AstralBiomeNPCs/Hadarian.cs @@ -31,6 +31,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = -1; npc.damage = 50; npc.defense = 8; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 330; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0.75f; diff --git a/NPCs/AstralBiomeNPCs/Hive.cs b/NPCs/AstralBiomeNPCs/Hive.cs index c8f60641e4..3efc41c3e5 100644 --- a/NPCs/AstralBiomeNPCs/Hive.cs +++ b/NPCs/AstralBiomeNPCs/Hive.cs @@ -30,7 +30,8 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.aiStyle = -1; npc.damage = 55; npc.defense = 15; - npc.lifeMax = 470; + npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.lifeMax = 470; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/AstralBiomeNPCs/Mantis.cs b/NPCs/AstralBiomeNPCs/Mantis.cs index 155099d07e..12c90de84a 100644 --- a/NPCs/AstralBiomeNPCs/Mantis.cs +++ b/NPCs/AstralBiomeNPCs/Mantis.cs @@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 58; npc.aiStyle = -1; npc.defense = 6; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 340; npc.knockBackResist = 0.2f; npc.value = Item.buyPrice(0, 0, 15, 0); diff --git a/NPCs/AstralBiomeNPCs/Nova.cs b/NPCs/AstralBiomeNPCs/Nova.cs index 9cc302b65a..333b4eaf88 100644 --- a/NPCs/AstralBiomeNPCs/Nova.cs +++ b/NPCs/AstralBiomeNPCs/Nova.cs @@ -38,6 +38,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 50; npc.damage = 45; npc.defense = 15; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 230; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/AstralBiomeNPCs/SmallSightseer.cs b/NPCs/AstralBiomeNPCs/SmallSightseer.cs index 94edd2e28d..ebc1bfd5c7 100644 --- a/NPCs/AstralBiomeNPCs/SmallSightseer.cs +++ b/NPCs/AstralBiomeNPCs/SmallSightseer.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.height = 40; npc.damage = 38; npc.defense = 16; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 310; npc.DeathSound = mod.GetLegacySoundSlot(SoundType.NPCKilled, "Sounds/NPCKilled/AstralEnemyDeath"); npc.noGravity = true; diff --git a/NPCs/AstralBiomeNPCs/StellarCulex.cs b/NPCs/AstralBiomeNPCs/StellarCulex.cs index 094b20812c..3a8cf01279 100644 --- a/NPCs/AstralBiomeNPCs/StellarCulex.cs +++ b/NPCs/AstralBiomeNPCs/StellarCulex.cs @@ -32,6 +32,7 @@ namespace CalamityMod.NPCs.AstralBiomeNPCs npc.npcSlots = 0.5f; //needed? npc.damage = 55; npc.defense = 18; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.knockBackResist = 0.65f; npc.lifeMax = 210; npc.value = Item.buyPrice(0, 0, 10, 0); diff --git a/NPCs/AstralBiomeNPCs/Twinkler.cs b/NPCs/AstralBiomeNPCs/Twinkler.cs new file mode 100644 index 0000000000..cfaa0bf5ff --- /dev/null +++ b/NPCs/AstralBiomeNPCs/Twinkler.cs @@ -0,0 +1,114 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.World; +using CalamityMod.CalPlayer; +using MonoMod.Cil; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.NPCs.AstralBiomeNPCs +{ + public class Twinkler : ModNPC + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Twinkler"); + Main.npcFrameCount[npc.type] = 8; + Main.npcCatchable[npc.type] = true; + } + + public override void SetDefaults() + { + npc.CloneDefaults(NPCID.LightningBug); //ID is 358 + npc.width = 7; + npc.height = 5; + aiType = NPCID.LightningBug; + animationType = NPCID.LightningBug; + npc.catchItem = (short)mod.ItemType("TwinklerItem"); + npc.friendly = true; // We have to add this and CanBeHitByItem/CanBeHitByProjectile because of reasons. + //banner = npc.type; + //bannerItem = mod.ItemType("TwinklerBanner"); + } + + + public override bool? CanBeHitByItem(Player player, Item item) { + return true; + } + + public override bool? CanBeHitByProjectile(Projectile projectile) { + return true; + } + + public override void HitEffect(int hitDirection, double damage) { + if (npc.life <= 0) { + for (int i = 0; i < 6; i++) { + int dust = Dust.NewDust(npc.position, npc.width, npc.height, mod.DustType("AstralOrange"), 2 * hitDirection, -2f); + if (Main.rand.NextBool(2)) { + Main.dust[dust].noGravity = true; + Main.dust[dust].scale = 1.2f * npc.scale; + } + else { + Main.dust[dust].scale = 0.7f * npc.scale; + } + } + } + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.player.GetModPlayer().ZoneAstral && !spawnInfo.player.ZoneRockLayerHeight) + { + return SpawnCondition.TownCritter.Chance; + } + return 0f; + } + + public virtual void OnCatchNPC(Player player, Item item) + { + try + { + var npcCenter = npc.Center.ToTileCoordinates(); + if (!WorldGen.SolidTile(npcCenter.X, npcCenter.Y) && Main.tile[npcCenter.X, npcCenter.Y].liquid == 0) + { + Main.tile[npcCenter.X, npcCenter.Y].liquid = (byte)Main.rand.Next(50, 150); + Main.tile[npcCenter.X, npcCenter.Y].lava(true); + Main.tile[npcCenter.X, npcCenter.Y].honey(false); + WorldGen.SquareTileFrame(npcCenter.X, npcCenter.Y, true); + } + } + catch + { + return; + } + } + } + + internal class TwinklerItem : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Twinkler"); + } + + public override void SetDefaults() + { + item.useStyle = 1; + item.autoReuse = true; + item.useTurn = true; + item.useAnimation = 15; + item.useTime = 10; + item.maxStack = 999; + item.consumable = true; + item.noUseGraphic = true; + item.value = Item.buyPrice(0, 0, 40, 0); + //item.CloneDefaults(2004); //Lightning Bug item + item.width = 26; + item.height = 24; + item.bait = 40; + item.makeNPC = (short)mod.NPCType("Twinkler"); + } + } +} diff --git a/NPCs/AstralBiomeNPCs/Twinkler.png b/NPCs/AstralBiomeNPCs/Twinkler.png new file mode 100644 index 0000000000..dfb376ea93 Binary files /dev/null and b/NPCs/AstralBiomeNPCs/Twinkler.png differ diff --git a/NPCs/AstralBiomeNPCs/TwinklerItem.png b/NPCs/AstralBiomeNPCs/TwinklerItem.png new file mode 100644 index 0000000000..2ff16f3b9a Binary files /dev/null and b/NPCs/AstralBiomeNPCs/TwinklerItem.png differ diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index 5d7f093028..0398a864c1 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -25,6 +25,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 38; npc.height = 44; npc.defense = 40; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.LifeMaxNERD(12000, 18000, 29100, 360000, 420000); double HPBoost = Config.BossHealthPercentageBoost * 0.01; npc.lifeMax += (int)(npc.lifeMax * HPBoost); diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index 36ca027a11..2b33c2f4b5 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -34,6 +34,7 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 56; npc.height = 56; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; if (CalamityWorld.death) { diff --git a/NPCs/AstrumDeus/AstrumDeusProbe3.cs b/NPCs/AstrumDeus/AstrumDeusProbe3.cs index c1c25be03d..e8b7d3dd55 100644 --- a/NPCs/AstrumDeus/AstrumDeusProbe3.cs +++ b/NPCs/AstrumDeus/AstrumDeusProbe3.cs @@ -23,7 +23,8 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 30; npc.height = 30; npc.defense = 30; - npc.lifeMax = 1400; + npc.GetCalamityNPC().RevPlusDR(0.2f); + npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) { npc.lifeMax = 120000; diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index b864a6d6ca..8124ebbb89 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -21,7 +21,8 @@ namespace CalamityMod.NPCs.AstrumDeus npc.width = 52; npc.height = 68; npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; + npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.lifeMax = CalamityWorld.revenge ? 18000 : 12000; if (CalamityWorld.death) { npc.lifeMax = 29100; diff --git a/NPCs/BrimstoneWaifu/Brimling.cs b/NPCs/BrimstoneWaifu/Brimling.cs index 91dc485ad9..e90e33c1da 100644 --- a/NPCs/BrimstoneWaifu/Brimling.cs +++ b/NPCs/BrimstoneWaifu/Brimling.cs @@ -11,6 +11,8 @@ namespace CalamityMod.NPCs.BrimstoneWaifu public class Brimling : ModNPC { private bool boostDR = false; + public static float normalDR = 0.2f; + public static float boostedDR = 0.8f; public override void SetStaticDefaults() { @@ -25,6 +27,8 @@ namespace CalamityMod.NPCs.BrimstoneWaifu npc.damage = 0; npc.width = 60; npc.height = 60; + npc.defense = 0; + npc.GetCalamityNPC().DR = normalDR; npc.lifeMax = 4000; if (CalamityWorld.death) { @@ -97,6 +101,10 @@ namespace CalamityMod.NPCs.BrimstoneWaifu boostDR = false; npc.chaseable = true; } + + // Set DR based on boost status + npc.GetCalamityNPC().DR = boostDR ? boostedDR : normalDR; + float num1446 = goIntoShell ? 1f : (CalamityWorld.bossRushActive ? 12f : 6f); int num1447 = 480; float num244; @@ -226,17 +234,6 @@ namespace CalamityMod.NPCs.BrimstoneWaifu } } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - double multiplier = 0.8; - if (boostDR) - { - multiplier = 0.2; - } - damage = (int)((double)damage * multiplier); - return true; - } - public override void FindFrame(int frameHeight) { npc.frameCounter += 1.0; diff --git a/NPCs/Calamitas/Calamitas.cs b/NPCs/Calamitas/Calamitas.cs index 9c71bf0508..d182eeb36c 100644 --- a/NPCs/Calamitas/Calamitas.cs +++ b/NPCs/Calamitas/Calamitas.cs @@ -25,6 +25,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 15; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.value = 0f; npc.lifeMax = CalamityWorld.revenge ? 51750 : 37500; if (CalamityWorld.death) diff --git a/NPCs/Calamitas/CalamitasRun.cs b/NPCs/Calamitas/CalamitasRun.cs index 5a26905d84..7ab90d5855 100644 --- a/NPCs/Calamitas/CalamitasRun.cs +++ b/NPCs/Calamitas/CalamitasRun.cs @@ -27,6 +27,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = CalamityWorld.revenge ? 13200 : 9000; if (CalamityWorld.death) { diff --git a/NPCs/Calamitas/CalamitasRun2.cs b/NPCs/Calamitas/CalamitasRun2.cs index 0abb8fe602..5a62afc0a0 100644 --- a/NPCs/Calamitas/CalamitasRun2.cs +++ b/NPCs/Calamitas/CalamitasRun2.cs @@ -27,6 +27,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = CalamityWorld.revenge ? 11025 : 7500; if (CalamityWorld.death) { diff --git a/NPCs/Calamitas/CalamitasRun3.cs b/NPCs/Calamitas/CalamitasRun3.cs index 3c5857bcec..9fc5cbf413 100644 --- a/NPCs/Calamitas/CalamitasRun3.cs +++ b/NPCs/Calamitas/CalamitasRun3.cs @@ -31,6 +31,7 @@ namespace CalamityMod.NPCs.Calamitas npc.width = 120; npc.height = 120; npc.defense = 25; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = CalamityWorld.revenge ? 38812 : 28125; if (CalamityWorld.death) { diff --git a/NPCs/Calamitas/SoulSeeker.cs b/NPCs/Calamitas/SoulSeeker.cs index 2f6598eac5..dfa821ad16 100644 --- a/NPCs/Calamitas/SoulSeeker.cs +++ b/NPCs/Calamitas/SoulSeeker.cs @@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.Calamitas npc.canGhostHeal = false; npc.damage = 40; npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 2500; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/CalamityBiomeNPCs/DespairStone.cs b/NPCs/CalamityBiomeNPCs/DespairStone.cs index ff0f3d6ee8..00219530bf 100644 --- a/NPCs/CalamityBiomeNPCs/DespairStone.cs +++ b/NPCs/CalamityBiomeNPCs/DespairStone.cs @@ -23,7 +23,8 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs npc.width = 72; //324 npc.height = 72; //216 npc.defense = 38; - npc.lifeMax = 120; + npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.lifeMax = 120; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 5, 0); npc.HitSound = SoundID.NPCHit41; diff --git a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs index 466dccd27d..2b964ec2e6 100644 --- a/NPCs/CalamityBiomeNPCs/SoulSlurper.cs +++ b/NPCs/CalamityBiomeNPCs/SoulSlurper.cs @@ -24,6 +24,7 @@ namespace CalamityMod.NPCs.CalamityBiomeNPCs npc.width = 60; //324 npc.height = 40; //216 npc.defense = 40; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 60; npc.knockBackResist = 0.65f; npc.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 3da4111e2a..7245d7ff0b 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1,3 +1,5 @@ +using CalamityMod.Buffs.DoTDebuffs; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer; using CalamityMod.Projectiles; using CalamityMod.Utilities; @@ -16,10 +18,21 @@ namespace CalamityMod.NPCs { public class CalamityGlobalNPC : GlobalNPC { - #region Variables - // Damage reduction - private float protection = 0f; - private float defProtection = 0f; + #region Variables + public float DR { get; set; } = 0f; + + /// + /// If this is set to true, the NPC's DR cannot be reduced via any means. This applies regardless of whether customDR is true or false. + /// + public bool unbreakableDR = false; + + /// + /// Overrides the normal DR math and uses custom DR reductions for each debuff, registered separately.

+ /// Used primarily by post-Moon Lord bosses. + ///
+ public bool customDR = false; + public Dictionary flatDRReductions = new Dictionary(); + public Dictionary multDRReductions = new Dictionary(); // Iron Heart private int ironHeartDamage = 0; @@ -99,7 +112,7 @@ namespace CalamityMod.NPCs public static int SCalWorm = -1; // Collections - public SortedDictionary BossRushHPChanges = new SortedDictionary + public static SortedDictionary BossRushHPChanges = new SortedDictionary { // Tier 1 { NPCID.QueenBee, 420000 }, @@ -161,10 +174,10 @@ namespace CalamityMod.NPCs { NPCID.MoonLordCore, 1400000 }, { NPCID.MoonLordHand, 450000 }, { NPCID.MoonLordHead, 600000 }, - { NPCID.MoonLordLeechBlob, 8000 } + { NPCID.MoonLordFreeEye, 1000 } }; - public SortedDictionary BossValues = new SortedDictionary + public static SortedDictionary BossValues = new SortedDictionary { { NPCID.QueenBee, Item.buyPrice(0, 5)}, { NPCID.SkeletronHead, Item.buyPrice(0, 7) }, @@ -422,31 +435,26 @@ namespace CalamityMod.NPCs } } - if (eFreeze && !CalamityWorld.bossRushActive) + // Exo Freeze, Glacial State and Temporal Sadness don't work on bosses or other specific enemies. + if (!npc.boss && !CalamityMod.movementImpairImmuneList.Contains(npc.type)) { - npc.velocity.X = 0f; - npc.velocity.Y += 0.1f; - - if (npc.velocity.Y > 15f) + if (eFreeze && !CalamityWorld.bossRushActive) { - npc.velocity.Y = 15f; + npc.velocity.X = 0f; + npc.velocity.Y += 0.1f; + if (npc.velocity.Y > 15f) + npc.velocity.Y = 15f; } - } - - if (tSad) - { - npc.velocity.Y /= 2; - npc.velocity.X /= 2; - } - - if (gState) - { - npc.velocity.X = 0f; - npc.velocity.Y += 0.05f; - - if (npc.velocity.Y > 15f) + else if (gState) { - npc.velocity.Y = 15f; + npc.velocity.X = 0f; + npc.velocity.Y += 0.05f; + if (npc.velocity.Y > 15f) + npc.velocity.Y = 15f; + } + if (tSad) + { + npc.velocity /= 2f; } } @@ -461,7 +469,7 @@ namespace CalamityMod.NPCs ApplyDPSDebuff(nightwither, 200, 40, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(dFlames, 2500, 500, ref npc.lifeRegen, ref damage); ApplyDPSDebuff(bBlood, 50, 10, ref npc.lifeRegen, ref damage); - } + } public void ApplyDPSDebuff(bool debuff, int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) { @@ -490,6 +498,14 @@ namespace CalamityMod.NPCs newAI[m] = 0f; } + // Apply DR to vanilla NPCs. No vanilla NPCs have DR except in Rev+. + // This also applies DR to other mods' NPCs who have set up their NPCs to have DR in Rev+. + if (CalamityWorld.revenge) + { + CalamityMod.DRValues.TryGetValue(npc.type, out float revDR); + DR = revDR; + } + if (npc.boss && CalamityWorld.revenge) { if (npc.type != mod.NPCType("HiveMindP2") && npc.type != mod.NPCType("Leviathan") && npc.type != mod.NPCType("StormWeaverHeadNaked") && @@ -564,11 +580,6 @@ namespace CalamityMod.NPCs { IronHeartChanges(npc); } - - if (protection > 0f) - { - defProtection = protection; - } } #endregion @@ -658,7 +669,11 @@ namespace CalamityMod.NPCs { npc.value = (int)(npc.value * 1.5); - if (npc.type == NPCID.Mothron) + if (npc.type == NPCID.MoonLordFreeEye) + { + npc.lifeMax = (int)(npc.lifeMax * 150.0); + } + else if (npc.type == NPCID.Mothron) { npc.scale = 1.25f; } @@ -667,7 +682,7 @@ namespace CalamityMod.NPCs npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 2.4) : (int)(npc.lifeMax * 1.9); npc.npcSlots = 12f; } - else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead || npc.type == NPCID.MoonLordLeechBlob) + else if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) { npc.lifeMax = CalamityWorld.death ? (int)(npc.lifeMax * 1.4) : (int)(npc.lifeMax * 1.2); npc.npcSlots = 12f; @@ -814,257 +829,18 @@ namespace CalamityMod.NPCs { npc.canGhostHeal = false; } - - RevengeanceDamageReduction(npc, mod); } - #endregion - #region Revengeance Damage Reduction - private void RevengeanceDamageReduction(NPC npc, Mod mod) - { - if (Config.RevengeanceAndDeathThoriumBossBuff) - { - Mod thorium = ModLoader.GetMod("ThoriumMod"); - if (thorium != null) - { - if (npc.type == thorium.NPCType("Viscount") || npc.type == thorium.NPCType("BoreanStrider") || npc.type == thorium.NPCType("FallenDeathBeholder") || - npc.type == thorium.NPCType("Lich") || npc.type == thorium.NPCType("AbyssionReleased")) - { - protection = 0.05f; - } - else if (npc.type == thorium.NPCType("CryoCore") || npc.type == thorium.NPCType("BioCore") || npc.type == thorium.NPCType("PyroCore") || - npc.type == thorium.NPCType("Aquaius")) - { - protection = 0.1f; - } - else if (npc.type == thorium.NPCType("ThePrimeScouter") || npc.type == thorium.NPCType("FallenDeathBeholder2") || npc.type == thorium.NPCType("SlagFury") || - npc.type == thorium.NPCType("Aquaius2") || npc.type == thorium.NPCType("GraniteEnergyStorm")) - { - protection = 0.2f; - } - else if (npc.type == thorium.NPCType("TheBuriedWarrior") || npc.type == thorium.NPCType("TheBuriedWarrior1") || npc.type == thorium.NPCType("TheBuriedWarrior2") || - npc.type == thorium.NPCType("LichHeadless") || npc.type == thorium.NPCType("AbyssionCracked")) - { - protection = 0.25f; - } - else if (npc.type == thorium.NPCType("Omnicide")) - { - protection = 0.3f; - } - else if (npc.type == thorium.NPCType("Abyssion")) - { - protection = 0.35f; - } - } - } - - if (npc.type == mod.NPCType("Cnidrion") || npc.type == mod.NPCType("DesertScourgeBody") || npc.type == mod.NPCType("ColossalSquid") || - npc.type == mod.NPCType("Siren") || npc.type == mod.NPCType("ThiccWaifu") || npc.type == mod.NPCType("ProfanedGuardianBoss3") || - npc.type == mod.NPCType("ScornEater") || npc.type == mod.NPCType("AquaticScourgeBody") || npc.type == mod.NPCType("AquaticScourgeBodyAlt") || - npc.type == mod.NPCType("Mauler") || npc.type == mod.NPCType("EutrophicRay")) - { - protection = 0.05f; - } - else if (npc.type == mod.NPCType("AstrumDeusBody") || npc.type == mod.NPCType("SoulSeeker") || npc.type == mod.NPCType("DesertScourgeTail") || - npc.type == mod.NPCType("Horse") || npc.type == mod.NPCType("ProfanedEnergyBody") || npc.type == mod.NPCType("ScavengerClawLeft") || - npc.type == mod.NPCType("ScavengerClawRight") || npc.type == mod.NPCType("ScavengerHead") || npc.type == mod.NPCType("MantisShrimp") || - npc.type == mod.NPCType("PhantomDebris") || npc.type == mod.NPCType("AstrumDeusHead") || npc.type == mod.NPCType("AquaticScourgeHead") || - npc.type == mod.NPCType("Cryon") || npc.type == mod.NPCType("Cryogen")) - { - protection = 0.1f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerHead") || npc.type == mod.NPCType("AstralProbe") || npc.type == mod.NPCType("Calamitas") || - npc.type == mod.NPCType("CalamitasRun") || npc.type == mod.NPCType("CalamitasRun2") || npc.type == mod.NPCType("CalamitasRun3") || - npc.type == mod.NPCType("SoulSlurper") || npc.type == mod.NPCType("ProvSpawnHealer") || npc.type == mod.NPCType("Gnasher") || - npc.type == mod.NPCType("ScavengerLegLeft") || npc.type == mod.NPCType("ScavengerLegRight") || npc.type == mod.NPCType("ShockstormShuttle") || - npc.type == mod.NPCType("Reaper") || npc.type == mod.NPCType("OverloadedSoldier") || npc.type == mod.NPCType("AquaticScourgeTail") || - npc.type == mod.NPCType("EidolonWyrmHead") || npc.type == mod.NPCType("Aries") || npc.type == mod.NPCType("AstralachneaGround") || - npc.type == mod.NPCType("AstralachneaWall") || npc.type == mod.NPCType("Astrageldon") || npc.type == mod.NPCType("Atlas") || - npc.type == mod.NPCType("BigSightseer") || npc.type == mod.NPCType("FusionFeeder") || npc.type == mod.NPCType("Hadarian") || - npc.type == mod.NPCType("Hive") || npc.type == mod.NPCType("Mantis") || npc.type == mod.NPCType("Nova") || npc.type == mod.NPCType("SmallSightseer") || - npc.type == mod.NPCType("StellarCulex")) - { - protection = 0.15f; - } - else if (npc.type == mod.NPCType("AstrumDeusProbe3") || npc.type == mod.NPCType("PlaguebringerShade") || npc.type == mod.NPCType("BlindedAngler")) - { - protection = 0.2f; - } - else if (npc.type == mod.NPCType("PlaguebringerGoliath") || npc.type == mod.NPCType("ProfanedGuardianBoss2") || npc.type == mod.NPCType("SandTortoise") || - npc.type == mod.NPCType("StasisProbe") || npc.type == mod.NPCType("BobbitWormHead") || npc.type == mod.NPCType("GreatSandShark") || - npc.type == mod.NPCType("Clam") || npc.type == mod.NPCType("PrismTurtle")) - { - protection = 0.25f; - } - else if (npc.type == mod.NPCType("ProvSpawnOffense") || npc.type == mod.NPCType("GiantClam")) - { - protection = 0.3f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerBody") || npc.type == mod.NPCType("AstrumDeusTail") || npc.type == mod.NPCType("DespairStone") || - npc.type == mod.NPCType("SoulSeekerSupreme") || npc.type == mod.NPCType("Leviathan")) - { - protection = 0.35f; - } - else if (npc.type == mod.NPCType("CryogenIce") || npc.type == mod.NPCType("ProfanedGuardianBoss") || npc.type == mod.NPCType("ProvSpawnDefense") || - npc.type == mod.NPCType("ScavengerBody")) - { - protection = 0.4f; - } - else if (npc.type == mod.NPCType("ArmoredDiggerTail")) - { - protection = 0.45f; - } - else if (npc.type == mod.NPCType("SirenIce")) - { - protection = 0.5f; - } - else - { - switch (npc.type) - { - case NPCID.SkeletronHand: - case NPCID.SkeletronHead: - case NPCID.QueenBee: - case NPCID.HeadlessHorseman: - case NPCID.FlyingAntlion: - case NPCID.PirateCaptain: - case NPCID.MoonLordHead: - case NPCID.MoonLordHand: - case NPCID.MoonLordCore: - case NPCID.CultistBoss: - case NPCID.Crab: - case NPCID.SeaSnail: - protection = 0.05f; - break; - - case NPCID.Antlion: - case NPCID.TheHungry: - case NPCID.TheDestroyer: - case NPCID.UndeadViking: - case NPCID.MourningWood: - case NPCID.Everscream: - case NPCID.GreekSkeleton: - case NPCID.GraniteFlyer: - case NPCID.WalkingAntlion: - case NPCID.Pumpking: - case NPCID.IceQueen: - case NPCID.IceGolem: - case NPCID.AnomuraFungus: - case NPCID.SkeletonArcher: - case NPCID.SandElemental: - case NPCID.Arapaima: - case NPCID.ArmoredViking: - case NPCID.DD2Betsy: - case NPCID.DD2OgreT2: - protection = 0.1f; - break; - - case NPCID.ElfCopter: - case NPCID.GraniteGolem: - case NPCID.ArmoredSkeleton: - case NPCID.PirateShipCannon: - case NPCID.DD2OgreT3: - protection = 0.15f; - break; - - case NPCID.Retinazer: - case NPCID.Spazmatism: - case NPCID.PrimeCannon: - case NPCID.PrimeLaser: - case NPCID.TheDestroyerBody: - case NPCID.RustyArmoredBonesAxe: - case NPCID.RustyArmoredBonesFlail: - case NPCID.RustyArmoredBonesSword: - case NPCID.RustyArmoredBonesSwordNoArmor: - case NPCID.BlueArmoredBones: - case NPCID.BlueArmoredBonesMace: - case NPCID.BlueArmoredBonesNoPants: - case NPCID.BlueArmoredBonesSword: - case NPCID.HellArmoredBones: - case NPCID.HellArmoredBonesSpikeShield: - case NPCID.HellArmoredBonesMace: - case NPCID.HellArmoredBonesSword: - case NPCID.RaggedCaster: - case NPCID.RaggedCasterOpenCoat: - case NPCID.Necromancer: - case NPCID.NecromancerArmored: - case NPCID.DiabolistRed: - case NPCID.DiabolistWhite: - case NPCID.BoneLee: - case NPCID.DungeonSpirit: - case NPCID.GiantCursedSkull: - case NPCID.SkeletonSniper: - case NPCID.TacticalSkeleton: - case NPCID.SkeletonCommando: - case NPCID.AngryBonesBig: - case NPCID.AngryBonesBigMuscle: - case NPCID.AngryBonesBigHelmet: - case NPCID.MartianSaucerTurret: - case NPCID.MartianSaucerCannon: - case NPCID.MartianTurret: - case NPCID.MartianDrone: - case NPCID.MartianSaucer: - case NPCID.MartianSaucerCore: - case NPCID.Crawdad: - case NPCID.Crawdad2: - case NPCID.GiantShelly: - case NPCID.GiantShelly2: - case NPCID.Mothron: - protection = 0.2f; - break; - - case NPCID.PrimeSaw: - case NPCID.PrimeVice: - case NPCID.SkeletronPrime: - case NPCID.Probe: - case NPCID.PossessedArmor: - case NPCID.Golem: - case NPCID.GolemFistLeft: - case NPCID.GolemFistRight: - case NPCID.GolemHead: - case NPCID.GolemHeadFree: - protection = 0.25f; - break; - - case NPCID.Mimic: - case NPCID.PresentMimic: - case NPCID.BigMimicCorruption: - case NPCID.BigMimicCrimson: - case NPCID.BigMimicHallow: - case NPCID.BigMimicJungle: - protection = 0.3f; - break; - - case NPCID.GiantTortoise: - case NPCID.IceTortoise: - case NPCID.SantaNK1: - case NPCID.MartianWalker: - case NPCID.TheDestroyerTail: - protection = 0.35f; - break; - - case NPCID.DeadlySphere: - protection = 0.4f; - break; - - case NPCID.Paladin: - protection = 0.45f; - break; - - case NPCID.WallofFlesh: - case NPCID.MothronEgg: - protection = 0.5f; - break; - - case NPCID.DungeonGuardian: - protection = 0.999999f; - break; - - default: - break; - } - } - } + /// + /// Sets the DR of this NPC only if Revengeance Mode is enabled. Otherwise sets DR to zero. + /// + /// The DR to set, assuming Rev+ difficulty. + /// Whether Revengeance Mode is currently enabled. + public bool RevPlusDR(float dr) + { + DR = CalamityWorld.revenge ? dr : 0f; + return CalamityWorld.revenge; + } #endregion #region Other Stat Changes @@ -1346,123 +1122,160 @@ namespace CalamityMod.NPCs #region Strike NPC public override bool StrikeNPC(NPC npc, ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) + // TODO -- move this to Destroyer's Rev+ AI; either set his DR or modify npc.takenDamageMultiplier + if (npc.type == NPCID.TheDestroyer || npc.type == NPCID.TheDestroyerBody || npc.type == NPCID.TheDestroyerTail) { if ((newAI[1] < 480f || newAI[2] > 0f) && (CalamityWorld.revenge || CalamityWorld.bossRushActive)) { damage *= 0.01; } } - else if (npc.type == mod.NPCType("SCalWormBody") || npc.type == mod.NPCType("SCalWormHead") || npc.type == mod.NPCType("SCalWormBodyWeak") || npc.type == mod.NPCType("SCalWormTail") || npc.type == mod.NPCType("EidolonWyrmHeadHuge")) - { - damage *= 0.000001; - } - double yellowCandleDamageBoost = damage * 0.05; // Get value before DR + // Yellow Candle provides +5% damage which ignores both DR and defense. + // However, armor penetration bonus damage has already been applied, so it's slightly higher than it should be. + double yellowCandleDamage = 0.05 * damage; - int newDefense = npc.defense - - (pFlames ? 4 : 0) - - (wDeath ? 50 : 0) - - (gsInferno ? 20 : 0) - - (astralInfection ? 8 : 0) - - (aFlames ? 10 : 0) - - (wCleave ? 15 : 0); + // Apply modifications to enemy's current defense based on Calamity debuffs. + // As with defense and DR, flat reductions apply first, then multiplicative reductions. + int effectiveDefense = npc.defense - + (pFlames ? Plague.DefenseReduction : 0) - + (wDeath ? WhisperingDeath.DefenseReduction : 0) - + (gsInferno ? GodSlayerInferno.DefenseReduction : 0) - + (astralInfection ? AstralInfectionDebuff.DefenseReduction : 0) - + (aFlames ? AbyssalFlames.DefenseReduction : 0) - + (wCleave ? WarCleave.DefenseReduction : 0); if (gState) - { - newDefense /= 2; - } - + effectiveDefense /= 2; if (aCrunch) - { - newDefense /= 3; - } + effectiveDefense /= 3; - if (newDefense < 0) - { - newDefense = 0; - } + // Defense can never be negative and has a minimum value of zero. + if (effectiveDefense < 0) + effectiveDefense = 0; - defense = newDefense; + // Apply vanilla-style defense before DR, using Calamity's reduced defense. + damage = Main.CalculateDamage((int)damage, effectiveDefense); - if (protection > 0f) - { - double newDamage = damage + (defense * 0.25); //defense damage boost 150 * .25 = 45 + 150 = 195 damage 180 defense + // DR applies after vanilla defense. + damage = ApplyDR(npc, damage); - if (marked) - { - protection *= 0.5f; - } + // Add Yellow Candle damage if the NPC isn't supposed to be "near invincible" + if (yellowCandle && DR < 0.99f && npc.takenDamageMultiplier > 0.05f) + damage += yellowCandleDamage; - if (npc.betsysCurse) - { - protection *= 0.66f; - } - - if (wCleave) - { - protection *= 0.75f; - } - - if (npc.ichor) - { - protection *= 0.75f; - } - else if (npc.onFire2) - { - protection *= 0.8f; - } - - if (protection < 0f) - { - protection = 0f; - } - - if (newDamage >= 1.0) - { - newDamage = (1f - protection) * newDamage; //DR calc 195 * 0.4 = 78 damage 0.6 DR - - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - - damage = newDamage; - protection = defProtection; - } - - if (protection < 0.99f) - { - if (yellowCandle) - { - damage += yellowCandleDamageBoost; - } - } - - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) - { - if (npc.life - (int)damage <= 0) - { - if (newAI[0] != 1f) - { - newAI[0] = 1f; - npc.life = npc.lifeMax; - npc.netUpdate = true; - npc.dontTakeDamage = true; - } - } - } - } - - return true; //vanilla defense calc 78 - (180 / 2 = 90) = 0, boosted to 1 by calc + // Cancel out vanilla defense math by reversing the calculation vanilla is about to perform. + // While roundabout, this is safer than returning false to stop vanilla damage calculations entirely. + // Other mods will probably expect the vanilla code to run and may compensate for it themselves. + damage = Main.CalculateDamage((int)damage, -defense); + return true; } - #endregion - #region Boss Head Slot - public override void BossHeadSlot(NPC npc, ref int index) + /// + /// Modifies damage incoming to an NPC based on their DR (damage reduction) stat added by Calamity.

+ /// This is entirely separate from vanilla's takenDamageMultiplier. + ///
+ /// Incoming damage. Has been modified by Main.DamageVar and boosted by armor penetration, but nothing else. + /// + private double ApplyDR(NPC npc, double damage) + { + if (DR <= 0f || damage <= 1.0) + return damage; + + // If the NPC currently has unbreakable DR, it cannot be reduced by any means. + // If custom DR is enabled, use that instead of normal DR. + float effectiveDR = unbreakableDR ? DR : (customDR ? CustomDRMath(npc, DR) : DefaultDRMath(npc, DR)); + + // DR floor is 0%. Nothing can have negative DR. + if (effectiveDR <= 0f) + effectiveDR = 0f; + + double newDamage = (1f - effectiveDR) * damage; + return newDamage < 1.0 ? 1.0 : newDamage; + } + + private float DefaultDRMath(NPC npc, float DR) + { + float calcDR = DR; + if (marked) + calcDR *= 0.5f; + if (npc.betsysCurse) + calcDR *= 0.66f; + if (wCleave) + calcDR *= 0.75f; + + // Ichor supersedes Cursed Inferno if both are applied. + if (npc.ichor) + calcDR *= 0.75f; + else if (npc.onFire2) + calcDR *= 0.8f; + + return calcDR; + } + + private float CustomDRMath(NPC npc, float DR) + { + void FlatEditDR(ref float theDR, bool npcHasDebuff, int buffID) + { + if (npcHasDebuff && flatDRReductions.TryGetValue(buffID, out float reduction)) + theDR -= reduction; + } + void MultEditDR(ref float theDR, bool npcHasDebuff, int buffID) + { + if (npcHasDebuff && multDRReductions.TryGetValue(buffID, out float multiplier)) + theDR *= multiplier; + } + + float calcDR = DR; + + // Apply flat reductions first. All vanilla debuffs check their internal booleans. + FlatEditDR(ref calcDR, npc.poisoned, BuffID.Poisoned); + FlatEditDR(ref calcDR, npc.onFire, BuffID.OnFire); + FlatEditDR(ref calcDR, npc.venom, BuffID.Venom); + FlatEditDR(ref calcDR, npc.onFrostBurn, BuffID.Frostburn); + FlatEditDR(ref calcDR, npc.shadowFlame, BuffID.ShadowFlame); + FlatEditDR(ref calcDR, npc.daybreak, BuffID.Daybreak); + FlatEditDR(ref calcDR, npc.betsysCurse, BuffID.BetsysCurse); + + // Ichor supersedes Cursed Inferno if both are applied. + FlatEditDR(ref calcDR, npc.ichor, BuffID.Ichor); + FlatEditDR(ref calcDR, npc.onFire2 && !npc.ichor, BuffID.CursedInferno); + + // Modded debuffs are handled modularly and use HasBuff. + foreach (KeyValuePair entry in flatDRReductions) + { + int buffID = entry.Key; + if (buffID >= BuffID.Count && npc.HasBuff(buffID)) + calcDR -= entry.Value; + } + + // Apply multiplicative reductions second. All vanilla debuffs check their internal booleans. + MultEditDR(ref calcDR, npc.poisoned, BuffID.Poisoned); + MultEditDR(ref calcDR, npc.onFire, BuffID.OnFire); + MultEditDR(ref calcDR, npc.venom, BuffID.Venom); + MultEditDR(ref calcDR, npc.onFrostBurn, BuffID.Frostburn); + MultEditDR(ref calcDR, npc.shadowFlame, BuffID.ShadowFlame); + MultEditDR(ref calcDR, npc.daybreak, BuffID.Daybreak); + MultEditDR(ref calcDR, npc.betsysCurse, BuffID.BetsysCurse); + + // Ichor supersedes Cursed Inferno if both are applied. + MultEditDR(ref calcDR, npc.ichor, BuffID.Ichor); + MultEditDR(ref calcDR, npc.onFire2 && !npc.ichor, BuffID.CursedInferno); + + // Modded debuffs are handled modularly and use HasBuff. + foreach (KeyValuePair entry in multDRReductions) + { + int buffID = entry.Key; + if (buffID >= BuffID.Count && npc.HasBuff(buffID)) + calcDR *= entry.Value; + } + + return calcDR; + } + #endregion + + #region Boss Head Slot + public override void BossHeadSlot(NPC npc, ref int index) { if (CalamityWorld.revenge) { @@ -1513,15 +1326,6 @@ namespace CalamityMod.NPCs } } - if (CalamityWorld.revenge || CalamityWorld.bossRushActive) - { - if (npc.type == NPCID.MoonLordFreeEye) - { - npc.active = false; - npc.netUpdate = true; - } - } - if (CalamityWorld.bossRushActive && !npc.friendly && !npc.townNPC) { BossRushForceDespawnOtherNPCs(npc, mod); @@ -1636,12 +1440,6 @@ namespace CalamityMod.NPCs case NPCID.AncientDoom: return CalamityGlobalAI.BuffedAncientDoomAI(npc, mod); - case NPCID.MoonLordCore: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: - case NPCID.MoonLordLeechBlob: - return CalamityGlobalAI.BuffedMoonLordAI(npc, enraged, mod); - default: break; } @@ -2047,7 +1845,7 @@ namespace CalamityMod.NPCs case 28: if (npc.type != NPCID.MoonLordCore && npc.type != NPCID.MoonLordHead && npc.type != NPCID.MoonLordHand && - npc.type != NPCID.MoonLordLeechBlob) + npc.type != NPCID.MoonLordFreeEye && npc.type != mod.NPCType("Eidolist")) { npc.active = false; npc.netUpdate = true; @@ -2192,6 +1990,19 @@ namespace CalamityMod.NPCs switch (npc.type) { + case NPCID.MoonLordFreeEye: + CalamityGlobalAI.RevengeanceMoonLordFreeEyeAI(npc); + break; + + case NPCID.MoonLordCore: + CalamityGlobalAI.RevengeanceMoonLordCoreAI(npc); + break; + + case NPCID.MoonLordHand: + case NPCID.MoonLordHead: + CalamityGlobalAI.RevengeanceMoonLordHandAI(npc, mod); + break; + case NPCID.DungeonGuardian: CalamityGlobalAI.RevengeanceDungeonGuardianAI(npc, configBossRushBoost, enraged); break; @@ -2214,24 +2025,19 @@ namespace CalamityMod.NPCs #region Post AI public override void PostAI(NPC npc) { - if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses) - { - npc.velocity.X *= 0.95f; - npc.velocity.Y *= 0.95f; - } + // Bosses and any specific other NPCs are completely immune to having their movement impaired. + if (npc.boss || CalamityMod.movementImpairImmuneList.Contains(npc.type)) + return; - if (!CalamityWorld.bossRushActive) + if (pearlAura && !CalamityPlayer.areThereAnyDamnBosses) + npc.velocity *= 0.95f; + + if (!CalamityWorld.bossRushActive) { if (silvaStun) - { - npc.velocity.X = 0f; - npc.velocity.Y = 0f; - } + npc.velocity = Vector2.Zero; else if (timeSlow) - { - npc.velocity.X *= 0.85f; - npc.velocity.Y *= 0.85f; - } + npc.velocity *= 0.85f; } } #endregion @@ -2400,6 +2206,7 @@ namespace CalamityMod.NPCs case NPCID.GiantCursedSkull: case NPCID.Butcher: case NPCID.Psycho: + case NPCID.MoonLordFreeEye: target.AddBuff(mod.BuffType("Horror"), 180); target.AddBuff(mod.BuffType("MarkedforDeath"), 180); break; @@ -2577,7 +2384,7 @@ namespace CalamityMod.NPCs public override void OnHitByProjectile(NPC npc, Projectile projectile, int damage, float knockback, bool crit) { bool isSummon = projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type); - + if (Main.player[projectile.owner].GetCalamityPlayer().sGenerator) { if (isSummon && npc.damage > 0) diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index f2c8cee2a3..855c622e24 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.CeaselessVoid npc.width = 100; npc.height = 100; npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = 200; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) @@ -316,12 +317,6 @@ namespace CalamityMod.NPCs.CeaselessVoid } } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = (crit ? 2 : 1); - return false; - } - public override void NPCLoot() { // Only drop items if fought alone diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index a72d9fb66c..a1c597aa13 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -31,6 +31,7 @@ namespace CalamityMod.NPCs.Cryogen npc.width = 80; npc.height = 80; npc.defense = 12; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 26300 : 17900; if (CalamityWorld.death) { diff --git a/NPCs/Cryogen/CryogenIce.cs b/NPCs/Cryogen/CryogenIce.cs index ebc42ef407..a471296b47 100644 --- a/NPCs/Cryogen/CryogenIce.cs +++ b/NPCs/Cryogen/CryogenIce.cs @@ -24,7 +24,8 @@ namespace CalamityMod.NPCs.Cryogen npc.width = 240; npc.height = 240; npc.defense = 0; - npc.lifeMax = 1400; + npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.lifeMax = 1400; if (CalamityWorld.bossRushActive) { npc.lifeMax = 100000; diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index dec1dbabe9..df8a86d962 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; npc.height = 36; npc.defense = 6; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index 9490fc3249..89a943eaa9 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -21,6 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge npc.width = 32; //324 npc.height = 48; //216 npc.defense = 9; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = CalamityWorld.revenge ? 2650 : 2300; if (CalamityWorld.death) { diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 22122ae70f..40855f0aaf 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -29,7 +29,8 @@ namespace CalamityMod.NPCs.GreatSandShark npc.width = 300; npc.height = 120; npc.defense = 60; - npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = CalamityWorld.revenge ? 11000 : 8000; if (CalamityWorld.death) { npc.lifeMax = 16000; diff --git a/NPCs/HiveMind/HiveCyst.cs b/NPCs/HiveMind/HiveCyst.cs index 5facf7d0a4..22a8cccf95 100644 --- a/NPCs/HiveMind/HiveCyst.cs +++ b/NPCs/HiveMind/HiveCyst.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.World; namespace CalamityMod.NPCs.HiveMind { @@ -43,6 +44,10 @@ namespace CalamityMod.NPCs.HiveMind { return 0f; } + else if (NPC.downedBoss2 && !CalamityWorld.downedHiveMind) + { + return SpawnCondition.Corruption.Chance * 1.5f; + } return SpawnCondition.Corruption.Chance * (Main.hardMode ? 0.05f : 0.5f); } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index ba993a888b..946a221727 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -28,7 +28,8 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 850; npc.height = 450; npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 90700 : 69000; + npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.lifeMax = CalamityWorld.revenge ? 90700 : 69000; if (CalamityWorld.death) { npc.lifeMax = 189750; diff --git a/NPCs/Leviathan/Siren.cs b/NPCs/Leviathan/Siren.cs index 9df9e089ce..72090cface 100644 --- a/NPCs/Leviathan/Siren.cs +++ b/NPCs/Leviathan/Siren.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = CalamityWorld.revenge ? 41600 : 27400; if (CalamityWorld.death) { diff --git a/NPCs/Leviathan/SirenIce.cs b/NPCs/Leviathan/SirenIce.cs index 7a45bd8827..7968bed16f 100644 --- a/NPCs/Leviathan/SirenIce.cs +++ b/NPCs/Leviathan/SirenIce.cs @@ -23,7 +23,8 @@ namespace CalamityMod.NPCs.Leviathan npc.width = 100; npc.height = 100; npc.defense = 10; - npc.lifeMax = 650; + npc.GetCalamityNPC().RevPlusDR(0.5f); + npc.lifeMax = 650; if (CalamityWorld.bossRushActive) { npc.lifeMax = 400000; diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index 9b546fe380..0fa81d4459 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -19,7 +19,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 38; npc.height = 38; npc.defense = 30; - npc.lifeMax = 20000; + npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.lifeMax = 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 19b9023224..f76fe9fe21 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 54; npc.height = 54; npc.defense = 15; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 769eabe06d..7e460d6ddb 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -19,7 +19,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 34; npc.height = 34; npc.defense = 45; - npc.lifeMax = 20000; + npc.GetCalamityNPC().RevPlusDR(0.45f); + npc.lifeMax = 20000; npc.knockBackResist = 0f; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index 17bc279c9f..b6432f28f2 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 160; npc.height = 80; npc.defense = 6; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = 400; npc.knockBackResist = 0.05f; aiType = -1; diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index 837fb6e9c2..f73aca9838 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 50; npc.height = 64; npc.defense = 10; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 300; npc.knockBackResist = 0f; npc.value = Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index b575600b3e..fb3038a998 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -26,6 +26,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 230; npc.height = 230; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 3800; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 42aa4d80ae..1df44b6b1f 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -22,7 +22,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 18; npc.height = 40; npc.defense = 18; - npc.lifeMax = 90; + npc.GetCalamityNPC().RevPlusDR(0.15f); + npc.lifeMax = 90; npc.knockBackResist = 0.5f; animationType = 77; npc.value = Item.buyPrice(0, 0, 2, 0); diff --git a/NPCs/NormalNPCs/PhantomDebris.cs b/NPCs/NormalNPCs/PhantomDebris.cs index 92e7d34b37..78ad9b4cf8 100644 --- a/NPCs/NormalNPCs/PhantomDebris.cs +++ b/NPCs/NormalNPCs/PhantomDebris.cs @@ -21,6 +21,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 44; npc.height = 22; npc.defense = 20; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 80; npc.aiStyle = 3; aiType = 67; diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 393ea55710..d768181a1f 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -29,8 +29,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.value = Item.buyPrice(0, 10, 0, 0); npc.HitSound = SoundID.NPCHit1; npc.DeathSound = SoundID.NPCDeath1; - /*banner = npc.type; - bannerItem = mod.ItemType("PitbullBanner");*/ + banner = npc.type; + bannerItem = mod.ItemType("PiggyBanner"); } public override float SpawnChance(NPCSpawnInfo spawnInfo) diff --git a/NPCs/NormalNPCs/PlaguedJungleSlime.cs b/NPCs/NormalNPCs/PlaguedJungleSlime.cs index a47389000f..dc7bf82e6b 100644 --- a/NPCs/NormalNPCs/PlaguedJungleSlime.cs +++ b/NPCs/NormalNPCs/PlaguedJungleSlime.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.NormalNPCs { spikeTimer -= 1f; } - if (!npc.wet) + if (!npc.wet && !Main.player[npc.target].GetCalamityPlayer().royalGel) { Vector2 vector3 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); float num14 = Main.player[npc.target].position.X + (float)Main.player[npc.target].width * 0.5f - vector3.X; diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index ff7f7b36f3..c7b2fa21e8 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 72; npc.height = 36; npc.defense = 50; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 6000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/NormalNPCs/SandTortoise.cs b/NPCs/NormalNPCs/SandTortoise.cs index 58650d16ff..4fc3a45698 100644 --- a/NPCs/NormalNPCs/SandTortoise.cs +++ b/NPCs/NormalNPCs/SandTortoise.cs @@ -22,7 +22,8 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 46; npc.height = 32; npc.defense = 30; - npc.scale = 1.5f; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.scale = 1.5f; npc.lifeMax = 580; npc.knockBackResist = 0.2f; animationType = 153; diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index d2aac28a05..9a0da33455 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 160; npc.height = 160; npc.defense = 38; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = 16000; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index 3ead0a260e..968569bd4f 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 64; npc.height = 38; npc.defense = 15; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 150; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/NormalNPCs/ThiccWaifu.cs b/NPCs/NormalNPCs/ThiccWaifu.cs index 7efbfd3dde..b17eb7f57a 100644 --- a/NPCs/NormalNPCs/ThiccWaifu.cs +++ b/NPCs/NormalNPCs/ThiccWaifu.cs @@ -24,6 +24,7 @@ namespace CalamityMod.NPCs.NormalNPCs npc.width = 80; npc.height = 140; npc.defense = 18; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = 6000; if (CalamityWorld.downedProvidence) { diff --git a/NPCs/Perforator/PerforatorCyst.cs b/NPCs/Perforator/PerforatorCyst.cs index f87159a13e..99e5f34f06 100644 --- a/NPCs/Perforator/PerforatorCyst.cs +++ b/NPCs/Perforator/PerforatorCyst.cs @@ -2,6 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.World; namespace CalamityMod.NPCs.Perforator { @@ -43,6 +44,10 @@ namespace CalamityMod.NPCs.Perforator { return 0f; } + else if (NPC.downedBoss2 && !CalamityWorld.downedPerforator) + { + return SpawnCondition.Crimson.Chance * 1.5f; + } return SpawnCondition.Crimson.Chance * (Main.hardMode ? 0.05f : 0.5f); } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index c6c8a91bf5..0784fdfd09 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -37,7 +37,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath npc.width = 198; npc.height = 198; npc.defense = 40; - npc.lifeMax = CalamityWorld.revenge ? 77275 : 58500; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = CalamityWorld.revenge ? 77275 : 58500; if (CalamityWorld.death) { npc.lifeMax = 110000; diff --git a/NPCs/PlaguebringerShade/PlaguebringerShade.cs b/NPCs/PlaguebringerShade/PlaguebringerShade.cs index 12ffad62e2..1d240f2696 100644 --- a/NPCs/PlaguebringerShade/PlaguebringerShade.cs +++ b/NPCs/PlaguebringerShade/PlaguebringerShade.cs @@ -22,7 +22,8 @@ namespace CalamityMod.NPCs.PlaguebringerShade npc.width = 66; npc.height = 66; npc.defense = 30; - npc.lifeMax = CalamityWorld.death ? 4000 : 3000; + npc.GetCalamityNPC().RevPlusDR(0.2f); + npc.lifeMax = CalamityWorld.death ? 4000 : 3000; npc.value = Item.buyPrice(0, 1, 50, 0); if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index ce81be62e5..30d6491389 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -15,7 +15,12 @@ namespace CalamityMod.NPCs.Polterghast { private int despawnTimer = 600; private bool spawnGhost = false; + private bool boostDR = false; + public static float phase1DR = 0.1f; + public static float phase2DR = 0.15f; + public static float phase3DR = 0.2f; + public static float cloneDRBoost = 0.6f; public override void SetStaticDefaults() { @@ -30,6 +35,11 @@ namespace CalamityMod.NPCs.Polterghast npc.width = 90; npc.height = 120; npc.defense = 90; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = 0.1f; + global.customDR = true; + global.multDRReductions.Add(BuffID.Ichor, 0.88f); + global.multDRReductions.Add(BuffID.CursedInferno, 0.9f); npc.lifeMax = CalamityWorld.revenge ? 495000 : 412500; if (CalamityWorld.death) { @@ -251,6 +261,11 @@ namespace CalamityMod.NPCs.Polterghast } } + // Set DR based on phase and boostDR variable + float dr = phase3 ? phase3DR : phase2 ? phase2DR : phase1DR; + if (boostDR) dr += cloneDRBoost; + npc.GetCalamityNPC().DR = dr; + if (expertMode) { num734 += revenge ? 1.5f : 1f; @@ -708,37 +723,6 @@ namespace CalamityMod.NPCs.Polterghast CalamityMod.UpdateServerBoolean(); } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = 0.1f + //.1 - ((double)npc.life < (double)npc.lifeMax * 0.75 ? 0.05f : 0f) + //.15 - ((double)npc.life < (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33) ? 0.05f : 0f) + //.2 - (boostDR ? 0.6f : 0f); //.8 - if (npc.ichor) - { - protection *= 0.88f; - } - else if (npc.onFire2) - { - protection *= 0.9f; - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; - } - public override void FindFrame(int frameHeight) { bool phase2 = (double)npc.life >= (double)npc.lifeMax * (CalamityWorld.revenge ? 0.5 : 0.33); diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs index 0c5b571359..18971dff12 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss.cs @@ -30,7 +30,8 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.width = 100; npc.height = 80; npc.defense = 50; - npc.lifeMax = 102500; + npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.lifeMax = 102500; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 600000 : 500000; diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs index d4879a913e..32f455c765 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss2.cs @@ -24,7 +24,8 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.width = 100; npc.height = 80; npc.defense = 50; - npc.lifeMax = 40000; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 400000 : 300000; diff --git a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs index fb9995fb9f..c9c3b00af3 100644 --- a/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs +++ b/NPCs/ProfanedGuardianBoss/ProfanedGuardianBoss3.cs @@ -24,6 +24,7 @@ namespace CalamityMod.NPCs.ProfanedGuardianBoss npc.width = 100; npc.height = 80; npc.defense = 35; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index c3d91d881b..3e60e92534 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -23,7 +23,8 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 50; - npc.lifeMax = 25000; + npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.lifeMax = 25000; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 360000 : 300000; diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index db1240e6ec..fb1aaff529 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 35; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 40000; if (CalamityWorld.bossRushActive) { diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index e99076f887..db2e12e669 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -26,7 +26,8 @@ namespace CalamityMod.NPCs.Providence npc.width = 100; npc.height = 80; npc.defense = 40; - npc.lifeMax = 42500; + npc.GetCalamityNPC().RevPlusDR(0.3f); + npc.lifeMax = 42500; if (CalamityWorld.bossRushActive) { npc.lifeMax = CalamityWorld.death ? 500000 : 400000; diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 0c28cf5a46..845478b725 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -24,6 +24,9 @@ namespace CalamityMod.NPCs.Providence private int frameUsed = 0; private int healTimer = 0; + public static float normalDR = 0.25f; + public static float cocoonDR = 0.9f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Providence, the Profaned Goddess"); @@ -37,6 +40,11 @@ namespace CalamityMod.NPCs.Providence npc.width = 600; npc.height = 450; npc.defense = 50; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = normalDR; + global.customDR = true; + global.flatDRReductions.Add(BuffID.Ichor, 0.05f); + global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); npc.lifeMax = CalamityWorld.revenge ? 500000 : 440000; if (CalamityWorld.death) { @@ -307,8 +315,11 @@ namespace CalamityMod.NPCs.Providence } } - // Movement - if (npc.ai[0] != 2f && npc.ai[0] != 5f) + // Set DR based on current attack phase + npc.GetCalamityNPC().DR = (npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? cocoonDR : normalDR; + + // Movement + if (npc.ai[0] != 2f && npc.ai[0] != 5f) { // Firing holy ray or not bool firingLaser = npc.ai[0] == 7f; @@ -1093,27 +1104,6 @@ namespace CalamityMod.NPCs.Providence potionType = ItemID.SuperHealingPotion; } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = (((npc.ichor || npc.onFire2) ? 0.2f : 0.25f) + - ((npc.ai[0] == 2f || npc.ai[0] == 5f || npc.ai[0] == 7f) ? 0.65f : 0f)); //0.85 or 0.9 - - if (newDamage < 1.0) - newDamage = 1.0; - - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - - if (newDamage < 1.0) - newDamage = 1.0; - } - - damage = newDamage; - return true; - } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Mod mod = ModLoader.GetMod("CalamityMod"); diff --git a/NPCs/Scavenger/ScavengerBody.cs b/NPCs/Scavenger/ScavengerBody.cs index 45e9e86143..397c69ad9d 100644 --- a/NPCs/Scavenger/ScavengerBody.cs +++ b/NPCs/Scavenger/ScavengerBody.cs @@ -28,7 +28,8 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 332; npc.height = 214; npc.defense = 55; - npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; + npc.GetCalamityNPC().RevPlusDR(0.4f); + npc.lifeMax = CalamityWorld.revenge ? 53500 : 42700; if (CalamityWorld.death) { npc.lifeMax = 90000; diff --git a/NPCs/Scavenger/ScavengerClawLeft.cs b/NPCs/Scavenger/ScavengerClawLeft.cs index c00fac1daf..345dbd67d6 100644 --- a/NPCs/Scavenger/ScavengerClawLeft.cs +++ b/NPCs/Scavenger/ScavengerClawLeft.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 80; npc.height = 40; npc.defense = 40; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerClawRight.cs b/NPCs/Scavenger/ScavengerClawRight.cs index 44b7b2b550..46bca10b5b 100644 --- a/NPCs/Scavenger/ScavengerClawRight.cs +++ b/NPCs/Scavenger/ScavengerClawRight.cs @@ -23,6 +23,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 80; //324 npc.height = 40; //216 npc.defense = 50; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 11120; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerHead.cs b/NPCs/Scavenger/ScavengerHead.cs index 9df46f7954..564e73e9c3 100644 --- a/NPCs/Scavenger/ScavengerHead.cs +++ b/NPCs/Scavenger/ScavengerHead.cs @@ -21,6 +21,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 80; npc.height = 80; npc.defense = 50; + npc.GetCalamityNPC().RevPlusDR(0.1f); npc.lifeMax = 32705; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerLegLeft.cs b/NPCs/Scavenger/ScavengerLegLeft.cs index e44a0e2e65..f7b68299ae 100644 --- a/NPCs/Scavenger/ScavengerLegLeft.cs +++ b/NPCs/Scavenger/ScavengerLegLeft.cs @@ -21,6 +21,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 60; npc.height = 60; npc.defense = 40; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 22010; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/Scavenger/ScavengerLegRight.cs b/NPCs/Scavenger/ScavengerLegRight.cs index 492a398fb0..964280f2eb 100644 --- a/NPCs/Scavenger/ScavengerLegRight.cs +++ b/NPCs/Scavenger/ScavengerLegRight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.NPCs.Scavenger npc.width = 60; npc.height = 60; npc.defense = 40; + npc.GetCalamityNPC().RevPlusDR(0.15f); npc.lifeMax = 21010; npc.knockBackResist = 0f; aiType = -1; diff --git a/NPCs/StormWeaver/StasisProbe.cs b/NPCs/StormWeaver/StasisProbe.cs index 377bdd04ab..48be9af7e3 100644 --- a/NPCs/StormWeaver/StasisProbe.cs +++ b/NPCs/StormWeaver/StasisProbe.cs @@ -22,7 +22,8 @@ namespace CalamityMod.NPCs.StormWeaver npc.width = 30; npc.height = 30; npc.defense = 60; - npc.lifeMax = 1200; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = 1200; if (CalamityWorld.bossRushActive) { npc.lifeMax = 25000; diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 9c762dedf0..c70e71b3b4 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -21,8 +21,9 @@ namespace CalamityMod.NPCs.StormWeaver npc.npcSlots = 5f; npc.width = 40; npc.height = 40; - npc.defense = 99999; - npc.lifeMax = 20000; + npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; + npc.lifeMax = 20000; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); @@ -175,12 +176,6 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = 1; - return false; - } - public override bool CheckActive() { return false; diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index bf35629087..28f5677587 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -30,8 +30,9 @@ namespace CalamityMod.NPCs.StormWeaver npc.npcSlots = 5f; npc.width = 74; npc.height = 74; - npc.defense = 99999; - npc.lifeMax = 20000; + npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; + npc.lifeMax = 20000; Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); @@ -516,12 +517,6 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = 0; - return false; - } - public override bool CheckActive() { return false; diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index c5e0f50f16..e1d425e756 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -20,7 +20,9 @@ namespace CalamityMod.NPCs.StormWeaver npc.width = 48; npc.height = 80; npc.lifeMax = 20000; - Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); + npc.defense = 0; + npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; + Mod calamityModMusic = ModLoader.GetMod("CalamityModMusic"); if (calamityModMusic != null) music = calamityModMusic.GetSoundSlot(SoundType.Music, "Sounds/Music/ScourgeofTheUniverse"); else @@ -51,7 +53,6 @@ namespace CalamityMod.NPCs.StormWeaver npc.HitSound = SoundID.NPCHit4; npc.DeathSound = SoundID.NPCDeath14; npc.netAlways = true; - npc.takenDamageMultiplier = CalamityWorld.death ? 3f : 10f; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; diff --git a/NPCs/SunkenSeaNPCs/BlindedAngler.cs b/NPCs/SunkenSeaNPCs/BlindedAngler.cs index 25f10a5d66..668e5627ea 100644 --- a/NPCs/SunkenSeaNPCs/BlindedAngler.cs +++ b/NPCs/SunkenSeaNPCs/BlindedAngler.cs @@ -26,7 +26,8 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 56; npc.height = 44; npc.defense = 30; - npc.lifeMax = 750; + npc.GetCalamityNPC().RevPlusDR(0.2f); + npc.lifeMax = 750; npc.aiStyle = -1; aiType = -1; npc.value = Item.buyPrice(0, 0, 40, 0); diff --git a/NPCs/SunkenSeaNPCs/Clam.cs b/NPCs/SunkenSeaNPCs/Clam.cs index ef006dc1e7..3ba5fb7dea 100644 --- a/NPCs/SunkenSeaNPCs/Clam.cs +++ b/NPCs/SunkenSeaNPCs/Clam.cs @@ -25,7 +25,8 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 56; npc.height = 38; npc.defense = 9999; - npc.lifeMax = Main.hardMode ? 300 : 150; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) { npc.lifeMax *= 2; diff --git a/NPCs/SunkenSeaNPCs/EutrophicRay.cs b/NPCs/SunkenSeaNPCs/EutrophicRay.cs index cecfc8f0b8..d66ba4a98a 100644 --- a/NPCs/SunkenSeaNPCs/EutrophicRay.cs +++ b/NPCs/SunkenSeaNPCs/EutrophicRay.cs @@ -24,6 +24,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 116; npc.height = 36; npc.defense = Main.hardMode ? 15 : 5; + npc.GetCalamityNPC().RevPlusDR(0.05f); npc.lifeMax = Main.hardMode ? 500 : 150; npc.aiStyle = -1; aiType = -1; diff --git a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs index 15c994bf92..02eacf3cf1 100644 --- a/NPCs/SunkenSeaNPCs/GhostBellSmall.cs +++ b/NPCs/SunkenSeaNPCs/GhostBellSmall.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs { npc.npcSlots = 0.1f; npc.noGravity = true; + npc.chaseable = false; npc.aiStyle = -1; aiType = -1; npc.damage = 0; diff --git a/NPCs/SunkenSeaNPCs/GiantClam.cs b/NPCs/SunkenSeaNPCs/GiantClam.cs index 3a8b0ed677..5ca7eb3ba2 100644 --- a/NPCs/SunkenSeaNPCs/GiantClam.cs +++ b/NPCs/SunkenSeaNPCs/GiantClam.cs @@ -34,7 +34,8 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 160; npc.height = 120; npc.defense = 9999; - npc.lifeMax = Main.hardMode ? 7500 : 1250; + npc.GetCalamityNPC().RevPlusDR(0.3f); + npc.lifeMax = Main.hardMode ? 7500 : 1250; for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; diff --git a/NPCs/SunkenSeaNPCs/PrismTurtle.cs b/NPCs/SunkenSeaNPCs/PrismTurtle.cs index f947976e0a..595fb3ff92 100644 --- a/NPCs/SunkenSeaNPCs/PrismTurtle.cs +++ b/NPCs/SunkenSeaNPCs/PrismTurtle.cs @@ -27,7 +27,8 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.width = 72; npc.height = 58; npc.defense = Main.hardMode ? 25 : 10; - npc.lifeMax = Main.hardMode ? 1000 : 350; + npc.GetCalamityNPC().RevPlusDR(0.25f); + npc.lifeMax = Main.hardMode ? 1000 : 350; npc.aiStyle = -1; aiType = -1; npc.value = Main.hardMode ? Item.buyPrice(0, 0, 50, 0) : Item.buyPrice(0, 0, 5, 0); diff --git a/NPCs/SunkenSeaNPCs/SeaMinnow.cs b/NPCs/SunkenSeaNPCs/SeaMinnow.cs index cc07b197ec..057ae14e9b 100644 --- a/NPCs/SunkenSeaNPCs/SeaMinnow.cs +++ b/NPCs/SunkenSeaNPCs/SeaMinnow.cs @@ -30,6 +30,7 @@ namespace CalamityMod.NPCs.SunkenSeaNPCs npc.DeathSound = SoundID.NPCDeath1; banner = npc.type; bannerItem = mod.ItemType("SeaMinnowBanner"); + npc.chaseable = false; } public override void AI() diff --git a/NPCs/SupremeCalamitas/SCalWormBody.cs b/NPCs/SupremeCalamitas/SCalWormBody.cs index bdb74c2749..0b01037523 100644 --- a/NPCs/SupremeCalamitas/SCalWormBody.cs +++ b/NPCs/SupremeCalamitas/SCalWormBody.cs @@ -22,6 +22,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 26; //28 npc.height = 18; //28 npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) { diff --git a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs index 198075af0c..17764f6cf2 100644 --- a/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs +++ b/NPCs/SupremeCalamitas/SCalWormBodyWeak.cs @@ -30,7 +30,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.aiStyle = 6; aiType = -1; npc.knockBackResist = 0f; - npc.scale = 1.2f; + npc.takenDamageMultiplier = 1E-6f; + npc.scale = 1.2f; if (Main.expertMode) { npc.scale = 1.35f; diff --git a/NPCs/SupremeCalamitas/SCalWormHead.cs b/NPCs/SupremeCalamitas/SCalWormHead.cs index fea35229c4..38523c07b7 100644 --- a/NPCs/SupremeCalamitas/SCalWormHead.cs +++ b/NPCs/SupremeCalamitas/SCalWormHead.cs @@ -29,6 +29,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 56; //324 npc.height = 62; //216 npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) { diff --git a/NPCs/SupremeCalamitas/SCalWormTail.cs b/NPCs/SupremeCalamitas/SCalWormTail.cs index a2de006140..b0c31f50fe 100644 --- a/NPCs/SupremeCalamitas/SCalWormTail.cs +++ b/NPCs/SupremeCalamitas/SCalWormTail.cs @@ -20,6 +20,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 26; //324 npc.height = 46; //216 npc.defense = 0; + npc.takenDamageMultiplier = 1E-6f; npc.lifeMax = CalamityWorld.revenge ? 1200000 : 1000000; if (CalamityWorld.death) { diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index 756f0b96fc..1a1d3b6f27 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -29,7 +29,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.canGhostHeal = false; npc.damage = 0; npc.defense = 80; - npc.lifeMax = Main.expertMode ? 90000 : 50000; + npc.GetCalamityNPC().RevPlusDR(0.35f); + npc.lifeMax = Main.expertMode ? 90000 : 50000; if (CalamityWorld.revenge) { npc.lifeMax = CalamityWorld.death ? 100000 : 170000; diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index fdae876176..8053418245 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -55,6 +55,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas private Rectangle safeBox = default; + public static float normalDR = 0.7f; + public static float deathDR = 0.75f; + public static float bossRushDR = 0.6f; + public static float enragedDR = 0.99f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Supreme Calamitas"); @@ -68,7 +73,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 120; - npc.value = Item.buyPrice(10, 0, 0, 0); + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = CalamityWorld.bossRushActive ? bossRushDR : CalamityWorld.death ? deathDR : normalDR; + global.customDR = true; + global.multDRReductions.Add(BuffID.Ichor, 0.9f); + global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); + npc.value = Item.buyPrice(10, 0, 0, 0); npc.lifeMax = CalamityWorld.revenge ? 5500000 : 5000000; if (CalamityWorld.death) { @@ -337,7 +347,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } } - if (!player.Hitbox.Intersects(safeBox)) + #endregion + #region Enrage and DR + if (!player.Hitbox.Intersects(safeBox)) { if (uDieLul < 3f) { @@ -361,6 +373,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas } protectionBoost = false; } + + // Set DR to be 99% and unbreakable if enraged. Boost DR during the 5th attack. + CalamityGlobalNPC global = npc.GetCalamityNPC(); + if(protectionBoost) + { + global.DR = enragedDR; + global.unbreakableDR = true; + } + else + { + global.DR = CalamityWorld.bossRushActive ? bossRushDR : CalamityWorld.death ? deathDR : normalDR; + global.unbreakableDR = false; + if (startFifthAttack) + global.DR *= 1.2f; + } #endregion #region Despawn if (!player.active || player.dead) @@ -2089,55 +2116,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { damage /= 2; } - if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) - { - damage /= 3; - } } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 10) - { - damage = 0; - return false; - } - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = (CalamityWorld.death ? 0.75f : 0.7f); //45% - if (CalamityWorld.bossRushActive) - { - protection = 0.6f; - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (npc.ichor) - { - protection *= 0.9f; //41% - } - else if (npc.onFire2) - { - protection *= 0.91f; - } - if (startFifthAttack) - { - protection *= 1.2f; //90% or 84% - } - if (protectionBoost) - { - protection = 0.99f; //99% - } - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; + return !CNPCUtils.AntiButcher(npc, ref damage, 0.1f); } public override bool CheckActive() diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index 59ebc88d16..283111a684 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -27,7 +27,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 100; - npc.lifeMax = CalamityWorld.revenge ? 2100000 : 1800000; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; + global.customDR = true; + global.multDRReductions.Add(BuffID.Ichor, 0.9f); + global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); + npc.lifeMax = CalamityWorld.revenge ? 2100000 : 1800000; if (CalamityWorld.death) { npc.lifeMax = 1500000; @@ -195,50 +200,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas { damage /= 2; } - if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) - { - damage /= 3; - } } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = (CalamityWorld.death ? 0.75f : 0.7f); //45% - if (CalamityWorld.bossRushActive) - { - protection = 0.6f; - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (npc.ichor) - { - protection *= 0.9f; //41% - } - else if (npc.onFire2) - { - protection *= 0.91f; - } - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; - } + public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) + { + return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + } - public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; Microsoft.Xna.Framework.Color color24 = npc.GetAlpha(drawColor); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 17fc43abdd..2fb6a6d5fd 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -27,6 +27,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas npc.width = 120; npc.height = 120; npc.defense = 100; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = CalamityWorld.bossRushActive ? 0.6f : CalamityWorld.death ? 0.75f : 0.7f; + global.customDR = true; + global.multDRReductions.Add(BuffID.Ichor, 0.9f); + global.multDRReductions.Add(BuffID.CursedInferno, 0.91f); npc.lifeMax = CalamityWorld.revenge ? 2100000 : 1800000; if (CalamityWorld.death) { @@ -195,47 +200,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { damage /= 2; } - if (projectile.type == mod.ProjectileType("ApothMark") || projectile.type == mod.ProjectileType("ApothJaws")) - { - damage /= 3; - } } public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - double newDamage = (damage + (int)((double)defense * 0.25)); - float protection = (CalamityWorld.death ? 0.75f : 0.7f); //45% - if (CalamityWorld.bossRushActive) - { - protection = 0.6f; - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (npc.ichor) - { - protection *= 0.9f; //41% - } - else if (npc.onFire2) - { - protection *= 0.91f; - } - if (newDamage >= 1.0) - { - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; + return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs index d97099f3e9..5b22ce96c7 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody.cs @@ -24,6 +24,9 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 56; npc.height = 56; npc.defense = 70; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = CalamityWorld.death ? 0.95f : 0.925f; + global.unbreakableDR = true; npc.lifeMax = CalamityWorld.revenge ? 750000 : 675000; if (CalamityWorld.death) { @@ -211,14 +214,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - double protection = CalamityWorld.death ? 0.05 : 0.075; - damage = (int)((double)damage * protection); - return true; + return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs index f80ce6f6f5..359f53732a 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBody2.cs @@ -22,6 +22,9 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 34; npc.height = 34; npc.defense = 60; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = 0.5f; + global.unbreakableDR = true; npc.lifeMax = 100000; npc.aiStyle = 6; aiType = -1; @@ -94,12 +97,6 @@ namespace CalamityMod.NPCs.TheDevourerofGods } } - public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) - { - damage = (int)((double)damage * 0.5); - return true; - } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = 1; diff --git a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs index 5860c33046..39d65822b8 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsBodyS.cs @@ -25,7 +25,10 @@ namespace CalamityMod.NPCs.TheDevourerofGods npc.width = 70; npc.height = 70; npc.defense = 70; - npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = CalamityWorld.death ? 0.97f : 0.955f; + global.unbreakableDR = true; + npc.lifeMax = CalamityWorld.revenge ? 1350000 : 1150000; if (CalamityWorld.death) { npc.lifeMax = 2100000; @@ -199,14 +202,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - double protection = CalamityWorld.death ? 0.03 : 0.045; - damage = (int)((double)damage * protection); - return true; + return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs index 51e55cf4a3..bd2e32ad57 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHead.cs @@ -703,22 +703,17 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - string key = "Mods.CalamityMod.EdgyBossText2"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - damage = 0; - return false; - } - return true; + if(CNPCUtils.AntiButcher(npc, ref damage, 0.5f)) + { + string key = "Mods.CalamityMod.EdgyBossText2"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + return false; + } + return true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs index 4f777b278d..e7e1c95e27 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsHeadS.cs @@ -961,22 +961,17 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - string key = "Mods.CalamityMod.EdgyBossText2"; - Color messageColor = Color.Cyan; - if (Main.netMode == NetmodeID.SinglePlayer) - { - Main.NewText(Language.GetTextValue(key), messageColor); - } - else if (Main.netMode == NetmodeID.Server) - { - NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); - } - damage = 0; - return false; - } - return true; + if (CNPCUtils.AntiButcher(npc, ref damage, 0.5f)) + { + string key = "Mods.CalamityMod.EdgyBossText2"; + Color messageColor = Color.Cyan; + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetTextValue(key), messageColor); + else if (Main.netMode == NetmodeID.Server) + NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor); + return false; + } + return true; } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs index f2fcf27bb8..a7c75e935e 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTail.cs @@ -192,13 +192,8 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - return true; - } + return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); + } public override bool CheckActive() { diff --git a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs index ef3d25762d..7fd86b0705 100644 --- a/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs +++ b/NPCs/TheDevourerofGods/DevourerofGodsTailS.cs @@ -266,12 +266,7 @@ namespace CalamityMod.NPCs.TheDevourerofGods public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 2) - { - damage = 0; - return false; - } - return true; + return !CNPCUtils.AntiButcher(npc, ref damage, 0.5f); } public override bool CheckActive() diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index f038e94fd3..64c65b1951 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -116,12 +116,9 @@ namespace CalamityMod.NPCs.TownNPCs PossibleDialogs.Add("Maybe I'm bitter. It's been a long time, so whatever. Just do a good job out there."); PossibleDialogs.Add("It's not stealing! I'm just borrowing it until I die!"); - for (int j = 0; j < Main.LocalPlayer.inventory.Length; j++) + if (InventoryHas(Main.LocalPlayer, ItemID.BoneGlove)) { - if (Main.LocalPlayer.inventory[j].type == ItemID.BoneGlove) - { - PossibleDialogs.Add("Wouldn't be the first time I used my friends' remains as weapons."); - } + PossibleDialogs.Add("Wouldn't be the first time I used my friends' remains as weapons."); } if (Main.hardMode) { @@ -135,7 +132,7 @@ namespace CalamityMod.NPCs.TownNPCs PossibleDialogs.Add("Providence HATES it when you take her stuff. I learned that the hard way."); PossibleDialogs.Add("You think I can get away with looting from ghosts? It ain't like they can pick things up."); } - if (InventoryHas(Main.LocalPlayer,mod.ItemType("Valediction")) || + if (InventoryHas(Main.LocalPlayer, mod.ItemType("Valediction")) || InventoryHas(Main.LocalPlayer, mod.ItemType("TheReaper"))) { PossibleDialogs.Add("Oh man, did you rip that off a shark!? Now that's a weapon!"); diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index c1c612e4ba..c91b8d7b22 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -29,6 +29,10 @@ namespace CalamityMod.NPCs.Yharon private bool spawnArena = false; private int invincibilityCounter = 0; + public static float Phase1_DR = 0.17f; + public static float Phase2_DR = 0.22f; + public static float EnragedDR = 0.9f; + public override void SetStaticDefaults() { DisplayName.SetDefault("Jungle Dragon, Yharon"); @@ -60,6 +64,7 @@ namespace CalamityMod.NPCs.Yharon npc.boss = true; NPCID.Sets.TrailCacheLength[npc.type] = 8; NPCID.Sets.TrailingMode[npc.type] = 1; + for (int k = 0; k < npc.buffImmune.Length; k++) { npc.buffImmune[k] = true; @@ -68,6 +73,13 @@ namespace CalamityMod.NPCs.Yharon npc.buffImmune[BuffID.CursedInferno] = false; npc.buffImmune[mod.BuffType("DemonFlames")] = false; npc.buffImmune[mod.BuffType("Shred")] = false; + + CalamityGlobalNPC global = npc.GetCalamityNPC(); + global.DR = Phase1_DR; + global.customDR = true; + global.flatDRReductions.Add(BuffID.Ichor, 0.05f); + global.flatDRReductions.Add(BuffID.CursedInferno, 0.05f); + npc.noGravity = true; npc.noTileCollide = true; npc.netAlways = true; @@ -341,6 +353,9 @@ namespace CalamityMod.NPCs.Yharon protectionBoost = false; } + // Set DR based on protection boost (aka enrage) + npc.GetCalamityNPC().DR = protectionBoost ? EnragedDR : Phase1_DR; + // Trigger spawn effects if (npc.localAI[0] == 0f) { @@ -1882,7 +1897,11 @@ namespace CalamityMod.NPCs.Yharon npc.timeLeft = 3600; } } - int num = -1; + + // Set DR based on protection boost (aka enrage) + npc.GetCalamityNPC().DR = protectionBoost ? EnragedDR : Phase2_DR; + + int num = -1; float num2 = 1f; int num4 = expertMode ? 110 : 125; if (phase4) @@ -2818,40 +2837,18 @@ namespace CalamityMod.NPCs.Yharon } #endregion - #region DamageFormula + #region StrikeNPC public override bool StrikeNPC(ref double damage, int defense, ref float knockback, int hitDirection, ref bool crit) { - if (damage > npc.lifeMax / 10 || (!startSecondAI && dropLoot)) + if (CNPCUtils.AntiButcher(npc, ref damage, 0.1f)) return false; + + // Safeguard to prevent damage which would allow skipping phase 2. + if (!startSecondAI && dropLoot) { damage = 0; return false; } - double newDamage = (damage + (int)((double)defense * 0.25)); - if (newDamage < 1.0) - { - newDamage = 1.0; - } - if (newDamage >= 1.0) - { - if (startSecondAI) - { - float protection = (((npc.ichor || npc.onFire2) ? 0.17f : 0.22f) + - (protectionBoost ? 0.68f : 0f)); //0.85 or 0.9 - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - } - else - { - float protection = (((npc.ichor || npc.onFire2) ? 0.12f : 0.17f) + - (protectionBoost ? 0.73f : 0f)); //0.85 or 0.9 - newDamage = (double)((int)((double)(1f - protection) * newDamage)); - } - if (newDamage < 1.0) - { - newDamage = 1.0; - } - } - damage = newDamage; - return true; + return true; } #endregion diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 42b7da9a41..8daddf8131 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -39,6 +39,9 @@ namespace CalamityMod.Projectiles public int spawnedPlayerMinionProjectileDamageValue = 0; public int defDamage = 0; + // Rogue Stuff + public bool stealthStrike = false; //Update all existing rogue weapons with this + // Iron Heart public int ironHeartDamage = 0; @@ -518,6 +521,10 @@ namespace CalamityMod.Projectiles } } } + else if (projectile.type == ProjectileID.FallingStar) + projectile.ranged = true; + else if (projectile.type == ProjectileID.SoulDrain) + projectile.magic = true; if (Main.player[projectile.owner].GetCalamityPlayer().eQuiver && projectile.ranged && projectile.friendly && CalamityMod.rangedProjectileExceptionList.TrueForAll(x => projectile.type != x)) @@ -625,6 +632,18 @@ namespace CalamityMod.Projectiles int dust = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 244, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f, 0, default, 0.5f); Main.dust[dust].noGravity = true; } + + if (rogue) + { + if (Main.player[projectile.owner].GetCalamityPlayer().moonCrown) + { + //Summon moon sigils infrequently + if (Main.rand.NextBool(300)) + { + Projectile.NewProjectile(projectile.position, Vector2.Zero, mod.ProjectileType("MoonSigil"), 10, 0); + } + } + } } #endregion @@ -1192,7 +1211,32 @@ namespace CalamityMod.Projectiles num9 *= num10; Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, num8, num9, mod.ProjectileType("XerocStar"), (int)((double)num * 1.6), 0f, projectile.owner, (float)num6, 0f); } - } + + if (Main.player[projectile.owner].GetCalamityPlayer().featherCrown && stealthStrike) + { + for (int i = 0; i < 10; i++) + { + Vector2 pos = new Vector2(target.position.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + float speedX = (target.position.X - pos.X) / 30f; + float speedY = (target.position.Y - pos.Y) * 8; + int feather = Projectile.NewProjectile(pos.X, pos.Y, speedX, speedY, mod.ProjectileType("StickyFeather"), 15, 3, projectile.owner, 0f, (float)Main.rand.Next(15)); + Main.projectile[feather].magic = false; + Main.projectile[feather].GetGlobalProjectile(mod).rogue = true; + } + } + + if (Main.player[projectile.owner].GetCalamityPlayer().moonCrown && stealthStrike) + { + for (int i = 0; i < 20; i++) + { + Vector2 pos = new Vector2(target.position.X + (float)target.width * 0.5f + (float)Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 velocity = (target.position - pos) / 10f; + int flare = Projectile.NewProjectile(pos, velocity, ProjectileID.LunarFlare, 50, 3, projectile.owner); + Main.projectile[flare].magic = false; + Main.projectile[flare].GetGlobalProjectile(mod).rogue = true; + } + } + } else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type)) { if (Main.player[projectile.owner].GetCalamityPlayer().pArtifact) diff --git a/Projectiles/Melee/Cyclone.cs b/Projectiles/Melee/Cyclone.cs index fd437a1a7a..ad9fea509c 100644 --- a/Projectiles/Melee/Cyclone.cs +++ b/Projectiles/Melee/Cyclone.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Melee { public class Cyclone : ModProjectile { + public int dustvortex = 0; public override void SetStaticDefaults() { DisplayName.SetDefault("Cyclone"); @@ -30,15 +31,37 @@ namespace CalamityMod.Projectiles.Melee projectile.ignoreWater = true; projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 10; + projectile.tileCollide = false; } public override void AI() { + projectile.ai[0]++; + projectile.ai[1]++; + + //Code so it doesnt collide on tiles instantly + if (projectile.ai[0] >= 12) + projectile.tileCollide = true; + projectile.rotation += 2.5f; projectile.alpha -= 5; if (projectile.alpha < 50) { projectile.alpha = 50; + if (projectile.ai[1] >= 15) + { + + for (int i = 1; i <= 6; i++) + { + Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(dustvortex)); + int d = Dust.NewDust(projectile.Center, projectile.width/2, projectile.height/2, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.3f); + Main.dust[d].noGravity = true; + Main.dust[d].velocity = dustspeed; + dustvortex += 60; + } + dustvortex -= 355; + projectile.ai[1] = 0; + } } float num472 = projectile.Center.X; float num473 = projectile.Center.Y; @@ -86,5 +109,19 @@ namespace CalamityMod.Projectiles.Melee CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 1); return false; } - } + + public override void Kill(int timeLeft) + { + Main.PlaySound(2, (int)projectile.Center.X,(int)projectile.Center.Y, 60, 0.6f); + + for (int i = 0; i <= 360; i += 3) + { + Vector2 dustspeed = new Vector2(3f, 3f).RotatedBy(MathHelper.ToRadians(i)); + int d = Dust.NewDust(projectile.Center, projectile.width, projectile.height, 31, dustspeed.X, dustspeed.Y, 200, new Color(232, 251, 250, 200), 1.4f); + Main.dust[d].noGravity = true; + Main.dust[d].position = projectile.Center; + Main.dust[d].velocity = dustspeed; + } + } + } } diff --git a/Projectiles/Ranged/AccelerationBullet.cs b/Projectiles/Ranged/AccelerationBullet.cs index 4b217c8842..cafbaf1687 100644 --- a/Projectiles/Ranged/AccelerationBullet.cs +++ b/Projectiles/Ranged/AccelerationBullet.cs @@ -31,21 +31,13 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { projectile.velocity *= 1.01f; - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 91, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 91, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/AccelerationBullet.png b/Projectiles/Ranged/AccelerationBullet.png index 0056fc1e24..646dd6b505 100644 Binary files a/Projectiles/Ranged/AccelerationBullet.png and b/Projectiles/Ranged/AccelerationBullet.png differ diff --git a/Projectiles/Ranged/AcidBullet.cs b/Projectiles/Ranged/AcidBullet.cs index 57ef3753c2..520b994c9d 100644 --- a/Projectiles/Ranged/AcidBullet.cs +++ b/Projectiles/Ranged/AcidBullet.cs @@ -31,21 +31,13 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 4f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 107, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 107, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/AcidBullet.png b/Projectiles/Ranged/AcidBullet.png index 0056fc1e24..be1527a00f 100644 Binary files a/Projectiles/Ranged/AcidBullet.png and b/Projectiles/Ranged/AcidBullet.png differ diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index b05ef086e2..f7ff00c660 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; - projectile.alpha = 255; projectile.timeLeft = 600; projectile.light = 0.25f; projectile.extraUpdates = 1; @@ -52,8 +51,10 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreAI() { - for (int num136 = 0; num136 < 6; num136++) - { + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { int randomDust = Main.rand.Next(2); if (randomDust == 0) { @@ -63,11 +64,8 @@ namespace CalamityMod.Projectiles.Ranged { randomDust = mod.DustType("AstralBlue"); } - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, randomDust, 0f, 0f, 0, default, 1.5f); - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, randomDust, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; } diff --git a/Projectiles/Ranged/AstralRound.png b/Projectiles/Ranged/AstralRound.png index 0056fc1e24..8e4b2a680f 100644 Binary files a/Projectiles/Ranged/AstralRound.png and b/Projectiles/Ranged/AstralRound.png differ diff --git a/Projectiles/Ranged/EnhancedNanoRound.cs b/Projectiles/Ranged/EnhancedNanoRound.cs index 51629d125f..758d8afc56 100644 --- a/Projectiles/Ranged/EnhancedNanoRound.cs +++ b/Projectiles/Ranged/EnhancedNanoRound.cs @@ -31,21 +31,13 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.25f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 229, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 229, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/EnhancedNanoRound.png b/Projectiles/Ranged/EnhancedNanoRound.png index 0056fc1e24..811eef69ba 100644 Binary files a/Projectiles/Ranged/EnhancedNanoRound.png and b/Projectiles/Ranged/EnhancedNanoRound.png differ diff --git a/Projectiles/Ranged/FlashBullet.cs b/Projectiles/Ranged/FlashBullet.cs index 21faae4855..e548939fe4 100644 --- a/Projectiles/Ranged/FlashBullet.cs +++ b/Projectiles/Ranged/FlashBullet.cs @@ -31,21 +31,13 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f, ((255 - projectile.alpha) * 0.1f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 264, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 264, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/FlashBullet.png b/Projectiles/Ranged/FlashBullet.png index 0056fc1e24..a5754b5064 100644 Binary files a/Projectiles/Ranged/FlashBullet.png and b/Projectiles/Ranged/FlashBullet.png differ diff --git a/Projectiles/Ranged/FrostsparkBullet.cs b/Projectiles/Ranged/FrostsparkBullet.cs index 4f41aef0c0..706f0d460e 100644 --- a/Projectiles/Ranged/FrostsparkBullet.cs +++ b/Projectiles/Ranged/FrostsparkBullet.cs @@ -31,30 +31,22 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f, ((255 - projectile.alpha) * 0.15f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 4f) - { - for (int num136 = 0; num136 < 10; num136++) + if (Main.rand.NextBool(2)) + { + int dustType = Main.rand.Next(3); + if (dustType == 0) { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int dustType = Main.rand.Next(2); - if (dustType == 0) - { - dustType = 67; - } - else - { - dustType = 6; - } - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; + dustType = 67; } - } + else + { + dustType = 6; + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/FrostsparkBullet.png b/Projectiles/Ranged/FrostsparkBullet.png index 0056fc1e24..e281327743 100644 Binary files a/Projectiles/Ranged/FrostsparkBullet.png and b/Projectiles/Ranged/FrostsparkBullet.png differ diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index d916932bf3..6d439031ce 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged { DisplayName.SetDefault("Halley's Comet"); } - + public override void SetDefaults() { projectile.width = 20; @@ -97,4 +97,4 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(mod.BuffType("Nightwither"), 300); } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/HolyFireBullet.cs b/Projectiles/Ranged/HolyFireBullet.cs index 84e57938b5..02f53dc92c 100644 --- a/Projectiles/Ranged/HolyFireBullet.cs +++ b/Projectiles/Ranged/HolyFireBullet.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.height = 12; projectile.friendly = true; projectile.extraUpdates = 5; - projectile.alpha = 255; projectile.penetrate = 1; projectile.timeLeft = 600; projectile.ranged = true; @@ -28,33 +28,43 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 4f) - { - for (int num92 = 0; num92 < 2; num92++) - { - float num93 = projectile.velocity.X / 3f * (float)num92; - float num94 = projectile.velocity.Y / 3f * (float)num92; - int num95 = 4; - int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 244, 0f, 0f, 100, default, 2f); - Main.dust[num96].noGravity = true; - Main.dust[num96].velocity *= 0.1f; - Main.dust[num96].velocity += projectile.velocity * 0.1f; - Dust expr_47FA_cp_0 = Main.dust[num96]; - expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; - Dust expr_4815_cp_0 = Main.dust[num96]; - expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; - } - if (Main.rand.NextBool(10)) - { - int num97 = 4; - int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 244, 0f, 0f, 100, default, 0.6f); - Main.dust[num98].velocity *= 0.25f; - Main.dust[num98].velocity += projectile.velocity * 0.5f; - } - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(10)) + { + float num93 = projectile.velocity.X / 3f; + float num94 = projectile.velocity.Y / 3f; + int num95 = 4; + int num96 = Dust.NewDust(new Vector2(projectile.position.X + (float)num95, projectile.position.Y + (float)num95), projectile.width - num95 * 2, projectile.height - num95 * 2, 244, 0f, 0f, 100, default, 2f); + Main.dust[num96].noGravity = true; + Main.dust[num96].velocity *= 0.1f; + Main.dust[num96].velocity += projectile.velocity * 0.1f; + Dust expr_47FA_cp_0 = Main.dust[num96]; + expr_47FA_cp_0.position.X = expr_47FA_cp_0.position.X - num93; + Dust expr_4815_cp_0 = Main.dust[num96]; + expr_4815_cp_0.position.Y = expr_4815_cp_0.position.Y - num94; + } + if (Main.rand.NextBool(20)) + { + int num97 = 4; + int num98 = Dust.NewDust(new Vector2(projectile.position.X + (float)num97, projectile.position.Y + (float)num97), projectile.width - num97 * 2, projectile.height - num97 * 2, 244, 0f, 0f, 100, default, 0.6f); + Main.dust[num98].velocity *= 0.25f; + Main.dust[num98].velocity += projectile.velocity * 0.5f; + } } + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + Vector2 drawOrigin = new Vector2(Main.projectileTexture[projectile.type].Width * 0.5f, projectile.height * 0.5f); + for (int k = 0; k < projectile.oldPos.Length; k++) + { + Vector2 drawPos = projectile.oldPos[k] - Main.screenPosition + drawOrigin + new Vector2(0f, projectile.gfxOffY); + Color color = projectile.GetAlpha(lightColor) * ((float)(projectile.oldPos.Length - k) / (float)projectile.oldPos.Length); + spriteBatch.Draw(Main.projectileTexture[projectile.type], drawPos, null, color, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); + } + return true; + } + public override void Kill(int timeLeft) { if (projectile.owner == Main.myPlayer) diff --git a/Projectiles/Ranged/HolyFireBullet.png b/Projectiles/Ranged/HolyFireBullet.png index 0056fc1e24..1ab4bc050e 100644 Binary files a/Projectiles/Ranged/HolyFireBullet.png and b/Projectiles/Ranged/HolyFireBullet.png differ diff --git a/Projectiles/Ranged/HyperiusBullet.cs b/Projectiles/Ranged/HyperiusBullet.cs index 7ffc19aa5f..b36d9ddea1 100644 --- a/Projectiles/Ranged/HyperiusBullet.cs +++ b/Projectiles/Ranged/HyperiusBullet.cs @@ -32,21 +32,23 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 235, 0f, 0f, 0, default, 0.75f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + int dustType = Main.rand.Next(3); + if (dustType == 0) + { + dustType = 235; + } + else if (dustType == 1) + { + dustType = 61; + } + else + { + dustType = 88; + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/HyperiusBullet.png b/Projectiles/Ranged/HyperiusBullet.png index 01c3ee5696..796dc78281 100644 Binary files a/Projectiles/Ranged/HyperiusBullet.png and b/Projectiles/Ranged/HyperiusBullet.png differ diff --git a/Projectiles/Ranged/OMGWTH.cs b/Projectiles/Ranged/OMGWTH.cs index 50b0d01404..eef30b5186 100644 --- a/Projectiles/Ranged/OMGWTH.cs +++ b/Projectiles/Ranged/OMGWTH.cs @@ -32,17 +32,26 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, ((255 - projectile.alpha) * 0.25f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f, ((255 - projectile.alpha) * 0.01f) / 255f); - for (int num136 = 0; num136 < 3; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 235, 0f, 0f, 0, default, 0.75f); + if (Main.rand.NextBool(2)) + { + int dustType = Main.rand.Next(3); + if (dustType == 0) + { + dustType = 235; + } + else if (dustType == 1) + { + dustType = 61; + } + else + { + dustType = 88; + } + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, dustType, 0f, 0f, 0, default, 0.5f); Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; Main.dust[num137].velocity *= 0f; Main.dust[num137].noGravity = true; - } + } } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) diff --git a/Projectiles/Ranged/OMGWTH.png b/Projectiles/Ranged/OMGWTH.png index 87d6c017a4..796dc78281 100644 Binary files a/Projectiles/Ranged/OMGWTH.png and b/Projectiles/Ranged/OMGWTH.png differ diff --git a/Projectiles/Ranged/SparkSpreaderFire.cs b/Projectiles/Ranged/SparkSpreaderFire.cs index b4d6906bbf..ea5967466c 100644 --- a/Projectiles/Ranged/SparkSpreaderFire.cs +++ b/Projectiles/Ranged/SparkSpreaderFire.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged { DisplayName.SetDefault("Fire"); } - + public override void SetDefaults() { projectile.width = 12; @@ -100,4 +100,4 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.OnFire, 60 * Main.rand.Next(1,4)); } } -} \ No newline at end of file +} diff --git a/Projectiles/Ranged/SuperballBullet.cs b/Projectiles/Ranged/SuperballBullet.cs index c6b2f52ba9..2f51c81e6d 100644 --- a/Projectiles/Ranged/SuperballBullet.cs +++ b/Projectiles/Ranged/SuperballBullet.cs @@ -30,21 +30,13 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - projectile.localAI[0] += 1f; - if (projectile.localAI[0] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 87, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + if (Main.rand.NextBool(3)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 87, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/SuperballBullet.png b/Projectiles/Ranged/SuperballBullet.png index 0056fc1e24..b198b5ea66 100644 Binary files a/Projectiles/Ranged/SuperballBullet.png and b/Projectiles/Ranged/SuperballBullet.png differ diff --git a/Projectiles/Ranged/VeriumBullet.cs b/Projectiles/Ranged/VeriumBullet.cs index 15e80f0cdc..fff0dbaf52 100644 --- a/Projectiles/Ranged/VeriumBullet.cs +++ b/Projectiles/Ranged/VeriumBullet.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Ranged projectile.friendly = true; projectile.ranged = true; projectile.penetrate = 1; - projectile.alpha = 255; projectile.timeLeft = 600; projectile.extraUpdates = 1; aiType = ProjectileID.Bullet; @@ -42,21 +41,15 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreAI() { - projectile.localAI[1] += 1f; - if (projectile.localAI[1] >= 6f) - { - for (int num136 = 0; num136 < 10; num136++) - { - float x2 = projectile.position.X - projectile.velocity.X / 10f * (float)num136; - float y2 = projectile.position.Y - projectile.velocity.Y / 10f * (float)num136; - int num137 = Dust.NewDust(new Vector2(x2, y2), 1, 1, 182, 0f, 0f, 0, default, 0.5f); - Main.dust[num137].alpha = projectile.alpha; - Main.dust[num137].position.X = x2; - Main.dust[num137].position.Y = y2; - Main.dust[num137].velocity *= 0f; - Main.dust[num137].noGravity = true; - } - } + projectile.rotation = projectile.velocity.ToRotation() + MathHelper.ToRadians(90f); + projectile.spriteDirection = projectile.direction; + if (Main.rand.NextBool(2)) + { + int num137 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), 1, 1, 70, 0f, 0f, 0, default, 0.5f); + Main.dust[num137].alpha = projectile.alpha; + Main.dust[num137].velocity *= 0f; + Main.dust[num137].noGravity = true; + } float num138 = (float)Math.Sqrt((double)(projectile.velocity.X * projectile.velocity.X + projectile.velocity.Y * projectile.velocity.Y)); float num139 = projectile.localAI[0]; if (num139 == 0f) diff --git a/Projectiles/Ranged/VeriumBullet.png b/Projectiles/Ranged/VeriumBullet.png index e6c2d4b44a..c1252295f3 100644 Binary files a/Projectiles/Ranged/VeriumBullet.png and b/Projectiles/Ranged/VeriumBullet.png differ diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.cs b/Projectiles/Rogue/AbyssalMirrorProjectile.cs new file mode 100644 index 0000000000..fceb84d554 --- /dev/null +++ b/Projectiles/Rogue/AbyssalMirrorProjectile.cs @@ -0,0 +1,44 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AbyssalMirrorProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenyl Fluid"); + Main.projFrames[projectile.type] = 3; + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 14; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 50; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft < 25) { projectile.alpha += 10; } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.friendly && target.rarity != 2 && !CalamityPlayer.areThereAnyDamnBosses) + { + target.AddBuff(mod.BuffType("SilvaStun"), 300); + } + } + } +} diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile.png b/Projectiles/Rogue/AbyssalMirrorProjectile.png new file mode 100644 index 0000000000..e7cc9f5a56 Binary files /dev/null and b/Projectiles/Rogue/AbyssalMirrorProjectile.png differ diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 7b063779eb..40863198e3 100644 --- a/Projectiles/Rogue/BlastBarrelProjectile.cs +++ b/Projectiles/Rogue/BlastBarrelProjectile.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Projectiles.Rogue public class BlastBarrelProjectile : ModProjectile { public float cooldown = 0f; - public float oldVelocityX = 0f; + public float oldVelocityX = 0f; public override void SetStaticDefaults() { DisplayName.SetDefault("Barrel"); @@ -33,9 +33,10 @@ namespace CalamityMod.Projectiles.Rogue public bool collideX => projectile.oldPosition.X == projectile.position.X; public override void AI() { + bool stealthS = projectile.GetCalamityProj().stealthStrike; if (projectile.localAI[0] == 0f) { - projectile.ai[1] = projectile.ai[0] == 0 ? 1 : 3; + projectile.ai[1] = stealthS.ToInt() == 0 ? 1 : 3; projectile.localAI[0] = 1f; } projectile.rotation += Math.Sign(projectile.velocity.X) * MathHelper.ToRadians(8f); @@ -60,11 +61,13 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) => false; public void BounceEffects() { + bool stealthS = projectile.GetCalamityProj().stealthStrike; int projectileCount = 12; + Main.PlaySound(2, projectile.Center, 14); //aka can bounce multiple times - if (projectile.ai[0] != 0f) + if (stealthS) { - projectileCount += (3 - (int)projectile.ai[0]) * 2; //more shit the closer we are to death + projectileCount += (3 - stealthS.ToInt()) * 2; //more shit the closer we are to death } for (int i = 0; i < projectileCount; i++) { @@ -78,7 +81,7 @@ namespace CalamityMod.Projectiles.Rogue { Vector2 fireVelocity = (Vector2.UnitY * (-16f + Main.rand.NextFloat(-3, 12f))).RotatedByRandom((double)MathHelper.ToRadians(40f)); int fireIndex = Projectile.NewProjectile(projectile.Center, projectile.velocity + fireVelocity, - Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), + Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), BlastBarrel.BaseDamage, 1f, projectile.owner); Main.projectile[fireIndex].thrown = false; Main.projectile[fireIndex].GetGlobalProjectile(mod).rogue = true; @@ -97,4 +100,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 559ef786fa..92667aca1d 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Bloodsoaked Crasher"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Rogue/BouncingEyeballProjectile.cs b/Projectiles/Rogue/BouncingEyeballProjectile.cs index 75825ac436..ce2419e7e9 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectile.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectile.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Rogue } public override bool OnTileCollide(Vector2 oldVelocity) { + Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); Bounces--; if (Bounces <= 0) { @@ -60,6 +61,7 @@ namespace CalamityMod.Projectiles.Rogue } public override void Kill(int timeLeft) { + Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); int dustCount = Main.rand.Next(8, 16); for (int index = 0; index < dustCount; index++) { diff --git a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs index 21bfa03978..87f7cc7c6b 100644 --- a/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs +++ b/Projectiles/Rogue/BouncingEyeballProjectileStealthStrike.cs @@ -48,11 +48,13 @@ namespace CalamityMod.Projectiles.Rogue { projectile.velocity = Main.rand.NextFloat(-1.15f, -0.85f) * oldVelocity * Bounciness; } + Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); return false; } public override void Kill(int timeLeft) { //explode into a larger display of blood. Yay + Main.PlaySound(3, (int)projectile.Center.X, (int)projectile.Center.Y, 19, 0.7f); int dustCount = Main.rand.Next(15, 26); for (int index = 0; index < dustCount; index++) { diff --git a/Projectiles/Rogue/ButcherKnife.cs b/Projectiles/Rogue/ButcherKnife.cs index 3c342544aa..eea33c43ef 100644 --- a/Projectiles/Rogue/ButcherKnife.cs +++ b/Projectiles/Rogue/ButcherKnife.cs @@ -15,6 +15,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Butcher Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Rogue/CarvingFork.cs b/Projectiles/Rogue/CarvingFork.cs index bcee776a39..af5afc485e 100644 --- a/Projectiles/Rogue/CarvingFork.cs +++ b/Projectiles/Rogue/CarvingFork.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Carving Fork"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -34,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/EclipseMirrorBurst.cs b/Projectiles/Rogue/EclipseMirrorBurst.cs new file mode 100644 index 0000000000..f746e4ff95 --- /dev/null +++ b/Projectiles/Rogue/EclipseMirrorBurst.cs @@ -0,0 +1,76 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class EclipseMirrorBurst : ModProjectile + { + private int frameCounter = 0; + private int frameX = 0; + private int frameY = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Eclipse Mirror Flash"); + } + + public override void SetDefaults() + { + projectile.width = 750; + projectile.height = 750; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = false; + projectile.ignoreWater = true; + projectile.timeLeft = 150; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 5; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + frameCounter++; + if (frameCounter > 3) + { + frameCounter = 0; + frameY++; + if (frameY > 1) + { + frameX++; + frameY = 0; + } + } + if (frameX > 0 && frameY > 0) + { + projectile.Kill(); + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = mod.GetTexture("Projectiles/Rogue/EclipseMirrorFlash"); + spriteBatch.Draw + ( + texture, + new Vector2 + ( + projectile.position.X - Main.screenPosition.X + projectile.width * 0.5f - 50, + projectile.position.Y - Main.screenPosition.Y + projectile.height - 750 * 0.5f - 50 + ), + new Rectangle(frameX * 752, frameY * 752, 750, 750), + Color.White, + projectile.rotation, + new Vector2(325, 325), + projectile.scale, + SpriteEffects.None, + 0f + ); + } + } +} diff --git a/Projectiles/Rogue/EclipseMirrorBurst.png b/Projectiles/Rogue/EclipseMirrorBurst.png new file mode 100644 index 0000000000..c51889a8cd Binary files /dev/null and b/Projectiles/Rogue/EclipseMirrorBurst.png differ diff --git a/Projectiles/Rogue/EclipseMirrorFlash.png b/Projectiles/Rogue/EclipseMirrorFlash.png new file mode 100644 index 0000000000..31dbce55bb Binary files /dev/null and b/Projectiles/Rogue/EclipseMirrorFlash.png differ diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 95fdf26409..425511c88c 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -12,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Eclipse's Fall"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index e3b57a7019..27c71c199c 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -15,10 +15,12 @@ namespace CalamityMod.Projectiles.Rogue public class EclipsesStealth : ModProjectile { private int deadinside = 0; //used to know when to drop spears from the sky - + public override void SetStaticDefaults() { DisplayName.SetDefault("Eclipse's Stealth"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -34,7 +36,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.localNPCHitCooldown = 30; projectile.GetGlobalProjectile(mod).rogue = true; } - + public override void AI() { deadinside++; //congrats Pinkie diff --git a/Projectiles/Rogue/Fork.cs b/Projectiles/Rogue/Fork.cs index ef32a08144..82e9fa417d 100644 --- a/Projectiles/Rogue/Fork.cs +++ b/Projectiles/Rogue/Fork.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Fork"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -32,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs new file mode 100644 index 0000000000..c8c5043970 --- /dev/null +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -0,0 +1,74 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class InkBombProjectile : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Bomb"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 22; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = 1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 50; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + projectile.velocity.Y += 0.1f; + projectile.rotation += projectile.velocity.X * 0.1f; + + if (projectile.timeLeft == 1) + CreateInk(); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.friendly) + CreateInk(); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + CreateInk(); + return true; + } + + private void CreateInk() + { + Main.PlaySound(2, (int)Main.player[Main.myPlayer].position.X, (int)Main.player[Main.myPlayer].position.Y, 14); + for (int i = 0; i < 20; i++) + { + int projType = Main.rand.Next(0, 3); + int inkType; + switch (projType) + { + case 0: + inkType = mod.ProjectileType("InkCloud"); + break; + case 1: + inkType = mod.ProjectileType("InkCloud2"); + break; + default: + inkType = mod.ProjectileType("InkCloud3"); + break; + } + int inkID = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), inkType, 22, 7, Main.myPlayer); + Main.projectile[inkID].timeLeft += Main.rand.Next(-20, 25); + } + projectile.Kill(); + } + } +} diff --git a/Projectiles/Rogue/InkBombProjectile.png b/Projectiles/Rogue/InkBombProjectile.png new file mode 100644 index 0000000000..f8992d1d1c Binary files /dev/null and b/Projectiles/Rogue/InkBombProjectile.png differ diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs new file mode 100644 index 0000000000..48f0c5d8c8 --- /dev/null +++ b/Projectiles/Rogue/InkCloud.cs @@ -0,0 +1,46 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class InkCloud : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Cloud"); + } + + public override void SetDefaults() + { + projectile.width = 32; + projectile.height = 28; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft < 50) + projectile.alpha += 5; + if (projectile.timeLeft < 75) + projectile.velocity *= 0.95f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.friendly) + { + target.AddBuff(BuffID.Confused, 300); + } + } + } +} diff --git a/Projectiles/Rogue/InkCloud.png b/Projectiles/Rogue/InkCloud.png new file mode 100644 index 0000000000..7312f82b91 Binary files /dev/null and b/Projectiles/Rogue/InkCloud.png differ diff --git a/Projectiles/Rogue/InkCloud2.cs b/Projectiles/Rogue/InkCloud2.cs new file mode 100644 index 0000000000..e48b574a22 --- /dev/null +++ b/Projectiles/Rogue/InkCloud2.cs @@ -0,0 +1,46 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class InkCloud2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Cloud"); + } + + public override void SetDefaults() + { + projectile.width = 36; + projectile.height = 30; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft < 50) + projectile.alpha += 5; + if (projectile.timeLeft < 75) + projectile.velocity *= 0.95f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.friendly) + { + target.AddBuff(BuffID.Confused, 300); + } + } + } +} diff --git a/Projectiles/Rogue/InkCloud2.png b/Projectiles/Rogue/InkCloud2.png new file mode 100644 index 0000000000..515075a8b3 Binary files /dev/null and b/Projectiles/Rogue/InkCloud2.png differ diff --git a/Projectiles/Rogue/InkCloud3.cs b/Projectiles/Rogue/InkCloud3.cs new file mode 100644 index 0000000000..34952fb55e --- /dev/null +++ b/Projectiles/Rogue/InkCloud3.cs @@ -0,0 +1,46 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class InkCloud3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Ink Cloud"); + } + + public override void SetDefaults() + { + projectile.width = 30; + projectile.height = 24; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 100; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = -1; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft < 50) + projectile.alpha += 5; + if (projectile.timeLeft < 75) + projectile.velocity *= 0.95f; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (!target.friendly) + { + target.AddBuff(BuffID.Confused, 300); + } + } + } +} diff --git a/Projectiles/Rogue/InkCloud3.png b/Projectiles/Rogue/InkCloud3.png new file mode 100644 index 0000000000..f838f05c81 Binary files /dev/null and b/Projectiles/Rogue/InkCloud3.png differ diff --git a/Projectiles/Rogue/Knife.cs b/Projectiles/Rogue/Knife.cs index bbd0338782..47467a6a1f 100644 --- a/Projectiles/Rogue/Knife.cs +++ b/Projectiles/Rogue/Knife.cs @@ -1,3 +1,4 @@ +using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,8 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Knife"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } public override void SetDefaults() @@ -32,7 +35,7 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); } projectile.spriteDirection = projectile.direction = (projectile.velocity.X > 0).ToDirectionInt(); - projectile.rotation = projectile.velocity.ToRotation(); + projectile.rotation = projectile.velocity.ToRotation() + (projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); } public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) diff --git a/Projectiles/Rogue/MeteorFist.cs b/Projectiles/Rogue/MeteorFist.cs index 4f64536f4d..af5ab65cdf 100644 --- a/Projectiles/Rogue/MeteorFist.cs +++ b/Projectiles/Rogue/MeteorFist.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.friendly = true; projectile.penetrate = 1; projectile.timeLeft = 180; - projectile.GetGlobalProjectile(mod).rogue = true; + projectile.GetCalamityProj().rogue = true; } public override void AI() @@ -57,10 +57,11 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num249].noGravity = true; } } - if (Math.Abs(projectile.velocity.X) < 15f && Math.Abs(projectile.velocity.Y) < 15f) - { + + // Almost instantly accelerate to very high speed + if (projectile.velocity.Length() <= 23f) projectile.velocity *= 2f; - } + else if (Main.rand.NextBool(2)) { int num252 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, 6, 0f, 0f, 100, default, 0.5f); diff --git a/Projectiles/Rogue/MoonSigil.cs b/Projectiles/Rogue/MoonSigil.cs new file mode 100644 index 0000000000..2d26e87e69 --- /dev/null +++ b/Projectiles/Rogue/MoonSigil.cs @@ -0,0 +1,58 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Projectiles.Rogue +{ + public class MoonSigil : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Moon Sigil"); + } + + public override void SetDefaults() + { + projectile.width = 20; + projectile.height = 20; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 250; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 2; + Mod calamity = ModLoader.GetMod("CalamityMod"); + projectile.GetGlobalProjectile(calamity).rogue = true; + } + + public override void AI() + { + if (projectile.timeLeft < 25) { projectile.alpha += 10; } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Texture2D texture = mod.GetTexture("Projectiles/Rogue/MoonSigil"); + spriteBatch.Draw + ( + texture, + new Vector2 + ( + projectile.position.X - Main.screenPosition.X + projectile.width * 0.5f, + projectile.position.Y - Main.screenPosition.Y + projectile.height - 20 * 0.5f + ), + new Rectangle(0, 0, 20, 20), + Color.White, + projectile.rotation, + new Vector2(10, 10), + projectile.scale, + SpriteEffects.None, + 0f + ); + } + } +} diff --git a/Projectiles/Rogue/MoonSigil.png b/Projectiles/Rogue/MoonSigil.png new file mode 100644 index 0000000000..75d98fdbe5 Binary files /dev/null and b/Projectiles/Rogue/MoonSigil.png differ diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index 659d16d25a..8ae7a9ebcb 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -28,11 +28,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f; - if(projectile.spriteDirection == -1) - { - projectile.rotation -= 1.57f; - } + projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; } public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) @@ -49,10 +45,5 @@ namespace CalamityMod.Projectiles.Rogue Item.NewItem((int)projectile.position.X, (int)projectile.position.Y, projectile.width, projectile.height, mod.ItemType("PalladiumJavelin")); } } - - public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) - { - target.AddBuff(BuffID.BoneJavelin, 500); - } } } diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index 7d81336dc3..330f0adde8 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.extraUpdates = 1; projectile.GetGlobalProjectile(mod).rogue = true; } - + public override void AI() { CalamityPlayer modPlayer = Main.player[Main.myPlayer].GetCalamityPlayer(); @@ -38,8 +38,11 @@ namespace CalamityMod.Projectiles.Rogue projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 0.785f; Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 130, projectile.velocity.X * 0.25f, projectile.velocity.Y * 0.25f, 0, new Color(255, 255, 255), 0.85f); projectile.ai[0] += 1f; - if (projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) - lifesteal = true; + if (projectile.ai[0] == 1f && modPlayer.StealthStrikeAvailable()) + { + projectile.GetCalamityProj().stealthStrike = true; + lifesteal = true; + } if ((projectile.ai[0] %= 5f) == 0f) { int numProj = 2; diff --git a/Projectiles/Rogue/ScourgeVenomCloud.cs b/Projectiles/Rogue/ScourgeVenomCloud.cs index ccff03a1d2..0316c517ee 100644 --- a/Projectiles/Rogue/ScourgeVenomCloud.cs +++ b/Projectiles/Rogue/ScourgeVenomCloud.cs @@ -75,4 +75,4 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Venom, 240); } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs index 020ad2394c..b99e150e4d 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -13,8 +13,10 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Moist Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - + public override void SetDefaults() { projectile.width = 26; @@ -27,7 +29,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.timeLeft = 1200; projectile.GetGlobalProjectile(mod).rogue = true; } - + public override void AI() { if (Main.rand.Next(5) == 0) @@ -61,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num622].velocity *= 1f; } if (projectile.owner == Main.myPlayer) - { + { int num320 = Main.rand.Next(2, 6); int num3; for (int num321 = 0; num321 < num320; num321 = num3 + 1) @@ -81,4 +83,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs index 6da5236865..461bc85be5 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs @@ -13,8 +13,10 @@ namespace CalamityMod.Projectiles.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Stealthy Scourge"); + ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; + ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - + public override void SetDefaults() { projectile.width = 26; @@ -29,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue projectile.usesLocalNPCImmunity = true; projectile.localNPCHitCooldown = 60; } - + public override void AI() { if (Main.rand.Next(5) == 0 && projectile.ai[0] != 1f) @@ -177,7 +179,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) { - if (target.type != mod.NPCType("Cryogen") || target.type != mod.NPCType("Brimstone Elemental") || target.type != NPCID.SkeletronPrime) + if (target.type == mod.NPCType("Cryogen") || target.type == mod.NPCType("Brimstone Elemental") || target.type == NPCID.SkeletronPrime) { target.buffImmune[BuffID.Venom] = false; } @@ -197,7 +199,7 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[num622].velocity *= 1f; } if (projectile.owner == Main.myPlayer) - { + { int num320 = Main.rand.Next(2, 6); int num3; for (int num321 = 0; num321 < num320; num321 = num3 + 1) @@ -217,4 +219,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index 6f03cb8db7..25f7ce94ee 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Summon ProjectileID.Sets.MinionTargettingFeature[projectile.type] = true; Main.projFrames[projectile.type] = 3; } - + public override void SetDefaults() { projectile.width = 36; @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Summon projectile.minion = true; target = GetClosestNPCToTarget(maxDistToEnemy, false); } - + public int GetClosestNPCToTarget(float maxDistance, bool ignoreTiles) { int closestNPC = -1; @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Summon } return closestNPC; } - + public override void AI() { if (projectile.localAI[0] == 0f) @@ -278,7 +278,7 @@ namespace CalamityMod.Projectiles.Summon projectile.netUpdate = true; } } - } + } if (Vector2.Distance(player.Center, projectile.Center) <= 1400 & !returningBackToPlayer) //don't return to player if currently busy dealing with an enemy { if (enemyCheckTimer % 240 == 0 & enemyCheckTimer != 0) @@ -293,4 +293,4 @@ namespace CalamityMod.Projectiles.Summon return false; } } -} \ No newline at end of file +} diff --git a/Tiles/CharredOre.cs b/Tiles/CharredOre.cs index 30876bce64..3c048beb99 100644 --- a/Tiles/CharredOre.cs +++ b/Tiles/CharredOre.cs @@ -60,4 +60,4 @@ namespace CalamityMod.Tiles return false; } } -} \ No newline at end of file +} diff --git a/Tiles/FurnitureOccult/OccultStone.cs b/Tiles/FurnitureOccult/OccultStone.cs index 71ac71a725..3df5ba0c33 100644 --- a/Tiles/FurnitureOccult/OccultStone.cs +++ b/Tiles/FurnitureOccult/OccultStone.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Tiles.FurnitureOccult //Left if ( - CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && + CheckTile(Type, true, 1, 0, i, j) && CheckTile(Type, false, 1, 1, i, j) && CheckTile(Type, true, 0, 1, i, j) && (CheckTile(Type, true, -1, 1, i, j) || CheckTile(Type, false, -1, 0, i, j)) ) { diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index a0fa2d758e..fba4a9648d 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -356,6 +356,9 @@ namespace CalamityMod.Tiles case 107: item = "GiantClamBanner"; break; + case 108: + item = "PiggyBanner"; + break; default: return; } @@ -695,6 +698,9 @@ namespace CalamityMod.Tiles case 107: type = "GiantClam"; break; + case 108: + type = "Piggy"; + break; default: return; } diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 1d540e9ada..e6d30bdd8b 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 4c4857f285..33e11e93fb 100644 --- a/Utilities/CalamityUtils.cs +++ b/Utilities/CalamityUtils.cs @@ -1,4 +1,6 @@ using CalamityMod.CalPlayer; +using CalamityMod.NPCs; +using CalamityMod.Projectiles; using CalamityMod.World; using Microsoft.Xna.Framework; using System.Collections.Generic; @@ -20,7 +22,7 @@ namespace CalamityMod { case 1: return player.GetCalamityPlayer().ZoneAbyssLayer1; - + case 2: return player.GetCalamityPlayer().ZoneAbyssLayer2; @@ -38,6 +40,8 @@ namespace CalamityMod public static class CNPCUtils { + public static CalamityGlobalNPC GetCalamityNPC(this NPC npc) => npc.GetGlobalNPC(); + /// /// Allows you to set the lifeMax value of a NPC to different values based on the mode. Called instead of npc.lifeMax = X. /// @@ -66,7 +70,7 @@ namespace CalamityMod if (npc.boss) { double HPBoost = (double)Config.BossHealthPercentageBoost * 0.01; - npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); + npc.lifeMax += (int)((double)npc.lifeMax * HPBoost); } } /// @@ -106,6 +110,25 @@ namespace CalamityMod } return ClosestNPCAt(origin,maxDistanceToCheck); } + + /// + /// Crude anti-butcher logic based on % max health. + /// + /// The NPC attacked. + /// How much damage the attack would deal. + /// Whether or not the anti-butcher was triggered. + public static bool AntiButcher(NPC npc, ref double damage, float healthPercent) + { + if (damage <= npc.lifeMax * healthPercent) + return false; + damage = 0D; + return true; + } + } + + public static class CProjectileUtils + { + public static CalamityGlobalProjectile GetCalamityProj(this Projectile proj) => proj.GetGlobalProjectile(); } public static class CMiscUtils