Files
CalamityModPublic/Projectiles/Rogue/StickyBol.cs
T
termigator1359 84421ebbc2 various sentry fixes among others
1. Fixed Ballistic Poison Bomb cloud velocity.
2. Fixed compile errors with Flak/Gamma Acid.
3. Fixed sentries not being able to be placed on platforms.
4. Fixed bugs with Pulse Turret.
5. Updated targetting util to check for tiles on minion targetted npcs.
6. Fixed rotational errors on cadaverous carrion.
7. Cadaverous carrion now checks for tile collision.
2020-07-23 13:25:14 -04:00

85 lines
2.5 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Rogue
{
public class StickyBol : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Sticky Bol");
}
public override void SetDefaults()
{
projectile.width = 14;
projectile.height = 14;
projectile.friendly = true;
projectile.penetrate = 5;
projectile.timeLeft = 300;
projectile.tileCollide = false;
projectile.Calamity().rogue = true;
projectile.usesLocalNPCImmunity = true;
projectile.localNPCHitCooldown = 60;
}
public override void AI()
{
Color color = new Color(0, 80, 255, 100);
if (Main.rand.NextBool(12))
{
Dust.NewDust(projectile.position + Vector2.One * 6f, projectile.width - 12, projectile.height - 12, 4, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 175, color, 1.2f);
}
//Sticky Behaviour
projectile.StickyProjAI(10);
if (projectile.ai[0] != 1f)
{
projectile.StickToTiles(true, false);
projectile.localAI[1] += 1f;
if (projectile.localAI[1] > 10f)
{
projectile.localAI[1] = 10f;
if (projectile.velocity.Y == 0f && projectile.velocity.X != 0f)
{
projectile.velocity.X *= 0.97f;
if (Math.Abs(projectile.velocity.X) < 0.01f)
{
projectile.velocity.X = 0f;
projectile.netUpdate = true;
}
}
projectile.velocity.Y += 0.2f;
}
projectile.rotation += projectile.velocity.X * 0.1f;
}
}
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
{
projectile.ModifyHitNPCSticky(5, true);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
{
if (targetHitbox.Width > 8 && targetHitbox.Height > 8)
{
targetHitbox.Inflate(-targetHitbox.Width / 8, -targetHitbox.Height / 8);
}
return null;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.Slimed, 120);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.Slimed, 120);
}
}
}