Leviathan Teeth stealth remake
Also slightly changes the regular throw but not by an amount that should effect balance.
This commit is contained in:
1 parent
dffa920129
commit
4fb5d74ef1
5 files changed
+235
-119
No files matched your search
@@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
Item.value = CalamityGlobalItem.RarityLimeBuyPrice;
|
||||
Item.rare = ItemRarityID.Lime;
|
||||
Item.shoot = ModContent.ProjectileType<LeviathanTooth>();
|
||||
Item.shootSpeed = 5.5f;
|
||||
Item.shootSpeed = 7.5f;
|
||||
Item.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
|
||||
@@ -36,14 +36,13 @@ namespace CalamityMod.Items.Weapons.Rogue
|
||||
{
|
||||
if (player.Calamity().StealthStrikeAvailable())
|
||||
{
|
||||
Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity * 1.5f, type, damage, knockback * 12, player.whoAmI, 0f, 4f);
|
||||
Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.SafeNormalize(Vector2.UnitX), ModContent.ProjectileType<LeviathanToothStealth>(), damage, 0, player.whoAmI, 0, 0);
|
||||
tooth.Calamity().stealthStrike = true;
|
||||
tooth.timeLeft = 140;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.05f + i * 0.15f) * Main.rand.NextFloat(0.7f, 1f), type, damage, knockback, player.whoAmI, 0f, Main.rand.Next(1, 3+1));
|
||||
Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.05f + i * 0.15f) * Main.rand.NextFloat(0.8f, 1f), type, damage, knockback, player.whoAmI, 0f, Main.rand.Next(1, 3+1));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ LeviathanTeeth: {
|
||||
'''
|
||||
Rapidly throws a spread of teeth that stick into enemies
|
||||
After sticking to an enemy, the teeth will gouge through them and shoot out the other side
|
||||
Stealth strikes throw a single piercing tooth that creates a jawline of teeth to maul your foes
|
||||
Stealth strikes create a clamping jaw of teeth to maul your foes
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@ LeonidCometSmall.DisplayName: Leonid Comet
|
||||
LeonidProgenitorBombshell.DisplayName: Leonid Bombshell
|
||||
LeonidStar.DisplayName: Leonid Star
|
||||
LeviathanTooth.DisplayName: Leviathan Tooth
|
||||
LeviathanToothStealth.DisplayName: Leviathan Jaw
|
||||
LionfishProj.DisplayName: Lionfish
|
||||
LostSoulFriendly.DisplayName: Lost Soul
|
||||
LuminousShard.DisplayName: Stardust Shard
|
||||
|
||||
@@ -23,18 +23,13 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
public bool canDamage = true;
|
||||
public bool canStick = true;
|
||||
public Vector2 vibrate = Vector2.Zero;
|
||||
public int stuckTimer = 120;
|
||||
public int stuckTimer = 180;
|
||||
public Vector2 placementCenter;
|
||||
float placementDistance;
|
||||
Vector2 placementVelocity;
|
||||
public Vector2 storedVelocity;
|
||||
public bool collideWithTiles = true;
|
||||
|
||||
public bool jawline = true; // Tooth direction for the stealthstrike
|
||||
public Vector2 startingVel;
|
||||
public bool toothDirection = false;
|
||||
public Vector2 chomp = Vector2.Zero;
|
||||
public bool chomping = true;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 8;
|
||||
@@ -48,39 +43,42 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.extraUpdates = 3;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.noEnchantmentVisuals = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Red, Color.White, 0.85f).ToVector3() * 0.5f * Utils.GetLerpValue(255, 0, Projectile.alpha, true));
|
||||
if (time == 0)
|
||||
{
|
||||
stuckTimer = Main.rand.Next(100, 120 + 1);
|
||||
startingVel = Projectile.velocity;
|
||||
if (Projectile.ai[1] < 4)
|
||||
toothDirection = Main.rand.NextBool();
|
||||
}
|
||||
if (!stuckInTarget && !stuckInGround)
|
||||
{
|
||||
if (!Projectile.Calamity().stealthStrike)
|
||||
if (Projectile.velocity.Length() > 5 && time > 30 && Projectile.numHits == 0)
|
||||
Projectile.velocity *= 0.97f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if ((time % 2 == 0 || !canStick) && time > 5)
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
if ((time % 2 == 0 || !canStick) && time > 15)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
if (time > 90 && canStick)
|
||||
{
|
||||
Projectile.velocity.Y += 0.03f;
|
||||
if (Projectile.velocity.Y > 0)
|
||||
Projectile.velocity.X *= 0.99f;
|
||||
}
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f) * (canStick ? 1 : 1.3f));
|
||||
dust.noGravity = true;
|
||||
Particle blood = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(canStick ? 0.3f : 0.1f) * Main.rand.NextFloat(5f, 8f), "CalamityMod/Particles/LargeBloom",
|
||||
false, 8, Main.rand.NextFloat(0.055f, 0.07f), Color.Lerp(Color.DarkRed, Color.Black, Main.rand.NextFloat(0, 0.5f)) * 0.7f, new Vector2(0.7f, 1f), false, shrinkSpeed: 0.8f);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
}
|
||||
if (time > 90 && canStick)
|
||||
{
|
||||
Projectile.velocity.Y += 0.03f;
|
||||
if (Projectile.velocity.Y > 0)
|
||||
Projectile.velocity.X *= 0.99f;
|
||||
}
|
||||
}
|
||||
else if (stuckInTarget)
|
||||
@@ -107,7 +105,8 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
vibrate = Vector2.Zero;
|
||||
canStick = false;
|
||||
collideWithTiles = true;
|
||||
Projectile.velocity = storedVelocity * 1.3f;
|
||||
Projectile.velocity = storedVelocity;
|
||||
Projectile.extraUpdates = 4;
|
||||
stuckInTarget = false;
|
||||
|
||||
for (int i = 0; i <= 7; i++)
|
||||
@@ -130,117 +129,33 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.rotation = storedVelocity.ToRotation() + MathHelper.PiOver2;
|
||||
}
|
||||
|
||||
if (Projectile.Calamity().stealthStrike)
|
||||
{
|
||||
collideWithTiles = false;
|
||||
if (time > 15 && (Projectile.ai[1] == 4 ? Projectile.timeLeft > 60 : time < 40))
|
||||
{
|
||||
for (int i = 0; i < (Projectile.ai[1] == 4 ? 2 : 1); i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.6f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
if (Projectile.ai[1] == 4)
|
||||
{
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
int jawDir = jawline ? 1 : -1;
|
||||
Vector2 spawnPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90f * jawDir)) * 170;
|
||||
Vector2 jawVel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90f * jawDir)) * 17;
|
||||
if (time > 10 && Projectile.timeLeft >= 60)
|
||||
{
|
||||
if (time % 3 == 0)
|
||||
{
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Projectile tooth = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnPos, jawVel, ModContent.ProjectileType<LeviathanTooth>(), Projectile.damage, Projectile.knockBack / 12, Projectile.owner, 0, Main.rand.Next(1, 3 + 1), Projectile.velocity.X > 0 ? 1 : -1);
|
||||
tooth.Calamity().stealthStrike = true;
|
||||
tooth.timeLeft = 120;
|
||||
tooth.extraUpdates = 0;
|
||||
tooth.usesLocalNPCImmunity = false;
|
||||
tooth.usesIDStaticNPCImmunity = true;
|
||||
tooth.idStaticNPCHitCooldown = 8;
|
||||
}
|
||||
jawline = !jawline;
|
||||
}
|
||||
if (time % 2 == 0)
|
||||
{
|
||||
Particle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 15, 1f, Color.DarkRed * 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
if (Projectile.timeLeft == 60)
|
||||
Projectile.velocity *= 0.5f;
|
||||
}
|
||||
else if (Projectile.timeLeft <= 60)
|
||||
{
|
||||
Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0));
|
||||
Projectile.velocity *= 0.95f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.rotation = startingVel.ToRotation() + MathHelper.ToRadians(270f);
|
||||
if (Projectile.timeLeft > 90)
|
||||
{
|
||||
Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, -startingVel.X * 1.3f, 0.045f);
|
||||
Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, -startingVel.Y * 1.3f, 0.045f);
|
||||
Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 120, 90, 255, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 30, 255, 0));
|
||||
Projectile.velocity *= 0.9f;
|
||||
}
|
||||
if (time > 40)
|
||||
{
|
||||
if (!chomping)
|
||||
{
|
||||
chomp.X = MathHelper.Lerp(chomp.X, startingVel.X * 3, 0.2f);
|
||||
chomp.Y = MathHelper.Lerp(chomp.Y, startingVel.Y * 3, 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
chomp.X = MathHelper.Lerp(chomp.X, 0, 0.2f);
|
||||
chomp.Y = MathHelper.Lerp(chomp.Y, 0, 0.2f);
|
||||
}
|
||||
if (time % 18 == 0)
|
||||
chomping = !chomping;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
time++;
|
||||
|
||||
if (collideWithTiles && Collision.SolidCollision(Projectile.Center, 4, 4)) // Vanilla tile collision messes with velocity so we use this instead
|
||||
{
|
||||
canDamage = false;
|
||||
if (Projectile.timeLeft > 180)
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.timeLeft = 180;
|
||||
stuckInGround = true;
|
||||
storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
SoundStyle sound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit1");
|
||||
SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.6f) }, Projectile.Center);
|
||||
collideWithTiles = false;
|
||||
|
||||
}
|
||||
|
||||
if (!Projectile.Calamity().stealthStrike)
|
||||
Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0));
|
||||
Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0));
|
||||
time++;
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (!Projectile.Calamity().stealthStrike)
|
||||
modifiers.SourceDamage *= target == chosenTarget ? 1 : (canStick ? 0.2f : 0.5f);
|
||||
modifiers.SourceDamage *= target == chosenTarget ? 1 : (canStick ? 0.2f : 0.5f);
|
||||
}
|
||||
public override bool? CanDamage() => canDamage ? null : false;
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
if (target == chosenTarget || Projectile.Calamity().stealthStrike)
|
||||
if (target == chosenTarget)
|
||||
target.AddBuff(ModContent.BuffType<HeavyBleeding>(), 180);
|
||||
if (!stuckInTarget && canStick && !Projectile.Calamity().stealthStrike)
|
||||
if (!stuckInTarget && canStick)
|
||||
{
|
||||
if (Projectile.timeLeft < 400)
|
||||
Projectile.timeLeft = 400;
|
||||
@@ -266,10 +181,10 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
if (Projectile.ai[1] == 4)
|
||||
tex = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/GreenWater").Value;
|
||||
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + vibrate + chomp, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, toothDirection ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + vibrate, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, toothDirection ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Calamity().stealthStrike ? 50 : 18, targetHitbox);
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18, targetHitbox);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.NPCs;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static Terraria.Player;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
[PierceResistException]
|
||||
public class LeviathanToothStealth : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/Rogue/LeviathanTooth";
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
|
||||
public bool canDamage = false;
|
||||
public bool isTopJaw = false;
|
||||
public float topJawRot = 0;
|
||||
public float bottomJawRot = 0;
|
||||
public int jawSlamTime = 25;
|
||||
public bool spawnedDust = false;
|
||||
public int jawLength = 750;
|
||||
public int hitTimer = 0;
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 8;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 2;
|
||||
Projectile.height = 2;
|
||||
Projectile.friendly = true;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.extraUpdates = 0;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.timeLeft = 180;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 8;
|
||||
Projectile.ArmorPenetration = 25;
|
||||
Projectile.noEnchantmentVisuals = true;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (hitTimer > 0)
|
||||
hitTimer--;
|
||||
if (time == 0)
|
||||
{
|
||||
topJawRot = -MathHelper.PiOver4;
|
||||
bottomJawRot = MathHelper.PiOver4;
|
||||
}
|
||||
topJawRot *= 0.95f;
|
||||
bottomJawRot *= 0.95f;
|
||||
float openingRot = 0.5f;
|
||||
if (time <= 10)
|
||||
{
|
||||
float lerpValue = 1 - (float)Math.Pow(Utils.GetLerpValue(10, 0, time, true), 2);
|
||||
topJawRot = MathHelper.Lerp(-MathHelper.PiOver4, -MathHelper.PiOver4 - openingRot, lerpValue);
|
||||
bottomJawRot = MathHelper.Lerp(MathHelper.PiOver4, MathHelper.PiOver4 + openingRot, lerpValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
float lerpValue = (float)Math.Pow(Utils.GetLerpValue(11, jawSlamTime, time, true), 4);
|
||||
topJawRot = MathHelper.Lerp(-MathHelper.PiOver4 - openingRot, 0, lerpValue);
|
||||
bottomJawRot = MathHelper.Lerp(MathHelper.PiOver4 + openingRot, 0, lerpValue);
|
||||
}
|
||||
|
||||
if (time < jawSlamTime * 1.5f)
|
||||
{
|
||||
Owner.direction = Projectile.direction;
|
||||
if (time < jawSlamTime)
|
||||
{
|
||||
Projectile.Center = Owner.Center;
|
||||
Projectile.velocity = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld) * 0.01f;
|
||||
}
|
||||
Owner.itemTime = Owner.itemAnimation = 2;
|
||||
Vector2 toMouse = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld);
|
||||
Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, toMouse.ToRotation() + topJawRot * Owner.direction + MathHelper.PiOver2 * -Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0));
|
||||
Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, toMouse.ToRotation() + bottomJawRot * Owner.direction + MathHelper.PiOver2 * -Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0));
|
||||
}
|
||||
if (time == jawSlamTime)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 5f;
|
||||
Owner.Calamity().ConsumeStealthByAttacking();
|
||||
SoundStyle crunch = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath");
|
||||
for (int i = 0; i < 3; i++)
|
||||
SoundEngine.PlaySound(crunch with { Volume = 0.4f, Pitch = -0.1f * i, MaxInstances = 3 }, Projectile.Center);
|
||||
SoundStyle crunch2 = new("CalamityMod/Sounds/NPCHit/RavagerHurt3");
|
||||
for (int i = 0; i < 2; i++)
|
||||
SoundEngine.PlaySound(crunch2 with { Volume = 0.8f, Pitch = -0.4f * i, MaxInstances = 2 }, Projectile.Center);
|
||||
canDamage = true;
|
||||
}
|
||||
|
||||
Projectile.Opacity = (float)Math.Pow(Utils.GetLerpValue(0, 40, Projectile.timeLeft, true), 4);
|
||||
if (Projectile.Opacity <= 0.4f)
|
||||
canDamage = false;
|
||||
time++;
|
||||
spawnedDust = false;
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
float damageMult = 1;
|
||||
if (hitTimer != 0)
|
||||
damageMult = 0.2f;
|
||||
bool jawsJustSlammed = (time >= jawSlamTime && time <= jawSlamTime + 8);
|
||||
modifiers.SourceDamage *= (jawsJustSlammed ? 12 : 1) * damageMult;
|
||||
if (hitTimer == 0)
|
||||
hitTimer = Projectile.localNPCHitCooldown;
|
||||
|
||||
if (target.CanBeMoved(true))
|
||||
target.velocity *= 0.05f;
|
||||
}
|
||||
public override bool? CanDamage() => canDamage ? null : false;
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<HeavyBleeding>(), 300);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (time == 0)
|
||||
return false;
|
||||
|
||||
Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value;
|
||||
Vector2 startPoint = Projectile.Center;
|
||||
int distance = jawLength;
|
||||
int travelLength = 35;
|
||||
Vector2 endPoint = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * distance;
|
||||
Vector2 direction = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
|
||||
for (int t = -1; t <= 1; t += 2)
|
||||
{
|
||||
SpriteEffects spriteFx = (!isTopJaw) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
Color drawColor = Projectile.GetAlpha(lightColor);
|
||||
int toothNum = 0;
|
||||
for (int i = 0; i < distance; i += travelLength)
|
||||
{
|
||||
if (((isTopJaw && Projectile.direction == -1) || (!isTopJaw && Projectile.direction == 1)) && i == 0)
|
||||
i += (int)(travelLength * 0.5f);
|
||||
|
||||
float jawRot = (isTopJaw ? topJawRot : bottomJawRot);
|
||||
float scale = (Projectile.scale + 0.35f - 0.02f * toothNum);
|
||||
float slamLerp = (float)Math.Pow(Utils.GetLerpValue(0, jawSlamTime * 1.5f, time, true), 4);
|
||||
float sine = ((float)Math.Pow((float)Math.Sin((time + toothNum * 3) / 10), 4)) * slamLerp;
|
||||
Vector2 drawPos = (startPoint + i * direction.RotatedBy(jawRot)) + direction.RotatedBy(MathHelper.PiOver2 * (isTopJaw ? 1 : -1)) * (-25 * scale - 65 * sine * scale);
|
||||
Vector2 toMouse = Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
Vector2 finalDrawPos = drawPos + toMouse.RotatedBy(jawRot) * 5 * (1 - slamLerp) + Main.rand.NextVector2Circular(14, 14) * (time >= jawSlamTime ? Utils.GetLerpValue(jawSlamTime + 30, jawSlamTime, time, true) : 0);
|
||||
float rotation = Projectile.velocity.ToRotation() + (jawRot) + (isTopJaw ? MathHelper.Pi : 0);
|
||||
float toothOpacity = Math.Min((float)Math.Pow(Utils.GetLerpValue(0, toothNum, time, true), 3), Projectile.Opacity);
|
||||
Main.EntitySpriteDraw(tex, finalDrawPos - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, toothOpacity) * toothOpacity, rotation, new Vector2(tex.Width / 2, tex.Height), new Vector2(1f, 1) * scale, spriteFx, 0);
|
||||
toothNum++;
|
||||
|
||||
if (!spawnedDust && toothNum > 1)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(finalDrawPos, 5, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.5f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), 100, default, Main.rand.NextFloat(1.1f, 1.9f) * scale);
|
||||
dust.noGravity = true;
|
||||
dust.alpha = (int)(255 * (1 - toothOpacity));
|
||||
Particle blood = new CustomSpark(finalDrawPos, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.4f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), "CalamityMod/Particles/LargeBloom",
|
||||
false, 8, Main.rand.NextFloat(0.065f, 0.08f) * scale, Color.Lerp(Color.DarkRed, Color.Black, Main.rand.NextFloat(0, 0.5f)) * 0.7f * toothOpacity, new Vector2(1f, 1f), false, shrinkSpeed: 0.9f);
|
||||
GeneralParticleHandler.SpawnParticle(blood);
|
||||
|
||||
Lighting.AddLight(finalDrawPos, Color.Lerp(Color.Red, Color.White, 0.85f).ToVector3() * 1.2f * toothOpacity);
|
||||
}
|
||||
}
|
||||
isTopJaw = (t == -1);
|
||||
}
|
||||
spawnedDust = true; // Make sure effect spawning isn't happening based on frame rate
|
||||
|
||||
return false;
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
if (!canDamage)
|
||||
return false;
|
||||
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
Vector2 start = Projectile.Center;
|
||||
float length = jawLength;
|
||||
float size = 165;
|
||||
float _ = float.NaN;
|
||||
bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _);
|
||||
return (hit);
|
||||
|
||||
return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Calamity().stealthStrike ? 50 : 18, targetHitbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user