Files
CalamityModPublic/Projectiles/Summon/MK2RocketNormal.cs
T

67 lines
1.9 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Summon
{
public class MK2RocketNormal : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Rocket");
Main.projFrames[Projectile.type] = 3;
ProjectileID.Sets.MinionShot[Projectile.type] = true;
}
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 14;
Projectile.light = 0.5f;
Projectile.extraUpdates = 1;
Projectile.tileCollide = false;
Projectile.friendly = true;
Projectile.minion = true;
Projectile.minionSlots = 0f;
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 600;
}
public override void AI()
{
Projectile.frameCounter++;
if (Projectile.frameCounter > 8)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame >= Main.projFrames[Projectile.type])
{
Projectile.frame = 0;
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Plague>(), 180);
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.timeLeft > 599)
return false;
return true;
}
}
}