Files
CalamityModPublic/Projectiles/Melee/SpatialSpear3.cs
T
Andrew Marheine e1cac76818 1 - Buffed Apoc Array, Asteroid Staff, Augur, Genisis, Nuclear Fury, Ultra Liquidator, Ark of the Elements, Avalanche, Devastation, Elemental Shiv, Gilded Proboscis, Greatsword of Judgement, Plague Keeper, Elemental Lance, Stellar Contempt, Clockwork Bow, Elemental Eruption, Golden Eagle, Disseminator, Onyx Chain Blaster, Planetary Annihilation, Pride Hunter's Plannar Ripper, Shredder, Starfleet, Hell's Sun, Lunar Kunai, Utensil Poker, Lunar Flare and Meowmere.
2 - Nerfed Star Wrath, Terrarian, Mad Alchemist Cocktail alt fire, Rouge Slash, Omega Biome Blade, Solstice Claymore, and Elemental Disk.
3 - Increased Golem despawn range in rev+.
4 - Fixed Nuclear Fury projectile drawing bug.
5 - Thorn Blossom only drains 3 HP instead of 5.
6 - Elemental Lance reworked to have projectiles split sooner.
2020-11-27 00:06:15 -06:00

108 lines
4.3 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class SpatialSpear3 : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Spear");
}
public override void SetDefaults()
{
projectile.width = 10;
projectile.height = 10;
projectile.friendly = true;
projectile.melee = true;
projectile.tileCollide = false;
projectile.penetrate = 1;
projectile.timeLeft = 40;
}
public override void AI()
{
Lighting.AddLight(projectile.Center, 1f, 0.05f, 0.05f);
projectile.rotation = (float)Math.Atan2(projectile.velocity.Y, projectile.velocity.X) + MathHelper.PiOver4;
if (projectile.localAI[1] == 0f)
{
projectile.scale -= 0.01f;
projectile.alpha += 15;
if (projectile.alpha >= 125)
{
projectile.alpha = 130;
projectile.localAI[1] = 1f;
}
}
else if (projectile.localAI[1] == 1f)
{
projectile.scale += 0.01f;
projectile.alpha -= 15;
if (projectile.alpha <= 0)
{
projectile.alpha = 0;
projectile.localAI[1] = 0f;
}
}
if (Main.rand.NextBool(8))
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 73, projectile.velocity.X * 0.1f, projectile.velocity.Y * 0.1f);
}
projectile.localAI[0] += 1f;
if (projectile.localAI[0] >= 30f)
{
projectile.localAI[0] = 0f;
int numProj = 2;
float rotation = MathHelper.ToRadians(20);
if (projectile.owner == Main.myPlayer)
{
for (int i = 0; i < numProj + 1; i++)
{
Vector2 perturbedSpeed = projectile.velocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (numProj - 1)));
Projectile.NewProjectile(projectile.Center, perturbedSpeed, ModContent.ProjectileType<SpatialSpear4>(), (int)(projectile.damage * 0.5), projectile.knockBack * 0.5f, projectile.owner, 0f, 0f);
}
}
}
}
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
if (projectile.timeLeft > 35)
return false;
Texture2D tex = Main.projectileTexture[projectile.type];
spriteBatch.Draw(tex, projectile.Center - Main.screenPosition, null, projectile.GetAlpha(lightColor), projectile.rotation, tex.Size() / 2f, projectile.scale, SpriteEffects.None, 0f);
return false;
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 120);
target.AddBuff(ModContent.BuffType<GlacialState>(), 120);
target.AddBuff(ModContent.BuffType<Plague>(), 120);
target.AddBuff(ModContent.BuffType<HolyFlames>(), 120);
}
public override void Kill(int timeLeft)
{
for (int num795 = 4; num795 < 12; num795++)
{
float num796 = projectile.oldVelocity.X * (30f / num795);
float num797 = projectile.oldVelocity.Y * (30f / num795);
int num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.8f);
Main.dust[num798].noGravity = true;
Dust dust = Main.dust[num798];
dust.velocity *= 0.5f;
num798 = Dust.NewDust(new Vector2(projectile.oldPosition.X - num796, projectile.oldPosition.Y - num797), 8, 8, 73, projectile.oldVelocity.X, projectile.oldVelocity.Y, 100, default, 1.4f);
dust = Main.dust[num798];
dust.velocity *= 0.05f;
}
}
}
}