69 lines
1.6 KiB
C#
69 lines
1.6 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using static Terraria.ModLoader.ModContent;
|
|
|
|
namespace CalamityMod.Projectiles.Typeless
|
|
{
|
|
public class SerpentsBiteHook : ModProjectile
|
|
{
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Serpent's Bite");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.CloneDefaults(ProjectileID.GemHookAmethyst);
|
|
}
|
|
|
|
// Use this hook for hooks that can have multiple hooks mid-flight: Dual Hook, Web Slinger, Fish Hook, Static Hook, Lunar Hook
|
|
public override bool? CanUseGrapple(Player player)
|
|
{
|
|
int hooksOut = 0;
|
|
for (int l = 0; l < 1000; l++)
|
|
{
|
|
if (Main.projectile[l].active && Main.projectile[l].owner == Main.myPlayer && Main.projectile[l].type == projectile.type)
|
|
{
|
|
hooksOut++;
|
|
}
|
|
}
|
|
if (hooksOut > 2) // This hook can have 3 hooks out.
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Amethyst Hook is 300, Static Hook is 600
|
|
public override float GrappleRange()
|
|
{
|
|
return 450f; //28.125 tiles
|
|
}
|
|
|
|
public override void NumGrappleHooks(Player player, ref int numHooks)
|
|
{
|
|
numHooks = 2;
|
|
}
|
|
|
|
// default is 11, Lunar is 24
|
|
public override void GrappleRetreatSpeed(Player player, ref float speed)
|
|
{
|
|
speed = 14f;
|
|
}
|
|
|
|
public override void GrapplePullSpeed(Player player, ref float speed)
|
|
{
|
|
speed = 12;
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
CalamityUtils.DrawHook(projectile, GetTexture("CalamityMod/ExtraTextures/Chains/SerpentsBiteChain"));
|
|
return true;
|
|
}
|
|
}
|
|
}
|