From 0e34bab94fa174280d0a3e3fcaea4da024784ec8 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 16 May 2020 15:56:56 -0400 Subject: [PATCH] added the shadow potion --- Buffs/Potions/ShadowBuff.cs | 24 ++++++++ Buffs/Potions/ShadowBuff.png | Bin 0 -> 531 bytes CalPlayer/CalamityPlayer.cs | 12 +++- CalPlayer/CalamityPlayerMiscEffects.cs | 6 ++ Items/CalamityGlobalItem.cs | 4 ++ Items/Potions/ShadowPotion.cs | 55 +++++++++++++++++++ Items/Potions/ShadowPotion.png | Bin 0 -> 566 bytes Projectiles/CalamityGlobalProjectile.cs | 70 ++++++++++++++++++++++++ Projectiles/Magic/AuroraAustralis.cs | 2 - Projectiles/Rogue/CosmicScythe.cs | 2 +- Projectiles/Rogue/ShadowBlackhole.cs | 61 +++++++++++++++++++++ Projectiles/Rogue/ShadowBlackhole.png | Bin 0 -> 1676 bytes 12 files changed, 230 insertions(+), 6 deletions(-) create mode 100644 Buffs/Potions/ShadowBuff.cs create mode 100644 Buffs/Potions/ShadowBuff.png create mode 100644 Items/Potions/ShadowPotion.cs create mode 100644 Items/Potions/ShadowPotion.png create mode 100644 Projectiles/Rogue/ShadowBlackhole.cs create mode 100644 Projectiles/Rogue/ShadowBlackhole.png 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 0000000000000000000000000000000000000000..ed4141070aa03265f31a77138830db4b303418b4 GIT binary patch literal 531 zcmV+u0_^>XP)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00Ci1L_t(o!{wJfPQySDh2QdLgdznR zM2aX)8Y<2}$1%7C2cY5>93vfPaFv?Mk|~HoguFz-6zd1tVK+7il8N$~csIKanf(vlg`i0$-gEXSI>N`)DT$ed{WK5c7|DSTo0XK|FPNk+RQ@| zdI-dvUnIK#fRQZ#0G-3I)2wu4u9B|TpW1nl1f`F_Po2+7za}`IBp4?~LJxt#!Mh`1 zUHh_oL&J?EB3n(4^lw*GJ&-jlX39 z0C*@~|0IEo^OZ*%0gC%I_wUcWz!pmb$#VhcrFP-PmC{EbMk3~z)z3Ch$4$=l5#Smx z?+0{{wY)htIhH4?sFvgw0ofSCOL0000IbVXQnMOaBjI!|(GWo~p~bZKvH V05ODE?C$^o002ovPDHLkV1mWZ-&X(t literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..e1bae342cfff839adf30b6c46d58dc8c883362ff GIT binary patch literal 566 zcmV-60?GY}P)Px#AY({UO#lFTCIA3{ga82g0001h=l}q9FaQARU;qF* zm;eA5aGbhPJOBUy24YJ`L;(K){{a7>y{D4^00D$aL_t(Y$Gz0OZWBQmh2dutTd~Q; z@gf|>{1gy@1QkSr0xG)HTp5?Z6;P+6Lx^-V6cIucAtZsUNt}2s+bo4`@UBd7;mv90 zM`uRwd`I5|a(c4NCskE?oAz5BqORL~Z5P_Y}UOGuSf5QH+!PGRz zdUQSj&)1sZ&Cg-&T4@hFuHMLy7T+oPG>vNZ^6+$~3yUKRD zJt$u?VV?A35@+`JWy$}g`S)_OaT_GPZVK!5HE^q2p6P;}&K?Tvls~^srM#3OomGYZ zHopNnqV=-F@#v`?*IS*07*qoM6N<$ Ef~Th($ literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..e8c92cab14278cf363afe741eb2599b9a878fd35 GIT binary patch literal 1676 zcmZ9M4>;3#9LImv$fR{viCW4T&RkOZqe)#DHe5ME=!N zl5`svPB)shBoFC2eL&o{--*K@hy zT0;nemJ_|){XriLL5oir=z~%3Z9*vM5UhPZ`yi+?W7)?@JuqK%(%;h+lC)ulz+@xS z%ijlr&R9cGLLvmsfL94`ASliOg47WZgwKVbHSB`l_wNQD^bdM_xU+MYHUeRh>c5SBqaf{7)KA3r6*&DZ1{Th$nG%~3`wG4##ba88> z1Lw?N$@`B-oEp`azPGL36ee>pIUgx3!=Y)I#~gwCI9q`cUPM3u8ALmyL2FR(fs6=j1#(}D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