60 lines
2.4 KiB
C#
60 lines
2.4 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Buffs.StatDebuffs;
|
|
using Microsoft.Xna.Framework;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using CalamityMod.Projectiles.BaseProjectiles;
|
|
namespace CalamityMod.Projectiles.Melee.Spears
|
|
{
|
|
public class SpatialLanceProjectile : BaseSpearProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Lance");
|
|
}
|
|
|
|
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 this 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.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 7;
|
|
}
|
|
|
|
public override float InitialSpeed => 3f;
|
|
public override float ReelbackSpeed => 1.1f;
|
|
public override float ForwardSpeed => 0.6f;
|
|
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
|
{
|
|
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
|
projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType<SpatialSpear>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
|
};
|
|
public override void ExtraBehavior()
|
|
{
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
int idx = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
|
Main.dust[idx].noGravity = true;
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
|
|
target.AddBuff(BuffID.Frostburn, 120);
|
|
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
|
|
}
|
|
}
|
|
}
|