+ Merge 1.4.4
This commit is contained in:
commit
63ba2cf4b3
4 files changed
+241
-255
No files matched your search
@@ -122,6 +122,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
stuckInTarget = true;
|
||||
storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8;
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,54 +148,64 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
HasHit = true;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
public override void OnHitPlayer(Player target, Player.HurtInfo info)
|
||||
{
|
||||
HasHit = true;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
HasHit = true;
|
||||
Projectile.netUpdate = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer && HasHit == true && !BonusEffectMode && Projectile.ai[2] == 0)
|
||||
if (HasHit == true && !BonusEffectMode && Projectile.ai[2] == 0)
|
||||
{
|
||||
bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII);
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
SoundEngine.PlaySound(RocketExplosion with { MaxInstances = 2}, Projectile.Center);
|
||||
//If using a rocket with extra effects, spawn an invisible copy that handes the tile breaking/liquid spawning logic
|
||||
if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<ScorchedEarthRocket>(), 0, 0f, Projectile.owner, RocketID, 0f, 2f);
|
||||
// Create Blast
|
||||
float blastSize = 300;
|
||||
float minMultiplier = 0.25f;
|
||||
int hitsToMinMult = 4;
|
||||
int debuff1 = BuffID.Daybreak;
|
||||
int debuff2 = BuffID.Oiled;
|
||||
int debuffTime = 360;
|
||||
//The explosion has a different damage scaling depending on which rocket type you have. Left is Cluster Rocket, right is Non-Cluster.
|
||||
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurst>(), (int)(Projectile.damage * (isClusterRocket ? 0.75f : 1)), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult);
|
||||
blast.localAI[0] = debuff1;
|
||||
blast.localAI[2] = debuff2;
|
||||
blast.localAI[1] = debuffTime;
|
||||
blast.timeLeft = 15;
|
||||
blast.DamageType = DamageClass.Ranged;
|
||||
for (int j = 0; j < (isClusterRocket ? 9 : 5); j++)
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<ScorchedEarthClusterBomb>(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner);
|
||||
bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII);
|
||||
//If using a rocket with extra effects, spawn an invisible copy that handes the tile breaking/liquid spawning logic
|
||||
if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<ScorchedEarthRocket>(), 0, 0f, Projectile.owner, RocketID, 0f, 2f);
|
||||
// Create Blast
|
||||
float blastSize = 300;
|
||||
float minMultiplier = 0.25f;
|
||||
int hitsToMinMult = 4;
|
||||
int debuff1 = BuffID.Daybreak;
|
||||
int debuff2 = BuffID.Oiled;
|
||||
int debuffTime = 360;
|
||||
//The explosion has a different damage scaling depending on which rocket type you have. Left is Cluster Rocket, right is Non-Cluster.
|
||||
Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurst>(), (int)(Projectile.damage * (isClusterRocket ? 0.75f : 1)), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult);
|
||||
blast.localAI[0] = debuff1;
|
||||
blast.localAI[2] = debuff2;
|
||||
blast.localAI[1] = debuffTime;
|
||||
blast.timeLeft = 15;
|
||||
blast.DamageType = DamageClass.Ranged;
|
||||
for (int j = 0; j < (isClusterRocket ? 9 : 5); j++)
|
||||
{
|
||||
Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<ScorchedEarthClusterBomb>(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle FX for all clients
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
||||
SoundEngine.PlaySound(RocketExplosion with { MaxInstances = 2 }, Projectile.Center);
|
||||
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Black, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.7f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
//Explosion effect
|
||||
|
||||
+107
-119
@@ -9,6 +9,7 @@ using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
|
||||
namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
@@ -17,19 +18,19 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Projectiles/Rogue/PumpkaboomBig";
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public ref float skipExplosionSound => ref Projectile.ai[1];
|
||||
|
||||
public float time = 0;
|
||||
public ref float stuckNPC => ref Projectile.ai[2];
|
||||
public ref float stuckState => ref Projectile.ai[1];
|
||||
public ref float flungState => ref Projectile.ai[0];
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public int tileHits = 0;
|
||||
public bool flung = false;
|
||||
public float charge = 0;
|
||||
public bool hasReachedFullCharge = false;
|
||||
public bool hasStoppedHolding = false;
|
||||
public float midAirRot = 0;
|
||||
public int initialCastDirection = 0;
|
||||
|
||||
public bool stuck = false;
|
||||
public int stuckNPC = -1;
|
||||
Vector2 placementDistance;
|
||||
Vector2 placementVelocity;
|
||||
|
||||
@@ -37,12 +38,10 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
private float progress = -1;
|
||||
|
||||
public Color mainColor = Color.White;
|
||||
public Color c1 = new Color(255, 117, 24); // Orange
|
||||
public Color c2 = new Color(168, 47, 57); // Maroon / Darkish Red
|
||||
public float glowProgress = -1;
|
||||
public Color shiftColor;
|
||||
public Color c1 = new Color(255, 117, 24);
|
||||
public Color c2 = new Color(168, 47, 57);
|
||||
private bool hasDealtDamage = false;
|
||||
|
||||
public NPC markedTarget;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 32;
|
||||
@@ -57,10 +56,9 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.timeLeft = 1200;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
public override bool ShouldUpdatePosition() => flung && !stuck;
|
||||
public override bool? CanDamage() => (flung && tileHits == 0 ? null : false);
|
||||
|
||||
private bool hasDealtDamage = false;
|
||||
public override bool ShouldUpdatePosition() => flungState != 0f && stuckState == 0f;
|
||||
public override bool? CanDamage() => (flungState != 0f && tileHits == 0 ? null : false);
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
@@ -72,14 +70,8 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Outline color shifting
|
||||
float rate = (Main.GlobalTimeWrappedHourly * 6);
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
c1,
|
||||
c2
|
||||
};
|
||||
|
||||
float rate = (Main.GlobalTimeWrappedHourly * 6);
|
||||
List<Color> eColors = new List<Color>() { c1, c2 };
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
@@ -92,17 +84,13 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
|
||||
// When an NPC is hit by the bomb, stick to it.
|
||||
if (stuck)
|
||||
if (stuckState == 1f)
|
||||
{
|
||||
if (stuckNPC >= 0 && Main.npc[stuckNPC].active)
|
||||
{
|
||||
Projectile.Center = Main.npc[stuckNPC].Center + placementVelocity * placementDistance;
|
||||
}
|
||||
if (stuckNPC >= 0 && Main.npc[(int) stuckNPC].active)
|
||||
Projectile.Center = Main.npc[(int) stuckNPC].Center + placementVelocity * placementDistance;
|
||||
|
||||
else
|
||||
{
|
||||
else if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
if (Projectile.timeLeft == 109)
|
||||
{
|
||||
@@ -119,9 +107,8 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
{
|
||||
NPC target = Main.npc[i];
|
||||
if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < maxPullDistance)
|
||||
if (target != null && target.active && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < maxPullDistance)
|
||||
{
|
||||
// Avoid pulling the NPC the bomb is stuck to
|
||||
if (target.whoAmI == stuckNPC)
|
||||
continue;
|
||||
|
||||
@@ -142,7 +129,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
return;
|
||||
}
|
||||
|
||||
if (flung)
|
||||
if (flungState != 0f)
|
||||
{
|
||||
if (initialCastDirection == 0)
|
||||
initialCastDirection = Owner.direction;
|
||||
@@ -153,7 +140,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
Projectile.velocity.Y += 0.22f;
|
||||
|
||||
if (!stuck)
|
||||
if (stuckState == 0f)
|
||||
midAirRot += 0.03f * initialCastDirection;
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + midAirRot;
|
||||
@@ -163,89 +150,94 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
else
|
||||
{
|
||||
Projectile.velocity = Owner.velocity;
|
||||
float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. Scales with speed.
|
||||
if (completion >= 1 || hasReachedFullCharge) // The moment of being thrown.
|
||||
int useAnim = Owner.HeldItem.useAnimation > 0 ? Owner.HeldItem.useAnimation : 30;
|
||||
float completion = time / (useAnim * 0.7f);
|
||||
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
time = -1;
|
||||
Projectile.Center = Owner.Center;
|
||||
Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
Projectile.velocity = velocity * 16;
|
||||
|
||||
Projectile.tileCollide = true;
|
||||
flung = true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (Main.mouseLeft && !hasStoppedHolding) // The charging up.
|
||||
{
|
||||
if (completion >= 0.7f && completion <= 0.8f)
|
||||
{
|
||||
time--;
|
||||
if (charge < 1)
|
||||
charge += 0.5f;
|
||||
|
||||
if (charge >= 1 && !hasReachedFullCharge)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item1, Projectile.Center);
|
||||
hasReachedFullCharge = true;
|
||||
}
|
||||
}
|
||||
if (completion >= 1 || hasReachedFullCharge)
|
||||
{
|
||||
time = -1;
|
||||
Projectile.Center = Owner.Center;
|
||||
Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
Projectile.velocity = velocity * 16;
|
||||
Projectile.tileCollide = true;
|
||||
flungState = 1f;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasReachedFullCharge)
|
||||
if (Main.mouseLeft && !hasStoppedHolding)
|
||||
{
|
||||
Projectile.localAI[1] = 5;
|
||||
Projectile.ai[1] = 1; // Skip explosion fx
|
||||
Projectile.Kill();
|
||||
if (completion >= 0.7f && completion <= 0.8f)
|
||||
{
|
||||
time--;
|
||||
if (charge < 1)
|
||||
charge += 0.5f;
|
||||
|
||||
if (charge >= 1 && !hasReachedFullCharge)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item1, Projectile.Center);
|
||||
hasReachedFullCharge = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasReachedFullCharge)
|
||||
{
|
||||
Projectile.localAI[1] = 5;
|
||||
flungState = -1f;
|
||||
Projectile.Kill();
|
||||
}
|
||||
hasStoppedHolding = true;
|
||||
}
|
||||
hasStoppedHolding = true;
|
||||
}
|
||||
|
||||
Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X);
|
||||
float grenadeRot = 0;
|
||||
if (completion >= 0.7f)
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction);
|
||||
}
|
||||
grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation();
|
||||
Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : -3, Owner.direction == 1 ? -24 : -4).RotatedBy(grenadeRot);
|
||||
float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction);
|
||||
|
||||
Projectile.Center = grenadePos;
|
||||
Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0);
|
||||
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90));
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0)));
|
||||
}
|
||||
|
||||
float grenadeRot = 0;
|
||||
if (completion >= 0.7f)
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction);
|
||||
}
|
||||
|
||||
Vector2 mouseDir = (Main.myPlayer == Projectile.owner) ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
grenadeRot += mouseDir.ToRotation();
|
||||
Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : -3, Owner.direction == 1 ? -24 : -4).RotatedBy(grenadeRot);
|
||||
float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction);
|
||||
|
||||
Projectile.Center = grenadePos;
|
||||
Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0);
|
||||
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, mouseDir.ToRotation() - MathHelper.ToRadians(90));
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0)));
|
||||
}
|
||||
time++;
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
stuck = true;
|
||||
stuckState = 1f;
|
||||
stuckNPC = target.whoAmI;
|
||||
|
||||
Projectile.localAI[1] = 5; // Reset firing state
|
||||
|
||||
// See PreDraw
|
||||
Projectile.localAI[1] = 5;
|
||||
beginStretchAnim = true;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
SoundStyle w = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThud");
|
||||
SoundEngine.PlaySound(w with { Volume = 0.7f, Pitch = 0f, MaxInstances = 6 }, Projectile.Center);
|
||||
|
||||
stuck = true;
|
||||
stuckState = 1f;
|
||||
stuckNPC = target.whoAmI;
|
||||
|
||||
placementDistance = new(-Vector2.Distance(target.Center, Projectile.Center));
|
||||
@@ -254,14 +246,11 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.rotation = Projectile.oldVelocity.ToRotation() + MathHelper.PiOver2 + midAirRot;
|
||||
Projectile.ai[1] = Projectile.rotation;
|
||||
flungState = Projectile.rotation;
|
||||
|
||||
hasDealtDamage = true;
|
||||
Projectile.localAI[1] = 5; // Reset firing state
|
||||
|
||||
glowProgress = 0; // Start glowing until death
|
||||
|
||||
Projectile.timeLeft = 110; // Lasts as long as sfx
|
||||
Projectile.localAI[1] = 5;
|
||||
Projectile.timeLeft = 110;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
@@ -285,19 +274,22 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
}
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
Projectile.localAI[1] = 5; // Reset firing state
|
||||
|
||||
if (Projectile.ai[1] != 1)
|
||||
if (flungState != -1f)
|
||||
{
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center);
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.6f }, Projectile.Center);
|
||||
Owner.SetScreenshake(5f);
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<PumpkaboomBoomBig>(), Projectile.damage * 2, Projectile.knockBack * 2, Projectile.owner, 0);
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
Owner.SetScreenshake(5f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<PumpkaboomBoomBig>(), Projectile.damage * 2, Projectile.knockBack * 2, Projectile.owner, 0);
|
||||
}
|
||||
|
||||
float scale = 0.18f;
|
||||
Vector2 spawnPos = Projectile.Center;
|
||||
@@ -320,6 +312,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 21, targetHitbox);
|
||||
@@ -379,45 +372,40 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
float drawRotation = Projectile.rotation;
|
||||
Vector2 drawPosition;
|
||||
|
||||
if (stuck && glowProgress >= 0f)
|
||||
if (stuckState == 1f && Projectile.timeLeft <= 110)
|
||||
{
|
||||
glowProgress += 0.03f;
|
||||
|
||||
float glowSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 25f); // Period of full pulse
|
||||
float pulse = MathHelper.Lerp(0.7f, 1f, glowSine); // Least protruding to most protruding
|
||||
float lifeFadeIn = Utils.GetLerpValue(110, 0, Projectile.timeLeft, true); // How much the glow overall fades in as it gets closer to exploding
|
||||
float glowSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 25f);
|
||||
float pulse = MathHelper.Lerp(0.7f, 1f, glowSine);
|
||||
float lifeFadeIn = Utils.GetLerpValue(110, 0, Projectile.timeLeft, true);
|
||||
float finalGlowIntensity = pulse * lifeFadeIn;
|
||||
drawPosition = Projectile.Center - Main.screenPosition;
|
||||
|
||||
// Create 20 copies of the projectile that draw behind with mainColor to create a glowy outline effect
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
float rotationOffset = (MathHelper.TwoPi * i / 15);
|
||||
Vector2 glowOffset = rotationOffset.ToRotationVector2() * (3f + glowSine * 1f) * finalGlowIntensity;
|
||||
|
||||
Main.spriteBatch.Draw(mainTexture, drawPosition + glowOffset, null, mainColor with { A = 0 } * finalGlowIntensity * 0.4f, drawRotation, drawOrigin, drawScale, spriteEffects, 0f);
|
||||
Main.spriteBatch.Draw(mainTexture, drawPosition + glowOffset, null, mainColor with { A = 0 } * finalGlowIntensity * 0.4f, flungState, drawOrigin, drawScale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!flung)
|
||||
if (flungState == 0f)
|
||||
{
|
||||
spriteEffects = SpriteEffects.FlipVertically;
|
||||
|
||||
float completion = time / (Owner.HeldItem.useAnimation * 0.7f);
|
||||
int useAnim = Owner.HeldItem.useAnimation > 0 ? Owner.HeldItem.useAnimation : 30;
|
||||
float completion = time / (useAnim * 0.7f);
|
||||
float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
float grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction);
|
||||
grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation();
|
||||
|
||||
Vector2 mouseDir = (Main.myPlayer == Projectile.owner) ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
grenadeRot += mouseDir.ToRotation();
|
||||
Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot);
|
||||
drawPosition = grenadePos - Main.screenPosition;
|
||||
drawRotation = grenadeRot - MathHelper.ToRadians(25 * completionLerp2) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stuck)
|
||||
{
|
||||
drawRotation = Projectile.ai[1];
|
||||
}
|
||||
if (stuckState == 1f)
|
||||
drawRotation = flungState;
|
||||
drawPosition = Projectile.Center - Main.screenPosition;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,19 +16,19 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Rogue";
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Rogue/Pumpkaboom";
|
||||
public ref float time => ref Projectile.ai[0];
|
||||
public ref float skipExplosionSound => ref Projectile.ai[1];
|
||||
|
||||
public float time = 0;
|
||||
public ref float stuckNPC => ref Projectile.ai[2];
|
||||
public ref float stuckState => ref Projectile.ai[1];
|
||||
public ref float flungState => ref Projectile.ai[0];
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public int tileHits = 0;
|
||||
public bool flung = false;
|
||||
public float charge = 0;
|
||||
public bool hasReachedFullCharge = false;
|
||||
public bool hasStoppedHolding = false;
|
||||
public float midAirRot = 0;
|
||||
public int initialCastDirection = 0;
|
||||
|
||||
public bool stuck = false;
|
||||
public int stuckNPC = -1;
|
||||
Vector2 placementDistance;
|
||||
Vector2 placementVelocity;
|
||||
|
||||
@@ -36,12 +36,10 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
private float progress = -1;
|
||||
|
||||
public Color mainColor = Color.White;
|
||||
public Color c1 = new Color(255, 117, 24); // Orange
|
||||
public Color c2 = new Color(168, 47, 57); // Maroon / Darkish Red
|
||||
public float glowProgress = -1;
|
||||
public Color shiftColor;
|
||||
public Color c1 = new Color(255, 117, 24);
|
||||
public Color c2 = new Color(168, 47, 57);
|
||||
private bool hasDealtDamage = false;
|
||||
|
||||
public NPC markedTarget;
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 26;
|
||||
@@ -52,14 +50,12 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.tileCollide = false;
|
||||
|
||||
Projectile.timeLeft = 1200;
|
||||
Projectile.DamageType = RogueDamageClass.Instance;
|
||||
}
|
||||
public override bool ShouldUpdatePosition() => flung && !stuck;
|
||||
public override bool? CanDamage() => (flung && tileHits == 0 ? null : false);
|
||||
|
||||
private bool hasDealtDamage = false;
|
||||
public override bool ShouldUpdatePosition() => flungState != 0f && stuckState == 0f;
|
||||
public override bool? CanDamage() => (flungState != 0f && tileHits == 0 ? null : false);
|
||||
|
||||
public override bool? CanHitNPC(NPC target)
|
||||
{
|
||||
@@ -71,14 +67,8 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Outline color shifting
|
||||
float rate = (Main.GlobalTimeWrappedHourly * 6);
|
||||
List<Color> eColors = new List<Color>()
|
||||
{
|
||||
c1,
|
||||
c2
|
||||
};
|
||||
|
||||
float rate = (Main.GlobalTimeWrappedHourly * 6);
|
||||
List<Color> eColors = new List<Color>() { c1, c2 };
|
||||
int colorIndex = (int)(rate / 2 % eColors.Count);
|
||||
Color currentColor = eColors[colorIndex];
|
||||
Color nextColor = eColors[(colorIndex + 1) % eColors.Count];
|
||||
@@ -90,18 +80,15 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
progress += 0.08f;
|
||||
}
|
||||
|
||||
// When an NPC is hit by the bomb, stick to it.
|
||||
if (stuck)
|
||||
if (stuckState == 1f)
|
||||
{
|
||||
if (stuckNPC >= 0 && Main.npc[stuckNPC].active)
|
||||
if (stuckNPC >= 0 && Main.npc[(int) stuckNPC].active)
|
||||
{
|
||||
Projectile.Center = Main.npc[stuckNPC].Center + placementVelocity * placementDistance;
|
||||
Projectile.Center = Main.npc[(int) stuckNPC].Center + placementVelocity * placementDistance;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else if (Main.netMode != NetmodeID.MultiplayerClient)
|
||||
Projectile.Kill();
|
||||
}
|
||||
if (Projectile.timeLeft == 109)
|
||||
{
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/PumpkaboomNormalTicking") with { Pitch = 0f, Volume = 1f, MaxInstances = 4 }, Projectile.Center);
|
||||
@@ -109,7 +96,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
return;
|
||||
}
|
||||
|
||||
if (flung)
|
||||
if (flungState != 0f)
|
||||
{
|
||||
if (initialCastDirection == 0)
|
||||
initialCastDirection = Owner.direction;
|
||||
@@ -120,7 +107,7 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
|
||||
Projectile.velocity.Y += 0.22f;
|
||||
|
||||
if (!stuck)
|
||||
if (stuckState == 0f)
|
||||
midAirRot += 0.06f * initialCastDirection;
|
||||
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2 + midAirRot;
|
||||
@@ -130,89 +117,93 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
else
|
||||
{
|
||||
Projectile.velocity = Owner.velocity;
|
||||
float completion = time / (Owner.HeldItem.useAnimation * 0.7f); // The completion of the throw animation. Scales with speed.
|
||||
if (completion >= 1 || hasReachedFullCharge) // The moment of being thrown.
|
||||
{
|
||||
time = -1;
|
||||
Projectile.Center = Owner.Center;
|
||||
Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
Projectile.velocity = velocity * 16;
|
||||
int useAnim = Owner.HeldItem.useAnimation > 0 ? Owner.HeldItem.useAnimation : 30;
|
||||
float completion = time / (useAnim * 0.7f);
|
||||
|
||||
Projectile.tileCollide = true;
|
||||
flung = true;
|
||||
}
|
||||
|
||||
else
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
{
|
||||
if (Main.mouseLeft && !hasStoppedHolding) // The charging up.
|
||||
{
|
||||
if (completion >= 0.7f && completion <= 0.8f)
|
||||
if (completion >= 1 || hasReachedFullCharge)
|
||||
{
|
||||
time = -1;
|
||||
Projectile.Center = Owner.Center;
|
||||
Vector2 velocity = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
||||
Projectile.velocity = velocity * 16;
|
||||
Projectile.tileCollide = true;
|
||||
flungState = 1f;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Main.mouseLeft && !hasStoppedHolding)
|
||||
{
|
||||
time--;
|
||||
if (charge < 1)
|
||||
charge += 0.5f;
|
||||
|
||||
if (charge >= 1 && !hasReachedFullCharge)
|
||||
if (completion >= 0.7f && completion <= 0.8f)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item1, Projectile.Center);
|
||||
hasReachedFullCharge = true;
|
||||
time--;
|
||||
if (charge < 1)
|
||||
charge += 0.5f;
|
||||
|
||||
if (charge >= 1 && !hasReachedFullCharge)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item1, Projectile.Center);
|
||||
hasReachedFullCharge = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hasReachedFullCharge)
|
||||
else
|
||||
{
|
||||
Projectile.localAI[1] = 5;
|
||||
Projectile.ai[1] = 1; // Skip explosion fx
|
||||
Projectile.Kill();
|
||||
if (!hasReachedFullCharge)
|
||||
{
|
||||
Projectile.localAI[1] = 5;
|
||||
flungState = -1f;
|
||||
Projectile.Kill();
|
||||
}
|
||||
hasStoppedHolding = true;
|
||||
}
|
||||
hasStoppedHolding = true;
|
||||
}
|
||||
|
||||
Owner.direction = Math.Sign(Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).X);
|
||||
float grenadeRot = 0;
|
||||
if (completion >= 0.7f)
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction);
|
||||
}
|
||||
grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation();
|
||||
Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : -3, Owner.direction == 1 ? -24 : -4).RotatedBy(grenadeRot);
|
||||
float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction);
|
||||
|
||||
Projectile.Center = grenadePos;
|
||||
Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0);
|
||||
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation() - MathHelper.ToRadians(90));
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0)));
|
||||
}
|
||||
|
||||
float grenadeRot = 0;
|
||||
if (completion >= 0.7f)
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0.7f, 1f, completion, true), 7);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(-75, 130f, completionLerp) * Owner.direction);
|
||||
}
|
||||
else
|
||||
{
|
||||
float completionLerp = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp) * Owner.direction);
|
||||
}
|
||||
|
||||
Vector2 mouseDir = (Main.myPlayer == Projectile.owner) ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
grenadeRot += mouseDir.ToRotation();
|
||||
Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : -3, Owner.direction == 1 ? -24 : -4).RotatedBy(grenadeRot);
|
||||
float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
float grenadeHalfRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction);
|
||||
|
||||
Projectile.Center = grenadePos;
|
||||
Projectile.rotation = grenadeRot - MathHelper.ToRadians(25 * grenadeHalfRot) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0);
|
||||
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, mouseDir.ToRotation() - MathHelper.ToRadians(90));
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, grenadeRot - (Owner.direction == 1 ? MathHelper.ToRadians(180) : MathHelper.ToRadians(0)));
|
||||
}
|
||||
time++;
|
||||
}
|
||||
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
stuck = true;
|
||||
stuckState = 1f;
|
||||
stuckNPC = target.whoAmI;
|
||||
|
||||
Projectile.localAI[1] = 5; // Reset firing state
|
||||
|
||||
// See PreDraw
|
||||
Projectile.localAI[1] = 5;
|
||||
beginStretchAnim = true;
|
||||
Projectile.netUpdate = true;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
SoundStyle w = new("CalamityMod/Sounds/Item/WulfrumScrewdriverThud");
|
||||
SoundEngine.PlaySound(w with { Volume = 0.7f, Pitch = 0f, MaxInstances = 6 }, Projectile.Center);
|
||||
|
||||
stuck = true;
|
||||
stuckState = 1f;
|
||||
stuckNPC = target.whoAmI;
|
||||
|
||||
placementDistance = new(-Vector2.Distance(target.Center, Projectile.Center));
|
||||
@@ -221,14 +212,12 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
Projectile.velocity = Vector2.Zero;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.rotation = Projectile.oldVelocity.ToRotation() + MathHelper.PiOver2 + midAirRot;
|
||||
Projectile.ai[1] = Projectile.rotation;
|
||||
flungState = Projectile.rotation;
|
||||
|
||||
hasDealtDamage = true;
|
||||
Projectile.localAI[1] = 5; // Reset firing state
|
||||
|
||||
glowProgress = 0; // Start glowing until death
|
||||
|
||||
Projectile.timeLeft = 110; // Lasts as long as sfx
|
||||
Projectile.localAI[1] = 5;
|
||||
Projectile.timeLeft = 110;
|
||||
Projectile.netUpdate = true;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -258,12 +247,13 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
{
|
||||
Projectile.localAI[1] = 5; // Reset firing state
|
||||
|
||||
if (Projectile.ai[1] != 1)
|
||||
if (flungState != -1f)
|
||||
{
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/PumpkinExplode1") with { Pitch = 0f, Volume = 0.75f }, Projectile.Center);
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/FlakKrakenShoot") with { Pitch = 0f, Volume = 0.4f }, Projectile.Center);
|
||||
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<PumpkaboomBoomSmall>(), Projectile.damage * 2, Projectile.knockBack * 2, Projectile.owner, 0);
|
||||
if (Main.myPlayer == Projectile.owner)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<PumpkaboomBoomSmall>(), Projectile.damage * 2, Projectile.knockBack * 2, Projectile.owner, 0);
|
||||
|
||||
float scale = 0.1f;
|
||||
Vector2 spawnPos = Projectile.Center;
|
||||
@@ -345,13 +335,11 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
float drawRotation = Projectile.rotation;
|
||||
Vector2 drawPosition;
|
||||
|
||||
if (stuck && glowProgress >= 0f)
|
||||
if (stuckState == 1f && Projectile.timeLeft <= 110)
|
||||
{
|
||||
glowProgress += 0.03f;
|
||||
|
||||
float glowSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f); // Period of full pulse
|
||||
float pulse = MathHelper.Lerp(0.7f, 1f, glowSine); // Least protruding to most protruding
|
||||
float lifeFadeIn = Utils.GetLerpValue(110, 0, Projectile.timeLeft, true); // How much the glow overall fades in as it gets closer to exploding
|
||||
float glowSine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f);
|
||||
float pulse = MathHelper.Lerp(0.7f, 1f, glowSine);
|
||||
float lifeFadeIn = Utils.GetLerpValue(110, 0, Projectile.timeLeft, true);
|
||||
float finalGlowIntensity = pulse * lifeFadeIn;
|
||||
drawPosition = Projectile.Center - Main.screenPosition;
|
||||
|
||||
@@ -361,29 +349,28 @@ namespace CalamityMod.Projectiles.Rogue
|
||||
float rotationOffset = (MathHelper.TwoPi * i / 15);
|
||||
Vector2 glowOffset = rotationOffset.ToRotationVector2() * (3f + glowSine * 1f) * finalGlowIntensity;
|
||||
|
||||
Main.spriteBatch.Draw(mainTexture, drawPosition + glowOffset, null, mainColor with { A = 0 } * finalGlowIntensity * 0.4f, drawRotation, drawOrigin, drawScale, spriteEffects, 0f);
|
||||
Main.spriteBatch.Draw(mainTexture, drawPosition + glowOffset, null, mainColor with { A = 0 } * finalGlowIntensity * 0.4f, flungState, drawOrigin, drawScale, spriteEffects, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!flung)
|
||||
if (flungState == 0f)
|
||||
{
|
||||
spriteEffects = SpriteEffects.FlipVertically;
|
||||
|
||||
float completion = time / (Owner.HeldItem.useAnimation * 0.7f);
|
||||
int useAnim = Owner.HeldItem.useAnimation > 0 ? Owner.HeldItem.useAnimation : 30;
|
||||
float completion = time / (useAnim * 0.7f);
|
||||
float completionLerp2 = (float)Math.Pow(Utils.GetLerpValue(0f, 0.7f, completion, true), 2);
|
||||
float grenadeRot = MathHelper.ToRadians(MathHelper.Lerp(120, -75f, completionLerp2) * Owner.direction);
|
||||
grenadeRot += Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld).ToRotation();
|
||||
|
||||
Vector2 mouseDir = (Main.myPlayer == Projectile.owner) ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Projectile.velocity.SafeNormalize(Vector2.UnitX);
|
||||
grenadeRot += mouseDir.ToRotation();
|
||||
Vector2 grenadePos = Owner.GetFrontHandPosition(Player.CompositeArmStretchAmount.Full, grenadeRot) + new Vector2(Owner.direction == 1 ? 5 : 5, Owner.direction == 1 ? -38 : 22).RotatedBy(grenadeRot);
|
||||
drawPosition = grenadePos - Main.screenPosition;
|
||||
drawRotation = grenadeRot - MathHelper.ToRadians(25 * completionLerp2) + (Owner.direction == 1 ? MathHelper.ToRadians(180) : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stuck)
|
||||
{
|
||||
drawRotation = Projectile.ai[1];
|
||||
}
|
||||
if (stuckState == 1f)
|
||||
drawRotation = flungState;
|
||||
drawPosition = Projectile.Center - Main.screenPosition;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user