Files
CalamityModPublic/Projectiles/Magic/NuclearFuryProjectile.cs
T
mountaindrew10 4626974709 1 - Inferna Cutter now inflicts Hellfire instead of On Fire! and no longer inflicts Brimstone Flames.
2 - Mantis Claws now inflict Hellfire.
3 - Vulcanite Lance now inflicts Hellfire instead of On Fire!
4 - Fault Line now inflicts Hellfire instead of On Fire!
5 - Blood Bath now inflicts Burning Blood.
6 - Shaderain Staff no longer inflicts any debuffs.
7 - Icicle Trident no longer inflicts Glacial State.
8 - Infernal Rift now inflicts Hellfire instead of Brimstone Flames.
9 - Vesuvius no longer buffs the player with Molten and now inflicts Hellfire.
10 - Deathhail Staff now inflicts God Slayer Inferno instead of On Fire! and Frostburn.
11 - Divine Retribution no longer inflicts Crush Depth.
12 - Elemental Ray no longer inflicts any debuffs.
13 - Helium Flash no longer inflicts Irradiated.
14 - Ice Barrage no longer inflicts Exo Freeze.
15 - Sanguine Flare no longer inflicts any debuffs.
16 - Soul Piercer now inflicts God Slayer Inferno.
17 - Staff of Blushie now only inflicts Daybroken.
18 - Ultra Liquidator no longer inflicts any debuffs and no longer requires Ichor/Cursed Flames to craft.
19 - Venusian Trident now inflicts Daybroken instead of On Fire!
20 - The Wand now only inflicts Dragonfire.
21 - Gatling Laser no longer inflicts any debuffs.
22 - Ion Blaster no longer inflicts any debuffs.
23 - Lazhar now inflicts Daybroken instead of On Fire!
24 - Aetherflux Cannon now inflicts Holy Flames.
25 - Apoctosis Array no longer inflicts any debuffs.
26 - Plasma Caster no longer inflicts any debuffs.
27 - Purge Guzzler no longer inflicts On Fire!
28 - Death Valley Duster now inflicts Armor Crunch.
29 - Forbidden Sun now inflicts Hellfire instead of On Fire!
30 - Frigidflash Bolt now inflicts Hellfire instead of On Fire!
31 - Poseidon now inflicts Eutrophication.
32 - Primordial Earth now inflicts Armor Crunch.
33 - Seething Discharge now inflicts Brimstone Flames.
34 - Tome of Fates no longer inflicts Brimstone Flames.
35 - Apotheosis no longer inflicts Armor Crunch, Demon Flames and Exo Freeze, but now inflicts Whispering Death.
36 - Augur of the Elements no longer inflicts any debuffs.
37 - Event Horizon no longer inflicts any debuffs.
38 - Nuclear Fury no longer inflicts any debuffs.
39 - Primordial Ancient now inflicts Armor Crunch.
40 - Recitation of the Beast no longer inflicts any debuffs.
41 - Arctic Bear Paw no longer inflicts Confused.
42 - Mad Alchemist's Cocktail Glove no longer inflicts Poisoned, On Fire!, Cursed Inferno, Shadowflame and Frostburn, but now inflicts Electrified and the debuff durations have been doubled.
43 - Yharim's Crystal now inflicts Dragonfire.
2022-12-05 02:47:40 -06:00

158 lines
6.3 KiB
C#

