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 22828c1c11..97d7e90159 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -85,7 +85,8 @@ 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; @@ -296,11 +297,18 @@ namespace CalamityMod.CalPlayer 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 oldDie = 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; @@ -997,7 +1005,15 @@ namespace CalamityMod.CalPlayer weakPetrification = false; - shadowflame = false; + inkBomb = false; + inkBombCooldown = false; + darkGodSheath = false; + abyssalMirror = false; + abyssalMirrorCooldown = false; + eclipseMirror = false; + eclipseMirrorCooldown = false; + + shadowflame = false; wDeath = false; lethalLavaBurn = false; aCrunch = false; @@ -1217,11 +1233,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; @@ -4629,10 +4648,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 + @@ -4710,12 +4767,75 @@ 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++) + { + //Get which projectile to use + int projType = Main.rand.Next(0, 3); + int lumenylType; + switch (projType) + { + case 0: + lumenylType = mod.ProjectileType("AbyssalMirrorProjectile1"); + break; + case 1: + lumenylType = mod.ProjectileType("AbyssalMirrorProjectile2"); + break; + default: + lumenylType = mod.ProjectileType("AbyssalMirrorProjectile3"); + break; + } + int lumenyl = Projectile.NewProjectile(player.Center.X, player.Center.Y, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), lumenylType, 55, 0, player.whoAmI); + Main.projectile[lumenyl].rotation = Main.rand.NextFloat(0, 360); + } + } + } + + 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")) { @@ -7333,8 +7453,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) { @@ -9301,22 +9434,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() { @@ -10467,6 +10623,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/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/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/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/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/CalamityCustomThrowingDamage/BlastBarrel.cs b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs index 428885f2c0..acc3d01076 100644 --- a/Items/CalamityCustomThrowingDamage/BlastBarrel.cs +++ b/Items/CalamityCustomThrowingDamage/BlastBarrel.cs @@ -44,4 +44,4 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage return false; } } -} \ No newline at end of file +} diff --git a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs index e85a711d5d..da5acfa910 100644 --- a/Items/CalamityCustomThrowingDamage/EclipsesFall.cs +++ b/Items/CalamityCustomThrowingDamage/EclipsesFall.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Items.CalamityCustomThrowingDamage } return false; } - + public override void AddRecipes() { ModRecipe recipe = new ModRecipe(mod); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 61db76853f..f25bbaa42f 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -1805,7 +1805,7 @@ namespace CalamityMod.Items if (item.type == ItemID.WormScarf) player.endurance -= 0.07f; - + if (item.type == ItemID.RoyalGel) modPlayer.royalGel = true; diff --git a/Items/Weapons/Astral/AstralBlaster.cs b/Items/Weapons/Astral/AstralBlaster.cs index e0e664e638..9ec2d6e27c 100644 --- a/Items/Weapons/Astral/AstralBlaster.cs +++ b/Items/Weapons/Astral/AstralBlaster.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Astral item.shoot = mod.ProjectileType("AstralRound"); item.useAmmo = 97; } - + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); diff --git a/Items/Weapons/Bumblebirb/GoldenEagle.cs b/Items/Weapons/Bumblebirb/GoldenEagle.cs index 1cafff97d5..35395959b8 100644 --- a/Items/Weapons/Bumblebirb/GoldenEagle.cs +++ b/Items/Weapons/Bumblebirb/GoldenEagle.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Bumblebirb item.useAmmo = 97; item.GetGlobalItem(mod).postMoonLordRarity = 12; } - + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); diff --git a/Items/Weapons/Crabulon/Fungicide.cs b/Items/Weapons/Crabulon/Fungicide.cs index ae84df3190..331f5660e7 100644 --- a/Items/Weapons/Crabulon/Fungicide.cs +++ b/Items/Weapons/Crabulon/Fungicide.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Crabulon item.shootSpeed = 14f; item.useAmmo = 97; } - + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); 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/Perforators/Eviscerator.cs b/Items/Weapons/Perforators/Eviscerator.cs index 7a6f417810..3b13d7d8df 100644 --- a/Items/Weapons/Perforators/Eviscerator.cs +++ b/Items/Weapons/Perforators/Eviscerator.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Perforators item.shootSpeed = 22f; item.useAmmo = 97; } - + public override Vector2? HoldoutOffset() { return new Vector2(-7, 0); diff --git a/Items/Weapons/SDFMG.cs b/Items/Weapons/SDFMG.cs index d173fdd129..f163496208 100644 --- a/Items/Weapons/SDFMG.cs +++ b/Items/Weapons/SDFMG.cs @@ -39,12 +39,12 @@ namespace CalamityMod.Items.Weapons item.useAmmo = 97; 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 1912cd586c..158c55d8d9 100644 --- a/Items/Weapons/SlagMagnum.cs +++ b/Items/Weapons/SlagMagnum.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons item.shoot = mod.ProjectileType("SlagRound"); item.useAmmo = 97; } - + public override Vector2? HoldoutOffset() { return new Vector2(-10, 0); diff --git a/Items/Weapons/SlimeGod/GunkShot.cs b/Items/Weapons/SlimeGod/GunkShot.cs index 5f22b4f536..3035334cef 100644 --- a/Items/Weapons/SlimeGod/GunkShot.cs +++ b/Items/Weapons/SlimeGod/GunkShot.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.SlimeGod item.shootSpeed = 5f; item.useAmmo = 97; } - + public override Vector2? HoldoutOffset() { return new Vector2(-5, 0); diff --git a/Items/Weapons/SlimeGod/OverloadedBlaster.cs b/Items/Weapons/SlimeGod/OverloadedBlaster.cs index 0be0a3de6d..23bab11b5f 100644 --- a/Items/Weapons/SlimeGod/OverloadedBlaster.cs +++ b/Items/Weapons/SlimeGod/OverloadedBlaster.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.SlimeGod item.shoot = mod.ProjectileType("SlimeBolt"); item.useAmmo = 23; } - + public override Vector2? HoldoutOffset() { return new Vector2(-4, 0); 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/NPCs/AbyssNPCs/BobbitWormHead.cs b/NPCs/AbyssNPCs/BobbitWormHead.cs index 1a674081b3..c027db7832 100644 --- a/NPCs/AbyssNPCs/BobbitWormHead.cs +++ b/NPCs/AbyssNPCs/BobbitWormHead.cs @@ -62,10 +62,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..750b6e7f0d 100644 --- a/NPCs/AbyssNPCs/ColossalSquid.cs +++ b/NPCs/AbyssNPCs/ColossalSquid.cs @@ -321,10 +321,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/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/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/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/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/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 214b6ff395..fa7439d8be 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; @@ -17,9 +19,7 @@ namespace CalamityMod.NPCs public class CalamityGlobalNPC : GlobalNPC { #region Variables - // Damage reduction - private float protection = 0f; - private float defProtection = 0f; + private float DR = 0f; // Iron Heart private int ironHeartDamage = 0; @@ -564,11 +564,6 @@ namespace CalamityMod.NPCs { IronHeartChanges(npc); } - - if (protection > 0f) - { - defProtection = protection; - } } #endregion @@ -834,30 +829,30 @@ namespace CalamityMod.NPCs 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; + DR = 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; + DR = 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; + DR = 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; + DR = 0.25f; } else if (npc.type == thorium.NPCType("Omnicide")) { - protection = 0.3f; + DR = 0.3f; } else if (npc.type == thorium.NPCType("Abyssion")) { - protection = 0.35f; + DR = 0.35f; } } } @@ -867,7 +862,7 @@ namespace CalamityMod.NPCs 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; + DR = 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") || @@ -875,7 +870,7 @@ namespace CalamityMod.NPCs 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; + DR = 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") || @@ -888,39 +883,39 @@ namespace CalamityMod.NPCs 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; + DR = 0.15f; } else if (npc.type == mod.NPCType("AstrumDeusProbe3") || npc.type == mod.NPCType("PlaguebringerShade") || npc.type == mod.NPCType("BlindedAngler")) { - protection = 0.2f; + DR = 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; + DR = 0.25f; } else if (npc.type == mod.NPCType("ProvSpawnOffense") || npc.type == mod.NPCType("GiantClam")) { - protection = 0.3f; + DR = 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; + DR = 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; + DR = 0.4f; } else if (npc.type == mod.NPCType("ArmoredDiggerTail")) { - protection = 0.45f; + DR = 0.45f; } else if (npc.type == mod.NPCType("SirenIce")) { - protection = 0.5f; + DR = 0.5f; } else { @@ -939,7 +934,7 @@ namespace CalamityMod.NPCs case NPCID.CultistBoss: case NPCID.Crab: case NPCID.SeaSnail: - protection = 0.05f; + DR = 0.05f; break; case NPCID.Antlion: @@ -961,7 +956,7 @@ namespace CalamityMod.NPCs case NPCID.ArmoredViking: case NPCID.DD2Betsy: case NPCID.DD2OgreT2: - protection = 0.1f; + DR = 0.1f; break; case NPCID.ElfCopter: @@ -969,7 +964,7 @@ namespace CalamityMod.NPCs case NPCID.ArmoredSkeleton: case NPCID.PirateShipCannon: case NPCID.DD2OgreT3: - protection = 0.15f; + DR = 0.15f; break; case NPCID.Retinazer: @@ -1015,7 +1010,7 @@ namespace CalamityMod.NPCs case NPCID.GiantShelly: case NPCID.GiantShelly2: case NPCID.Mothron: - protection = 0.2f; + DR = 0.2f; break; case NPCID.PrimeSaw: @@ -1028,7 +1023,7 @@ namespace CalamityMod.NPCs case NPCID.GolemFistRight: case NPCID.GolemHead: case NPCID.GolemHeadFree: - protection = 0.25f; + DR = 0.25f; break; case NPCID.Mimic: @@ -1037,7 +1032,7 @@ namespace CalamityMod.NPCs case NPCID.BigMimicCrimson: case NPCID.BigMimicHallow: case NPCID.BigMimicJungle: - protection = 0.3f; + DR = 0.3f; break; case NPCID.GiantTortoise: @@ -1045,24 +1040,24 @@ namespace CalamityMod.NPCs case NPCID.SantaNK1: case NPCID.MartianWalker: case NPCID.TheDestroyerTail: - protection = 0.35f; + DR = 0.35f; break; case NPCID.DeadlySphere: - protection = 0.4f; + DR = 0.4f; break; case NPCID.Paladin: - protection = 0.45f; + DR = 0.45f; break; case NPCID.WallofFlesh: case NPCID.MothronEgg: - protection = 0.5f; + DR = 0.5f; break; case NPCID.DungeonGuardian: - protection = 0.999999f; + DR = 0.999999f; break; default: @@ -1351,6 +1346,7 @@ 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) { + // 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)) @@ -1358,99 +1354,83 @@ namespace CalamityMod.NPCs 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; - } - } - - 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; + + float effectiveDR = DR; + if (marked) + effectiveDR *= 0.5f; + if (npc.betsysCurse) + effectiveDR *= 0.66f; + if (wCleave) + effectiveDR *= 0.75f; + + // Ichor and Cursed Flames are mutually exclusive + if (npc.ichor) + effectiveDR *= 0.75f; + else if (npc.onFire2) + effectiveDR *= 0.8f; + + // 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; + } + #endregion + + #region Boss Head Slot + public override void BossHeadSlot(NPC npc, ref int index) { if (CalamityWorld.revenge) { @@ -2564,7 +2544,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/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/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/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/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/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/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/Rogue/AbyssalMirrorProjectile1.cs b/Projectiles/Rogue/AbyssalMirrorProjectile1.cs new file mode 100644 index 0000000000..5c9e704a5f --- /dev/null +++ b/Projectiles/Rogue/AbyssalMirrorProjectile1.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AbyssalMirrorProjectile1 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenyl Fluid"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 50; + 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 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/AbyssalMirrorProjectile1.png b/Projectiles/Rogue/AbyssalMirrorProjectile1.png new file mode 100644 index 0000000000..7fed7e0043 Binary files /dev/null and b/Projectiles/Rogue/AbyssalMirrorProjectile1.png differ diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile2.cs b/Projectiles/Rogue/AbyssalMirrorProjectile2.cs new file mode 100644 index 0000000000..44d911d0a1 --- /dev/null +++ b/Projectiles/Rogue/AbyssalMirrorProjectile2.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AbyssalMirrorProjectile2 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenyl Fluid"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 50; + 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 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/AbyssalMirrorProjectile2.png b/Projectiles/Rogue/AbyssalMirrorProjectile2.png new file mode 100644 index 0000000000..26516f9035 Binary files /dev/null and b/Projectiles/Rogue/AbyssalMirrorProjectile2.png differ diff --git a/Projectiles/Rogue/AbyssalMirrorProjectile3.cs b/Projectiles/Rogue/AbyssalMirrorProjectile3.cs new file mode 100644 index 0000000000..80e28ccd17 --- /dev/null +++ b/Projectiles/Rogue/AbyssalMirrorProjectile3.cs @@ -0,0 +1,43 @@ +using Terraria; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; + +namespace CalamityMod.Projectiles.Rogue +{ + public class AbyssalMirrorProjectile3 : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Lumenyl Fluid"); + } + + public override void SetDefaults() + { + projectile.width = 12; + projectile.height = 12; + projectile.friendly = true; + projectile.alpha = 0; + projectile.penetrate = -1; + projectile.tileCollide = true; + projectile.ignoreWater = true; + projectile.timeLeft = 50; + 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 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/AbyssalMirrorProjectile3.png b/Projectiles/Rogue/AbyssalMirrorProjectile3.png new file mode 100644 index 0000000000..bab50601a9 Binary files /dev/null and b/Projectiles/Rogue/AbyssalMirrorProjectile3.png differ diff --git a/Projectiles/Rogue/BlastBarrelProjectile.cs b/Projectiles/Rogue/BlastBarrelProjectile.cs index 7b063779eb..586e2b240a 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"); @@ -78,7 +78,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 +97,4 @@ namespace CalamityMod.Projectiles.Rogue return false; } } -} \ No newline at end of file +} 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/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 17e48c4f31..27c71c199c 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -15,7 +15,7 @@ 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"); @@ -36,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/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/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 fcf715725f..b99e150e4d 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasProjectile.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - + public override void SetDefaults() { projectile.width = 26; @@ -29,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) @@ -63,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) @@ -83,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 39982291dc..018105df32 100644 --- a/Projectiles/Rogue/ScourgeoftheSeasStealth.cs +++ b/Projectiles/Rogue/ScourgeoftheSeasStealth.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Projectiles.Rogue ProjectileID.Sets.TrailCacheLength[projectile.type] = 6; ProjectileID.Sets.TrailingMode[projectile.type] = 0; } - + public override void SetDefaults() { projectile.width = 26; @@ -31,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) @@ -199,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) @@ -219,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/Utilities/CalamityUtils.cs b/Utilities/CalamityUtils.cs index 4c4857f285..f18118f3ea 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); } } /// @@ -108,6 +112,11 @@ namespace CalamityMod } } + public static class CProjectileUtils + { + public static CalamityGlobalProjectile GetCalamityProj(this Projectile proj) => proj.GetGlobalProjectile(); + } + public static class CMiscUtils { public static void AddWithCondition(this List list, T type, bool condition)