Files
CalamityModPublic/Projectiles/Rogue/AcidShrapnel.cs
T
Ozzatron ba14da9cdd Initial tModPorter run. Almost all of this is Kill -> OnKill in every Projectile ever.
Profaned Soul Crystal's anti-whip-stack only works on vanilla whips at the moment.
2023-09-30 01:17:11 -04:00

72 lines
2.4 KiB
C#

using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class AcidShrapnel : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Rogue";
public override string Texture => "CalamityMod/Projectiles/Rogue/BarrelShrapnel";
public bool HitTile = false;
public override void SetStaticDefaults()
{
Main.projFrames[Projectile.type] = 3;
}
public override void SetDefaults()
{
Projectile.width = 12;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 160;
Projectile.tileCollide = true;
Projectile.DamageType = RogueDamageClass.Instance;
Projectile.ignoreWater = true;
}
public override void AI()
{
Projectile.ai[0] += 1f;
if (HitTile)
{
Projectile.velocity.X = 0f;
Projectile.rotation = MathHelper.Pi;
}
else
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
Projectile.velocity.Y += 0.2f;
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
HitTile = true;
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
Projectile.Kill();
}
public override void OnHitPlayer(Player target, Player.HurtInfo info)
{
target.AddBuff(ModContent.BuffType<Irradiated>(), 180);
Projectile.Kill();
}
public override void OnKill(int timeLeft)
{
for (int i = 0; i < 15; i++)
{
Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulfurousSeaAcid);
dust.velocity = Vector2.UnitY.RotatedBy(i / 15f * MathHelper.TwoPi) * 3f * (float)Math.Cos(i / 15f * MathHelper.TwoPi);
dust.scale = 2.5f;
dust.noGravity = true;
}
}
}
}