84 lines
3.0 KiB
C#
84 lines
3.0 KiB
C#
using CalamityMod.Buffs.StatDebuffs;
|
|
using CalamityMod.CalPlayer;
|
|
using CalamityMod.DataStructures;
|
|
using CalamityMod.Particles;
|
|
using CalamityMod.Items.Weapons.Melee;
|
|
using Terraria.Graphics.Shaders;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using static Terraria.ModLoader.ModContent;
|
|
using static CalamityMod.CalamityUtils;
|
|
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class PurityProjection : ModProjectile //The boring plain one
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_PurityProjection";
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Purity Projection");
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 5;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 2;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = projectile.height = 32;
|
|
projectile.aiStyle = 27;
|
|
aiType = ProjectileID.LightBeam;
|
|
projectile.friendly = true;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 40;
|
|
projectile.melee = true;
|
|
projectile.tileCollide = false;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (projectile.timeLeft < 35)
|
|
projectile.tileCollide = true;
|
|
|
|
Lighting.AddLight(projectile.Center, 0.75f, 1f, 0.24f);
|
|
int dustParticle = Dust.NewDust(projectile.position, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 0.9f);
|
|
Main.dust[dustParticle].noGravity = true;
|
|
Main.dust[dustParticle].velocity *= 0.5f;
|
|
Main.dust[dustParticle].velocity += projectile.velocity * 0.1f;
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
if (projectile.timeLeft > 35)
|
|
return false;
|
|
|
|
DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Main.PlaySound(SoundID.Item43, projectile.Center);
|
|
for (int i = 0; i <= 15; i++)
|
|
{
|
|
Vector2 displace = (projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f;
|
|
int dustParticle = Dust.NewDust(projectile.Center + displace, projectile.width, projectile.height, 75, 0f, 0f, 100, default, 2f);
|
|
Main.dust[dustParticle].noGravity = true;
|
|
Main.dust[dustParticle].velocity = projectile.oldVelocity;
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
int debuffTime = 90;
|
|
target.AddBuff(BuffType<ArmorCrunch>(), debuffTime);
|
|
}
|
|
}
|
|
} |