Void Vortex p1
This commit is contained in:
1 parent
9d024f9e26
commit
82c9c2e7cd
3 files changed
+196
-30
No files matched your search
@@ -24,11 +24,11 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
Item.width = 130;
|
||||
Item.height = 130;
|
||||
Item.damage = 110;
|
||||
Item.damage = 90;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.mana = 60;
|
||||
Item.useTime = 80;
|
||||
Item.useAnimation = 80;
|
||||
Item.mana = 30;
|
||||
Item.useTime = 43;
|
||||
Item.useAnimation = 43;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
Item.knockBack = 0f;
|
||||
@@ -44,21 +44,22 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
{
|
||||
int numOrbs = 12;
|
||||
Vector2 clickPos = Main.MouseWorld;
|
||||
float orbDistance = 48f;
|
||||
float orbSpeed = 5f;
|
||||
float orbDistance = 90f;
|
||||
float orbSpeed = 4f;
|
||||
|
||||
float spinCoinflip = Main.rand.NextBool() ? -1f : 1f;
|
||||
Vector2 dir = Main.rand.NextVector2Unit();
|
||||
for (int i = 0; i < numOrbs; i++)
|
||||
{
|
||||
Vector2 orbPos = clickPos + dir * orbDistance;
|
||||
Vector2 vel = dir.RotatedBy(spinCoinflip * MathHelper.PiOver2) * orbSpeed;
|
||||
Vector2 vel = dir.RotatedBy(spinCoinflip * -MathHelper.PiOver2) * orbSpeed;
|
||||
|
||||
// Choose random firing stagger values for each orb to create a desynchronized barrage of lasers
|
||||
float timingStagger = Main.rand.Next(OrbFireRate);
|
||||
Projectile.NewProjectile(source, orbPos, vel, type, damage, knockback, player.whoAmI, timingStagger, spinCoinflip);
|
||||
Projectile.NewProjectile(source, orbPos, -vel, type, damage, knockback, player.whoAmI, i * 4, spinCoinflip);
|
||||
dir = dir.RotatedBy(MathHelper.TwoPi / numOrbs);
|
||||
}
|
||||
// Big orb
|
||||
Projectile.NewProjectile(source, clickPos, Vector2.Zero, type, damage * 9, 10, player.whoAmI, 0, spinCoinflip, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
@@ -9,14 +10,21 @@ namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public float dustAngle = 0f;
|
||||
public bool growing = false;
|
||||
public bool dustWave = false;
|
||||
public float variance;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 4;
|
||||
Projectile.height = 4;
|
||||
Projectile.extraUpdates = 100;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.friendly = true;
|
||||
Projectile.timeLeft = 90;
|
||||
Projectile.timeLeft = 500;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
@@ -24,12 +32,46 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
/*
|
||||
Vector2 projPos = Projectile.position;
|
||||
projPos -= Projectile.velocity * 0.25f;
|
||||
int boltDust = Dust.NewDust(projPos, 1, 1, DustID.UnusedWhiteBluePurple, 0f, 0f, 0, default, 1.25f);
|
||||
Main.dust[boltDust].position = projPos;
|
||||
Main.dust[boltDust].scale = (float)Main.rand.Next(70, 110) * 0.013f;
|
||||
Main.dust[boltDust].velocity *= 0.1f;
|
||||
*/
|
||||
|
||||
if (Projectile.timeLeft == 500)
|
||||
{
|
||||
Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f, 0.2f, 3);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.13f, 0.13f, 3);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
}
|
||||
|
||||
if (Projectile.timeLeft % 3 == 0 && Projectile.timeLeft < 499)
|
||||
{
|
||||
LineParticle spark2 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.8f, Color.Aqua * 0.6f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
LineParticle spark3 = new LineParticle(Projectile.Center, -Projectile.velocity * 0.05f, false, 6, 1.3f, Color.White * 0.6f);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
for (int i = 0; i <= 4; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), 226, Projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f));
|
||||
dust.scale = Main.rand.NextFloat(0.3f, 0.5f);
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Electrified, 90);
|
||||
if (hit.Damage > 1)
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using System;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Mono.Cecil;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
@@ -9,9 +15,16 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public class VoidVortexProj : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public int time = 0;
|
||||
public int timeOffset = 0;
|
||||
public bool doDamage = false;
|
||||
public bool fireBeam = true;
|
||||
public bool rotDirection = false;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Main.projFrames[Projectile.type] = 5;
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 15;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
@@ -22,21 +35,94 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = 135;
|
||||
Projectile.timeLeft = 90;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.DamageType = DamageClass.Magic;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
// Spin chaotically given a pre-defined spin direction. Choose one initially at random.
|
||||
float spinTheta = 0.11f;
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta;
|
||||
Projectile.rotation += Projectile.localAI[0];
|
||||
if (Projectile.ai[2] == 3)
|
||||
{
|
||||
if (time == 0)
|
||||
{
|
||||
timeOffset = Main.rand.Next(20, 40 + 1);
|
||||
Projectile.timeLeft = 500;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.scale = Main.rand.NextFloat(0.35f, 0.55f);
|
||||
rotDirection = Main.rand.NextBool();
|
||||
}
|
||||
|
||||
if (time >= 20)
|
||||
doDamage = true;
|
||||
if (time >= timeOffset && time % 25 == 0)
|
||||
{
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(rotDirection ? 0.65f : -0.65f);
|
||||
rotDirection = !rotDirection;
|
||||
}
|
||||
CalamityUtils.HomeInOnNPC(Projectile, true, 1000f, 15, MathHelper.Clamp(100f - time * 0.3f, 40, 100));
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f));
|
||||
dust2.scale = Main.rand.NextFloat(0.35f, 0.75f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Projectile.timeLeft < 65)
|
||||
{
|
||||
Projectile.velocity *= 0.98f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Spin chaotically given a pre-defined spin direction. Choose one initially at random.
|
||||
float spinTheta = 0.11f;
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
Projectile.localAI[0] = Main.rand.NextBool() ? -spinTheta : spinTheta;
|
||||
//Projectile.rotation += Projectile.localAI[0];
|
||||
|
||||
// Spiral outwards in an increasingly chaotic fashion.
|
||||
float revolutionTheta = 0.14f * Projectile.ai[1];
|
||||
if (Projectile.ai[0] % 2 == 0f)
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f;
|
||||
|
||||
}
|
||||
if (time == 25 && Projectile.ai[2] == 1)
|
||||
{
|
||||
Projectile.scale = 1.5f;
|
||||
Projectile.alpha = 0;
|
||||
for (int k = 0; k < 25; k++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(15, 15).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.45f, 0.95f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
Projectile.ai[0] = 0;
|
||||
}
|
||||
if (time >= 25 && Projectile.ai[2] == 1 && time % 2 == 0 && Projectile.timeLeft > 20)
|
||||
{
|
||||
Particle bolt = new CrackParticle(Projectile.Center, new Vector2(8, 8).RotatedByRandom(100), Color.Aqua * 0.65f, Vector2.One, 0, 0, Main.rand.NextFloat(0.4f, 0.65f), 11);
|
||||
GeneralParticleHandler.SpawnParticle(bolt);
|
||||
}
|
||||
|
||||
--Projectile.ai[0];
|
||||
|
||||
NPC target = Projectile.Center.ClosestNPCAt(1000);
|
||||
|
||||
if (fireBeam && Projectile.ai[0] == -30 && Projectile.ai[2] <= 0 && target != null)
|
||||
{
|
||||
CalamityUtils.MagnetSphereHitscan(Projectile, 1000f, 8f, 0, 2, ModContent.ProjectileType<ClimaxBeam>(), 1D, true);
|
||||
fireBeam = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Animate the lightning orb.
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter > 6)
|
||||
if (Projectile.frameCounter > 3)
|
||||
{
|
||||
Projectile.frameCounter = 0;
|
||||
Projectile.frame++;
|
||||
@@ -46,24 +132,58 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
}
|
||||
|
||||
// Spiral outwards in an increasingly chaotic fashion.
|
||||
float revolutionTheta = 0.12f * Projectile.ai[1];
|
||||
Projectile.velocity = Projectile.velocity.RotatedBy(revolutionTheta) * 1.0092f;
|
||||
if (Projectile.ai[0] <= 0)
|
||||
time++;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.ai[2] == 1)
|
||||
{
|
||||
doDamage = true;
|
||||
Projectile.ExpandHitboxBy(400);
|
||||
Projectile.Damage();
|
||||
|
||||
// Initial stagger in frames needs to be skipped over before it starts shooting,
|
||||
// but once it's past that then it can fire constantly
|
||||
--Projectile.ai[0];
|
||||
if (Projectile.ai[0] < 0f)
|
||||
CalamityUtils.MagnetSphereHitscan(Projectile, 400f, 8f, VoidVortex.OrbFireRate, 2, ModContent.ProjectileType<ClimaxBeam>(), 1D, true);
|
||||
for (int k = 0; k < 12; k++)
|
||||
{
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType<VoidVortexProj>(), Projectile.damage / 8, 0f, Main.myPlayer, 0f, 0f, 3f);
|
||||
}
|
||||
for (int k = 0; k < 40; k++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.65f, 1.15f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/AuricBulletHit");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0f }, Projectile.Center);
|
||||
Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Aqua, "CalamityMod/Particles/PlasmaExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0, 0.2f, 14);
|
||||
GeneralParticleHandler.SpawnParticle(bolt);
|
||||
}
|
||||
if (Projectile.ai[2] == 3)
|
||||
{
|
||||
for (int k = 0; k < 7; k++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 226, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.45f, 0.75f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(BuffID.Electrified, 180);
|
||||
if (hit.Damage > 1 && Projectile.ai[2] == 3)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override Color? GetAlpha(Color lightColor)
|
||||
{
|
||||
if (Projectile.timeLeft < 30)
|
||||
if (Projectile.timeLeft < 20)
|
||||
{
|
||||
float timerAlpha = Projectile.timeLeft / 30f;
|
||||
float timerAlpha = Projectile.timeLeft / 20f;
|
||||
Projectile.alpha = (int)(255f - 255f * timerAlpha);
|
||||
}
|
||||
if (time < 25 && Projectile.ai[2] == 1)
|
||||
Projectile.alpha = 255;
|
||||
return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0);
|
||||
}
|
||||
|
||||
@@ -72,10 +192,13 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value;
|
||||
int framing = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value.Height / Main.projFrames[Projectile.type];
|
||||
int y6 = framing * Projectile.frame;
|
||||
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale, SpriteEffects.None, 0);
|
||||
Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture2D13.Width / 2f, framing / 2f), Projectile.scale * (Projectile.ai[2] == 3 ? 1.3f : 1f), SpriteEffects.None, 0);
|
||||
|
||||
if (Projectile.ai[2] == 3)
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor * 0.3f, 1, texture2D13);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool? CanDamage() => false;
|
||||
public override bool? CanDamage() => doDamage ? null : false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user