diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index 8a1bed0f1c..87c8f2f8d0 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -47,6 +47,17 @@ namespace CalamityMod.Buffs } } + public override void Update(int type, NPC npc, ref int buffIndex) + { + if (type == BuffID.Webbed) + { + if (npc.Calamity().webbed < npc.buffTime[buffIndex]) + npc.Calamity().webbed = npc.buffTime[buffIndex]; + npc.DelBuff(buffIndex); + buffIndex--; + } + } + public override void ModifyBuffTip(int type, ref string tip, ref int rare) { if (type == BuffID.NebulaUpDmg1) diff --git a/Items/Weapons/Rogue/WebBall.cs b/Items/Weapons/Rogue/WebBall.cs new file mode 100644 index 0000000000..7351e1fa8b --- /dev/null +++ b/Items/Weapons/Rogue/WebBall.cs @@ -0,0 +1,59 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class WebBall : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Web Ball"); + Tooltip.SetDefault(@"Throws a web-covered ball that covers enemies in cobwebs to slow them down +Stealth strikes slow enemies down longer"); + } + + public override void SafeSetDefaults() + { + item.width = 20; + item.damage = 12; + item.noMelee = true; + item.noUseGraphic = true; + item.maxStack = 999; + item.consumable = true; + item.useAnimation = 20; + item.useStyle = 1; + item.useTime = 20; + item.knockBack = 3f; + item.UseSound = SoundID.Item1; + item.height = 18; + item.value = Item.buyPrice(0, 0, 0, 30); + item.rare = 0; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 4f; + item.Calamity().rogue = true; + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike + { + int proj = Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, item.damage, item.knockBack, player.whoAmI, 0f, 0f); + Main.projectile[proj].Calamity().stealthStrike = true; + return false; + } + return true; + } + + /*public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.Cobweb, 3); + recipe.SetResult(this); + recipe.AddRecipe(); + }*/ + } +} diff --git a/Items/Weapons/Rogue/WebBall.png b/Items/Weapons/Rogue/WebBall.png new file mode 100644 index 0000000000..3640d6596e Binary files /dev/null and b/Items/Weapons/Rogue/WebBall.png differ diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index a47d4f3bd5..c1804281c8 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -95,6 +95,7 @@ namespace CalamityMod.NPCs public int tSad = 0; public int eFreeze = 0; public int silvaStun = 0; + public int webbed = 0; public int yellowCandle = 0; public int pearlAura = 0; public int wCleave = 0; @@ -605,6 +606,7 @@ namespace CalamityMod.NPCs npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; npc.buffImmune[ModContent.BuffType()] = true; + npc.buffImmune[BuffID.Webbed] = true; } if (DestroyerIDs.Contains(npc.type) || npc.type == NPCID.DD2EterniaCrystal || npc.townNPC) @@ -2111,6 +2113,8 @@ namespace CalamityMod.NPCs eFreeze--; if (silvaStun > 0) silvaStun--; + if (webbed > 0) + webbed--; if (yellowCandle > 0) yellowCandle--; if (pearlAura > 0) @@ -2167,7 +2171,7 @@ namespace CalamityMod.NPCs { if (silvaStun > 0) npc.velocity = Vector2.Zero; - else if (timeSlow > 0) + else if (timeSlow > 0 || webbed > 0) npc.velocity *= 0.85f; } } @@ -3089,6 +3093,21 @@ namespace CalamityMod.NPCs } } } + if (webbed > 0) + { + if (Main.rand.Next(5) < 4) + { + int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, 30, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1.1f; + Main.dust[dust].velocity.Y += 0.25f; + if (Main.rand.NextBool(2)) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.5f; + } + } + } if (gState > 0 || eFreeze > 0) { diff --git a/Projectiles/Rogue/WebBallBol.cs b/Projectiles/Rogue/WebBallBol.cs new file mode 100644 index 0000000000..28106959aa --- /dev/null +++ b/Projectiles/Rogue/WebBallBol.cs @@ -0,0 +1,48 @@ +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class WebBallBol : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Web Ball"); + } + + public override void SetDefaults() + { + projectile.width = 18; + projectile.height = 18; + projectile.friendly = true; + projectile.penetrate = 3; + projectile.timeLeft = 300; + projectile.Calamity().rogue = true; + projectile.aiStyle = 14; + } + + public override void AI() + { + if (Main.rand.NextBool(12)) + { + Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 30, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f); + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (projectile.Calamity().stealthStrike == true) + { + target.AddBuff(BuffID.Webbed, 180); + } + else + { + target.AddBuff(BuffID.Webbed, 30); + } + } + } +} + diff --git a/Projectiles/Rogue/WebBallBol.png b/Projectiles/Rogue/WebBallBol.png new file mode 100644 index 0000000000..3640d6596e Binary files /dev/null and b/Projectiles/Rogue/WebBallBol.png differ