diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs new file mode 100644 index 0000000000..43db535b50 --- /dev/null +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -0,0 +1,35 @@ +using CalamityMod.Projectiles.Melee.Yoyos; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Melee +{ + public class TheMicrowave : ModItem + { + public override void SetStaticDefaults() + { + DisplayName.SetDefault("The Microwave"); + //Tooltip.SetDefault("MMMMMMMMMMMMMM, 13th letter of the alphabet moments"); + Tooltip.SetDefault("Baking enemies in the astral infection\n\n" + + "Summons an aura around the yoyo that damages nearby enemies"); + } + + public override void SetDefaults() + { + item.CloneDefaults(ItemID.TheEyeOfCthulhu); + item.damage = 100; + item.useTime = 22; + item.useAnimation = 22; + item.useStyle = 5; + item.channel = true; + item.melee = true; + item.knockBack = 3f; + item.value = Item.buyPrice(0, 95, 0, 0); + item.rare = 9; + item.autoReuse = true; + item.shoot = ModContent.ProjectileType(); + ItemID.Sets.Yoyo[item.type] = true; + } + } +} diff --git a/Items/Weapons/Melee/TheMicrowave.png b/Items/Weapons/Melee/TheMicrowave.png new file mode 100644 index 0000000000..fc28f6184a Binary files /dev/null and b/Items/Weapons/Melee/TheMicrowave.png differ diff --git a/Projectiles/Melee/MicrowaveAura.cs b/Projectiles/Melee/MicrowaveAura.cs new file mode 100644 index 0000000000..6bb218c4e0 --- /dev/null +++ b/Projectiles/Melee/MicrowaveAura.cs @@ -0,0 +1,53 @@ +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MicrowaveAura : ModProjectile + { + private int radius = 100; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Microwave"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.SoulDrain); + aiType = 476; + projectile.magic = false; + projectile.melee = true; + projectile.usesIDStaticNPCImmunity = true; + projectile.idStaticNPCHitCooldown = 10; + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 180); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float dist1 = Vector2.Distance(projectile.Center, targetHitbox.TopLeft()); + float dist2 = Vector2.Distance(projectile.Center, targetHitbox.TopRight()); + float dist3 = Vector2.Distance(projectile.Center, targetHitbox.BottomLeft()); + float dist4 = Vector2.Distance(projectile.Center, targetHitbox.BottomRight()); + + float minDist = dist1; + if (dist2 < minDist) + minDist = dist2; + if (dist3 < minDist) + minDist = dist3; + if (dist4 < minDist) + minDist = dist4; + + return minDist <= radius; + } + } +} diff --git a/Projectiles/Melee/MicrowaveAura.png b/Projectiles/Melee/MicrowaveAura.png new file mode 100644 index 0000000000..df1dd57993 Binary files /dev/null and b/Projectiles/Melee/MicrowaveAura.png differ diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs b/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs new file mode 100644 index 0000000000..928523cf26 --- /dev/null +++ b/Projectiles/Melee/Yoyos/TheMicrowaveProj.cs @@ -0,0 +1,75 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee.Yoyos +{ + public class TheMicrowaveProj : ModProjectile + { + private int radius = 100; + + public override void SetStaticDefaults() + { + //DisplayName.SetDefault("Bootleg Lacerator"); + DisplayName.SetDefault("Microwave"); + } + + public override void SetDefaults() + { + projectile.CloneDefaults(ProjectileID.TheEyeOfCthulhu); + projectile.width = 16; + projectile.height = 16; + projectile.penetrate = -1; + projectile.extraUpdates = 1; + aiType = 555; + projectile.melee = true; + projectile.usesLocalNPCImmunity = true; + projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + if (projectile.owner == Main.myPlayer) + { + Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.5f), projectile.knockBack, projectile.owner, 0f, 0f); + + //dust circle + int numDust = (int)(0.2f * MathHelper.TwoPi * radius); + float angleIncrement = MathHelper.TwoPi / (float)numDust; + Vector2 dustOffset = new Vector2(radius, 0f); + dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); + for (int i = 0; i < numDust; i++) + { + dustOffset = dustOffset.RotatedBy(angleIncrement); + int dustType = Utils.SelectRandom(Main.rand, new int[] + { + ModContent.DustType(), + ModContent.DustType() + }); + int dust = Dust.NewDust(projectile.Center, 1, 1, dustType); + Main.dust[dust].position = projectile.Center + dustOffset; + Main.dust[dust].fadeIn = 1f; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].scale = 0.1599999999f; + } + } + } + + public override void PostDraw(SpriteBatch spriteBatch, Color lightColor) + { + Rectangle frame = new Rectangle(0, 0, 20, 16); + spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow"), projectile.Center - Main.screenPosition, frame, Color.White, projectile.rotation, projectile.Size / 2, 1f, SpriteEffects.None, 0f); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.AddBuff(ModContent.BuffType(), 300); + } + } +} diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProj.png b/Projectiles/Melee/Yoyos/TheMicrowaveProj.png new file mode 100644 index 0000000000..cbdb8f620b Binary files /dev/null and b/Projectiles/Melee/Yoyos/TheMicrowaveProj.png differ diff --git a/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png b/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png new file mode 100644 index 0000000000..11635706b2 Binary files /dev/null and b/Projectiles/Melee/Yoyos/TheMicrowaveProjGlow.png differ