Implementation
This commit is contained in:
1 parent
364735314a
commit
b14fe2f9c7
12 files changed
+332
-114
No files matched your search
@@ -5,6 +5,7 @@ using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@@ -14,82 +15,48 @@ namespace CalamityMod.Items.Weapons.Magic
|
||||
public class HeliumFlash : ModItem, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Items.Weapons.Magic";
|
||||
internal const float ExplosionDamageMultiplier = 0.125f;
|
||||
internal const float ExplosionDamageMultiplier = 2f;
|
||||
public static readonly SoundStyle Charge = new("CalamityMod/Sounds/Item/HeliumFlashCharge");
|
||||
public static readonly SoundStyle ChargeLoop = new("CalamityMod/Sounds/Item/HeliumFlashFullChargeLoop");
|
||||
internal static readonly int ChargeLoopSoundFrames = 120;
|
||||
public static readonly SoundStyle FullCharge = new("CalamityMod/Sounds/Item/HeliumFlashReady");
|
||||
public static readonly SoundStyle CancelCharge = new("CalamityMod/Sounds/Item/VividClarityBeamAppear") { Volume = 0.5f };
|
||||
public static readonly SoundStyle ChargeFire = new("CalamityMod/Sounds/Item/HeliumFlashFire") { Volume = 1.2f};
|
||||
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
Item.staff[Item.type] = true;
|
||||
}
|
||||
public static int AftershotCooldownFrames = 17;
|
||||
public static int FullChargeFrames = 88;
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Item.width = 112;
|
||||
Item.height = 112;
|
||||
Item.DamageType = DamageClass.Magic;
|
||||
Item.damage = 1800;
|
||||
Item.damage = 3200;
|
||||
Item.knockBack = 9.5f;
|
||||
Item.mana = 40;
|
||||
Item.useAnimation = 40;
|
||||
Item.useTime = 40;
|
||||
Item.useTime = Item.useAnimation = AftershotCooldownFrames;
|
||||
Item.autoReuse = true;
|
||||
Item.noMelee = true;
|
||||
|
||||
Item.channel = true;
|
||||
Item.noUseGraphic = true;
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.UseSound = SoundID.Item73;
|
||||
|
||||
Item.value = CalamityGlobalItem.RarityVioletBuyPrice;
|
||||
Item.rare = ModContent.RarityType<Violet>();
|
||||
|
||||
Item.shoot = ModContent.ProjectileType<VolatileStarcore>();
|
||||
Item.shoot = ModContent.ProjectileType<HeliumFlashHoldout>();
|
||||
Item.shootSpeed = 15f;
|
||||
}
|
||||
|
||||
// Creates dust at the tip of the staff when used.
|
||||
public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0;
|
||||
|
||||
public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true;
|
||||
|
||||
public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
|
||||
{
|
||||
Vector2 dir = velocity;
|
||||
double angle = Math.Atan2(velocity.Y, velocity.X) + MathHelper.PiOver4;
|
||||
dir = dir.SafeNormalize(Vector2.Zero);
|
||||
dir *= 80f * (float)Math.Sqrt(2); // distance to gleaming point on staff
|
||||
Vector2 dustPos = position + dir;
|
||||
|
||||
int dustType = 162;
|
||||
int dustCount = 72;
|
||||
float minSpeed = 4f;
|
||||
float maxSpeed = 11f;
|
||||
float minScale = 0.8f;
|
||||
float maxScale = 1.4f;
|
||||
Vector2 leftVec = new Vector2(-1f, 0f).RotatedBy(angle);
|
||||
Vector2 rightVec = new Vector2(1f, 0f).RotatedBy(angle);
|
||||
Vector2 upVec = new Vector2(0f, -1f).RotatedBy(angle);
|
||||
Vector2 downVec = new Vector2(0f, 1f).RotatedBy(angle);
|
||||
for (int i = 0; i < dustCount; i += 4)
|
||||
{
|
||||
int left = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f);
|
||||
Main.dust[left].position = dustPos;
|
||||
Main.dust[left].velocity = leftVec * Main.rand.NextFloat(minSpeed, maxSpeed);
|
||||
Main.dust[left].scale = Main.rand.NextFloat(minScale, maxScale);
|
||||
Main.dust[left].noGravity = true;
|
||||
|
||||
int right = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f);
|
||||
Main.dust[right].position = dustPos;
|
||||
Main.dust[right].velocity = rightVec * Main.rand.NextFloat(minSpeed, maxSpeed);
|
||||
Main.dust[right].scale = Main.rand.NextFloat(minScale, maxScale);
|
||||
Main.dust[right].noGravity = true;
|
||||
|
||||
int up = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f);
|
||||
Main.dust[up].position = dustPos;
|
||||
Main.dust[up].velocity = upVec * Main.rand.NextFloat(minSpeed, maxSpeed);
|
||||
Main.dust[up].scale = Main.rand.NextFloat(minScale, maxScale);
|
||||
Main.dust[up].noGravity = true;
|
||||
|
||||
int down = Dust.NewDust(dustPos, 1, 1, dustType, 0f, 0f);
|
||||
Main.dust[down].position = dustPos;
|
||||
Main.dust[down].velocity = downVec * Main.rand.NextFloat(minSpeed, maxSpeed);
|
||||
Main.dust[down].scale = Main.rand.NextFloat(minScale, maxScale);
|
||||
Main.dust[down].noGravity = true;
|
||||
}
|
||||
return true;
|
||||
Vector2 spawnPosition = player.RotatedRelativePoint(player.MountedCenter, true);
|
||||
Projectile.NewProjectileDirect(source, spawnPosition, player.Calamity().mouseWorld - spawnPosition, ModContent.ProjectileType<HeliumFlashHoldout>(), damage, knockback, player.whoAmI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,55 @@
|
||||
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 FlameExplosion : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/FlameExplosion";
|
||||
public override bool UseAdditiveBlend => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
private float OriginalScale;
|
||||
private float FinalScale;
|
||||
private float opacity;
|
||||
private Vector2 Squish;
|
||||
private Color BaseColor;
|
||||
|
||||
public FlameExplosion(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, float opacity)
|
||||
{
|
||||
Position = position;
|
||||
Velocity = velocity;
|
||||
BaseColor = color;
|
||||
OriginalScale = originalScale;
|
||||
FinalScale = finalScale;
|
||||
Scale = originalScale;
|
||||
Lifetime = lifeTime;
|
||||
Squish = squish;
|
||||
Rotation = rotation;
|
||||
}
|
||||
|
||||
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>(Texture).Value;
|
||||
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Melee;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using static CalamityMod.Projectiles.Rogue.FinalDawnFlame;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
@@ -12,9 +15,18 @@ namespace CalamityMod.Projectiles.Magic
|
||||
public new string LocalizationCategory => "Projectiles.Magic";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
|
||||
private static int Lifetime = 40;
|
||||
private static float ExplosionRadius = 210.0f;
|
||||
private static float StartDustQuantity = 36f;
|
||||
private static float ExplosionRadius = 500.0f;
|
||||
private static float ParticleRadius = 210.0f;
|
||||
private Player Owner => Main.player[Projectile.owner];
|
||||
public int frameX = 0;
|
||||
public int frameY = 0;
|
||||
private const int horizontalFrames = 5;
|
||||
private const int verticalFrames = 4;
|
||||
public int time = 0;
|
||||
public int currentFrame = 1;
|
||||
private const int frameLength = 2;
|
||||
public bool damageFrame = false;
|
||||
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
@@ -26,56 +38,68 @@ namespace CalamityMod.Projectiles.Magic
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.timeLeft = Lifetime;
|
||||
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = 8;
|
||||
}
|
||||
|
||||
// localAI[0] = frame counter
|
||||
// localAI[1] = dust quantity
|
||||
public override void AI()
|
||||
{
|
||||
// Play sound on frame 1 and initialize dust quantity
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
Projectile.frameCounter++;
|
||||
if (Projectile.frameCounter % frameLength == frameLength - 1)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item74, Projectile.Center);
|
||||
SoundEngine.PlaySound(SoundID.Item88, Projectile.Center);
|
||||
Projectile.localAI[1] = StartDustQuantity;
|
||||
currentFrame++;
|
||||
|
||||
frameY++;
|
||||
if (frameY >= verticalFrames)
|
||||
{
|
||||
frameX++;
|
||||
frameY = 0;
|
||||
}
|
||||
if (frameX >= horizontalFrames)
|
||||
{
|
||||
Projectile.Kill();
|
||||
}
|
||||
}
|
||||
|
||||
// Pure dust projectile
|
||||
DrawProjectile();
|
||||
|
||||
// Increment frame counter
|
||||
Projectile.localAI[0] += 1f;
|
||||
}
|
||||
|
||||
private void DrawProjectile()
|
||||
{
|
||||
// Taper down the dust amount for the last bit of the projectile's life
|
||||
if (Projectile.localAI[0] >= Lifetime - 15)
|
||||
Projectile.localAI[1] -= 1f;
|
||||
|
||||
int dustCount = (int)Projectile.localAI[1];
|
||||
for (int i = 0; i < dustCount; ++i)
|
||||
if (currentFrame == 15)
|
||||
damageFrame = true;
|
||||
else
|
||||
damageFrame = false;
|
||||
if (currentFrame <= 8)
|
||||
{
|
||||
int dustType = Main.rand.NextBool(3) ? 262 : 87;
|
||||
float scale = Main.rand.NextFloat(2.0f, 2.5f);
|
||||
float randX = Main.rand.NextFloat(-30f, 30f);
|
||||
float randY = Main.rand.NextFloat(-30f, 30f);
|
||||
float randVelocity = Main.rand.NextFloat(5f, 24f);
|
||||
float speed = (float)Math.Sqrt((double)(randX * randX + randY * randY));
|
||||
speed = randVelocity / speed;
|
||||
randX *= speed;
|
||||
randY *= speed;
|
||||
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType);
|
||||
Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f);
|
||||
Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f);
|
||||
Main.dust[idx].velocity.X = randX;
|
||||
Main.dust[idx].velocity.Y = randY;
|
||||
Main.dust[idx].scale = scale;
|
||||
Main.dust[idx].noGravity = true;
|
||||
float rotation = Main.rand.NextBool() ? 1f : -1f;
|
||||
float orbScale = MathHelper.Clamp(Utils.GetLerpValue(15, 0, time), 0, 1);
|
||||
Particle orb = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.Red, Color.OrangeRed, 8f * orbScale, 8, rotation, 3);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.AntiqueWhite, 7f * orbScale, 8, rotation, 3);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
}
|
||||
if (currentFrame == 9)
|
||||
{
|
||||
float rotation = Main.rand.NextBool() ? 2.5f : -2.5f;
|
||||
Particle sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.Coral, Color.Orange, 3f, 9, rotation, 2);
|
||||
GeneralParticleHandler.SpawnParticle(sparkle);
|
||||
}
|
||||
if (currentFrame == 15)
|
||||
{
|
||||
Owner.Calamity().GeneralScreenShakePower = 8f;
|
||||
SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HeliumFlashExplodeNoMetal") { Volume = 1.2f }, Projectile.Center);
|
||||
Particle explosion = new PlasmaExplosion(Projectile.Center, Vector2.Zero, Color.OrangeRed, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0006f + 0.1f, 22);
|
||||
GeneralParticleHandler.SpawnParticle(explosion);
|
||||
Particle explosion2 = new PlasmaExplosion(Projectile.Center, Vector2.Zero, Color.DarkOrange, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0004f + 0.1f, Main.rand.Next(15, 21));
|
||||
GeneralParticleHandler.SpawnParticle(explosion2);
|
||||
Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Red, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0030f + 0.1f, Main.rand.Next(18), false);
|
||||
GeneralParticleHandler.SpawnParticle(explosion3);
|
||||
Particle explosion4 = new PlasmaExplosion(Projectile.Center, Vector2.Zero, Color.Red, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0006f + 0.1f, 25);
|
||||
GeneralParticleHandler.SpawnParticle(explosion4);
|
||||
Particle explosion5 = new FlameExplosion(Projectile.Center, Vector2.Zero, Color.OrangeRed, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0015f + 0.1f, 25, 1f);
|
||||
GeneralParticleHandler.SpawnParticle(explosion5);
|
||||
Particle explosion6 = new FlameExplosion(Projectile.Center, Vector2.Zero, Color.DarkOrange, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0018f + 0.1f, 25, 1f);
|
||||
GeneralParticleHandler.SpawnParticle(explosion6);
|
||||
Particle explosion7 = new FlameExplosion(Projectile.Center, Vector2.Zero, Color.Red, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ParticleRadius * 0.0021f + 0.1f, 25, 1f);
|
||||
GeneralParticleHandler.SpawnParticle(explosion7);
|
||||
Vector2 randVel = new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f);
|
||||
Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, new Color(57, 46, 115) * 0.9f, Main.rand.Next(25, 35 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.4f);
|
||||
GeneralParticleHandler.SpawnParticle(smoke);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,5 +109,8 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
|
||||
public override bool? CanDamage() => damageFrame ? null : false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.BaseProjectiles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria.ModLoader;
|
||||
using ReLogic.Utilities;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.GameContent;
|
||||
using CalamityMod.Projectiles.Ranged;
|
||||
using System.Reflection.Metadata;
|
||||
|
||||
namespace CalamityMod.Projectiles.Magic
|
||||
{
|
||||
internal class HeliumFlashHoldout : BaseGunHoldoutProjectile
|
||||
{
|
||||
public override int AssociatedItemID => ModContent.ItemType<HeliumFlash>();
|
||||
public override float MaxOffsetLengthFromArm => 60f;
|
||||
public override float BaseOffsetY => 4.5f;
|
||||
public override string Texture => "CalamityMod/Projectiles/Magic/HeliumFlashHoldout";
|
||||
public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitX.RotatedBy(Projectile.rotation) * 24;
|
||||
|
||||
private ref float CurrentChargingFrames => ref Projectile.ai[0];
|
||||
private bool FullyCharged => CurrentChargingFrames >= HeliumFlash.FullChargeFrames;
|
||||
public SlotId HeliumChargeSlot;
|
||||
public static float BulletSpeed = 40f;
|
||||
|
||||
public override void KillHoldoutLogic()
|
||||
{
|
||||
if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type)
|
||||
Projectile.Kill();
|
||||
}
|
||||
|
||||
public override void HoldoutAI()
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(HeliumChargeSlot, out var ChargeSound) && ChargeSound.IsPlaying)
|
||||
ChargeSound.Position = Projectile.Center;
|
||||
|
||||
// Fire if the owner stops channeling or otherwise cannot use the weapon.
|
||||
if (Owner.CantUseHoldout())
|
||||
{
|
||||
KeepRefreshingLifetime = false;
|
||||
|
||||
if (Projectile.ai[1] != 1f)
|
||||
{
|
||||
Projectile.timeLeft = HeliumFlash.AftershotCooldownFrames;
|
||||
|
||||
SoundEngine.PlaySound(HeliumFlash.CancelCharge, Projectile.Center);
|
||||
ChargeSound?.Stop();
|
||||
|
||||
Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed;
|
||||
if (FullyCharged)
|
||||
{
|
||||
SoundEngine.PlaySound(HeliumFlash.ChargeFire, Projectile.Center);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity, ModContent.ProjectileType<VolatileStarcore>(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0);
|
||||
Particle pulse = new CustomPulse(GunTipPosition, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.05f, 22);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
Particle pulse2 = new CustomPulse(GunTipPosition, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.08f, 22);
|
||||
GeneralParticleHandler.SpawnParticle(pulse2);
|
||||
Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero);
|
||||
Particle pulse3 = new GlowSparkParticle(GunTipPosition, shootDirection * 18, false, 6, 0.057f, Color.OrangeRed, new Vector2(1.7f, 0.8f), true);
|
||||
GeneralParticleHandler.SpawnParticle(pulse3);
|
||||
for (int i = 0; i <= 18; i++)
|
||||
{
|
||||
Vector2 sparkVelocity = shootVelocity / 2f;
|
||||
|
||||
float sparkScale1 = Main.rand.NextFloat(0.3f, 0.8f);
|
||||
Vector2 sparkvelocity1 = sparkVelocity.RotatedByRandom(0.45f) * Main.rand.NextFloat(0.5f, 0.7f);
|
||||
SparkParticle spark1 = new SparkParticle(GunTipPosition, sparkvelocity1, false, 40, sparkScale1, Main.rand.NextBool() ? Color.Red : Color.DarkRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark1);
|
||||
|
||||
float sparkScale2 = Main.rand.NextFloat(0.4f, 1f);
|
||||
Vector2 sparkvelocity2 = sparkVelocity.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.9f, 1.6f);
|
||||
SparkParticle spark2 = new SparkParticle(GunTipPosition, sparkvelocity2, false, 40, sparkScale2, Main.rand.NextBool() ? Color.DarkOrange : Color.OrangeRed);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
Projectile.ai[1] = 1f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentChargingFrames++;
|
||||
|
||||
// Sounds
|
||||
if (FullyCharged)
|
||||
{
|
||||
if ((CurrentChargingFrames - HeliumFlash.FullChargeFrames) % HeliumFlash.ChargeLoopSoundFrames == 0)
|
||||
HeliumChargeSlot = SoundEngine.PlaySound(HeliumFlash.ChargeLoop, Projectile.Center);
|
||||
if (Main.rand.NextBool(10))
|
||||
{
|
||||
Particle lightning = new ThunderBoltVFX(() => GunTipPosition, Main.rand.NextFloat(MathHelper.TwoPi), 0.10f, Color.Red, 30, 0);
|
||||
GeneralParticleHandler.SpawnParticle(lightning);
|
||||
}
|
||||
}
|
||||
else if (CurrentChargingFrames == 10)
|
||||
HeliumChargeSlot = SoundEngine.PlaySound(HeliumFlash.Charge, Projectile.Center);
|
||||
|
||||
// Charge-up visuals
|
||||
if (CurrentChargingFrames >= 10)
|
||||
{
|
||||
if (!FullyCharged)
|
||||
{
|
||||
Particle streak = new ManaDrainStreak(Owner, Main.rand.NextFloat(0.06f + (CurrentChargingFrames / 180), 0.08f + (CurrentChargingFrames / 180)), Main.rand.NextVector2CircularEdge(2.5f, 2.5f) * Main.rand.NextFloat(0.3f * CurrentChargingFrames, 0.3f * CurrentChargingFrames), 0f, Color.Red, Color.Orange, 7, GunTipPosition);
|
||||
GeneralParticleHandler.SpawnParticle(streak);
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
Particle lightning = new ThunderBoltVFX(() => GunTipPosition, Main.rand.NextFloat(MathHelper.TwoPi), Main.rand.NextFloat(0.01f + (CurrentChargingFrames / 1200), 0.08f + (CurrentChargingFrames / 1200)), Color.Red, 30, 0);
|
||||
GeneralParticleHandler.SpawnParticle(lightning);
|
||||
}
|
||||
}
|
||||
|
||||
float orbScale = MathHelper.Clamp(CurrentChargingFrames, 0f, HeliumFlash.FullChargeFrames);
|
||||
Particle orb = new GenericBloom(GunTipPosition, Projectile.velocity, Color.OrangeRed, orbScale / 200f, 2);
|
||||
GeneralParticleHandler.SpawnParticle(orb);
|
||||
Particle orb2 = new CritSpark(GunTipPosition, Projectile.velocity, Color.Red, Color.OrangeRed, orbScale / 25f, 2, 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(orb2);
|
||||
}
|
||||
|
||||
// Full charge effects
|
||||
if (CurrentChargingFrames == HeliumFlash.FullChargeFrames)
|
||||
{
|
||||
SoundEngine.PlaySound(HeliumFlash.FullCharge, Projectile.Center);
|
||||
Particle pulse = new DetailedExplosion(GunTipPosition, Vector2.Zero, Color.Red, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, 0.18f, 22, false);
|
||||
GeneralParticleHandler.SpawnParticle(pulse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (SoundEngine.TryGetActiveSound(HeliumChargeSlot, out var ChargeSound))
|
||||
ChargeSound?.Stop();
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = TextureAssets.Projectile[Type].Value;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f);
|
||||
Vector2 rotationPoint = texture.Size() * 0.5f;
|
||||
SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None;
|
||||
|
||||
if (!Owner.CantUseHoldout())
|
||||
{
|
||||
float rumble = MathHelper.Clamp(CurrentChargingFrames, 0f, HeliumFlash.FullChargeFrames);
|
||||
drawPosition += Main.rand.NextVector2Circular(rumble / 25f, rumble / 25f);
|
||||
}
|
||||
|
||||
Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -1,6 +1,9 @@
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Items.Weapons.Magic;
|
||||
using CalamityMod.Items.Weapons.Ranged;
|
||||
using CalamityMod.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Mono.Cecil;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.ID;
|
||||
@@ -37,11 +40,10 @@ namespace CalamityMod.Projectiles.Magic
|
||||
DrawOriginOffsetY = -10;
|
||||
DrawOriginOffsetX = 0;
|
||||
|
||||
// Play sound and set rotation on frame 1
|
||||
// Set rotation on frame 1
|
||||
if (Projectile.localAI[0] == 0f)
|
||||
{
|
||||
Projectile.localAI[0] = 1f;
|
||||
SoundEngine.PlaySound(SoundID.NPCDeath56, Projectile.Center);
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4;
|
||||
}
|
||||
|
||||
@@ -51,7 +53,6 @@ namespace CalamityMod.Projectiles.Magic
|
||||
|
||||
// Lighting and spin
|
||||
Lighting.AddLight(Projectile.Center, 1.8f, 1.6f, 0.5f);
|
||||
Projectile.rotation += 0.11f;
|
||||
|
||||
// Increment frame counter
|
||||
Projectile.localAI[0] += 1f;
|
||||
@@ -65,22 +66,29 @@ namespace CalamityMod.Projectiles.Magic
|
||||
}
|
||||
if (Projectile.frame >= NumAnimationFrames)
|
||||
Projectile.frame = 0;
|
||||
if (Projectile.timeLeft == 239)
|
||||
{
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
Particle lightning = new ThunderBoltVFX(() => Projectile.Center, (Projectile.velocity).ToRotation() - MathHelper.PiOver2, 0.4f, Color.Red, 50, 0);
|
||||
GeneralParticleHandler.SpawnParticle(lightning);
|
||||
}
|
||||
}
|
||||
if (Projectile.timeLeft <= 231)
|
||||
{
|
||||
SparkParticle trail = new SparkParticle(Projectile.Center - Projectile.velocity * 1.8f, -Projectile.velocity * 0.01f, false, 11, 4f, Color.OrangeRed * 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(trail);
|
||||
}
|
||||
if (Projectile.timeLeft <= 220)
|
||||
{
|
||||
SparkParticle spark = new SparkParticle(Projectile.Center + Main.rand.NextVector2Circular(15, 15) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * Main.rand.NextFloat(0.5f, 1.5f), false, 45, 0.9f, Color.Red);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void SpawnDust()
|
||||
{
|
||||
int coreDustCount = 2; //3
|
||||
int coreDustType = 262;
|
||||
for (int i = 0; i < coreDustCount; ++i)
|
||||
{
|
||||
float scale = Main.rand.NextFloat(1.0f, 1.4f);
|
||||
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, coreDustType);
|
||||
Main.dust[idx].velocity *= 0.7f;
|
||||
Main.dust[idx].velocity += Projectile.velocity * 1.4f;
|
||||
Main.dust[idx].scale = scale;
|
||||
Main.dust[idx].noGravity = true;
|
||||
}
|
||||
|
||||
int trailDustCount = 4; //5
|
||||
int trailDustType = 264;
|
||||
for (int i = 0; i < trailDustCount; ++i)
|
||||
|
||||
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