Ice Barrage balance + refactoring
This commit is contained in:
1 parent
47bccca482
commit
7ab76ecb48
4 files changed
+76
-117
No files matched your search
@@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
Item.rare = ModContent.RarityType<DarkBlue>();
|
||||
Item.Calamity().donorItem = true;
|
||||
|
||||
Item.damage = 2250;
|
||||
Item.damage = 2300;
|
||||
Item.knockBack = 6f;
|
||||
Item.useAnimation = Item.useTime = 300;
|
||||
Item.reuseDelay = 60;
|
||||
|
||||
@@ -96,8 +96,8 @@ HellwingBat.DisplayName: Ashen Hellwing
|
||||
HolyFlame.DisplayName: Holy Flame
|
||||
HolyLaser.DisplayName: Holy Laser
|
||||
IceBarrageMain.DisplayName: Ice Barrage
|
||||
IceBlock.DisplayName: Ice Barrage
|
||||
IceBlockIcicle.DisplayName: Ice Barrage
|
||||
IceBlock.DisplayName: Ice Barrage Block
|
||||
IceBlockIcicle.DisplayName: Ice Barrage Icicle
|
||||
IceCluster.DisplayName: Ice Cluster
|
||||
Icicle.DisplayName: Icicle
|
||||
IcicleStaffProj.DisplayName: Furious Icicle
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -11,8 +12,9 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
private int pwidth = 58;
|
||||
private int pheight = 58;
|
||||
private const int pwidth = 58;
|
||||
private const int pheight = 58;
|
||||
private ref float Timer => ref Projectile.ai[0];
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = pwidth;
|
||||
@@ -30,130 +32,99 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
NPC closestTarget = Projectile.Center.ClosestNPCAt(500f, true, true);
|
||||
NPC closestTarget = Projectile.Center.ClosestNPCAt(5000f, true, true);
|
||||
if (closestTarget != null)
|
||||
{
|
||||
Projectile.Center = closestTarget.Center;
|
||||
}
|
||||
|
||||
Projectile.ai[0]++;
|
||||
Projectile.ai[1]++;
|
||||
Timer++;
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
int dustType = Main.rand.NextBool() ? 68 : 67;
|
||||
if (Main.rand.NextBool(4))
|
||||
int dustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod;
|
||||
if (Timer < 140f)
|
||||
{
|
||||
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;
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, dustType, Main.rand.NextVector2Circular(-4f, 4f), 50, default, 1.3f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
int direct = Main.rand.NextBool() ? 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() ? 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;
|
||||
Vector2 dustSpawn = Projectile.position + new Vector2(Main.rand.Next(Projectile.width), Main.rand.Next(Projectile.height));
|
||||
|
||||
Dust dust1 = Dust.NewDustPerfect(dustSpawn, dustType, Vector2.UnitY * 10f * direct, 50, default, 1.3f);
|
||||
dust1.noGravity = true;
|
||||
direct = Main.rand.NextBool() ? 1 : -1;
|
||||
Dust dust2 = Dust.NewDustPerfect(dustSpawn, dustType, Vector2.UnitX * 10f * direct, 50, default, 1.3f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
}
|
||||
if (Projectile.ai[0] < 55)
|
||||
|
||||
if (Timer < 55)
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
int dtype1 = Main.rand.NextBool() ? 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;
|
||||
int auraDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod;
|
||||
Vector2 auraDustPos = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(250f, 270f);
|
||||
Vector2 auraDustSpeed = Vector2.Normalize(Projectile.Center - auraDustPos) * 0.5f;
|
||||
|
||||
Dust auraDust = Dust.NewDustPerfect(auraDustPos, auraDustType, auraDustSpeed, Scale: Main.rand.NextFloat(1.5f, 2f));
|
||||
auraDust.noGravity = true;
|
||||
}
|
||||
}
|
||||
else if (Projectile.ai[0] == 55f)
|
||||
else if (Timer == 55f)
|
||||
{
|
||||
for (int i = 0; i < 270; i++)
|
||||
for (int i = 0; i < 210; i++)
|
||||
{
|
||||
int dtype2 = Main.rand.NextBool() ? 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;
|
||||
int inwardDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod;
|
||||
Vector2 inwardDustPos = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(250f, 270f);
|
||||
Vector2 inwardDustSpeed = Vector2.Normalize(Projectile.Center - inwardDustPos) * Main.rand.NextFloat(8f, 34f);
|
||||
|
||||
Dust inwardDust = Dust.NewDustPerfect(inwardDustPos, inwardDustType, inwardDustSpeed, Scale: Main.rand.NextFloat(1.5f, 2f));
|
||||
inwardDust.noGravity = true;
|
||||
}
|
||||
|
||||
}
|
||||
else if (Projectile.ai[0] == 140f)
|
||||
else if (Timer == 140f)
|
||||
{
|
||||
Vector2 projcenter = Projectile.Center;
|
||||
Projectile.width = 200;
|
||||
Projectile.height = 200;
|
||||
Projectile.Center = projcenter;
|
||||
Projectile.Damage();
|
||||
for (int i = 0; i < 180; i++)
|
||||
|
||||
for (int i = 0; i < 150; i++)
|
||||
{
|
||||
int dtype3 = Main.rand.NextBool() ? 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;
|
||||
int outwardDustType = Main.rand.NextBool() ? DustID.BlueCrystalShard : Main.rand.NextBool(4) ? DustID.Ice : DustID.IceRod;
|
||||
Dust outwardDust = Dust.NewDustPerfect(Projectile.Center, outwardDustType, Main.rand.NextVector2Circular(-18f, 18f), 50, default, 1.5f);
|
||||
outwardDust.noGravity = true;
|
||||
}
|
||||
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;
|
||||
|
||||
// Bottom
|
||||
Vector2 pos1 = new Vector2(Projectile.Center.X, Projectile.Center.Y + (Projectile.height * 0.5f) + 20f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos1, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 0f);
|
||||
// Left
|
||||
Vector2 pos2 = new Vector2(Projectile.Center.X - (Projectile.width * 0.5f) - 20f, Projectile.Center.Y);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos2, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 1f);
|
||||
// Top
|
||||
Vector2 pos3 = new Vector2(Projectile.Center.X, Projectile.Center.Y - (Projectile.height * 0.5f) - 20f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos3, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 2f);
|
||||
// Right
|
||||
Vector2 pos4 = new Vector2(Projectile.Center.X + (Projectile.width * 0.5f) + 20f, Projectile.Center.Y);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos4, Vector2.Zero, ModContent.ProjectileType<IceBlock>(), (int)(Projectile.damage * 0.3f), 5f, Projectile.owner, 3f);
|
||||
}
|
||||
if (Projectile.ai[0] > 90)
|
||||
|
||||
if (Timer > 90)
|
||||
{
|
||||
Projectile.ai[1]++;
|
||||
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));
|
||||
Vector2 spawnPos = Projectile.Center + new Vector2(Main.rand.NextFloat(-200f, 200f), -400f);
|
||||
int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, Vector2.UnitY * 6f, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.05f), 2f, Projectile.owner, 0f, Main.rand.Next(3));
|
||||
if (ice.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[ice].timeLeft = 600;
|
||||
Main.projectile[ice].tileCollide = false;
|
||||
Main.projectile[ice].DamageType = DamageClass.Magic;
|
||||
}
|
||||
Projectile.ai[1] = 0f;
|
||||
@@ -161,16 +132,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
}
|
||||
|
||||
public override bool? CanDamage()
|
||||
{
|
||||
if (Projectile.ai[0] == 140f)
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<GlacialState>(), 60);
|
||||
}
|
||||
public override bool? CanDamage() => Timer == 140f ? null : false;
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<GlacialState>(), 60);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Projectile.alpha = 255;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 60;
|
||||
Projectile.localNPCHitCooldown = 30;
|
||||
Projectile.coldDamage = true;
|
||||
}
|
||||
|
||||
@@ -32,32 +32,29 @@ namespace CalamityMod.Projectiles.Magic
|
||||
if (Projectile.alpha > 20)
|
||||
{
|
||||
Projectile.alpha -= 12;
|
||||
if (Projectile.alpha < 20)
|
||||
Projectile.alpha = 20;
|
||||
}
|
||||
if (Projectile.alpha < 20)
|
||||
{
|
||||
Projectile.alpha = 20;
|
||||
}
|
||||
|
||||
foreach (Projectile proj in Main.ActiveProjectiles)
|
||||
{
|
||||
if (proj.type == ModContent.ProjectileType<IceBarrageMain>() && proj.owner == Main.myPlayer)
|
||||
{
|
||||
Vector2 pos1 = new Vector2(proj.Center.X, proj.Center.Y - (proj.height * 0.5f) - 44f);
|
||||
Vector2 pos2 = new Vector2(proj.Center.X + (proj.width * 0.5f) + 48f, proj.Center.Y);
|
||||
Vector2 pos3 = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 44f);
|
||||
Vector2 pos4 = new Vector2(proj.Center.X - (proj.width * 0.5f) - 49f, proj.Center.Y);
|
||||
// 0 = Bottom, 1 = Left, 2 = Top, 3 = Right
|
||||
// Why is 0 Bottom instead of Top? Hitbox alignment.
|
||||
switch (Projectile.ai[0])
|
||||
{
|
||||
case 0:
|
||||
Projectile.Center = pos1;
|
||||
Projectile.Center = new Vector2(proj.Center.X, proj.Center.Y + (proj.height * 0.5f) + 20f);
|
||||
break;
|
||||
case 1:
|
||||
Projectile.Center = pos2;
|
||||
Projectile.Center = new Vector2(proj.Center.X - (proj.width * 0.5f) - 20f, proj.Center.Y);
|
||||
break;
|
||||
case 2:
|
||||
Projectile.Center = pos3;
|
||||
Projectile.Center = new Vector2(proj.Center.X, proj.Center.Y - (proj.height * 0.5f) - 20f);
|
||||
break;
|
||||
case 3:
|
||||
Projectile.Center = pos4;
|
||||
Projectile.Center = new Vector2(proj.Center.X + (proj.width * 0.5f) + 20f, proj.Center.Y);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -66,13 +63,13 @@ namespace CalamityMod.Projectiles.Magic
|
||||
switch (Projectile.ai[0])
|
||||
{
|
||||
case 1:
|
||||
Projectile.rotation = (MathHelper.Pi * 0.5f);
|
||||
Projectile.rotation = MathHelper.PiOver2;
|
||||
break;
|
||||
case 2:
|
||||
Projectile.rotation = MathHelper.Pi;
|
||||
break;
|
||||
case 3:
|
||||
Projectile.rotation = (MathHelper.Pi * 1.5f);
|
||||
Projectile.rotation = MathHelper.Pi * 1.5f;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user