using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.DataStructures;
namespace JoshuasMod.Projectiles.MourningArc
{
public class MourningArc : ModItem
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Mourning Arc"); //The weapon's name when shown in-game.
}
public override void SetDefaults()
{
projectile.width = 220;
projectile.height = 220;
projectile.penetrate = -1;
projectile.ignoreWater = true;
projectile.melee = true;
projectile.friendly = true;
projectile.tileCollide = false;
}
public override void AI()
{
//The sound of the projectile.
projectile.soundDelay--;
if (projectile.soundDelay <= 0)
{
Main.PlaySound(2, (int)projectile.Center.X, (int)projectile.Center.Y, 15); //Cant tell if "2" or "15" is the SoundID. Either way I want SoundID of "71" (Death Sickle's Swing Sound).
projectile.soundDelay = 45;
}
//How the projectile works.
Player player = Main.player[projectile.owner];
if (Main.myPlayer == projectile.owner)
{
if (!player.channel || player.noItems || player.CCed)
{
projectile.Kill();
}
}
Lighting.AddLight(projectile.Center, 1f, 0.6f, 0f); //This is the Projectile's light color (RGB)
projectile.Center = player.MountedCenter;
projectile.position.X += player.width / 2 * player.direction;
projectile.spriteDirection = player.direction;
projectile.rotation += 0.3f * player.direction; //This is the Projectile's Spinnig/Rotation Speed
if (projectile.rotation > MathHelper.TwoPi)
{
projectile.rotation -= MathHelper.TwoPi;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
Texture2D texture = Main.projectileTexture[projectile.type];
spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, new Vector2(texture.Width / 2, texture.Height / 2), 1f, projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.CursedInferno, 5 * 60); //Add CursedInferno Buff to the NPC for 5 seconds.
}
}
}
[/CODE[/SPOILER]