The Hive Rework REAL
This commit is contained in:
1 parent
c5d9ab1ea4
commit
6400350d58
27 files changed
+628
-348
No files matched your search
@@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.damage = 60;
|
||||
Item.damage = 400;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.useTime = Item.useAnimation = OriginalUseTime;
|
||||
Item.shoot = ProjectileType<TheHiveHoldout>();
|
||||
|
||||
@@ -1250,8 +1250,9 @@ TheHive: {
|
||||
DisplayName: The Hive
|
||||
Tooltip:
|
||||
'''
|
||||
Launches a variety of rockets that explode into friendly bees
|
||||
Rockets will destroy tiles with tile-destroying ammo
|
||||
Launches a wide spread of 4 missiles that explode on contact with enemies and tiles
|
||||
Charging the launcher decreases the spread and increases the velocity of the missile barrage
|
||||
Fully charging the launcher will cause it to fire a nuke to decimate a massive area on impact
|
||||
'''
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ HeavenlyGaleProj.DisplayName: Heavenly Gale
|
||||
HighExplosivePeanutShell.DisplayName: High Explosive Peanut Shell
|
||||
HiveBomb.DisplayName: Hive Bomb
|
||||
HiveMissile.DisplayName: Hive Missile
|
||||
HiveNuke.DisplayName: Hive Nuke
|
||||
HolyFireBulletProj.DisplayName: Holy Fire Bullet
|
||||
HydraHead.DisplayName: Hydra Head
|
||||
HydraHeadLaunch.DisplayName: Hydra Head
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.CalamityUtils;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CustomPulse : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public bool UseAltVisual = true;
|
||||
public override bool UseAdditiveBlend => UseAltVisual;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
private string NewTexture;
|
||||
private float OriginalScale;
|
||||
private float FinalScale;
|
||||
private float opacity;
|
||||
private Vector2 Squish;
|
||||
private Color BaseColor;
|
||||
|
||||
public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
BaseColor = color;
|
||||
NewTexture = texture;
|
||||
OriginalScale = originalScale;
|
||||
FinalScale = finalScale;
|
||||
Scale = originalScale;
|
||||
Lifetime = lifeTime;
|
||||
Squish = squish;
|
||||
Rotation = rotation;
|
||||
UseAltVisual = UseAdditiveBlend;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
|
||||
Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress);
|
||||
|
||||
opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2);
|
||||
|
||||
Color = BaseColor * opacity;
|
||||
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
|
||||
Velocity *= 0.95f;
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>(NewTexture).Value;
|
||||
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -1,191 +0,0 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class HiveBomb : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
private ref float RocketType => ref Projectile.ai[0];
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 95;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
float halfX = 0f;
|
||||
float halfY = 0f;
|
||||
if (i == 1)
|
||||
{
|
||||
halfX = Projectile.velocity.X * 0.5f;
|
||||
halfY = Projectile.velocity.Y * 0.5f;
|
||||
}
|
||||
int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
|
||||
Main.dust[dust].velocity *= 0.2f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f);
|
||||
Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust].velocity *= 0.05f;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f)
|
||||
{
|
||||
Projectile.velocity *= 1.1f;
|
||||
}
|
||||
else if (Main.rand.NextBool())
|
||||
{
|
||||
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust2].noGravity = true;
|
||||
Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
|
||||
Main.rand.Next(2);
|
||||
dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust2].noGravity = true;
|
||||
Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90);
|
||||
|
||||
if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket)
|
||||
{
|
||||
if (Projectile.wet)
|
||||
Projectile.timeLeft = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType)
|
||||
{
|
||||
smallRadius = 4,
|
||||
mediumRadius = 7,
|
||||
largeRadius = 10
|
||||
};
|
||||
int blastRadius = Projectile.RocketBehavior(info);
|
||||
Projectile.ExpandHitboxBy(64);
|
||||
Projectile.Damage();
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int j = 0; j < 6; j++)
|
||||
{
|
||||
if (j % 2 != 1 || Main.rand.NextBool(3))
|
||||
{
|
||||
Vector2 projPos = Projectile.position;
|
||||
Vector2 projVel = Projectile.oldVelocity;
|
||||
projVel.Normalize();
|
||||
projVel *= 8f;
|
||||
float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f;
|
||||
float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f;
|
||||
projPos -= projVel * (float)j;
|
||||
beeVelX += Projectile.oldVelocity.X / 6f;
|
||||
beeVelY += Projectile.oldVelocity.Y / 6f;
|
||||
int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 3), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer);
|
||||
if (bee.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[bee].penetrate = 2;
|
||||
Main.projectile[bee].DamageType = DamageClass.Ranged;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[dusty].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[dusty].scale = 0.5f;
|
||||
Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 30; j++)
|
||||
{
|
||||
int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[dusty2].noGravity = true;
|
||||
Main.dust[dusty2].velocity *= 5f;
|
||||
dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemEmerald, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[dusty2].velocity *= 2f;
|
||||
}
|
||||
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
Vector2 goreSource = Projectile.Center;
|
||||
int goreAmt = 3;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
target.AddBuff(ModContent.BuffType<Plague>(), 180);
|
||||
}
|
||||
}
|
||||
}
|
||||
+106
-139
@@ -1,74 +1,94 @@
|
||||
using System;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.Projectiles.Ranged.TheHiveHoldout;
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class HiveMissile : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
private ref float RocketType => ref Projectile.ai[0];
|
||||
public ref float RocketID => ref Projectile.ai[0];
|
||||
public ref float ProjectileSpeed => ref Projectile.ai[1];
|
||||
public ref float Time => ref Projectile.ai[2];
|
||||
public bool HasHit = false;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 14;
|
||||
Projectile.height = 14;
|
||||
Projectile.scale = 0.75f;
|
||||
Projectile.width = 25;
|
||||
Projectile.height = 25;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 95;
|
||||
Projectile.timeLeft = 100;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 2;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
if (Math.Abs(Projectile.velocity.X) >= 8f || Math.Abs(Projectile.velocity.Y) >= 8f)
|
||||
// Rotates towards its velocity.
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
HasHit = true;
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
Time++;
|
||||
|
||||
if (Projectile.timeLeft <= 50)
|
||||
{
|
||||
Projectile.velocity *= 0.965f;
|
||||
if (Time % 5 == 0)
|
||||
{
|
||||
float halfX = 0f;
|
||||
float halfY = 0f;
|
||||
if (i == 1)
|
||||
{
|
||||
halfX = Projectile.velocity.X * 0.5f;
|
||||
halfY = Projectile.velocity.Y * 0.5f;
|
||||
}
|
||||
int dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Torch, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust].scale *= 2f + (float)Main.rand.Next(10) * 0.1f;
|
||||
Main.dust[dust].velocity *= 0.2f;
|
||||
Main.dust[dust].noGravity = true;
|
||||
dust = Dust.NewDust(new Vector2(Projectile.position.X + 3f + halfX, Projectile.position.Y + 3f + halfY) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.Smoke, 0f, 0f, 100, default, 0.5f);
|
||||
Main.dust[dust].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust].velocity *= 0.05f;
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 3.5f, Main.rand.NextBool(3) ? DustEffectsID : 303, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f), 0, default, Main.rand.NextFloat(0.5f, 0.9f));
|
||||
dust.noGravity = false;
|
||||
if (dust.type != DustEffectsID)
|
||||
dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
}
|
||||
if (Math.Abs(Projectile.velocity.X) < 15f && Math.Abs(Projectile.velocity.Y) < 15f)
|
||||
{
|
||||
Projectile.velocity *= 1.5f;
|
||||
}
|
||||
else if (Main.rand.NextBool())
|
||||
{
|
||||
int dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust2].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust2].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust2].noGravity = true;
|
||||
Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
|
||||
Main.rand.Next(2);
|
||||
dust2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f);
|
||||
Main.dust[dust2].scale = 1f + (float)Main.rand.Next(5) * 0.1f;
|
||||
Main.dust[dust2].noGravity = true;
|
||||
Main.dust[dust2].position = Projectile.Center + new Vector2(0f, (float)(-(float)Projectile.height / 2 - 6)).RotatedBy((double)Projectile.rotation, default) * 1.1f;
|
||||
}
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(90);
|
||||
|
||||
if (RocketType == ItemID.DryRocket || RocketType == ItemID.WetRocket || RocketType == ItemID.LavaRocket || RocketType == ItemID.HoneyRocket)
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
// The projectile will fade away as its time alive is ending.
|
||||
Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 40f, 0f, 0f, 255f);
|
||||
|
||||
if (Time % 3 == 0)
|
||||
{
|
||||
if (Projectile.wet)
|
||||
Projectile.timeLeft = 1;
|
||||
Dust trailDust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool() ? 303 : DustEffectsID, Scale: Main.rand.NextFloat(0.3f, 0.6f));
|
||||
trailDust.noGravity = true;
|
||||
trailDust.noLight = true;
|
||||
trailDust.noLightEmittence = true;
|
||||
trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.8f);
|
||||
if (trailDust.type != DustEffectsID)
|
||||
trailDust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
if (Time > 5f)
|
||||
{
|
||||
float sizeBonus = Projectile.timeLeft < 30 ? Time * 0.003f : 0;
|
||||
Color smokeColor = Color.Lerp(Color.Black, Color.Lime, 0.25f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity.RotatedByRandom(sizeBonus) * Main.rand.NextFloat(0.2f, 0.6f), smokeColor * 0.65f, 6, Main.rand.NextFloat(0.3f, 0.45f) + sizeBonus, 0.23f - (sizeBonus * 0.3f), Main.rand.NextFloat(-0.2f, 0.2f), false);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 2.5f, 303, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.05f, 0.4f), 0, default, Main.rand.NextFloat(0.8f, 1.4f));
|
||||
dust.noGravity = false;
|
||||
dust.color = Color.Black;
|
||||
dust.alpha = Main.rand.Next(90, 220 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.7f);
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
@@ -77,108 +97,55 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
HasHit = true;
|
||||
target.AddBuff(ModContent.BuffType<Plague>(), 90);
|
||||
}
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
HasHit = true;
|
||||
return true;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.numHits > 1)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.8f);
|
||||
if (Projectile.damage < 1)
|
||||
Projectile.damage = 1;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketType)
|
||||
if (HasHit == true)
|
||||
{
|
||||
smallRadius = 5,
|
||||
mediumRadius = 8,
|
||||
largeRadius = 11
|
||||
};
|
||||
int blastRadius = Projectile.RocketBehavior(info);
|
||||
Projectile.ExpandHitboxBy(80);
|
||||
Projectile.Damage();
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4);
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = -0.3f }, Projectile.Center);
|
||||
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int j = 0; j < 3; j++)
|
||||
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID);
|
||||
int blastRadius = (int)(Projectile.RocketBehavior(info) * 0.7f);
|
||||
Projectile.ExpandHitboxBy((float)blastRadius);
|
||||
Projectile.damage = (int)(Projectile.damage * 0.5f);
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.Damage();
|
||||
|
||||
Particle blastRing = new CustomPulse(
|
||||
Projectile.Center,
|
||||
Vector2.Zero,
|
||||
StaticEffectsColor * 0.8f,
|
||||
"CalamityMod/Particles/FlameExplosion",
|
||||
Vector2.One,
|
||||
Main.rand.NextFloat(-10, 10),
|
||||
Projectile.width / 22815f,
|
||||
Projectile.width / 2275f,
|
||||
10);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
|
||||
for (int k = 0; k < 15; k++)
|
||||
{
|
||||
if (j % 2 != 1 || Main.rand.NextBool(3))
|
||||
{
|
||||
Vector2 projPos = Projectile.position;
|
||||
Vector2 projVel = Projectile.oldVelocity;
|
||||
projVel.Normalize();
|
||||
projVel *= 8f;
|
||||
float beeVelX = (float)Main.rand.Next(-35, 36) * 0.01f;
|
||||
float beeVelY = (float)Main.rand.Next(-35, 36) * 0.01f;
|
||||
projPos -= projVel * (float)j;
|
||||
beeVelX += Projectile.oldVelocity.X / 6f;
|
||||
beeVelY += Projectile.oldVelocity.Y / 6f;
|
||||
int bee = Projectile.NewProjectile(Projectile.GetSource_FromThis(), projPos.X, projPos.Y, beeVelX, beeVelY, Main.player[Projectile.owner].beeType(), Main.player[Projectile.owner].beeDamage(Projectile.damage / 2), Main.player[Projectile.owner].beeKB(0f), Main.myPlayer);
|
||||
if (bee.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[bee].penetrate = 2;
|
||||
Main.projectile[bee].DamageType = DamageClass.Ranged;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
SoundEngine.PlaySound(SoundID.Item14, Projectile.position);
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
int dusty = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[dusty].velocity *= 3f;
|
||||
if (Main.rand.NextBool())
|
||||
{
|
||||
Main.dust[dusty].scale = 0.5f;
|
||||
Main.dust[dusty].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < 30; j++)
|
||||
{
|
||||
int dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default, 3f);
|
||||
Main.dust[dusty2].noGravity = true;
|
||||
Main.dust[dusty2].velocity *= 5f;
|
||||
dusty2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GemRuby, 0f, 0f, 100, default, 2f);
|
||||
Main.dust[dusty2].velocity *= 2f;
|
||||
}
|
||||
|
||||
if (Main.netMode != NetmodeID.Server)
|
||||
{
|
||||
Vector2 goreSource = Projectile.Center;
|
||||
int goreAmt = 3;
|
||||
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;
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.75f, 0.95f);
|
||||
dust2.noGravity = true;
|
||||
dust2.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,257 @@
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
using CalamityMod.Buffs.DamageOverTime;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Rogue;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.Projectiles.Ranged.TheHiveHoldout;
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class HiveNuke : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public ref float RocketID => ref Projectile.ai[0];
|
||||
public ref float ProjectileSpeed => ref Projectile.ai[1];
|
||||
public bool HasHit = false;
|
||||
public float Time = 0;
|
||||
public bool BonusEffectMode;
|
||||
public bool SetLifetime = false;
|
||||
private Player Owner => Main.player[Projectile.owner];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 20;
|
||||
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
||||
}
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 25;
|
||||
Projectile.height = 25;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 1500;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.extraUpdates = 15;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
BonusEffectMode = Projectile.ai[2] == 2;
|
||||
if (BonusEffectMode)
|
||||
{
|
||||
if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII)
|
||||
{
|
||||
if (!SetLifetime)
|
||||
{
|
||||
Projectile.timeLeft = 60;
|
||||
Projectile.extraUpdates = 0;
|
||||
Projectile.damage = 0;
|
||||
Projectile.alpha = 255;
|
||||
SetLifetime = true;
|
||||
}
|
||||
|
||||
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID);
|
||||
int blastRadius = (int)(Projectile.RocketBehavior(info) * 5f);
|
||||
if (Time % 5 == 0)
|
||||
{
|
||||
Projectile.ExplodeTiles((int)(blastRadius * Utils.Remap(Time, 60f, 1f, 1f, 0f, true)), info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Point center = Projectile.Center.ToTileCoordinates();
|
||||
if (RocketID == ItemID.DryRocket)
|
||||
{
|
||||
DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true);
|
||||
if (Time == 0)
|
||||
{
|
||||
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadDry);
|
||||
}
|
||||
}
|
||||
if (RocketID == ItemID.WetRocket)
|
||||
{
|
||||
DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true);
|
||||
if (Time == 0)
|
||||
{
|
||||
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadWater);
|
||||
}
|
||||
}
|
||||
if (RocketID == ItemID.LavaRocket)
|
||||
{
|
||||
DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true);
|
||||
if (Time == 0)
|
||||
{
|
||||
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadLava);
|
||||
}
|
||||
}
|
||||
if (RocketID == ItemID.HoneyRocket)
|
||||
{
|
||||
DelegateMethods.f_1 = 10.5f * Utils.Remap(Time, 60f, 1f, 1f, 0f, true);
|
||||
if (Time == 0)
|
||||
{
|
||||
Utils.PlotTileArea(center.X, center.Y, DelegateMethods.SpreadHoney);
|
||||
}
|
||||
}
|
||||
}
|
||||
Time++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rotates towards its velocity.
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket)
|
||||
Projectile.Kill();
|
||||
|
||||
Time++;
|
||||
|
||||
if (Projectile.timeLeft <= 30)
|
||||
Projectile.velocity *= 0.95f;
|
||||
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
// The projectile will fade away as its time alive is ending.
|
||||
Projectile.alpha = (int)Utils.Remap(Projectile.timeLeft, 10f, 0f, 0f, 255f);
|
||||
|
||||
if (Time % 3 == 0)
|
||||
{
|
||||
Dust trailDust = Dust.NewDustDirect(Projectile.Center, Projectile.width, Projectile.height, Main.rand.NextBool() ? 303 : DustEffectsID, Scale: Main.rand.NextFloat(0.3f, 0.6f));
|
||||
trailDust.noGravity = true;
|
||||
trailDust.noLight = true;
|
||||
trailDust.noLightEmittence = true;
|
||||
trailDust.velocity = -Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 0.8f);
|
||||
if (trailDust.type != DustEffectsID)
|
||||
trailDust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
if (Time > 5f)
|
||||
{
|
||||
Color smokeColor = Color.Lerp(Color.Black, Color.Lime, 0.25f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center - Projectile.velocity * 2, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f), smokeColor * 0.65f, 9, Main.rand.NextFloat(0.45f, 0.6f), 0.23f, Main.rand.NextFloat(-0.2f, 0.2f), false);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 2.5f, 303, -Projectile.velocity.RotatedByRandom(0.05f) * Main.rand.NextFloat(0.2f, 0.9f), 0, default, Main.rand.NextFloat(0.9f, 1.6f));
|
||||
dust.noGravity = false;
|
||||
dust.color = Color.Black;
|
||||
dust.alpha = Main.rand.Next(90, 220 + 1);
|
||||
}
|
||||
|
||||
Lighting.AddLight(Projectile.Center, StaticEffectsColor.ToVector3() * 0.7f);
|
||||
}
|
||||
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.4f, targetHitbox);
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (BonusEffectMode) { return false; }
|
||||
Texture2D texture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/StarProj").Value;
|
||||
if (Time > 6)
|
||||
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], EffectsColor * 0.4f, 1, texture);
|
||||
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0);
|
||||
return false;
|
||||
}
|
||||
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
||||
{
|
||||
HasHit = true;
|
||||
target.AddBuff(ModContent.BuffType<Plague>(), 60);
|
||||
}
|
||||
public override bool OnTileCollide(Vector2 oldVelocity)
|
||||
{
|
||||
HasHit = true;
|
||||
return true;
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
if (Projectile.numHits > 1)
|
||||
Projectile.damage = (int)(Projectile.damage * 0.90f);
|
||||
if (Projectile.damage < 1)
|
||||
Projectile.damage = 1;
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (HasHit == true && !BonusEffectMode)
|
||||
{
|
||||
if (Main.zenithWorld)
|
||||
{
|
||||
SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 11);
|
||||
SoundEngine.PlaySound(bees with { Volume = 1.5f }, Projectile.Center);
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.35f }, Projectile.Center);
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.9f }, Projectile.Center);
|
||||
}
|
||||
|
||||
Owner.Calamity().GeneralScreenShakePower = 9.5f;
|
||||
|
||||
var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID);
|
||||
int blastRadius = (int)(Projectile.RocketBehavior(info) * 5f);
|
||||
Projectile.ExpandHitboxBy((float)blastRadius);
|
||||
if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType<HiveNuke>(), 0, 0f, Projectile.owner, RocketID, 0f, 2f);
|
||||
Projectile.damage = (int)(Projectile.damage * 0.7f);
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.Damage();
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
{
|
||||
Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, StaticEffectsColor * 0.8f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.width / 22815f, Projectile.width / (2275f + 520 * k), 20 + 4 * k);
|
||||
GeneralParticleHandler.SpawnParticle(blastRing);
|
||||
}
|
||||
|
||||
for (int k = 0; k < 30; k++)
|
||||
{
|
||||
GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f), false, 60, Main.rand.NextFloat(0.8f, 1.4f), StaticEffectsColor, true, true);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
}
|
||||
|
||||
for (int k = 0; k < 45; k++)
|
||||
{
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(3) ? DustEffectsID : 303, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.85f, 1.25f);
|
||||
dust2.noGravity = true;
|
||||
if (dust2.type != DustEffectsID)
|
||||
dust2.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, 303, new Vector2(35, 35).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f), 0, default, Main.rand.NextFloat(0.9f, 1.7f));
|
||||
dust.noGravity = false;
|
||||
dust.color = Color.Black;
|
||||
dust.alpha = Main.rand.Next(90, 220 + 1);
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < (Main.zenithWorld ? 100 : 20); k++)
|
||||
{
|
||||
int BEES = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.2f, 0.8f), ModContent.ProjectileType<PlaguenadeBee>(), (int)(Projectile.damage * 0.1f), 0f, Projectile.owner, 0f, 0f);
|
||||
if (BEES.WithinBounds(Main.maxProjectiles))
|
||||
{
|
||||
Main.projectile[BEES].penetrate = 1;
|
||||
Main.projectile[BEES].DamageType = DamageClass.Ranged;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!BonusEffectMode)
|
||||
{
|
||||
for (int i = 0; i <= 15; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(10, 10) - Projectile.velocity * 3.5f, Main.rand.NextBool(3) ? DustEffectsID : 303, Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.4f, 0.9f), 0, default, Main.rand.NextFloat(0.5f, 0.9f));
|
||||
dust.noGravity = false;
|
||||
if (dust.type != DustEffectsID)
|
||||
dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 535 B After Width: | Height: | Size: 535 B |
@@ -1,8 +1,13 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Mono.Cecil;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
@@ -17,13 +22,23 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override string Texture => "CalamityMod/Items/Weapons/Ranged/TheHive";
|
||||
|
||||
// The type of dust used in the effects and the color of the particles that it'll use depending on the type of rocket used.
|
||||
// It'll carry over to the projectiles that it shoots.
|
||||
public static int DustEffectsID { get; set; }
|
||||
public static Color EffectsColor { get; set; }
|
||||
public static Color StaticEffectsColor = Color.Lime;
|
||||
private ref float ShootingTimer => ref Projectile.ai[0];
|
||||
private bool FireNuke;
|
||||
private float PostFireCooldown = 0;
|
||||
private bool HasLetGo = false;
|
||||
private SlotId HiveHum;
|
||||
|
||||
private ref float OffsetLength => ref Projectile.localAI[0];
|
||||
|
||||
private Player Owner;
|
||||
|
||||
private const float MaxOffsetLength = 15f;
|
||||
private const float MaxCharge = 90f;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -35,14 +50,28 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
FireNuke = ShootingTimer > MaxCharge;
|
||||
Item heldItem = Owner.ActiveItem();
|
||||
|
||||
// If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout.
|
||||
if (Owner.CantUseHoldout() || heldItem.type != ItemType<TheHive>())
|
||||
if (ShootingTimer == 0)
|
||||
{
|
||||
Projectile.Kill();
|
||||
SoundStyle charge = new("CalamityMod/Sounds/Item/LowHum");
|
||||
HiveHum = SoundEngine.PlaySound(charge with { Volume = 1.6f, IsLooped = true }, Projectile.Center);
|
||||
}
|
||||
// If there's no player, or the player is the server, or the owner's stunned, there'll be no holdout.
|
||||
if (Owner.CantUseHoldout() && !HasLetGo || heldItem.type != ItemType<TheHive>())
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying)
|
||||
{
|
||||
hum?.Stop();
|
||||
}
|
||||
ShootRocket(heldItem);
|
||||
NetUpdate();
|
||||
return;
|
||||
HasLetGo = true;
|
||||
}
|
||||
if (HasLetGo)
|
||||
{
|
||||
PostFiringCooldown();
|
||||
}
|
||||
|
||||
// The center of the player, taking into account if they have a mount or not.
|
||||
@@ -54,17 +83,54 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// Deals with the holdout's rotation and direction, the owner's arms, etc.
|
||||
ManageHoldout(ownerPosition, ownerToMouse);
|
||||
|
||||
// If the timer reaches Item.useTime, it'll shoot.
|
||||
// It'll shoot once immediately as the timer reaches.
|
||||
if (ShootingTimer >= heldItem.useAnimation)
|
||||
ShootRocket(heldItem);
|
||||
|
||||
// When we change the distance of the gun from the arms for the recoil,
|
||||
// recover to the original position smoothly.
|
||||
if (OffsetLength != MaxOffsetLength)
|
||||
OffsetLength = MathHelper.Lerp(OffsetLength, MaxOffsetLength, 0.1f);
|
||||
|
||||
ShootingTimer++;
|
||||
if (!HasLetGo)
|
||||
{
|
||||
ShootingTimer++;
|
||||
if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying)
|
||||
{
|
||||
hum.Position = Projectile.Center;
|
||||
hum.Pitch = MathHelper.Lerp(0f, 0.8f, Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true));
|
||||
}
|
||||
}
|
||||
|
||||
// Inside here go all the things that dedicated servers shouldn't spend resources on.
|
||||
// Like visuals and sounds.
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 33f;
|
||||
Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero) * 20;
|
||||
if (ShootingTimer >= MaxCharge && !HasLetGo)
|
||||
{
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
GlowOrbParticle spark = new GlowOrbParticle(tipPosition + Projectile.velocity * 1.5f, Vector2.Zero, false, 2, Main.rand.NextFloat(0.5f, 1.1f), Color.Red);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
for (int e = 0; e < 2; e++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(tipPosition + Projectile.velocity * 1.5f, 90, shootDirection * Main.rand.NextFloat(0.01f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.45f, 0.75f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ShootingTimer == MaxCharge && !HasLetGo)
|
||||
{
|
||||
SoundStyle fullCharge = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGAttackSwitchShort");
|
||||
SoundEngine.PlaySound(fullCharge with { Volume = 0.9f}, Projectile.Center);
|
||||
for (int k = 0; k < 15; k++)
|
||||
{
|
||||
Dust dust2 = Dust.NewDustPerfect(tipPosition, 90, new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 0.8f));
|
||||
dust2.scale = Main.rand.NextFloat(0.85f, 1.15f);
|
||||
dust2.noGravity = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ManageHoldout(Vector2 mountedCenter, Vector2 ownerToMouse)
|
||||
@@ -92,12 +158,18 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
float armRotation = Projectile.rotation - MathHelper.PiOver2; // -Pi/2 because the arms rotation starts with arms pointing down.
|
||||
Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Quarter, armRotation);
|
||||
Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, armRotation + MathHelper.ToRadians(15f) * direction);
|
||||
|
||||
// Rumble (only while channeling)
|
||||
float rumble = Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true) * ShootingTimer >= MaxCharge ? 2 : 0.8f;
|
||||
if (!Owner.CantUseHoldout())
|
||||
Projectile.Center += Main.rand.NextVector2Circular(rumble, rumble);
|
||||
}
|
||||
|
||||
private void ShootRocket(Item item)
|
||||
{
|
||||
// We use the velocity of this projectile as its direction vector.
|
||||
Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero);
|
||||
float VelocityMultiplier = MathHelper.Lerp(0.5f, 1.5f, Utils.GetLerpValue(0f, MaxCharge, ShootingTimer, true));
|
||||
|
||||
// The position of the tip of the gun.
|
||||
Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 33f;
|
||||
@@ -106,18 +178,66 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
// With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used.
|
||||
Owner.PickAmmo(item, out _, out float projSpeed, out int damage, out float knockback, out int rocketType);
|
||||
|
||||
// Decides the color of the effects depending on the type of rocket used.
|
||||
switch (rocketType)
|
||||
{
|
||||
case ItemID.WetRocket:
|
||||
DustEffectsID = 45;
|
||||
EffectsColor = Color.RoyalBlue;
|
||||
break;
|
||||
case ItemID.LavaRocket:
|
||||
DustEffectsID = DustID.Torch;
|
||||
EffectsColor = Color.Red;
|
||||
break;
|
||||
case ItemID.HoneyRocket:
|
||||
DustEffectsID = DustID.Honey;
|
||||
EffectsColor = Color.Yellow;
|
||||
break;
|
||||
default:
|
||||
DustEffectsID = 131;
|
||||
EffectsColor = Color.LawnGreen;
|
||||
break;
|
||||
}
|
||||
|
||||
// Spawns the projectile.
|
||||
Projectile.NewProjectileDirect(
|
||||
if (FireNuke)
|
||||
{
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = 0.1f }, Projectile.Center);
|
||||
|
||||
Projectile.NewProjectileDirect(
|
||||
Projectile.GetSource_FromThis(),
|
||||
tipPosition,
|
||||
shootDirection * projSpeed,
|
||||
ProjectileID.None, // TEMPORARY.
|
||||
shootDirection * projSpeed * 0.3f,
|
||||
ProjectileType<HiveNuke>(),
|
||||
damage,
|
||||
knockback,
|
||||
Projectile.owner,
|
||||
rocketType);
|
||||
PostFireCooldown = 75;
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PBGBarrageLaunch");
|
||||
SoundEngine.PlaySound(fire with { Volume = 0.4f, Pitch = 0.7f }, Projectile.Center);
|
||||
|
||||
ShootingTimer = 0f;
|
||||
int numProj = 4;
|
||||
float rotation = MathHelper.ToRadians(MathHelper.Clamp(25 - VelocityMultiplier * 20, 3, 25));
|
||||
for (int i = 0; i < numProj; i++)
|
||||
{
|
||||
Vector2 perturbedSpeed = (shootDirection).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1)));
|
||||
Projectile.NewProjectileDirect(
|
||||
Projectile.GetSource_FromThis(),
|
||||
tipPosition,
|
||||
perturbedSpeed * projSpeed * VelocityMultiplier,
|
||||
ProjectileType<HiveMissile>(),
|
||||
damage / 5,
|
||||
knockback,
|
||||
Projectile.owner,
|
||||
rocketType);
|
||||
}
|
||||
PostFireCooldown = 35;
|
||||
}
|
||||
|
||||
NetUpdate();
|
||||
|
||||
@@ -126,8 +246,59 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
if (FireNuke)
|
||||
{
|
||||
for (int k = 0; k < 10; k++)
|
||||
{
|
||||
float pulseScale = Main.rand.NextFloat(0.35f, 0.55f);
|
||||
DirectionalPulseRing pulse = new DirectionalPulseRing(tipPosition, (shootDirection * 25).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
for (int i = 0; i <= 15; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(tipPosition, Main.rand.NextBool(3) ? DustEffectsID : 303, (shootDirection * 20).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.5f, 1.2f), 0, default, Main.rand.NextFloat(0.5f, 0.9f));
|
||||
dust.noGravity = false;
|
||||
if (dust.type != DustEffectsID)
|
||||
dust.color = Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int k = 0; k < 6; k++)
|
||||
{
|
||||
float pulseScale = Main.rand.NextFloat(0.2f, 0.4f);
|
||||
DirectionalPulseRing pulse = new DirectionalPulseRing(tipPosition, (shootDirection * 20).RotatedByRandom(0.25f) * Main.rand.NextFloat(0.5f, 1.2f), (Main.rand.NextBool(3) ? EffectsColor : StaticEffectsColor) * 0.8f, new Vector2(1, 1), pulseScale - 0.25f, pulseScale, 0f, 20);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
}
|
||||
|
||||
// By decreasing the offset length of the gun from the arms, we give an effect of recoil.
|
||||
OffsetLength -= 8f;
|
||||
OffsetLength -= FireNuke ? 16f : 6f;
|
||||
}
|
||||
private void PostFiringCooldown()
|
||||
{
|
||||
Vector2 tipPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 33f;
|
||||
|
||||
if (PostFireCooldown > 0)
|
||||
{
|
||||
PostFireCooldown--;
|
||||
Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f);
|
||||
Particle smoke = new HeavySmokeParticle(tipPosition, smokeVel, StaticEffectsColor, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(tipPosition, 303, smokeVel.RotatedByRandom(0.1f), 80, default, Main.rand.NextFloat(0.4f, 1.3f));
|
||||
dust.noGravity = false;
|
||||
dust.color = StaticEffectsColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(HiveHum, out var hum) && hum.IsPlaying)
|
||||
{
|
||||
hum?.Stop();
|
||||
}
|
||||
Projectile.Kill();
|
||||
NetUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private void NetUpdate()
|
||||
@@ -150,6 +321,9 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
if (ShootingTimer <= 0)
|
||||
return false;
|
||||
|
||||
Texture2D texture = Request<Texture2D>(Texture).Value;
|
||||
Texture2D glowTexture = Request<Texture2D>(Texture + "_Glow").Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
Names:
|
||||
1 - Aqua
|
||||
2 - CIT
|
||||
3 - Lilac
|
||||
4 - Metarex
|
||||
5 - moonburn
|
||||
6 - Ozzatron
|
||||
7 - Rebecca
|
||||
8 - Shayy
|
||||
9 - StipulatedVenus
|
||||
10 - Xyk
|
||||
11 - Shade
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user