Files
CalamityModPublic/Projectiles/Ranged/Nuke.cs
T
mountaindrew10 96942111c3 1 - Bloodfire Arrows no longer inflict Brimstone Flames.
2 - Holy Fire Bullets no longer inflicts On Fire!
3 - Icy Bullets no longer inflict Glacial State.
4 - Toxibow now inflicts Irradiated for 8 seconds.
5 - Corroded Caustibow no longer inflicts Sulphuric Poisoning but increased duration of Irradiated to 8 seconds.
6 - Flarewing Bow bats now inflict Hellfire.
7 - Arterial Assault no longer inflicts Brimstone Flames.
8 - Contagion no longer inflicts Plague.
9 - Deathwind now inflicts God Slayer Inferno instead of On Fire! and Frostburn.
10 - Drataliornus now only inflicts Dragonfire.
11 - The Maelstrom now inflicts Crush Depth.
12 - Eviscerator now inflicts Burning Blood.
13 - Clamor Rifle now inflicts Eutrophication.
14 - Hellborn now inflicts Hellfire on gun hits.
15 - Helstorm now inflicts Hellfire on gun hits.
16 - Leviatitan no longer inflicts Poisoned.
17 - Needler now inflicts Acid Venom.
18 - Ace's High no longer inflicts Brimstone Flames.
19 - Auralis no longer inflicts Cursed Inferno and Ichor.
20 - Claret Cannon no longer inflicts Brimstone Flames.
21 - Dragon's Breath no longer inflicts On Fire!
22 - Karasawa no longer inflicts any debuffs.
23 - Spyker now inflicts Acid Venom.
24 - Universal Genesis no longer inflicts any debuffs.
25 - Mineral Mortar now inflicts Armor Crunch.
26 - Blissful Bombardier now inflicts Holy Flames instead of Dragonfire.
27 - Chicken Cannon now inflicts Dragonfire.
28 - Scorched Earth no longer inflicts On Fire!
29 - Dragoon Drizzlefish now inflicts Brimstone Flames for 1 second with primary fireballs and 0.5 seconds with split fireballs.
30 - Meowthrower no longer inflicts any debuffs.
31 - Blood Boiler no longer inflicts Brimstone Flames.
32 - Elemental Eruption no longer inflicts any debuffs.
33 - Flak Kraken now inflicts Crush Depth.
34 - Elemental Blaster no longer inflicts any debuffs.
35 - Heavy Laser Rifle no longer inflicts On Fire!
36 - Spetic Skewer no longer inflicts Acid Venom.
37 - Starmada no longer inflicts any debuffs.
38 - Sulphuric Acid Cannon now inflicts Sulphuric Poisoning.
2022-12-06 02:31:06 -06:00

240 lines
9.8 KiB
C#

using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
using CalamityMod.Buffs.DamageOverTime;
namespace CalamityMod.Projectiles.Ranged
{
public class Nuke : ModProjectile
{
public int flarePowderTimer = 12;
public static Item FalseLauncher = null;
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Nuke");
Main.projFrames[Projectile.type] = 3;
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 22;
Projectile.height = 22;
Projectile.friendly = true;
Projectile.ignoreWater = true;
Projectile.penetrate = 1;
Projectile.timeLeft = 125;
Projectile.DamageType = DamageClass.Ranged;
}
private static void DefineFalseLauncher()
{
int rocketID = ItemID.RocketLauncher;
FalseLauncher = new Item();
FalseLauncher.SetDefaults(rocketID, true);
}
public override void AI()
{
//Animation
Projectile.frameCounter++;
if (Projectile.frameCounter > 7)
{
Projectile.frame++;
Projectile.frameCounter = 0;
}
if (Projectile.frame > 2)
{
Projectile.frame = 0;
}
//Rotation
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + MathHelper.ToRadians(90) * Projectile.direction;
flarePowderTimer--;
if (flarePowderTimer <= 0)
{
if (Projectile.owner == Main.myPlayer)
{
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<BlissfulBombardierDustProjectile>(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner, 0f, 0f);
}
flarePowderTimer = 12;
}
if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f)
{
float num247 = Projectile.velocity.X * 0.5f;
float num248 = Projectile.velocity.Y * 0.5f;
int num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 1f);
Main.dust[num249].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
Main.dust[num249].velocity *= 0.2f;
Main.dust[num249].noGravity = true;
num249 = Dust.NewDust(new Vector2(Projectile.position.X + 3f + num247, Projectile.position.Y + 3f + num248) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, 244, 0f, 0f, 100, default, 0.5f);
Main.dust[num249].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
Main.dust[num249].velocity *= 0.05f;
}
// Construct a fake item to use with vanilla code for the sake of picking ammo.
if (FalseLauncher is null)
DefineFalseLauncher();
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
if (projID == ProjectileID.DryRocket || projID == ProjectileID.WetRocket || projID == ProjectileID.LavaRocket || projID == ProjectileID.HoneyRocket)
{
Projectile.ignoreWater = false;
if (Projectile.wet)
Projectile.timeLeft = 1;
}
}
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
}
public override void OnHitPvp(Player target, int damage, bool crit)
{
target.AddBuff(ModContent.BuffType<HolyFlames>(), 300);
}
public override void Kill(int timeLeft)
{
Projectile.ExpandHitboxBy(192);
Projectile.maxPenetrate = -1;
Projectile.penetrate = -1;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.Damage();
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
for (int i = 0; i < 40; i++)
{
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f);
Main.dust[idx].velocity *= 3f;
if (Main.rand.NextBool(2))
{
Main.dust[idx].scale = 0.5f;
Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
}
}
for (int i = 0; i < 60; i++)
{
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 3f);
Main.dust[idx].noGravity = true;
Main.dust[idx].velocity *= 5f;
idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 244, 0f, 0f, 100, default, 2f);
Main.dust[idx].velocity *= 2f;
}
if (Main.netMode != NetmodeID.Server)
{
Vector2 goreSource = Projectile.Center;
int goreAmt = 10;
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;
}
}
// Construct a fake item to use with vanilla code for the sake of picking ammo.
if (FalseLauncher is null)
DefineFalseLauncher();
Player player = Main.player[Projectile.owner];
int projID = ProjectileID.RocketI;
float shootSpeed = 0f;
int damage = 0;
float kb = 0f;
player.PickAmmo(FalseLauncher, out projID, out shootSpeed, out damage, out kb, out _, true);
int blastRadius = 0;
if (projID == ProjectileID.RocketII || projID == ProjectileID.ClusterRocketII)
blastRadius = 6;
else if (projID == ProjectileID.RocketIV)
blastRadius = 12;
else if (projID == ProjectileID.MiniNukeRocketII)
blastRadius = 18;
Projectile.ExpandHitboxBy(22);
if (Projectile.owner == Main.myPlayer && blastRadius > 0)
{
CalamityUtils.ExplodeandDestroyTiles(Projectile, blastRadius, true, new List<int>() { }, new List<int>() { });
}
if (Projectile.owner == Main.myPlayer)
{
Point center = Projectile.Center.ToTileCoordinates();
DelegateMethods.v2_1 = center.ToVector2();
DelegateMethods.f_1 = 4f;
if (projID == ProjectileID.DryRocket)
{
DelegateMethods.f_1 = 4.5f;
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry);
}
else if (projID == ProjectileID.WetRocket)
{
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater);
}
else if (projID == ProjectileID.LavaRocket)
{
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava);
}
else if (projID == ProjectileID.HoneyRocket)
{
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney);
}
}
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
}
}