2 - Amalgam now inflicts Acid Venom instead of Brimstone Flames and Plague and Astral Infection instead of God Slayer Inferno. 3 - Elemental Gauntlet now only inflicts Hellfire. 4 - Frosty Flare now inflicts Frostburn on all hits instead of just melee. 5 - Corrosive Spine now inflicts Acid Venom instead of Poisoned. 6 - Void of Extinction now inflicts Brimstone Flames on all hits instead of Hellfire on melee hits. 7 - Necklace of Vexation now inflicts Acid Venom instead of Cursed Inferno and Venom while wearing Reaver Armor. 8 - The Camper no longer inflicts On Fire! 9 - Increased Alicorn mount run speed to 90 mph, gave it infinite flight and increased vertical speed to 70 mph. 10 - Increased Gaze of Crysthamyr mount horizontal flight acceleration by 70%, decreased run speed to 50 mph and made holding W while flying up greatly boost vertical acceleration. 11 - Gaze of Crysthamyr now requires 10 Souls of Night to craft instead of 100. 12 - Dragon Scales infernadoes and fireballs now inflict Dragonfire. 13 - Abyssal Mirror projectiles now inflict Crush Depth. 14 - Statis Void Sash projectiles no longer inflict God Slayer Inferno. 15 - Venerated Locket projectiles now inflict God Slayer Inferno. 16 - Hallowed Rune projectiles no longer inflict Astral Infection. 17 - Nebulous Core projectiles now inflict God Slayer Inferno.
171 lines
7.0 KiB
C#
171 lines
7.0 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class DragonShit : ModProjectile
|
|
{
|
|
public NPC target;
|
|
public Vector2 rotationVector = Vector2.UnitY * -13f;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Fire");
|
|
Main.projFrames[Projectile.type] = 5;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 64;
|
|
Projectile.height = 64;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.penetrate = 1;
|
|
Projectile.timeLeft = 420;
|
|
Projectile.DamageType = RogueDamageClass.Instance;
|
|
}
|
|
|
|
public override bool? CanHitNPC(NPC target) => Projectile.timeLeft < 380 && target.CanBeChasedBy(Projectile);
|
|
|
|
public override void AI()
|
|
{
|
|
target = Projectile.Center.ClosestNPCAt(1200f);
|
|
if (Projectile.localAI[0] == 0f)
|
|
{
|
|
Projectile.ai[0] = Utils.SelectRandom(Main.rand, -1f, 1f);
|
|
Projectile.localAI[0] = 1f;
|
|
}
|
|
|
|
Projectile.frameCounter++;
|
|
if (Projectile.frameCounter > 4)
|
|
{
|
|
Projectile.frame++;
|
|
Projectile.frameCounter = 0;
|
|
}
|
|
if (Projectile.frame >= Main.projFrames[Projectile.type])
|
|
Projectile.frame = 0;
|
|
|
|
if (Projectile.timeLeft >= 380)
|
|
{
|
|
Projectile.velocity *= 1.07f;
|
|
}
|
|
else if (target != null)
|
|
{
|
|
Projectile.velocity = (Projectile.velocity * 23f + Projectile.SafeDirectionTo(target.Center) * 14.975f) / 24f;
|
|
}
|
|
else
|
|
{
|
|
Projectile.timeLeft = Math.Min(Projectile.timeLeft, 15);
|
|
Projectile.alpha += 17;
|
|
Projectile.velocity = rotationVector;
|
|
rotationVector = rotationVector.RotatedBy(MathHelper.ToRadians(14.975f * Projectile.ai[0]));
|
|
}
|
|
}
|
|
|
|
// Reduce damage of projectiles if more than the cap are active
|
|
public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection)
|
|
{
|
|
int projectileCount = Main.player[Projectile.owner].ownedProjectileCounts[Projectile.type];
|
|
int cap = 5;
|
|
int oldDamage = damage;
|
|
if (projectileCount > cap)
|
|
{
|
|
damage -= (int)(oldDamage * ((projectileCount - cap) * 0.05));
|
|
if (damage < 1)
|
|
damage = 1;
|
|
}
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha);
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
Texture2D projectileTexture = ModContent.Request<Texture2D>(Texture).Value;
|
|
int frameHeight = ModContent.Request<Texture2D>(Texture).Value.Height / Main.projFrames[Projectile.type];
|
|
int frameY = frameHeight * Projectile.frame;
|
|
Main.spriteBatch.Draw(projectileTexture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, frameY, projectileTexture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)projectileTexture.Width / 2f, (float)frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0);
|
|
return false;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<Dragonfire>(), 120);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);
|
|
Projectile.ExpandHitboxBy(80);
|
|
for (int d = 0; d < 5; d++)
|
|
{
|
|
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f);
|
|
Main.dust[idx].velocity *= 3f;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
Main.dust[idx].scale = 0.5f;
|
|
Main.dust[idx].fadeIn = 1f + Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int d = 0; d < 8; d++)
|
|
{
|
|
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f);
|
|
Main.dust[idx].noGravity = true;
|
|
Main.dust[idx].velocity *= 5f;
|
|
idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 1f);
|
|
Main.dust[idx].velocity *= 2f;
|
|
}
|
|
|
|
if (Main.netMode != NetmodeID.Server)
|
|
{
|
|
Vector2 goreSource = Projectile.Center;
|
|
int goreAmt = 3;
|
|
Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f);
|
|
for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++)
|
|
{
|
|
float velocityMult = 0.33f;
|
|
if (goreIndex < (goreAmt / 3))
|
|
{
|
|
velocityMult = 0.66f;
|
|
}
|
|
if (goreIndex >= (2 * goreAmt / 3))
|
|
{
|
|
velocityMult = 1f;
|
|
}
|
|
Mod mod = ModContent.GetInstance<CalamityMod>();
|
|
int type = Main.rand.Next(61, 64);
|
|
int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
Gore gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X += 1f;
|
|
gore.velocity.Y += 1f;
|
|
type = Main.rand.Next(61, 64);
|
|
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X -= 1f;
|
|
gore.velocity.Y += 1f;
|
|
type = Main.rand.Next(61, 64);
|
|
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X += 1f;
|
|
gore.velocity.Y -= 1f;
|
|
type = Main.rand.Next(61, 64);
|
|
smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f);
|
|
gore = Main.gore[smoke];
|
|
gore.velocity *= velocityMult;
|
|
gore.velocity.X -= 1f;
|
|
gore.velocity.Y -= 1f;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|