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.
181 lines
8.8 KiB
C#
181 lines
8.8 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
using Terraria.ID;
|
|
using CalamityMod.Buffs.StatDebuffs;
|
|
|
|
namespace CalamityMod.Projectiles.Magic
|
|
{
|
|
public class IceBarrageMain : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
|
|
private int pwidth = 58;
|
|
private int pheight = 58;
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Ice Barrage");
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = pwidth;
|
|
Projectile.height = pheight;
|
|
Projectile.friendly = true;
|
|
Projectile.tileCollide = false;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.timeLeft = 280;
|
|
Projectile.penetrate = -1;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = 10;
|
|
Projectile.coldDamage = true;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
NPC closestTarget = Projectile.Center.ClosestNPCAt(500f, true, true);
|
|
if (closestTarget != null)
|
|
{
|
|
Projectile.Center = closestTarget.Center;
|
|
}
|
|
|
|
Projectile.ai[0]++;
|
|
Projectile.ai[1]++;
|
|
for (int j = 0; j < 3; j++)
|
|
{
|
|
int dustType = Main.rand.NextBool(2) ? 68 : 67;
|
|
if (Main.rand.NextBool(4))
|
|
{
|
|
dustType = 80;
|
|
}
|
|
if (Projectile.ai[0] < 140f)
|
|
{
|
|
Vector2 direction = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-4f, 4f));
|
|
int dust = Dust.NewDust(Projectile.Center, 1, 1, dustType, direction.X, direction.Y, 50, default, 1.3f);
|
|
Main.dust[dust].noGravity = true;
|
|
}
|
|
else
|
|
{
|
|
int direct = Main.rand.NextBool(2) ? 1 : -1;
|
|
Vector2 dir1 = new Vector2(0f, 10f) * direct;
|
|
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir1.X, dir1.Y, 50, default, 1.3f);
|
|
Main.dust[dust1].noGravity = true;
|
|
Main.dust[dust1].velocity = dir1;
|
|
int direct2 = Main.rand.NextBool(2) ? 1 : -1;
|
|
Vector2 dir2 = new Vector2(10f, 0f) * direct2;
|
|
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, dir2.X, dir2.Y, 50, default, 1.3f);
|
|
Main.dust[dust2].noGravity = true;
|
|
Main.dust[dust2].velocity = dir2;
|
|
}
|
|
}
|
|
if (Projectile.ai[0] < 55)
|
|
{
|
|
for (int i = 0; i < 10; i++)
|
|
{
|
|
int dtype1 = Main.rand.NextBool(2) ? 68 : 67;
|
|
if (Main.rand.NextBool(4))
|
|
{
|
|
dtype1 = 80;
|
|
}
|
|
Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360)));
|
|
Vector2 Dspeed = Projectile.Center - Dpos;
|
|
Dspeed.Normalize();
|
|
Dspeed *= 0.5f;
|
|
float Dscale = Main.rand.NextFloat(1.5f, 2f);
|
|
int d1 = Dust.NewDust(Dpos, 1, 1, dtype1, Dspeed.X, Dspeed.Y, 0, default, Dscale);
|
|
Main.dust[d1].velocity = Dspeed;
|
|
Main.dust[d1].noGravity = true;
|
|
}
|
|
}
|
|
else if (Projectile.ai[0] == 55f)
|
|
{
|
|
for (int i = 0; i < 270; i++)
|
|
{
|
|
int dtype2 = Main.rand.NextBool(2) ? 68 : 67;
|
|
if (Main.rand.NextBool(4))
|
|
{
|
|
dtype2 = 80;
|
|
}
|
|
Vector2 Dpos = Projectile.Center + new Vector2(Main.rand.NextFloat(250f, 270f), Main.rand.NextFloat(250f, 270f)).RotatedBy(MathHelper.ToRadians(Main.rand.Next(1, 360)));
|
|
Vector2 Dspeed = Projectile.Center - Dpos;
|
|
Dspeed.Normalize();
|
|
Dspeed *= Main.rand.NextFloat(8f,34f);
|
|
float Dscale = Main.rand.NextFloat(1.5f, 2f);
|
|
int d1 = Dust.NewDust(Dpos, 1, 1, dtype2, Dspeed.X, Dspeed.Y, 0, default, Dscale);
|
|
Main.dust[d1].velocity = Dspeed;
|
|
Main.dust[d1].noGravity = true;
|
|
}
|
|
|
|
}
|
|
else if (Projectile.ai[0] == 140f)
|
|
{
|
|
Vector2 projcenter = Projectile.Center;
|
|
Projectile.width = 200;
|
|
Projectile.height = 200;
|
|
Projectile.Center = projcenter;
|
|
Projectile.Damage();
|
|
for (int i = 0; i < 180; i++)
|
|
{
|
|
int dtype3 = Main.rand.NextBool(2) ? 68 : 67;
|
|
if (Main.rand.NextBool(4))
|
|
{
|
|
dtype3 = 80;
|
|
}
|
|
Vector2 explosiondir = new Vector2(Main.rand.NextFloat(-18f, 18f), Main.rand.NextFloat(-18f, 18f));
|
|
int d2 = Dust.NewDust(Projectile.Center, 1, 1, dtype3, explosiondir.X, explosiondir.Y, 50, default, 1.5f);
|
|
Main.dust[d2].noGravity = true;
|
|
}
|
|
for (int k = 0; k < 45; k++)
|
|
{
|
|
Vector2 projspeed = new Vector2(Main.rand.NextFloat(-8f, 8f), Main.rand.NextFloat(-8f, 8f));
|
|
int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3));
|
|
Main.projectile[ice].timeLeft = 600;
|
|
Main.projectile[ice].DamageType = DamageClass.Magic;
|
|
}
|
|
Projectile.width = pwidth;
|
|
Projectile.height = pheight;
|
|
Projectile.Center = projcenter;
|
|
Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 44f);
|
|
int block1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos1, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f, 0f);
|
|
Main.projectile[block1].Center = pos1;
|
|
Vector2 pos2 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 48f, Projectile.Center.Y);
|
|
int block2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos2, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f, 0f);
|
|
Main.projectile[block2].Center = pos2;
|
|
Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 44f);
|
|
int block3 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos3, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f, 0f);
|
|
Main.projectile[block3].Center = pos3;
|
|
Vector2 pos4 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 49f, Projectile.Center.Y);
|
|
int block4 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos4, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f, 0f);
|
|
Main.projectile[block4].Center = pos4;
|
|
}
|
|
if (Projectile.ai[0] > 90)
|
|
{
|
|
if (Projectile.ai[1] >= 5f)
|
|
{
|
|
Vector2 projspeed = new Vector2(Main.rand.NextFloat(-5f, 5f), Main.rand.NextFloat(-5f, 5f));
|
|
int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, projspeed, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, (float)Main.rand.Next(3));
|
|
if (ice.WithinBounds(Main.maxProjectiles))
|
|
{
|
|
Main.projectile[ice].timeLeft = 600;
|
|
Main.projectile[ice].DamageType = DamageClass.Magic;
|
|
}
|
|
Projectile.ai[1] = 0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool? CanDamage()
|
|
{
|
|
if (Projectile.ai[0] == 140f)
|
|
return null;
|
|
return false;
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<GlacialState>(), 60);
|
|
}
|
|
}
|
|
}
|