Files
CalamityModPublic/Projectiles/Rogue/BlazingStarProj.cs
T
mountaindrew10 b2624d86a9 1 - Blazing Star now inflicts Hellfire.
2 - Frostcrush Valari no longer inflicts Frostburn and Crush Depth.
3 - Icebreaker now inflicts Nightwither on stealth strikes for 7 seconds.
4 - Kelvin Catalyst stealth strike now inflicts Glacial State.
5 - Mangrove Chakram now inflicts Acid Venom instead of Cursed Inferno.
6 - Subduction Slicer now inflicts Hellfire instead of On Fire! and the length of the Daybroken debuff on stealth strikes is now 7 seconds.
7 - Elemental Disk no longer inflicts debuffs.
8 - Eradicator now inflicts God Slayer Inferno instead of On Fire! and Frostburn.
9 - Molten Amputator now inflits Holy Flames.
10 - Valediction no longer inflicts Wet.
11 - Gel Darts no longer inflict Slow.
12 - Stormfront Razor now inflicts Electrified.
13 - Cosmic Kunai no longer inflicts God Slayer Inferno.
14 - Jaws of Oblivion no longer inflicts Marked for Death.
15 - Utensil Poker no longer inflicts Bleeding, Burning Blood and Well Fed.
16 - Sludge Splotch now inflicts Slimed instead of Slow.
17 - Web Ball stealth strike Webbed duration increased to 2 seconds.
18 - Tooth Balls now inflict Burning Blood.
19 - Deep Wounder now inflicts Marked for Death on stealth strikes instead of Crush Depth and inflicts Crush Depth with regular hits.
20 - Gacruxian Mollusk sparks now inflict Electrified.
21 - Bloodsoaked Crasher no longer inflicts Brimstone Flames.
22 - Hypothermia stealth strikes now inflict Glacial State.
23 - Seared Pan no longer inflicts Burning Blood and inflicts Daybroken instead of On Fire!
24 - The Reaper now inflicts Irradiated and Sulphuric Poisoning.
2022-12-04 04:45:46 -06:00

147 lines
5.5 KiB
C#

using CalamityMod.Items.Weapons.Rogue;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.Buffs.DamageOverTime;
namespace CalamityMod.Projectiles.Rogue
{
public class BlazingStarProj : ModProjectile
{
public override string Texture => "CalamityMod/Items/Weapons/Rogue/BlazingStar";
public const int Lifetime = 1540;
public const int ReboundTime = 40;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Blazing Star");
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 34;
Projectile.height = 32;
Projectile.friendly = true;
Projectile.tileCollide = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 5;
Projectile.timeLeft = Lifetime;
Projectile.DamageType = RogueDamageClass.Instance;
}
public override void AI()
{
if (Projectile.Calamity().stealthStrike)
Projectile.penetrate = Projectile.maxPenetrate = -1;
// Boomerang rotation
Projectile.rotation += 0.4f * Projectile.direction;
// Boomerang sound
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 8;
SoundEngine.PlaySound(SoundID.Item7, Projectile.position);
}
// Returns after some number of frames in the air
if (Projectile.timeLeft < Lifetime - ReboundTime)
Projectile.ai[0] = 1f;
if (Projectile.ai[0] != 0f)
{
Projectile.tileCollide = false;
float returnSpeed = BlazingStar.Speed * 2.5f;
float acceleration = 2f;
Player owner = Main.player[Projectile.owner];
// Delete the projectile if it's excessively far away.
// Relying on the length instead of a second square root call for Normalize is used here for general performance since both the distance
// and normalized vector are used in this code.
float distanceToPlayer = Projectile.Distance(owner.Center);
Vector2 velocity = (owner.Center - Projectile.Center) / distanceToPlayer * returnSpeed;
// Kill the projectile is if it's super far from the player.
if (distanceToPlayer > 3000f)
Projectile.Kill();
// Home back in on the player.
// No, projectiles do not have a SimpleFlyMovement extension method like NPCs do.
if (Projectile.velocity.X < velocity.X)
{
Projectile.velocity.X = Projectile.velocity.X + acceleration;
if (Projectile.velocity.X < 0f && velocity.X > 0f)
Projectile.velocity.X += acceleration;
}
else if (Projectile.velocity.X > velocity.X)
{
Projectile.velocity.X = Projectile.velocity.X - acceleration;
if (Projectile.velocity.X > 0f && velocity.X < 0f)
Projectile.velocity.X -= acceleration;
}
if (Projectile.velocity.Y < velocity.Y)
{
Projectile.velocity.Y = Projectile.velocity.Y + acceleration;
if (Projectile.velocity.Y < 0f && velocity.Y > 0f)
Projectile.velocity.Y += acceleration;
}
else if (Projectile.velocity.Y > velocity.Y)
{
Projectile.velocity.Y = Projectile.velocity.Y - acceleration;
if (Projectile.velocity.Y > 0f && velocity.Y < 0f)
Projectile.velocity.Y -= acceleration;
}
// Delete the projectile if it touches its owner.
if (Main.myPlayer == Projectile.owner)
{
if (Projectile.Hitbox.Intersects(owner.Hitbox))
Projectile.Kill();
}
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.OnFire3, 180);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(BuffID.OnFire3, 180);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
// Make the star bounce on tiles.
public override bool OnTileCollide(Vector2 oldVelocity)
{
// Impacts the terrain even though it bounces off.
SoundEngine.PlaySound(SoundID.Dig, Projectile.Center);
Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height);
if (Projectile.velocity.X != oldVelocity.X)
{
Projectile.velocity.X = -oldVelocity.X;
}
if (Projectile.velocity.Y != oldVelocity.Y)
{
Projectile.velocity.Y = -oldVelocity.Y;
}
Projectile.ai[0] = 1f;
return false;
}
}
}