64 lines
2.3 KiB
C#
64 lines
2.3 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class BrackishWater : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Rogue";
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 12;
|
|
Projectile.height = 12;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.timeLeft = 60;
|
|
Projectile.DamageType = RogueDamageClass.Instance;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0f / 255f, (255 - Projectile.alpha) * 0.25f / 255f, (255 - Projectile.alpha) * 0.5f / 255f);
|
|
if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 1f)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item21, Projectile.position);
|
|
Projectile.localAI[0] += 1f;
|
|
}
|
|
if (Projectile.timeLeft % 2 == 0)
|
|
{
|
|
int randomDust = Utils.SelectRandom(Main.rand, new int[]
|
|
{
|
|
33,
|
|
89
|
|
});
|
|
int water = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1.2f);
|
|
Main.dust[water].noGravity = true;
|
|
Main.dust[water].velocity *= 0.5f;
|
|
Main.dust[water].velocity += Projectile.velocity * 0.1f;
|
|
}
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
if (Projectile.owner == Main.myPlayer)
|
|
{
|
|
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BrackishWaterBlast>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f);
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(BuffID.Venom, 90);
|
|
}
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
|
{
|
|
target.AddBuff(BuffID.Venom, 90);
|
|
}
|
|
}
|
|
}
|