using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Magic
{
public class NuclearFuryProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Nuclear Fury");
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 60;
Projectile.height = 60;
Projectile.alpha = 255;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.penetrate = -1;
Projectile.timeLeft = 600;
Projectile.tileCollide = false;
Projectile.extraUpdates = 2;
Projectile.ignoreWater = true;
}
public override void AI()
{
Projectile.localAI[1] += 1f;
if (Projectile.localAI[1] > 10f && Main.rand.NextBool(3))
{
int num = 6;
for (int index1 = 0; index1 < num; ++index1)
{
Vector2 vector2_1 = (Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width, (float)Projectile.height) / 2f).RotatedBy((double)(index1 - (num / 2 - 1)) * Math.PI / (double)num, new Vector2()) + Projectile.Center;
Vector2 vector2_2 = ((Main.rand.NextFloat() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * (float)Main.rand.Next(3, 8);
int index2 = Dust.NewDust(vector2_1 + vector2_2, 0, 0, 217, vector2_2.X * 2f, vector2_2.Y * 2f, 100, new Color(), 1.4f);
Dust dust = Main.dust[index2];
dust.noGravity = true;
dust.noLight = true;
dust.velocity /= 4f;
dust.velocity -= Projectile.velocity;
}
Projectile.alpha -= 5;
if (Projectile.alpha < 50)
Projectile.alpha = 50;
Lighting.AddLight((int)Projectile.Center.X / 16, (int)Projectile.Center.Y / 16, 0.1f, 0.4f, 0.6f);
}
Projectile.rotation += Projectile.velocity.X * 0.1f;
Projectile.rotation += Projectile.velocity.Y * 0.1f;
int num1 = -1;
Vector2 targetVec = Projectile.Center;
float maxDistance = 500f;
if (Projectile.localAI[0] > 0f)
{
Projectile.localAI[0] -= 1f;
}
if (Projectile.ai[0] == 0f && Projectile.localAI[0] == 0f)
{
for (int index = 0; index < Main.maxNPCs; ++index)
{
NPC npc = Main.npc[index];
if (npc.CanBeChasedBy(Projectile, false) && (Projectile.ai[0] == 0f || Projectile.ai[0] == (index + 1f)))
{
float extraDistance = (npc.width / 2) + (npc.height / 2);
bool canHit = true;
if (extraDistance < maxDistance)
canHit = Collision.CanHit(Projectile.Center, 1, 1, npc.Center, 1, 1);
float npcDist = Vector2.Distance(npc.Center, targetVec);
if (npcDist < (maxDistance + extraDistance) && canHit)
{
maxDistance = npcDist;
targetVec = npc.Center;
num1 = index;
}
}
}
if (num1 >= 0)
{
Projectile.ai[0] = num1 + 1f;
Projectile.netUpdate = true;
}
}
if (Projectile.localAI[0] == 0f && Projectile.ai[0] == 0f)
Projectile.localAI[0] = 30f;
bool flag = false;
if (Projectile.ai[0] != 0f)
{
int index = (int)(Projectile.ai[0] - 1);
if (Main.npc[index].active && !Main.npc[index].dontTakeDamage && Main.npc[index].immune[Projectile.owner] == 0)
{
if ((Math.Abs(Projectile.Center.X - Main.npc[index].Center.X) + Math.Abs(Projectile.Center.Y - Main.npc[index].Center.Y)) < 1000f)
{
flag = true;
targetVec = Main.npc[index].Center;
}
}
else
{
Projectile.ai[0] = 0f;
flag = false;
Projectile.netUpdate = true;
}
}
if (flag)
{
double num3 = (double)(targetVec - Projectile.Center).ToRotation() - (double)Projectile.velocity.ToRotation();
if (num3 > Math.PI)
num3 -= 2.0 * Math.PI;
if (num3 < -1.0 * Math.PI)
num3 += 2.0 * Math.PI;
Projectile.velocity = Projectile.velocity.RotatedBy(num3 * 0.1, new Vector2());
}
float num4 = Projectile.velocity.Length();
Projectile.velocity.Normalize();
Projectile.velocity = Projectile.velocity * (num4 + 1f / 400f);
}
public override void Kill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
for (int k = 0; k < 5; k++)
{
int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 34, 0f, 0f);
Main.dust[dust].velocity *= 0f;
Main.dust[dust].noGravity = true;
}
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(200, 200, 200, 200);
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
if (Projectile.ai[1] != 1f) //Nuclear Fury
{
target.immune[Projectile.owner] = 5;
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
}
}