From 85aaa0872173af138eae5ecc4398edf2cd273906 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Sat, 7 Dec 2019 18:49:07 -0500 Subject: [PATCH] added bouncy spiky balls (unobtainable) --- CalamityMod.cs | 2 + Items/Weapons/Rogue/BouncySpikyBall.cs | 62 +++++++++++++ Items/Weapons/Rogue/BouncySpikyBall.png | Bin 0 -> 301 bytes Projectiles/Rogue/BouncyBol.cs | 115 ++++++++++++++++++++++++ Projectiles/Rogue/BouncyBol.png | Bin 0 -> 301 bytes 5 files changed, 179 insertions(+) create mode 100644 Items/Weapons/Rogue/BouncySpikyBall.cs create mode 100644 Items/Weapons/Rogue/BouncySpikyBall.png create mode 100644 Projectiles/Rogue/BouncyBol.cs create mode 100644 Projectiles/Rogue/BouncyBol.png diff --git a/CalamityMod.cs b/CalamityMod.cs index 660aa7d041..b80626c1a1 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1959,6 +1959,7 @@ namespace CalamityMod spikyBallList = new List() { + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1969,6 +1970,7 @@ namespace CalamityMod spikyBallProjList = new List() { + ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs new file mode 100644 index 0000000000..93981d333d --- /dev/null +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -0,0 +1,62 @@ +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Rogue +{ + public class BouncySpikyBall : RogueWeapon + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bouncy Spiky Ball"); + Tooltip.SetDefault(@"Throws a very bouncy ball that richochets off walls and enemies +Receives a small boost in damage and velocity after bouncing off an enemy +Stealth strikes provide a bigger boost after richocheting"); + } + + public override void SafeSetDefaults() + { + item.width = 14; + item.damage = 10; + item.noMelee = true; + item.noUseGraphic = true; + item.useAnimation = 18; + item.useStyle = 1; + item.useTime = 18; + item.knockBack = 1f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.consumable = true; + item.maxStack = 999; + item.height = 14; + item.value = Item.buyPrice(0, 0, 1, 0); + item.rare = 1; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 8f; + 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 stealth = Projectile.NewProjectile(position, new Vector2(speedX, speedY), type, damage, knockBack, player.whoAmI, 0f, 0f); + Main.projectile[stealth].Calamity().stealthStrike = true; + return false; + } + return true; + } + + /*public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ItemID.SpikyBall, 3); + recipe.AddIngredient(ItemID.PinkGel); + recipe.AddTile(TileID.WorkBenches); + recipe.SetResult(this, 3); + recipe.AddRecipe(); + }*/ + } +} diff --git a/Items/Weapons/Rogue/BouncySpikyBall.png b/Items/Weapons/Rogue/BouncySpikyBall.png new file mode 100644 index 0000000000000000000000000000000000000000..d409a6b5715f6ea598d496cd8460bae187a0b499 GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v}}Ko-U3d z8t0czTF7-MK%{NIc360LOk_y&h6Nn&SlP}!u)e{P*uOF5izJWVhM8(Bjy{vlNew(( z#QXSw*|cr;bLSWH-T!MD&by{}*@CH-!3^zhmc8Dy!r8fWDaUU+hQdji4X2B^54@|m z&aiOm_hyqU&o5PdT9aZ<>+p8;Pv&7bf8zOU;q&*?H4op|$oRwe-p=ECx-6MXq6M#3 z?O=cKt1`2pb>6i!>y_*b#mQHU7EgH6SEMe!-$m<7blRGKp(hpeS5^fkKa#h$^}POQ ugU?T(e}qb0BY?=$&C0(hGc~Uyu_QA;kHN4d;>~-YEQ6=3pUXO@geCwP<9nn4 literal 0 HcmV?d00001 diff --git a/Projectiles/Rogue/BouncyBol.cs b/Projectiles/Rogue/BouncyBol.cs new file mode 100644 index 0000000000..c9e3476b2c --- /dev/null +++ b/Projectiles/Rogue/BouncyBol.cs @@ -0,0 +1,115 @@ +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class BouncyBol : ModProjectile + { + private bool hasHitEnemy = false; + private int targetNPC = -1; + private List previousNPCs = new List() { -1 }; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Bouncy Ball"); + } + + public override void SetDefaults() + { + projectile.width = 14; + projectile.height = 14; + projectile.friendly = true; + projectile.penetrate = 8; + projectile.timeLeft = 600; + projectile.Calamity().rogue = true; + projectile.aiStyle = 14; + } + + public override void AI() + { + if (hasHitEnemy == true && projectile.timeLeft < 575) + { + projectile.velocity.X *= 1.005f; //you broke up, time to yeet yourself out + projectile.velocity.Y *= 1.005f; + if (projectile.velocity.X > 16f) + { + projectile.velocity.X = 16f; + } + if (projectile.velocity.Y > 16f) + { + projectile.velocity.Y = 16f; + } + } + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + float minDist = 999f; + int index = 0; + for (int i = 0; i < Main.npc.Length; i++) + { + bool hasHitNPC = false; + for (int j = 0; j < previousNPCs.Count; j++) + { + if (previousNPCs[j] == i) + { + hasHitNPC = true; + } + } + + NPC npc = Main.npc[i]; + if (npc == target) + { + previousNPCs.Add(i); + } + if (!npc.friendly && !npc.townNPC && npc.active && !npc.dontTakeDamage && npc.chaseable && npc != target && !hasHitNPC) + { + float dist = (projectile.Center - npc.Center).Length(); + if (dist < minDist) + { + minDist = dist; + index = i; + } + } + } + + Vector2 velocityNew; + if (minDist < 999f) + { + if (projectile.Calamity().stealthStrike && hasHitEnemy == false) + { + projectile.damage = (int)(projectile.damage * 1.5f); + } + else + { + projectile.damage = (int)(projectile.damage * 1.1f); + } + hasHitEnemy = true; + targetNPC = index; + velocityNew = Main.npc[index].Center - projectile.Center; + velocityNew.Normalize(); + velocityNew *= 15f; + projectile.velocity = velocityNew; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (projectile.velocity.X != oldVelocity.X) + { + projectile.velocity.X = -oldVelocity.X * 1.001f; + } + if (projectile.velocity.Y != oldVelocity.Y) + { + projectile.velocity.Y = -oldVelocity.Y * 1.001f; + } + return false; + } + } +} diff --git a/Projectiles/Rogue/BouncyBol.png b/Projectiles/Rogue/BouncyBol.png new file mode 100644 index 0000000000000000000000000000000000000000..d409a6b5715f6ea598d496cd8460bae187a0b499 GIT binary patch literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xawj^(N7l!{JxM1({$v}}Ko-U3d z8t0czTF7-MK%{NIc360LOk_y&h6Nn&SlP}!u)e{P*uOF5izJWVhM8(Bjy{vlNew(( z#QXSw*|cr;bLSWH-T!MD&by{}*@CH-!3^zhmc8Dy!r8fWDaUU+hQdji4X2B^54@|m z&aiOm_hyqU&o5PdT9aZ<>+p8;Pv&7bf8zOU;q&*?H4op|$oRwe-p=ECx-6MXq6M#3 z?O=cKt1`2pb>6i!>y_*b#mQHU7EgH6SEMe!-$m<7blRGKp(hpeS5^fkKa#h$^}POQ ugU?T(e}qb0BY?=$&C0(hGc~Uyu_QA;kHN4d;>~-YEQ6=3pUXO@geCwP<9nn4 literal 0 HcmV?d00001