68 lines
2.2 KiB
C#
68 lines
2.2 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class TacticiansTrumpCardProj : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Beam");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = 20;
|
|
projectile.height = 20;
|
|
projectile.aiStyle = 27;
|
|
projectile.friendly = true;
|
|
projectile.magic = true;
|
|
projectile.penetrate = 3;
|
|
projectile.timeLeft = 300;
|
|
aiType = ProjectileID.LightBeam;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 10;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.37f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.47f / 255f);
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 132, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
|
}
|
|
projectile.rotation = projectile.velocity.ToRotation();
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
if (projectile.timeLeft > 295)
|
|
return false;
|
|
|
|
Texture2D tex = Main.projectileTexture[projectile.type];
|
|
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
for (int k = 0; k < 5; k++)
|
|
{
|
|
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 132, projectile.oldVelocity.X * 0.5f, projectile.oldVelocity.Y * 0.5f);
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<TacticiansElectricBoom>(), projectile.damage / 2, 0f, projectile.owner);
|
|
}
|
|
|
|
public override void OnHitPvp(Player target, int damage, bool crit)
|
|
{
|
|
Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType<TacticiansElectricBoom>(), projectile.damage / 2, 0f, projectile.owner);
|
|
}
|
|
}
|
|
}
|