From e26b1fa6a0754d70fbf78842fa7faaf685732005 Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Wed, 13 May 2020 18:15:26 -0400 Subject: [PATCH] prismatic breaker file (not done yet) --- Items/Weapons/Melee/PrismaticBreaker.cs | 162 ++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 Items/Weapons/Melee/PrismaticBreaker.cs diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs new file mode 100644 index 0000000000..a99583fb4b --- /dev/null +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -0,0 +1,162 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class PrismaticBreaker : ModItem + { + private int alpha = 50; + private int swing = 0; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Elemental Excalibur"); + Tooltip.SetDefault("Freezes enemies and heals the player on hit\n" + + "Fires rainbow beams that change their behavior based on their color\n" + + "Right click for true melee"); + } + + public override void SetDefaults() + { + item.damage = 500; + item.crit += 8; + item.useAnimation = 15; + item.useStyle = 1; + item.useTime = 3; + item.useTurn = true; + item.melee = true; + item.knockBack = 8f; + item.UseSound = SoundID.Item1; + item.autoReuse = true; + item.width = 92; + item.height = 92; + item.value = CalamityGlobalItem.Rarity14BuyPrice; + item.rare = 10; + item.shoot = ModContent.ProjectileType(); + item.shootSpeed = 12f; + item.Calamity().customRarity = CalamityRarity.Dedicated; + } + + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Vector2 origin = new Vector2(46f, 44f); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Items/Weapons/Melee/PrismaticBreakerGlow"), item.Center - Main.screenPosition, null, Color.White, rotation, origin, 1f, SpriteEffects.None, 0f); + } + + 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.altFunctionUse == 2) + { + Projectile.NewProjectile(position.X, position.Y, speedX * 0.5f, speedY * 0.5f, ModContent.ProjectileType(), (int)(damage * 1), knockBack, player.whoAmI, 0f, 0f); + } + else + { + swing++; + if (swing > 5) + swing = 0; + if (swing == 5) + { + Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, 0f, 0f); + } + } + return false; + } + + public override bool AltFunctionUse(Player player) => true; + + public override void MeleeEffects(Player player, Rectangle hitbox) + { + if (Main.rand.NextBool(4)) + { + Color color = new Color(255, 0, 0, alpha); + switch (Main.rand.Next(12)) + { + case 0: // Red + break; + case 1: // Orange + color = new Color(255, 128, 0, alpha); + break; + case 2: // Yellow + color = new Color(255, 255, 0, alpha); + break; + case 3: // Lime + color = new Color(128, 255, 0, alpha); + break; + case 4: // Green + color = new Color(0, 255, 0, alpha); + break; + case 5: // Turquoise + color = new Color(0, 255, 128, alpha); + break; + case 6: // Cyan + color = new Color(0, 255, 255, alpha); + break; + case 7: // Light Blue + color = new Color(0, 128, 255, alpha); + break; + case 8: // Blue + color = new Color(0, 0, 255, alpha); + break; + case 9: // Purple + color = new Color(128, 0, 255, alpha); + break; + case 10: // Fuschia + color = new Color(255, 0, 255, alpha); + break; + case 11: // Hot Pink + color = new Color(255, 0, 128, alpha); + break; + default: + break; + } + + Dust dust24 = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 267, 0f, 0f, alpha, color, 0.8f)]; + dust24.noGravity = true; + } + } + + public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void OnHitPvp(Player player, Player target, int damage, bool crit) + { + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(BuffID.CursedInferno, 120); + target.AddBuff(BuffID.Frostburn, 120); + target.AddBuff(BuffID.OnFire, 120); + target.AddBuff(BuffID.Ichor, 120); + } + + public override void AddRecipes() + { + ModRecipe recipe = new ModRecipe(mod); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType()); + recipe.AddIngredient(ModContent.ItemType(), 3); + recipe.AddIngredient(ModContent.ItemType(), 10); + recipe.AddTile(ModContent.TileType()); + recipe.SetResult(this); + recipe.AddRecipe(); + } + } +}