From 435503a41ebb8475b6fa072be0a3434ebc043b48 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Thu, 14 May 2020 20:00:19 -0400 Subject: [PATCH] added Tyranny's End (auric gun) --- CalamityMod.cs | 3 +- Items/Weapons/Ranged/TyrannysEnd.cs | 63 ++++++++++++++++ Projectiles/Ranged/PiercingBullet.cs | 101 ++++++++++++++++++++++++++ Projectiles/Ranged/PiercingBullet.png | Bin 0 -> 577 bytes 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 Items/Weapons/Ranged/TyrannysEnd.cs create mode 100644 Projectiles/Ranged/PiercingBullet.cs create mode 100644 Projectiles/Ranged/PiercingBullet.png diff --git a/CalamityMod.cs b/CalamityMod.cs index b8b00b3fdf..af1402ed87 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -1866,7 +1866,8 @@ namespace CalamityMod ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType(), + ModContent.ItemType() }; boomerangList = new List() diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs new file mode 100644 index 0000000000..8a5e72f6d8 --- /dev/null +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -0,0 +1,63 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class TyrannysEnd : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Tyranny's End"); + Tooltip.SetDefault("Pierce the heart of even the most heavily-armored foe\n" + + "Fires a .70 caliber sniper round that bypasses enemy defense and DR\n" + + "Rounds mark enemies for death and summon a swarm of additional bullets on crits"); + } + + public override void SetDefaults() + { + item.damage = 4000; + item.crit += 35; + item.knockBack = 9.5f; + item.ranged = true; + item.useTime = 55; + item.useAnimation = 55; + item.shoot = ProjectileID.BulletHighVelocity; + item.shootSpeed = 12f; + item.useAmmo = AmmoID.Bullet; + item.autoReuse = true; + + item.width = 94; + item.height = 32; + item.useStyle = 5; + item.noMelee = true; + item.UseSound = mod.GetLegacySoundSlot(SoundType.Item, "Sounds/Item/LargeWeaponFire"); + item.value = CalamityGlobalItem.Rarity15BuyPrice; + item.rare = 10; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 4); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + + public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, ModContent.ProjectileType(), damage, knockBack, player.whoAmI, 0f, 0f); + return false; + } + } +} diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs new file mode 100644 index 0000000000..29d5803af7 --- /dev/null +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -0,0 +1,101 @@ +using CalamityMod.Buffs.StatDebuffs; +using Microsoft.Xna.Framework; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Ranged +{ + public class PiercingBullet : ModProjectile + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Piercing Blow"); + } + + public override void SetDefaults() + { + projectile.width = 4; + projectile.height = 4; + projectile.light = 0.5f; + projectile.alpha = 255; + projectile.extraUpdates = 10; + projectile.scale = 1.18f; + projectile.friendly = true; + projectile.ranged = true; + projectile.ignoreWater = true; + projectile.aiStyle = 1; + aiType = ProjectileID.BulletHighVelocity; + projectile.penetrate = 1; + projectile.timeLeft = 600; + } + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + //Avoid touching things that you probably aren't meant to damage + if (target.defense > 999 || target.Calamity().DR >= 0.95f || target.Calamity().unbreakableDR) + return; + + //DR applies after defense, so undo it first + damage = (int)(damage * (1 / (1 - target.Calamity().DR))); + + //Then proceed to ignore all defense + int penetratableDefense = Math.Max(target.defense - Main.player[projectile.owner].armorPenetration, 0); + int penetratedDefense = Math.Min(penetratableDefense, target.defense); + damage += (int)(0.5f * penetratedDefense); + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height); + Main.PlaySound(0, (int)projectile.position.X, (int)projectile.position.Y, 1, 1f, 0f); + return true; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + if (crit) + { + int bulletCount = 10; + for (int x = 0; x < bulletCount; x++) + { + float speed = 12f; + float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f); + float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); + Vector2 origin = new Vector2(xPos, yPos); + Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y); + velocity.Normalize(); + velocity *= speed; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); + } + } + } + target.AddBuff(ModContent.BuffType(), 900); + } + + public override void OnHitPvp(Player target, int damage, bool crit) + { + if (crit) + { + int bulletCount = 10; + for (int x = 0; x < bulletCount; x++) + { + float speed = 12f; + float xPos = projectile.Center.X + (x < bulletCount / 2 ? 500f : -500f); + float yPos = projectile.Center.Y + Main.rand.Next(-500, 501); + Vector2 origin = new Vector2(xPos, yPos); + Vector2 velocity = new Vector2(target.Center.X - origin.X, target.Center.Y - origin.Y); + velocity.Normalize(); + velocity *= speed; + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(origin, velocity, ModContent.ProjectileType(), (int)(projectile.damage * 0.2), projectile.knockBack, projectile.owner); + } + } + } + target.AddBuff(ModContent.BuffType(), 900); + } + } +} diff --git a/Projectiles/Ranged/PiercingBullet.png b/Projectiles/Ranged/PiercingBullet.png new file mode 100644 index 0000000000000000000000000000000000000000..3f761a030699cc54bd0304ad1e59bcc981894019 GIT binary patch literal 577 zcmWO3Pe{`N6bJC%+jP$9v{kD#E3NF0E6e^$1))rBG1oAoTNFe^hr%qPP8A-KkPiJh zl;I(gl30aw>`;gD&!%%a|E2TK)J;vzsmoHLo~NQNBD)h+c}7-8H+lw17F6SB`S@2rnPz zr9&J!$cqO!EOPkYeqPwe^VvKn_Hsz<;aL;^&Egrco2SJtp4!QO#15VmnLHu3^Y}In zime{p-;u*5S7>qSuI?wdh`h?$ziL z26P(WU4@QhbR?l&=;6_$EfMYnxOHgNp(P$JEu3+1YS64fQ!E-|(4fXI6@C&L2#thh zf|KAPv=ZC|522mlC3F(H2t9;eLLZ@@FhCe23=#W@M~Fv>1H?h%3F1lODdK738RA*u z5b-?m0&$plkvKxUOdO>OQ}C<&;I74-SDJg~+Y?H9ke;ZH`xHX5`X=e)%TrE&{P5gV z{4VXB{bf^Sy{|O8tj;l;bKdIpgd4ZC E0lkVlg8%>k literal 0 HcmV?d00001