Files
CalamityModPublic/Projectiles/Melee/Spears/FulgurationHalberdProj.cs
T

64 lines
2.6 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee.Spears
{
public class FulgurationHalberdProj : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Fulguration Halberd");
}
public override void SetDefaults()
{
projectile.width = 40; //The width of the .png file in pixels divided by 2.
projectile.aiStyle = 19;
projectile.melee = true; //Dictates whether projectile is a melee-class weapon.
projectile.timeLeft = 90;
projectile.height = 40; //The height of the .png file in pixels divided by 2.
projectile.friendly = true;
projectile.hostile = false;
projectile.tileCollide = false;
projectile.ignoreWater = true;
projectile.penetrate = -1;
projectile.ownerHitCheck = true;
projectile.hide = true;
projectile.Calamity().trueMelee = true;
}
public override void AI()
{
Main.player[projectile.owner].direction = projectile.direction;
Main.player[projectile.owner].heldProj = projectile.whoAmI;
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
projectile.position += projectile.velocity * projectile.ai[0];
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = 3f;
projectile.netUpdate = true;
}
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
projectile.ai[0] -= 2.4f;
else
{
projectile.ai[0] += 0.95f;
}
if (Main.player[projectile.owner].itemAnimation == 0)
projectile.Kill();
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
if (projectile.spriteDirection == -1)
projectile.rotation -= 1.57f;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.immune[projectile.owner] = 8;
target.AddBuff(ModContent.BuffType<BurningBlood>(), 300);
}
}
}