Files
CalamityModPublic/Projectiles/Summon/PlantSeed.cs
T

66 lines
1.9 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Summon
{
public class PlantSeed : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Seed");
Main.projFrames[projectile.type] = 2;
ProjectileID.Sets.MinionShot[projectile.type] = true;
}
public override void SetDefaults()
{
projectile.width = 14;
projectile.height = 14;
projectile.light = 0.5f;
projectile.alpha = 255;
projectile.extraUpdates = 2;
projectile.tileCollide = false;
projectile.friendly = true;
projectile.minion = true;
projectile.minionSlots = 0f;
projectile.ignoreWater = true;
projectile.aiStyle = 1;
aiType = ProjectileID.BulletHighVelocity;
projectile.penetrate = 1;
projectile.timeLeft = 600;
}
public override void AI()
{
projectile.frameCounter++;
if (projectile.frameCounter > 8)
{
projectile.frame++;
projectile.frameCounter = 0;
}
if (projectile.frame >= 2)
{
projectile.frame = 0;
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
CalamityGlobalProjectile.DrawCenteredAndAfterimage(projectile, lightColor, ProjectileID.Sets.TrailingMode[projectile.type], 2);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Poisoned, 60);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Poisoned, 60);
}
}
}