Added a base spear projectile
Also changes to slick cane to make it less insane.
This commit is contained in:
1 parent
08a68ffb16
commit
1b7ced4a03
24 files changed
+518
-981
No files matched your search
@@ -0,0 +1,171 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.BaseProjectiles
|
||||
{
|
||||
public abstract class BaseSpearProjectile : ModProjectile
|
||||
{
|
||||
public enum SpearType
|
||||
{
|
||||
TypicalSpear,
|
||||
GhastlyGlaiveSpear
|
||||
}
|
||||
// Spears likely suffer from the same "no-double" problems whips do because of their hide field
|
||||
// If we ever want to add a special dual-spear, be sure to not have projectile.hide active.
|
||||
|
||||
// Also, be careful with the move and reelback speed. If they're bad values,
|
||||
// the spear might end up detaching from or impaling the player.
|
||||
|
||||
public virtual void Behavior()
|
||||
{
|
||||
if (SpearAiType == SpearType.TypicalSpear)
|
||||
{
|
||||
// ai[0] = Speed value of the spear. Changes as time goes by.
|
||||
// localAI[0] = Special effect 0-1 flag value. Actived right before the spear goes backward.
|
||||
|
||||
Player player = Main.player[projectile.owner];
|
||||
|
||||
// Adjust owner stats based on this projectile
|
||||
player.direction = projectile.direction;
|
||||
player.heldProj = projectile.whoAmI;
|
||||
player.itemTime = player.itemAnimation;
|
||||
|
||||
// Stick to the player
|
||||
projectile.position = player.Center - projectile.Size / 2f;
|
||||
|
||||
// And move outward/inward based on the speed variable.
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
|
||||
// If we're not movement, start.
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = InitialSpeed;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
// Reel back
|
||||
if (player.itemAnimation < player.itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= ReelbackSpeed;
|
||||
|
||||
// If we haven't done the special effect yet (assuming there is one), do it.
|
||||
// Note : Null Coalescing does not work in this case because we are invoking a method, not setting a value.
|
||||
if (projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
EffectBeforeReelback.Invoke(projectile);
|
||||
}
|
||||
}
|
||||
// Move forward
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += ForwardSpeed;
|
||||
}
|
||||
|
||||
// If at the end of the animation, kill the projectile.
|
||||
if (player.itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2 + MathHelper.PiOver4;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= MathHelper.PiOver2;
|
||||
}
|
||||
else if (SpearAiType == SpearType.GhastlyGlaiveSpear)
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
|
||||
Vector2 playerRelativePoint = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
|
||||
projectile.direction = player.direction;
|
||||
player.heldProj = projectile.whoAmI;
|
||||
projectile.Center = playerRelativePoint;
|
||||
if (player.dead)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
// If the player isn't stuck, be it from the stoned or frozen debuff, do the usual AI
|
||||
if (!player.frozen)
|
||||
{
|
||||
// Pretty much the same as regular spears.
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
if (projectile.localAI[0] == 0f && EffectBeforeReelback != null && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
EffectBeforeReelback.Invoke(projectile);
|
||||
}
|
||||
}
|
||||
projectile.spriteDirection = projectile.direction = player.direction;
|
||||
// Decrement alpha if it's greater than zero. A 255 starting alpha is
|
||||
// not required, this is just a solution for relevant edge-cases.
|
||||
if (projectile.alpha > 0)
|
||||
{
|
||||
projectile.alpha -= 127;
|
||||
if (projectile.alpha < 0)
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
if (projectile.localAI[0] > 0f)
|
||||
{
|
||||
projectile.localAI[0] -= 1f;
|
||||
}
|
||||
float inverseAnimationCompletion = 1f - (player.itemAnimation / (float)player.itemAnimationMax);
|
||||
float originalVelocityDirection = projectile.velocity.ToRotation();
|
||||
float originalVelocitySpeed = projectile.velocity.Length();
|
||||
|
||||
Vector2 flatVelocity = Vector2.UnitX.RotatedBy(MathHelper.Pi + inverseAnimationCompletion * MathHelper.TwoPi) *
|
||||
new Vector2(originalVelocitySpeed, projectile.ai[0]);
|
||||
|
||||
projectile.position += flatVelocity.RotatedBy(originalVelocityDirection) +
|
||||
new Vector2(originalVelocitySpeed + TravelSpeed, 0f).RotatedBy(originalVelocityDirection);
|
||||
|
||||
// Determine how to rotate. The larger the 40 value is, the more rapidly the projectile rotates.
|
||||
Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(originalVelocityDirection) +
|
||||
new Vector2(originalVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(originalVelocityDirection);
|
||||
projectile.rotation = player.AngleTo(destination) + MathHelper.PiOver4 * player.direction; //or this
|
||||
|
||||
// Rotate 180 degrees if facing to the right
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation += MathHelper.Pi;
|
||||
|
||||
player.DirectionTo(projectile.Center);
|
||||
}
|
||||
|
||||
// Kill the hook if the player's item use cycle is almost over and reset the reuseDelay
|
||||
// reuseDelay is typically used for burst shots, like the clockwork assult rifle, and is
|
||||
// decremented by the useTime. On reset it reverts to useAnimation - 1
|
||||
if (player.itemAnimation == 2)
|
||||
{
|
||||
projectile.Kill();
|
||||
player.reuseDelay = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
public virtual void ExtraBehavior()
|
||||
{
|
||||
|
||||
}
|
||||
public override void AI()
|
||||
{
|
||||
Behavior();
|
||||
if ((SpearAiType == SpearType.GhastlyGlaiveSpear && !Main.player[projectile.owner].frozen) ||
|
||||
SpearAiType == SpearType.TypicalSpear)
|
||||
{
|
||||
ExtraBehavior();
|
||||
}
|
||||
}
|
||||
|
||||
#region Virtual Values
|
||||
// Typical spear virtual values
|
||||
public virtual float InitialSpeed => 3f;
|
||||
public virtual float ReelbackSpeed => 1f;
|
||||
public virtual float ForwardSpeed => 0.75f;
|
||||
// Ghastly Glaive spear virtual values
|
||||
public virtual float TravelSpeed => 22f;
|
||||
// Neither
|
||||
public virtual Action<Projectile> EffectBeforeReelback => null;
|
||||
public virtual SpearType SpearAiType => SpearType.TypicalSpear;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class AmidiasTridentProj : ModProjectile
|
||||
public class AmidiasTridentProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,40 +26,12 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1f;
|
||||
public override float ForwardSpeed => 0.75f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 1f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, ModContent.ProjectileType<AmidiasWhirlpool>(), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.75f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, ModContent.ProjectileType<AmidiasWhirlpool>(), projectile.damage, projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,11 @@ using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class AstralPikeProj : ModProjectile
|
||||
public class AstralPikeProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -28,42 +29,15 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, ModContent.DustType<AstralOrange>(), projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
@@ -74,26 +48,19 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800;
|
||||
Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
|
||||
float num80 = xPos;
|
||||
float speedX = target.position.X - vector2.X;
|
||||
float speedY = target.position.Y - vector2.Y;
|
||||
float dir = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
|
||||
dir = 10 / num80;
|
||||
speedX *= dir * 150;
|
||||
speedY *= dir * 150;
|
||||
if (speedX > 15f)
|
||||
speedX = 15f;
|
||||
if (speedX < -15f)
|
||||
speedX = -15f;
|
||||
if (speedY > 15f)
|
||||
speedY = 15f;
|
||||
if (speedY < -15f)
|
||||
speedY = -15f;
|
||||
float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt();
|
||||
Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
|
||||
float speedX = target.position.X - spawnPosition.X;
|
||||
float speedY = target.position.Y - spawnPosition.Y;
|
||||
float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
|
||||
magnitude = 10f / xPos;
|
||||
speedX *= magnitude * 150f;
|
||||
speedY *= magnitude * 150f;
|
||||
speedX = MathHelper.Clamp(speedX, -15f, 15f);
|
||||
speedY = MathHelper.Clamp(speedY, -15f, 15f);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
int proj = Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType<AstralStar>(), (int)(projectile.damage * 0.2), 1f, projectile.owner);
|
||||
int proj = Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType<AstralStar>(), (int)(projectile.damage * 0.2), 1f, projectile.owner);
|
||||
Main.projectile[proj].Calamity().forceMelee = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class BansheeHookProj : ModProjectile
|
||||
public class BansheeHookProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -29,106 +30,92 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.localNPCHitCooldown = 2;
|
||||
projectile.alpha = 255;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear;
|
||||
public override float TravelSpeed => 22f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center + projectile.velocity * 0.5f,
|
||||
projectile.velocity * 0.8f, ModContent.ProjectileType<BansheeHookScythe>(),
|
||||
(int)(projectile.damage * 1.75),
|
||||
projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
};
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
Vector2 vector = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
projectile.direction = player.direction;
|
||||
player.heldProj = projectile.whoAmI;
|
||||
projectile.Center = vector;
|
||||
if (player.dead)
|
||||
|
||||
Vector2 playerRelativePoint = player.RotatedRelativePoint(player.MountedCenter);
|
||||
|
||||
float itemAnimationCompletion = player.itemAnimation / (float)player.itemAnimationMax;
|
||||
float completionAsAngle = (1f - itemAnimationCompletion) * MathHelper.TwoPi;
|
||||
float startingVelocityRotation = projectile.velocity.ToRotation();
|
||||
float startingVelocitySpeed = projectile.velocity.Length();
|
||||
|
||||
// The motion moves in an imaginary circle, but the cane does not because it relies on
|
||||
// its ai[0] X multiplier, giving it the "swiping" motion.
|
||||
Vector2 flatVelocity = Vector2.UnitX.RotatedBy(MathHelper.Pi + completionAsAngle) *
|
||||
new Vector2(startingVelocitySpeed, projectile.ai[0]);
|
||||
|
||||
Vector2 destination = playerRelativePoint + flatVelocity.RotatedBy(startingVelocityRotation) +
|
||||
new Vector2(startingVelocitySpeed + TravelSpeed + 40f, 0f).RotatedBy(startingVelocityRotation);
|
||||
|
||||
Vector2 directionTowardsEnd = player.DirectionTo(destination);
|
||||
Vector2 initalVelocity = projectile.velocity.SafeNormalize(Vector2.UnitY);
|
||||
|
||||
float dustCount = 2f;
|
||||
int i = 0;
|
||||
while (i < dustCount)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f);
|
||||
dust.velocity = player.DirectionTo(dust.position) * 2f;
|
||||
dust.position = projectile.Center +
|
||||
initalVelocity.RotatedBy(completionAsAngle * 2f + i / dustCount * MathHelper.TwoPi) * 10f;
|
||||
dust.scale = 1f + Main.rand.NextFloat(0.6f);
|
||||
dust.velocity += initalVelocity * 3f;
|
||||
dust.noGravity = true;
|
||||
i++;
|
||||
}
|
||||
if (!player.frozen)
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X * 0.5f, projectile.Center.Y + projectile.velocity.Y * 0.5f,
|
||||
projectile.velocity.X * 0.8f, projectile.velocity.Y * 0.8f, ModContent.ProjectileType<BansheeHookScythe>(), (int)(projectile.damage * 1.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
projectile.spriteDirection = projectile.direction = player.direction;
|
||||
projectile.alpha -= 127;
|
||||
if (projectile.alpha < 0)
|
||||
projectile.alpha = 0;
|
||||
if (projectile.localAI[0] > 0f)
|
||||
projectile.localAI[0] -= 1f;
|
||||
float num = player.itemAnimation / (float)player.itemAnimationMax;
|
||||
float num2 = 1f - num;
|
||||
float num3 = projectile.velocity.ToRotation();
|
||||
float num4 = projectile.velocity.Length();
|
||||
float num5 = 22f;
|
||||
Vector2 spinningpoint = new Vector2(1f, 0f).RotatedBy(3.14159274f + num2 * 6.28318548f, default) * new Vector2(num4, projectile.ai[0]);
|
||||
projectile.position += spinningpoint.RotatedBy(num3, default) + new Vector2(num4 + num5, 0f).RotatedBy(num3, default);
|
||||
Vector2 destination = vector + spinningpoint.RotatedBy(num3, default) + new Vector2(num4 + num5 + 40f, 0f).RotatedBy(num3, default);
|
||||
projectile.rotation = player.AngleTo(destination) + (float)(Math.PI * 0.25) * player.direction; //or this
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation += (float)Math.PI; //change this
|
||||
player.DirectionTo(projectile.Center);
|
||||
Vector2 value = player.DirectionTo(destination);
|
||||
Vector2 vector2 = projectile.velocity.SafeNormalize(Vector2.UnitY);
|
||||
float num6 = 2f;
|
||||
int num7 = 0;
|
||||
while (num7 < num6)
|
||||
{
|
||||
Dust dust = Dust.NewDustDirect(projectile.Center, 14, 14, 60, 0f, 0f, 110, default, 1f);
|
||||
dust.velocity = player.DirectionTo(dust.position) * 2f;
|
||||
dust.position = projectile.Center + vector2.RotatedBy(num2 * 6.28318548f * 2f + num7 / num6 * 6.28318548f, default) * 10f;
|
||||
dust.scale = 1f + 0.6f * Main.rand.NextFloat();
|
||||
dust.velocity += vector2 * 3f;
|
||||
dust.noGravity = true;
|
||||
num7++;
|
||||
}
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust2 = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f);
|
||||
dust2.velocity = player.DirectionTo(dust2.position) * 2f;
|
||||
dust2.position = projectile.Center + value * -110f;
|
||||
dust2.scale = 0.45f + 0.4f * Main.rand.NextFloat();
|
||||
dust2.fadeIn = 0.7f + 0.4f * Main.rand.NextFloat();
|
||||
dust2.noGravity = true;
|
||||
dust2.noLight = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player.itemAnimation == 2)
|
||||
{
|
||||
projectile.Kill();
|
||||
player.reuseDelay = 2;
|
||||
Dust dust = Dust.NewDustDirect(projectile.Center, 20, 20, 60, 0f, 0f, 110, default, 1f);
|
||||
dust.velocity = player.DirectionTo(dust.position) * 2f;
|
||||
dust.position = projectile.Center + directionTowardsEnd * -110f;
|
||||
dust.scale = 0.45f + Main.rand.NextFloat(0.4f);
|
||||
dust.fadeIn = 0.7f + Main.rand.NextFloat(0.4f);
|
||||
dust.noGravity = true;
|
||||
dust.noLight = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Vector2 vector53 = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Texture2D texture2D31 = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type];
|
||||
Vector2 origin8 = new Vector2(projectile.spriteDirection == 1 ? texture2D31.Width - -8f : -8f, -8f); //-8 -8
|
||||
spriteBatch.Draw(texture2D31, vector53, null, new Color(255, 255, 255, 127), projectile.rotation, origin8, projectile.scale, SpriteEffects.None, 0f);
|
||||
Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Texture2D alternateHookTexture = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookAlt") : Main.projectileTexture[projectile.type];
|
||||
Vector2 origin = new Vector2(projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f);
|
||||
spriteBatch.Draw(alternateHookTexture, drawPosition, null,
|
||||
new Color(255, 255, 255, 127), projectile.rotation,
|
||||
origin, projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Vector2 vector53 = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Texture2D texture = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookAltGlow") : ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/BansheeHookGlow");
|
||||
Vector2 origin8 = new Vector2(projectile.spriteDirection == 1 ? texture.Width - -8f : -8f, -8f); //-8 -8
|
||||
spriteBatch.Draw(texture, vector53, null, Color.White, projectile.rotation, origin8, 1f, SpriteEffects.None, 0f);
|
||||
Vector2 origin = new Vector2(projectile.spriteDirection == 1 ? texture.Width - -8f : -8f, -8f); //-8 -8
|
||||
spriteBatch.Draw(texture, drawPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f);
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float f2 = projectile.rotation - 0.7853982f * Math.Sign(projectile.velocity.X) + (projectile.spriteDirection == -1 ? 3.14159274f : 0f);
|
||||
float num4 = 0f;
|
||||
float scaleFactor = -95f;
|
||||
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, 23f * projectile.scale, ref num4))
|
||||
float angle = projectile.rotation - MathHelper.PiOver4 * Math.Sign(projectile.velocity.X) +
|
||||
(projectile.spriteDirection == -1).ToInt() * MathHelper.Pi;
|
||||
|
||||
float areaCheck = -95f;
|
||||
float reduntantVariable = 0f;
|
||||
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(),
|
||||
targetHitbox.Size(), projectile.Center,
|
||||
projectile.Center + angle.ToRotationVector2() * areaCheck,
|
||||
(TravelSpeed + 1f) * projectile.scale, ref reduntantVariable))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -136,7 +123,11 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<BansheeHookBoom>(), (int)(damage * 0.25), 10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
|
||||
{
|
||||
Projectile.NewProjectile(target.Center, Vector2.Zero,
|
||||
ModContent.ProjectileType<BansheeHookBoom>(), (int)(damage * 0.25),
|
||||
10f, projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class BrimlanceProj : ModProjectile
|
||||
public class BrimlanceProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -27,40 +27,16 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.direction * 2, 0f, 150, default, 1f);
|
||||
Main.dust[num].noGravity = true;
|
||||
int idx = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 235, projectile.direction * 2, 0f, 150, default, 1f);
|
||||
Main.dust[idx].noGravity = true;
|
||||
}
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
@@ -68,20 +44,14 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
target.immune[projectile.owner] = 7;
|
||||
if (target.life <= 0)
|
||||
{
|
||||
int num251 = Main.rand.Next(2, 5);
|
||||
int flameCount = Main.rand.Next(2, 5);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Projectile.NewProjectile(target.Center.X, target.Center.Y, 0f, 0f, ModContent.ProjectileType<BrimlanceHellfireExplosion>(), (int)(projectile.damage * 0.75), knockback, Main.myPlayer);
|
||||
for (int num252 = 0; num252 < num251; num252++)
|
||||
Projectile.NewProjectile(target.Center, Vector2.Zero, ModContent.ProjectileType<BrimlanceHellfireExplosion>(), (int)(projectile.damage * 0.75), knockback, Main.myPlayer);
|
||||
for (int i = 0; i < flameCount; i++)
|
||||
{
|
||||
Vector2 value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
|
||||
while (value15.X == 0f && value15.Y == 0f)
|
||||
{
|
||||
value15 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
|
||||
}
|
||||
value15.Normalize();
|
||||
value15 *= Main.rand.Next(70, 101) * 0.1f;
|
||||
Projectile.NewProjectile(target.Center.X, target.Center.Y, value15.X, value15.Y, ModContent.ProjectileType<BrimlanceStandingFire>(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f);
|
||||
Vector2 fireVelocity = new Vector2(0f, Main.rand.NextFloat(7f, 10f)).RotatedByRandom(MathHelper.TwoPi);
|
||||
Projectile.NewProjectile(target.Center, fireVelocity, ModContent.ProjectileType<BrimlanceStandingFire>(), (int)(projectile.damage * 0.5), 0f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class DiseasedPikeSpear : ModProjectile
|
||||
public class DiseasedPikeSpear : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -24,42 +25,15 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(4))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
@@ -68,9 +42,9 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
target.AddBuff(ModContent.BuffType<Plague>(), 360);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X * 1.5f, projectile.velocity.Y * 1.5f, ModContent.ProjectileType<PlagueSeeker>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
Projectile.NewProjectile(projectile.Center, projectile.velocity * 1.5f, ModContent.ProjectileType<PlagueSeeker>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class EarthenPikeSpear : ModProjectile
|
||||
public class EarthenPikeSpear : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,24 +25,15 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(4))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 32, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] >= 6f)
|
||||
{
|
||||
@@ -57,23 +48,6 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
Main.projectile[proj].Calamity().forceMelee = true;
|
||||
}
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -4,10 +4,11 @@ using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class ExsanguinationLanceProjectile : ModProjectile
|
||||
public class ExsanguinationLanceProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -27,42 +28,16 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 127, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.immune[projectile.owner] = 6;
|
||||
@@ -76,25 +51,18 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800;
|
||||
Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
|
||||
float num80 = xPos;
|
||||
float speedX = target.position.X - vector2.X;
|
||||
float speedY = target.position.Y - vector2.Y;
|
||||
float dir = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
|
||||
dir = 10 / num80;
|
||||
speedX *= dir * 150;
|
||||
speedY *= dir * 150;
|
||||
if (speedX > 15f)
|
||||
speedX = 15f;
|
||||
if (speedX < -15f)
|
||||
speedX = -15f;
|
||||
if (speedY > 15f)
|
||||
speedY = 15f;
|
||||
if (speedY < -15f)
|
||||
speedY = -15f;
|
||||
float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt();
|
||||
Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
|
||||
float speedX = target.position.X - spawnPosition.X;
|
||||
float speedY = target.position.Y - spawnPosition.Y;
|
||||
float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
|
||||
magnitude = 10f / xPos;
|
||||
speedX *= magnitude * 150;
|
||||
speedY *= magnitude * 150;
|
||||
speedX = MathHelper.Clamp(speedX, -15f, 15f);
|
||||
speedY = MathHelper.Clamp(speedY, -15f, 15f);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ModContent.ProjectileType<TinyFlare>(), (int)(projectile.damage * 0.5), 2f, projectile.owner);
|
||||
Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ModContent.ProjectileType<TinyFlare>(), (int)(projectile.damage * 0.5), 2f, projectile.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class FulgurationHalberdProj : ModProjectile
|
||||
public class FulgurationHalberdProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -24,36 +25,11 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
projectile.ai[0] -= 2.4f;
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.immune[projectile.owner] = 8;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class GildedProboscisProj : ModProjectile
|
||||
public class GildedProboscisProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,45 +24,21 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 1;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
// These numbers sure are common, huh?
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(4))
|
||||
{
|
||||
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 60, projectile.direction * 2, 0f, 150, default, 1f);
|
||||
Main.dust[num].noGravity = true;
|
||||
}
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
projectile.localAI[0] = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class GoldplumeSpearProjectile : ModProjectile
|
||||
public class GoldplumeSpearProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -23,24 +23,14 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1.1f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] >= 6f)
|
||||
{
|
||||
@@ -51,19 +41,6 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType<Feather>(), (int)(projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
projectile.ai[0] -= 1.1f;
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class HeartRapierProjectile : ModProjectile
|
||||
public class HeartRapierProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,36 +25,25 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1.1f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 12, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
projectile.localAI[0] += 1f;
|
||||
if (projectile.localAI[0] >= 6f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
projectile.localAI[0] = 0f;
|
||||
if (Main.myPlayer == projectile.owner)
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType<Feather>(), (int)(projectile.damage * 0.2), 0f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
projectile.ai[0] -= 1.1f;
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -3,10 +3,11 @@ using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class HellionFlowerSpearProjectile : ModProjectile
|
||||
public class HellionFlowerSpearProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -26,71 +27,33 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 44, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<HellionSpike>(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y, projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<HellionSpike>(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
};
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
target.immune[projectile.owner] = 8;
|
||||
target.AddBuff(BuffID.Venom, 300);
|
||||
if (crit)
|
||||
{
|
||||
float xPos = Main.rand.NextBool(2) ? projectile.position.X + 800 : projectile.position.X - 800;
|
||||
Vector2 vector2 = new Vector2(xPos, projectile.position.Y - Main.rand.Next(600, 801));
|
||||
float num80 = xPos;
|
||||
float speedX = target.position.X - vector2.X;
|
||||
float speedY = target.position.Y - vector2.Y;
|
||||
float dir = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
|
||||
dir = 10 / num80;
|
||||
speedX *= dir * 150;
|
||||
speedY *= dir * 150;
|
||||
if (speedX > 15f)
|
||||
speedX = 15f;
|
||||
if (speedX < -15f)
|
||||
speedX = -15f;
|
||||
if (speedY > 15f)
|
||||
speedY = 15f;
|
||||
if (speedY < -15f)
|
||||
speedY = -15f;
|
||||
float xPos = projectile.position.X + 800f * Main.rand.NextBool(2).ToDirectionInt();
|
||||
Vector2 spawnPosition = new Vector2(xPos, projectile.position.Y - Main.rand.Next(-800, 801));
|
||||
float speedX = target.position.X - spawnPosition.X;
|
||||
float speedY = target.position.Y - spawnPosition.Y;
|
||||
float magnitude = (float)Math.Sqrt(speedX * speedX + speedY * speedY);
|
||||
magnitude = 10f / xPos;
|
||||
speedX *= magnitude * 150;
|
||||
speedY *= magnitude * 150;
|
||||
speedX = MathHelper.Clamp(speedX, -15f, 15f);
|
||||
speedY = MathHelper.Clamp(speedY, -15f, 15f);
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
Projectile.NewProjectile(vector2.X, vector2.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner);
|
||||
Projectile.NewProjectile(spawnPosition.X, spawnPosition.Y, speedX, speedY, ProjectileID.FlowerPetal, (int)(projectile.damage * 0.5), 2f, projectile.owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class InsidiousImpalerProj : ModProjectile
|
||||
public class InsidiousImpalerProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -26,46 +26,18 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 8;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1.1f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 1.1f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<InsidiousHarpoon>(), (int)(projectile.damage * 0.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<InsidiousHarpoon>(), (int)(projectile.damage * 0.75), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
};
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class MarniteSpearProjectile : ModProjectile
|
||||
public class MarniteSpearProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -23,36 +21,11 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
projectile.ai[0] -= 1.1f;
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1.1f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,14 @@
|
||||
using CalamityMod.Items.Weapons.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class NadirSpear : ModProjectile
|
||||
public class NadirSpear : BaseSpearProjectile
|
||||
{
|
||||
private const float StartOffset = 5.5f;
|
||||
private const float OutSpeed = 1.1f;
|
||||
private const float BackSpeed = 2.1f;
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
DisplayName.SetDefault("Nadir");
|
||||
@@ -27,84 +24,43 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.friendly = true;
|
||||
projectile.tileCollide = false;
|
||||
projectile.ignoreWater = true;
|
||||
|
||||
projectile.hide = true;
|
||||
|
||||
projectile.penetrate = -1;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 2;
|
||||
}
|
||||
|
||||
// ai[0] is the current offset of the spear. Positive is further away from the player.
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 5.5f;
|
||||
public override float ReelbackSpeed => 2.1f;
|
||||
public override float ForwardSpeed => 1.1f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
// On the first frame, set the spear at its starting offset
|
||||
if (projectile.ai[0] == 0f)
|
||||
int damage = Nadir.BaseDamage / 5;
|
||||
float kb = 5.5f;
|
||||
Vector2 projPos = projectile.Center + projectile.velocity;
|
||||
Vector2 projVel = projectile.velocity * 0.75f;
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
Projectile.NewProjectile(projPos, projVel, ModContent.ProjectileType<VoidEssence>(), damage, kb, projectile.owner, 0f, 0f);
|
||||
|
||||
// Play a screaming soul sound effect (unused Shadowflame Hex Doll noise)
|
||||
Main.PlaySound(SoundID.Item104, projectile.Center);
|
||||
|
||||
// Create a circle of purple dust where the projectile comes out, looking like the edge of a portal
|
||||
int circleDust = 18;
|
||||
Vector2 baseDustVel = new Vector2(3.8f, 0f);
|
||||
for (int i = 0; i < circleDust; ++i)
|
||||
{
|
||||
projectile.ai[0] = StartOffset;
|
||||
projectile.netUpdate = true;
|
||||
int dustID = 27;
|
||||
float angle = i * (MathHelper.TwoPi / circleDust);
|
||||
Vector2 dustVel = baseDustVel.RotatedBy(angle);
|
||||
|
||||
int idx = Dust.NewDust(projectile.Center, 1, 1, dustID);
|
||||
Main.dust[idx].noGravity = true;
|
||||
Main.dust[idx].position = projectile.Center;
|
||||
Main.dust[idx].velocity = dustVel;
|
||||
Main.dust[idx].scale = 2.4f;
|
||||
}
|
||||
|
||||
// Update the player so that he/she is still holding the spear
|
||||
Player player = Main.player[projectile.owner];
|
||||
player.direction = projectile.direction;
|
||||
player.heldProj = projectile.whoAmI;
|
||||
player.itemTime = player.itemAnimation;
|
||||
|
||||
// Update the spear so that it continues to be "held" by the player every frame
|
||||
projectile.position.X = player.position.X + player.width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = player.position.Y + player.height / 2 - projectile.height / 2;
|
||||
|
||||
// Move the spear based on its current offset
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
|
||||
// The spear is returning for the last 1/3 of the item's animation
|
||||
if (player.itemAnimation < player.itemAnimationMax / 3f)
|
||||
{
|
||||
projectile.ai[0] -= BackSpeed;
|
||||
|
||||
// On the very first returning frame, fire the projectile
|
||||
if (projectile.localAI[0] == 0f)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
|
||||
int damage = Nadir.BaseDamage / 5;
|
||||
float kb = 5.5f;
|
||||
Vector2 projPos = projectile.Center + projectile.velocity;
|
||||
Vector2 projVel = projectile.velocity * 0.75f;
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
Projectile.NewProjectile(projPos, projVel, ModContent.ProjectileType<VoidEssence>(), damage, kb, projectile.owner, 0f, 0f);
|
||||
|
||||
// Play a screaming soul sound effect (unused Shadowflame Hex Doll noise)
|
||||
Main.PlaySound(SoundID.Item104, projectile.Center);
|
||||
|
||||
// Create a circle of purple dust where the projectile comes out, looking like the edge of a portal
|
||||
int circleDust = 18;
|
||||
Vector2 baseDustVel = new Vector2(3.8f, 0f);
|
||||
for (int i = 0; i < circleDust; ++i)
|
||||
{
|
||||
int dustID = 27;
|
||||
float angle = i * (MathHelper.TwoPi / circleDust);
|
||||
Vector2 dustVel = baseDustVel.RotatedBy(angle);
|
||||
|
||||
int idx = Dust.NewDust(projectile.Center, 1, 1, dustID);
|
||||
Main.dust[idx].noGravity = true;
|
||||
Main.dust[idx].position = projectile.Center;
|
||||
Main.dust[idx].velocity = dustVel;
|
||||
Main.dust[idx].scale = 2.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For the remaining 2/3, the spear is heading out and doing nothing.
|
||||
else
|
||||
projectile.ai[0] += OutSpeed;
|
||||
|
||||
// If the player is no longer using an item (e.g. they die), kill the spear instantly.
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
// Produce dust at all times while the spear is moving.
|
||||
};
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
int movingDust = 3;
|
||||
for (int i = 0; i < movingDust; ++i)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class SausageMakerSpear : ModProjectile
|
||||
public class SausageMakerSpear : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -23,40 +23,17 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1.1f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 5, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
projectile.ai[0] -= 1.1f;
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
if (projectile.owner == Main.myPlayer)
|
||||
|
||||
@@ -4,9 +4,10 @@ using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class SpatialLanceProjectile : ModProjectile
|
||||
public class SpatialLanceProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -26,50 +27,25 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.usesLocalNPCImmunity = true;
|
||||
projectile.localNPCHitCooldown = 3;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 1.1f;
|
||||
public override float ForwardSpeed => 0.6f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType<SpatialSpear>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
};
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
||||
Main.dust[num].noGravity = true;
|
||||
int idx = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 66, projectile.direction * 2, 0f, 150, new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), 1f);
|
||||
Main.dust[idx].noGravity = true;
|
||||
}
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 1.1f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X, projectile.velocity.Y, ModContent.ProjectileType<SpatialSpear>(), projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.6f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class StarnightLanceProjectile : ModProjectile
|
||||
public class StarnightLanceProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,45 +25,19 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<StarnightBeam>(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
};
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 29, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 2.4f, projectile.velocity.Y * 2.4f, ModContent.ProjectileType<StarnightBeam>(), (int)(projectile.damage * 0.8), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class StreamGougeProj : ModProjectile
|
||||
public class StreamGougeProj : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -31,49 +31,21 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.localNPCHitCooldown = 1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
int num = Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 173, projectile.direction * 2, 0f, 150, default, 1f);
|
||||
Main.dust[num].noGravity = true;
|
||||
}
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, projectile.velocity.X, projectile.velocity.Y,
|
||||
ModContent.ProjectileType<EssenceBeam>(), projectile.damage * 4, projectile.knockBack, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ForwardSpeed => 2.4f;
|
||||
public override float ReelbackSpeed => 3f;
|
||||
|
||||
public override void PostDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Vector2 origin = new Vector2(0f, 0f);
|
||||
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/StreamGougeGlow"), projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, 1f, SpriteEffects.None, 0f);
|
||||
spriteBatch.Draw(ModContent.GetTexture("CalamityMod/Projectiles/Melee/Spears/StreamGougeGlow"),
|
||||
projectile.Center - Main.screenPosition,
|
||||
null,
|
||||
Color.White,
|
||||
projectile.rotation,
|
||||
Vector2.Zero,
|
||||
1f,
|
||||
SpriteEffects.None,
|
||||
0f);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class TerraLanceProjectile : ModProjectile
|
||||
public class TerraLanceProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -23,45 +24,19 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, ModContent.ProjectileType<TerraSpear>(), (int)(projectile.damage * 0.85), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
};
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (Main.rand.NextBool(5))
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f);
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 1.4f, projectile.velocity.Y * 1.4f, ModContent.ProjectileType<TerraSpear>(), (int)(projectile.damage * 0.85), projectile.knockBack * 0.85f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 107, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f);
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class UrchinSpearProjectile : ModProjectile
|
||||
public class UrchinSpearProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,44 +25,16 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override Action<Projectile> EffectBeforeReelback => (proj) =>
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
{
|
||||
projectile.ai[0] -= 2.4f;
|
||||
if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner)
|
||||
{
|
||||
projectile.localAI[0] = 1f;
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
Projectile.NewProjectile(projectile.Center.X + projectile.velocity.X, projectile.Center.Y + projectile.velocity.Y,
|
||||
projectile.velocity.X * 1.6f, projectile.velocity.Y * 1.6f, ModContent.ProjectileType<UrchinSpikeFugu>(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
projectile.ai[0] += 0.95f;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
};
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Melee.Spears
|
||||
{
|
||||
public class YateveoBloomSpear : ModProjectile
|
||||
public class YateveoBloomSpear : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -25,19 +25,14 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
projectile.ignoreWater = true;
|
||||
projectile.penetrate = -1;
|
||||
projectile.ownerHitCheck = true;
|
||||
projectile.hide = true;
|
||||
projectile.Calamity().trueMelee = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
public override float InitialSpeed => 3f;
|
||||
public override float ReelbackSpeed => 2.4f;
|
||||
public override float ForwardSpeed => 0.95f;
|
||||
public override void ExtraBehavior()
|
||||
{
|
||||
Main.player[projectile.owner].direction = projectile.direction;
|
||||
Main.player[projectile.owner].heldProj = projectile.whoAmI;
|
||||
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
|
||||
projectile.position.X = Main.player[projectile.owner].position.X + Main.player[projectile.owner].width / 2 - projectile.width / 2;
|
||||
projectile.position.Y = Main.player[projectile.owner].position.Y + Main.player[projectile.owner].height / 2 - projectile.height / 2;
|
||||
projectile.position += projectile.velocity * projectile.ai[0];
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
int dustType = Main.rand.Next(5);
|
||||
@@ -61,25 +56,6 @@ namespace CalamityMod.Projectiles.Melee.Spears
|
||||
Main.dust[dust].noGravity = true;
|
||||
Main.dust[dust].scale = 1.5f;
|
||||
}
|
||||
|
||||
if (projectile.ai[0] == 0f)
|
||||
{
|
||||
projectile.ai[0] = 3f;
|
||||
projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
|
||||
projectile.ai[0] -= 2.4f;
|
||||
else
|
||||
projectile.ai[0] += 0.95f;
|
||||
|
||||
if (Main.player[projectile.owner].itemAnimation == 0)
|
||||
projectile.Kill();
|
||||
|
||||
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + 2.355f;
|
||||
|
||||
if (projectile.spriteDirection == -1)
|
||||
projectile.rotation -= 1.57f;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public class SlickCaneProjectile : ModProjectile
|
||||
public class SlickCaneProjectile : BaseSpearProjectile
|
||||
{
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
@@ -29,74 +31,29 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
projectile.localNPCHitCooldown = 2;
|
||||
projectile.alpha = 180;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Player player = Main.player[projectile.owner];
|
||||
Vector2 vector = player.Center;
|
||||
projectile.direction = player.direction;
|
||||
player.heldProj = projectile.whoAmI;
|
||||
projectile.Center = vector;
|
||||
if (player.dead)
|
||||
{
|
||||
projectile.Kill();
|
||||
return;
|
||||
}
|
||||
if (!player.frozen)
|
||||
{
|
||||
projectile.spriteDirection = projectile.direction = player.direction;
|
||||
projectile.alpha -= 127;
|
||||
if (projectile.alpha < 0)
|
||||
{
|
||||
projectile.alpha = 0;
|
||||
}
|
||||
if (projectile.localAI[0] > 0f)
|
||||
{
|
||||
projectile.localAI[0] -= 1f;
|
||||
}
|
||||
float itemAnimationRatio = (float)player.itemAnimation / (float)player.itemAnimationMax;
|
||||
float inverseItemAnimationRatio = 1f - itemAnimationRatio;
|
||||
float rotatedVelocity = projectile.velocity.ToRotation();
|
||||
float velocityMagnitude = projectile.velocity.Length();
|
||||
float additive = 22f;
|
||||
Vector2 spinningpoint = Vector2.UnitX.RotatedBy((double)(MathHelper.Pi + inverseItemAnimationRatio * MathHelper.TwoPi), default) * new Vector2(velocityMagnitude, projectile.ai[0]) * 0.7f;
|
||||
projectile.position += spinningpoint.RotatedBy((double)rotatedVelocity, default) + new Vector2(velocityMagnitude + additive, 0f).RotatedBy((double)rotatedVelocity, default) / 15f;
|
||||
Vector2 destination = vector + spinningpoint.RotatedBy((double)rotatedVelocity, default) + new Vector2(velocityMagnitude + additive + 40f, 0f).RotatedBy((double)rotatedVelocity, default) / 1.8f;
|
||||
projectile.rotation = player.AngleTo(destination) + ((float)(Math.PI * 0.25)) * (float)player.direction; //or this
|
||||
if (projectile.spriteDirection == -1)
|
||||
{
|
||||
projectile.rotation += (float)Math.PI; //change this
|
||||
}
|
||||
player.DirectionTo(projectile.Center);
|
||||
}
|
||||
if (player.itemAnimation == 2)
|
||||
{
|
||||
projectile.Kill();
|
||||
player.reuseDelay = 2;
|
||||
}
|
||||
}
|
||||
public override SpearType SpearAiType => SpearType.GhastlyGlaiveSpear;
|
||||
public override float TravelSpeed => 8f;
|
||||
|
||||
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
||||
{
|
||||
Color color25 = Lighting.GetColor((int)((double)projectile.position.X + (double)projectile.width * 0.5) / 16, (int)(((double)projectile.position.Y + (double)projectile.height * 0.5) / 16.0));
|
||||
Vector2 vector53 = projectile.position + new Vector2((float)projectile.width, (float)projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Texture2D texture2D31 = (projectile.spriteDirection == -1) ? ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt") : Main.projectileTexture[projectile.type];
|
||||
Color alpha4 = projectile.GetAlpha(color25);
|
||||
Vector2 origin8 = new Vector2((float)texture2D31.Width, (float)texture2D31.Height) / 2f;
|
||||
origin8 = new Vector2((projectile.spriteDirection == 1) ? ((float)texture2D31.Width - -8f) : -8f, -8f); //-8 -8
|
||||
SpriteBatch arg_E055_0 = Main.spriteBatch;
|
||||
Vector2 arg_E055_2 = vector53;
|
||||
Rectangle? sourceRectangle2 = null;
|
||||
arg_E055_0.Draw(texture2D31, arg_E055_2, sourceRectangle2, new Color(255, 255, 255, 127), projectile.rotation, origin8, projectile.scale, SpriteEffects.None, 0f);
|
||||
Vector2 drawPosition = projectile.position + new Vector2(projectile.width, projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition;
|
||||
Texture2D alternateHookTexture = projectile.spriteDirection == -1 ? ModContent.GetTexture("CalamityMod/Projectiles/Rogue/SlickCaneProjectileAlt") : Main.projectileTexture[projectile.type];
|
||||
Vector2 origin = new Vector2(projectile.spriteDirection == 1 ? alternateHookTexture.Width + 8f : -8f, -8f);
|
||||
spriteBatch.Draw(alternateHookTexture, drawPosition, null,
|
||||
lightColor, projectile.rotation,
|
||||
origin, projectile.scale, SpriteEffects.None, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float f2 = projectile.rotation - 0.7853982f * (float)Math.Sign(projectile.velocity.X) + ((projectile.spriteDirection == -1) ? 3.14159274f : 0f);
|
||||
float f2 = projectile.rotation - MathHelper.PiOver4 *
|
||||
Math.Sign(projectile.velocity.X) + (projectile.spriteDirection == -1).ToInt() * MathHelper.Pi;
|
||||
float velocityMagnitude = 0f;
|
||||
float scaleFactor = -95f;
|
||||
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor, 23f * projectile.scale, ref velocityMagnitude))
|
||||
float scaleFactor = 35f;
|
||||
if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(),
|
||||
projectile.Center, projectile.Center + f2.ToRotationVector2() * scaleFactor,
|
||||
(TravelSpeed + 1f) * projectile.scale, ref velocityMagnitude))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -108,25 +65,14 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if ((target.damage > 5 || target.boss) && player.whoAmI == Main.myPlayer && !target.SpawnedFromStatue)
|
||||
{
|
||||
float moneyValueToDrop = target.value / Main.rand.NextFloat(15f, 35f);
|
||||
if (projectile.Calamity().stealthStrike && Main.rand.NextBool(15))
|
||||
// Maximum of 50 silver, not counting steath strikes
|
||||
moneyValueToDrop = (int)MathHelper.Clamp(moneyValueToDrop, 0, 5000f);
|
||||
if (projectile.Calamity().stealthStrike && Main.rand.NextBool(15))
|
||||
{
|
||||
moneyValueToDrop += Item.buyPrice(0, Main.rand.Next(1, 4), Main.rand.Next(0, 100), Main.rand.Next(0, 100));
|
||||
}
|
||||
if (moneyValueToDrop > 1000000f)
|
||||
{
|
||||
int modifiedMoneyValue = (int)(moneyValueToDrop / 1000000f);
|
||||
if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0)
|
||||
{
|
||||
modifiedMoneyValue /= Main.rand.Next(3) + 1;
|
||||
}
|
||||
if (Main.rand.Next(5) == 0)
|
||||
{
|
||||
modifiedMoneyValue /= Main.rand.Next(3) + 1;
|
||||
}
|
||||
moneyValueToDrop -= (float)(1000000 * modifiedMoneyValue);
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 74, modifiedMoneyValue, false, 0, false, false);
|
||||
}
|
||||
else if (moneyValueToDrop > 10000f)
|
||||
|
||||
while (moneyValueToDrop > 10000f)
|
||||
{
|
||||
int modifiedMoneyValue = (int)(moneyValueToDrop / 10000f);
|
||||
if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0)
|
||||
@@ -137,10 +83,10 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
modifiedMoneyValue /= Main.rand.Next(3) + 1;
|
||||
}
|
||||
moneyValueToDrop -= (float)(10000 * modifiedMoneyValue);
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 73, modifiedMoneyValue, false, 0, false, false);
|
||||
moneyValueToDrop -= 10000 * modifiedMoneyValue;
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.GoldCoin, modifiedMoneyValue, false, 0, false, false);
|
||||
}
|
||||
else if (moneyValueToDrop > 100f)
|
||||
while (moneyValueToDrop > 100f)
|
||||
{
|
||||
int modifiedMoneyValue = (int)(moneyValueToDrop / 100f);
|
||||
if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0)
|
||||
@@ -151,11 +97,11 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
modifiedMoneyValue /= Main.rand.Next(3) + 1;
|
||||
}
|
||||
moneyValueToDrop -= (float)(100 * modifiedMoneyValue);
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 72, modifiedMoneyValue, false, 0, false, false);
|
||||
moneyValueToDrop -= 100 * modifiedMoneyValue;
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.SilverCoin, modifiedMoneyValue, false, 0, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (moneyValueToDrop > 0f)
|
||||
{
|
||||
int modifiedMoneyValue = (int)moneyValueToDrop;
|
||||
if (modifiedMoneyValue > 50 && Main.rand.Next(5) == 0)
|
||||
{
|
||||
@@ -169,8 +115,8 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
modifiedMoneyValue = 1;
|
||||
}
|
||||
moneyValueToDrop -= (float)modifiedMoneyValue;
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, 71, modifiedMoneyValue, false, 0, false, false);
|
||||
moneyValueToDrop -= modifiedMoneyValue;
|
||||
Item.NewItem((int)target.position.X, (int)target.position.Y, target.width, target.height, ItemID.CopperCoin, modifiedMoneyValue, false, 0, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user