2 - True melee damage tooltip only displays on true melee weapons. 3 - True melee code adjustments to make it better.
51 lines
2.1 KiB
C#
51 lines
2.1 KiB
C#
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using CalamityMod.Projectiles.BaseProjectiles;
|
|
namespace CalamityMod.Projectiles.Melee.Spears
|
|
{
|
|
public class StarnightLanceProjectile : 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 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;
|
|
}
|
|
|
|
public override float InitialSpeed => 3f;
|
|
public override float ReelbackSpeed => 2.4f;
|
|
public override float ForwardSpeed => 0.95f;
|
|
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
|
{
|
|
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
|
projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<StarnightBeam>(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
|
};
|
|
public override void ExtraBehavior()
|
|
{
|
|
if (Main.rand.NextBool(5))
|
|
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.immune[projectile.owner] = 8;
|
|
target.AddBuff(BuffID.Frostburn, 120);
|
|
}
|
|
}
|
|
}
|