diff --git a/Buffs/Potions/ShadowBuff.cs b/Buffs/Potions/ShadowBuff.cs new file mode 100644 index 0000000000..34e1da15ef --- /dev/null +++ b/Buffs/Potions/ShadowBuff.cs @@ -0,0 +1,24 @@ +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Potions +{ + public class ShadowBuff : ModBuff + { + public override void SetDefaults() + { + DisplayName.SetDefault("Shadow"); + Description.SetDefault("You're invisible, certain rogue weapons give and gain buffs, and stealth generation is boosted."); + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = false; + longerExpertDebuff = false; + } + + public override void Update(Player player, ref int buffIndex) + { + player.invis = true; + player.Calamity().shadow = true; + } + } +} diff --git a/Buffs/Potions/ShadowBuff.png b/Buffs/Potions/ShadowBuff.png new file mode 100644 index 0000000000..ed4141070a Binary files /dev/null and b/Buffs/Potions/ShadowBuff.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 4e301ff99f..be1476c699 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -720,6 +720,7 @@ namespace CalamityMod.CalPlayer public bool bounding = false; public bool triumph = false; public bool penumbra = false; + public bool shadow = false; public bool photosynthesis = false; public bool astralInjection = false; public bool gravityNormalizer = false; @@ -1670,6 +1671,7 @@ namespace CalamityMod.CalPlayer bounding = false; triumph = false; penumbra = false; + shadow = false; photosynthesis = false; astralInjection = false; gravityNormalizer = false; @@ -1999,6 +2001,7 @@ namespace CalamityMod.CalPlayer bounding = false; triumph = false; penumbra = false; + shadow = false; photosynthesis = false; astralInjection = false; gravityNormalizer = false; @@ -5964,7 +5967,6 @@ namespace CalamityMod.CalPlayer #endregion #region Can Hit - public override bool? CanHitNPC(Item item, NPC target) { if (camper && ((double)Math.Abs(player.velocity.X) > 0.05 || (double)Math.Abs(player.velocity.Y) > 0.05)) @@ -5982,7 +5984,6 @@ namespace CalamityMod.CalPlayer } return null; } - #endregion #region Fishing @@ -6044,7 +6045,7 @@ namespace CalamityMod.CalPlayer num79 *= num80; float speedX4 = num78 + (float)Main.rand.Next(-30, 31) * 0.02f; float speedY5 = num79 + (float)Main.rand.Next(-30, 31) * 0.02f; - int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)((float)damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15)); + int p = Projectile.NewProjectile(vector2.X, vector2.Y, speedX4, speedY5, type, (int)(damage * 0.15f), (int)(knockBack), player.whoAmI, 0f, (float)Main.rand.Next(15)); Main.projectile[p].knockBack /= 2; Main.projectile[p].Calamity().forceRogue = true; //in case melee/rogue variants bug out if (StealthStrikeAvailable()) @@ -9459,6 +9460,11 @@ namespace CalamityMod.CalPlayer stealthGenStandstill += 0.08f; stealthGenMoving += 0.08f; } + if (shadow) + { + stealthGenStandstill += 0.1f; + stealthGenMoving += 0.1f; + } if (etherealExtorter && Main.moonPhase == 3) // 3 = Waning Crescent stealthGenStandstill += 0.15f; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 081c9564a1..2ebcda8d11 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2332,6 +2332,12 @@ namespace CalamityMod.CalPlayer player.moveSpeed += 0.05f; } + if (modPlayer.shadow) + { + if (player.FindBuffIndex(BuffID.Invisibility) > -1) + player.ClearBuff(BuffID.Invisibility); + } + if (modPlayer.irradiated) { if (modPlayer.boomerDukeLore) diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 2177191869..6def603cb8 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -769,6 +769,10 @@ namespace CalamityMod.Items } return true; } + if (item.type == ItemID.InvisibilityPotion && player.FindBuffIndex(ModContent.BuffType()) > -1) + { + return false; + } if ((item.type == ItemID.RegenerationPotion || item.type == ItemID.LifeforcePotion) && player.FindBuffIndex(ModContent.BuffType()) > -1) { return false; diff --git a/Items/Potions/ShadowPotion.cs b/Items/Potions/ShadowPotion.cs new file mode 100644 index 0000000000..110a7ae0c2 --- /dev/null +++ b/Items/Potions/ShadowPotion.cs @@ -0,0 +1,55 @@ +using CalamityMod.Buffs.Potions; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class ShadowPotion : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Shadow Potion"); + Tooltip.SetDefault("Causes the player to disappear while not attacking\n" + + "Holding different types of rogue weapons give the player boosts\n" + + "Different types of rogue weapons spawn different projectiles on hit\n" + + "Stealth generation is increased by 10%"); + } + + public override void SetDefaults() + { + item.width = 28; + item.height = 18; + item.useTurn = true; + item.maxStack = 30; + item.rare = 3; + item.useAnimation = 17; + item.useTime = 17; + item.useStyle = 2; + item.UseSound = SoundID.Item3; + item.consumable = true; + item.buffType = ModContent.BuffType(); + item.buffTime = 18000; //5 minutes + item.value = Item.buyPrice(0, 2, 0, 0); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ItemID.InvisibilityPotion); + recipe.AddIngredient(ItemID.BottledWater); + recipe.AddTile(TileID.Bottles); + recipe.SetResult(this, 2); + recipe.AddRecipe(); + recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddIngredient(ItemID.InvisibilityPotion); + recipe.AddTile(TileID.AlchemyTable); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +} diff --git a/Items/Potions/ShadowPotion.png b/Items/Potions/ShadowPotion.png new file mode 100644 index 0000000000..e1bae342cf Binary files /dev/null and b/Items/Potions/ShadowPotion.png differ diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 733c1d5776..6607800c7f 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1382,6 +1382,76 @@ namespace CalamityMod.Projectiles } target.AddBuff(BuffID.Venom, 240); } + + if (modPlayer.shadow) + { + if (CalamityMod.javelinProjList.Contains(projectile.type)) + { + int randrot = Main.rand.Next(-30, 391); + Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(randrot)); + Projectile.NewProjectile(projectile.Center, SoulSpeed, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.1, 60), 3f, projectile.owner, 0f, 0f); + } + if (CalamityMod.spikyBallProjList.Contains(projectile.type)) + { + int scythe = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); + Main.projectile[scythe].usesLocalNPCImmunity = true; + Main.projectile[scythe].localNPCHitCooldown = 10; + Main.projectile[scythe].penetrate = 2; + } + if (CalamityMod.daggerProjList.Contains(projectile.type)) + { + Vector2 shardVelocity = new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)); + shardVelocity.Normalize(); + shardVelocity *= 5f; + int shard = Projectile.NewProjectile(projectile.Center, shardVelocity, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.15, 60), 0f, projectile.owner); + Main.projectile[shard].timeLeft = 150; + } + if (CalamityMod.boomerangProjList.Contains(projectile.type)) + { + int spiritDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.2, 60); + int[] numArray1 = new int[Main.maxNPCs]; + int maxValue1 = 0; + int maxValue2 = 0; + for (int index = 0; index < Main.maxNPCs; ++index) + { + if (Main.npc[index].CanBeChasedBy((object)projectile, false)) + { + float num2 = Math.Abs(Main.npc[index].Center.X - projectile.Center.X) + Math.Abs(Main.npc[index].Center.Y - projectile.Center.Y); + if (num2 < 800f) + { + if (Collision.CanHit(projectile.position, 1, 1, Main.npc[index].position, Main.npc[index].width, Main.npc[index].height) && num2 > 50f) + { + numArray1[maxValue2] = index; + ++maxValue2; + } + else if (maxValue2 == 0) + { + numArray1[maxValue1] = index; + ++maxValue1; + } + } + } + } + if (maxValue1 == 0 && maxValue2 == 0) + return; + int num3 = maxValue2 <= 0 ? numArray1[Main.rand.Next(maxValue1)] : numArray1[Main.rand.Next(maxValue2)]; + double num4 = 4.0; + float num5 = (float)Main.rand.Next(-100, 101); + float num6 = (float)Main.rand.Next(-100, 101); + double num7 = Math.Sqrt((double)num5 * (double)num5 + (double)num6 * (double)num6); + float num8 = (float)(num4 / num7); + float SpeedX = num5 * num8; + float SpeedY = num6 * num8; + int ghost = Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, SpeedX, SpeedY, ProjectileID.SpectreWrath, spiritDamage, 0f, projectile.owner, (float)num3, 0f); + Main.projectile[ghost].Calamity().forceRogue = true; + Main.projectile[ghost].penetrate = 1; + } + if (CalamityMod.flaskBombProjList.Contains(projectile.type)) + { + int blackhole = Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), CalamityUtils.DamageSoftCap(projectile.damage * 0.05, 60), 3f, projectile.owner, 0f, 0f); + Main.projectile[blackhole].Center = projectile.Center; + } + } } else if (projectile.minion || projectile.sentry || CalamityMod.projectileMinionList.Contains(projectile.type) || ProjectileID.Sets.MinionShot[projectile.type] || ProjectileID.Sets.SentryShot[projectile.type]) { diff --git a/Projectiles/Magic/AuroraAustralis.cs b/Projectiles/Magic/AuroraAustralis.cs index efe31ad461..aef879aa5f 100644 --- a/Projectiles/Magic/AuroraAustralis.cs +++ b/Projectiles/Magic/AuroraAustralis.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Projectiles.Magic { private static float CosFrequency = 0.05f; private static float CosAmplitude = 0.008f; - private static float RotationIncrement = 0.26f; public int[] dustTypes = new int[] { ModContent.DustType(), @@ -36,7 +35,6 @@ namespace CalamityMod.Projectiles.Magic CosFrequency = 0.15f; CosAmplitude = 0.06f; - RotationIncrement = 0.26f; } public override void AI() diff --git a/Projectiles/Rogue/CosmicScythe.cs b/Projectiles/Rogue/CosmicScythe.cs index f280bc3277..d0b1149701 100644 --- a/Projectiles/Rogue/CosmicScythe.cs +++ b/Projectiles/Rogue/CosmicScythe.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Rogue { if (projectile.timeLeft > 350) projectile.velocity *= 1.06f; - projectile.damage = (int) ((double)originalDamage * 1.25); + projectile.damage = (int)(originalDamage * 1.25); CalamityGlobalProjectile.HomeInOnNPC(projectile, true, 1500f, 20f, 20f); } } diff --git a/Projectiles/Rogue/ShadowBlackhole.cs b/Projectiles/Rogue/ShadowBlackhole.cs new file mode 100644 index 0000000000..adee13f4bf --- /dev/null +++ b/Projectiles/Rogue/ShadowBlackhole.cs @@ -0,0 +1,61 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class ShadowBlackhole : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Blackhole"); + Main.projFrames[projectile.type] = 7; + } + + public override void SetDefaults() + { + projectile.width = 88; + projectile.height = 90; + projectile.friendly = true; + projectile.penetrate = -1; + projectile.Calamity().rogue = true; + projectile.tileCollide = false; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 20; + } + + public override void AI() + { + // Update animation + if (projectile.timeLeft % 5 == 0) + { + projectile.frame++; + } + if (projectile.frame >= Main.projFrames[projectile.type]) + { + projectile.frame = 0; + } + + projectile.ai[0]++; + if (projectile.ai[0] > 120f) + { + projectile.scale *= 0.95f; + projectile.Opacity *= 0.95f; + projectile.height = (int)(projectile.height * projectile.scale); + projectile.width = (int)(projectile.width * projectile.scale); + } + if (projectile.scale <= 0.05f) + { + projectile.Kill(); + } + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + target.AddBuff(BuffID.Blackout, 300); + } + } +} diff --git a/Projectiles/Rogue/ShadowBlackhole.png b/Projectiles/Rogue/ShadowBlackhole.png new file mode 100644 index 0000000000..e8c92cab14 Binary files /dev/null and b/Projectiles/Rogue/ShadowBlackhole.png differ